Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge in trunk |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | cmake-ide |
Files: | files | file ages | folders |
SHA3-256: |
4d8aecdfcf0ca35853f765393771cf6d |
User & Date: | ashepilko 2020-01-09 17:57:18.655 |
Context
2020-01-09
| ||
18:26 | Add the debug and autoconfig compile definitions; needed for source browsing. ... (check-in: fabe2d41 user: ashepilko tags: cmake-ide) | |
17:57 | Merge in trunk ... (check-in: 4d8aecdf user: ashepilko tags: cmake-ide) | |
2020-01-08
| ||
19:18 | Clarified point 2.2 of fossil-v-git.wiki, adding more info about the sizes of Fossil vs Git in response to comments on this Hacker News posting: https://news.ycombinator.com/item?id=21974942 ... (check-in: 9dcb3de4 user: wyoung tags: trunk) | |
2018-09-19
| ||
21:00 | Add docs on using IDE for Fossil development. ... (check-in: 7d2be6f8 user: ashepilko tags: cmake-ide) | |
Changes
Added .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 Dockerfile.
1 2 3 | ### # Dockerfile for Fossil ### | | | 1 2 3 4 5 6 7 8 9 10 11 | ### # Dockerfile for Fossil ### FROM fedora:29 ### 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 ### If you want to build "trunk", change the next line accordingly. ENV FOSSIL_INSTALL_VERSION release |
︙ | ︙ |
Changes to Makefile.classic.
︙ | ︙ | |||
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 | #### 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) #### Extra arguments for linking the finished binary. Fossil needs # 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.$(FOSSIL_ENABLE_MINIZ)) $(LDFLAGS) # If using HTTPS: LIB += -lcrypto -lssl #### 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 # You should not need to change anything below this line | > > > > > > > > > > > > | 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 | #### 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 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.$(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 # You should not need to change anything below this line |
︙ | ︙ |
Changes to Makefile.in.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H INSTALLDIR = $(DESTDIR)@prefix@/bin USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ USE_LINENOISE = @USE_LINENOISE@ USE_MMAN_H = @USE_MMAN_H@ USE_SEE = @USE_SEE@ FOSSIL_ENABLE_MINIZ = @FOSSIL_ENABLE_MINIZ@ include $(SRCDIR)/main.mk distclean: clean -rm -f autoconfig.h config.log Makefile reconfig: | > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H INSTALLDIR = $(DESTDIR)@prefix@/bin USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ USE_LINENOISE = @USE_LINENOISE@ USE_MMAN_H = @USE_MMAN_H@ USE_SEE = @USE_SEE@ FOSSIL_ENABLE_MINIZ = @FOSSIL_ENABLE_MINIZ@ APPNAME = fossil include $(SRCDIR)/main.mk distclean: clean -rm -f autoconfig.h config.log Makefile reconfig: |
︙ | ︙ |
Changes to Makefile.osx-jaguar.
︙ | ︙ | |||
36 37 38 39 40 41 42 | # BCC = cc BCCFLAGS = $(CFLAGS) #### The suffix to add to final executable file. When cross-compiling # to windows, make this ".exe". Otherwise leave it blank. # | | | | 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 = 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_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 |
Added 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 | 2.11 |
Changes to auto.def.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # System autoconfiguration. Try: ./configure --help 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-exec-rel-paths=0 => {Enable relative paths for external diff/gdiff} 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"} | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # System autoconfiguration. Try: ./configure --help 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-exec-rel-paths=0 => {Enable relative paths for external diff/gdiff} with-legacy-mv-rm=1 => {Enable legacy behavior for mv/rm (skip checkout files)} with-sanitizer: => {Build with C compiler's -fsanitize=LIST; e.g. address,enum,null,undefined} 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"} |
︙ | ︙ | |||
48 49 50 51 52 53 54 | # 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"] | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # 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}]} { 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 |
︙ | ︙ | |||
114 115 116 117 118 119 120 | } else { msg-result "no" } return $found } if {![opt-bool internal-sqlite]} { | | | | < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | } else { msg-result "no" } return $found } if {![opt-bool internal-sqlite]} { proc find_system_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 # fossil. # if {[check-function-in-lib sqlite3_open sqlite3 $extralibs]} { # 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 proc test_system_sqlite {} { # Check compatibility of the system SQLite library by running the sqlcompttest.c # program in the source tree # set cmdline {} lappend cmdline {*}[get-define CCACHE] lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS] lappend cmdline $::autosetup(dir)/../src/sqlcompattest.c -o conftest__ lappend cmdline {*}[get-define LDFLAGS] lappend cmdline {*}[get-define LIBS] 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 {$err} { user-error $result } file delete ./conftest__ } test_system_sqlite } proc is_mingw {} { return [string match *mingw* [get-define host]] } if {[is_mingw]} { |
︙ | ︙ | |||
511 512 513 514 515 516 517 | 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 } } | > > > > > > > > > > > > > > > > | > > | 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 | 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 } } # The SMTP module requires special libraries and headers for MX DNS # record lookups and such. cc-check-includes arpa/nameser.h cc-include-needs bind/resolv.h netinet/in.h cc-check-includes bind/resolv.h cc-check-includes resolv.h if { !(([cc-check-function-in-lib dn_expand resolv] || [cc-check-function-in-lib ns_name_uncompress {bind resolv}] || [cc-check-function-in-lib __ns_name_uncompress {bind resolv}]) && ([cc-check-function-in-lib ns_parserr {bind resolv}] || [cc-check-function-in-lib __ns_parserr {bind resolv}]) && ([cc-check-function-in-lib res_query {bind resolv}] || [cc-check-function-in-lib __res_query {bind resolv}]))} { msg-result "WARNING: SMTP feature will not be able to look up local MX." } cc-check-function-in-lib res_9_ns_initparse resolv # Other nonstandard function checks cc-check-functions utime cc-check-functions usleep cc-check-functions strchrnul cc-check-functions pledge cc-check-functions backtrace # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE |
︙ | ︙ | |||
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | 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" } } # Finally, append -ldl to make sure it's the last in the list. # The library order matters in case of 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] } make-template Makefile.in make-config-header autoconfig.h -auto {USE_* FOSSIL_*} | > > > > > > > > > > > > > > | 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 | 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" } } # 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 -ldl to make sure it's the last in the list. # The library order matters in case of 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] } 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 | 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/ |
Changes to autosetup/autosetup.
1 2 3 4 5 | #!/bin/sh # Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # vim:se syntax=tcl: # \ | | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/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" "$@" # Note that the version has a trailing + on unreleased versions set autosetup(version) 0.6.9 # Can be set to 1 to debug early-init problems set autosetup(debug) [expr {"--debug" in $argv}] ################################################################## # # Main flow of control, option handling # proc main {argv} { global autosetup define |
︙ | ︙ | |||
70 71 72 73 74 75 76 | set autosetup(argv) $argv set autosetup(cmdline) {} # options is a list of known options set autosetup(options) {} # optset is a dictionary of option values set by the user based on getopt set autosetup(optset) {} | | > > > > > | > > > > > > > > > > > > | | < | | < | | > > > > > > | | | | | | > > > > > | 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 | set autosetup(argv) $argv set autosetup(cmdline) {} # options is a list of known options set autosetup(options) {} # optset is a dictionary of option values set by the user based on getopt set autosetup(optset) {} # optdefault is a dictionary of default values set autosetup(optdefault) {} # options-defaults is a dictionary of overrides for default values for options set autosetup(options-defaults) {} set autosetup(optionhelp) {} set autosetup(showhelp) 0 use util # Parse options use getopt # At the is point we don't know what is a valid option # We simply parse anything that looks like an option set autosetup(getopt) [getopt argv] #"=Core Options:" options-add { help:=local => "display help and options. Optionally specify a module name, such as --help=system" licence license => "display the autosetup license" version => "display the version of autosetup" ref:=text manual:=text reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'" debug => "display debugging output as autosetup runs" install:=. => "install autosetup to the current or given directory" } if {$autosetup(installed)} { # hidden options so we can produce a nice error options-add { sysinstall:path } } else { options-add { sysinstall:path => "install standalone autosetup to the given directory (e.g.: /usr/local)" } } options-add { force init:=help => "create initial auto.def, etc. Use --init=help for known types" # Undocumented options option-checking=1 nopager quiet timing conf: } if {[opt-bool version]} { puts $autosetup(version) exit 0 } # autosetup --conf=alternate-auto.def if {[opt-str conf o]} { set autosetup(autodef) $o } # Debugging output (set this early) incr autosetup(debug) [opt-bool debug] incr autosetup(force) [opt-bool force] incr autosetup(msg-quiet) [opt-bool quiet] incr autosetup(msg-timing) [opt-bool timing] # If the local module exists, source it now to allow for # project-local customisations if {[file exists $autosetup(libdir)/local.tcl]} { use local } # Now any auto-load modules autosetup_load_auto_modules if {[opt-str help o]} { incr autosetup(showhelp) use help autosetup_help $o } if {[opt-bool licence license]} { use help autosetup_show_license exit 0 } if {[opt-str {manual ref reference} o]} { use help autosetup_reference $o } # Allow combining --install and --init set earlyexit 0 if {[opt-str install o]} { use install autosetup_install $o incr earlyexit } if {[opt-str init o]} { use init autosetup_init $o incr earlyexit } if {$earlyexit} { exit 0 } if {[opt-str sysinstall o]} { use install autosetup_install $o 1 exit 0 } if {![file exists $autosetup(autodef)]} { # Check for invalid option first options {} user-error "No auto.def found in \"$autosetup(srcdir)\" (use [file tail $::autosetup(exe)] --init to create one)" } |
︙ | ︙ | |||
183 184 185 186 187 188 189 190 191 192 193 194 195 196 | } define AUTOREMAKE [file-normalize $autosetup(exe)] define-append AUTOREMAKE [get-define CONFIGURE_OPTS] # Log how we were invoked configlog "Invoked as: [getenv WRAPPER $::argv0] [quote-argv $autosetup(argv)]" # Note that auto.def is *not* loaded in the global scope source $autosetup(autodef) # Could warn here if options {} was not specified show-notices | > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | } define AUTOREMAKE [file-normalize $autosetup(exe)] define-append AUTOREMAKE [get-define CONFIGURE_OPTS] # Log how we were invoked configlog "Invoked as: [getenv WRAPPER $::argv0] [quote-argv $autosetup(argv)]" configlog "Tclsh: [info nameofexecutable]" # Note that auto.def is *not* loaded in the global scope source $autosetup(autodef) # Could warn here if options {} was not specified show-notices |
︙ | ︙ | |||
208 209 210 211 212 213 214 | # @opt-bool ?-nodefault? option ... # # Check each of the named, boolean options and if any have been explicitly enabled # or disabled by the user, return 1 or 0 accordingly. # # If the option was specified more than once, the last value wins. | | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | # @opt-bool ?-nodefault? option ... # # Check each of the named, boolean options and if any have been explicitly enabled # or disabled by the user, return 1 or 0 accordingly. # # If the option was specified more than once, the last value wins. # e.g. With '--enable-foo --disable-foo', '[opt-bool foo]' will return 0 # # If no value was specified by the user, returns the default value for the # first option. If '-nodefault' is given, this behaviour changes and # -1 is returned instead. # proc opt-bool {args} { set nodefault 0 if {[lindex $args 0] eq "-nodefault"} { set nodefault 1 set args [lrange $args 1 end] |
︙ | ︙ | |||
235 236 237 238 239 240 241 | if {$nodefault} { return -1 } # Default value is the default for the first option return [dict get $::autosetup(optdefault) [lindex $args 0]] } | | | < < > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | if {$nodefault} { return -1 } # Default value is the default for the first option return [dict get $::autosetup(optdefault) [lindex $args 0]] } # @opt-val optionlist ?default=""? # # Returns a list containing all the values given for the non-boolean options in '$optionlist'. # There will be one entry in the list for each option given by the user, including if the # same option was used multiple times. # # If no options were set, '$default' is returned (exactly, not as a list). # # Note: For most use cases, 'opt-str' should be preferred. # proc opt-val {names {default ""}} { option-check-names {*}$names foreach opt $names { if {[dict exists $::autosetup(optset) $opt]} { lappend result {*}[dict get $::autosetup(optset) $opt] } } if {[info exists result]} { return $result } return $default } # @opt-str optionlist varname ?default? # # Sets '$varname' in the callers scope to the value for one of the given options. # # For the list of options given in '$optionlist', if any value is set for any option, # the option value is taken to be the *last* value of the last option (in the order given). # # If no option was given, and a default was specified with 'options-defaults', # that value is used. # # If no 'options-defaults' value was given and '$default' was given, it is used. # # If none of the above provided a value, no value is set. # # The return value depends on whether '$default' was specified. # If it was, the option value is returned. # If it was not, 1 is returns if a value was set, or 0 if not. # # Typical usage is as follows: # ## if {[opt-str {myopt altname} o]} { ## do something with $o ## } # # Or: ## define myname [opt-str {myopt altname} o "/usr/local"] # proc opt-str {names varname args} { global autosetup option-check-names {*}$names upvar $varname value if {[llength $args]} { # A default was given, so always return the string value of the option set default [lindex $args 0] set retopt 1 } else { # No default, so return 0 or 1 to indicate if a value was found set retopt 0 } foreach opt $names { if {[dict exists $::autosetup(optset) $opt]} { set result [lindex [dict get $::autosetup(optset) $opt] end] } } if {![info exists result]} { # No user-specified value. Has options-defaults been set? foreach opt $names { if {[dict exists $::autosetup(options-defaults) $opt]} { set result [dict get $autosetup(options-defaults) $opt] } } } if {[info exists result]} { set value $result if {$retopt} { return $value } return 1 } if {$retopt} { set value $default return $value } return 0 } proc option-check-names {args} { foreach o $args { if {$o ni $::autosetup(options)} { autosetup-error "Request for undeclared option --$o" } } |
︙ | ︙ | |||
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 | set opt [lindex $opts $i] if {[string match =* $opt]} { # This is a special heading lappend autosetup(optionhelp) $opt "" set header {} continue } #puts "i=$i, opt=$opt" regexp {^([^:=]*)(:)?(=)?(.*)$} $opt -> name colon equal value if {$name in $autosetup(options)} { autosetup-error "Option $name already specified" } #puts "$opt => $name $colon $equal $value" # Find the corresponding value in the user options # and set the default if necessary if {[string match "-*" $opt]} { # This is a documentation-only option, like "-C <dir>" set opthelp $opt } elseif {$colon eq ""} { # Boolean option lappend autosetup(options) $name if {$value eq "1"} { set opthelp "--disable-$name" } else { set opthelp "--$name" } # Set the default if {$value eq ""} { set value 0 } | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > < | > > > | 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 | set opt [lindex $opts $i] if {[string match =* $opt]} { # This is a special heading lappend autosetup(optionhelp) $opt "" set header {} continue } unset -nocomplain defaultvalue equal value #puts "i=$i, opt=$opt" regexp {^([^:=]*)(:)?(=)?(.*)$} $opt -> name colon equal value if {$name in $autosetup(options)} { autosetup-error "Option $name already specified" } #puts "$opt => $name $colon $equal $value" # Find the corresponding value in the user options # and set the default if necessary if {[string match "-*" $opt]} { # This is a documentation-only option, like "-C <dir>" set opthelp $opt } elseif {$colon eq ""} { # Boolean option lappend autosetup(options) $name # Check for override if {[dict exists $autosetup(options-defaults) $name]} { # A default was specified with options-defaults, so use it set value [dict get $autosetup(options-defaults) $name] } if {$value eq "1"} { set opthelp "--disable-$name" } else { set opthelp "--$name" } # Set the default if {$value eq ""} { set value 0 } set defaultvalue $value dict set autosetup(optdefault) $name $defaultvalue if {[dict exists $autosetup(getopt) $name]} { # The option was specified by the user. Look at the last value. lassign [lindex [dict get $autosetup(getopt) $name] end] type setvalue if {$type eq "str"} { # Can we convert the value to a boolean? if {$setvalue in {1 enabled yes}} { set setvalue 1 } elseif {$setvalue in {0 disabled no}} { set setvalue 0 } else { user-error "Boolean option $name given as --$name=$setvalue" } } dict set autosetup(optset) $name $setvalue #puts "Found boolean option --$name=$setvalue" } } else { # String option. lappend autosetup(options) $name if {$colon eq ":"} { # Was ":name=default" given? # If so, set $value to the display name and $defaultvalue to the default # (This is the preferred way to set a default value for a string option) if {[regexp {^([^=]+)=(.*)$} $value -> value defaultvalue]} { dict set autosetup(optdefault) $name $defaultvalue } } # Maybe override the default value if {[dict exists $autosetup(options-defaults) $name]} { # A default was specified with options-defaults, so use it set defaultvalue [dict get $autosetup(options-defaults) $name] dict set autosetup(optdefault) $name $defaultvalue } elseif {![info exists defaultvalue]} { # For backward compatibility, if ":name" was given, use name as both # the display text and the default value, but only if the user # specified the option without the value set defaultvalue $value } if {$equal eq "="} { # String option with optional value set opthelp "--$name?=$value?" } else { # String option with required value set opthelp "--$name=$value" } # Get the values specified by the user if {[dict exists $autosetup(getopt) $name]} { set listvalue {} foreach pair [dict get $autosetup(getopt) $name] { lassign $pair type setvalue if {$type eq "bool" && $setvalue} { if {$equal ne "="} { user-error "Option --$name requires a value" } # If given as a boolean, use the default value set setvalue $defaultvalue } lappend listvalue $setvalue } #puts "Found string option --$name=$listvalue" dict set autosetup(optset) $name $listvalue } } # Now create the help for this option if appropriate if {[lindex $opts $i+1] eq "=>"} { set desc [lindex $opts $i+2] if {[info exists defaultvalue]} { set desc [string map [list @default@ $defaultvalue] $desc] } #string match \n* $desc if {$header ne ""} { lappend autosetup(optionhelp) $header "" set header "" } # A multi-line description lappend autosetup(optionhelp) $opthelp $desc |
︙ | ︙ | |||
461 462 463 464 465 466 467 | puts $desc } else { options-wrap-desc [string trim $desc] $cols " " $indent [expr $max + 2] } } } | | | > | | | | > > > | | | | 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 | puts $desc } else { options-wrap-desc [string trim $desc] $cols " " $indent [expr $max + 2] } } } # @options optionspec # # Specifies configuration-time options which may be selected by the user # and checked with 'opt-str' and 'opt-bool'. '$optionspec' contains a series # of options specifications separated by newlines, as follows: # # A boolean option is of the form: # ## name[=0|1] => "Description of this boolean option" # # The default is 'name=0', meaning that the option is disabled by default. # If 'name=1' is used to make the option enabled by default, the description should reflect # that with text like "Disable support for ...". # # An argument option (one which takes a parameter) is of the form: # ## name:[=]value => "Description of this option" # # If the 'name:value' form is used, the value must be provided with the option (as '--name=myvalue'). # If the 'name:=value' form is used, the value is optional and the given value is used as the default # if it is not provided. # # The description may contain '@default@', in which case it will be replaced with the default # value for the option (taking into account defaults specified with 'options-defaults'. # # Undocumented options are also supported by omitting the '=> description'. # These options are not displayed with '--help' and can be useful for internal options or as aliases. # # For example, '--disable-lfs' is an alias for '--disable=largefile': # ## lfs=1 largefile=1 => "Disable large file support" # proc options {optlist} { # Allow options as a list or args options-add $optlist "Local Options:" |
︙ | ︙ | |||
507 508 509 510 511 512 513 514 515 | foreach o [dict keys $::autosetup(getopt)] { if {$o ni $::autosetup(options)} { user-error "Unknown option --$o" } } } } proc config_guess {} { | > > > > > > > > > > > | < | | | | | | | | | > > > > | > > > > > | > > > > > > > > > > > > | | | | | | | | 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 | foreach o [dict keys $::autosetup(getopt)] { if {$o ni $::autosetup(options)} { user-error "Unknown option --$o" } } } } # @options-defaults dictionary # # Specifies a dictionary of options and a new default value for each of those options. # Use before any 'use' statements in 'auto.def' to change the defaults for # subsequently included modules. proc options-defaults {dict} { foreach {n v} $dict { dict set ::autosetup(options-defaults) $n $v } } proc config_guess {} { if {[file-isexec $::autosetup(dir)/autosetup-config.guess]} { if {[catch {exec-with-stderr sh $::autosetup(dir)/autosetup-config.guess} alias]} { user-error $alias } return $alias } else { configlog "No autosetup-config.guess, so using uname" string tolower [exec uname -p]-unknown-[exec uname -s][exec uname -r] } } proc config_sub {alias} { if {[file-isexec $::autosetup(dir)/autosetup-config.sub]} { if {[catch {exec-with-stderr sh $::autosetup(dir)/autosetup-config.sub $alias} alias]} { user-error $alias } } return $alias } # @define name ?value=1? # # Defines the named variable to the given value. # These (name, value) pairs represent the results of the configuration check # and are available to be subsequently checked, modified and substituted. # proc define {name {value 1}} { set ::define($name) $value #dputs "$name <= $value" } # @undefine name # # Undefine the named variable. # proc undefine {name} { unset -nocomplain ::define($name) #dputs "$name <= <undef>" } # @define-append name value ... # # Appends the given value(s) to the given "defined" variable. # If the variable is not defined or empty, it is set to '$value'. # Otherwise the value is appended, separated by a space. # Any extra values are similarly appended. # If any value is already contained in the variable (as a substring) it is omitted. # proc define-append {name args} { if {[get-define $name ""] ne ""} { # Avoid duplicates foreach arg $args { if {$arg eq ""} { continue } set found 0 foreach str [split $::define($name) " "] { if {$str eq $arg} { incr found } } if {!$found} { append ::define($name) " " $arg } } } else { set ::define($name) [join $args] } #dputs "$name += [join $args] => $::define($name)" } # @get-define name ?default=0? # # Returns the current value of the "defined" variable, or '$default' # if not set. # proc get-define {name {default 0}} { if {[info exists ::define($name)]} { #dputs "$name => $::define($name)" return $::define($name) } #dputs "$name => $default" return $default } # @is-defined name # # Returns 1 if the given variable is defined. # proc is-defined {name} { info exists ::define($name) } # @is-define-set name # # Returns 1 if the given variable is defined and is set # to a value other than "" or 0 # proc is-define-set {name} { if {[get-define $name] in {0 ""}} { return 0 } return 1 } # @all-defines # # Returns a dictionary (name, value list) of all defined variables. # # This is suitable for use with 'dict', 'array set' or 'foreach' # and allows for arbitrary processing of the defined variables. # proc all-defines {} { array get ::define } # @get-env name default # # If '$name' was specified on the command line, return it. # Otherwise if '$name' was set in the environment, return it. # Otherwise return '$default'. # proc get-env {name default} { if {[dict exists $::autosetup(cmdline) $name]} { return [dict get $::autosetup(cmdline) $name] } getenv $name $default } # @env-is-set name # # Returns 1 if '$name' was specified on the command line or in the environment. # Note that an empty environment variable is not considered to be set. # proc env-is-set {name} { if {[dict exists $::autosetup(cmdline) $name]} { return 1 } if {[getenv $name ""] ne ""} { return 1 } return 0 } # @readfile filename ?default=""? # # Return the contents of the file, without the trailing newline. # If the file doesn't exist or can't be read, returns '$default'. # proc readfile {filename {default_value ""}} { set result $default_value catch { set f [open $filename] set result [read -nonewline $f] close $f } return $result } # @writefile filename value # # Creates the given file containing '$value'. # Does not add an extra newline. # proc writefile {filename value} { set f [open $filename w] puts -nonewline $f $value close $f } |
︙ | ︙ | |||
675 676 677 678 679 680 681 | set args {} foreach arg $argv { lappend args [quote-if-needed $arg] } join $args } | | | < < < < | > | | > | > > | | | < | > | > > | > > > | > | > > | | < < < | < < < < < | < < < | 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 | set args {} foreach arg $argv { lappend args [quote-if-needed $arg] } join $args } # @list-non-empty list # # Returns a copy of the given list with empty elements removed proc list-non-empty {list} { set result {} foreach p $list { if {$p ne ""} { lappend result $p } } return $result } # @find-executable-path name # # Searches the path for an executable with the given name. # Note that the name may include some parameters, e.g. 'cc -mbig-endian', # in which case the parameters are ignored. # The full path to the executable if found, or "" if not found. # Returns 1 if found, or 0 if not. # proc find-executable-path {name} { # Ignore any parameters set name [lindex $name 0] # The empty string is never a valid executable if {$name ne ""} { foreach p [split-path] { dputs "Looking for $name in $p" set exec [file join $p $name] if {[file-isexec $exec]} { dputs "Found $name -> $exec" return $exec } } } return {} } # @find-executable name # # Searches the path for an executable with the given name. # Note that the name may include some parameters, e.g. 'cc -mbig-endian', # in which case the parameters are ignored. # Returns 1 if found, or 0 if not. # proc find-executable {name} { if {[find-executable-path $name] eq {}} { return 0 } return 1 } # @find-an-executable ?-required? name ... # # Given a list of possible executable names, # searches for one of these on the path. # |
︙ | ︙ | |||
762 763 764 765 766 767 768 | } } return "" } # @configlog msg # | | | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | } } return "" } # @configlog msg # # Writes the given message to the configuration log, 'config.log'. # proc configlog {msg} { if {![info exists ::autosetup(logfh)]} { set ::autosetup(logfh) [open config.log w] } puts $::autosetup(logfh) $msg } |
︙ | ︙ | |||
798 799 800 801 802 803 804 | set ::autosetup(msg-checking) 0 show-notices } } # @msg-quiet command ... # | | | | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | set ::autosetup(msg-checking) 0 show-notices } } # @msg-quiet command ... # # 'msg-quiet' evaluates it's arguments as a command with output # from 'msg-checking' and 'msg-result' suppressed. # # This is useful if a check needs to run a subcheck which isn't # of interest to the user. proc msg-quiet {args} { incr ::autosetup(msg-quiet) set rc [uplevel 1 $args] incr ::autosetup(msg-quiet) -1 |
︙ | ︙ | |||
839 840 841 842 843 844 845 | # # Usage errors such as wrong command line options # @user-error msg # # Indicate incorrect usage to the user, including if required components # or features are not found. | | | 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | # # Usage errors such as wrong command line options # @user-error msg # # Indicate incorrect usage to the user, including if required components # or features are not found. # 'autosetup' exits with a non-zero return code. # proc user-error {msg} { show-notices puts stderr "Error: $msg" puts stderr "Try: '[file tail $::autosetup(exe)] --help' for options" exit 1 } |
︙ | ︙ | |||
885 886 887 888 889 890 891 892 893 894 895 896 897 898 | } proc maybe-show-timestamp {} { if {$::autosetup(msg-timing) && $::autosetup(msg-checking) == 0} { puts -nonewline [format {[%6.2f] } [expr {([clock millis] - $::autosetup(start)) % 10000 / 1000.0}]] } } proc autosetup_version {} { return "autosetup v$::autosetup(version)" } ################################################################## # | > > > > > > > > > > > | 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 | } proc maybe-show-timestamp {} { if {$::autosetup(msg-timing) && $::autosetup(msg-checking) == 0} { puts -nonewline [format {[%6.2f] } [expr {([clock millis] - $::autosetup(start)) % 10000 / 1000.0}]] } } # @autosetup-require-version required # # Checks the current version of 'autosetup' against '$required'. # A fatal error is generated if the current version is less than that required. # proc autosetup-require-version {required} { if {[compare-versions $::autosetup(version) $required] < 0} { user-error "autosetup version $required is required, but this is $::autosetup(version)" } } proc autosetup_version {} { return "autosetup v$::autosetup(version)" } ################################################################## # |
︙ | ︙ | |||
984 985 986 987 988 989 990 991 | # or 'autosetup/X/init.tcl' # # The latter form is useful for a complex module which requires additional # support file. In this form, '$::usedir' is set to the module directory # when it is loaded. # proc use {args} { foreach m $args { | > > > > > > | | | | | > > | | | > > > > > > > > > > > > > > > > > > > | | | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | # or 'autosetup/X/init.tcl' # # The latter form is useful for a complex module which requires additional # support file. In this form, '$::usedir' is set to the module directory # when it is loaded. # proc use {args} { global autosetup libmodule modsource set dirs [list $autosetup(libdir)] if {[info exists autosetup(srcdir)]} { lappend dirs $autosetup(srcdir)/autosetup } foreach m $args { if {[info exists libmodule($m)]} { continue } set libmodule($m) 1 if {[info exists modsource(${m}.tcl)]} { automf_load eval $modsource(${m}.tcl) } else { set locs [list ${m}.tcl ${m}/init.tcl] set found 0 foreach dir $dirs { foreach loc $locs { set source $dir/$loc if {[file exists $source]} { incr found break } } if {$found} { break } } if {$found} { # For the convenience of the "use" source, point to the directory # it is being loaded from set ::usedir [file dirname $source] automf_load source $source autosetup_add_dep $source } else { autosetup-error "use: No such module: $m" } } } } proc autosetup_load_auto_modules {} { global autosetup modsource # First load any embedded auto modules foreach mod [array names modsource *.auto] { automf_load eval $modsource($mod) } # Now any external auto modules foreach file [glob -nocomplain $autosetup(libdir)/*.auto $autosetup(libdir)/*/*.auto] { automf_load source $file } } # Load module source in the global scope by executing the given command proc automf_load {args} { if {[catch [list uplevel #0 $args] msg opts] ni {0 2 3}} { autosetup-full-error [error-dump $msg $opts $::autosetup(debug)] } } # Initial settings set autosetup(exe) $::argv0 set autosetup(istcl) 1 set autosetup(start) [clock millis] set autosetup(installed) 0 set autosetup(sysinstall) 0 set autosetup(msg-checking) 0 set autosetup(msg-quiet) 0 set autosetup(inittypes) {} # Embedded modules are inserted below here set autosetup(installed) 1 set autosetup(sysinstall) 0 # ----- @module asciidoc-formatting.tcl ----- set modsource(asciidoc-formatting.tcl) { # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which provides text formatting # asciidoc format use formatting |
︙ | ︙ | |||
1100 1101 1102 1103 1104 1105 1106 | } set defn [string trim [join $args \n]] regsub -all "\n\n" $defn "\n ::\n" defn puts $defn } } | | | | | 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 | } set defn [string trim [join $args \n]] regsub -all "\n\n" $defn "\n ::\n" defn puts $defn } } # ----- @module formatting.tcl ----- set modsource(formatting.tcl) { # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which provides common text formatting # This is designed for documentation which looks like: # code {...} # or # code { # ... # ... # } # In the second case, we need to work out the indenting |
︙ | ︙ | |||
1157 1158 1159 1160 1161 1162 1163 | } # Return the result return $lines } } | | | | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 | } # Return the result return $lines } } # ----- @module getopt.tcl ----- set modsource(getopt.tcl) { # Copyright (c) 2006 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Simple getopt module # Parse everything out of the argv list which looks like an option # Everything which doesn't look like an option, or is after --, is left unchanged |
︙ | ︙ | |||
1195 1196 1197 1198 1199 1200 1201 | break } if {[regexp {^--([^=][^=]+)=(.*)$} $arg -> name value]} { # --name=value dict lappend opts $name [list str $value] } elseif {[regexp {^--(enable-|disable-)?([^=]*)$} $arg -> prefix name]} { | | | | | 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 | break } if {[regexp {^--([^=][^=]+)=(.*)$} $arg -> name value]} { # --name=value dict lappend opts $name [list str $value] } elseif {[regexp {^--(enable-|disable-)?([^=]*)$} $arg -> prefix name]} { if {$prefix in {enable- ""}} { set value 1 } else { set value 0 } dict lappend opts $name [list bool $value] } else { lappend nargv $arg } } #puts "getopt: argv=[join $argv] => [join $nargv]" #array set getopt $opts #parray getopt set argv $nargv return $opts } } # ----- @module help.tcl ----- set modsource(help.tcl) { # Copyright (c) 2010 WorkWare Systems http://workware.net.au/ # All rights reserved # Module which provides usage, help and the command reference proc autosetup_help {what} { use_pager |
︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | user-error "Unknown module: $what" } else { options-show } } exit 0 } # If not already paged and stdout is a tty, pipe the output through the pager # This is done by reinvoking autosetup with --nopager added proc use_pager {} { if {![opt-bool nopager] && [getenv PAGER ""] ne "" && [isatty? stdin] && [isatty? stdout]} { if {[catch { exec [info nameofexecutable] $::argv0 --nopager {*}$::argv |& {*}[getenv PAGER] >@stdout <@stdin 2>@stderr | > > > > > > > > > > > > > > > > > > | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | user-error "Unknown module: $what" } else { options-show } } exit 0 } proc autosetup_show_license {} { global modsource autosetup use_pager if {[info exists modsource(LICENSE)]} { puts $modsource(LICENSE) return } foreach dir [list $autosetup(libdir) $autosetup(srcdir)] { set path [file join $dir LICENSE] if {[file exists $path]} { puts [readfile $path] return } } puts "LICENSE not found" } # If not already paged and stdout is a tty, pipe the output through the pager # This is done by reinvoking autosetup with --nopager added proc use_pager {} { if {![opt-bool nopager] && [getenv PAGER ""] ne "" && [isatty? stdin] && [isatty? stdout]} { if {[catch { exec [info nameofexecutable] $::argv0 --nopager {*}$::argv |& {*}[getenv PAGER] >@stdout <@stdin 2>@stderr |
︙ | ︙ | |||
1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 | exit 0 } proc autosetup_output_block {type lines} { if {[llength $lines]} { switch $type { code { codelines $lines } p { p [join $lines] } list { | > > > > > > | 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 | exit 0 } proc autosetup_output_block {type lines} { if {[llength $lines]} { switch $type { section { section $lines } subsection { subsection $lines } code { codelines $lines } p { p [join $lines] } list { |
︙ | ︙ | |||
1323 1324 1325 1326 1327 1328 1329 | } # Generate a command reference from inline documentation proc automf_command_reference {} { lappend files $::autosetup(prog) lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/*.tcl]] | > > > > > | | > | | > > > > > > > > > | | | 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | } # Generate a command reference from inline documentation proc automf_command_reference {} { lappend files $::autosetup(prog) lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/*.tcl]] # We want to process all non-module files before module files # and then modules in alphabetical order. # So examine all files and extract docs into doc($modulename) and doc(_core_) # # Each entry is a list of {type data} where $type is one of: section, subsection, code, list, p # and $data is a string for section, subsection or a list of text lines for other types. # XXX: Should commands be in alphabetical order too? Currently they are in file order. set doc(_core_) {} lappend doc(_core_) [list section "Core Commands"] foreach file $files { set modulename [file rootname [file tail $file]] set current _core_ set f [open $file] while {![eof $f]} { set line [gets $f] # Find embedded module names if {[regexp {^#.*@module ([^ ]*)} $line -> modulename]} { continue } # Find lines starting with "# @*" and continuing through the remaining comment lines if {![regexp {^# @(.*)} $line -> cmd]} { continue } # Synopsis or command? if {$cmd eq "synopsis:"} { set current $modulename lappend doc($current) [list section "Module: $modulename"] } else { lappend doc($current) [list subsection $cmd] } set lines {} set type p # Now the description while {![eof $f]} { |
︙ | ︙ | |||
1367 1368 1369 1370 1371 1372 1373 | set t p } #puts "hash=$hash, oldhash=$oldhash, lines=[llength $lines], cmd=$cmd" if {$t ne $type || $cmd eq ""} { # Finish the current block | | | > > > > > > > > > | | | 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 | set t p } #puts "hash=$hash, oldhash=$oldhash, lines=[llength $lines], cmd=$cmd" if {$t ne $type || $cmd eq ""} { # Finish the current block lappend doc($current) [list $type $lines] set lines {} set type $t } if {$cmd ne ""} { lappend lines $cmd } } lappend doc($current) [list $type $lines] } close $f } # Now format and output the results # _core_ will sort first foreach module [lsort [array names doc]] { foreach item $doc($module) { autosetup_output_block {*}$item } } } } # ----- @module init.tcl ----- set modsource(init.tcl) { # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module to help create auto.def and configure proc autosetup_init {type} { set help 0 |
︙ | ︙ | |||
1442 1443 1444 1445 1446 1447 1448 | } else { puts "I don't see $filename, so I will create it." } writefile $filename $contents } } | | | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > > | | | > > | > > > | | | | > | | > > > > > > > | > > > > > > | | > | | > > > > | > | > > > > > > | | > > > > | < < | > > > > > | > | | > | > | > > > > > | > > | > | | > > > > > > | > > > > > > > > > > | > | > > > | > | > > > | > > | | | 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 | } else { puts "I don't see $filename, so I will create it." } writefile $filename $contents } } # ----- @module install.tcl ----- set modsource(install.tcl) { # Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which can install autosetup # autosetup(installed)=1 means that autosetup is not running from source # autosetup(sysinstall)=1 means that autosetup is running from a sysinstall version # shared=1 means that we are trying to do a sysinstall. This is only possible from the development source. proc autosetup_install {dir {shared 0}} { global autosetup if {$shared} { if {$autosetup(installed) || $autosetup(sysinstall)} { user-error "Can only --sysinstall from development sources" } } elseif {$autosetup(installed) && !$autosetup(sysinstall)} { user-error "Can't --install from project install" } if {$autosetup(sysinstall)} { # This is the sysinstall version, so install just uses references cd $dir puts "[autosetup_version] creating configure to use system-installed autosetup" autosetup_create_configure 1 puts "Creating autosetup/README.autosetup" file mkdir autosetup autosetup_install_readme autosetup/README.autosetup 1 return } if {[catch { if {$shared} { set target $dir/bin/autosetup set installedas $target } else { if {$dir eq "."} { set installedas autosetup } else { set installedas $dir/autosetup } cd $dir file mkdir autosetup set target autosetup/autosetup } set targetdir [file dirname $target] file mkdir $targetdir set f [open $target w] set publicmodules {} # First the main script, but only up until "CUT HERE" set in [open $autosetup(dir)/autosetup] while {[gets $in buf] >= 0} { if {$buf ne "##-- CUT HERE --##"} { puts $f $buf continue } # Insert the static modules here # i.e. those which don't contain @synopsis: # All modules are inserted if $shared is set puts $f "set autosetup(installed) 1" puts $f "set autosetup(sysinstall) $shared" foreach file [lsort [glob $autosetup(libdir)/*.{tcl,auto}]] { set modname [file tail $file] set ext [file ext $modname] set buf [readfile $file] if {!$shared} { if {$ext eq ".auto" || [string match "*\n# @synopsis:*" $buf]} { lappend publicmodules $file continue } } dputs "install: importing lib/[file tail $file]" puts $f "# ----- @module $modname -----" puts $f "\nset modsource($modname) \{" puts $f $buf puts $f "\}\n" } if {$shared} { foreach {srcname destname} [list $autosetup(libdir)/README.autosetup-lib README.autosetup \ $autosetup(srcdir)/LICENSE LICENSE] { dputs "install: importing $srcname as $destname" puts $f "\nset modsource($destname) \\\n[list [readfile $srcname]\n]\n" } } } close $in close $f catch {exec chmod 755 $target} set installfiles {autosetup-config.guess autosetup-config.sub autosetup-test-tclsh} set removefiles {} if {!$shared} { autosetup_install_readme $targetdir/README.autosetup 0 # Install public modules foreach file $publicmodules { set tail [file tail $file] autosetup_install_file $file $targetdir/$tail } lappend installfiles jimsh0.c autosetup-find-tclsh LICENSE lappend removefiles config.guess config.sub test-tclsh find-tclsh } else { lappend installfiles {sys-find-tclsh autosetup-find-tclsh} } # Install support files foreach fileinfo $installfiles { if {[llength $fileinfo] == 2} { lassign $fileinfo source dest } else { lassign $fileinfo source set dest $source } autosetup_install_file $autosetup(dir)/$source $targetdir/$dest } # Remove obsolete files foreach file $removefiles { if {[file exists $targetdir/$file]} { file delete $targetdir/$file } } } error]} { user-error "Failed to install autosetup: $error" } if {$shared} { set type "system" } else { set type "local" } puts "Installed $type [autosetup_version] to $installedas" if {!$shared} { # Now create 'configure' if necessary autosetup_create_configure 0 } } proc autosetup_create_configure {shared} { if {[file exists configure]} { if {!$::autosetup(force)} { # Could this be an autosetup configure? if {![string match "*\nWRAPPER=*" [readfile configure]]} { puts "I see configure, but not created by autosetup, so I won't overwrite it." puts "Remove it or use --force to overwrite." return } } else { puts "I will overwrite the existing configure because you used --force." } } else { puts "I don't see configure, so I will create it." } if {$shared} { writefile configure \ {#!/bin/sh WRAPPER="$0"; export WRAPPER; "autosetup" "$@" } } else { writefile configure \ {#!/bin/sh dir="`dirname "$0"`/autosetup" WRAPPER="$0"; export WRAPPER; exec "`"$dir/autosetup-find-tclsh"`" "$dir/autosetup" "$@" } } catch {exec chmod 755 configure} } # Append the contents of $file to filehandle $f proc autosetup_install_append {f file} { dputs "install: include $file" set in [open $file] puts $f [read $in] close $in } proc autosetup_install_file {source target} { dputs "install: $source => $target" if {![file exists $source]} { error "Missing installation file '$source'" } writefile $target [readfile $source]\n # If possible, copy the file mode file stat $source stat set mode [format %o [expr {$stat(mode) & 0x1ff}]] catch {exec chmod $mode $target} } proc autosetup_install_readme {target sysinstall} { set readme "README.autosetup created by [autosetup_version]\n\n" if {$sysinstall} { append readme \ {This is the autosetup directory for a system install of autosetup. Loadable modules can be added here. } } else { append readme \ {This is the autosetup directory for a local install of autosetup. It contains autosetup, support files and loadable modules. } } append readme { *.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/ } dputs "install: autosetup/README.autosetup" writefile $target $readme } } # ----- @module markdown-formatting.tcl ----- set modsource(markdown-formatting.tcl) { # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which provides text formatting # markdown format (kramdown syntax) use formatting |
︙ | ︙ | |||
1625 1626 1627 1628 1629 1630 1631 | puts -nonewline ": " regsub -all "\n\n" $defn "\n: " defn } puts "$defn" } } | | | | 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 | puts -nonewline ": " regsub -all "\n\n" $defn "\n: " defn } puts "$defn" } } # ----- @module misc.tcl ----- set modsource(misc.tcl) { # Copyright (c) 2007-2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module containing misc procs useful to modules # Largely for platform compatibility set autosetup(istcl) [info exists ::tcl_library] |
︙ | ︙ | |||
1803 1804 1805 1806 1807 1808 1809 | # Remove the trailing newline string trim $result } } } | | | | | > | | | | | > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | > | | | > | | | | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 | # Remove the trailing newline string trim $result } } } # ----- @module text-formatting.tcl ----- set modsource(text-formatting.tcl) { # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which provides text formatting use formatting proc wordwrap {text length {firstprefix ""} {nextprefix ""}} { set len 0 set space $firstprefix foreach word [split $text] { set word [string trim $word] if {$word eq ""} { continue } if {[info exists partial]} { append partial " " $word if {[string first $quote $word] < 0} { # Haven't found end of quoted word continue } # Finished quoted word set word $partial unset partial unset quote } else { set quote [string index $word 0] if {$quote in {' *}} { if {[string first $quote $word 1] < 0} { # Haven't found end of quoted word # Not a whole word. set first [string index $word 0] # Start of quoted word set partial $word continue } } } if {$len && [string length $space$word] + $len >= $length} { puts "" set len 0 set space $nextprefix } incr len [string length $space$word] # Use man-page conventions for highlighting 'quoted' and *quoted* # single words. # Use x^Hx for *bold* and _^Hx for 'underline'. # # less and more will both understand this. # Pipe through 'col -b' to remove them. if {[regexp {^'(.*)'(.*)} $word -> quoted after]} { set quoted [string map {~ " "} $quoted] regsub -all . $quoted "&\b&" quoted set word $quoted$after } elseif {[regexp {^[*](.*)[*](.*)} $word -> quoted after]} { set quoted [string map {~ " "} $quoted] regsub -all . $quoted "_\b&" quoted set word $quoted$after } puts -nonewline $space$word set space " " } if {[info exists partial]} { # Missing end of quote puts -nonewline $space$partial } if {$len} { puts "" } } proc title {text} { underline [string trim $text] = nl } proc p {text} { wordwrap $text 80 nl } proc codelines {lines} { foreach line $lines { puts " $line" } nl } proc nl {} { puts "" } proc underline {text char} { regexp "^(\[ \t\]*)(.*)" $text -> indent words puts $text puts $indent[string repeat $char [string length $words]] } proc section {text} { underline "[string trim $text]" - nl } proc subsection {text} { underline "$text" ~ nl } proc bullet {text} { wordwrap $text 76 " * " " " } proc indent {text} { wordwrap $text 76 " " " " } proc defn {first args} { if {$first ne ""} { underline " $first" ~ } foreach p $args { if {$p ne ""} { indent $p } } } } # ----- @module util.tcl ----- set modsource(util.tcl) { # Copyright (c) 2012 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which contains miscellaneous utility functions # @compare-versions version1 version2 # # Versions are of the form 'a.b.c' (may be any number of numeric components) # # Compares the two versions and returns: ## -1 if v1 < v2 ## 0 if v1 == v2 ## 1 if v1 > v2 # # If one version has fewer components than the other, 0 is substituted to the right. e.g. ## 0.2 < 0.3 ## 0.2.5 > 0.2 ## 1.1 == 1.1.0 # proc compare-versions {v1 v2} { foreach c1 [split $v1 .] c2 [split $v2 .] { if {$c1 eq ""} { set c1 0 } if {$c2 eq ""} { set c2 0 } if {$c1 < $c2} { return -1 } if {$c1 > $c2} { return 1 } } return 0 } # @suffix suf list # # Takes a list and returns a new list with '$suf' appended # to each element # ## suffix .c {a b c} => {a.c b.c c.c} # proc suffix {suf list} { set result {} foreach p $list { lappend result $p$suf } return $result } # @prefix pre list # # Takes a list and returns a new list with '$pre' prepended # to each element # ## prefix jim- {a.c b.c} => {jim-a.c jim-b.c} # proc prefix {pre list} { set result {} foreach p $list { lappend result $pre$p } return $result } # @lpop list # # Removes the last entry from the given list and returns it. proc lpop {listname} { upvar $listname list set val [lindex $list end] set list [lrange $list 0 end-1] return $val } } # ----- @module wiki-formatting.tcl ----- set modsource(wiki-formatting.tcl) { # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module which provides text formatting # wiki.tcl.tk format output use formatting |
︙ | ︙ | |||
1973 1974 1975 1976 1977 1978 1979 | # Entry/Exit # if {$autosetup(debug)} { main $argv } if {[catch {main $argv} msg opts] == 1} { show-notices | | | 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 | # Entry/Exit # if {$autosetup(debug)} { main $argv } if {[catch {main $argv} msg opts] == 1} { show-notices autosetup-full-error [error-dump $msg $opts $autosetup(debug)] if {!$autosetup(debug)} { puts stderr "Try: '[file tail $autosetup(exe)] --debug' for a full stack trace" } exit 1 } |
Name change from autosetup/config.guess to autosetup/autosetup-config.guess.
1 2 | #! /bin/sh # Attempt to guess a canonical system name. | | | | | | | | 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 | #! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-03-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to <config-patches@gnu.org>. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." |
︙ | ︙ | |||
103 104 105 106 107 108 109 | { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in | | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; |
︙ | ︙ | |||
128 129 130 131 132 133 134 | fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown | | | | | > > > > > > > | | > > | | > > > > > | | | > > > | > > > > > > > | | | | > > > | > > > > | | | > > > | > > > > > > | | | | | | | | | | | | | | | | < < < < < < < < < | | | | 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 | fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include <features.h> #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; |
︙ | ︙ | |||
342 343 344 345 346 347 348 | echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; |
︙ | ︙ | |||
499 500 501 502 503 504 505 | exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include <sys/systemcfg.h> main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include <stdlib.h> #include <unistd.h> int main () { |
︙ | ︙ | |||
659 660 661 662 663 664 665 | puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF | | | | | | | | | | | | | 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 | puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include <unistd.h> int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct |
︙ | ︙ | |||
717 718 719 720 721 722 723 | } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF | | | | | | | 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 | } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd |
︙ | ︙ | |||
765 766 767 768 769 770 771 | C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) | | | | | | | | | | | | | | | | | < > | > | | | | < < < < | | | | | < < < < < < < < < < < < | < < < | | | | | | | | | | | | | | | | > > > | | | | > > > | | | | | | > > > | | | | | | | | | | | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > | | | | | | | > > > > > > > | | | | | | | | > > > > > > | | | | | | | | | | > > > > > > > > | | > > > > > > > | | | | | < | | | | | | | | | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 | C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL" elif /bin/uname -X 2>/dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <<EOF NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize the system type. Please install a C compiler and try again. EOF ;; esac cat >&2 <<EOF This script (version $timestamp), has failed to recognize the operating system you are using. If your script is old, overwrite *all* copies of config.guess and config.sub with the latest versions from: https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess and https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub If $0 has already been updated, send the following data and any information you think might be pertinent to config-patches@gnu.org to provide the necessary information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: |
Name change from autosetup/config.sub to autosetup/autosetup-config.sub.
1 2 | #! /bin/sh # Configuration validation subroutine script. | | | | | | < | | | 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 | #! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-03-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to <config-patches@gnu.org>. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." |
︙ | ︙ | |||
91 92 93 94 95 96 97 | break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. | | | | | | | | | | | 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 | break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we |
︙ | ︙ | |||
175 176 177 178 179 180 181 | basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 | | | | | | | | | | | | < < < | 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 | basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint |
︙ | ︙ | |||
251 252 253 254 255 256 257 258 259 260 261 | | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | > | | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ |
︙ | ︙ | |||
295 296 297 298 299 300 301 | | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | | > | | | | 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 | | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown |
︙ | ︙ | |||
360 361 362 363 364 365 366 | # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) | | > | | | 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 | # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ |
︙ | ︙ | |||
423 424 425 426 427 428 429 430 431 432 433 434 435 | | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | > > | > | | 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 | | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att |
︙ | ︙ | |||
485 486 487 488 489 490 491 | basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) | | | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown |
︙ | ︙ | |||
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) | > > > | | | | | 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 | basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown |
︙ | ︙ | |||
630 631 632 633 634 635 636 | basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; | | > > > > > > > > | 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 | basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd |
︙ | ︙ | |||
723 724 725 726 727 728 729 | ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; | < < < | | | | | | | < < < | 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 | ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv |
︙ | ︙ | |||
820 821 822 823 824 825 826 | basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) | | | | | 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 | basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm |
︙ | ︙ | |||
884 885 886 887 888 889 890 | basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; | | | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 | basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; |
︙ | ︙ | |||
929 930 931 932 933 934 935 936 937 938 939 940 941 942 | ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; | > > > > > > | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; |
︙ | ︙ | |||
961 962 963 964 965 966 967 | os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) | | | | | | | | | | | | | | 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 | os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 |
︙ | ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; | < < < < < < < | | | 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 | sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 |
︙ | ︙ | |||
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) | > > > | < < < < < < < < | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 | basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. |
︙ | ︙ | |||
1282 1283 1284 1285 1286 1287 1288 | ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; | < < < < < < < | | | | | < < < > > > > | | | | | | | | | | | > > | | | | | < < < < < < | 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) |
︙ | ︙ | |||
1464 1465 1466 1467 1468 1469 1470 | ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; | | | 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 | ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) |
︙ | ︙ | |||
1486 1487 1488 1489 1490 1491 1492 | ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; | | < < < < < < < < < > > > > > > > > > > > > > > > | | 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 | ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their |
︙ | ︙ | |||
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; | > > > < < < | 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 | ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) |
︙ | ︙ | |||
1661 1662 1663 1664 1665 1666 1667 | ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; | | < < < | 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 | ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) |
︙ | ︙ | |||
1788 1789 1790 1791 1792 1793 1794 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac | | | | | 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 | -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: |
Name change from autosetup/find-tclsh to autosetup/autosetup-find-tclsh.
1 2 3 4 | #!/bin/sh # Looks for a suitable tclsh or jimsh in the PATH # If not found, builds a bootstrap jimsh from source d=`dirname "$0"` | > | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #!/bin/sh # Looks for a suitable tclsh or jimsh in the PATH # If not found, builds a bootstrap jimsh from source # Prefer $autosetup_tclsh if is set in the environment d=`dirname "$0"` { "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0 PATH="$PATH:$d"; export PATH for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0 done echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0" for cc in ${CC_FOR_BUILD:-cc} gcc; do { $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue "$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0 done echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc." echo false |
Name change from autosetup/test-tclsh to autosetup/autosetup-test-tclsh.
︙ | ︙ |
Changes to autosetup/cc-db.tcl.
1 2 3 4 5 | # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # The 'cc-db' module provides a knowledge-base of system idiosyncrasies. # In general, this module can always be included. use cc module-options {} # openbsd needs sys/types.h to detect some system headers cc-include-needs sys/socket.h sys/types.h |
︙ | ︙ |
Changes to autosetup/cc-lib.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # Provides a library of common tests on top of the 'cc' module. use cc module-options {} # @cc-check-lfs # | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # Provides a library of common tests on top of the 'cc' module. use cc module-options {} # @cc-check-lfs # # The equivalent of the 'AC_SYS_LARGEFILE' macro. # # defines 'HAVE_LFS' if LFS is available, # and defines '_FILE_OFFSET_BITS=64' if necessary # # Returns 1 if 'LFS' is available or 0 otherwise # proc cc-check-lfs {} { cc-check-includes sys/types.h |
︙ | ︙ | |||
33 34 35 36 37 38 39 | } define-feature lfs $lfs return $lfs } # @cc-check-endian # | | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | } define-feature lfs $lfs return $lfs } # @cc-check-endian # # The equivalent of the 'AC_C_BIGENDIAN' macro. # # defines 'HAVE_BIG_ENDIAN' if endian is known to be big, # or 'HAVE_LITTLE_ENDIAN' if endian is known to be little. # # Returns 1 if determined, or 0 if not. # proc cc-check-endian {} { cc-check-includes sys/types.h sys/param.h |
︙ | ︙ | |||
78 79 80 81 82 83 84 | # @cc-check-flags flag ?...? # # Checks whether the given C/C++ compiler flags can be used. Defines feature # names prefixed with 'HAVE_CFLAG' and 'HAVE_CXXFLAG' respectively, and # appends working flags to '-cflags' and 'CFLAGS' or 'CXXFLAGS'. proc cc-check-flags {args} { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | # @cc-check-flags flag ?...? # # Checks whether the given C/C++ compiler flags can be used. Defines feature # names prefixed with 'HAVE_CFLAG' and 'HAVE_CXXFLAG' respectively, and # appends working flags to '-cflags' and 'CFLAGS' or 'CXXFLAGS'. proc cc-check-flags {args} { set result 1 array set opts [cc-get-settings] switch -exact -- $opts(-lang) { c++ { set lang C++ set prefix CXXFLAG } c { set lang C set prefix CFLAG } default { autosetup-error "cc-check-flags failed with unknown language: $opts(-lang)" } } foreach flag $args { msg-checking "Checking whether the $lang compiler accepts $flag..." if {[cctest -cflags $flag]} { msg-result yes define-feature $prefix$flag cc-with [list -cflags [list $flag]] define-append ${prefix}S $flag } else { msg-result no set result 0 } } return $result } # @cc-check-standards ver ?...? # # Checks whether the C/C++ compiler accepts one of the specified '-std=$ver' # options, and appends the first working one to '-cflags' and 'CFLAGS' or # 'CXXFLAGS'. proc cc-check-standards {args} { array set opts [cc-get-settings] foreach std $args { if {[cc-check-flags -std=$std]} { return $std } } return "" } # Checks whether $keyword is usable as alignof proc cctest_alignof {keyword} { msg-checking "Checking for $keyword..." if {[cctest -code "int x = ${keyword}(char), y = ${keyword}('x');"]} then { msg-result ok define-feature $keyword } else { msg-result "not found" } } # @cc-check-c11 # # Checks for several C11/C++11 extensions and their alternatives. Currently # checks for '_Static_assert', '_Alignof', '__alignof__', '__alignof'. proc cc-check-c11 {} { msg-checking "Checking for _Static_assert..." if {[cctest -code { _Static_assert(1, "static assertions are available"); }]} then { msg-result ok define-feature _Static_assert } else { msg-result "not found" } cctest_alignof _Alignof cctest_alignof __alignof__ cctest_alignof __alignof } # @cc-check-alloca # # The equivalent of the 'AC_FUNC_ALLOCA' macro. # # Checks for the existence of 'alloca' # defines 'HAVE_ALLOCA' and returns 1 if it exists. proc cc-check-alloca {} { cc-check-some-feature alloca { cctest -includes alloca.h -code { alloca (2 * sizeof (int)); } } } # @cc-signal-return-type # # The equivalent of the 'AC_TYPE_SIGNAL' macro. # # defines 'RETSIGTYPE' to 'int' or 'void'. proc cc-signal-return-type {} { msg-checking "Checking return type of signal handlers..." cc-with {-includes {sys/types.h signal.h}} { if {[cctest -code {return *(signal (0, 0)) (0) == 1;}]} { set type int } else { set type void } define RETSIGTYPE $type msg-result $type } } |
Changes to autosetup/cc-shared.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # The 'cc-shared' module provides support for shared libraries and shared objects. # It defines the following variables: # ## SH_CFLAGS Flags to use compiling sources destined for a shared library ## SH_LDFLAGS Flags to use linking (creating) a shared library ## SH_SOPREFIX Prefix to use to set the soname when creating a shared library ## SH_SOEXT Extension for shared libs ## SH_SOEXTVER Format for versioned shared libs - %s = version ## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object ## SHOBJ_LDFLAGS Flags to use linking a shared object, undefined symbols allowed ## SHOBJ_LDFLAGS_R - as above, but all symbols must be resolved ## SH_LINKFLAGS Flags to use linking an executable which will load shared objects ## LD_LIBRARY_PATH Environment variable which specifies path to shared libraries ## STRIPLIBFLAGS Arguments to strip a dynamic library module-options {} # Defaults: gcc on unix | > > | | > > > | < < < < | | 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 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # The 'cc-shared' module provides support for shared libraries and shared objects. # It defines the following variables: # ## SH_CFLAGS Flags to use compiling sources destined for a shared library ## SH_LDFLAGS Flags to use linking (creating) a shared library ## SH_SOPREFIX Prefix to use to set the soname when creating a shared library ## SH_SOFULLPATH Set to 1 if the shared library soname should include the full install path ## SH_SOEXT Extension for shared libs ## SH_SOEXTVER Format for versioned shared libs - %s = version ## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object ## SHOBJ_LDFLAGS Flags to use linking a shared object, undefined symbols allowed ## SHOBJ_LDFLAGS_R - as above, but all symbols must be resolved ## SH_LINKRPATH Format for setting the rpath when linking an executable, %s = path ## SH_LINKFLAGS Flags to use linking an executable which will load shared objects ## LD_LIBRARY_PATH Environment variable which specifies path to shared libraries ## STRIPLIBFLAGS Arguments to strip a dynamic library module-options {} # Defaults: gcc on unix define SHOBJ_CFLAGS -fPIC define SHOBJ_LDFLAGS -shared define SH_CFLAGS -fPIC define SH_LDFLAGS -shared define SH_LINKFLAGS -rdynamic define SH_LINKRPATH "-Wl,-rpath -Wl,%s" define SH_SOEXT .so define SH_SOEXTVER .so.%s define SH_SOPREFIX -Wl,-soname, define LD_LIBRARY_PATH LD_LIBRARY_PATH define STRIPLIBFLAGS --strip-unneeded # Note: This is a helpful reference for identifying the toolchain # http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers switch -glob -- [get-define host] { *-*-darwin* { define SHOBJ_CFLAGS "-dynamic -fno-common" define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup" define SHOBJ_LDFLAGS_R -bundle define SH_CFLAGS -dynamic define SH_LDFLAGS -dynamiclib define SH_LINKFLAGS "" define SH_SOEXT .dylib define SH_SOEXTVER .%s.dylib define SH_SOPREFIX -Wl,-install_name, define SH_SOFULLPATH define LD_LIBRARY_PATH DYLD_LIBRARY_PATH define STRIPLIBFLAGS -x } *-*-ming* - *-*-cygwin - *-*-msys { define SHOBJ_CFLAGS "" define SHOBJ_LDFLAGS -shared define SH_CFLAGS "" define SH_LDFLAGS -shared define SH_LINKRPATH "" define SH_LINKFLAGS "" define SH_SOEXT .dll define SH_SOEXTVER .dll define SH_SOPREFIX "" define LD_LIBRARY_PATH PATH } sparc* { if {[msg-quiet cc-check-decls __SUNPRO_C]} { msg-result "Found sun stdio compiler" # sun stdio compiler # XXX: These haven't been fully tested. define SHOBJ_CFLAGS -KPIC define SHOBJ_LDFLAGS "-G" define SH_CFLAGS -KPIC define SH_LINKFLAGS -Wl,-export-dynamic define SH_SOPREFIX -Wl,-h, } } *-*-solaris* { if {[msg-quiet cc-check-decls __SUNPRO_C]} { msg-result "Found sun stdio compiler" # sun stdio compiler # XXX: These haven't been fully tested. define SHOBJ_CFLAGS -KPIC define SHOBJ_LDFLAGS "-G" define SH_CFLAGS -KPIC define SH_LINKFLAGS -Wl,-export-dynamic define SH_SOPREFIX -Wl,-h, } } |
︙ | ︙ | |||
101 102 103 104 105 106 107 | define SHOBJ_LDFLAGS -shared define SH_CFLAGS "" define SH_LDFLAGS -shared define SH_LINKFLAGS "" define SH_SOPREFIX "" define LD_LIBRARY_PATH LIBRARY_PATH } | < < < < < | 102 103 104 105 106 107 108 109 110 111 112 113 | define SHOBJ_LDFLAGS -shared define SH_CFLAGS "" define SH_LDFLAGS -shared define SH_LINKFLAGS "" define SH_SOPREFIX "" define LD_LIBRARY_PATH LIBRARY_PATH } } if {![is-defined SHOBJ_LDFLAGS_R]} { define SHOBJ_LDFLAGS_R [get-define SHOBJ_LDFLAGS] } |
Changes to autosetup/cc.tcl.
1 2 3 4 5 6 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # The 'cc' module supports checking various 'features' of the C or C++ | | | > < < < < < | 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 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # The 'cc' module supports checking various 'features' of the C or C++ # compiler/linker environment. Common commands are 'cc-check-includes', # 'cc-check-types', 'cc-check-functions', 'cc-with', 'make-config-header' and 'make-template'. # # The following environment variables are used if set: # ## CC - C compiler ## CXX - C++ compiler ## CPP - C preprocessor ## CCACHE - Set to "none" to disable automatic use of ccache ## CFLAGS - Additional C compiler flags ## CXXFLAGS - Additional C++ compiler flags ## LDFLAGS - Additional compiler flags during linking ## LIBS - Additional libraries to use (for all tests) ## CROSS - Tool prefix for cross compilation # # The following variables are defined from the corresponding # environment variables if set. # ## CPPFLAGS ## LINKFLAGS ## CC_FOR_BUILD ## LD use system module-options {} # Checks for the existence of the given function by linking # proc cctest_function {function} { cctest -link 1 -declare "extern void $function\(void);" -code "$function\();" } # Checks for the existence of the given type by compiling |
︙ | ︙ | |||
66 67 68 69 70 71 72 | proc cctest_decl {name} { cctest -code "#ifndef $name\n(void)$name;\n#endif" } # @cc-check-sizeof type ... # # Checks the size of the given types (between 1 and 32, inclusive). | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | proc cctest_decl {name} { cctest -code "#ifndef $name\n(void)$name;\n#endif" } # @cc-check-sizeof type ... # # Checks the size of the given types (between 1 and 32, inclusive). # Defines a variable with the size determined, or 'unknown' otherwise. # e.g. for type 'long long', defines 'SIZEOF_LONG_LONG'. # Returns the size of the last type. # proc cc-check-sizeof {args} { foreach type $args { msg-checking "Checking for sizeof $type..." set size unknown # Try the most common sizes first |
︙ | ︙ | |||
107 108 109 110 111 112 113 | } } return $ret } # @cc-check-includes includes ... # | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | } } return $ret } # @cc-check-includes includes ... # # Checks that the given include files can be used. proc cc-check-includes {args} { cc-check-some-feature $args { set with {} if {[dict exists $::autosetup(cc-include-deps) $each]} { set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]] msg-quiet cc-check-includes {*}$deps foreach i $deps { |
︙ | ︙ | |||
132 133 134 135 136 137 138 | cctest -includes $each } } } # @cc-include-needs include required ... # | | | | | | | | | | | | | | | 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 | cctest -includes $each } } } # @cc-include-needs include required ... # # Ensures that when checking for '$include', a check is first # made for each '$required' file, and if found, it is included with '#include'. proc cc-include-needs {file args} { foreach depfile $args { dict set ::autosetup(cc-include-deps) $file $depfile 1 } } # @cc-check-types type ... # # Checks that the types exist. proc cc-check-types {args} { cc-check-some-feature $args { cctest_type $each } } # @cc-check-defines define ... # # Checks that the given preprocessor symbols are defined. proc cc-check-defines {args} { cc-check-some-feature $args { cctest_define $each } } # @cc-check-decls name ... # # Checks that each given name is either a preprocessor symbol or rvalue # such as an enum. Note that the define used is 'HAVE_DECL_xxx' # rather than 'HAVE_xxx'. proc cc-check-decls {args} { set ret 1 foreach name $args { msg-checking "Checking for $name..." set r [cctest_decl $name] define-feature "decl $name" $r if {$r} { msg-result "ok" } else { msg-result "not found" set ret 0 } } return $ret } # @cc-check-functions function ... # # Checks that the given functions exist (can be linked). proc cc-check-functions {args} { cc-check-some-feature $args { cctest_function $each } } # @cc-check-members type.member ... # # Checks that the given type/structure members exist. # A structure member is of the form 'struct stat.st_mtime'. proc cc-check-members {args} { cc-check-some-feature $args { cctest_member $each } } # @cc-check-function-in-lib function libs ?otherlibs? # # Checks that the given function can be found in one of the libs. # # First checks for no library required, then checks each of the libraries # in turn. # # If the function is found, the feature is defined and 'lib_$function' is defined # to '-l$lib' where the function was found, or "" if no library required. # In addition, '-l$lib' is prepended to the 'LIBS' define. # # If additional libraries may be needed for linking, they should be specified # with '$extralibs' as '-lotherlib1 -lotherlib2'. # These libraries are not automatically added to 'LIBS'. # # Returns 1 if found or 0 if not. # proc cc-check-function-in-lib {function libs {otherlibs {}}} { msg-checking "Checking libs for $function..." set found 0 cc-with [list -libs $otherlibs] { if {[cctest_function $function]} { msg-result "none needed" define lib_$function "" |
︙ | ︙ | |||
238 239 240 241 242 243 244 | incr found break } } } } } | > | < < | | | | | | 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 | incr found break } } } } } define-feature $function $found if {!$found} { msg-result "no" } return $found } # @cc-check-tools tool ... # # Checks for existence of the given compiler tools, taking # into account any cross compilation prefix. # # For example, when checking for 'ar', first 'AR' is checked on the command # line and then in the environment. If not found, '${host}-ar' or # simply 'ar' is assumed depending upon whether cross compiling. # The path is searched for this executable, and if found 'AR' is defined # to the executable name. # Note that even when cross compiling, the simple 'ar' is used as a fallback, # but a warning is generated. This is necessary for some toolchains. # # It is an error if the executable is not found. # proc cc-check-tools {args} { foreach tool $args { set TOOL [string toupper $tool] |
︙ | ︙ | |||
282 283 284 285 286 287 288 | } } # @cc-check-progs prog ... # # Checks for existence of the given executables on the path. # | | | | > > > > > > > > > > > > > > > > > > > > > > > | 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 | } } # @cc-check-progs prog ... # # Checks for existence of the given executables on the path. # # For example, when checking for 'grep', the path is searched for # the executable, 'grep', and if found 'GREP' is defined as 'grep'. # # If the executable is not found, the variable is defined as 'false'. # Returns 1 if all programs were found, or 0 otherwise. # proc cc-check-progs {args} { set failed 0 foreach prog $args { set PROG [string toupper $prog] msg-checking "Checking for $prog..." if {![find-executable $prog]} { msg-result no define $PROG false incr failed } else { msg-result ok define $PROG $prog } } expr {!$failed} } # @cc-path-progs prog ... # # Like cc-check-progs, but sets the define to the full path rather # than just the program name. # proc cc-path-progs {args} { set failed 0 foreach prog $args { set PROG [string toupper $prog] msg-checking "Checking for $prog..." set path [find-executable-path $prog] if {$path eq ""} { msg-result no define $PROG false incr failed } else { msg-result $path define $PROG $path } } expr {!$failed} } # Adds the given settings to $::autosetup(ccsettings) and # returns the old settings. # |
︙ | ︙ | |||
324 325 326 327 328 329 330 | array set new $prev foreach {name value} $settings { switch -exact -- $name { -cflags - -includes { # These are given as lists | | | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | array set new $prev foreach {name value} $settings { switch -exact -- $name { -cflags - -includes { # These are given as lists lappend new($name) {*}[list-non-empty $value] } -declare { lappend new($name) $value } -libs { # Note that new libraries are added before previous libraries set new($name) [list {*}[list-non-empty $value] {*}$new($name)] } -link - -lang - -nooutput { set new($name) $value } -source - -sourcefile - -code { # XXX: These probably are only valid directly from cctest set new($name) $value |
︙ | ︙ | |||
371 372 373 374 375 376 377 | set prev [cc-get-settings] cc-store-settings [dict merge $prev $args] return $prev } # @cc-with settings ?{ script }? # | | | | | | | 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 | set prev [cc-get-settings] cc-store-settings [dict merge $prev $args] return $prev } # @cc-with settings ?{ script }? # # Sets the given 'cctest' settings and then runs the tests in '$script'. # Note that settings such as '-lang' replace the current setting, while # those such as '-includes' are appended to the existing setting. # # If no script is given, the settings become the default for the remainder # of the 'auto.def' file. # ## cc-with {-lang c++} { ## # This will check with the C++ compiler ## cc-check-types bool ## cc-with {-includes signal.h} { ## # This will check with the C++ compiler, signal.h and any existing includes. ## ... ## } ## # back to just the C++ compiler ## } # # The '-libs' setting is special in that newer values are added *before* earlier ones. # ## cc-with {-libs {-lc -lm}} { ## cc-with {-libs -ldl} { ## cctest -libs -lsocket ... ## # libs will be in this order: -lsocket -ldl -lc -lm ## } ## } |
︙ | ︙ | |||
413 414 415 416 417 418 419 | return -code [dict get $info -code] $result } return $result } } # @cctest ?settings? | | | | < | 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 | return -code [dict get $info -code] $result } return $result } } # @cctest ?settings? # # Low level C/C++ compiler checker. Compiles and or links a small C program # according to the arguments and returns 1 if OK, or 0 if not. # # Supported settings are: # ## -cflags cflags A list of flags to pass to the compiler ## -includes list A list of includes, e.g. {stdlib.h stdio.h} ## -declare code Code to declare before main() ## -link 1 Don't just compile, link too ## -lang c|c++ Use the C (default) or C++ compiler ## -libs liblist List of libraries to link, e.g. {-ldl -lm} ## -code code Code to compile in the body of main() ## -source code Compile a complete program. Ignore -includes, -declare and -code ## -sourcefile file Shorthand for -source [readfile [get-define srcdir]/$file] ## -nooutput 1 Treat any compiler output (e.g. a warning) as an error # # Unless '-source' or '-sourcefile' is specified, the C program looks like: # ## #include <firstinclude> /* same for remaining includes in the list */ ## ## declare-code /* any code in -declare, verbatim */ ## ## int main(void) { ## code /* any code in -code, verbatim */ ## return 0; ## } # # Any failures are recorded in 'config.log' # proc cctest {args} { set tmp conftest__ # Easiest way to merge in the settings cc-with $args { array set opts [cc-get-settings] } |
︙ | ︙ | |||
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | } # Build the command line set cmdline {} lappend cmdline {*}[get-define CCACHE] switch -exact -- $opts(-lang) { c++ { lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS] } c { lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS] } default { autosetup-error "cctest called with unknown language: $opts(-lang)" } } | > > | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | } # Build the command line set cmdline {} lappend cmdline {*}[get-define CCACHE] switch -exact -- $opts(-lang) { c++ { set src conftest__.cpp lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS] } c { set src conftest__.c lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS] } default { autosetup-error "cctest called with unknown language: $opts(-lang)" } } |
︙ | ︙ | |||
552 553 554 555 556 557 558 | set ::cc_cache($cmdline,$lines) $ok return $ok } # @make-autoconf-h outfile ?auto-patterns=HAVE_*? ?bare-patterns=SIZEOF_*? # | | | | | | | | | 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 | set ::cc_cache($cmdline,$lines) $ok return $ok } # @make-autoconf-h outfile ?auto-patterns=HAVE_*? ?bare-patterns=SIZEOF_*? # # Deprecated - see 'make-config-header' proc make-autoconf-h {file {autopatterns {HAVE_*}} {barepatterns {SIZEOF_* HAVE_DECL_*}}} { user-notice "*** make-autoconf-h is deprecated -- use make-config-header instead" make-config-header $file -auto $autopatterns -bare $barepatterns } # @make-config-header outfile ?-auto patternlist? ?-bare patternlist? ?-none patternlist? ?-str patternlist? ... # # Examines all defined variables which match the given patterns # and writes an include file, '$file', which defines each of these. # Variables which match '-auto' are output as follows: # - defines which have the value '0' are ignored. # - defines which have integer values are defined as the integer value. # - any other value is defined as a string, e.g. '"value"' # Variables which match '-bare' are defined as-is. # Variables which match '-str' are defined as a string, e.g. '"value"' # Variables which match '-none' are omitted. # # Note that order is important. The first pattern that matches is selected. # Default behaviour is: # ## -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_* -none * # # If the file would be unchanged, it is not written. proc make-config-header {file args} { set guard _[string toupper [regsub -all {[^a-zA-Z0-9]} [file tail $file] _]] file mkdir [file dirname $file] set lines {} lappend lines "#ifndef $guard" |
︙ | ︙ | |||
675 676 677 678 679 680 681 682 683 684 685 686 687 688 | define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] cc gcc false] if {[get-define CC] eq ""} { user-error "Could not find a C compiler. Tried: [join $try ", "]" } define CCACHE [find-an-executable [get-env CCACHE ccache]] # Initial cctest settings cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0} set autosetup(cc-include-deps) {} msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]" if {[get-define CXX] ne "false"} { | > > > > > > > > > | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] cc gcc false] if {[get-define CC] eq ""} { user-error "Could not find a C compiler. Tried: [join $try ", "]" } define CCACHE [find-an-executable [get-env CCACHE ccache]] # If any of these are set in the environment, propagate them to the AUTOREMAKE commandline foreach i {CC CXX CCACHE CPP CFLAGS CXXFLAGS CXXFLAGS LDFLAGS LIBS CROSS CPPFLAGS LINKFLAGS CC_FOR_BUILD LD} { if {[env-is-set $i]} { # Note: If the variable is set on the command line, get-env will return that value # so the command line will continue to override the environment define-append AUTOREMAKE [quote-if-needed $i=[get-env $i ""]] } } # Initial cctest settings cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0} set autosetup(cc-include-deps) {} msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]" if {[get-define CXX] ne "false"} { |
︙ | ︙ |
Changes to autosetup/jimsh0.c.
1 | /* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */ | < < | 1 2 3 4 5 6 7 8 9 | /* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */ #define JIM_TCL_COMPAT #define JIM_ANSIC #define JIM_REGEXP #define HAVE_NO_AUTOCONF #define _JIMAUTOCONF_H #define TCL_LIBRARY "." #define jim_ext_bootstrap #define jim_ext_aio |
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #define TCL_PLATFORM_PLATFORM "windows" #define TCL_PLATFORM_PATH_SEPARATOR ";" #define HAVE_MKDIR_ONE_ARG #define HAVE_SYSTEM #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H #else #define TCL_PLATFORM_OS "unknown" #define TCL_PLATFORM_PLATFORM "unix" #define TCL_PLATFORM_PATH_SEPARATOR ":" #define HAVE_VFORK #define HAVE_WAITPID #define HAVE_ISATTY #define HAVE_MKSTEMP #define HAVE_LINK #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H #endif | > > > > > > > > > > > > > > > | | 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 | #define TCL_PLATFORM_PLATFORM "windows" #define TCL_PLATFORM_PATH_SEPARATOR ";" #define HAVE_MKDIR_ONE_ARG #define HAVE_SYSTEM #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H #define HAVE_UMASK #include <sys/stat.h> #ifndef S_IRWXG #define S_IRWXG 0 #endif #ifndef S_IRWXO #define S_IRWXO 0 #endif #else #define TCL_PLATFORM_OS "unknown" #define TCL_PLATFORM_PLATFORM "unix" #define TCL_PLATFORM_PATH_SEPARATOR ":" #ifdef _MINIX #define vfork fork #define _POSIX_SOURCE #else #define _GNU_SOURCE #endif #define HAVE_VFORK #define HAVE_WAITPID #define HAVE_ISATTY #define HAVE_MKSTEMP #define HAVE_LINK #define HAVE_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H #define HAVE_UMASK #endif #define JIM_VERSION 78 #ifndef JIM_WIN32COMPAT_H #define JIM_WIN32COMPAT_H #ifdef __cplusplus extern "C" { |
︙ | ︙ | |||
86 87 88 89 90 91 92 | #define LLONG_MIN (-LLONG_MAX - 1I64) #endif #define JIM_WIDE_MIN LLONG_MIN #define JIM_WIDE_MAX LLONG_MAX #define JIM_WIDE_MODIFIER "I64d" #define strcasecmp _stricmp #define strtoull _strtoui64 | < | | | < | < < < < | 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 | #define LLONG_MIN (-LLONG_MAX - 1I64) #endif #define JIM_WIDE_MIN LLONG_MIN #define JIM_WIDE_MAX LLONG_MAX #define JIM_WIDE_MODIFIER "I64d" #define strcasecmp _stricmp #define strtoull _strtoui64 #include <io.h> struct timeval { long tv_sec; long tv_usec; }; int gettimeofday(struct timeval *tv, void *unused); #define HAVE_OPENDIR struct dirent { char *d_name; }; typedef struct DIR { long handle; struct _finddata_t info; struct dirent result; char *name; } DIR; DIR *opendir(const char *name); int closedir(DIR *dir); struct dirent *readdir(DIR *dir); #endif #endif #ifdef __cplusplus } #endif #endif #ifndef UTF8_UTIL_H #define UTF8_UTIL_H |
︙ | ︙ | |||
144 145 146 147 148 149 150 | int utf8_fromunicode(char *p, unsigned uc); #ifndef JIM_UTF8 #include <ctype.h> | | > > | | | | 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 | int utf8_fromunicode(char *p, unsigned uc); #ifndef JIM_UTF8 #include <ctype.h> #define utf8_strlen(S, B) ((B) < 0 ? (int)strlen(S) : (B)) #define utf8_strwidth(S, B) utf8_strlen((S), (B)) #define utf8_tounicode(S, CP) (*(CP) = (unsigned char)*(S), 1) #define utf8_getchars(CP, C) (*(CP) = (C), 1) #define utf8_upper(C) toupper(C) #define utf8_title(C) toupper(C) #define utf8_lower(C) tolower(C) #define utf8_index(C, I) (I) #define utf8_charlen(C) 1 #define utf8_prev_len(S, L) 1 #define utf8_width(C) 1 #else #endif #ifdef __cplusplus } #endif #endif #ifndef __JIM__H #define __JIM__H #ifdef __cplusplus extern "C" { #endif #include <time.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #ifndef HAVE_NO_AUTOCONF #endif |
︙ | ︙ | |||
222 223 224 225 226 227 228 | #define JIM_BREAK 3 #define JIM_CONTINUE 4 #define JIM_SIGNAL 5 #define JIM_EXIT 6 #define JIM_EVAL 7 | | | | | | | | | | | | | | | 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 | #define JIM_BREAK 3 #define JIM_CONTINUE 4 #define JIM_SIGNAL 5 #define JIM_EXIT 6 #define JIM_EVAL 7 #define JIM_MAX_CALLFRAME_DEPTH 1000 #define JIM_MAX_EVAL_DEPTH 2000 #define JIM_PRIV_FLAG_SHIFT 20 #define JIM_NONE 0 #define JIM_ERRMSG 1 #define JIM_ENUM_ABBREV 2 #define JIM_UNSHARED 4 #define JIM_MUSTEXIST 8 #define JIM_SUBST_NOVAR 1 #define JIM_SUBST_NOCMD 2 #define JIM_SUBST_NOESC 4 #define JIM_SUBST_FLAG 128 #define JIM_CASESENS 0 #define JIM_NOCASE 1 #define JIM_PATH_LEN 1024 #define JIM_NOTUSED(V) ((void) V) |
︙ | ︙ | |||
337 338 339 340 341 342 343 | #define Jim_GetHashEntryVal(he) ((he)->u.val) #define Jim_GetHashTableCollisions(ht) ((ht)->collisions) #define Jim_GetHashTableSize(ht) ((ht)->size) #define Jim_GetHashTableUsed(ht) ((ht)->used) typedef struct Jim_Obj { | | | | | | | | | | | | > > > > > > | | | | | | | | | | | | | < < < < < | | | 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 | #define Jim_GetHashEntryVal(he) ((he)->u.val) #define Jim_GetHashTableCollisions(ht) ((ht)->collisions) #define Jim_GetHashTableSize(ht) ((ht)->size) #define Jim_GetHashTableUsed(ht) ((ht)->used) typedef struct Jim_Obj { char *bytes; const struct Jim_ObjType *typePtr; int refCount; int length; union { jim_wide wideValue; int intValue; double doubleValue; void *ptr; struct { void *ptr1; void *ptr2; } twoPtrValue; struct { void *ptr; int int1; int int2; } ptrIntValue; struct { struct Jim_Var *varPtr; unsigned long callFrameId; int global; } varValue; struct { struct Jim_Obj *nsObj; struct Jim_Cmd *cmdPtr; unsigned long procEpoch; } cmdValue; struct { struct Jim_Obj **ele; int len; int maxLen; } listValue; struct { int maxLength; int charLength; } strValue; struct { unsigned long id; struct Jim_Reference *refPtr; } refValue; struct { struct Jim_Obj *fileNameObj; int lineNumber; } sourceValue; struct { struct Jim_Obj *varNameObjPtr; struct Jim_Obj *indexObjPtr; } dictSubstValue; struct { int line; int argc; } scriptLineValue; } internalRep; struct Jim_Obj *prevObjPtr; struct Jim_Obj *nextObjPtr; } Jim_Obj; #define Jim_IncrRefCount(objPtr) \ ++(objPtr)->refCount #define Jim_DecrRefCount(interp, objPtr) \ if (--(objPtr)->refCount <= 0) Jim_FreeObj(interp, objPtr) |
︙ | ︙ | |||
440 441 442 443 444 445 446 | typedef void (Jim_FreeInternalRepProc)(struct Jim_Interp *interp, struct Jim_Obj *objPtr); typedef void (Jim_DupInternalRepProc)(struct Jim_Interp *interp, struct Jim_Obj *srcPtr, Jim_Obj *dupPtr); typedef void (Jim_UpdateStringProc)(struct Jim_Obj *objPtr); typedef struct Jim_ObjType { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | typedef void (Jim_FreeInternalRepProc)(struct Jim_Interp *interp, struct Jim_Obj *objPtr); typedef void (Jim_DupInternalRepProc)(struct Jim_Interp *interp, struct Jim_Obj *srcPtr, Jim_Obj *dupPtr); typedef void (Jim_UpdateStringProc)(struct Jim_Obj *objPtr); typedef struct Jim_ObjType { const char *name; Jim_FreeInternalRepProc *freeIntRepProc; Jim_DupInternalRepProc *dupIntRepProc; Jim_UpdateStringProc *updateStringProc; int flags; } Jim_ObjType; #define JIM_TYPE_NONE 0 #define JIM_TYPE_REFERENCES 1 typedef struct Jim_CallFrame { unsigned long id; int level; struct Jim_HashTable vars; struct Jim_HashTable *staticVars; struct Jim_CallFrame *parent; Jim_Obj *const *argv; int argc; Jim_Obj *procArgsObjPtr; Jim_Obj *procBodyObjPtr; struct Jim_CallFrame *next; Jim_Obj *nsObj; Jim_Obj *fileNameObj; int line; Jim_Stack *localCommands; struct Jim_Obj *tailcallObj; struct Jim_Cmd *tailcallCmd; } Jim_CallFrame; typedef struct Jim_Var { Jim_Obj *objPtr; struct Jim_CallFrame *linkFramePtr; } Jim_Var; typedef int Jim_CmdProc(struct Jim_Interp *interp, int argc, Jim_Obj *const *argv); typedef void Jim_DelCmdProc(struct Jim_Interp *interp, void *privData); typedef struct Jim_Cmd { int inUse; int isproc; struct Jim_Cmd *prevCmd; union { struct { Jim_CmdProc *cmdProc; Jim_DelCmdProc *delProc; void *privData; } native; struct { Jim_Obj *argListObjPtr; Jim_Obj *bodyObjPtr; Jim_HashTable *staticVars; int argListLen; int reqArity; int optArity; int argsPos; int upcall; struct Jim_ProcArg { Jim_Obj *nameObjPtr; Jim_Obj *defaultObjPtr; } *arglist; Jim_Obj *nsObj; } proc; } u; } Jim_Cmd; typedef struct Jim_PrngState { unsigned char sbox[256]; unsigned int i, j; } Jim_PrngState; typedef struct Jim_Interp { Jim_Obj *result; int errorLine; Jim_Obj *errorFileNameObj; int addStackTrace; int maxCallFrameDepth; int maxEvalDepth; int evalDepth; int returnCode; int returnLevel; int exitCode; long id; int signal_level; jim_wide sigmask; int (*signal_set_result)(struct Jim_Interp *interp, jim_wide sigmask); Jim_CallFrame *framePtr; Jim_CallFrame *topFramePtr; struct Jim_HashTable commands; unsigned long procEpoch; /* Incremented every time the result of procedures names lookup caching may no longer be valid. */ unsigned long callFrameEpoch; /* Incremented every time a new callframe is created. This id is used for the 'ID' field contained in the Jim_CallFrame structure. */ int local; Jim_Obj *liveList; Jim_Obj *freeList; Jim_Obj *currentScriptObj; Jim_Obj *nullScriptObj; Jim_Obj *emptyObj; Jim_Obj *trueObj; Jim_Obj *falseObj; unsigned long referenceNextId; struct Jim_HashTable references; unsigned long lastCollectId; /* reference max Id of the last GC execution. It's set to ~0 while the collection is running as sentinel to avoid to recursive calls via the [collect] command inside finalizers. */ time_t lastCollectTime; Jim_Obj *stackTrace; Jim_Obj *errorProc; Jim_Obj *unknown; int unknown_called; int errorFlag; void *cmdPrivData; /* Used to pass the private data pointer to a command. It is set to what the user specified via Jim_CreateCommand(). */ struct Jim_CallFrame *freeFramesList; struct Jim_HashTable assocData; Jim_PrngState *prngState; struct Jim_HashTable packages; Jim_Stack *loadHandles; } Jim_Interp; #define Jim_InterpIncrProcEpoch(i) (i)->procEpoch++ #define Jim_SetResultString(i,s,l) Jim_SetResult(i, Jim_NewStringObj(i,s,l)) #define Jim_SetResultInt(i,intval) Jim_SetResult(i, Jim_NewIntObj(i,intval)) #define Jim_SetResultBool(i,b) Jim_SetResultInt(i, b) |
︙ | ︙ | |||
621 622 623 624 625 626 627 | JIM_EXPORT void Jim_Free (void *ptr); JIM_EXPORT char * Jim_StrDup (const char *s); JIM_EXPORT char *Jim_StrDupLen(const char *s, int l); JIM_EXPORT char **Jim_GetEnviron(void); JIM_EXPORT void Jim_SetEnviron(char **env); | | | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | JIM_EXPORT void Jim_Free (void *ptr); JIM_EXPORT char * Jim_StrDup (const char *s); JIM_EXPORT char *Jim_StrDupLen(const char *s, int l); JIM_EXPORT char **Jim_GetEnviron(void); JIM_EXPORT void Jim_SetEnviron(char **env); JIM_EXPORT int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unlink_file); JIM_EXPORT int Jim_Eval(Jim_Interp *interp, const char *script); JIM_EXPORT int Jim_EvalSource(Jim_Interp *interp, const char *filename, int lineno, const char *script); |
︙ | ︙ | |||
814 815 816 817 818 819 820 | JIM_EXPORT int Jim_SetDictKeysVector (Jim_Interp *interp, Jim_Obj *varNamePtr, Jim_Obj *const *keyv, int keyc, Jim_Obj *newObjPtr, int flags); JIM_EXPORT int Jim_DictPairs(Jim_Interp *interp, Jim_Obj *dictPtr, Jim_Obj ***objPtrPtr, int *len); JIM_EXPORT int Jim_DictAddElement(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *keyObjPtr, Jim_Obj *valueObjPtr); | | > > | > > | > > > > | 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 | JIM_EXPORT int Jim_SetDictKeysVector (Jim_Interp *interp, Jim_Obj *varNamePtr, Jim_Obj *const *keyv, int keyc, Jim_Obj *newObjPtr, int flags); JIM_EXPORT int Jim_DictPairs(Jim_Interp *interp, Jim_Obj *dictPtr, Jim_Obj ***objPtrPtr, int *len); JIM_EXPORT int Jim_DictAddElement(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *keyObjPtr, Jim_Obj *valueObjPtr); #define JIM_DICTMATCH_KEYS 0x0001 #define JIM_DICTMATCH_VALUES 0x002 JIM_EXPORT int Jim_DictMatchTypes(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *patternObj, int match_type, int return_types); JIM_EXPORT int Jim_DictSize(Jim_Interp *interp, Jim_Obj *objPtr); JIM_EXPORT int Jim_DictInfo(Jim_Interp *interp, Jim_Obj *objPtr); JIM_EXPORT Jim_Obj *Jim_DictMerge(Jim_Interp *interp, int objc, Jim_Obj *const *objv); JIM_EXPORT int Jim_GetReturnCode (Jim_Interp *interp, Jim_Obj *objPtr, int *intPtr); JIM_EXPORT int Jim_EvalExpression (Jim_Interp *interp, Jim_Obj *exprObjPtr); JIM_EXPORT int Jim_GetBoolFromExpr (Jim_Interp *interp, Jim_Obj *exprObjPtr, int *boolPtr); JIM_EXPORT int Jim_GetBoolean(Jim_Interp *interp, Jim_Obj *objPtr, int *booleanPtr); JIM_EXPORT int Jim_GetWide (Jim_Interp *interp, Jim_Obj *objPtr, jim_wide *widePtr); JIM_EXPORT int Jim_GetLong (Jim_Interp *interp, Jim_Obj *objPtr, long *longPtr); #define Jim_NewWideObj Jim_NewIntObj JIM_EXPORT Jim_Obj * Jim_NewIntObj (Jim_Interp *interp, |
︙ | ︙ | |||
850 851 852 853 854 855 856 857 858 859 860 861 862 863 | JIM_EXPORT Jim_Obj * Jim_NewDoubleObj(Jim_Interp *interp, double doubleValue); JIM_EXPORT void Jim_WrongNumArgs (Jim_Interp *interp, int argc, Jim_Obj *const *argv, const char *msg); JIM_EXPORT int Jim_GetEnum (Jim_Interp *interp, Jim_Obj *objPtr, const char * const *tablePtr, int *indexPtr, const char *name, int flags); JIM_EXPORT int Jim_ScriptIsComplete(Jim_Interp *interp, Jim_Obj *scriptObj, char *stateCharPtr); JIM_EXPORT int Jim_FindByName(const char *name, const char * const array[], size_t len); typedef void (Jim_InterpDeleteProc)(Jim_Interp *interp, void *data); | > > | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | JIM_EXPORT Jim_Obj * Jim_NewDoubleObj(Jim_Interp *interp, double doubleValue); JIM_EXPORT void Jim_WrongNumArgs (Jim_Interp *interp, int argc, Jim_Obj *const *argv, const char *msg); JIM_EXPORT int Jim_GetEnum (Jim_Interp *interp, Jim_Obj *objPtr, const char * const *tablePtr, int *indexPtr, const char *name, int flags); JIM_EXPORT int Jim_CheckShowCommands(Jim_Interp *interp, Jim_Obj *objPtr, const char *const *tablePtr); JIM_EXPORT int Jim_ScriptIsComplete(Jim_Interp *interp, Jim_Obj *scriptObj, char *stateCharPtr); JIM_EXPORT int Jim_FindByName(const char *name, const char * const array[], size_t len); typedef void (Jim_InterpDeleteProc)(Jim_Interp *interp, void *data); |
︙ | ︙ | |||
876 877 878 879 880 881 882 | JIM_EXPORT void Jim_MakeErrorMessage (Jim_Interp *interp); JIM_EXPORT int Jim_InteractivePrompt (Jim_Interp *interp); JIM_EXPORT void Jim_HistoryLoad(const char *filename); JIM_EXPORT void Jim_HistorySave(const char *filename); | | > | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | JIM_EXPORT void Jim_MakeErrorMessage (Jim_Interp *interp); JIM_EXPORT int Jim_InteractivePrompt (Jim_Interp *interp); JIM_EXPORT void Jim_HistoryLoad(const char *filename); JIM_EXPORT void Jim_HistorySave(const char *filename); JIM_EXPORT char *Jim_HistoryGetline(Jim_Interp *interp, const char *prompt); JIM_EXPORT void Jim_HistorySetCompletion(Jim_Interp *interp, Jim_Obj *commandObj); JIM_EXPORT void Jim_HistoryAdd(const char *line); JIM_EXPORT void Jim_HistoryShow(void); JIM_EXPORT int Jim_InitStaticExtensions(Jim_Interp *interp); JIM_EXPORT int Jim_StringToWide(const char *str, jim_wide *widePtr, int base); JIM_EXPORT int Jim_IsBigEndian(void); |
︙ | ︙ | |||
902 903 904 905 906 907 908 | JIM_EXPORT int Jim_IsDict(Jim_Obj *objPtr); JIM_EXPORT int Jim_IsList(Jim_Obj *objPtr); #ifdef __cplusplus } #endif | | | | | | | | | | | 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 | JIM_EXPORT int Jim_IsDict(Jim_Obj *objPtr); JIM_EXPORT int Jim_IsList(Jim_Obj *objPtr); #ifdef __cplusplus } #endif #endif #ifndef JIM_SUBCMD_H #define JIM_SUBCMD_H #ifdef __cplusplus extern "C" { #endif #define JIM_MODFLAG_HIDDEN 0x0001 #define JIM_MODFLAG_FULLARGV 0x0002 typedef int jim_subcmd_function(Jim_Interp *interp, int argc, Jim_Obj *const *argv); typedef struct { const char *cmd; const char *args; jim_subcmd_function *function; short minargs; short maxargs; unsigned short flags; } jim_subcmd_type; const jim_subcmd_type * Jim_ParseSubCmd(Jim_Interp *interp, const jim_subcmd_type *command_table, int argc, Jim_Obj *const *argv); int Jim_SubCmdProc(Jim_Interp *interp, int argc, Jim_Obj *const *argv); |
︙ | ︙ | |||
958 959 960 961 962 963 964 | typedef struct { int rm_so; int rm_eo; } regmatch_t; typedef struct regexp { | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | typedef struct { int rm_so; int rm_eo; } regmatch_t; typedef struct regexp { int re_nsub; int cflags; int err; int regstart; int reganch; int regmust; int regmlen; int *program; const char *regparse; int p; int proglen; int eflags; const char *start; const char *reginput; const char *regbol; regmatch_t *pmatch; int nmatch; } regexp; typedef regexp regex_t; #define REG_EXTENDED 0 #define REG_NEWLINE 1 #define REG_ICASE 2 #define REG_NOTBOL 16 enum { REG_NOERROR, REG_NOMATCH, REG_BADPAT, REG_ERR_NULL_ARGUMENT, REG_ERR_UNKNOWN, REG_ERR_TOO_BIG, REG_ERR_NOMEM, REG_ERR_TOO_MANY_PAREN, REG_ERR_UNMATCHED_PAREN, REG_ERR_UNMATCHED_BRACES, |
︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); void regfree(regex_t *preg); #ifdef __cplusplus } #endif #endif int Jim_bootstrapInit(Jim_Interp *interp) { if (Jim_PackageProvide(interp, "bootstrap", "1.0", JIM_ERRMSG)) return JIM_ERR; return Jim_EvalSource(interp, "bootstrap.tcl", 1, "\n" "\n" | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | | | 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 | size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); void regfree(regex_t *preg); #ifdef __cplusplus } #endif #endif #ifndef JIM_SIGNAL_H #define JIM_SIGNAL_H #ifdef __cplusplus extern "C" { #endif const char *Jim_SignalId(int sig); #ifdef __cplusplus } #endif #endif #ifndef JIMIOCOMPAT_H #define JIMIOCOMPAT_H #include <stdio.h> #include <errno.h> void Jim_SetResultErrno(Jim_Interp *interp, const char *msg); int Jim_OpenForWrite(const char *filename, int append); int Jim_OpenForRead(const char *filename); #if defined(__MINGW32__) #ifndef STRICT #define STRICT #endif #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <fcntl.h> #include <io.h> #include <process.h> typedef HANDLE pidtype; #define JIM_BAD_PID INVALID_HANDLE_VALUE #define JIM_NO_PID INVALID_HANDLE_VALUE #define WIFEXITED(STATUS) (((STATUS) & 0xff00) == 0) #define WEXITSTATUS(STATUS) ((STATUS) & 0x00ff) #define WIFSIGNALED(STATUS) (((STATUS) & 0xff00) != 0) #define WTERMSIG(STATUS) (((STATUS) >> 8) & 0xff) #define WNOHANG 1 int Jim_Errno(void); pidtype waitpid(pidtype pid, int *status, int nohang); #define HAVE_PIPE #define pipe(P) _pipe((P), 0, O_NOINHERIT) #elif defined(HAVE_UNISTD_H) #include <unistd.h> #include <fcntl.h> #include <sys/wait.h> #include <sys/stat.h> typedef int pidtype; #define Jim_Errno() errno #define JIM_BAD_PID -1 #define JIM_NO_PID 0 #ifndef HAVE_EXECVPE #define execvpe(ARG0, ARGV, ENV) execvp(ARG0, ARGV) #endif #endif #endif int Jim_bootstrapInit(Jim_Interp *interp) { if (Jim_PackageProvide(interp, "bootstrap", "1.0", JIM_ERRMSG)) return JIM_ERR; return Jim_EvalSource(interp, "bootstrap.tcl", 1, "\n" "\n" "proc package {cmd pkg args} {\n" " if {$cmd eq \"require\"} {\n" " foreach path $::auto_path {\n" " set pkgpath $path/$pkg.tcl\n" " if {$path eq \".\"} {\n" " set pkgpath $pkg.tcl\n" " }\n" " if {[file exists $pkgpath]} {\n" " uplevel #0 [list source $pkgpath]\n" " return\n" " }\n" " }\n" " }\n" "}\n" ); } |
︙ | ︙ | |||
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | " return \"\"\n" "}\n" "\n" "if {$tcl_platform(platform) eq \"windows\"} {\n" " set jim::argv0 [string map {\\\\ /} $jim::argv0]\n" "}\n" "\n" "_jimsh_init\n" ); } int Jim_globInit(Jim_Interp *interp) { if (Jim_PackageProvide(interp, "glob", "1.0", JIM_ERRMSG)) return JIM_ERR; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | " return \"\"\n" "}\n" "\n" "if {$tcl_platform(platform) eq \"windows\"} {\n" " set jim::argv0 [string map {\\\\ /} $jim::argv0]\n" "}\n" "\n" "\n" "set tcl::autocomplete_commands {info tcl::prefix socket namespace array clock file package string dict signal history}\n" "\n" "\n" "\n" "proc tcl::autocomplete {prefix} {\n" " if {[set space [string first \" \" $prefix]] != -1} {\n" " set cmd [string range $prefix 0 $space-1]\n" " if {$cmd in $::tcl::autocomplete_commands || [info channel $cmd] ne \"\"} {\n" " set arg [string range $prefix $space+1 end]\n" "\n" " return [lmap p [$cmd -commands] {\n" " if {![string match \"${arg}*\" $p]} continue\n" " function \"$cmd $p\"\n" " }]\n" " }\n" " }\n" "\n" " if {[string match \"source *\" $prefix]} {\n" " set path [string range $prefix 7 end]\n" " return [lmap p [glob -nocomplain \"${path}*\"] {\n" " function \"source $p\"\n" " }]\n" " }\n" "\n" " return [lmap p [lsort [info commands $prefix*]] {\n" " if {[string match \"* *\" $p]} {\n" " continue\n" " }\n" " function $p\n" " }]\n" "}\n" "\n" "_jimsh_init\n" ); } int Jim_globInit(Jim_Interp *interp) { if (Jim_PackageProvide(interp, "glob", "1.0", JIM_ERRMSG)) return JIM_ERR; |
︙ | ︙ | |||
1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | { if (Jim_PackageProvide(interp, "stdlib", "1.0", JIM_ERRMSG)) return JIM_ERR; return Jim_EvalSource(interp, "stdlib.tcl", 1, "\n" "\n" "\n" "proc lambda {arglist args} {\n" " tailcall proc [ref {} function lambda.finalizer] $arglist {*}$args\n" "}\n" "\n" "proc lambda.finalizer {name val} {\n" " rename $name {}\n" | > > > > > > > | 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | { if (Jim_PackageProvide(interp, "stdlib", "1.0", JIM_ERRMSG)) return JIM_ERR; return Jim_EvalSource(interp, "stdlib.tcl", 1, "\n" "\n" "if {![exists -command ref]} {\n" "\n" " proc ref {args} {{count 0}} {\n" " format %08x [incr count]\n" " }\n" "}\n" "\n" "\n" "proc lambda {arglist args} {\n" " tailcall proc [ref {} function lambda.finalizer] $arglist {*}$args\n" "}\n" "\n" "proc lambda.finalizer {name val} {\n" " rename $name {}\n" |
︙ | ︙ | |||
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | " lappend lines $line\n" " }\n" " }\n" " join $lines \\n\n" "}\n" "\n" "\n" "\n" "proc errorInfo {msg {stacktrace \"\"}} {\n" " if {$stacktrace eq \"\"} {\n" "\n" " set stacktrace [info stacktrace]\n" "\n" " lappend stacktrace {*}[stacktrace 1]\n" | > > > > > > > | 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | " lappend lines $line\n" " }\n" " }\n" " join $lines \\n\n" "}\n" "\n" "\n" "\n" "proc defer {script} {\n" " upvar jim::defer v\n" " lappend v $script\n" "}\n" "\n" "\n" "\n" "proc errorInfo {msg {stacktrace \"\"}} {\n" " if {$stacktrace eq \"\"} {\n" "\n" " set stacktrace [info stacktrace]\n" "\n" " lappend stacktrace {*}[stacktrace 1]\n" |
︙ | ︙ | |||
1400 1401 1402 1403 1404 1405 1406 | "\n" "proc {info nameofexecutable} {} {\n" " if {[exists ::jim::exe]} {\n" " return $::jim::exe\n" " }\n" "}\n" "\n" | < < < < < < < < < < < < < < < < < < < < < | 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | "\n" "proc {info nameofexecutable} {} {\n" " if {[exists ::jim::exe]} {\n" " return $::jim::exe\n" " }\n" "}\n" "\n" "\n" "proc {dict update} {&varName args script} {\n" " set keys {}\n" " foreach {n v} $args {\n" " upvar $v var_$v\n" " if {[dict exists $varName $n]} {\n" " set var_$v [dict get $varName $n]\n" |
︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 | " dict unset varName $n\n" " }\n" " }\n" " }\n" " return {*}$opts $msg\n" "}\n" "\n" | < < < < < < < < < < < < < | 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | " dict unset varName $n\n" " }\n" " }\n" " }\n" " return {*}$opts $msg\n" "}\n" "\n" "proc {dict replace} {dictionary {args {key value}}} {\n" " if {[llength ${key value}] % 2} {\n" " tailcall {dict replace}\n" " }\n" " tailcall dict merge $dictionary ${key value}\n" "}\n" "\n" |
︙ | ︙ | |||
1501 1502 1503 1504 1505 1506 1507 | "proc {dict remove} {dictionary {args key}} {\n" " foreach k $key {\n" " dict unset dictionary $k\n" " }\n" " return $dictionary\n" "}\n" "\n" | < < < < < | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | "proc {dict remove} {dictionary {args key}} {\n" " foreach k $key {\n" " dict unset dictionary $k\n" " }\n" " return $dictionary\n" "}\n" "\n" "\n" "proc {dict for} {vars dictionary script} {\n" " if {[llength $vars] != 2} {\n" " return -code error \"must have exactly two variable names\"\n" " }\n" " dict size $dictionary\n" " tailcall foreach $vars $dictionary $script\n" |
︙ | ︙ | |||
1589 1590 1591 1592 1593 1594 1595 | "\n" "proc fileevent {args} {\n" " tailcall {*}$args\n" "}\n" "\n" "\n" "\n" | < | 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 | "\n" "proc fileevent {args} {\n" " tailcall {*}$args\n" "}\n" "\n" "\n" "\n" "proc parray {arrayname {pattern *} {puts puts}} {\n" " upvar $arrayname a\n" "\n" " set max 0\n" " foreach name [array names a $pattern]] {\n" " if {[string length $name] > $max} {\n" " set max [string length $name]\n" |
︙ | ︙ | |||
1645 1646 1647 1648 1649 1650 1651 | " catch {$in close}\n" " }\n" "}\n" "\n" "\n" "\n" "proc popen {cmd {mode r}} {\n" | | > > > > | > > > > > > > > > > > | | 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 | " catch {$in close}\n" " }\n" "}\n" "\n" "\n" "\n" "proc popen {cmd {mode r}} {\n" " lassign [pipe] r w\n" " try {\n" " if {[string match \"w*\" $mode]} {\n" " lappend cmd <@$r &\n" " set pids [exec {*}$cmd]\n" " $r close\n" " set f $w\n" " } else {\n" " lappend cmd >@$w &\n" " set pids [exec {*}$cmd]\n" " $w close\n" " set f $r\n" " }\n" " lambda {cmd args} {f pids} {\n" " if {$cmd eq \"pid\"} {\n" " return $pids\n" " }\n" " if {$cmd eq \"getfd\"} {\n" " $f getfd\n" " }\n" " if {$cmd eq \"close\"} {\n" " $f close\n" "\n" " set retopts {}\n" " foreach p $pids {\n" " lassign [wait $p] status - rc\n" " if {$status eq \"CHILDSTATUS\"} {\n" " if {$rc == 0} {\n" " continue\n" " }\n" " set msg \"child process exited abnormally\"\n" " } else {\n" " set msg \"child killed: received signal\"\n" " }\n" " set retopts [list -code error -errorcode [list $status $p $rc] $msg]\n" " }\n" " return {*}$retopts\n" " }\n" " tailcall $f $cmd {*}$args\n" " }\n" " } on error {error opts} {\n" " $r close\n" " $w close\n" " error $error\n" |
︙ | ︙ | |||
1690 1691 1692 1693 1694 1695 1696 | " return -code error \"can not find channel named \\\"$channelId\\\"\"\n" " }\n" " if {[catch {$channelId pid} pids]} {\n" " return \"\"\n" " }\n" " return $pids\n" "}\n" | < < < < | 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | " return -code error \"can not find channel named \\\"$channelId\\\"\"\n" " }\n" " if {[catch {$channelId pid} pids]} {\n" " return \"\"\n" " }\n" " return $pids\n" "}\n" "\n" "\n" "\n" "\n" "\n" "\n" "\n" |
︙ | ︙ | |||
1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 | " }\n" " file delete $path\n" "}\n" ); } #include <stdio.h> #include <string.h> #include <errno.h> #include <fcntl.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #include <sys/stat.h> #endif #if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_SELECT) && defined(HAVE_NETINET_IN_H) && defined(HAVE_NETDB_H) && defined(HAVE_ARPA_INET_H) #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif #else #define JIM_ANSIC #endif #if defined(JIM_SSL) #include <openssl/ssl.h> #include <openssl/err.h> #endif | > > > > > > > > > > | | > | > > > | | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 | " }\n" " file delete $path\n" "}\n" ); } #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <stdio.h> #include <string.h> #include <errno.h> #include <fcntl.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #include <sys/stat.h> #endif #if defined(HAVE_SYS_SOCKET_H) && defined(HAVE_SELECT) && defined(HAVE_NETINET_IN_H) && defined(HAVE_NETDB_H) && defined(HAVE_ARPA_INET_H) #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif #define HAVE_SOCKETS #elif defined (__MINGW32__) #else #define JIM_ANSIC #endif #if defined(JIM_SSL) #include <openssl/ssl.h> #include <openssl/err.h> #endif #ifdef HAVE_TERMIOS_H #endif #define AIO_CMD_LEN 32 #define AIO_BUF_LEN 256 #ifndef HAVE_FTELLO #define ftello ftell #endif #ifndef HAVE_FSEEKO #define fseeko fseek #endif #define AIO_KEEPOPEN 1 #if defined(JIM_IPV6) #define IPV6 1 #else #define IPV6 0 #ifndef PF_INET6 #define PF_INET6 0 #endif #endif #ifdef JIM_ANSIC #undef HAVE_PIPE #undef HAVE_SOCKETPAIR #endif struct AioFile; typedef struct { int (*writer)(struct AioFile *af, const char *buf, int len); int (*reader)(struct AioFile *af, char *buf, int len); const char *(*getline)(struct AioFile *af, char *buf, int len); int (*error)(const struct AioFile *af); const char *(*strerror)(struct AioFile *af); int (*verify)(struct AioFile *af); } JimAioFopsType; typedef struct AioFile { FILE *fp; Jim_Obj *filename; int type; int openFlags; int fd; Jim_Obj *rEvent; Jim_Obj *wEvent; Jim_Obj *eEvent; int addr_family; void *ssl; const JimAioFopsType *fops; |
︙ | ︙ | |||
1877 1878 1879 1880 1881 1882 1883 | static int stdio_error(const AioFile *af) { if (!ferror(af->fp)) { return JIM_OK; } clearerr(af->fp); | | | | 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 | static int stdio_error(const AioFile *af) { if (!ferror(af->fp)) { return JIM_OK; } clearerr(af->fp); if (feof(af->fp) || errno == EAGAIN || errno == EINTR) { return JIM_OK; } #ifdef ECONNRESET if (errno == ECONNRESET) { return JIM_OK; } #endif #ifdef ECONNABORTED if (errno == ECONNABORTED) { return JIM_OK; } #endif return JIM_ERR; } static const char *stdio_strerror(struct AioFile *af) |
︙ | ︙ | |||
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 | if (name) { Jim_SetResultFormatted(interp, "%#s: %s", name, JimAioErrorString(af)); } else { Jim_SetResultString(interp, JimAioErrorString(af), -1); } } static void JimAioDelProc(Jim_Interp *interp, void *privData) { AioFile *af = privData; JIM_NOTUSED(interp); Jim_DecrRefCount(interp, af->filename); #ifdef jim_ext_eventloop | > > > > > > > > > | | < | | 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 | if (name) { Jim_SetResultFormatted(interp, "%#s: %s", name, JimAioErrorString(af)); } else { Jim_SetResultString(interp, JimAioErrorString(af), -1); } } static int JimCheckStreamError(Jim_Interp *interp, AioFile *af) { int ret = af->fops->error(af); if (ret) { JimAioSetError(interp, af->filename); } return ret; } static void JimAioDelProc(Jim_Interp *interp, void *privData) { AioFile *af = privData; JIM_NOTUSED(interp); Jim_DecrRefCount(interp, af->filename); #ifdef jim_ext_eventloop Jim_DeleteFileHandler(interp, af->fd, JIM_EVENT_READABLE | JIM_EVENT_WRITABLE | JIM_EVENT_EXCEPTION); #endif #if defined(JIM_SSL) if (af->ssl != NULL) { SSL_free(af->ssl); } #endif if (!(af->openFlags & AIO_KEEPOPEN)) { fclose(af->fp); } Jim_Free(af); } static int aio_cmd_read(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); char buf[AIO_BUF_LEN]; Jim_Obj *objPtr; int nonewline = 0; jim_wide neededLen = -1; if (argc && Jim_CompareStringImmediate(interp, argv[0], "-nonewline")) { nonewline = 1; argv++; argc--; } if (argc == 1) { |
︙ | ︙ | |||
2005 2006 2007 2008 2009 2010 2011 | if (neededLen != -1) { neededLen -= retval; } } if (retval != readlen) break; } | | | 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 | if (neededLen != -1) { neededLen -= retval; } } if (retval != readlen) break; } if (JimCheckStreamError(interp, af)) { Jim_FreeNewObj(interp, objPtr); return JIM_ERR; } if (nonewline) { int len; const char *s = Jim_GetString(objPtr, &len); |
︙ | ︙ | |||
2027 2028 2029 2030 2031 2032 2033 | return JIM_OK; } AioFile *Jim_AioFile(Jim_Interp *interp, Jim_Obj *command) { Jim_Cmd *cmdPtr = Jim_GetCommand(interp, command, JIM_ERRMSG); | | > > > > > > > > > > | 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 | return JIM_OK; } AioFile *Jim_AioFile(Jim_Interp *interp, Jim_Obj *command) { Jim_Cmd *cmdPtr = Jim_GetCommand(interp, command, JIM_ERRMSG); if (cmdPtr && !cmdPtr->isproc && cmdPtr->u.native.cmdProc == JimAioSubCmdProc) { return (AioFile *) cmdPtr->u.native.privData; } Jim_SetResultFormatted(interp, "Not a filehandle: \"%#s\"", command); return NULL; } FILE *Jim_AioFilehandle(Jim_Interp *interp, Jim_Obj *command) { AioFile *af; af = Jim_AioFile(interp, command); if (af == NULL) { return NULL; } return af->fp; } static int aio_cmd_getfd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); fflush(af->fp); Jim_SetResultInt(interp, fileno(af->fp)); return JIM_OK; } static int aio_cmd_copy(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); jim_wide count = 0; jim_wide maxlen = JIM_WIDE_MAX; AioFile *outf = Jim_AioFile(interp, argv[0]); |
︙ | ︙ | |||
2108 2109 2110 2111 2112 2113 2114 | if (buf[AIO_BUF_LEN - 1] == '\0' && buf[AIO_BUF_LEN - 2] != '\n') { Jim_AppendString(interp, objPtr, buf, AIO_BUF_LEN - 1); } else { len = strlen(buf); if (len && (buf[len - 1] == '\n')) { | | | | | 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 | if (buf[AIO_BUF_LEN - 1] == '\0' && buf[AIO_BUF_LEN - 2] != '\n') { Jim_AppendString(interp, objPtr, buf, AIO_BUF_LEN - 1); } else { len = strlen(buf); if (len && (buf[len - 1] == '\n')) { len--; } Jim_AppendString(interp, objPtr, buf, len); break; } } if (JimCheckStreamError(interp, af)) { Jim_FreeNewObj(interp, objPtr); return JIM_ERR; } if (argc) { if (Jim_SetVariable(interp, argv[0], objPtr) != JIM_OK) { Jim_FreeNewObj(interp, objPtr); return JIM_ERR; } len = Jim_Length(objPtr); if (len == 0 && feof(af->fp)) { len = -1; } Jim_SetResultInt(interp, len); } else { Jim_SetResult(interp, objPtr); } |
︙ | ︙ | |||
2205 2206 2207 2208 2209 2210 2211 | Jim_SetResultInt(interp, feof(af->fp)); return JIM_OK; } static int aio_cmd_close(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc == 3) { | | | 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 | Jim_SetResultInt(interp, feof(af->fp)); return JIM_OK; } static int aio_cmd_close(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc == 3) { #if defined(HAVE_SOCKETS) && defined(HAVE_SHUTDOWN) static const char * const options[] = { "r", "w", NULL }; enum { OPT_R, OPT_W, }; int option; AioFile *af = Jim_CmdPrivData(interp); if (Jim_GetEnum(interp, argv[2], options, &option, NULL, JIM_ERRMSG) != JIM_OK) { return JIM_ERR; |
︙ | ︙ | |||
2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 | } (void)fcntl(af->fd, F_SETFL, fmode); } Jim_SetResultInt(interp, (fmode & O_NONBLOCK) ? 1 : 0); return JIM_OK; } #endif #ifdef HAVE_FSYNC static int aio_cmd_sync(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); fflush(af->fp); | > | 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 | } (void)fcntl(af->fd, F_SETFL, fmode); } Jim_SetResultInt(interp, (fmode & O_NONBLOCK) ? 1 : 0); return JIM_OK; } #endif #ifdef HAVE_FSYNC static int aio_cmd_sync(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); fflush(af->fp); |
︙ | ︙ | |||
2362 2363 2364 2365 2366 2367 2368 | return Jim_EvalObjBackground(interp, *objPtrPtr); } static int aio_eventinfo(Jim_Interp *interp, AioFile * af, unsigned mask, Jim_Obj **scriptHandlerObj, int argc, Jim_Obj * const *argv) { if (argc == 0) { | | | | | | | | | 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 | return Jim_EvalObjBackground(interp, *objPtrPtr); } static int aio_eventinfo(Jim_Interp *interp, AioFile * af, unsigned mask, Jim_Obj **scriptHandlerObj, int argc, Jim_Obj * const *argv) { if (argc == 0) { if (*scriptHandlerObj) { Jim_SetResult(interp, *scriptHandlerObj); } return JIM_OK; } if (*scriptHandlerObj) { Jim_DeleteFileHandler(interp, af->fd, mask); } if (Jim_Length(argv[0]) == 0) { return JIM_OK; } Jim_IncrRefCount(argv[0]); *scriptHandlerObj = argv[0]; Jim_CreateFileHandler(interp, af->fd, mask, JimAioFileEventHandler, scriptHandlerObj, JimAioFileEventFinalizer); return JIM_OK; } static int aio_cmd_readable(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { |
︙ | ︙ | |||
2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 | { AioFile *af = Jim_CmdPrivData(interp); return aio_eventinfo(interp, af, JIM_EVENT_EXCEPTION, &af->eEvent, argc, argv); } #endif static const jim_subcmd_type aio_command_table[] = { { "read", "?-nonewline? ?len?", aio_cmd_read, 0, 2, | > > | | > > > > > > > | | | | | | | | | | | | | | | | 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 | { AioFile *af = Jim_CmdPrivData(interp); return aio_eventinfo(interp, af, JIM_EVENT_EXCEPTION, &af->eEvent, argc, argv); } #endif static const jim_subcmd_type aio_command_table[] = { { "read", "?-nonewline? ?len?", aio_cmd_read, 0, 2, }, { "copyto", "handle ?size?", aio_cmd_copy, 1, 2, }, { "getfd", NULL, aio_cmd_getfd, 0, 0, }, { "gets", "?var?", aio_cmd_gets, 0, 1, }, { "puts", "?-nonewline? str", aio_cmd_puts, 1, 2, }, { "isatty", NULL, aio_cmd_isatty, 0, 0, }, { "flush", NULL, aio_cmd_flush, 0, 0, }, { "eof", NULL, aio_cmd_eof, 0, 0, }, { "close", "?r(ead)|w(rite)?", aio_cmd_close, 0, 1, JIM_MODFLAG_FULLARGV, }, { "seek", "offset ?start|current|end", aio_cmd_seek, 1, 2, }, { "tell", NULL, aio_cmd_tell, 0, 0, }, { "filename", NULL, aio_cmd_filename, 0, 0, }, #ifdef O_NDELAY { "ndelay", "?0|1?", aio_cmd_ndelay, 0, 1, }, #endif #ifdef HAVE_FSYNC { "sync", NULL, aio_cmd_sync, 0, 0, }, #endif { "buffering", "none|line|full", aio_cmd_buffering, 1, 1, }, #ifdef jim_ext_eventloop { "readable", "?readable-script?", aio_cmd_readable, 0, 1, }, { "writable", "?writable-script?", aio_cmd_writable, 0, 1, }, { "onexception", "?exception-script?", aio_cmd_onexception, 0, 1, }, #endif { NULL } }; static int JimAioSubCmdProc(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { |
︙ | ︙ | |||
2564 2565 2566 2567 2568 2569 2570 | mode = (argc == 3) ? Jim_String(argv[2]) : "r"; #ifdef jim_ext_tclcompat { const char *filename = Jim_String(argv[1]); | | | 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 | mode = (argc == 3) ? Jim_String(argv[2]) : "r"; #ifdef jim_ext_tclcompat { const char *filename = Jim_String(argv[1]); if (*filename == '|') { Jim_Obj *evalObj[3]; evalObj[0] = Jim_NewStringObj(interp, "::popen", -1); evalObj[1] = Jim_NewStringObj(interp, filename + 1, -1); evalObj[2] = Jim_NewStringObj(interp, mode, -1); |
︙ | ︙ | |||
2601 2602 2603 2604 2605 2606 2607 | if (!filename) { filename = Jim_NewStringObj(interp, buf, -1); } Jim_IncrRefCount(filename); if (fh == NULL) { | < > > < | | < > > > | < | | | < | < < | < < < < | < | < < < < < < < | < < < | < < | | < < | | < | < | < < < > | | > > > | | 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 | if (!filename) { filename = Jim_NewStringObj(interp, buf, -1); } Jim_IncrRefCount(filename); if (fh == NULL) { if (fd >= 0) { #ifndef JIM_ANSIC fh = fdopen(fd, mode); #endif } else fh = fopen(Jim_String(filename), mode); if (fh == NULL) { JimAioSetError(interp, filename); #ifndef JIM_ANSIC if (fd >= 0) { close(fd); } #endif Jim_DecrRefCount(interp, filename); return NULL; } } af = Jim_Alloc(sizeof(*af)); memset(af, 0, sizeof(*af)); af->fp = fh; af->filename = filename; af->openFlags = openFlags; #ifndef JIM_ANSIC af->fd = fileno(fh); #ifdef FD_CLOEXEC if ((openFlags & AIO_KEEPOPEN) == 0) { (void)fcntl(af->fd, F_SETFD, FD_CLOEXEC); } #endif #endif af->addr_family = family; af->fops = &stdio_fops; af->ssl = NULL; Jim_CreateCommand(interp, buf, JimAioSubCmdProc, af, JimAioDelProc); Jim_SetResult(interp, Jim_MakeGlobalNamespaceName(interp, Jim_NewStringObj(interp, buf, -1))); return af; } #if defined(HAVE_PIPE) || (defined(HAVE_SOCKETPAIR) && defined(HAVE_SYS_UN_H)) static int JimMakeChannelPair(Jim_Interp *interp, int p[2], Jim_Obj *filename, const char *hdlfmt, int family, const char *mode[2]) { if (JimMakeChannel(interp, NULL, p[0], filename, hdlfmt, family, mode[0])) { Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0); Jim_ListAppendElement(interp, objPtr, Jim_GetResult(interp)); if (JimMakeChannel(interp, NULL, p[1], filename, hdlfmt, family, mode[1])) { Jim_ListAppendElement(interp, objPtr, Jim_GetResult(interp)); Jim_SetResult(interp, objPtr); return JIM_OK; } } close(p[0]); close(p[1]); JimAioSetError(interp, NULL); return JIM_ERR; } #endif #ifdef HAVE_PIPE static int JimAioPipeCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int p[2]; static const char *mode[2] = { "r", "w" }; if (argc != 1) { Jim_WrongNumArgs(interp, 1, argv, ""); return JIM_ERR; } if (pipe(p) != 0) { JimAioSetError(interp, NULL); return JIM_ERR; } return JimMakeChannelPair(interp, p, argv[0], "aio.pipe%ld", 0, mode); } #endif int Jim_aioInit(Jim_Interp *interp) { if (Jim_PackageProvide(interp, "aio", "1.0", JIM_ERRMSG)) return JIM_ERR; #if defined(JIM_SSL) Jim_CreateCommand(interp, "load_ssl_certs", JimAioLoadSSLCertsCommand, NULL, NULL); #endif Jim_CreateCommand(interp, "open", JimAioOpenCommand, NULL, NULL); #ifdef HAVE_SOCKETS Jim_CreateCommand(interp, "socket", JimAioSockCommand, NULL, NULL); #endif #ifdef HAVE_PIPE Jim_CreateCommand(interp, "pipe", JimAioPipeCommand, NULL, NULL); #endif JimMakeChannel(interp, stdin, -1, NULL, "stdin", 0, "r"); JimMakeChannel(interp, stdout, -1, NULL, "stdout", 0, "w"); JimMakeChannel(interp, stderr, -1, NULL, "stderr", 0, "w"); return JIM_OK; } |
︙ | ︙ | |||
2811 2812 2813 2814 2815 2816 2817 | #if defined(JIM_REGEXP) #else #include <regex.h> #endif static void FreeRegexpInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) { | | | | | | | | | | | | 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 | #if defined(JIM_REGEXP) #else #include <regex.h> #endif static void FreeRegexpInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) { regfree(objPtr->internalRep.ptrIntValue.ptr); Jim_Free(objPtr->internalRep.ptrIntValue.ptr); } static const Jim_ObjType regexpObjType = { "regexp", FreeRegexpInternalRep, NULL, NULL, JIM_TYPE_NONE }; static regex_t *SetRegexpFromAny(Jim_Interp *interp, Jim_Obj *objPtr, unsigned flags) { regex_t *compre; const char *pattern; int ret; if (objPtr->typePtr == ®expObjType && objPtr->internalRep.ptrIntValue.ptr && objPtr->internalRep.ptrIntValue.int1 == flags) { return objPtr->internalRep.ptrIntValue.ptr; } pattern = Jim_String(objPtr); compre = Jim_Alloc(sizeof(regex_t)); if ((ret = regcomp(compre, pattern, REG_EXTENDED | flags)) != 0) { char buf[100]; regerror(ret, compre, buf, sizeof(buf)); Jim_SetResultFormatted(interp, "couldn't compile regular expression pattern: %s", buf); regfree(compre); Jim_Free(compre); return NULL; } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = ®expObjType; objPtr->internalRep.ptrIntValue.int1 = flags; objPtr->internalRep.ptrIntValue.ptr = compre; return compre; } int Jim_RegexpCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int opt_indices = 0; |
︙ | ︙ | |||
2999 3000 3001 3002 3003 3004 3005 | if (match == REG_NOMATCH) { goto done; } num_matches++; if (opt_all && !opt_inline) { | | | 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 | if (match == REG_NOMATCH) { goto done; } num_matches++; if (opt_all && !opt_inline) { goto try_next_match; } j = 0; for (i += 2; opt_inline ? j < num_vars : i < argc; i++, j++) { Jim_Obj *resultObj; |
︙ | ︙ | |||
3039 3040 3041 3042 3043 3044 3045 | } } if (opt_inline) { Jim_ListAppendElement(interp, resultListObj, resultObj); } else { | | | 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 | } } if (opt_inline) { Jim_ListAppendElement(interp, resultListObj, resultObj); } else { result = Jim_SetVariable(interp, argv[i], resultObj); if (result != JIM_OK) { Jim_FreeObj(interp, resultObj); break; } } |
︙ | ︙ | |||
3166 3167 3168 3169 3170 3171 3172 | } pattern = Jim_String(argv[i]); source_str = Jim_GetString(argv[i + 1], &source_len); replace_str = Jim_GetString(argv[i + 2], &replace_len); varname = argv[i + 3]; | | | | 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 | } pattern = Jim_String(argv[i]); source_str = Jim_GetString(argv[i + 1], &source_len); replace_str = Jim_GetString(argv[i + 2], &replace_len); varname = argv[i + 3]; resultObj = Jim_NewStringObj(interp, "", 0); if (offset) { if (offset < 0) { offset += source_len + 1; } if (offset > source_len) { offset = source_len; } else if (offset < 0) { offset = 0; } } Jim_AppendString(interp, resultObj, source_str, offset); n = source_len - offset; p = source_str + offset; do { int match = regexec(regex, p, MAX_SUB_MATCHES, pmatch, regexec_flags); |
︙ | ︙ | |||
3240 3241 3242 3243 3244 3245 3246 | pmatch[idx].rm_eo - pmatch[idx].rm_so); } } p += pmatch[0].rm_eo; n -= pmatch[0].rm_eo; | | | | | | | 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 | pmatch[idx].rm_eo - pmatch[idx].rm_so); } } p += pmatch[0].rm_eo; n -= pmatch[0].rm_eo; if (!opt_all || n == 0) { break; } if ((regcomp_flags & REG_NEWLINE) == 0 && pattern[0] == '^') { break; } if (pattern[0] == '\0' && n) { Jim_AppendString(interp, resultObj, p, 1); p++; n--; } regexec_flags |= REG_NOTBOL; } while (n); Jim_AppendString(interp, resultObj, p, -1); if (argc - i == 4) { result = Jim_SetVariable(interp, varname, resultObj); if (result == JIM_OK) { Jim_SetResultInt(interp, num_matches); } else { |
︙ | ︙ | |||
3318 3319 3320 3321 3322 3323 3324 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif # ifndef MAXPATHLEN # define MAXPATHLEN JIM_PATH_LEN # endif | | > > > > > > > | 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 | #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif # ifndef MAXPATHLEN # define MAXPATHLEN JIM_PATH_LEN # endif #if defined(__MINGW32__) || defined(__MSYS__) || defined(_MSC_VER) #define ISWINDOWS 1 #else #define ISWINDOWS 0 #endif #if defined(HAVE_STRUCT_STAT_ST_MTIMESPEC) #define STAT_MTIME_US(STAT) ((STAT).st_mtimespec.tv_sec * 1000000ll + (STAT).st_mtimespec.tv_nsec / 1000) #elif defined(HAVE_STRUCT_STAT_ST_MTIM) #define STAT_MTIME_US(STAT) ((STAT).st_mtim.tv_sec * 1000000ll + (STAT).st_mtim.tv_nsec / 1000) #endif static const char *JimGetFileType(int mode) { if (S_ISREG(mode)) { return "file"; } else if (S_ISDIR(mode)) { |
︙ | ︙ | |||
3369 3370 3371 3372 3373 3374 3375 | { Jim_ListAppendElement(interp, listObj, Jim_NewStringObj(interp, key, -1)); Jim_ListAppendElement(interp, listObj, Jim_NewIntObj(interp, value)); } static int StoreStatData(Jim_Interp *interp, Jim_Obj *varName, const struct stat *sb) { | | > > > | > | > > | > > | > > > < < < < < < | | | 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 | { Jim_ListAppendElement(interp, listObj, Jim_NewStringObj(interp, key, -1)); Jim_ListAppendElement(interp, listObj, Jim_NewIntObj(interp, value)); } static int StoreStatData(Jim_Interp *interp, Jim_Obj *varName, const struct stat *sb) { Jim_Obj *listObj = Jim_NewListObj(interp, NULL, 0); AppendStatElement(interp, listObj, "dev", sb->st_dev); AppendStatElement(interp, listObj, "ino", sb->st_ino); AppendStatElement(interp, listObj, "mode", sb->st_mode); AppendStatElement(interp, listObj, "nlink", sb->st_nlink); AppendStatElement(interp, listObj, "uid", sb->st_uid); AppendStatElement(interp, listObj, "gid", sb->st_gid); AppendStatElement(interp, listObj, "size", sb->st_size); AppendStatElement(interp, listObj, "atime", sb->st_atime); AppendStatElement(interp, listObj, "mtime", sb->st_mtime); AppendStatElement(interp, listObj, "ctime", sb->st_ctime); #ifdef STAT_MTIME_US AppendStatElement(interp, listObj, "mtimeus", STAT_MTIME_US(*sb)); #endif Jim_ListAppendElement(interp, listObj, Jim_NewStringObj(interp, "type", -1)); Jim_ListAppendElement(interp, listObj, Jim_NewStringObj(interp, JimGetFileType((int)sb->st_mode), -1)); if (varName) { Jim_Obj *objPtr; objPtr = Jim_GetVariable(interp, varName, JIM_NONE); if (objPtr) { Jim_Obj *objv[2]; objv[0] = objPtr; objv[1] = listObj; objPtr = Jim_DictMerge(interp, 2, objv); if (objPtr == NULL) { Jim_SetResultFormatted(interp, "can't set \"%#s(dev)\": variable isn't array", varName); Jim_FreeNewObj(interp, listObj); return JIM_ERR; } Jim_InvalidateStringRep(objPtr); Jim_FreeNewObj(interp, listObj); listObj = objPtr; } Jim_SetVariable(interp, varName, listObj); } Jim_SetResult(interp, listObj); return JIM_OK; } static int file_cmd_dirname(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *path = Jim_String(argv[0]); const char *p = strrchr(path, '/'); if (!p && path[0] == '.' && path[1] == '.' && path[2] == '\0') { Jim_SetResultString(interp, "..", -1); } else if (!p) { Jim_SetResultString(interp, ".", -1); } else if (p == path) { Jim_SetResultString(interp, "/", -1); } else if (ISWINDOWS && p[-1] == ':') { Jim_SetResultString(interp, path, p - path + 1); } else { Jim_SetResultString(interp, path, p - path); } return JIM_OK; } |
︙ | ︙ | |||
3510 3511 3512 3513 3514 3515 3516 | { int i; char *newname = Jim_Alloc(MAXPATHLEN + 1); char *last = newname; *newname = 0; | | | | | | | | | | 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 | { int i; char *newname = Jim_Alloc(MAXPATHLEN + 1); char *last = newname; *newname = 0; for (i = 0; i < argc; i++) { int len; const char *part = Jim_GetString(argv[i], &len); if (*part == '/') { last = newname; } else if (ISWINDOWS && strchr(part, ':')) { last = newname; } else if (part[0] == '.') { if (part[1] == '/') { part += 2; len -= 2; } else if (part[1] == 0 && last != newname) { continue; } } if (last != newname && last[-1] != '/') { *last++ = '/'; } if (len) { if (last + len - newname >= MAXPATHLEN) { Jim_Free(newname); Jim_SetResultString(interp, "Path too long", -1); return JIM_ERR; } memcpy(last, part, len); last += len; } if (last > newname + 1 && last[-1] == '/') { if (!ISWINDOWS || !(last > newname + 2 && last[-2] == ':')) { *--last = 0; } } } *last = 0; Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, newname, last - newname)); return JIM_OK; } static int file_access(Jim_Interp *interp, Jim_Obj *filename, int mode) |
︙ | ︙ | |||
3589 3590 3591 3592 3593 3594 3595 | } static int file_cmd_executable(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { #ifdef X_OK return file_access(interp, argv[0], X_OK); #else | | | 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 | } static int file_cmd_executable(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { #ifdef X_OK return file_access(interp, argv[0], X_OK); #else Jim_SetResultBool(interp, 1); return JIM_OK; #endif } static int file_cmd_exists(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { |
︙ | ︙ | |||
3614 3615 3616 3617 3618 3619 3620 | } while (argc--) { const char *path = Jim_String(argv[0]); if (unlink(path) == -1 && errno != ENOENT) { if (rmdir(path) == -1) { | | | 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 | } while (argc--) { const char *path = Jim_String(argv[0]); if (unlink(path) == -1 && errno != ENOENT) { if (rmdir(path) == -1) { if (!force || Jim_EvalPrefix(interp, "file delete force", 1, argv) != JIM_OK) { Jim_SetResultFormatted(interp, "couldn't delete file \"%s\": %s", path, strerror(errno)); return JIM_ERR; } } } |
︙ | ︙ | |||
3637 3638 3639 3640 3641 3642 3643 | #define MKDIR_DEFAULT(PATHNAME) mkdir(PATHNAME, 0755) #endif static int mkdir_all(char *path) { int ok = 1; | | | | | | | | 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 | #define MKDIR_DEFAULT(PATHNAME) mkdir(PATHNAME, 0755) #endif static int mkdir_all(char *path) { int ok = 1; goto first; while (ok--) { { char *slash = strrchr(path, '/'); if (slash && slash != path) { *slash = 0; if (mkdir_all(path) != 0) { return -1; } *slash = '/'; } } first: if (MKDIR_DEFAULT(path) == 0) { return 0; } if (errno == ENOENT) { continue; } if (errno == EEXIST) { struct stat sb; if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { return 0; } errno = EEXIST; } break; } return -1; } static int file_cmd_mkdir(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { |
︙ | ︙ | |||
3696 3697 3698 3699 3700 3701 3702 | argv++; } return JIM_OK; } static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { | | | 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 | argv++; } return JIM_OK; } static int file_cmd_tempfile(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int fd = Jim_MakeTempFile(interp, (argc >= 1) ? Jim_String(argv[0]) : NULL, 0); if (fd < 0) { return JIM_ERR; } close(fd); return JIM_OK; |
︙ | ︙ | |||
3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 | if (file_stat(interp, argv[0], &sb) != JIM_OK) { return JIM_ERR; } Jim_SetResultInt(interp, sb.st_atime); return JIM_OK; } static int file_cmd_mtime(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { struct stat sb; if (argc == 2) { | > > > > > > > > > > > > > > > > > > > < | < < | < < < < | < < < < < < < > > > > > > > > > > > > > > > > > > > > | 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 | if (file_stat(interp, argv[0], &sb) != JIM_OK) { return JIM_ERR; } Jim_SetResultInt(interp, sb.st_atime); return JIM_OK; } static int JimSetFileTimes(Jim_Interp *interp, const char *filename, jim_wide us) { #ifdef HAVE_UTIMES struct timeval times[2]; times[1].tv_sec = times[0].tv_sec = us / 1000000; times[1].tv_usec = times[0].tv_usec = us % 1000000; if (utimes(filename, times) != 0) { Jim_SetResultFormatted(interp, "can't set time on \"%s\": %s", filename, strerror(errno)); return JIM_ERR; } return JIM_OK; #else Jim_SetResultString(interp, "Not implemented", -1); return JIM_ERR; #endif } static int file_cmd_mtime(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { struct stat sb; if (argc == 2) { jim_wide secs; if (Jim_GetWide(interp, argv[1], &secs) != JIM_OK) { return JIM_ERR; } return JimSetFileTimes(interp, Jim_String(argv[0]), secs * 1000000); } if (file_stat(interp, argv[0], &sb) != JIM_OK) { return JIM_ERR; } Jim_SetResultInt(interp, sb.st_mtime); return JIM_OK; } #ifdef STAT_MTIME_US static int file_cmd_mtimeus(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { struct stat sb; if (argc == 2) { jim_wide us; if (Jim_GetWide(interp, argv[1], &us) != JIM_OK) { return JIM_ERR; } return JimSetFileTimes(interp, Jim_String(argv[0]), us); } if (file_stat(interp, argv[0], &sb) != JIM_OK) { return JIM_ERR; } Jim_SetResultInt(interp, STAT_MTIME_US(sb)); return JIM_OK; } #endif static int file_cmd_copy(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { return Jim_EvalPrefix(interp, "file copy", argc, argv); } static int file_cmd_size(Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
︙ | ︙ | |||
3960 3961 3962 3963 3964 3965 3966 | static const jim_subcmd_type file_command_table[] = { { "atime", "name", file_cmd_atime, 1, 1, | | | > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 | static const jim_subcmd_type file_command_table[] = { { "atime", "name", file_cmd_atime, 1, 1, }, { "mtime", "name ?time?", file_cmd_mtime, 1, 2, }, #ifdef STAT_MTIME_US { "mtimeus", "name ?time?", file_cmd_mtimeus, 1, 2, }, #endif { "copy", "?-force? source dest", file_cmd_copy, 2, 3, }, { "dirname", "name", file_cmd_dirname, 1, 1, }, { "rootname", "name", file_cmd_rootname, 1, 1, }, { "extension", "name", file_cmd_extension, 1, 1, }, { "tail", "name", file_cmd_tail, 1, 1, }, { "normalize", "name", file_cmd_normalize, 1, 1, }, { "join", "name ?name ...?", file_cmd_join, 1, -1, }, { "readable", "name", file_cmd_readable, 1, 1, }, { "writable", "name", file_cmd_writable, 1, 1, }, { "executable", "name", file_cmd_executable, 1, 1, }, { "exists", "name", file_cmd_exists, 1, 1, }, { "delete", "?-force|--? name ...", file_cmd_delete, 1, -1, }, { "mkdir", "dir ...", file_cmd_mkdir, 1, -1, }, { "tempfile", "?template?", file_cmd_tempfile, 0, 1, }, { "rename", "?-force? source dest", file_cmd_rename, 2, 3, }, #if defined(HAVE_LINK) && defined(HAVE_SYMLINK) { "link", "?-symbolic|-hard? newname target", file_cmd_link, 2, 3, }, #endif #if defined(HAVE_READLINK) { "readlink", "name", file_cmd_readlink, 1, 1, }, #endif { "size", "name", file_cmd_size, 1, 1, }, { "stat", "name ?var?", file_cmd_stat, 1, 2, }, { "lstat", "name ?var?", file_cmd_lstat, 1, 2, }, { "type", "name", file_cmd_type, 1, 1, }, #ifdef HAVE_GETEUID { "owned", "name", file_cmd_owned, 1, 1, }, #endif { "isdirectory", "name", file_cmd_isdirectory, 1, 1, }, { "isfile", "name", file_cmd_isfile, 1, 1, }, { NULL } }; static int Jim_CdCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
︙ | ︙ | |||
4177 4178 4179 4180 4181 4182 4183 | if (getcwd(cwd, MAXPATHLEN) == NULL) { Jim_SetResultString(interp, "Failed to get pwd", -1); Jim_Free(cwd); return JIM_ERR; } else if (ISWINDOWS) { | | | 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 | if (getcwd(cwd, MAXPATHLEN) == NULL) { Jim_SetResultString(interp, "Failed to get pwd", -1); Jim_Free(cwd); return JIM_ERR; } else if (ISWINDOWS) { char *p = cwd; while ((p = strchr(p, '\\')) != NULL) { *p++ = '/'; } } Jim_SetResultString(interp, cwd, -1); |
︙ | ︙ | |||
4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 | Jim_CreateCommand(interp, "file", Jim_SubCmdProc, (void *)file_command_table, NULL); Jim_CreateCommand(interp, "pwd", Jim_PwdCmd, NULL, NULL); Jim_CreateCommand(interp, "cd", Jim_CdCmd, NULL, NULL); return JIM_OK; } #include <string.h> #include <ctype.h> #if (!defined(HAVE_VFORK) || !defined(HAVE_WAITPID)) && !defined(__MINGW32__) static int Jim_ExecCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *cmdlineObj = Jim_NewEmptyStringObj(interp); int i, j; int rc; | > > > | | | 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 | Jim_CreateCommand(interp, "file", Jim_SubCmdProc, (void *)file_command_table, NULL); Jim_CreateCommand(interp, "pwd", Jim_PwdCmd, NULL, NULL); Jim_CreateCommand(interp, "cd", Jim_CdCmd, NULL, NULL); return JIM_OK; } #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <string.h> #include <ctype.h> #if (!defined(HAVE_VFORK) || !defined(HAVE_WAITPID)) && !defined(__MINGW32__) static int Jim_ExecCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *cmdlineObj = Jim_NewEmptyStringObj(interp); int i, j; int rc; for (i = 1; i < argc; i++) { int len; const char *arg = Jim_GetString(argv[i], &len); if (i > 1) { Jim_AppendString(interp, cmdlineObj, " ", 1); } if (strpbrk(arg, "\\\" ") == NULL) { Jim_AppendString(interp, cmdlineObj, arg, len); continue; } Jim_AppendString(interp, cmdlineObj, "\"", 1); for (j = 0; j < len; j++) { if (arg[j] == '\\' || arg[j] == '"') { |
︙ | ︙ | |||
4264 4265 4266 4267 4268 4269 4270 | return JIM_OK; } #else #include <errno.h> #include <signal.h> | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < | < < < < | | | | < < > | < < < | < < < < | | | 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 | return JIM_OK; } #else #include <errno.h> #include <signal.h> #include <sys/stat.h> struct WaitInfoTable; static char **JimOriginalEnviron(void); static char **JimSaveEnv(char **env); static void JimRestoreEnv(char **env); static int JimCreatePipeline(Jim_Interp *interp, int argc, Jim_Obj *const *argv, pidtype **pidArrayPtr, int *inPipePtr, int *outPipePtr, int *errFilePtr); static void JimDetachPids(struct WaitInfoTable *table, int numPids, const pidtype *pidPtr); static int JimCleanupChildren(Jim_Interp *interp, int numPids, pidtype *pidPtr, Jim_Obj *errStrObj); static int Jim_WaitCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv); #if defined(__MINGW32__) static pidtype JimStartWinProcess(Jim_Interp *interp, char **argv, char **env, int inputId, int outputId, int errorId); #endif static void Jim_RemoveTrailingNewline(Jim_Obj *objPtr) { int len; const char *s = Jim_GetString(objPtr, &len); if (len > 0 && s[len - 1] == '\n') { objPtr->length--; objPtr->bytes[objPtr->length] = '\0'; } } static int JimAppendStreamToString(Jim_Interp *interp, int fd, Jim_Obj *strObj) { char buf[256]; FILE *fh = fdopen(fd, "r"); int ret = 0; if (fh == NULL) { return -1; } while (1) { |
︙ | ︙ | |||
4388 4389 4390 4391 4392 4393 4394 | int n; char **envptr; char *envdata; Jim_Obj *objPtr = Jim_GetGlobalVariableStr(interp, "env", JIM_NONE); if (!objPtr) { | | | | | 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 | int n; char **envptr; char *envdata; Jim_Obj *objPtr = Jim_GetGlobalVariableStr(interp, "env", JIM_NONE); if (!objPtr) { return JimOriginalEnviron(); } num = Jim_ListLength(interp, objPtr); if (num % 2) { num--; } size = Jim_Length(objPtr) + 2; envptr = Jim_Alloc(sizeof(*envptr) * (num / 2 + 1) + size); envdata = (char *)&envptr[num / 2 + 1]; |
︙ | ︙ | |||
4431 4432 4433 4434 4435 4436 4437 | static void JimFreeEnv(char **env, char **original_environ) { if (env != original_environ) { Jim_Free(env); } } | < < < < < < < < < < < < < < < | | < | < > > | | | > > > | > > > | > > > > | | | | > | | | > > | | > > > > > > > > > > > > > > > > > > > | | > | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < < < | | < < < < < < < < < < < < < < < < < < < < < > > > > > < | < < | | | | | > > > > > | > > | | > | > | > | > | | > > | < > > > | > | > > | | | | | | | | | | | | > > > | < < | | | | | 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 | static void JimFreeEnv(char **env, char **original_environ) { if (env != original_environ) { Jim_Free(env); } } static Jim_Obj *JimMakeErrorCode(Jim_Interp *interp, pidtype pid, int waitStatus, Jim_Obj *errStrObj) { Jim_Obj *errorCode = Jim_NewListObj(interp, NULL, 0); if (pid == JIM_BAD_PID || pid == JIM_NO_PID) { Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, "NONE", -1)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, (long)pid)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, -1)); } else if (WIFEXITED(waitStatus)) { Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, "CHILDSTATUS", -1)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, (long)pid)); Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, WEXITSTATUS(waitStatus))); } else { const char *type; const char *action; const char *signame; if (WIFSIGNALED(waitStatus)) { type = "CHILDKILLED"; action = "killed"; signame = Jim_SignalId(WTERMSIG(waitStatus)); } else { type = "CHILDSUSP"; action = "suspended"; signame = "none"; } Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, type, -1)); if (errStrObj) { Jim_AppendStrings(interp, errStrObj, "child ", action, " by signal ", Jim_SignalId(WTERMSIG(waitStatus)), "\n", NULL); } Jim_ListAppendElement(interp, errorCode, Jim_NewIntObj(interp, (long)pid)); Jim_ListAppendElement(interp, errorCode, Jim_NewStringObj(interp, signame, -1)); } return errorCode; } static int JimCheckWaitStatus(Jim_Interp *interp, pidtype pid, int waitStatus, Jim_Obj *errStrObj) { if (WIFEXITED(waitStatus) && WEXITSTATUS(waitStatus) == 0) { return JIM_OK; } Jim_SetGlobalVariableStr(interp, "errorCode", JimMakeErrorCode(interp, pid, waitStatus, errStrObj)); return JIM_ERR; } struct WaitInfo { pidtype pid; int status; int flags; }; struct WaitInfoTable { struct WaitInfo *info; int size; int used; int refcount; }; #define WI_DETACHED 2 #define WAIT_TABLE_GROW_BY 4 static void JimFreeWaitInfoTable(struct Jim_Interp *interp, void *privData) { struct WaitInfoTable *table = privData; if (--table->refcount == 0) { Jim_Free(table->info); Jim_Free(table); } } static struct WaitInfoTable *JimAllocWaitInfoTable(void) { struct WaitInfoTable *table = Jim_Alloc(sizeof(*table)); table->info = NULL; table->size = table->used = 0; table->refcount = 1; return table; } static int JimWaitRemove(struct WaitInfoTable *table, pidtype pid) { int i; for (i = 0; i < table->used; i++) { if (pid == table->info[i].pid) { if (i != table->used - 1) { table->info[i] = table->info[table->used - 1]; } table->used--; return 0; } } return -1; } static int Jim_ExecCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int outputId; int errorId; pidtype *pidPtr; int numPids, result; int child_siginfo = 1; Jim_Obj *childErrObj; Jim_Obj *errStrObj; struct WaitInfoTable *table = Jim_CmdPrivData(interp); if (argc > 1 && Jim_CompareStringImmediate(interp, argv[argc - 1], "&")) { Jim_Obj *listObj; int i; argc--; numPids = JimCreatePipeline(interp, argc - 1, argv + 1, &pidPtr, NULL, NULL, NULL); if (numPids < 0) { return JIM_ERR; } listObj = Jim_NewListObj(interp, NULL, 0); for (i = 0; i < numPids; i++) { Jim_ListAppendElement(interp, listObj, Jim_NewIntObj(interp, (long)pidPtr[i])); } Jim_SetResult(interp, listObj); JimDetachPids(table, numPids, pidPtr); Jim_Free(pidPtr); return JIM_OK; } numPids = JimCreatePipeline(interp, argc - 1, argv + 1, &pidPtr, NULL, &outputId, &errorId); if (numPids < 0) { return JIM_ERR; } result = JIM_OK; errStrObj = Jim_NewStringObj(interp, "", 0); if (outputId != -1) { if (JimAppendStreamToString(interp, outputId, errStrObj) < 0) { result = JIM_ERR; Jim_SetResultErrno(interp, "error reading from output pipe"); } } childErrObj = Jim_NewStringObj(interp, "", 0); Jim_IncrRefCount(childErrObj); if (JimCleanupChildren(interp, numPids, pidPtr, childErrObj) != JIM_OK) { result = JIM_ERR; } if (errorId != -1) { int ret; lseek(errorId, 0, SEEK_SET); ret = JimAppendStreamToString(interp, errorId, errStrObj); if (ret < 0) { Jim_SetResultErrno(interp, "error reading from error pipe"); result = JIM_ERR; } else if (ret > 0) { child_siginfo = 0; } } if (child_siginfo) { Jim_AppendObj(interp, errStrObj, childErrObj); } Jim_DecrRefCount(interp, childErrObj); Jim_RemoveTrailingNewline(errStrObj); Jim_SetResult(interp, errStrObj); return result; } static pidtype JimWaitForProcess(struct WaitInfoTable *table, pidtype pid, int *statusPtr) { if (JimWaitRemove(table, pid) == 0) { waitpid(pid, statusPtr, 0); return pid; } return JIM_BAD_PID; } static void JimDetachPids(struct WaitInfoTable *table, int numPids, const pidtype *pidPtr) { int j; for (j = 0; j < numPids; j++) { int i; for (i = 0; i < table->used; i++) { if (pidPtr[j] == table->info[i].pid) { table->info[i].flags |= WI_DETACHED; break; } } } } static int JimGetChannelFd(Jim_Interp *interp, const char *name) { Jim_Obj *objv[2]; objv[0] = Jim_NewStringObj(interp, name, -1); objv[1] = Jim_NewStringObj(interp, "getfd", -1); if (Jim_EvalObjVector(interp, 2, objv) == JIM_OK) { jim_wide fd; if (Jim_GetWide(interp, Jim_GetResult(interp), &fd) == JIM_OK) { return fd; } } return -1; } static void JimReapDetachedPids(struct WaitInfoTable *table) { struct WaitInfo *waitPtr; int count; int dest; if (!table) { return; } waitPtr = table->info; dest = 0; for (count = table->used; count > 0; waitPtr++, count--) { if (waitPtr->flags & WI_DETACHED) { int status; pidtype pid = waitpid(waitPtr->pid, &status, WNOHANG); if (pid == waitPtr->pid) { table->used--; continue; } } if (waitPtr != &table->info[dest]) { table->info[dest] = *waitPtr; } dest++; } } static int Jim_WaitCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { struct WaitInfoTable *table = Jim_CmdPrivData(interp); int nohang = 0; pidtype pid; long pidarg; int status; Jim_Obj *errCodeObj; if (argc == 1) { JimReapDetachedPids(table); return JIM_OK; } if (argc > 1 && Jim_CompareStringImmediate(interp, argv[1], "-nohang")) { nohang = 1; } if (argc != nohang + 2) { Jim_WrongNumArgs(interp, 1, argv, "?-nohang? ?pid?"); return JIM_ERR; } if (Jim_GetLong(interp, argv[nohang + 1], &pidarg) != JIM_OK) { return JIM_ERR; } pid = waitpid((pidtype)pidarg, &status, nohang ? WNOHANG : 0); errCodeObj = JimMakeErrorCode(interp, pid, status, NULL); if (pid != JIM_BAD_PID && (WIFEXITED(status) || WIFSIGNALED(status))) { JimWaitRemove(table, pid); } Jim_SetResult(interp, errCodeObj); return JIM_OK; } static int Jim_PidCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 1) { Jim_WrongNumArgs(interp, 1, argv, ""); return JIM_ERR; } Jim_SetResultInt(interp, (jim_wide)getpid()); return JIM_OK; } static int JimCreatePipeline(Jim_Interp *interp, int argc, Jim_Obj *const *argv, pidtype **pidArrayPtr, int *inPipePtr, int *outPipePtr, int *errFilePtr) { pidtype *pidPtr = NULL; /* Points to malloc-ed array holding all * the pids of child processes. */ int numPids = 0; /* Actual number of processes that exist * at *pidPtr right now. */ int cmdCount; /* Count of number of distinct commands * found in argc/argv. */ const char *input = NULL; /* Describes input for pipeline, depending * on "inputFile". NULL means take input * from stdin/pipe. */ int input_len = 0; #define FILE_NAME 0 #define FILE_APPEND 1 #define FILE_HANDLE 2 #define FILE_TEXT 3 int inputFile = FILE_NAME; /* 1 means input is name of input file. * 2 means input is filehandle name. * 0 means input holds actual * text to be input to command. */ int outputFile = FILE_NAME; /* 0 means output is the name of output file. * 1 means output is the name of output file, and append. * 2 means output is filehandle name. * All this is ignored if output is NULL */ int errorFile = FILE_NAME; /* 0 means error is the name of error file. * 1 means error is the name of error file, and append. * 2 means error is filehandle name. * All this is ignored if error is NULL */ const char *output = NULL; /* Holds name of output file to pipe to, * or NULL if output goes to stdout/pipe. */ const char *error = NULL; /* Holds name of stderr file to pipe to, * or NULL if stderr goes to stderr/pipe. */ int inputId = -1; int outputId = -1; int errorId = -1; int lastOutputId = -1; int pipeIds[2]; int firstArg, lastArg; /* Indexes of first and last arguments in * current command. */ int lastBar; int i; pidtype pid; char **save_environ; #ifndef __MINGW32__ char **child_environ; #endif struct WaitInfoTable *table = Jim_CmdPrivData(interp); char **arg_array = Jim_Alloc(sizeof(*arg_array) * (argc + 1)); int arg_count = 0; if (inPipePtr != NULL) { *inPipePtr = -1; } if (outPipePtr != NULL) { *outPipePtr = -1; } if (errFilePtr != NULL) { *errFilePtr = -1; } pipeIds[0] = pipeIds[1] = -1; cmdCount = 1; lastBar = -1; for (i = 0; i < argc; i++) { const char *arg = Jim_String(argv[i]); if (arg[0] == '<') { |
︙ | ︙ | |||
4794 4795 4796 4797 4798 4799 4800 | output = arg + 1; if (*output == '>') { outputFile = FILE_APPEND; output++; } if (*output == '&') { | | | 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 | output = arg + 1; if (*output == '>') { outputFile = FILE_APPEND; output++; } if (*output == '&') { output++; dup_error = 1; } if (*output == '@') { outputFile = FILE_HANDLE; output++; } |
︙ | ︙ | |||
4835 4836 4837 4838 4839 4840 4841 | if (i == lastBar + 1 || i == argc - 1) { Jim_SetResultString(interp, "illegal use of | or |& in command", -1); goto badargs; } lastBar = i; cmdCount++; } | | | | | > > > > | | | > | | | | | | | | | | < | | | | | | | | | | | | | | < | | | | | | | | | > > | | < | > > > > > > > | | | | > > > | | > > > | > > > > > | > > | | > > > > > > > | > > | | > | > > > | > > > | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 | if (i == lastBar + 1 || i == argc - 1) { Jim_SetResultString(interp, "illegal use of | or |& in command", -1); goto badargs; } lastBar = i; cmdCount++; } arg_array[arg_count++] = (char *)arg; continue; } if (i >= argc) { Jim_SetResultFormatted(interp, "can't specify \"%s\" as last word in command", arg); goto badargs; } } if (arg_count == 0) { Jim_SetResultString(interp, "didn't specify command to execute", -1); badargs: Jim_Free(arg_array); return -1; } save_environ = JimSaveEnv(JimBuildEnv(interp)); if (input != NULL) { if (inputFile == FILE_TEXT) { inputId = Jim_MakeTempFile(interp, NULL, 1); if (inputId == -1) { goto error; } if (write(inputId, input, input_len) != input_len) { Jim_SetResultErrno(interp, "couldn't write temp file"); close(inputId); goto error; } lseek(inputId, 0L, SEEK_SET); } else if (inputFile == FILE_HANDLE) { int fd = JimGetChannelFd(interp, input); if (fd < 0) { goto error; } inputId = dup(fd); } else { inputId = Jim_OpenForRead(input); if (inputId == -1) { Jim_SetResultFormatted(interp, "couldn't read file \"%s\": %s", input, strerror(Jim_Errno())); goto error; } } } else if (inPipePtr != NULL) { if (pipe(pipeIds) != 0) { Jim_SetResultErrno(interp, "couldn't create input pipe for command"); goto error; } inputId = pipeIds[0]; *inPipePtr = pipeIds[1]; pipeIds[0] = pipeIds[1] = -1; } if (output != NULL) { if (outputFile == FILE_HANDLE) { int fd = JimGetChannelFd(interp, output); if (fd < 0) { goto error; } lastOutputId = dup(fd); } else { lastOutputId = Jim_OpenForWrite(output, outputFile == FILE_APPEND); if (lastOutputId == -1) { Jim_SetResultFormatted(interp, "couldn't write file \"%s\": %s", output, strerror(Jim_Errno())); goto error; } } } else if (outPipePtr != NULL) { if (pipe(pipeIds) != 0) { Jim_SetResultErrno(interp, "couldn't create output pipe"); goto error; } lastOutputId = pipeIds[1]; *outPipePtr = pipeIds[0]; pipeIds[0] = pipeIds[1] = -1; } if (error != NULL) { if (errorFile == FILE_HANDLE) { if (strcmp(error, "1") == 0) { if (lastOutputId != -1) { errorId = dup(lastOutputId); } else { error = "stdout"; } } if (errorId == -1) { int fd = JimGetChannelFd(interp, error); if (fd < 0) { goto error; } errorId = dup(fd); } } else { errorId = Jim_OpenForWrite(error, errorFile == FILE_APPEND); if (errorId == -1) { Jim_SetResultFormatted(interp, "couldn't write file \"%s\": %s", error, strerror(Jim_Errno())); goto error; } } } else if (errFilePtr != NULL) { errorId = Jim_MakeTempFile(interp, NULL, 1); if (errorId == -1) { goto error; } *errFilePtr = dup(errorId); } pidPtr = Jim_Alloc(cmdCount * sizeof(*pidPtr)); for (i = 0; i < numPids; i++) { pidPtr[i] = JIM_BAD_PID; } for (firstArg = 0; firstArg < arg_count; numPids++, firstArg = lastArg + 1) { int pipe_dup_err = 0; int origErrorId = errorId; for (lastArg = firstArg; lastArg < arg_count; lastArg++) { if (strcmp(arg_array[lastArg], "|") == 0) { break; } if (strcmp(arg_array[lastArg], "|&") == 0) { pipe_dup_err = 1; break; } } if (lastArg == firstArg) { Jim_SetResultString(interp, "missing command to exec", -1); goto error; } arg_array[lastArg] = NULL; if (lastArg == arg_count) { outputId = lastOutputId; lastOutputId = -1; } else { if (pipe(pipeIds) != 0) { Jim_SetResultErrno(interp, "couldn't create pipe"); goto error; } outputId = pipeIds[1]; } if (pipe_dup_err) { errorId = outputId; } #ifdef __MINGW32__ pid = JimStartWinProcess(interp, &arg_array[firstArg], save_environ, inputId, outputId, errorId); if (pid == JIM_BAD_PID) { Jim_SetResultFormatted(interp, "couldn't exec \"%s\"", arg_array[firstArg]); goto error; } #else i = strlen(arg_array[firstArg]); child_environ = Jim_GetEnviron(); pid = vfork(); if (pid < 0) { Jim_SetResultErrno(interp, "couldn't fork child process"); goto error; } if (pid == 0) { if (inputId != -1) { dup2(inputId, fileno(stdin)); close(inputId); } if (outputId != -1) { dup2(outputId, fileno(stdout)); if (outputId != errorId) { close(outputId); } } if (errorId != -1) { dup2(errorId, fileno(stderr)); close(errorId); } if (outPipePtr) { close(*outPipePtr); } if (errFilePtr) { close(*errFilePtr); } if (pipeIds[0] != -1) { close(pipeIds[0]); } if (lastOutputId != -1) { close(lastOutputId); } (void)signal(SIGPIPE, SIG_DFL); execvpe(arg_array[firstArg], &arg_array[firstArg], child_environ); if (write(fileno(stderr), "couldn't exec \"", 15) && write(fileno(stderr), arg_array[firstArg], i) && write(fileno(stderr), "\"\n", 2)) { } #ifdef JIM_MAINTAINER { static char *const false_argv[2] = {"false", NULL}; execvp(false_argv[0],false_argv); } #endif _exit(127); } #endif if (table->used == table->size) { table->size += WAIT_TABLE_GROW_BY; table->info = Jim_Realloc(table->info, table->size * sizeof(*table->info)); } table->info[table->used].pid = pid; table->info[table->used].flags = 0; table->used++; pidPtr[numPids] = pid; errorId = origErrorId; if (inputId != -1) { close(inputId); } if (outputId != -1) { close(outputId); } inputId = pipeIds[0]; pipeIds[0] = pipeIds[1] = -1; } *pidArrayPtr = pidPtr; cleanup: if (inputId != -1) { close(inputId); } if (lastOutputId != -1) { close(lastOutputId); } if (errorId != -1) { close(errorId); } Jim_Free(arg_array); JimRestoreEnv(save_environ); return numPids; error: if ((inPipePtr != NULL) && (*inPipePtr != -1)) { close(*inPipePtr); *inPipePtr = -1; } if ((outPipePtr != NULL) && (*outPipePtr != -1)) { close(*outPipePtr); *outPipePtr = -1; } if ((errFilePtr != NULL) && (*errFilePtr != -1)) { close(*errFilePtr); *errFilePtr = -1; } if (pipeIds[0] != -1) { close(pipeIds[0]); } if (pipeIds[1] != -1) { close(pipeIds[1]); } if (pidPtr != NULL) { for (i = 0; i < numPids; i++) { if (pidPtr[i] != JIM_BAD_PID) { JimDetachPids(table, 1, &pidPtr[i]); } } Jim_Free(pidPtr); } numPids = -1; goto cleanup; } static int JimCleanupChildren(Jim_Interp *interp, int numPids, pidtype *pidPtr, Jim_Obj *errStrObj) { struct WaitInfoTable *table = Jim_CmdPrivData(interp); int result = JIM_OK; int i; for (i = 0; i < numPids; i++) { int waitStatus = 0; if (JimWaitForProcess(table, pidPtr[i], &waitStatus) != JIM_BAD_PID) { if (JimCheckWaitStatus(interp, pidPtr[i], waitStatus, errStrObj) != JIM_OK) { result = JIM_ERR; } } } Jim_Free(pidPtr); return result; } int Jim_execInit(Jim_Interp *interp) { struct WaitInfoTable *waitinfo; if (Jim_PackageProvide(interp, "exec", "1.0", JIM_ERRMSG)) return JIM_ERR; #ifdef SIGPIPE (void)signal(SIGPIPE, SIG_IGN); #endif waitinfo = JimAllocWaitInfoTable(); Jim_CreateCommand(interp, "exec", Jim_ExecCmd, waitinfo, JimFreeWaitInfoTable); waitinfo->refcount++; Jim_CreateCommand(interp, "wait", Jim_WaitCommand, waitinfo, JimFreeWaitInfoTable); Jim_CreateCommand(interp, "pid", Jim_PidCommand, 0, 0); return JIM_OK; } #if defined(__MINGW32__) static int JimWinFindExecutable(const char *originalName, char fullPath[MAX_PATH]) { int i; static char extensions[][5] = {".exe", "", ".bat"}; for (i = 0; i < (int) (sizeof(extensions) / sizeof(extensions[0])); i++) { |
︙ | ︙ | |||
5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 | return env; } static void JimRestoreEnv(char **env) { JimFreeEnv(env, Jim_GetEnviron()); } static Jim_Obj * JimWinBuildCommandLine(Jim_Interp *interp, char **argv) { char *start, *special; int quote, i; | > > > > > | 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 | return env; } static void JimRestoreEnv(char **env) { JimFreeEnv(env, Jim_GetEnviron()); } static char **JimOriginalEnviron(void) { return NULL; } static Jim_Obj * JimWinBuildCommandLine(Jim_Interp *interp, char **argv) { char *start, *special; int quote, i; |
︙ | ︙ | |||
5453 5454 5455 5456 5457 5458 5459 | Jim_AppendString(interp, strObj, "\"", 1); } } return strObj; } static pidtype | | | > | < | | < | | < | | | < < > | | < | > > > | < | < < < | | < | > > > > > > > > > > > | | | | < < < < < | < | < < | < < < < < < < < < | < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < | > | | < | < > | < > > | | > > > > > > > > > > > > > > | > | > > > > > > > > < | | | | 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 | Jim_AppendString(interp, strObj, "\"", 1); } } return strObj; } static pidtype JimStartWinProcess(Jim_Interp *interp, char **argv, char **env, int inputId, int outputId, int errorId) { STARTUPINFO startInfo; PROCESS_INFORMATION procInfo; HANDLE hProcess; char execPath[MAX_PATH]; pidtype pid = JIM_BAD_PID; Jim_Obj *cmdLineObj; char *winenv; if (JimWinFindExecutable(argv[0], execPath) < 0) { return JIM_BAD_PID; } argv[0] = execPath; hProcess = GetCurrentProcess(); cmdLineObj = JimWinBuildCommandLine(interp, argv); ZeroMemory(&startInfo, sizeof(startInfo)); startInfo.cb = sizeof(startInfo); startInfo.dwFlags = STARTF_USESTDHANDLES; startInfo.hStdInput = INVALID_HANDLE_VALUE; startInfo.hStdOutput= INVALID_HANDLE_VALUE; startInfo.hStdError = INVALID_HANDLE_VALUE; if (inputId == -1) { inputId = _fileno(stdin); } DuplicateHandle(hProcess, (HANDLE)_get_osfhandle(inputId), hProcess, &startInfo.hStdInput, 0, TRUE, DUPLICATE_SAME_ACCESS); if (startInfo.hStdInput == INVALID_HANDLE_VALUE) { goto end; } if (outputId == -1) { outputId = _fileno(stdout); } DuplicateHandle(hProcess, (HANDLE)_get_osfhandle(outputId), hProcess, &startInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); if (startInfo.hStdOutput == INVALID_HANDLE_VALUE) { goto end; } if (errorId == -1) { errorId = _fileno(stderr); } DuplicateHandle(hProcess, (HANDLE)_get_osfhandle(errorId), hProcess, &startInfo.hStdError, 0, TRUE, DUPLICATE_SAME_ACCESS); if (startInfo.hStdError == INVALID_HANDLE_VALUE) { goto end; } if (env == NULL) { winenv = NULL; } else if (env[0] == NULL) { winenv = (char *)"\0"; } else { winenv = env[0]; } if (!CreateProcess(NULL, (char *)Jim_String(cmdLineObj), NULL, NULL, TRUE, 0, winenv, NULL, &startInfo, &procInfo)) { goto end; } WaitForInputIdle(procInfo.hProcess, 5000); CloseHandle(procInfo.hThread); pid = procInfo.hProcess; end: Jim_FreeNewObj(interp, cmdLineObj); if (startInfo.hStdInput != INVALID_HANDLE_VALUE) { CloseHandle(startInfo.hStdInput); } if (startInfo.hStdOutput != INVALID_HANDLE_VALUE) { CloseHandle(startInfo.hStdOutput); } if (startInfo.hStdError != INVALID_HANDLE_VALUE) { CloseHandle(startInfo.hStdError); } return pid; } #else static char **JimOriginalEnviron(void) { return Jim_GetEnviron(); } static char **JimSaveEnv(char **env) { char **saveenv = Jim_GetEnviron(); Jim_SetEnviron(env); return saveenv; } static void JimRestoreEnv(char **env) { JimFreeEnv(Jim_GetEnviron(), env); Jim_SetEnviron(env); } #endif #endif #ifdef STRPTIME_NEEDS_XOPEN_SOURCE #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 500 #endif #endif #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <stdlib.h> #include <string.h> #include <stdio.h> #include <time.h> #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif struct clock_options { int gmt; const char *format; }; static int parse_clock_options(Jim_Interp *interp, int argc, Jim_Obj *const *argv, struct clock_options *opts) { static const char * const options[] = { "-gmt", "-format", NULL }; enum { OPT_GMT, OPT_FORMAT, }; int i; for (i = 0; i < argc; i += 2) { int option; if (Jim_GetEnum(interp, argv[i], options, &option, NULL, JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) { return JIM_ERR; } switch (option) { case OPT_GMT: if (Jim_GetBoolean(interp, argv[i + 1], &opts->gmt) != JIM_OK) { return JIM_ERR; } break; case OPT_FORMAT: opts->format = Jim_String(argv[i + 1]); break; } } return JIM_OK; } static int clock_cmd_format(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { char buf[100]; time_t t; jim_wide seconds; struct clock_options options = { 0, "%a %b %d %H:%M:%S %Z %Y" }; struct tm *tm; if (Jim_GetWide(interp, argv[0], &seconds) != JIM_OK) { return JIM_ERR; } if (argc % 2 == 0) { return -1; } if (parse_clock_options(interp, argc - 1, argv + 1, &options) == JIM_ERR) { return JIM_ERR; } t = seconds; tm = options.gmt ? gmtime(&t) : localtime(&t); if (tm == NULL || strftime(buf, sizeof(buf), options.format, tm) == 0) { Jim_SetResultString(interp, "format string too long or invalid time", -1); return JIM_ERR; } Jim_SetResultString(interp, buf, -1); return JIM_OK; } #ifdef HAVE_STRPTIME static time_t jim_timegm(const struct tm *tm) { int m = tm->tm_mon + 1; int y = 1900 + tm->tm_year - (m <= 2); int era = (y >= 0 ? y : y - 399) / 400; unsigned yoe = (unsigned)(y - era * 400); unsigned doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + tm->tm_mday - 1; unsigned doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; long days = (era * 146097 + (int)doe - 719468); int secs = tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec; return days * 24 * 60 * 60 + secs; } static int clock_cmd_scan(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { char *pt; struct tm tm; time_t now = time(NULL); struct clock_options options = { 0, NULL }; if (argc % 2 == 0) { return -1; } if (parse_clock_options(interp, argc - 1, argv + 1, &options) == JIM_ERR) { return JIM_ERR; } if (options.format == NULL) { return -1; } localtime_r(&now, &tm); pt = strptime(Jim_String(argv[0]), options.format, &tm); if (pt == 0 || *pt != 0) { Jim_SetResultString(interp, "Failed to parse time according to format", -1); return JIM_ERR; } Jim_SetResultInt(interp, options.gmt ? jim_timegm(&tm) : mktime(&tm)); return JIM_OK; } #endif static int clock_cmd_seconds(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { |
︙ | ︙ | |||
5686 5687 5688 5689 5690 5691 5692 | Jim_SetResultInt(interp, (jim_wide) tv.tv_sec * 1000 + tv.tv_usec / 1000); return JIM_OK; } static const jim_subcmd_type clock_command_table[] = { | < < < < < < < | > > > > > > > | | < < < < < < < | < > | > > > > > > > | 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 | Jim_SetResultInt(interp, (jim_wide) tv.tv_sec * 1000 + tv.tv_usec / 1000); return JIM_OK; } static const jim_subcmd_type clock_command_table[] = { { "clicks", NULL, clock_cmd_micros, 0, 0, }, { "format", "seconds ?-format string? ?-gmt boolean?", clock_cmd_format, 1, 5, }, { "microseconds", NULL, clock_cmd_micros, 0, 0, }, { "milliseconds", NULL, clock_cmd_millis, 0, 0, }, #ifdef HAVE_STRPTIME { "scan", "str -format format ?-gmt boolean?", clock_cmd_scan, 3, 5, }, #endif { "seconds", NULL, clock_cmd_seconds, 0, 0, }, { NULL } }; int Jim_clockInit(Jim_Interp *interp) { if (Jim_PackageProvide(interp, "clock", "1.0", JIM_ERRMSG)) return JIM_ERR; |
︙ | ︙ | |||
5751 5752 5753 5754 5755 5756 5757 | #include <string.h> #include <stdio.h> #include <errno.h> static int array_cmd_exists(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { | | | > | | < | | | | > > | | | > > | | 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 | #include <string.h> #include <stdio.h> #include <errno.h> static int array_cmd_exists(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *dictObj = Jim_GetVariable(interp, argv[0], JIM_UNSHARED); Jim_SetResultInt(interp, dictObj && Jim_DictSize(interp, dictObj) != -1); return JIM_OK; } static int array_cmd_get(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE); Jim_Obj *patternObj; if (!objPtr) { return JIM_OK; } patternObj = (argc == 1) ? NULL : argv[1]; if (patternObj == NULL || Jim_CompareStringImmediate(interp, patternObj, "*")) { if (Jim_IsList(objPtr) && Jim_ListLength(interp, objPtr) % 2 == 0) { Jim_SetResult(interp, objPtr); return JIM_OK; } } return Jim_DictMatchTypes(interp, objPtr, patternObj, JIM_DICTMATCH_KEYS, JIM_DICTMATCH_KEYS | JIM_DICTMATCH_VALUES); } static int array_cmd_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE); if (!objPtr) { return JIM_OK; } return Jim_DictMatchTypes(interp, objPtr, argc == 1 ? NULL : argv[1], JIM_DICTMATCH_KEYS, JIM_DICTMATCH_KEYS); } static int array_cmd_unset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; int len; Jim_Obj *resultObj; Jim_Obj *objPtr; Jim_Obj **dictValuesObj; if (argc == 1 || Jim_CompareStringImmediate(interp, argv[1], "*")) { Jim_UnsetVariable(interp, argv[0], JIM_NONE); return JIM_OK; } objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE); if (objPtr == NULL) { return JIM_OK; } if (Jim_DictPairs(interp, objPtr, &dictValuesObj, &len) != JIM_OK) { Jim_SetResultString(interp, "", -1); return JIM_OK; } resultObj = Jim_NewDictObj(interp, NULL, 0); for (i = 0; i < len; i += 2) { if (!Jim_StringMatchObj(interp, argv[1], dictValuesObj[i], 0)) { Jim_DictAddElement(interp, resultObj, dictValuesObj[i], dictValuesObj[i + 1]); } } Jim_Free(dictValuesObj); Jim_SetVariable(interp, argv[0], resultObj); return JIM_OK; } static int array_cmd_size(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *objPtr; int len = 0; objPtr = Jim_GetVariable(interp, argv[0], JIM_NONE); if (objPtr) { len = Jim_DictSize(interp, objPtr); if (len < 0) { Jim_SetResultInt(interp, 0); return JIM_OK; } } Jim_SetResultInt(interp, len); return JIM_OK; } |
︙ | ︙ | |||
5874 5875 5876 5877 5878 5879 5880 | if (len % 2) { Jim_SetResultString(interp, "list must have an even number of elements", -1); return JIM_ERR; } dictObj = Jim_GetVariable(interp, argv[0], JIM_UNSHARED); if (!dictObj) { | | | 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 | if (len % 2) { Jim_SetResultString(interp, "list must have an even number of elements", -1); return JIM_ERR; } dictObj = Jim_GetVariable(interp, argv[0], JIM_UNSHARED); if (!dictObj) { return Jim_SetVariable(interp, argv[0], listObj); } else if (Jim_DictSize(interp, dictObj) < 0) { return JIM_ERR; } if (Jim_IsShared(dictObj)) { |
︙ | ︙ | |||
5903 5904 5905 5906 5907 5908 5909 | static const jim_subcmd_type array_command_table[] = { { "exists", "arrayName", array_cmd_exists, 1, 1, | | | | | | | | | 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 | static const jim_subcmd_type array_command_table[] = { { "exists", "arrayName", array_cmd_exists, 1, 1, }, { "get", "arrayName ?pattern?", array_cmd_get, 1, 2, }, { "names", "arrayName ?pattern?", array_cmd_names, 1, 2, }, { "set", "arrayName list", array_cmd_set, 2, 2, }, { "size", "arrayName", array_cmd_size, 1, 1, }, { "stat", "arrayName", array_cmd_stat, 1, 1, }, { "unset", "arrayName ?pattern?", array_cmd_unset, 1, 2, }, { NULL } }; int Jim_arrayInit(Jim_Interp *interp) { |
︙ | ︙ | |||
5985 5986 5987 5988 5989 5990 5991 | Jim_execInit(interp); Jim_clockInit(interp); Jim_arrayInit(interp); Jim_stdlibInit(interp); Jim_tclcompatInit(interp); return JIM_OK; } | | > > > | 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 | Jim_execInit(interp); Jim_clockInit(interp); Jim_arrayInit(interp); Jim_stdlibInit(interp); Jim_tclcompatInit(interp); return JIM_OK; } #define JIM_OPTIMIZATION #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> #include <ctype.h> |
︙ | ︙ | |||
6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 | #ifdef JIM_DEBUG_PANIC static void JimPanicDump(int fail_condition, const char *fmt, ...); #define JimPanic(X) JimPanicDump X #else #define JimPanic(X) #endif static char JimEmptyStringRep[] = ""; static void JimFreeCallFrame(Jim_Interp *interp, Jim_CallFrame *cf, int action); static int ListSetIndex(Jim_Interp *interp, Jim_Obj *listPtr, int listindex, Jim_Obj *newObjPtr, int flags); static int JimDeleteLocalProcs(Jim_Interp *interp, Jim_Stack *localCommands); | > > > > > > | 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 | #ifdef JIM_DEBUG_PANIC static void JimPanicDump(int fail_condition, const char *fmt, ...); #define JimPanic(X) JimPanicDump X #else #define JimPanic(X) #endif #ifdef JIM_OPTIMIZATION #define JIM_IF_OPTIM(X) X #else #define JIM_IF_OPTIM(X) #endif static char JimEmptyStringRep[] = ""; static void JimFreeCallFrame(Jim_Interp *interp, Jim_CallFrame *cf, int action); static int ListSetIndex(Jim_Interp *interp, Jim_Obj *listPtr, int listindex, Jim_Obj *newObjPtr, int flags); static int JimDeleteLocalProcs(Jim_Interp *interp, Jim_Stack *localCommands); |
︙ | ︙ | |||
6110 6111 6112 6113 6114 6115 6116 | if (flags & JIM_CHARSET_SCAN) { if (*pattern == '^') { not++; pattern++; } | | | | | | | | 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 | if (flags & JIM_CHARSET_SCAN) { if (*pattern == '^') { not++; pattern++; } if (*pattern == ']') { goto first; } } while (*pattern && *pattern != ']') { if (pattern[0] == '\\') { first: pattern += utf8_tounicode_case(pattern, &pchar, nocase); } else { int start; int end; pattern += utf8_tounicode_case(pattern, &start, nocase); if (pattern[0] == '-' && pattern[1]) { pattern++; pattern += utf8_tounicode_case(pattern, &end, nocase); if ((c >= start && c <= end) || (c >= end && c <= start)) { match = 1; } continue; } pchar = start; } |
︙ | ︙ | |||
6167 6168 6169 6170 6171 6172 6173 | switch (pattern[0]) { case '*': while (pattern[1] == '*') { pattern++; } pattern++; if (!pattern[0]) { | | | | | | | | 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 | switch (pattern[0]) { case '*': while (pattern[1] == '*') { pattern++; } pattern++; if (!pattern[0]) { return 1; } while (*string) { if (JimGlobMatch(pattern, string, nocase)) return 1; string += utf8_tounicode(string, &c); } return 0; case '?': string += utf8_tounicode(string, &c); break; case '[': { string += utf8_tounicode(string, &c); pattern = JimCharsetMatch(pattern + 1, c, nocase ? JIM_NOCASE : 0); if (!pattern) { return 0; } if (!*pattern) { continue; } break; } case '\\': if (pattern[1]) { pattern++; } default: string += utf8_tounicode_case(string, &c, nocase); utf8_tounicode_case(pattern, &pchar, nocase); if (pchar != c) { return 0; } break; |
︙ | ︙ | |||
6247 6248 6249 6250 6251 6252 6253 | return JimSign(c1 - c2); } maxchars--; } if (!maxchars) { return 0; } | | | 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 | return JimSign(c1 - c2); } maxchars--; } if (!maxchars) { return 0; } if (*s1) { return 1; } if (*s2) { return -1; } return 0; |
︙ | ︙ | |||
6288 6289 6290 6291 6292 6293 6294 | static int JimStringLast(const char *s1, int l1, const char *s2, int l2) { const char *p; if (!l1 || !l2 || l1 > l2) return -1; | | | 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 | static int JimStringLast(const char *s1, int l1, const char *s2, int l2) { const char *p; if (!l1 || !l2 || l1 > l2) return -1; for (p = s2 + l2 - 1; p != s2 - 1; p--) { if (*p == *s1 && memcmp(s1, p, l1) == 0) { return p - s2; } } return -1; } |
︙ | ︙ | |||
6347 6348 6349 6350 6351 6352 6353 | if (str[i] == '+') { i++; } *sign = 1; } if (str[i] != '0') { | | | | | | | | | 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 | if (str[i] == '+') { i++; } *sign = 1; } if (str[i] != '0') { return 0; } switch (str[i + 1]) { case 'x': case 'X': *base = 16; break; case 'o': case 'O': *base = 8; break; case 'b': case 'B': *base = 2; break; default: return 0; } i += 2; if (str[i] != '-' && str[i] != '+' && !isspace(UCHAR(str[i]))) { return i; } *base = 10; return 0; } static long jim_strtol(const char *str, char **endptr) { int sign; int base; int i = JimNumberBase(str, &base, &sign); if (base != 10) { long value = strtol(str + i, endptr, base); if (endptr == NULL || *endptr != str + i) { return value * sign; } } return strtol(str, endptr, 10); } static jim_wide jim_strtoull(const char *str, char **endptr) { #ifdef HAVE_LONG_LONG int sign; int base; int i = JimNumberBase(str, &base, &sign); if (base != 10) { jim_wide value = strtoull(str + i, endptr, base); if (endptr == NULL || *endptr != str + i) { return value * sign; } } return strtoull(str, endptr, 10); #else return (unsigned long)jim_strtol(str, endptr); #endif } int Jim_StringToWide(const char *str, jim_wide * widePtr, int base) |
︙ | ︙ | |||
6426 6427 6428 6429 6430 6431 6432 | return JimCheckConversion(str, endptr); } int Jim_StringToDouble(const char *str, double *doublePtr) { char *endptr; | | | > > > > > | > | > | > > > > | > > > | 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 | return JimCheckConversion(str, endptr); } int Jim_StringToDouble(const char *str, double *doublePtr) { char *endptr; errno = 0; *doublePtr = strtod(str, &endptr); return JimCheckConversion(str, endptr); } static jim_wide JimPowWide(jim_wide b, jim_wide e) { jim_wide res = 1; if (b == 1) { return 1; } if (e < 0) { if (b != -1) { return 0; } e = -e; } while (e) { if (e & 1) { res *= b; } e >>= 1; b *= b; } return res; } #ifdef JIM_DEBUG_PANIC static void JimPanicDump(int condition, const char *fmt, ...) { |
︙ | ︙ | |||
6507 6508 6509 6510 6511 6512 6513 | } char *Jim_StrDupLen(const char *s, int l) { char *copy = Jim_Alloc(l + 1); memcpy(copy, s, l + 1); | | | 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 | } char *Jim_StrDupLen(const char *s, int l) { char *copy = Jim_Alloc(l + 1); memcpy(copy, s, l + 1); copy[l] = 0; return copy; } static jim_wide JimClock(void) { |
︙ | ︙ | |||
6596 6597 6598 6599 6600 6601 6602 | minimal = JIM_HT_INITIAL_SIZE; Jim_ExpandHashTable(ht, minimal); } void Jim_ExpandHashTable(Jim_HashTable *ht, unsigned int size) { | | | | | | | | | | 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 | minimal = JIM_HT_INITIAL_SIZE; Jim_ExpandHashTable(ht, minimal); } void Jim_ExpandHashTable(Jim_HashTable *ht, unsigned int size) { Jim_HashTable n; unsigned int realsize = JimHashTableNextPower(size), i; if (size <= ht->used) return; Jim_InitHashTable(&n, ht->type, ht->privdata); n.size = realsize; n.sizemask = realsize - 1; n.table = Jim_Alloc(realsize * sizeof(Jim_HashEntry *)); n.uniq = ht->uniq; memset(n.table, 0, realsize * sizeof(Jim_HashEntry *)); n.used = ht->used; for (i = 0; ht->used > 0; i++) { Jim_HashEntry *he, *nextHe; if (ht->table[i] == NULL) continue; he = ht->table[i]; while (he) { unsigned int h; nextHe = he->next; h = Jim_HashKey(ht, he->key) & n.sizemask; he->next = n.table[h]; n.table[h] = he; ht->used--; he = nextHe; } } assert(ht->used == 0); Jim_Free(ht->table); *ht = n; } int Jim_AddHashEntry(Jim_HashTable *ht, const void *key, void *val) { Jim_HashEntry *entry; entry = JimInsertHashEntry(ht, key, 0); if (entry == NULL) return JIM_ERR; Jim_SetHashKey(ht, entry, key); Jim_SetHashVal(ht, entry, val); return JIM_OK; } int Jim_ReplaceHashEntry(Jim_HashTable *ht, const void *key, void *val) |
︙ | ︙ | |||
6676 6677 6678 6679 6680 6681 6682 | else { Jim_FreeEntryVal(ht, entry); Jim_SetHashVal(ht, entry, val); } existed = 1; } else { | | | 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 | else { Jim_FreeEntryVal(ht, entry); Jim_SetHashVal(ht, entry, val); } existed = 1; } else { Jim_SetHashKey(ht, entry, key); Jim_SetHashVal(ht, entry, val); existed = 0; } return existed; } |
︙ | ︙ | |||
6699 6700 6701 6702 6703 6704 6705 | return JIM_ERR; h = Jim_HashKey(ht, key) & ht->sizemask; he = ht->table[h]; prevHe = NULL; while (he) { if (Jim_CompareHashKeys(ht, key, he->key)) { | | | | | | | | 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 | return JIM_ERR; h = Jim_HashKey(ht, key) & ht->sizemask; he = ht->table[h]; prevHe = NULL; while (he) { if (Jim_CompareHashKeys(ht, key, he->key)) { if (prevHe) prevHe->next = he->next; else ht->table[h] = he->next; Jim_FreeEntryKey(ht, he); Jim_FreeEntryVal(ht, he); Jim_Free(he); ht->used--; return JIM_OK; } prevHe = he; he = he->next; } return JIM_ERR; } int Jim_FreeHashTable(Jim_HashTable *ht) { unsigned int i; for (i = 0; ht->used > 0; i++) { Jim_HashEntry *he, *nextHe; if ((he = ht->table[i]) == NULL) continue; while (he) { nextHe = he->next; Jim_FreeEntryKey(ht, he); Jim_FreeEntryVal(ht, he); Jim_Free(he); ht->used--; he = nextHe; } } Jim_Free(ht->table); JimResetHashTable(ht); return JIM_OK; } Jim_HashEntry *Jim_FindHashEntry(Jim_HashTable *ht, const void *key) { Jim_HashEntry *he; unsigned int h; |
︙ | ︙ | |||
6817 6818 6819 6820 6821 6822 6823 | } static Jim_HashEntry *JimInsertHashEntry(Jim_HashTable *ht, const void *key, int replace) { unsigned int h; Jim_HashEntry *he; | | | | | | 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 | } static Jim_HashEntry *JimInsertHashEntry(Jim_HashTable *ht, const void *key, int replace) { unsigned int h; Jim_HashEntry *he; JimExpandHashTableIfNeeded(ht); h = Jim_HashKey(ht, key) & ht->sizemask; he = ht->table[h]; while (he) { if (Jim_CompareHashKeys(ht, key, he->key)) return replace ? he : NULL; he = he->next; } he = Jim_Alloc(sizeof(*he)); he->next = ht->table[h]; ht->table[h] = he; ht->used++; he->key = NULL; return he; |
︙ | ︙ | |||
6863 6864 6865 6866 6867 6868 6869 | static void JimStringCopyHTKeyDestructor(void *privdata, void *key) { Jim_Free(key); } static const Jim_HashTableType JimPackageHashTableType = { | | | | | | | | | | | | | | 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 | static void JimStringCopyHTKeyDestructor(void *privdata, void *key) { Jim_Free(key); } static const Jim_HashTableType JimPackageHashTableType = { JimStringCopyHTHashFunction, JimStringCopyHTDup, NULL, JimStringCopyHTKeyCompare, JimStringCopyHTKeyDestructor, NULL }; typedef struct AssocDataValue { Jim_InterpDeleteProc *delProc; void *data; } AssocDataValue; static void JimAssocDataHashTableValueDestructor(void *privdata, void *data) { AssocDataValue *assocPtr = (AssocDataValue *) data; if (assocPtr->delProc != NULL) assocPtr->delProc((Jim_Interp *)privdata, assocPtr->data); Jim_Free(data); } static const Jim_HashTableType JimAssocDataHashTableType = { JimStringCopyHTHashFunction, JimStringCopyHTDup, NULL, JimStringCopyHTKeyCompare, JimStringCopyHTKeyDestructor, JimAssocDataHashTableValueDestructor }; void Jim_InitStack(Jim_Stack *stack) { stack->len = 0; stack->maxlen = 0; stack->vector = NULL; |
︙ | ︙ | |||
6949 6950 6951 6952 6953 6954 6955 | for (i = 0; i < stack->len; i++) freeFunc(stack->vector[i]); } | | | | | | | | | | | | > | > > > > | | | | | | | | | | | | | 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 | for (i = 0; i < stack->len; i++) freeFunc(stack->vector[i]); } #define JIM_TT_NONE 0 #define JIM_TT_STR 1 #define JIM_TT_ESC 2 #define JIM_TT_VAR 3 #define JIM_TT_DICTSUGAR 4 #define JIM_TT_CMD 5 #define JIM_TT_SEP 6 #define JIM_TT_EOL 7 #define JIM_TT_EOF 8 #define JIM_TT_LINE 9 #define JIM_TT_WORD 10 #define JIM_TT_SUBEXPR_START 11 #define JIM_TT_SUBEXPR_END 12 #define JIM_TT_SUBEXPR_COMMA 13 #define JIM_TT_EXPR_INT 14 #define JIM_TT_EXPR_DOUBLE 15 #define JIM_TT_EXPR_BOOLEAN 16 #define JIM_TT_EXPRSUGAR 17 #define JIM_TT_EXPR_OP 20 #define TOKEN_IS_SEP(type) (type >= JIM_TT_SEP && type <= JIM_TT_EOF) #define TOKEN_IS_EXPR_START(type) (type == JIM_TT_NONE || type == JIM_TT_SUBEXPR_START || type == JIM_TT_SUBEXPR_COMMA) #define TOKEN_IS_EXPR_OP(type) (type >= JIM_TT_EXPR_OP) struct JimParseMissing { int ch; int line; }; struct JimParserCtx { const char *p; int len; int linenr; const char *tstart; const char *tend; int tline; int tt; int eof; int inquote; int comment; struct JimParseMissing missing; }; static int JimParseScript(struct JimParserCtx *pc); static int JimParseSep(struct JimParserCtx *pc); static int JimParseEol(struct JimParserCtx *pc); static int JimParseCmd(struct JimParserCtx *pc); static int JimParseQuote(struct JimParserCtx *pc); |
︙ | ︙ | |||
7028 7029 7030 7031 7032 7033 7034 | pc->comment = 1; pc->missing.ch = ' '; pc->missing.line = linenr; } static int JimParseScript(struct JimParserCtx *pc) { | | | 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 | pc->comment = 1; pc->missing.ch = ' '; pc->missing.line = linenr; } static int JimParseScript(struct JimParserCtx *pc) { while (1) { if (!pc->len) { pc->tstart = pc->p; pc->tend = pc->p - 1; pc->tline = pc->linenr; pc->tt = JIM_TT_EOL; pc->eof = 1; return JIM_OK; |
︙ | ︙ | |||
7064 7065 7066 7067 7068 7069 7070 | return JimParseStr(pc); case '[': pc->comment = 0; return JimParseCmd(pc); case '$': pc->comment = 0; if (JimParseVar(pc) == JIM_ERR) { | | | 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 | return JimParseStr(pc); case '[': pc->comment = 0; return JimParseCmd(pc); case '$': pc->comment = 0; if (JimParseVar(pc) == JIM_ERR) { pc->tstart = pc->tend = pc->p++; pc->len--; pc->tt = JIM_TT_ESC; } return JIM_OK; case '#': if (pc->comment) { |
︙ | ︙ | |||
7125 7126 7127 7128 7129 7130 7131 | } static void JimParseSubBrace(struct JimParserCtx *pc) { int level = 1; | | | 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 | } static void JimParseSubBrace(struct JimParserCtx *pc) { int level = 1; pc->p++; pc->len--; while (pc->len) { switch (*pc->p) { case '\\': if (pc->len > 1) { if (*++pc->p == '\n') { |
︙ | ︙ | |||
7169 7170 7171 7172 7173 7174 7175 | } static int JimParseSubQuote(struct JimParserCtx *pc) { int tt = JIM_TT_STR; int line = pc->tline; | | | 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 | } static int JimParseSubQuote(struct JimParserCtx *pc) { int tt = JIM_TT_STR; int line = pc->tline; pc->p++; pc->len--; while (pc->len) { switch (*pc->p) { case '\\': if (pc->len > 1) { if (*++pc->p == '\n') { |
︙ | ︙ | |||
7218 7219 7220 7221 7222 7223 7224 | static void JimParseSubCmd(struct JimParserCtx *pc) { int level = 1; int startofword = 1; int line = pc->tline; | | | 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 | static void JimParseSubCmd(struct JimParserCtx *pc) { int level = 1; int startofword = 1; int line = pc->tline; pc->p++; pc->len--; while (pc->len) { switch (*pc->p) { case '\\': if (pc->len > 1) { if (*++pc->p == '\n') { |
︙ | ︙ | |||
7298 7299 7300 7301 7302 7303 7304 | pc->tline = pc->linenr; pc->tt = JimParseSubQuote(pc); return JIM_OK; } static int JimParseVar(struct JimParserCtx *pc) { | | | | 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 | pc->tline = pc->linenr; pc->tt = JimParseSubQuote(pc); return JIM_OK; } static int JimParseVar(struct JimParserCtx *pc) { pc->p++; pc->len--; #ifdef EXPRSUGAR_BRACKET if (*pc->p == '[') { JimParseCmd(pc); pc->tt = JIM_TT_EXPRSUGAR; return JIM_OK; } #endif pc->tstart = pc->p; |
︙ | ︙ | |||
7334 7335 7336 7337 7338 7339 7340 | if (pc->len) { pc->p++; pc->len--; } } else { while (1) { | | | | 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 | if (pc->len) { pc->p++; pc->len--; } } else { while (1) { if (pc->p[0] == ':' && pc->p[1] == ':') { while (*pc->p == ':') { pc->p++; pc->len--; } continue; } if (isalnum(UCHAR(*pc->p)) || *pc->p == '_' || UCHAR(*pc->p) >= 0x80) { pc->p++; pc->len--; continue; } break; } if (*pc->p == '(') { int count = 1; const char *paren = NULL; pc->tt = JIM_TT_DICTSUGAR; while (count && pc->len) { |
︙ | ︙ | |||
7376 7377 7378 7379 7380 7381 7382 | } } if (count == 0) { pc->p++; pc->len--; } else if (paren) { | | | 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 | } } if (count == 0) { pc->p++; pc->len--; } else if (paren) { paren++; pc->len += (pc->p - paren); pc->p = paren; } #ifndef EXPRSUGAR_BRACKET if (*pc->tstart == '(') { pc->tt = JIM_TT_EXPRSUGAR; |
︙ | ︙ | |||
7401 7402 7403 7404 7405 7406 7407 | return JIM_OK; } static int JimParseStr(struct JimParserCtx *pc) { if (pc->tt == JIM_TT_SEP || pc->tt == JIM_TT_EOL || pc->tt == JIM_TT_NONE || pc->tt == JIM_TT_STR) { | | | | 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 | return JIM_OK; } static int JimParseStr(struct JimParserCtx *pc) { if (pc->tt == JIM_TT_SEP || pc->tt == JIM_TT_EOL || pc->tt == JIM_TT_NONE || pc->tt == JIM_TT_STR) { if (*pc->p == '{') { return JimParseBrace(pc); } if (*pc->p == '"') { pc->inquote = 1; pc->p++; pc->len--; pc->missing.line = pc->tline; } } pc->tstart = pc->p; pc->tline = pc->linenr; while (1) { if (pc->len == 0) { |
︙ | ︙ | |||
7439 7440 7441 7442 7443 7444 7445 | if (*(pc->p + 1) == '\n') { pc->linenr++; } pc->p++; pc->len--; } else if (pc->len == 1) { | | | | | | | 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 | if (*(pc->p + 1) == '\n') { pc->linenr++; } pc->p++; pc->len--; } else if (pc->len == 1) { pc->missing.ch = '\\'; } break; case '(': if (pc->len > 1 && pc->p[1] != '$') { break; } case ')': if (*pc->p == '(' || pc->tt == JIM_TT_VAR) { if (pc->p == pc->tstart) { pc->p++; pc->len--; } pc->tend = pc->p - 1; pc->tt = JIM_TT_ESC; return JIM_OK; } |
︙ | ︙ | |||
7497 7498 7499 7500 7501 7502 7503 | return JIM_OK; } break; } pc->p++; pc->len--; } | | | 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 | return JIM_OK; } break; } pc->p++; pc->len--; } return JIM_OK; } static int JimParseComment(struct JimParserCtx *pc) { while (*pc->p) { if (*pc->p == '\\') { pc->p++; |
︙ | ︙ | |||
7608 7609 7610 7611 7612 7613 7614 | for (k = 0; k < maxchars; k++) { int c = xdigitval(s[i + k + 1]); if (c == -1) { break; } val = (val << 4) | c; } | | | | | | | | | 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 | for (k = 0; k < maxchars; k++) { int c = xdigitval(s[i + k + 1]); if (c == -1) { break; } val = (val << 4) | c; } if (s[i] == '{') { if (k == 0 || val > 0x1fffff || s[i + k + 1] != '}') { i--; k = 0; } else { k++; } } if (k) { if (s[i] == 'x') { *p++ = val; } else { p += utf8_fromunicode(p, val); } i += k; break; } *p++ = s[i]; } break; case 'v': *p++ = 0xb; i++; break; case '\0': *p++ = '\\'; i++; break; case '\n': *p++ = ' '; do { i++; } while (s[i + 1] == ' ' || s[i + 1] == '\t'); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { int val = 0; int c = odigitval(s[i + 1]); val = c; c = odigitval(s[i + 2]); if (c == -1) { |
︙ | ︙ | |||
7706 7707 7708 7709 7710 7711 7712 | { const char *start, *end; char *token; int len; start = pc->tstart; end = pc->tend; | > | < < < < | | | | | | | | | < | 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 | { const char *start, *end; char *token; int len; start = pc->tstart; end = pc->tend; len = (end - start) + 1; if (len < 0) { len = 0; } token = Jim_Alloc(len + 1); if (pc->tt != JIM_TT_ESC) { memcpy(token, start, len); token[len] = '\0'; } else { len = JimEscape(token, start, len); } return Jim_NewStringObjNoAlloc(interp, token, len); } static int JimParseListSep(struct JimParserCtx *pc); static int JimParseListStr(struct JimParserCtx *pc); |
︙ | ︙ | |||
7788 7789 7790 7791 7792 7793 7794 | pc->tt = JIM_TT_STR; while (pc->len) { switch (*pc->p) { case '\\': pc->tt = JIM_TT_ESC; if (--pc->len == 0) { | | | 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 | pc->tt = JIM_TT_STR; while (pc->len) { switch (*pc->p) { case '\\': pc->tt = JIM_TT_ESC; if (--pc->len == 0) { pc->tend = pc->p; return JIM_OK; } pc->p++; break; case '\n': pc->linenr++; |
︙ | ︙ | |||
7824 7825 7826 7827 7828 7829 7830 | while (pc->len) { if (isspace(UCHAR(*pc->p))) { pc->tend = pc->p - 1; return JIM_OK; } if (*pc->p == '\\') { if (--pc->len == 0) { | | | | | | | | | | | | 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 | while (pc->len) { if (isspace(UCHAR(*pc->p))) { pc->tend = pc->p - 1; return JIM_OK; } if (*pc->p == '\\') { if (--pc->len == 0) { pc->tend = pc->p; return JIM_OK; } pc->tt = JIM_TT_ESC; pc->p++; } pc->p++; pc->len--; } pc->tend = pc->p - 1; return JIM_OK; } Jim_Obj *Jim_NewObj(Jim_Interp *interp) { Jim_Obj *objPtr; if (interp->freeList != NULL) { objPtr = interp->freeList; interp->freeList = objPtr->nextObjPtr; } else { objPtr = Jim_Alloc(sizeof(*objPtr)); } objPtr->refCount = 0; objPtr->prevObjPtr = NULL; objPtr->nextObjPtr = interp->liveList; if (interp->liveList) interp->liveList->prevObjPtr = objPtr; interp->liveList = objPtr; return objPtr; } void Jim_FreeObj(Jim_Interp *interp, Jim_Obj *objPtr) { JimPanic((objPtr->refCount != 0, "!!!Object %p freed with bad refcount %d, type=%s", objPtr, objPtr->refCount, objPtr->typePtr ? objPtr->typePtr->name : "<none>")); Jim_FreeIntRep(interp, objPtr); if (objPtr->bytes != NULL) { if (objPtr->bytes != JimEmptyStringRep) Jim_Free(objPtr->bytes); } if (objPtr->prevObjPtr) objPtr->prevObjPtr->nextObjPtr = objPtr->nextObjPtr; if (objPtr->nextObjPtr) objPtr->nextObjPtr->prevObjPtr = objPtr->prevObjPtr; if (interp->liveList == objPtr) interp->liveList = objPtr->nextObjPtr; #ifdef JIM_DISABLE_OBJECT_POOL Jim_Free(objPtr); #else objPtr->prevObjPtr = NULL; objPtr->nextObjPtr = interp->freeList; if (interp->freeList) interp->freeList->prevObjPtr = objPtr; interp->freeList = objPtr; objPtr->refCount = -1; #endif |
︙ | ︙ | |||
7917 7918 7919 7920 7921 7922 7923 | Jim_Obj *Jim_DuplicateObj(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_Obj *dupPtr; dupPtr = Jim_NewObj(interp); if (objPtr->bytes == NULL) { | | < | | | | | < | | < < | > > > > > > > > > > > | > | | | < | < > | 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 | Jim_Obj *Jim_DuplicateObj(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_Obj *dupPtr; dupPtr = Jim_NewObj(interp); if (objPtr->bytes == NULL) { dupPtr->bytes = NULL; } else if (objPtr->length == 0) { dupPtr->bytes = JimEmptyStringRep; dupPtr->length = 0; dupPtr->typePtr = NULL; return dupPtr; } else { dupPtr->bytes = Jim_Alloc(objPtr->length + 1); dupPtr->length = objPtr->length; memcpy(dupPtr->bytes, objPtr->bytes, objPtr->length + 1); } dupPtr->typePtr = objPtr->typePtr; if (objPtr->typePtr != NULL) { if (objPtr->typePtr->dupIntRepProc == NULL) { dupPtr->internalRep = objPtr->internalRep; } else { objPtr->typePtr->dupIntRepProc(interp, objPtr, dupPtr); } } return dupPtr; } const char *Jim_GetString(Jim_Obj *objPtr, int *lenPtr) { if (objPtr->bytes == NULL) { JimPanic((objPtr->typePtr->updateStringProc == NULL, "UpdateStringProc called against '%s' type.", objPtr->typePtr->name)); objPtr->typePtr->updateStringProc(objPtr); } if (lenPtr) *lenPtr = objPtr->length; return objPtr->bytes; } int Jim_Length(Jim_Obj *objPtr) { if (objPtr->bytes == NULL) { Jim_GetString(objPtr, NULL); } return objPtr->length; } const char *Jim_String(Jim_Obj *objPtr) { if (objPtr->bytes == NULL) { Jim_GetString(objPtr, NULL); } return objPtr->bytes; } static void JimSetStringBytes(Jim_Obj *objPtr, const char *str) { objPtr->bytes = Jim_StrDup(str); objPtr->length = strlen(str); } static void FreeDictSubstInternalRep(Jim_Interp *interp, Jim_Obj *objPtr); static void DupDictSubstInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); static const Jim_ObjType dictSubstObjType = { "dict-substitution", FreeDictSubstInternalRep, DupDictSubstInternalRep, NULL, JIM_TYPE_NONE, }; static void FreeInterpolatedInternalRep(Jim_Interp *interp, Jim_Obj *objPtr); static void DupInterpolatedInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); static const Jim_ObjType interpolatedObjType = { "interpolated", FreeInterpolatedInternalRep, DupInterpolatedInternalRep, NULL, JIM_TYPE_NONE, }; static void FreeInterpolatedInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_DecrRefCount(interp, objPtr->internalRep.dictSubstValue.indexObjPtr); } static void DupInterpolatedInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { dupPtr->internalRep = srcPtr->internalRep; Jim_IncrRefCount(dupPtr->internalRep.dictSubstValue.indexObjPtr); } static void DupStringInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); static int SetStringFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr); static const Jim_ObjType stringObjType = { "string", NULL, |
︙ | ︙ | |||
8035 8036 8037 8038 8039 8040 8041 | dupPtr->internalRep.strValue.maxLength = srcPtr->length; dupPtr->internalRep.strValue.charLength = srcPtr->internalRep.strValue.charLength; } static int SetStringFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { if (objPtr->typePtr != &stringObjType) { | | | | | | | 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 | dupPtr->internalRep.strValue.maxLength = srcPtr->length; dupPtr->internalRep.strValue.charLength = srcPtr->internalRep.strValue.charLength; } static int SetStringFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { if (objPtr->typePtr != &stringObjType) { if (objPtr->bytes == NULL) { JimPanic((objPtr->typePtr->updateStringProc == NULL, "UpdateStringProc called against '%s' type.", objPtr->typePtr->name)); objPtr->typePtr->updateStringProc(objPtr); } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &stringObjType; objPtr->internalRep.strValue.maxLength = objPtr->length; objPtr->internalRep.strValue.charLength = -1; } return JIM_OK; } int Jim_Utf8Length(Jim_Interp *interp, Jim_Obj *objPtr) { |
︙ | ︙ | |||
8071 8072 8073 8074 8075 8076 8077 | } Jim_Obj *Jim_NewStringObj(Jim_Interp *interp, const char *s, int len) { Jim_Obj *objPtr = Jim_NewObj(interp); | | | | < < | | | | 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 | } Jim_Obj *Jim_NewStringObj(Jim_Interp *interp, const char *s, int len) { Jim_Obj *objPtr = Jim_NewObj(interp); if (len == -1) len = strlen(s); if (len == 0) { objPtr->bytes = JimEmptyStringRep; } else { objPtr->bytes = Jim_StrDupLen(s, len); } objPtr->length = len; objPtr->typePtr = NULL; return objPtr; } Jim_Obj *Jim_NewStringObjUtf8(Jim_Interp *interp, const char *s, int charlen) { #ifdef JIM_UTF8 int bytelen = utf8_index(s, charlen); Jim_Obj *objPtr = Jim_NewStringObj(interp, s, bytelen); objPtr->typePtr = &stringObjType; objPtr->internalRep.strValue.maxLength = bytelen; objPtr->internalRep.strValue.charLength = charlen; return objPtr; #else return Jim_NewStringObj(interp, s, charlen); |
︙ | ︙ | |||
8130 8131 8132 8133 8134 8135 8136 | if (len == -1) len = strlen(str); needlen = objPtr->length + len; if (objPtr->internalRep.strValue.maxLength < needlen || objPtr->internalRep.strValue.maxLength == 0) { needlen *= 2; | | | | 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 | if (len == -1) len = strlen(str); needlen = objPtr->length + len; if (objPtr->internalRep.strValue.maxLength < needlen || objPtr->internalRep.strValue.maxLength == 0) { needlen *= 2; if (needlen < 7) { needlen = 7; } if (objPtr->bytes == JimEmptyStringRep) { objPtr->bytes = Jim_Alloc(needlen + 1); } else { objPtr->bytes = Jim_Realloc(objPtr->bytes, needlen + 1); } objPtr->internalRep.strValue.maxLength = needlen; } memcpy(objPtr->bytes + objPtr->length, str, len); objPtr->bytes[objPtr->length + len] = '\0'; if (objPtr->internalRep.strValue.charLength >= 0) { objPtr->internalRep.strValue.charLength += utf8_strlen(objPtr->bytes + objPtr->length, len); } objPtr->length += len; } void Jim_AppendString(Jim_Interp *interp, Jim_Obj *objPtr, const char *str, int len) { |
︙ | ︙ | |||
8208 8209 8210 8211 8212 8213 8214 | int Jim_StringCompareObj(Jim_Interp *interp, Jim_Obj *firstObjPtr, Jim_Obj *secondObjPtr, int nocase) { int l1, l2; const char *s1 = Jim_GetString(firstObjPtr, &l1); const char *s2 = Jim_GetString(secondObjPtr, &l2); if (nocase) { | | | 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 | int Jim_StringCompareObj(Jim_Interp *interp, Jim_Obj *firstObjPtr, Jim_Obj *secondObjPtr, int nocase) { int l1, l2; const char *s1 = Jim_GetString(firstObjPtr, &l1); const char *s2 = Jim_GetString(secondObjPtr, &l2); if (nocase) { return JimStringCompareLen(s1, s2, -1, nocase); } return JimStringCompare(s1, l1, s2, l2); } int Jim_StringCompareLenObj(Jim_Interp *interp, Jim_Obj *firstObjPtr, Jim_Obj *secondObjPtr, int nocase) { |
︙ | ︙ | |||
8310 8311 8312 8313 8314 8315 8316 | return NULL; } if (first == 0 && rangeLen == len) { return strObjPtr; } if (len == bytelen) { | | | 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 | return NULL; } if (first == 0 && rangeLen == len) { return strObjPtr; } if (len == bytelen) { return Jim_NewStringObj(interp, str + first, rangeLen); } return Jim_NewStringObjUtf8(interp, str + utf8_index(str, first), rangeLen); #else return Jim_StringByteRangeObj(interp, strObjPtr, firstObjPtr, lastObjPtr); #endif } |
︙ | ︙ | |||
8339 8340 8341 8342 8343 8344 8345 | if (last < first) { return strObjPtr; } str = Jim_String(strObjPtr); | | | | | 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 | if (last < first) { return strObjPtr; } str = Jim_String(strObjPtr); objPtr = Jim_NewStringObjUtf8(interp, str, first); if (newStrObj) { Jim_AppendObj(interp, objPtr, newStrObj); } Jim_AppendString(interp, objPtr, str + utf8_index(str, last + 1), len - last - 1); return objPtr; } static void JimStrCopyUpperLower(char *dest, const char *str, int uc) { |
︙ | ︙ | |||
8369 8370 8371 8372 8373 8374 8375 | static Jim_Obj *JimStringToLower(Jim_Interp *interp, Jim_Obj *strObjPtr) { char *buf; int len; const char *str; | < < < < < < < < | | 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 | static Jim_Obj *JimStringToLower(Jim_Interp *interp, Jim_Obj *strObjPtr) { char *buf; int len; const char *str; str = Jim_GetString(strObjPtr, &len); #ifdef JIM_UTF8 len *= 2; #endif buf = Jim_Alloc(len + 1); JimStrCopyUpperLower(buf, str, 0); return Jim_NewStringObjNoAlloc(interp, buf, -1); } static Jim_Obj *JimStringToUpper(Jim_Interp *interp, Jim_Obj *strObjPtr) { char *buf; const char *str; int len; str = Jim_GetString(strObjPtr, &len); #ifdef JIM_UTF8 len *= 2; #endif buf = Jim_Alloc(len + 1); JimStrCopyUpperLower(buf, str, 1); return Jim_NewStringObjNoAlloc(interp, buf, -1); } static Jim_Obj *JimStringToTitle(Jim_Interp *interp, Jim_Obj *strObjPtr) { char *buf, *p; int len; int c; const char *str; str = Jim_GetString(strObjPtr, &len); #ifdef JIM_UTF8 len *= 2; #endif buf = p = Jim_Alloc(len + 1); str += utf8_tounicode(str, &c); p += utf8_getchars(p, utf8_title(c)); |
︙ | ︙ | |||
8450 8451 8452 8453 8454 8455 8456 | static const char *JimFindTrimLeft(const char *str, int len, const char *trimchars, int trimlen) { while (len) { int c; int n = utf8_tounicode(str, &c); if (utf8_memchr(trimchars, trimlen, c) == NULL) { | | | 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 | static const char *JimFindTrimLeft(const char *str, int len, const char *trimchars, int trimlen) { while (len) { int c; int n = utf8_tounicode(str, &c); if (utf8_memchr(trimchars, trimlen, c) == NULL) { break; } str += n; len -= n; } return str; } |
︙ | ︙ | |||
8521 8522 8523 8524 8525 8526 8527 | SetStringFromAny(interp, strObjPtr); len = Jim_Length(strObjPtr); nontrim = JimFindTrimRight(strObjPtr->bytes, len, trimchars, trimcharslen); if (nontrim == NULL) { | | | | | | | | | 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 | SetStringFromAny(interp, strObjPtr); len = Jim_Length(strObjPtr); nontrim = JimFindTrimRight(strObjPtr->bytes, len, trimchars, trimcharslen); if (nontrim == NULL) { return Jim_NewEmptyStringObj(interp); } if (nontrim == strObjPtr->bytes + len) { return strObjPtr; } if (Jim_IsShared(strObjPtr)) { strObjPtr = Jim_NewStringObj(interp, strObjPtr->bytes, (nontrim - strObjPtr->bytes)); } else { strObjPtr->bytes[nontrim - strObjPtr->bytes] = 0; strObjPtr->length = (nontrim - strObjPtr->bytes); } return strObjPtr; } static Jim_Obj *JimStringTrim(Jim_Interp *interp, Jim_Obj *strObjPtr, Jim_Obj *trimcharsObjPtr) { Jim_Obj *objPtr = JimStringTrimLeft(interp, strObjPtr, trimcharsObjPtr); strObjPtr = JimStringTrimRight(interp, objPtr, trimcharsObjPtr); if (objPtr != strObjPtr && objPtr->refCount == 0) { Jim_FreeNewObj(interp, objPtr); } return strObjPtr; } |
︙ | ︙ | |||
8573 8574 8575 8576 8577 8578 8579 | #endif static int JimStringIs(Jim_Interp *interp, Jim_Obj *strObjPtr, Jim_Obj *strClass, int strict) { static const char * const strclassnames[] = { "integer", "alpha", "alnum", "ascii", "digit", "double", "lower", "upper", "space", "xdigit", | | | | 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 | #endif static int JimStringIs(Jim_Interp *interp, Jim_Obj *strObjPtr, Jim_Obj *strClass, int strict) { static const char * const strclassnames[] = { "integer", "alpha", "alnum", "ascii", "digit", "double", "lower", "upper", "space", "xdigit", "control", "print", "graph", "punct", "boolean", NULL }; enum { STR_IS_INTEGER, STR_IS_ALPHA, STR_IS_ALNUM, STR_IS_ASCII, STR_IS_DIGIT, STR_IS_DOUBLE, STR_IS_LOWER, STR_IS_UPPER, STR_IS_SPACE, STR_IS_XDIGIT, STR_IS_CONTROL, STR_IS_PRINT, STR_IS_GRAPH, STR_IS_PUNCT, STR_IS_BOOLEAN, }; int strclass; int len; int i; const char *str; int (*isclassfunc)(int c) = NULL; |
︙ | ︙ | |||
8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 | case STR_IS_DOUBLE: { double d; Jim_SetResultBool(interp, Jim_GetDouble(interp, strObjPtr, &d) == JIM_OK && errno != ERANGE); return JIM_OK; } case STR_IS_ALPHA: isclassfunc = isalpha; break; case STR_IS_ALNUM: isclassfunc = isalnum; break; case STR_IS_ASCII: isclassfunc = jim_isascii; break; case STR_IS_DIGIT: isclassfunc = isdigit; break; case STR_IS_LOWER: isclassfunc = islower; break; case STR_IS_UPPER: isclassfunc = isupper; break; case STR_IS_SPACE: isclassfunc = isspace; break; case STR_IS_XDIGIT: isclassfunc = isxdigit; break; case STR_IS_CONTROL: isclassfunc = iscntrl; break; case STR_IS_PRINT: isclassfunc = isprint; break; case STR_IS_GRAPH: isclassfunc = isgraph; break; case STR_IS_PUNCT: isclassfunc = ispunct; break; default: return JIM_ERR; } for (i = 0; i < len; i++) { | > > > > > > > | | 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 | case STR_IS_DOUBLE: { double d; Jim_SetResultBool(interp, Jim_GetDouble(interp, strObjPtr, &d) == JIM_OK && errno != ERANGE); return JIM_OK; } case STR_IS_BOOLEAN: { int b; Jim_SetResultBool(interp, Jim_GetBoolean(interp, strObjPtr, &b) == JIM_OK); return JIM_OK; } case STR_IS_ALPHA: isclassfunc = isalpha; break; case STR_IS_ALNUM: isclassfunc = isalnum; break; case STR_IS_ASCII: isclassfunc = jim_isascii; break; case STR_IS_DIGIT: isclassfunc = isdigit; break; case STR_IS_LOWER: isclassfunc = islower; break; case STR_IS_UPPER: isclassfunc = isupper; break; case STR_IS_SPACE: isclassfunc = isspace; break; case STR_IS_XDIGIT: isclassfunc = isxdigit; break; case STR_IS_CONTROL: isclassfunc = iscntrl; break; case STR_IS_PRINT: isclassfunc = isprint; break; case STR_IS_GRAPH: isclassfunc = isgraph; break; case STR_IS_PUNCT: isclassfunc = ispunct; break; default: return JIM_ERR; } for (i = 0; i < len; i++) { if (!isclassfunc(UCHAR(str[i]))) { Jim_SetResultBool(interp, 0); return JIM_OK; } } Jim_SetResultBool(interp, 1); return JIM_OK; } |
︙ | ︙ | |||
8654 8655 8656 8657 8658 8659 8660 | int Jim_CompareStringImmediate(Jim_Interp *interp, Jim_Obj *objPtr, const char *str) { if (objPtr->typePtr == &comparedStringObjType && objPtr->internalRep.ptr == str) { return 1; } else { | < < | | | 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 | int Jim_CompareStringImmediate(Jim_Interp *interp, Jim_Obj *objPtr, const char *str) { if (objPtr->typePtr == &comparedStringObjType && objPtr->internalRep.ptr == str) { return 1; } else { if (strcmp(str, Jim_String(objPtr)) != 0) return 0; if (objPtr->typePtr != &comparedStringObjType) { Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &comparedStringObjType; } objPtr->internalRep.ptr = (char *)str; return 1; } } static int qsortCompareStringPointers(const void *a, const void *b) { char *const *sa = (char *const *)a; |
︙ | ︙ | |||
8756 8757 8758 8759 8760 8761 8762 | { Jim_Obj *objPtr; int type; } ScriptToken; typedef struct ScriptObj { | | | | | | | | | 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 | { Jim_Obj *objPtr; int type; } ScriptToken; typedef struct ScriptObj { ScriptToken *token; Jim_Obj *fileNameObj; int len; int substFlags; int inUse; /* Used to share a ScriptObj. Currently only used by Jim_EvalObj() as protection against shimmering of the currently evaluated object. */ int firstline; int linenr; int missing; } ScriptObj; static void JimSetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr); static int JimParseCheckMissing(Jim_Interp *interp, int ch); static ScriptObj *JimGetScript(Jim_Interp *interp, Jim_Obj *objPtr); void FreeScriptInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) |
︙ | ︙ | |||
8797 8798 8799 8800 8801 8802 8803 | JIM_NOTUSED(srcPtr); dupPtr->typePtr = NULL; } typedef struct { | | | | | | | | | | | 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 | JIM_NOTUSED(srcPtr); dupPtr->typePtr = NULL; } typedef struct { const char *token; int len; int type; int line; } ParseToken; typedef struct { ParseToken *list; int size; int count; ParseToken static_list[20]; } ParseTokenList; static void ScriptTokenListInit(ParseTokenList *tokenlist) { tokenlist->list = tokenlist->static_list; tokenlist->size = sizeof(tokenlist->static_list) / sizeof(ParseToken); tokenlist->count = 0; |
︙ | ︙ | |||
8832 8833 8834 8835 8836 8837 8838 | static void ScriptAddToken(ParseTokenList *tokenlist, const char *token, int len, int type, int line) { ParseToken *t; if (tokenlist->count == tokenlist->size) { | | | | | | > > | > > | | > > > | | | | | | | | | | | | | | | 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 | static void ScriptAddToken(ParseTokenList *tokenlist, const char *token, int len, int type, int line) { ParseToken *t; if (tokenlist->count == tokenlist->size) { tokenlist->size *= 2; if (tokenlist->list != tokenlist->static_list) { tokenlist->list = Jim_Realloc(tokenlist->list, tokenlist->size * sizeof(*tokenlist->list)); } else { tokenlist->list = Jim_Alloc(tokenlist->size * sizeof(*tokenlist->list)); memcpy(tokenlist->list, tokenlist->static_list, tokenlist->count * sizeof(*tokenlist->list)); } } t = &tokenlist->list[tokenlist->count++]; t->token = token; t->len = len; t->type = type; t->line = line; } static int JimCountWordTokens(struct ScriptObj *script, ParseToken *t) { int expand = 1; int count = 0; if (t->type == JIM_TT_STR && !TOKEN_IS_SEP(t[1].type)) { if ((t->len == 1 && *t->token == '*') || (t->len == 6 && strncmp(t->token, "expand", 6) == 0)) { expand = -1; t++; } else { if (script->missing == ' ') { script->missing = '}'; script->linenr = t[1].line; } } } while (!TOKEN_IS_SEP(t->type)) { t++; count++; } return count * expand; } static Jim_Obj *JimMakeScriptObj(Jim_Interp *interp, const ParseToken *t) { Jim_Obj *objPtr; if (t->type == JIM_TT_ESC && memchr(t->token, '\\', t->len) != NULL) { int len = t->len; char *str = Jim_Alloc(len + 1); len = JimEscape(str, t->token, len); objPtr = Jim_NewStringObjNoAlloc(interp, str, len); } else { objPtr = Jim_NewStringObj(interp, t->token, t->len); } return objPtr; } static void ScriptObjAddTokens(Jim_Interp *interp, struct ScriptObj *script, ParseTokenList *tokenlist) { int i; struct ScriptToken *token; int lineargs = 0; ScriptToken *linefirst; int count; int linenr; #ifdef DEBUG_SHOW_SCRIPT_TOKENS printf("==== Tokens ====\n"); for (i = 0; i < tokenlist->count; i++) { printf("[%2d]@%d %s '%.*s'\n", i, tokenlist->list[i].line, jim_tt_name(tokenlist->list[i].type), tokenlist->list[i].len, tokenlist->list[i].token); } #endif count = tokenlist->count; for (i = 0; i < tokenlist->count; i++) { if (tokenlist->list[i].type == JIM_TT_EOL) { count++; } } linenr = script->firstline = tokenlist->list[0].line; token = script->token = Jim_Alloc(sizeof(ScriptToken) * count); linefirst = token++; for (i = 0; i < tokenlist->count; ) { int wordtokens; while (tokenlist->list[i].type == JIM_TT_SEP) { i++; } wordtokens = JimCountWordTokens(script, tokenlist->list + i); if (wordtokens == 0) { if (lineargs) { linefirst->type = JIM_TT_LINE; linefirst->objPtr = JimNewScriptLineObj(interp, lineargs, linenr); Jim_IncrRefCount(linefirst->objPtr); lineargs = 0; linefirst = token++; } i++; continue; } else if (wordtokens != 1) { token->type = JIM_TT_WORD; token->objPtr = Jim_NewIntObj(interp, wordtokens); Jim_IncrRefCount(token->objPtr); token++; if (wordtokens < 0) { i++; wordtokens = -wordtokens - 1; lineargs--; } } if (lineargs == 0) { linenr = tokenlist->list[i].line; } lineargs++; while (wordtokens--) { const ParseToken *t = &tokenlist->list[i++]; token->type = t->type; token->objPtr = JimMakeScriptObj(interp, t); Jim_IncrRefCount(token->objPtr); |
︙ | ︙ | |||
9008 9009 9010 9011 9012 9013 9014 | int Jim_ScriptIsComplete(Jim_Interp *interp, Jim_Obj *scriptObj, char *stateCharPtr) { ScriptObj *script = JimGetScript(interp, scriptObj); if (stateCharPtr) { *stateCharPtr = script->missing; } | | > > > | 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 | int Jim_ScriptIsComplete(Jim_Interp *interp, Jim_Obj *scriptObj, char *stateCharPtr) { ScriptObj *script = JimGetScript(interp, scriptObj); if (stateCharPtr) { *stateCharPtr = script->missing; } return script->missing == ' ' || script->missing == '}'; } static int JimParseCheckMissing(Jim_Interp *interp, int ch) { const char *msg; switch (ch) { case '\\': case ' ': return JIM_OK; case '[': msg = "unmatched \"[\""; break; case '{': msg = "missing close-brace"; break; case '}': msg = "extra characters after close-brace"; break; case '"': default: msg = "missing quote"; break; } Jim_SetResultString(interp, msg, -1); |
︙ | ︙ | |||
9047 9048 9049 9050 9051 9052 9053 | struct ScriptToken *token; token = script->token = Jim_Alloc(sizeof(ScriptToken) * tokenlist->count); for (i = 0; i < tokenlist->count; i++) { const ParseToken *t = &tokenlist->list[i]; | | | | | | | | | | 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 | struct ScriptToken *token; token = script->token = Jim_Alloc(sizeof(ScriptToken) * tokenlist->count); for (i = 0; i < tokenlist->count; i++) { const ParseToken *t = &tokenlist->list[i]; token->type = t->type; token->objPtr = JimMakeScriptObj(interp, t); Jim_IncrRefCount(token->objPtr); token++; } script->len = i; } static void JimSetScriptFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) { int scriptTextLen; const char *scriptText = Jim_GetString(objPtr, &scriptTextLen); struct JimParserCtx parser; struct ScriptObj *script; ParseTokenList tokenlist; int line = 1; if (objPtr->typePtr == &sourceObjType) { line = objPtr->internalRep.sourceValue.lineNumber; } ScriptTokenListInit(&tokenlist); JimParserInit(&parser, scriptText, scriptTextLen, line); while (!parser.eof) { JimParseScript(&parser); ScriptAddToken(&tokenlist, parser.tstart, parser.tend - parser.tstart + 1, parser.tt, parser.tline); } ScriptAddToken(&tokenlist, scriptText + scriptTextLen, 0, JIM_TT_EOF, 0); script = Jim_Alloc(sizeof(*script)); memset(script, 0, sizeof(*script)); script->inUse = 1; if (objPtr->typePtr == &sourceObjType) { script->fileNameObj = objPtr->internalRep.sourceValue.fileNameObj; } else { script->fileNameObj = interp->emptyObj; } Jim_IncrRefCount(script->fileNameObj); script->missing = parser.missing.ch; script->linenr = parser.missing.line; ScriptObjAddTokens(interp, script, &tokenlist); ScriptTokenListFree(&tokenlist); Jim_FreeIntRep(interp, objPtr); Jim_SetIntRepPtr(objPtr, script); objPtr->typePtr = &scriptObjType; } static void JimAddErrorToStack(Jim_Interp *interp, ScriptObj *script); static ScriptObj *JimGetScript(Jim_Interp *interp, Jim_Obj *objPtr) { if (objPtr == interp->emptyObj) { objPtr = interp->nullScriptObj; } if (objPtr->typePtr != &scriptObjType || ((struct ScriptObj *)Jim_GetIntRepPtr(objPtr))->substFlags) { JimSetScriptFromAny(interp, objPtr); } |
︙ | ︙ | |||
9153 9154 9155 9156 9157 9158 9159 | Jim_DecrRefCount(interp, cmdPtr->u.proc.nsObj); if (cmdPtr->u.proc.staticVars) { Jim_FreeHashTable(cmdPtr->u.proc.staticVars); Jim_Free(cmdPtr->u.proc.staticVars); } } else { | | | < | | | | | | | | | | | | | | | 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 | Jim_DecrRefCount(interp, cmdPtr->u.proc.nsObj); if (cmdPtr->u.proc.staticVars) { Jim_FreeHashTable(cmdPtr->u.proc.staticVars); Jim_Free(cmdPtr->u.proc.staticVars); } } else { if (cmdPtr->u.native.delProc) { cmdPtr->u.native.delProc(interp, cmdPtr->u.native.privData); } } if (cmdPtr->prevCmd) { JimDecrCmdRefCount(interp, cmdPtr->prevCmd); } Jim_Free(cmdPtr); } } static void JimVariablesHTValDestructor(void *interp, void *val) { Jim_DecrRefCount(interp, ((Jim_Var *)val)->objPtr); Jim_Free(val); } static const Jim_HashTableType JimVariablesHashTableType = { JimStringCopyHTHashFunction, JimStringCopyHTDup, NULL, JimStringCopyHTKeyCompare, JimStringCopyHTKeyDestructor, JimVariablesHTValDestructor }; static void JimCommandsHT_ValDestructor(void *interp, void *val) { JimDecrCmdRefCount(interp, val); } static const Jim_HashTableType JimCommandsHashTableType = { JimStringCopyHTHashFunction, JimStringCopyHTDup, NULL, JimStringCopyHTKeyCompare, JimStringCopyHTKeyDestructor, JimCommandsHT_ValDestructor }; #ifdef jim_ext_namespace static Jim_Obj *JimQualifyNameObj(Jim_Interp *interp, Jim_Obj *nsObj) { const char *name = Jim_String(nsObj); if (name[0] == ':' && name[1] == ':') { while (*++name == ':') { } nsObj = Jim_NewStringObj(interp, name, -1); } else if (Jim_Length(interp->framePtr->nsObj)) { nsObj = Jim_DuplicateObj(interp, interp->framePtr->nsObj); Jim_AppendStrings(interp, nsObj, "::", name, NULL); } return nsObj; } Jim_Obj *Jim_MakeGlobalNamespaceName(Jim_Interp *interp, Jim_Obj *nameObjPtr) |
︙ | ︙ | |||
9237 9238 9239 9240 9241 9242 9243 | } static const char *JimQualifyName(Jim_Interp *interp, const char *name, Jim_Obj **objPtrPtr) { Jim_Obj *objPtr = interp->emptyObj; if (name[0] == ':' && name[1] == ':') { | | | | | | | | 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 | } static const char *JimQualifyName(Jim_Interp *interp, const char *name, Jim_Obj **objPtrPtr) { Jim_Obj *objPtr = interp->emptyObj; if (name[0] == ':' && name[1] == ':') { while (*++name == ':') { } } else if (Jim_Length(interp->framePtr->nsObj)) { objPtr = Jim_DuplicateObj(interp, interp->framePtr->nsObj); Jim_AppendStrings(interp, objPtr, "::", name, NULL); name = Jim_String(objPtr); } Jim_IncrRefCount(objPtr); *objPtrPtr = objPtr; return name; } #define JimFreeQualifiedName(INTERP, OBJ) Jim_DecrRefCount((INTERP), (OBJ)) #else #define JimQualifyName(INTERP, NAME, DUMMY) (((NAME)[0] == ':' && (NAME)[1] == ':') ? (NAME) + 2 : (NAME)) #define JimFreeQualifiedName(INTERP, DUMMY) (void)(DUMMY) Jim_Obj *Jim_MakeGlobalNamespaceName(Jim_Interp *interp, Jim_Obj *nameObjPtr) { return nameObjPtr; } #endif static int JimCreateCommand(Jim_Interp *interp, const char *name, Jim_Cmd *cmd) { Jim_HashEntry *he = Jim_FindHashEntry(&interp->commands, name); if (he) { Jim_InterpIncrProcEpoch(interp); } if (he && interp->local) { cmd->prevCmd = Jim_GetHashEntryVal(he); Jim_SetHashVal(&interp->commands, he, cmd); } else { if (he) { Jim_DeleteHashEntry(&interp->commands, name); } Jim_AddHashEntry(&interp->commands, name, cmd); } return JIM_OK; } int Jim_CreateCommand(Jim_Interp *interp, const char *cmdNameStr, Jim_CmdProc *cmdProc, void *privData, Jim_DelCmdProc *delProc) { Jim_Cmd *cmdPtr = Jim_Alloc(sizeof(*cmdPtr)); memset(cmdPtr, 0, sizeof(*cmdPtr)); cmdPtr->inUse = 1; cmdPtr->u.native.delProc = delProc; cmdPtr->u.native.cmdProc = cmdProc; cmdPtr->u.native.privData = privData; JimCreateCommand(interp, cmdNameStr, cmdPtr); |
︙ | ︙ | |||
9324 9325 9326 9327 9328 9329 9330 | Jim_InitHashTable(cmdPtr->u.proc.staticVars, &JimVariablesHashTableType, interp); for (i = 0; i < len; i++) { Jim_Obj *objPtr, *initObjPtr, *nameObjPtr; Jim_Var *varPtr; int subLen; objPtr = Jim_ListGetIndex(interp, staticsListObjPtr, i); | | | 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 | Jim_InitHashTable(cmdPtr->u.proc.staticVars, &JimVariablesHashTableType, interp); for (i = 0; i < len; i++) { Jim_Obj *objPtr, *initObjPtr, *nameObjPtr; Jim_Var *varPtr; int subLen; objPtr = Jim_ListGetIndex(interp, staticsListObjPtr, i); subLen = Jim_ListLength(interp, objPtr); if (subLen == 1 || subLen == 2) { nameObjPtr = Jim_ListGetIndex(interp, objPtr, 0); if (subLen == 1) { initObjPtr = Jim_GetVariable(interp, nameObjPtr, JIM_NONE); if (initObjPtr == NULL) { Jim_SetResultFormatted(interp, |
︙ | ︙ | |||
9370 9371 9372 9373 9374 9375 9376 | return JIM_OK; } static void JimUpdateProcNamespace(Jim_Interp *interp, Jim_Cmd *cmdPtr, const char *cmdname) { #ifdef jim_ext_namespace if (cmdPtr->isproc) { | | | | | | | | | | | 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 | return JIM_OK; } static void JimUpdateProcNamespace(Jim_Interp *interp, Jim_Cmd *cmdPtr, const char *cmdname) { #ifdef jim_ext_namespace if (cmdPtr->isproc) { const char *pt = strrchr(cmdname, ':'); if (pt && pt != cmdname && pt[-1] == ':') { Jim_DecrRefCount(interp, cmdPtr->u.proc.nsObj); cmdPtr->u.proc.nsObj = Jim_NewStringObj(interp, cmdname, pt - cmdname - 1); Jim_IncrRefCount(cmdPtr->u.proc.nsObj); if (Jim_FindHashEntry(&interp->commands, pt + 1)) { Jim_InterpIncrProcEpoch(interp); } } } #endif } static Jim_Cmd *JimCreateProcedureCmd(Jim_Interp *interp, Jim_Obj *argListObjPtr, Jim_Obj *staticsListObjPtr, Jim_Obj *bodyObjPtr, Jim_Obj *nsObj) { Jim_Cmd *cmdPtr; int argListLen; int i; argListLen = Jim_ListLength(interp, argListObjPtr); cmdPtr = Jim_Alloc(sizeof(*cmdPtr) + sizeof(struct Jim_ProcArg) * argListLen); memset(cmdPtr, 0, sizeof(*cmdPtr)); cmdPtr->inUse = 1; cmdPtr->isproc = 1; cmdPtr->u.proc.argListObjPtr = argListObjPtr; cmdPtr->u.proc.argListLen = argListLen; cmdPtr->u.proc.bodyObjPtr = bodyObjPtr; cmdPtr->u.proc.argsPos = -1; cmdPtr->u.proc.arglist = (struct Jim_ProcArg *)(cmdPtr + 1); cmdPtr->u.proc.nsObj = nsObj ? nsObj : interp->emptyObj; Jim_IncrRefCount(argListObjPtr); Jim_IncrRefCount(bodyObjPtr); Jim_IncrRefCount(cmdPtr->u.proc.nsObj); if (staticsListObjPtr && JimCreateProcedureStatics(interp, cmdPtr, staticsListObjPtr) != JIM_OK) { goto err; } for (i = 0; i < argListLen; i++) { Jim_Obj *argPtr; Jim_Obj *nameObjPtr; Jim_Obj *defaultObjPtr; int len; argPtr = Jim_ListGetIndex(interp, argListObjPtr, i); len = Jim_ListLength(interp, argPtr); if (len == 0) { Jim_SetResultString(interp, "argument with no name", -1); err: JimDecrCmdRefCount(interp, cmdPtr); return NULL; } if (len > 2) { Jim_SetResultFormatted(interp, "too many fields in argument specifier \"%#s\"", argPtr); goto err; } if (len == 2) { nameObjPtr = Jim_ListGetIndex(interp, argPtr, 0); defaultObjPtr = Jim_ListGetIndex(interp, argPtr, 1); } else { nameObjPtr = argPtr; defaultObjPtr = NULL; } if (Jim_CompareStringImmediate(interp, nameObjPtr, "args")) { if (cmdPtr->u.proc.argsPos >= 0) { |
︙ | ︙ | |||
9508 9509 9510 9511 9512 9513 9514 | if (newName[0] == 0) { return Jim_DeleteCommand(interp, oldName); } fqold = JimQualifyName(interp, oldName, &qualifiedOldNameObj); fqnew = JimQualifyName(interp, newName, &qualifiedNewNameObj); | | | | | | 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 | if (newName[0] == 0) { return Jim_DeleteCommand(interp, oldName); } fqold = JimQualifyName(interp, oldName, &qualifiedOldNameObj); fqnew = JimQualifyName(interp, newName, &qualifiedNewNameObj); he = Jim_FindHashEntry(&interp->commands, fqold); if (he == NULL) { Jim_SetResultFormatted(interp, "can't rename \"%s\": command doesn't exist", oldName); } else if (Jim_FindHashEntry(&interp->commands, fqnew)) { Jim_SetResultFormatted(interp, "can't rename to \"%s\": command already exists", newName); } else { cmdPtr = Jim_GetHashEntryVal(he); JimIncrCmdRefCount(cmdPtr); JimUpdateProcNamespace(interp, cmdPtr, fqnew); Jim_AddHashEntry(&interp->commands, fqnew, cmdPtr); Jim_DeleteHashEntry(&interp->commands, fqold); Jim_InterpIncrProcEpoch(interp); ret = JIM_OK; } JimFreeQualifiedName(interp, qualifiedOldNameObj); JimFreeQualifiedName(interp, qualifiedNewNameObj); |
︙ | ︙ | |||
9569 9570 9571 9572 9573 9574 9575 | if (objPtr->typePtr != &commandObjType || objPtr->internalRep.cmdValue.procEpoch != interp->procEpoch #ifdef jim_ext_namespace || !Jim_StringEqObj(objPtr->internalRep.cmdValue.nsObj, interp->framePtr->nsObj) #endif ) { | | | | | | | | | | | | | | | | | | | 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 | if (objPtr->typePtr != &commandObjType || objPtr->internalRep.cmdValue.procEpoch != interp->procEpoch #ifdef jim_ext_namespace || !Jim_StringEqObj(objPtr->internalRep.cmdValue.nsObj, interp->framePtr->nsObj) #endif ) { const char *name = Jim_String(objPtr); Jim_HashEntry *he; if (name[0] == ':' && name[1] == ':') { while (*++name == ':') { } } #ifdef jim_ext_namespace else if (Jim_Length(interp->framePtr->nsObj)) { Jim_Obj *nameObj = Jim_DuplicateObj(interp, interp->framePtr->nsObj); Jim_AppendStrings(interp, nameObj, "::", name, NULL); he = Jim_FindHashEntry(&interp->commands, Jim_String(nameObj)); Jim_FreeNewObj(interp, nameObj); if (he) { goto found; } } #endif he = Jim_FindHashEntry(&interp->commands, name); if (he == NULL) { if (flags & JIM_ERRMSG) { Jim_SetResultFormatted(interp, "invalid command name \"%#s\"", objPtr); } return NULL; } #ifdef jim_ext_namespace found: #endif cmd = Jim_GetHashEntryVal(he); Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &commandObjType; objPtr->internalRep.cmdValue.procEpoch = interp->procEpoch; objPtr->internalRep.cmdValue.cmdPtr = cmd; objPtr->internalRep.cmdValue.nsObj = interp->framePtr->nsObj; Jim_IncrRefCount(interp->framePtr->nsObj); } else { cmd = objPtr->internalRep.cmdValue.cmdPtr; } while (cmd->u.proc.upcall) { cmd = cmd->prevCmd; } return cmd; } #define JIM_DICT_SUGAR 100 static int SetVariableFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr); static const Jim_ObjType variableObjType = { "variable", NULL, NULL, NULL, JIM_TYPE_REFERENCES, }; static int JimValidName(Jim_Interp *interp, const char *type, Jim_Obj *nameObjPtr) { if (nameObjPtr->typePtr != &variableObjType) { int len; const char *str = Jim_GetString(nameObjPtr, &len); if (memchr(str, '\0', len)) { Jim_SetResultFormatted(interp, "%s name contains embedded null", type); return JIM_ERR; } } return JIM_OK; } static int SetVariableFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) { const char *varName; Jim_CallFrame *framePtr; Jim_HashEntry *he; int global; int len; if (objPtr->typePtr == &variableObjType) { framePtr = objPtr->internalRep.varValue.global ? interp->topFramePtr : interp->framePtr; if (objPtr->internalRep.varValue.callFrameId == framePtr->id) { return JIM_OK; } } else if (objPtr->typePtr == &dictSubstObjType) { return JIM_DICT_SUGAR; } else if (JimValidName(interp, "variable", objPtr) != JIM_OK) { return JIM_ERR; } varName = Jim_GetString(objPtr, &len); if (len && varName[len - 1] == ')' && strchr(varName, '(') != NULL) { return JIM_DICT_SUGAR; } if (varName[0] == ':' && varName[1] == ':') { while (*++varName == ':') { } global = 1; framePtr = interp->topFramePtr; } else { global = 0; framePtr = interp->framePtr; } he = Jim_FindHashEntry(&framePtr->vars, varName); if (he == NULL) { if (!global && framePtr->staticVars) { he = Jim_FindHashEntry(framePtr->staticVars, varName); } if (he == NULL) { return JIM_ERR; } } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &variableObjType; objPtr->internalRep.varValue.callFrameId = framePtr->id; objPtr->internalRep.varValue.varPtr = Jim_GetHashEntryVal(he); objPtr->internalRep.varValue.global = global; return JIM_OK; } static int JimDictSugarSet(Jim_Interp *interp, Jim_Obj *ObjPtr, Jim_Obj *valObjPtr); static Jim_Obj *JimDictSugarGet(Jim_Interp *interp, Jim_Obj *ObjPtr, int flags); static Jim_Var *JimCreateVariable(Jim_Interp *interp, Jim_Obj *nameObjPtr, Jim_Obj *valObjPtr) { const char *name; Jim_CallFrame *framePtr; int global; Jim_Var *var = Jim_Alloc(sizeof(*var)); var->objPtr = valObjPtr; Jim_IncrRefCount(valObjPtr); var->linkFramePtr = NULL; name = Jim_String(nameObjPtr); if (name[0] == ':' && name[1] == ':') { while (*++name == ':') { } framePtr = interp->topFramePtr; global = 1; } else { framePtr = interp->framePtr; global = 0; } Jim_AddHashEntry(&framePtr->vars, name, var); Jim_FreeIntRep(interp, nameObjPtr); nameObjPtr->typePtr = &variableObjType; nameObjPtr->internalRep.varValue.callFrameId = framePtr->id; nameObjPtr->internalRep.varValue.varPtr = var; nameObjPtr->internalRep.varValue.global = global; return var; |
︙ | ︙ | |||
9780 9781 9782 9783 9784 9785 9786 | case JIM_OK: var = nameObjPtr->internalRep.varValue.varPtr; if (var->linkFramePtr == NULL) { Jim_IncrRefCount(valObjPtr); Jim_DecrRefCount(interp, var->objPtr); var->objPtr = valObjPtr; } | | | 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 | case JIM_OK: var = nameObjPtr->internalRep.varValue.varPtr; if (var->linkFramePtr == NULL) { Jim_IncrRefCount(valObjPtr); Jim_DecrRefCount(interp, var->objPtr); var->objPtr = valObjPtr; } else { Jim_CallFrame *savedCallFrame; savedCallFrame = interp->framePtr; interp->framePtr = var->linkFramePtr; err = Jim_SetVariable(interp, var->objPtr, valObjPtr); interp->framePtr = savedCallFrame; if (err != JIM_OK) |
︙ | ︙ | |||
9820 9821 9822 9823 9824 9825 9826 | result = Jim_SetVariableStr(interp, name, objPtr); interp->framePtr = savedFramePtr; return result; } int Jim_SetVariableStrWithStr(Jim_Interp *interp, const char *name, const char *val) { | | < < | < | | | | | | | 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 | result = Jim_SetVariableStr(interp, name, objPtr); interp->framePtr = savedFramePtr; return result; } int Jim_SetVariableStrWithStr(Jim_Interp *interp, const char *name, const char *val) { Jim_Obj *valObjPtr; int result; valObjPtr = Jim_NewStringObj(interp, val, -1); Jim_IncrRefCount(valObjPtr); result = Jim_SetVariableStr(interp, name, valObjPtr); Jim_DecrRefCount(interp, valObjPtr); return result; } int Jim_SetVariableLink(Jim_Interp *interp, Jim_Obj *nameObjPtr, Jim_Obj *targetNameObjPtr, Jim_CallFrame *targetCallFrame) { const char *varName; const char *targetName; Jim_CallFrame *framePtr; Jim_Var *varPtr; switch (SetVariableFromAny(interp, nameObjPtr)) { case JIM_DICT_SUGAR: Jim_SetResultFormatted(interp, "bad variable name \"%#s\": upvar won't create a scalar variable that looks like an array element", nameObjPtr); return JIM_ERR; case JIM_OK: varPtr = nameObjPtr->internalRep.varValue.varPtr; if (varPtr->linkFramePtr == NULL) { Jim_SetResultFormatted(interp, "variable \"%#s\" already exists", nameObjPtr); return JIM_ERR; } varPtr->linkFramePtr = NULL; break; } varName = Jim_String(nameObjPtr); if (varName[0] == ':' && varName[1] == ':') { while (*++varName == ':') { } framePtr = interp->topFramePtr; } else { framePtr = interp->framePtr; } targetName = Jim_String(targetNameObjPtr); |
︙ | ︙ | |||
9892 9893 9894 9895 9896 9897 9898 | Jim_SetResultFormatted(interp, "bad variable name \"%#s\": upvar won't create namespace variable that refers to procedure variable", nameObjPtr); Jim_DecrRefCount(interp, targetNameObjPtr); return JIM_ERR; } | | | | | | | | | 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 | Jim_SetResultFormatted(interp, "bad variable name \"%#s\": upvar won't create namespace variable that refers to procedure variable", nameObjPtr); Jim_DecrRefCount(interp, targetNameObjPtr); return JIM_ERR; } if (framePtr == targetCallFrame) { Jim_Obj *objPtr = targetNameObjPtr; while (1) { if (strcmp(Jim_String(objPtr), varName) == 0) { Jim_SetResultString(interp, "can't upvar from variable to itself", -1); Jim_DecrRefCount(interp, targetNameObjPtr); return JIM_ERR; } if (SetVariableFromAny(interp, objPtr) != JIM_OK) break; varPtr = objPtr->internalRep.varValue.varPtr; if (varPtr->linkFramePtr != targetCallFrame) break; objPtr = varPtr->objPtr; } } Jim_SetVariable(interp, nameObjPtr, targetNameObjPtr); nameObjPtr->internalRep.varValue.varPtr->linkFramePtr = targetCallFrame; Jim_DecrRefCount(interp, targetNameObjPtr); return JIM_OK; } Jim_Obj *Jim_GetVariable(Jim_Interp *interp, Jim_Obj *nameObjPtr, int flags) { switch (SetVariableFromAny(interp, nameObjPtr)) { case JIM_OK:{ Jim_Var *varPtr = nameObjPtr->internalRep.varValue.varPtr; if (varPtr->linkFramePtr == NULL) { return varPtr->objPtr; } else { Jim_Obj *objPtr; Jim_CallFrame *savedCallFrame = interp->framePtr; interp->framePtr = varPtr->linkFramePtr; objPtr = Jim_GetVariable(interp, varPtr->objPtr, flags); interp->framePtr = savedCallFrame; if (objPtr) { return objPtr; } } } break; case JIM_DICT_SUGAR: return JimDictSugarGet(interp, nameObjPtr, flags); } if (flags & JIM_ERRMSG) { Jim_SetResultFormatted(interp, "can't read \"%#s\": no such variable", nameObjPtr); } return NULL; } |
︙ | ︙ | |||
10001 10002 10003 10004 10005 10006 10007 | { Jim_Var *varPtr; int retval; Jim_CallFrame *framePtr; retval = SetVariableFromAny(interp, nameObjPtr); if (retval == JIM_DICT_SUGAR) { | | | | | 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 | { Jim_Var *varPtr; int retval; Jim_CallFrame *framePtr; retval = SetVariableFromAny(interp, nameObjPtr); if (retval == JIM_DICT_SUGAR) { return JimDictSugarSet(interp, nameObjPtr, NULL); } else if (retval == JIM_OK) { varPtr = nameObjPtr->internalRep.varValue.varPtr; if (varPtr->linkFramePtr) { framePtr = interp->framePtr; interp->framePtr = varPtr->linkFramePtr; retval = Jim_UnsetVariable(interp, varPtr->objPtr, JIM_NONE); interp->framePtr = framePtr; } else { const char *name = Jim_String(nameObjPtr); if (nameObjPtr->internalRep.varValue.global) { name += 2; framePtr = interp->topFramePtr; } else { framePtr = interp->framePtr; } retval = Jim_DeleteHashEntry(&framePtr->vars, name); if (retval == JIM_OK) { framePtr->id = interp->callFrameEpoch++; } } } if (retval != JIM_OK && (flags & JIM_ERRMSG)) { Jim_SetResultFormatted(interp, "can't unset \"%#s\": no such variable", nameObjPtr); } |
︙ | ︙ | |||
10059 10060 10061 10062 10063 10064 10065 | p++; keyLen = (str + len) - p; if (str[len - 1] == ')') { keyLen--; } | | | | | | 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 | p++; keyLen = (str + len) - p; if (str[len - 1] == ')') { keyLen--; } keyObjPtr = Jim_NewStringObj(interp, p, keyLen); Jim_IncrRefCount(varObjPtr); Jim_IncrRefCount(keyObjPtr); *varPtrPtr = varObjPtr; *keyPtrPtr = keyObjPtr; } static int JimDictSugarSet(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *valObjPtr) { int err; SetDictSubstFromAny(interp, objPtr); err = Jim_SetDictKeysVector(interp, objPtr->internalRep.dictSubstValue.varNameObjPtr, &objPtr->internalRep.dictSubstValue.indexObjPtr, 1, valObjPtr, JIM_MUSTEXIST); if (err == JIM_OK) { Jim_SetEmptyResult(interp); } else { if (!valObjPtr) { if (Jim_GetVariable(interp, objPtr->internalRep.dictSubstValue.varNameObjPtr, JIM_NONE)) { Jim_SetResultFormatted(interp, "can't unset \"%#s\": no such element in array", objPtr); return err; } } Jim_SetResultFormatted(interp, "can't %s \"%#s\": variable isn't array", (valObjPtr ? "set" : "unset"), objPtr); } return err; } static Jim_Obj *JimDictExpandArrayVariable(Jim_Interp *interp, Jim_Obj *varObjPtr, |
︙ | ︙ | |||
10116 10117 10118 10119 10120 10121 10122 | ret = Jim_DictKey(interp, dictObjPtr, keyObjPtr, &resObjPtr, JIM_NONE); if (ret != JIM_OK) { Jim_SetResultFormatted(interp, "can't read \"%#s(%#s)\": %s array", varObjPtr, keyObjPtr, ret < 0 ? "variable isn't" : "no such element in"); } else if ((flags & JIM_UNSHARED) && Jim_IsShared(dictObjPtr)) { | | | 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 | ret = Jim_DictKey(interp, dictObjPtr, keyObjPtr, &resObjPtr, JIM_NONE); if (ret != JIM_OK) { Jim_SetResultFormatted(interp, "can't read \"%#s(%#s)\": %s array", varObjPtr, keyObjPtr, ret < 0 ? "variable isn't" : "no such element in"); } else if ((flags & JIM_UNSHARED) && Jim_IsShared(dictObjPtr)) { Jim_SetVariable(interp, varObjPtr, Jim_DuplicateObj(interp, dictObjPtr)); } return resObjPtr; } |
︙ | ︙ | |||
10141 10142 10143 10144 10145 10146 10147 | void FreeDictSubstInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_DecrRefCount(interp, objPtr->internalRep.dictSubstValue.varNameObjPtr); Jim_DecrRefCount(interp, objPtr->internalRep.dictSubstValue.indexObjPtr); } | | < | > | | < | | 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 | void FreeDictSubstInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_DecrRefCount(interp, objPtr->internalRep.dictSubstValue.varNameObjPtr); Jim_DecrRefCount(interp, objPtr->internalRep.dictSubstValue.indexObjPtr); } static void DupDictSubstInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { dupPtr->internalRep = srcPtr->internalRep; Jim_IncrRefCount(dupPtr->internalRep.dictSubstValue.varNameObjPtr); Jim_IncrRefCount(dupPtr->internalRep.dictSubstValue.indexObjPtr); } static void SetDictSubstFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { if (objPtr->typePtr != &dictSubstObjType) { Jim_Obj *varObjPtr, *keyObjPtr; if (objPtr->typePtr == &interpolatedObjType) { varObjPtr = objPtr->internalRep.dictSubstValue.varNameObjPtr; keyObjPtr = objPtr->internalRep.dictSubstValue.indexObjPtr; Jim_IncrRefCount(varObjPtr); Jim_IncrRefCount(keyObjPtr); } |
︙ | ︙ | |||
10200 10201 10202 10203 10204 10205 10206 | Jim_DecrRefCount(interp, substKeyObjPtr); return resObjPtr; } static Jim_Obj *JimExpandExprSugar(Jim_Interp *interp, Jim_Obj *objPtr) { | < < | | < < | 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 | Jim_DecrRefCount(interp, substKeyObjPtr); return resObjPtr; } static Jim_Obj *JimExpandExprSugar(Jim_Interp *interp, Jim_Obj *objPtr) { if (Jim_EvalExpression(interp, objPtr) == JIM_OK) { return Jim_GetResult(interp); } return NULL; } static Jim_CallFrame *JimCreateCallFrame(Jim_Interp *interp, Jim_CallFrame *parent, Jim_Obj *nsObj) { |
︙ | ︙ | |||
10247 10248 10249 10250 10251 10252 10253 | Jim_IncrRefCount(nsObj); return cf; } static int JimDeleteLocalProcs(Jim_Interp *interp, Jim_Stack *localCommands) { | | | | < > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 | Jim_IncrRefCount(nsObj); return cf; } static int JimDeleteLocalProcs(Jim_Interp *interp, Jim_Stack *localCommands) { if (localCommands) { Jim_Obj *cmdNameObj; while ((cmdNameObj = Jim_StackPop(localCommands)) != NULL) { Jim_HashEntry *he; Jim_Obj *fqObjName; Jim_HashTable *ht = &interp->commands; const char *fqname = JimQualifyName(interp, Jim_String(cmdNameObj), &fqObjName); he = Jim_FindHashEntry(ht, fqname); if (he) { Jim_Cmd *cmd = Jim_GetHashEntryVal(he); if (cmd->prevCmd) { Jim_Cmd *prevCmd = cmd->prevCmd; cmd->prevCmd = NULL; JimDecrCmdRefCount(interp, cmd); Jim_SetHashVal(ht, he, prevCmd); } else { Jim_DeleteHashEntry(ht, fqname); } Jim_InterpIncrProcEpoch(interp); } Jim_DecrRefCount(interp, cmdNameObj); JimFreeQualifiedName(interp, fqObjName); } Jim_FreeStack(localCommands); Jim_Free(localCommands); } return JIM_OK; } static int JimInvokeDefer(Jim_Interp *interp, int retcode) { Jim_Obj *objPtr; if (Jim_FindHashEntry(&interp->framePtr->vars, "jim::defer") == NULL) { return retcode; } objPtr = Jim_GetVariableStr(interp, "jim::defer", JIM_NONE); if (objPtr) { int ret = JIM_OK; int i; int listLen = Jim_ListLength(interp, objPtr); Jim_Obj *resultObjPtr; Jim_IncrRefCount(objPtr); resultObjPtr = Jim_GetResult(interp); Jim_IncrRefCount(resultObjPtr); Jim_SetEmptyResult(interp); for (i = listLen; i > 0; i--) { Jim_Obj *scriptObjPtr = Jim_ListGetIndex(interp, objPtr, i - 1); ret = Jim_EvalObj(interp, scriptObjPtr); if (ret != JIM_OK) { break; } } if (ret == JIM_OK || retcode == JIM_ERR) { Jim_SetResult(interp, resultObjPtr); } else { retcode = ret; } Jim_DecrRefCount(interp, resultObjPtr); Jim_DecrRefCount(interp, objPtr); } return retcode; } #define JIM_FCF_FULL 0 #define JIM_FCF_REUSE 1 static void JimFreeCallFrame(Jim_Interp *interp, Jim_CallFrame *cf, int action) { JimDeleteLocalProcs(interp, cf->localCommands); if (cf->procArgsObjPtr) Jim_DecrRefCount(interp, cf->procArgsObjPtr); if (cf->procBodyObjPtr) |
︙ | ︙ | |||
10325 10326 10327 10328 10329 10330 10331 | cf->vars.used = 0; } cf->next = interp->freeFramesList; interp->freeFramesList = cf; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 | cf->vars.used = 0; } cf->next = interp->freeFramesList; interp->freeFramesList = cf; } int Jim_IsBigEndian(void) { union { unsigned short s; unsigned char c[2]; } uval = {0x0102}; |
︙ | ︙ | |||
10628 10629 10630 10631 10632 10633 10634 | Jim_IncrRefCount(i->unknown); Jim_IncrRefCount(i->currentScriptObj); Jim_IncrRefCount(i->nullScriptObj); Jim_IncrRefCount(i->errorProc); Jim_IncrRefCount(i->trueObj); Jim_IncrRefCount(i->falseObj); | | | 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 | Jim_IncrRefCount(i->unknown); Jim_IncrRefCount(i->currentScriptObj); Jim_IncrRefCount(i->nullScriptObj); Jim_IncrRefCount(i->errorProc); Jim_IncrRefCount(i->trueObj); Jim_IncrRefCount(i->falseObj); Jim_SetVariableStrWithStr(i, JIM_LIBPATH, TCL_LIBRARY); Jim_SetVariableStrWithStr(i, JIM_INTERACTIVE, "0"); Jim_SetVariableStrWithStr(i, "tcl_platform(engine)", "Jim"); Jim_SetVariableStrWithStr(i, "tcl_platform(os)", TCL_PLATFORM_OS); Jim_SetVariableStrWithStr(i, "tcl_platform(platform)", TCL_PLATFORM_PLATFORM); Jim_SetVariableStrWithStr(i, "tcl_platform(pathSeparator)", TCL_PLATFORM_PATH_SEPARATOR); |
︙ | ︙ | |||
10650 10651 10652 10653 10654 10655 10656 | void Jim_FreeInterp(Jim_Interp *i) { Jim_CallFrame *cf, *cfx; Jim_Obj *objPtr, *nextObjPtr; | | > > | 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 | void Jim_FreeInterp(Jim_Interp *i) { Jim_CallFrame *cf, *cfx; Jim_Obj *objPtr, *nextObjPtr; for (cf = i->framePtr; cf; cf = cfx) { JimInvokeDefer(i, JIM_OK); cfx = cf->parent; JimFreeCallFrame(i, cf, JIM_FCF_FULL); } Jim_DecrRefCount(i, i->emptyObj); Jim_DecrRefCount(i, i->trueObj); Jim_DecrRefCount(i, i->falseObj); |
︙ | ︙ | |||
10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 | if (i->liveList != NULL) { objPtr = i->liveList; printf("\n-------------------------------------\n"); printf("Objects still in the free list:\n"); while (objPtr) { const char *type = objPtr->typePtr ? objPtr->typePtr->name : "string"; if (objPtr->bytes && strlen(objPtr->bytes) > 20) { printf("%p (%d) %-10s: '%.20s...'\n", (void *)objPtr, objPtr->refCount, type, objPtr->bytes); } else { printf("%p (%d) %-10s: '%s'\n", | > | 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 | if (i->liveList != NULL) { objPtr = i->liveList; printf("\n-------------------------------------\n"); printf("Objects still in the free list:\n"); while (objPtr) { const char *type = objPtr->typePtr ? objPtr->typePtr->name : "string"; Jim_String(objPtr); if (objPtr->bytes && strlen(objPtr->bytes) > 20) { printf("%p (%d) %-10s: '%.20s...'\n", (void *)objPtr, objPtr->refCount, type, objPtr->bytes); } else { printf("%p (%d) %-10s: '%s'\n", |
︙ | ︙ | |||
10703 10704 10705 10706 10707 10708 10709 | objPtr = objPtr->nextObjPtr; } printf("-------------------------------------\n\n"); JimPanic((1, "Live list non empty freeing the interpreter! Leak?")); } #endif | | | | | 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 | objPtr = objPtr->nextObjPtr; } printf("-------------------------------------\n\n"); JimPanic((1, "Live list non empty freeing the interpreter! Leak?")); } #endif objPtr = i->freeList; while (objPtr) { nextObjPtr = objPtr->nextObjPtr; Jim_Free(objPtr); objPtr = nextObjPtr; } for (cf = i->freeFramesList; cf; cf = cfx) { cfx = cf->next; if (cf->vars.table) Jim_FreeHashTable(&cf->vars); Jim_Free(cf); } Jim_Free(i); } Jim_CallFrame *Jim_GetCallFrameByLevel(Jim_Interp *interp, Jim_Obj *levelObjPtr) { long level; const char *str; |
︙ | ︙ | |||
10744 10745 10746 10747 10748 10749 10750 | } } else { if (Jim_GetLong(interp, levelObjPtr, &level) != JIM_OK || level < 0) { level = -1; } else { | | | | | | | 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 | } } else { if (Jim_GetLong(interp, levelObjPtr, &level) != JIM_OK || level < 0) { level = -1; } else { level = interp->framePtr->level - level; } } } else { str = "1"; level = interp->framePtr->level - 1; } if (level == 0) { return interp->topFramePtr; } if (level > 0) { for (framePtr = interp->framePtr; framePtr; framePtr = framePtr->parent) { if (framePtr->level == level) { return framePtr; } } } Jim_SetResultFormatted(interp, "bad level \"%s\"", str); return NULL; } static Jim_CallFrame *JimGetCallFrameByInteger(Jim_Interp *interp, Jim_Obj *levelObjPtr) { long level; Jim_CallFrame *framePtr; if (Jim_GetLong(interp, levelObjPtr, &level) == JIM_OK) { if (level <= 0) { level = interp->framePtr->level + level; } if (level == 0) { return interp->topFramePtr; } for (framePtr = interp->framePtr; framePtr; framePtr = framePtr->parent) { if (framePtr->level == level) { return framePtr; } } } |
︙ | ︙ | |||
10808 10809 10810 10811 10812 10813 10814 | Jim_IncrRefCount(interp->stackTrace); } static void JimSetStackTrace(Jim_Interp *interp, Jim_Obj *stackTraceObj) { int len; | | | | | | | | 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 | Jim_IncrRefCount(interp->stackTrace); } static void JimSetStackTrace(Jim_Interp *interp, Jim_Obj *stackTraceObj) { int len; Jim_IncrRefCount(stackTraceObj); Jim_DecrRefCount(interp, interp->stackTrace); interp->stackTrace = stackTraceObj; interp->errorFlag = 1; len = Jim_ListLength(interp, interp->stackTrace); if (len >= 3) { if (Jim_Length(Jim_ListGetIndex(interp, interp->stackTrace, len - 2)) == 0) { interp->addStackTrace = 1; } } } static void JimAppendStackTrace(Jim_Interp *interp, const char *procname, Jim_Obj *fileNameObj, int linenr) { if (strcmp(procname, "unknown") == 0) { procname = ""; } if (!*procname && !Jim_Length(fileNameObj)) { return; } if (Jim_IsShared(interp->stackTrace)) { Jim_DecrRefCount(interp, interp->stackTrace); interp->stackTrace = Jim_DuplicateObj(interp, interp->stackTrace); Jim_IncrRefCount(interp->stackTrace); } if (!*procname && Jim_Length(fileNameObj)) { int len = Jim_ListLength(interp, interp->stackTrace); if (len >= 3) { Jim_Obj *objPtr = Jim_ListGetIndex(interp, interp->stackTrace, len - 3); if (Jim_Length(objPtr)) { objPtr = Jim_ListGetIndex(interp, interp->stackTrace, len - 2); if (Jim_Length(objPtr) == 0) { ListSetIndex(interp, interp->stackTrace, len - 2, fileNameObj, 0); ListSetIndex(interp, interp->stackTrace, len - 1, Jim_NewIntObj(interp, linenr), 0); return; } } } } |
︙ | ︙ | |||
10956 10957 10958 10959 10960 10961 10962 | static int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags) { jim_wide wideValue; const char *str; if (objPtr->typePtr == &coercedDoubleObjType) { | | | | | | 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 | static int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags) { jim_wide wideValue; const char *str; if (objPtr->typePtr == &coercedDoubleObjType) { objPtr->typePtr = &intObjType; return JIM_OK; } str = Jim_String(objPtr); if (Jim_StringToWide(str, &wideValue, 0) != JIM_OK) { if (flags & JIM_ERRMSG) { Jim_SetResultFormatted(interp, "expected integer but got \"%#s\"", objPtr); } return JIM_ERR; } if ((wideValue == JIM_WIDE_MIN || wideValue == JIM_WIDE_MAX) && errno == ERANGE) { Jim_SetResultString(interp, "Integer value too big to be represented", -1); return JIM_ERR; } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &intObjType; objPtr->internalRep.wideValue = wideValue; return JIM_OK; } #ifdef JIM_OPTIMIZATION |
︙ | ︙ | |||
11073 11074 11075 11076 11077 11078 11079 | return; } { char buf[JIM_DOUBLE_SPACE + 1]; int i; int len = sprintf(buf, "%.12g", value); | | | | 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 | return; } { char buf[JIM_DOUBLE_SPACE + 1]; int i; int len = sprintf(buf, "%.12g", value); for (i = 0; i < len; i++) { if (buf[i] == '.' || buf[i] == 'e') { #if defined(JIM_SPRINTF_DOUBLE_NEEDS_FIX) char *e = strchr(buf, 'e'); if (e && (e[1] == '-' || e[1] == '+') && e[2] == '0') { e += 2; memmove(e, e + 1, len - (e - buf)); } #endif break; } } |
︙ | ︙ | |||
11102 11103 11104 11105 11106 11107 11108 | static int SetDoubleFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { double doubleValue; jim_wide wideValue; const char *str; | < < | | < > > | | | | 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 | static int SetDoubleFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { double doubleValue; jim_wide wideValue; const char *str; #ifdef HAVE_LONG_LONG #define MIN_INT_IN_DOUBLE -(1LL << 53) #define MAX_INT_IN_DOUBLE -(MIN_INT_IN_DOUBLE + 1) if (objPtr->typePtr == &intObjType && JimWideValue(objPtr) >= MIN_INT_IN_DOUBLE && JimWideValue(objPtr) <= MAX_INT_IN_DOUBLE) { objPtr->typePtr = &coercedDoubleObjType; return JIM_OK; } #endif str = Jim_String(objPtr); if (Jim_StringToWide(str, &wideValue, 10) == JIM_OK) { Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &coercedDoubleObjType; objPtr->internalRep.wideValue = wideValue; return JIM_OK; } else { if (Jim_StringToDouble(str, &doubleValue) != JIM_OK) { Jim_SetResultFormatted(interp, "expected floating-point number but got \"%#s\"", objPtr); return JIM_ERR; } Jim_FreeIntRep(interp, objPtr); } objPtr->typePtr = &doubleObjType; objPtr->internalRep.doubleValue = doubleValue; return JIM_OK; } |
︙ | ︙ | |||
11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 | objPtr = Jim_NewObj(interp); objPtr->typePtr = &doubleObjType; objPtr->bytes = NULL; objPtr->internalRep.doubleValue = doubleValue; return objPtr; } static void ListInsertElements(Jim_Obj *listPtr, int idx, int elemc, Jim_Obj *const *elemVec); static void ListAppendElement(Jim_Obj *listPtr, Jim_Obj *objPtr); static void FreeListInternalRep(Jim_Interp *interp, Jim_Obj *objPtr); static void DupListInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); static void UpdateStringOfList(struct Jim_Obj *objPtr); static int SetListFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 | objPtr = Jim_NewObj(interp); objPtr->typePtr = &doubleObjType; objPtr->bytes = NULL; objPtr->internalRep.doubleValue = doubleValue; return objPtr; } static int SetBooleanFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags); int Jim_GetBoolean(Jim_Interp *interp, Jim_Obj *objPtr, int * booleanPtr) { if (objPtr->typePtr != &intObjType && SetBooleanFromAny(interp, objPtr, JIM_ERRMSG) == JIM_ERR) return JIM_ERR; *booleanPtr = (int) JimWideValue(objPtr); return JIM_OK; } static int SetBooleanFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags) { static const char * const falses[] = { "0", "false", "no", "off", NULL }; static const char * const trues[] = { "1", "true", "yes", "on", NULL }; int boolean; int index; if (Jim_GetEnum(interp, objPtr, falses, &index, NULL, 0) == JIM_OK) { boolean = 0; } else if (Jim_GetEnum(interp, objPtr, trues, &index, NULL, 0) == JIM_OK) { boolean = 1; } else { if (flags & JIM_ERRMSG) { Jim_SetResultFormatted(interp, "expected boolean but got \"%#s\"", objPtr); } return JIM_ERR; } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &intObjType; objPtr->internalRep.wideValue = boolean; return JIM_OK; } static void ListInsertElements(Jim_Obj *listPtr, int idx, int elemc, Jim_Obj *const *elemVec); static void ListAppendElement(Jim_Obj *listPtr, Jim_Obj *objPtr); static void FreeListInternalRep(Jim_Interp *interp, Jim_Obj *objPtr); static void DupListInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); static void UpdateStringOfList(struct Jim_Obj *objPtr); static int SetListFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr); |
︙ | ︙ | |||
11219 11220 11221 11222 11223 11224 11225 | #define JIM_ELESTR_SIMPLE 0 #define JIM_ELESTR_BRACE 1 #define JIM_ELESTR_QUOTE 2 static unsigned char ListElementQuotingType(const char *s, int len) { int i, level, blevel, trySimple = 1; | | | 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 | #define JIM_ELESTR_SIMPLE 0 #define JIM_ELESTR_BRACE 1 #define JIM_ELESTR_QUOTE 2 static unsigned char ListElementQuotingType(const char *s, int len) { int i, level, blevel, trySimple = 1; if (len == 0) return JIM_ELESTR_BRACE; if (s[0] == '"' || s[0] == '{') { trySimple = 0; goto testbrace; } for (i = 0; i < len; i++) { |
︙ | ︙ | |||
11241 11242 11243 11244 11245 11246 11247 | case '\\': case '\r': case '\n': case '\t': case '\f': case '\v': trySimple = 0; | | | | 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 | case '\\': case '\r': case '\n': case '\t': case '\f': case '\v': trySimple = 0; case '{': case '}': goto testbrace; } } return JIM_ELESTR_SIMPLE; testbrace: if (s[len - 1] == '\\') return JIM_ELESTR_QUOTE; level = 0; blevel = 0; for (i = 0; i < len; i++) { switch (s[i]) { case '{': |
︙ | ︙ | |||
11370 11371 11372 11373 11374 11375 11376 | { #define STATIC_QUOTING_LEN 32 int i, bufLen, realLength; const char *strRep; char *p; unsigned char *quotingType, staticQuoting[STATIC_QUOTING_LEN]; | | | | | | | 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 | { #define STATIC_QUOTING_LEN 32 int i, bufLen, realLength; const char *strRep; char *p; unsigned char *quotingType, staticQuoting[STATIC_QUOTING_LEN]; if (objc > STATIC_QUOTING_LEN) { quotingType = Jim_Alloc(objc); } else { quotingType = staticQuoting; } bufLen = 0; for (i = 0; i < objc; i++) { int len; strRep = Jim_GetString(objv[i], &len); quotingType[i] = ListElementQuotingType(strRep, len); switch (quotingType[i]) { case JIM_ELESTR_SIMPLE: if (i != 0 || strRep[0] != '#') { bufLen += len; break; } quotingType[i] = JIM_ELESTR_BRACE; case JIM_ELESTR_BRACE: bufLen += len + 2; break; case JIM_ELESTR_QUOTE: bufLen += len * 2; break; } bufLen++; } bufLen++; p = objPtr->bytes = Jim_Alloc(bufLen + 1); realLength = 0; for (i = 0; i < objc; i++) { int len, qlen; strRep = Jim_GetString(objv[i], &len); |
︙ | ︙ | |||
11434 11435 11436 11437 11438 11439 11440 | realLength++; } qlen = BackslashQuoteString(strRep, len, p); p += qlen; realLength += qlen; break; } | | | | 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 | realLength++; } qlen = BackslashQuoteString(strRep, len, p); p += qlen; realLength += qlen; break; } if (i + 1 != objc) { *p++ = ' '; realLength++; } } *p = '\0'; objPtr->length = realLength; if (quotingType != staticQuoting) { Jim_Free(quotingType); } } |
︙ | ︙ | |||
11475 11476 11477 11478 11479 11480 11481 | int i; listObjPtrPtr = JimDictPairs(objPtr, &len); for (i = 0; i < len; i++) { Jim_IncrRefCount(listObjPtrPtr[i]); } | | | | | | 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 | int i; listObjPtrPtr = JimDictPairs(objPtr, &len); for (i = 0; i < len; i++) { Jim_IncrRefCount(listObjPtrPtr[i]); } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &listObjType; objPtr->internalRep.listValue.len = len; objPtr->internalRep.listValue.maxLen = len; objPtr->internalRep.listValue.ele = listObjPtrPtr; return JIM_OK; } if (objPtr->typePtr == &sourceObjType) { fileNameObj = objPtr->internalRep.sourceValue.fileNameObj; linenr = objPtr->internalRep.sourceValue.lineNumber; } else { fileNameObj = interp->emptyObj; linenr = 1; } Jim_IncrRefCount(fileNameObj); str = Jim_GetString(objPtr, &strLen); Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &listObjType; objPtr->internalRep.listValue.len = 0; objPtr->internalRep.listValue.maxLen = 0; objPtr->internalRep.listValue.ele = NULL; if (strLen) { JimParserInit(&parser, str, strLen, linenr); while (!parser.eof) { Jim_Obj *elementPtr; JimParseList(&parser); if (parser.tt != JIM_TT_STR && parser.tt != JIM_TT_ESC) |
︙ | ︙ | |||
11639 11640 11641 11642 11643 11644 11645 | static int ListSortCommand(Jim_Obj **lhsObj, Jim_Obj **rhsObj) { Jim_Obj *compare_script; int rc; jim_wide ret = 0; | | | 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 | static int ListSortCommand(Jim_Obj **lhsObj, Jim_Obj **rhsObj) { Jim_Obj *compare_script; int rc; jim_wide ret = 0; compare_script = Jim_DuplicateObj(sort_info->interp, sort_info->command); Jim_ListAppendElement(sort_info->interp, compare_script, *lhsObj); Jim_ListAppendElement(sort_info->interp, compare_script, *rhsObj); rc = Jim_EvalObj(sort_info->interp, compare_script); if (rc != JIM_OK || Jim_GetWide(sort_info->interp, Jim_GetResult(sort_info->interp), &ret) != JIM_OK) { |
︙ | ︙ | |||
11661 11662 11663 11664 11665 11666 11667 | { int src; int dst = 0; Jim_Obj **ele = listObjPtr->internalRep.listValue.ele; for (src = 1; src < listObjPtr->internalRep.listValue.len; src++) { if (comp(&ele[dst], &ele[src]) == 0) { | | | | > > > | | | > | | 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 | { int src; int dst = 0; Jim_Obj **ele = listObjPtr->internalRep.listValue.ele; for (src = 1; src < listObjPtr->internalRep.listValue.len; src++) { if (comp(&ele[dst], &ele[src]) == 0) { Jim_DecrRefCount(sort_info->interp, ele[dst]); } else { dst++; } ele[dst] = ele[src]; } dst++; if (dst < listObjPtr->internalRep.listValue.len) { ele[dst] = ele[src]; } listObjPtr->internalRep.listValue.len = dst; } static int ListSortElements(Jim_Interp *interp, Jim_Obj *listObjPtr, struct lsort_info *info) { struct lsort_info *prev_info; typedef int (qsort_comparator) (const void *, const void *); int (*fn) (Jim_Obj **, Jim_Obj **); Jim_Obj **vector; int len; int rc; JimPanic((Jim_IsShared(listObjPtr), "ListSortElements called with shared object")); SetListFromAny(interp, listObjPtr); prev_info = sort_info; sort_info = info; vector = listObjPtr->internalRep.listValue.ele; len = listObjPtr->internalRep.listValue.len; switch (info->type) { case JIM_LSORT_ASCII: |
︙ | ︙ | |||
11714 11715 11716 11717 11718 11719 11720 | case JIM_LSORT_REAL: fn = ListSortReal; break; case JIM_LSORT_COMMAND: fn = ListSortCommand; break; default: | | | | | 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 | case JIM_LSORT_REAL: fn = ListSortReal; break; case JIM_LSORT_COMMAND: fn = ListSortCommand; break; default: fn = NULL; JimPanic((1, "ListSort called with invalid sort type")); return -1; } if (info->indexed) { info->subfn = fn; fn = ListSortIndexHelper; } if ((rc = setjmp(info->jmpbuf)) == 0) { qsort(vector, len, sizeof(Jim_Obj *), (qsort_comparator *) fn); |
︙ | ︙ | |||
11748 11749 11750 11751 11752 11753 11754 | int currentLen = listPtr->internalRep.listValue.len; int requiredLen = currentLen + elemc; int i; Jim_Obj **point; if (requiredLen > listPtr->internalRep.listValue.maxLen) { if (requiredLen < 2) { | | | 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 | int currentLen = listPtr->internalRep.listValue.len; int requiredLen = currentLen + elemc; int i; Jim_Obj **point; if (requiredLen > listPtr->internalRep.listValue.maxLen) { if (requiredLen < 2) { requiredLen = 4; } else { requiredLen *= 2; } listPtr->internalRep.listValue.ele = Jim_Realloc(listPtr->internalRep.listValue.ele, |
︙ | ︙ | |||
11934 11935 11936 11937 11938 11939 11940 | Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0); for (i = 0; i < objc; i++) ListAppendList(objPtr, objv[i]); return objPtr; } else { | | | | | | | | 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 | Jim_Obj *objPtr = Jim_NewListObj(interp, NULL, 0); for (i = 0; i < objc; i++) ListAppendList(objPtr, objv[i]); return objPtr; } else { int len = 0, objLen; char *bytes, *p; for (i = 0; i < objc; i++) { len += Jim_Length(objv[i]); } if (objc) len += objc - 1; p = bytes = Jim_Alloc(len + 1); for (i = 0; i < objc; i++) { const char *s = Jim_GetString(objv[i], &objLen); while (objLen && isspace(UCHAR(*s))) { s++; objLen--; len--; } while (objLen && isspace(UCHAR(s[objLen - 1]))) { if (objLen > 1 && s[objLen - 2] == '\\') { break; } objLen--; len--; } memcpy(p, s, objLen); |
︙ | ︙ | |||
11988 11989 11990 11991 11992 11993 11994 | { int first, last; int len, rangeLen; if (Jim_GetIndex(interp, firstObjPtr, &first) != JIM_OK || Jim_GetIndex(interp, lastObjPtr, &last) != JIM_OK) return NULL; | | | 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 | { int first, last; int len, rangeLen; if (Jim_GetIndex(interp, firstObjPtr, &first) != JIM_OK || Jim_GetIndex(interp, lastObjPtr, &last) != JIM_OK) return NULL; len = Jim_ListLength(interp, listObjPtr); first = JimRelToAbsIndex(len, first); last = JimRelToAbsIndex(len, last); JimRelToAbsRange(len, &first, &last, &rangeLen); if (first == 0 && last == len) { return listObjPtr; } return Jim_NewListObj(interp, listObjPtr->internalRep.listValue.ele + first, rangeLen); |
︙ | ︙ | |||
12028 12029 12030 12031 12032 12033 12034 | static void JimObjectHTKeyValDestructor(void *interp, void *val) { Jim_DecrRefCount(interp, (Jim_Obj *)val); } static const Jim_HashTableType JimDictHashTableType = { | | | | | | | | 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 | static void JimObjectHTKeyValDestructor(void *interp, void *val) { Jim_DecrRefCount(interp, (Jim_Obj *)val); } static const Jim_HashTableType JimDictHashTableType = { JimObjectHTHashFunction, JimObjectHTKeyValDup, JimObjectHTKeyValDup, JimObjectHTKeyCompare, JimObjectHTKeyValDestructor, JimObjectHTKeyValDestructor }; static const Jim_ObjType dictObjType = { "dict", FreeDictInternalRep, DupDictInternalRep, UpdateStringOfDict, |
︙ | ︙ | |||
12058 12059 12060 12061 12062 12063 12064 | void DupDictInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { Jim_HashTable *ht, *dupHt; Jim_HashTableIterator htiter; Jim_HashEntry *he; | | | | | | | | | 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 | void DupDictInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { Jim_HashTable *ht, *dupHt; Jim_HashTableIterator htiter; Jim_HashEntry *he; ht = srcPtr->internalRep.ptr; dupHt = Jim_Alloc(sizeof(*dupHt)); Jim_InitHashTable(dupHt, &JimDictHashTableType, interp); if (ht->size != 0) Jim_ExpandHashTable(dupHt, ht->size); JimInitHashTableIterator(ht, &htiter); while ((he = Jim_NextHashEntry(&htiter)) != NULL) { Jim_AddHashEntry(dupHt, he->key, he->u.val); } dupPtr->internalRep.ptr = dupHt; dupPtr->typePtr = &dictObjType; } static Jim_Obj **JimDictPairs(Jim_Obj *dictPtr, int *len) { Jim_HashTable *ht; Jim_HashTableIterator htiter; Jim_HashEntry *he; Jim_Obj **objv; int i; ht = dictPtr->internalRep.ptr; objv = Jim_Alloc((ht->used * 2) * sizeof(Jim_Obj *)); JimInitHashTableIterator(ht, &htiter); i = 0; while ((he = Jim_NextHashEntry(&htiter)) != NULL) { objv[i++] = Jim_GetHashEntryKey(he); objv[i++] = Jim_GetHashEntryVal(he); } *len = i; return objv; } static void UpdateStringOfDict(struct Jim_Obj *objPtr) { int len; Jim_Obj **objv = JimDictPairs(objPtr, &len); JimMakeListStringRep(objPtr, objv, len); Jim_Free(objv); } static int SetDictFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) { int listlen; if (objPtr->typePtr == &dictObjType) { return JIM_OK; } if (Jim_IsList(objPtr) && Jim_IsShared(objPtr)) { Jim_String(objPtr); } listlen = Jim_ListLength(interp, objPtr); if (listlen % 2) { Jim_SetResultString(interp, "missing value to go with key", -1); return JIM_ERR; } else { Jim_HashTable *ht; int i; ht = Jim_Alloc(sizeof(*ht)); Jim_InitHashTable(ht, &JimDictHashTableType, interp); for (i = 0; i < listlen; i += 2) { |
︙ | ︙ | |||
12156 12157 12158 12159 12160 12161 12162 | static int DictAddElement(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *keyObjPtr, Jim_Obj *valueObjPtr) { Jim_HashTable *ht = objPtr->internalRep.ptr; | | | 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 | static int DictAddElement(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *keyObjPtr, Jim_Obj *valueObjPtr) { Jim_HashTable *ht = objPtr->internalRep.ptr; if (valueObjPtr == NULL) { return Jim_DeleteHashEntry(ht, keyObjPtr); } Jim_ReplaceHashEntry(ht, keyObjPtr, valueObjPtr); return JIM_OK; } int Jim_DictAddElement(Jim_Interp *interp, Jim_Obj *objPtr, |
︙ | ︙ | |||
12207 12208 12209 12210 12211 12212 12213 | ht = dictPtr->internalRep.ptr; if ((he = Jim_FindHashEntry(ht, keyPtr)) == NULL) { if (flags & JIM_ERRMSG) { Jim_SetResultFormatted(interp, "key \"%#s\" not known in dictionary", keyPtr); } return JIM_ERR; } | > | | > | 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 | ht = dictPtr->internalRep.ptr; if ((he = Jim_FindHashEntry(ht, keyPtr)) == NULL) { if (flags & JIM_ERRMSG) { Jim_SetResultFormatted(interp, "key \"%#s\" not known in dictionary", keyPtr); } return JIM_ERR; } else { *objPtrPtr = Jim_GetHashEntryVal(he); return JIM_OK; } } int Jim_DictPairs(Jim_Interp *interp, Jim_Obj *dictPtr, Jim_Obj ***objPtrPtr, int *len) { if (SetDictFromAny(interp, dictPtr) != JIM_OK) { return JIM_ERR; |
︙ | ︙ | |||
12256 12257 12258 12259 12260 12261 12262 | { Jim_Obj *varObjPtr, *objPtr, *dictObjPtr; int shared, i; varObjPtr = objPtr = Jim_GetVariable(interp, varNamePtr, flags); if (objPtr == NULL) { if (newObjPtr == NULL && (flags & JIM_MUSTEXIST)) { | | | | | | | 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 | { Jim_Obj *varObjPtr, *objPtr, *dictObjPtr; int shared, i; varObjPtr = objPtr = Jim_GetVariable(interp, varNamePtr, flags); if (objPtr == NULL) { if (newObjPtr == NULL && (flags & JIM_MUSTEXIST)) { return JIM_ERR; } varObjPtr = objPtr = Jim_NewDictObj(interp, NULL, 0); if (Jim_SetVariable(interp, varNamePtr, objPtr) != JIM_OK) { Jim_FreeNewObj(interp, varObjPtr); return JIM_ERR; } } if ((shared = Jim_IsShared(objPtr))) varObjPtr = objPtr = Jim_DuplicateObj(interp, objPtr); for (i = 0; i < keyc; i++) { dictObjPtr = objPtr; if (SetDictFromAny(interp, dictObjPtr) != JIM_OK) { goto err; } if (i == keyc - 1) { if (Jim_DictAddElement(interp, objPtr, keyv[keyc - 1], newObjPtr) != JIM_OK) { if (newObjPtr || (flags & JIM_MUSTEXIST)) { goto err; } } break; } Jim_InvalidateStringRep(dictObjPtr); if (Jim_DictKey(interp, dictObjPtr, keyv[i], &objPtr, newObjPtr ? JIM_NONE : JIM_ERRMSG) == JIM_OK) { if (Jim_IsShared(objPtr)) { objPtr = Jim_DuplicateObj(interp, objPtr); DictAddElement(interp, dictObjPtr, keyv[i], objPtr); } } else { if (newObjPtr == NULL) { goto err; } objPtr = Jim_NewDictObj(interp, NULL, 0); DictAddElement(interp, dictObjPtr, keyv[i], objPtr); } } Jim_InvalidateStringRep(objPtr); Jim_InvalidateStringRep(varObjPtr); if (Jim_SetVariable(interp, varNamePtr, varObjPtr) != JIM_OK) { goto err; } Jim_SetResult(interp, varObjPtr); return JIM_OK; |
︙ | ︙ | |||
12339 12340 12341 12342 12343 12344 12345 | } else { char buf[JIM_INTEGER_SPACE + 1]; if (objPtr->internalRep.intValue >= 0) { sprintf(buf, "%d", objPtr->internalRep.intValue); } else { | | | | | | | | | | 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 | } else { char buf[JIM_INTEGER_SPACE + 1]; if (objPtr->internalRep.intValue >= 0) { sprintf(buf, "%d", objPtr->internalRep.intValue); } else { sprintf(buf, "end%d", objPtr->internalRep.intValue + 1); } JimSetStringBytes(objPtr, buf); } } static int SetIndexFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { int idx, end = 0; const char *str; char *endptr; str = Jim_String(objPtr); if (strncmp(str, "end", 3) == 0) { end = 1; str += 3; idx = 0; } else { idx = jim_strtol(str, &endptr); if (endptr == str) { goto badindex; } str = endptr; } if (*str == '+' || *str == '-') { int sign = (*str == '+' ? 1 : -1); idx += sign * jim_strtol(++str, &endptr); if (str == endptr || *endptr) { goto badindex; } str = endptr; } while (isspace(UCHAR(*str))) { str++; } if (*str) { goto badindex; } if (end) { if (idx > 0) { idx = INT_MAX; } else { idx--; } } else if (idx < 0) { idx = -INT_MAX; } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &indexObjType; objPtr->internalRep.intValue = idx; return JIM_OK; badindex: Jim_SetResultFormatted(interp, "bad index \"%#s\": must be integer?[+-]integer? or end?[+-]integer?", objPtr); return JIM_ERR; } int Jim_GetIndex(Jim_Interp *interp, Jim_Obj *objPtr, int *indexPtr) { if (objPtr->typePtr == &intObjType) { jim_wide val = JimWideValue(objPtr); if (val < 0) *indexPtr = -INT_MAX; else if (val > INT_MAX) *indexPtr = INT_MAX; |
︙ | ︙ | |||
12446 12447 12448 12449 12450 12451 12452 | "continue", "signal", "exit", "eval", NULL }; | | | 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 | "continue", "signal", "exit", "eval", NULL }; #define jimReturnCodesSize (sizeof(jimReturnCodes)/sizeof(*jimReturnCodes) - 1) static const Jim_ObjType returnCodeObjType = { "return-code", NULL, NULL, NULL, JIM_TYPE_NONE, |
︙ | ︙ | |||
12471 12472 12473 12474 12475 12476 12477 | } static int SetReturnCodeFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { int returnCode; jim_wide wideValue; | | | | < | | > | | < < | < < < < | < < < < < | < < < < | < < < | | | | | < | | > > > | > > | | < | | | | | < < < < | | | < < < | | < > > > > > | | 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 | } static int SetReturnCodeFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { int returnCode; jim_wide wideValue; if (JimGetWideNoErr(interp, objPtr, &wideValue) != JIM_ERR) returnCode = (int)wideValue; else if (Jim_GetEnum(interp, objPtr, jimReturnCodes, &returnCode, NULL, JIM_NONE) != JIM_OK) { Jim_SetResultFormatted(interp, "expected return code but got \"%#s\"", objPtr); return JIM_ERR; } Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &returnCodeObjType; objPtr->internalRep.intValue = returnCode; return JIM_OK; } int Jim_GetReturnCode(Jim_Interp *interp, Jim_Obj *objPtr, int *intPtr) { if (objPtr->typePtr != &returnCodeObjType && SetReturnCodeFromAny(interp, objPtr) == JIM_ERR) return JIM_ERR; *intPtr = objPtr->internalRep.intValue; return JIM_OK; } static int JimParseExprOperator(struct JimParserCtx *pc); static int JimParseExprNumber(struct JimParserCtx *pc); static int JimParseExprIrrational(struct JimParserCtx *pc); static int JimParseExprBoolean(struct JimParserCtx *pc); enum { JIM_EXPROP_MUL = JIM_TT_EXPR_OP, JIM_EXPROP_DIV, JIM_EXPROP_MOD, JIM_EXPROP_SUB, JIM_EXPROP_ADD, JIM_EXPROP_LSHIFT, JIM_EXPROP_RSHIFT, JIM_EXPROP_ROTL, JIM_EXPROP_ROTR, JIM_EXPROP_LT, JIM_EXPROP_GT, JIM_EXPROP_LTE, JIM_EXPROP_GTE, JIM_EXPROP_NUMEQ, JIM_EXPROP_NUMNE, JIM_EXPROP_BITAND, JIM_EXPROP_BITXOR, JIM_EXPROP_BITOR, JIM_EXPROP_LOGICAND, JIM_EXPROP_LOGICOR, JIM_EXPROP_TERNARY, JIM_EXPROP_COLON, JIM_EXPROP_POW, JIM_EXPROP_STREQ, JIM_EXPROP_STRNE, JIM_EXPROP_STRIN, JIM_EXPROP_STRNI, JIM_EXPROP_NOT, JIM_EXPROP_BITNOT, JIM_EXPROP_UNARYMINUS, JIM_EXPROP_UNARYPLUS, JIM_EXPROP_FUNC_INT, JIM_EXPROP_FUNC_WIDE, JIM_EXPROP_FUNC_ABS, JIM_EXPROP_FUNC_DOUBLE, JIM_EXPROP_FUNC_ROUND, JIM_EXPROP_FUNC_RAND, JIM_EXPROP_FUNC_SRAND, JIM_EXPROP_FUNC_SIN, JIM_EXPROP_FUNC_COS, JIM_EXPROP_FUNC_TAN, JIM_EXPROP_FUNC_ASIN, JIM_EXPROP_FUNC_ACOS, JIM_EXPROP_FUNC_ATAN, JIM_EXPROP_FUNC_ATAN2, JIM_EXPROP_FUNC_SINH, JIM_EXPROP_FUNC_COSH, JIM_EXPROP_FUNC_TANH, JIM_EXPROP_FUNC_CEIL, JIM_EXPROP_FUNC_FLOOR, JIM_EXPROP_FUNC_EXP, JIM_EXPROP_FUNC_LOG, JIM_EXPROP_FUNC_LOG10, JIM_EXPROP_FUNC_SQRT, JIM_EXPROP_FUNC_POW, JIM_EXPROP_FUNC_HYPOT, JIM_EXPROP_FUNC_FMOD, }; struct JimExprNode { int type; struct Jim_Obj *objPtr; struct JimExprNode *left; struct JimExprNode *right; struct JimExprNode *ternary; }; typedef struct Jim_ExprOperator { const char *name; int (*funcop) (Jim_Interp *interp, struct JimExprNode *opnode); unsigned char precedence; unsigned char arity; unsigned char attr; unsigned char namelen; } Jim_ExprOperator; static int JimExprGetTerm(Jim_Interp *interp, struct JimExprNode *node, Jim_Obj **objPtrPtr); static int JimExprGetTermBoolean(Jim_Interp *interp, struct JimExprNode *node); static int JimExprEvalTermNode(Jim_Interp *interp, struct JimExprNode *node); static int JimExprOpNumUnary(Jim_Interp *interp, struct JimExprNode *node) { int intresult = 1; int rc; double dA, dC = 0; jim_wide wA, wC = 0; Jim_Obj *A; if ((rc = JimExprGetTerm(interp, node->left, &A)) != JIM_OK) { return rc; } if ((A->typePtr != &doubleObjType || A->bytes) && JimGetWideNoErr(interp, A, &wA) == JIM_OK) { switch (node->type) { case JIM_EXPROP_FUNC_INT: case JIM_EXPROP_FUNC_WIDE: case JIM_EXPROP_FUNC_ROUND: case JIM_EXPROP_UNARYPLUS: wC = wA; break; case JIM_EXPROP_FUNC_DOUBLE: |
︙ | ︙ | |||
12651 12652 12653 12654 12655 12656 12657 | wC = !wA; break; default: abort(); } } else if ((rc = Jim_GetDouble(interp, A, &dA)) == JIM_OK) { | | > > > > | | | > | > | > > | > | | | | | | | | > | | > > > | | 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 | wC = !wA; break; default: abort(); } } else if ((rc = Jim_GetDouble(interp, A, &dA)) == JIM_OK) { switch (node->type) { case JIM_EXPROP_FUNC_INT: case JIM_EXPROP_FUNC_WIDE: wC = dA; break; case JIM_EXPROP_FUNC_ROUND: wC = dA < 0 ? (dA - 0.5) : (dA + 0.5); break; case JIM_EXPROP_FUNC_DOUBLE: case JIM_EXPROP_UNARYPLUS: dC = dA; intresult = 0; break; case JIM_EXPROP_FUNC_ABS: #ifdef JIM_MATH_FUNCTIONS dC = fabs(dA); #else dC = dA >= 0 ? dA : -dA; #endif intresult = 0; break; case JIM_EXPROP_UNARYMINUS: dC = -dA; intresult = 0; break; case JIM_EXPROP_NOT: wC = !dA; break; default: abort(); } } if (rc == JIM_OK) { if (intresult) { Jim_SetResultInt(interp, wC); } else { Jim_SetResult(interp, Jim_NewDoubleObj(interp, dC)); } } Jim_DecrRefCount(interp, A); return rc; } static double JimRandDouble(Jim_Interp *interp) { unsigned long x; JimRandomBytes(interp, &x, sizeof(x)); return (double)x / (unsigned long)~0; } static int JimExprOpIntUnary(Jim_Interp *interp, struct JimExprNode *node) { jim_wide wA; Jim_Obj *A; int rc; if ((rc = JimExprGetTerm(interp, node->left, &A)) != JIM_OK) { return rc; } rc = Jim_GetWide(interp, A, &wA); if (rc == JIM_OK) { switch (node->type) { case JIM_EXPROP_BITNOT: Jim_SetResultInt(interp, ~wA); break; case JIM_EXPROP_FUNC_SRAND: JimPrngSeed(interp, (unsigned char *)&wA, sizeof(wA)); Jim_SetResult(interp, Jim_NewDoubleObj(interp, JimRandDouble(interp))); break; default: abort(); } } Jim_DecrRefCount(interp, A); return rc; } static int JimExprOpNone(Jim_Interp *interp, struct JimExprNode *node) { JimPanic((node->type != JIM_EXPROP_FUNC_RAND, "JimExprOpNone only support rand()")); Jim_SetResult(interp, Jim_NewDoubleObj(interp, JimRandDouble(interp))); return JIM_OK; } #ifdef JIM_MATH_FUNCTIONS static int JimExprOpDoubleUnary(Jim_Interp *interp, struct JimExprNode *node) { int rc; double dA, dC; Jim_Obj *A; if ((rc = JimExprGetTerm(interp, node->left, &A)) != JIM_OK) { return rc; } rc = Jim_GetDouble(interp, A, &dA); if (rc == JIM_OK) { switch (node->type) { case JIM_EXPROP_FUNC_SIN: dC = sin(dA); break; case JIM_EXPROP_FUNC_COS: dC = cos(dA); break; case JIM_EXPROP_FUNC_TAN: |
︙ | ︙ | |||
12794 12795 12796 12797 12798 12799 12800 | break; case JIM_EXPROP_FUNC_SQRT: dC = sqrt(dA); break; default: abort(); } | | | > > | | > > > > > > > | | | | 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 | break; case JIM_EXPROP_FUNC_SQRT: dC = sqrt(dA); break; default: abort(); } Jim_SetResult(interp, Jim_NewDoubleObj(interp, dC)); } Jim_DecrRefCount(interp, A); return rc; } #endif static int JimExprOpIntBin(Jim_Interp *interp, struct JimExprNode *node) { jim_wide wA, wB; int rc; Jim_Obj *A, *B; if ((rc = JimExprGetTerm(interp, node->left, &A)) != JIM_OK) { return rc; } if ((rc = JimExprGetTerm(interp, node->right, &B)) != JIM_OK) { Jim_DecrRefCount(interp, A); return rc; } rc = JIM_ERR; if (Jim_GetWide(interp, A, &wA) == JIM_OK && Jim_GetWide(interp, B, &wB) == JIM_OK) { jim_wide wC; rc = JIM_OK; switch (node->type) { case JIM_EXPROP_LSHIFT: wC = wA << wB; break; case JIM_EXPROP_RSHIFT: wC = wA >> wB; break; case JIM_EXPROP_BITAND: |
︙ | ︙ | |||
12857 12858 12859 12860 12861 12862 12863 | if (negative) { wC = -wC; } } break; case JIM_EXPROP_ROTL: case JIM_EXPROP_ROTR:{ | | | | | < | < > > > > > | < > > | | > > > > > | | | | > > < | | | | | < | < | < | > | < > | > > > > > > > > > > > > > > > < | | | | | < | < | < | < | < | < < < | | | | | | | | < | < < | < < < < < < < | < > > > > > > > > | | > > | > > | > | > | > | | | | > > > > > | | | < < | < < < < < | < < | < < < < < < < < < < < | < < | | < < < | < | < | < | < | < | < | | < | < < | | < < < < < < < < | < < | < < | | | > | | | < < < < | | < < < < < < < < < < < < < < < | < < < < < | < | | < | < < < | | | | < | < | < < < < | | < < | < | < | | | | 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 | if (negative) { wC = -wC; } } break; case JIM_EXPROP_ROTL: case JIM_EXPROP_ROTR:{ unsigned long uA = (unsigned long)wA; unsigned long uB = (unsigned long)wB; const unsigned int S = sizeof(unsigned long) * 8; uB %= S; if (node->type == JIM_EXPROP_ROTR) { uB = S - uB; } wC = (unsigned long)(uA << uB) | (uA >> (S - uB)); break; } default: abort(); } Jim_SetResultInt(interp, wC); } Jim_DecrRefCount(interp, A); Jim_DecrRefCount(interp, B); return rc; } static int JimExprOpBin(Jim_Interp *interp, struct JimExprNode *node) { int rc = JIM_OK; double dA, dB, dC = 0; jim_wide wA, wB, wC = 0; Jim_Obj *A, *B; if ((rc = JimExprGetTerm(interp, node->left, &A)) != JIM_OK) { return rc; } if ((rc = JimExprGetTerm(interp, node->right, &B)) != JIM_OK) { Jim_DecrRefCount(interp, A); return rc; } if ((A->typePtr != &doubleObjType || A->bytes) && (B->typePtr != &doubleObjType || B->bytes) && JimGetWideNoErr(interp, A, &wA) == JIM_OK && JimGetWideNoErr(interp, B, &wB) == JIM_OK) { switch (node->type) { case JIM_EXPROP_POW: case JIM_EXPROP_FUNC_POW: if (wA == 0 && wB < 0) { Jim_SetResultString(interp, "exponentiation of zero by negative power", -1); rc = JIM_ERR; goto done; } wC = JimPowWide(wA, wB); goto intresult; case JIM_EXPROP_ADD: wC = wA + wB; goto intresult; case JIM_EXPROP_SUB: wC = wA - wB; goto intresult; case JIM_EXPROP_MUL: wC = wA * wB; goto intresult; case JIM_EXPROP_DIV: if (wB == 0) { Jim_SetResultString(interp, "Division by zero", -1); rc = JIM_ERR; goto done; } else { if (wB < 0) { wB = -wB; wA = -wA; } wC = wA / wB; if (wA % wB < 0) { wC--; } goto intresult; } case JIM_EXPROP_LT: wC = wA < wB; goto intresult; case JIM_EXPROP_GT: wC = wA > wB; goto intresult; case JIM_EXPROP_LTE: wC = wA <= wB; goto intresult; case JIM_EXPROP_GTE: wC = wA >= wB; goto intresult; case JIM_EXPROP_NUMEQ: wC = wA == wB; goto intresult; case JIM_EXPROP_NUMNE: wC = wA != wB; goto intresult; } } if (Jim_GetDouble(interp, A, &dA) == JIM_OK && Jim_GetDouble(interp, B, &dB) == JIM_OK) { switch (node->type) { #ifndef JIM_MATH_FUNCTIONS case JIM_EXPROP_POW: case JIM_EXPROP_FUNC_POW: case JIM_EXPROP_FUNC_ATAN2: case JIM_EXPROP_FUNC_HYPOT: case JIM_EXPROP_FUNC_FMOD: Jim_SetResultString(interp, "unsupported", -1); rc = JIM_ERR; goto done; #else case JIM_EXPROP_POW: case JIM_EXPROP_FUNC_POW: dC = pow(dA, dB); goto doubleresult; case JIM_EXPROP_FUNC_ATAN2: dC = atan2(dA, dB); goto doubleresult; case JIM_EXPROP_FUNC_HYPOT: dC = hypot(dA, dB); goto doubleresult; case JIM_EXPROP_FUNC_FMOD: dC = fmod(dA, dB); goto doubleresult; #endif case JIM_EXPROP_ADD: dC = dA + dB; goto doubleresult; case JIM_EXPROP_SUB: dC = dA - dB; goto doubleresult; case JIM_EXPROP_MUL: dC = dA * dB; goto doubleresult; case JIM_EXPROP_DIV: if (dB == 0) { #ifdef INFINITY dC = dA < 0 ? -INFINITY : INFINITY; #else dC = (dA < 0 ? -1.0 : 1.0) * strtod("Inf", NULL); #endif } else { dC = dA / dB; } goto doubleresult; case JIM_EXPROP_LT: wC = dA < dB; goto intresult; case JIM_EXPROP_GT: wC = dA > dB; goto intresult; case JIM_EXPROP_LTE: wC = dA <= dB; goto intresult; case JIM_EXPROP_GTE: wC = dA >= dB; goto intresult; case JIM_EXPROP_NUMEQ: wC = dA == dB; goto intresult; case JIM_EXPROP_NUMNE: wC = dA != dB; goto intresult; } } else { int i = Jim_StringCompareObj(interp, A, B, 0); switch (node->type) { case JIM_EXPROP_LT: wC = i < 0; goto intresult; case JIM_EXPROP_GT: wC = i > 0; goto intresult; case JIM_EXPROP_LTE: wC = i <= 0; goto intresult; case JIM_EXPROP_GTE: wC = i >= 0; goto intresult; case JIM_EXPROP_NUMEQ: wC = i == 0; goto intresult; case JIM_EXPROP_NUMNE: wC = i != 0; goto intresult; } } rc = JIM_ERR; done: Jim_DecrRefCount(interp, A); Jim_DecrRefCount(interp, B); return rc; intresult: Jim_SetResultInt(interp, wC); goto done; doubleresult: Jim_SetResult(interp, Jim_NewDoubleObj(interp, dC)); goto done; } static int JimSearchList(Jim_Interp *interp, Jim_Obj *listObjPtr, Jim_Obj *valObj) { int listlen; int i; listlen = Jim_ListLength(interp, listObjPtr); for (i = 0; i < listlen; i++) { if (Jim_StringEqObj(Jim_ListGetIndex(interp, listObjPtr, i), valObj)) { return 1; } } return 0; } static int JimExprOpStrBin(Jim_Interp *interp, struct JimExprNode *node) { Jim_Obj *A, *B; jim_wide wC; int rc; if ((rc = JimExprGetTerm(interp, node->left, &A)) != JIM_OK) { return rc; } if ((rc = JimExprGetTerm(interp, node->right, &B)) != JIM_OK) { Jim_DecrRefCount(interp, A); return rc; } switch (node->type) { case JIM_EXPROP_STREQ: case JIM_EXPROP_STRNE: wC = Jim_StringEqObj(A, B); if (node->type == JIM_EXPROP_STRNE) { wC = !wC; } break; case JIM_EXPROP_STRIN: wC = JimSearchList(interp, B, A); break; case JIM_EXPROP_STRNI: wC = !JimSearchList(interp, B, A); break; default: abort(); } Jim_SetResultInt(interp, wC); Jim_DecrRefCount(interp, A); Jim_DecrRefCount(interp, B); return rc; } static int ExprBool(Jim_Interp *interp, Jim_Obj *obj) { long l; double d; int b; int ret = -1; Jim_IncrRefCount(obj); if (Jim_GetLong(interp, obj, &l) == JIM_OK) { ret = (l != 0); } else if (Jim_GetDouble(interp, obj, &d) == JIM_OK) { ret = (d != 0); } else if (Jim_GetBoolean(interp, obj, &b) == JIM_OK) { ret = (b != 0); } Jim_DecrRefCount(interp, obj); return ret; } static int JimExprOpAnd(Jim_Interp *interp, struct JimExprNode *node) { int result = JimExprGetTermBoolean(interp, node->left); if (result == 1) { result = JimExprGetTermBoolean(interp, node->right); } if (result == -1) { return JIM_ERR; } Jim_SetResultInt(interp, result); return JIM_OK; } static int JimExprOpOr(Jim_Interp *interp, struct JimExprNode *node) { int result = JimExprGetTermBoolean(interp, node->left); if (result == 0) { result = JimExprGetTermBoolean(interp, node->right); } if (result == -1) { return JIM_ERR; } Jim_SetResultInt(interp, result); return JIM_OK; } static int JimExprOpTernary(Jim_Interp *interp, struct JimExprNode *node) { int result = JimExprGetTermBoolean(interp, node->left); if (result == 1) { return JimExprEvalTermNode(interp, node->right); } else if (result == 0) { return JimExprEvalTermNode(interp, node->ternary); } return JIM_ERR; } enum { OP_FUNC = 0x0001, OP_RIGHT_ASSOC = 0x0002, }; #define OPRINIT_ATTR(N, P, ARITY, F, ATTR) {N, F, P, ARITY, ATTR, sizeof(N) - 1} #define OPRINIT(N, P, ARITY, F) OPRINIT_ATTR(N, P, ARITY, F, 0) static const struct Jim_ExprOperator Jim_ExprOperators[] = { OPRINIT("*", 110, 2, JimExprOpBin), OPRINIT("/", 110, 2, JimExprOpBin), OPRINIT("%", 110, 2, JimExprOpIntBin), OPRINIT("-", 100, 2, JimExprOpBin), |
︙ | ︙ | |||
13294 13295 13296 13297 13298 13299 13300 | OPRINIT("==", 70, 2, JimExprOpBin), OPRINIT("!=", 70, 2, JimExprOpBin), OPRINIT("&", 50, 2, JimExprOpIntBin), OPRINIT("^", 49, 2, JimExprOpIntBin), OPRINIT("|", 48, 2, JimExprOpIntBin), | < | < < < | < | | < < < < < | | | | | | | | | | | | | | | | | | > | | | | | | | | | | > > | | | | 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 | OPRINIT("==", 70, 2, JimExprOpBin), OPRINIT("!=", 70, 2, JimExprOpBin), OPRINIT("&", 50, 2, JimExprOpIntBin), OPRINIT("^", 49, 2, JimExprOpIntBin), OPRINIT("|", 48, 2, JimExprOpIntBin), OPRINIT("&&", 10, 2, JimExprOpAnd), OPRINIT("||", 9, 2, JimExprOpOr), OPRINIT_ATTR("?", 5, 3, JimExprOpTernary, OP_RIGHT_ASSOC), OPRINIT_ATTR(":", 5, 3, NULL, OP_RIGHT_ASSOC), OPRINIT_ATTR("**", 120, 2, JimExprOpBin, OP_RIGHT_ASSOC), OPRINIT("eq", 60, 2, JimExprOpStrBin), OPRINIT("ne", 60, 2, JimExprOpStrBin), OPRINIT("in", 55, 2, JimExprOpStrBin), OPRINIT("ni", 55, 2, JimExprOpStrBin), OPRINIT_ATTR("!", 150, 1, JimExprOpNumUnary, OP_RIGHT_ASSOC), OPRINIT_ATTR("~", 150, 1, JimExprOpIntUnary, OP_RIGHT_ASSOC), OPRINIT_ATTR(" -", 150, 1, JimExprOpNumUnary, OP_RIGHT_ASSOC), OPRINIT_ATTR(" +", 150, 1, JimExprOpNumUnary, OP_RIGHT_ASSOC), OPRINIT_ATTR("int", 200, 1, JimExprOpNumUnary, OP_FUNC), OPRINIT_ATTR("wide", 200, 1, JimExprOpNumUnary, OP_FUNC), OPRINIT_ATTR("abs", 200, 1, JimExprOpNumUnary, OP_FUNC), OPRINIT_ATTR("double", 200, 1, JimExprOpNumUnary, OP_FUNC), OPRINIT_ATTR("round", 200, 1, JimExprOpNumUnary, OP_FUNC), OPRINIT_ATTR("rand", 200, 0, JimExprOpNone, OP_FUNC), OPRINIT_ATTR("srand", 200, 1, JimExprOpIntUnary, OP_FUNC), #ifdef JIM_MATH_FUNCTIONS OPRINIT_ATTR("sin", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("cos", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("tan", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("asin", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("acos", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("atan", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("atan2", 200, 2, JimExprOpBin, OP_FUNC), OPRINIT_ATTR("sinh", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("cosh", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("tanh", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("ceil", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("floor", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("exp", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("log", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("log10", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("sqrt", 200, 1, JimExprOpDoubleUnary, OP_FUNC), OPRINIT_ATTR("pow", 200, 2, JimExprOpBin, OP_FUNC), OPRINIT_ATTR("hypot", 200, 2, JimExprOpBin, OP_FUNC), OPRINIT_ATTR("fmod", 200, 2, JimExprOpBin, OP_FUNC), #endif }; #undef OPRINIT #undef OPRINIT_ATTR #define JIM_EXPR_OPERATORS_NUM \ (sizeof(Jim_ExprOperators)/sizeof(struct Jim_ExprOperator)) static int JimParseExpression(struct JimParserCtx *pc) { while (isspace(UCHAR(*pc->p)) || (*(pc->p) == '\\' && *(pc->p + 1) == '\n')) { if (*pc->p == '\n') { pc->linenr++; } pc->p++; pc->len--; } pc->tline = pc->linenr; pc->tstart = pc->p; if (pc->len == 0) { pc->tend = pc->p; pc->tt = JIM_TT_EOL; pc->eof = 1; |
︙ | ︙ | |||
13399 13400 13401 13402 13403 13404 13405 | break; case '[': return JimParseCmd(pc); case '$': if (JimParseVar(pc) == JIM_ERR) return JimParseExprOperator(pc); else { | | | 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 | break; case '[': return JimParseCmd(pc); case '$': if (JimParseVar(pc) == JIM_ERR) return JimParseExprOperator(pc); else { if (pc->tt == JIM_TT_EXPRSUGAR) { return JIM_ERR; } return JIM_OK; } break; case '0': |
︙ | ︙ | |||
13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 | return JimParseBrace(pc); case 'N': case 'I': case 'n': case 'i': if (JimParseExprIrrational(pc) == JIM_ERR) return JimParseExprOperator(pc); break; default: return JimParseExprOperator(pc); break; } return JIM_OK; } static int JimParseExprNumber(struct JimParserCtx *pc) { char *end; | > > > > > > > > | | | | | 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 | return JimParseBrace(pc); case 'N': case 'I': case 'n': case 'i': if (JimParseExprIrrational(pc) == JIM_ERR) if (JimParseExprBoolean(pc) == JIM_ERR) return JimParseExprOperator(pc); break; case 't': case 'f': case 'o': case 'y': if (JimParseExprBoolean(pc) == JIM_ERR) return JimParseExprOperator(pc); break; default: return JimParseExprOperator(pc); break; } return JIM_OK; } static int JimParseExprNumber(struct JimParserCtx *pc) { char *end; pc->tt = JIM_TT_EXPR_INT; jim_strtoull(pc->p, (char **)&pc->p); if (strchr("eENnIi.", *pc->p) || pc->p == pc->tstart) { if (strtod(pc->tstart, &end)) { } if (end == pc->tstart) return JIM_ERR; if (end > pc->p) { pc->tt = JIM_TT_EXPR_DOUBLE; pc->p = end; } } pc->tend = pc->p - 1; pc->len -= (pc->p - pc->tstart); return JIM_OK; |
︙ | ︙ | |||
13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 | pc->tend = pc->p - 1; pc->tt = JIM_TT_EXPR_DOUBLE; return JIM_OK; } } return JIM_ERR; } static int JimParseExprOperator(struct JimParserCtx *pc) { int i; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < | | | | | | | | | < < < < < < < < < | > > > > > > | 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 | pc->tend = pc->p - 1; pc->tt = JIM_TT_EXPR_DOUBLE; return JIM_OK; } } return JIM_ERR; } static int JimParseExprBoolean(struct JimParserCtx *pc) { const char *booleans[] = { "false", "no", "off", "true", "yes", "on", NULL }; const int lengths[] = { 5, 2, 3, 4, 3, 2, 0 }; int i; for (i = 0; booleans[i]; i++) { const char *boolean = booleans[i]; int length = lengths[i]; if (strncmp(boolean, pc->p, length) == 0) { pc->p += length; pc->len -= length; pc->tend = pc->p - 1; pc->tt = JIM_TT_EXPR_BOOLEAN; return JIM_OK; } } return JIM_ERR; } static const struct Jim_ExprOperator *JimExprOperatorInfoByOpcode(int opcode) { static Jim_ExprOperator dummy_op; if (opcode < JIM_TT_EXPR_OP) { return &dummy_op; } return &Jim_ExprOperators[opcode - JIM_TT_EXPR_OP]; } static int JimParseExprOperator(struct JimParserCtx *pc) { int i; const struct Jim_ExprOperator *bestOp = NULL; int bestLen = 0; for (i = 0; i < (signed)JIM_EXPR_OPERATORS_NUM; i++) { const struct Jim_ExprOperator *op = &Jim_ExprOperators[i]; if (op->name[0] != pc->p[0]) { continue; } if (op->namelen > bestLen && strncmp(op->name, pc->p, op->namelen) == 0) { bestOp = op; bestLen = op->namelen; } } if (bestOp == NULL) { return JIM_ERR; } if (bestOp->attr & OP_FUNC) { const char *p = pc->p + bestLen; int len = pc->len - bestLen; while (len && isspace(UCHAR(*p))) { len--; p++; } if (*p != '(') { return JIM_ERR; } } pc->tend = pc->p + bestLen - 1; pc->p += bestLen; pc->len -= bestLen; pc->tt = (bestOp - Jim_ExprOperators) + JIM_TT_EXPR_OP; return JIM_OK; } const char *jim_tt_name(int type) { static const char * const tt_names[JIM_TT_EXPR_OP] = { "NIL", "STR", "ESC", "VAR", "ARY", "CMD", "SEP", "EOL", "EOF", "LIN", "WRD", "(((", ")))", ",,,", "INT", "DBL", "BOO", "$()" }; if (type < JIM_TT_EXPR_OP) { return tt_names[type]; } else if (type == JIM_EXPROP_UNARYMINUS) { return "-VE"; } else if (type == JIM_EXPROP_UNARYPLUS) { return "+VE"; } else { const struct Jim_ExprOperator *op = JimExprOperatorInfoByOpcode(type); static char buf[20]; if (op->name) { return op->name; |
︙ | ︙ | |||
13566 13567 13568 13569 13570 13571 13572 | FreeExprInternalRep, DupExprInternalRep, NULL, JIM_TYPE_REFERENCES, }; | | | > | | | | < | > | | > | > > > > > | | | | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < | > > > > | > > > > | > > > > > > > > > | > > > > > > > > > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | < < < < < < < < < < < < < < < < < | | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < | 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 | FreeExprInternalRep, DupExprInternalRep, NULL, JIM_TYPE_REFERENCES, }; struct ExprTree { struct JimExprNode *expr; struct JimExprNode *nodes; int len; int inUse; }; static void ExprTreeFreeNodes(Jim_Interp *interp, struct JimExprNode *nodes, int num) { int i; for (i = 0; i < num; i++) { if (nodes[i].objPtr) { Jim_DecrRefCount(interp, nodes[i].objPtr); } } Jim_Free(nodes); } static void ExprTreeFree(Jim_Interp *interp, struct ExprTree *expr) { ExprTreeFreeNodes(interp, expr->nodes, expr->len); Jim_Free(expr); } static void FreeExprInternalRep(Jim_Interp *interp, Jim_Obj *objPtr) { struct ExprTree *expr = (void *)objPtr->internalRep.ptr; if (expr) { if (--expr->inUse != 0) { return; } ExprTreeFree(interp, expr); } } static void DupExprInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { JIM_NOTUSED(interp); JIM_NOTUSED(srcPtr); dupPtr->typePtr = NULL; } struct ExprBuilder { int parencount; int level; ParseToken *token; ParseToken *first_token; Jim_Stack stack; Jim_Obj *exprObjPtr; Jim_Obj *fileNameObj; struct JimExprNode *nodes; struct JimExprNode *next; }; #ifdef DEBUG_SHOW_EXPR static void JimShowExprNode(struct JimExprNode *node, int level) { int i; for (i = 0; i < level; i++) { printf(" "); } if (TOKEN_IS_EXPR_OP(node->type)) { printf("%s\n", jim_tt_name(node->type)); if (node->left) { JimShowExprNode(node->left, level + 1); } if (node->right) { JimShowExprNode(node->right, level + 1); } if (node->ternary) { JimShowExprNode(node->ternary, level + 1); } } else { printf("[%s] %s\n", jim_tt_name(node->type), Jim_String(node->objPtr)); } } #endif #define EXPR_UNTIL_CLOSE 0x0001 #define EXPR_FUNC_ARGS 0x0002 #define EXPR_TERNARY 0x0004 static int ExprTreeBuildTree(Jim_Interp *interp, struct ExprBuilder *builder, int precedence, int flags, int exp_numterms) { int rc; struct JimExprNode *node; int exp_stacklen = builder->stack.len + exp_numterms; if (builder->level++ > 200) { Jim_SetResultString(interp, "Expression too complex", -1); return JIM_ERR; } while (builder->token->type != JIM_TT_EOL) { ParseToken *t = builder->token++; int prevtt; if (t == builder->first_token) { prevtt = JIM_TT_NONE; } else { prevtt = t[-1].type; } if (t->type == JIM_TT_SUBEXPR_START) { if (builder->stack.len == exp_stacklen) { Jim_SetResultFormatted(interp, "unexpected open parenthesis in expression: \"%#s\"", builder->exprObjPtr); return JIM_ERR; } builder->parencount++; rc = ExprTreeBuildTree(interp, builder, 0, EXPR_UNTIL_CLOSE, 1); if (rc != JIM_OK) { return rc; } } else if (t->type == JIM_TT_SUBEXPR_END) { if (!(flags & EXPR_UNTIL_CLOSE)) { if (builder->stack.len == exp_stacklen && builder->level > 1) { builder->token--; builder->level--; return JIM_OK; } Jim_SetResultFormatted(interp, "unexpected closing parenthesis in expression: \"%#s\"", builder->exprObjPtr); return JIM_ERR; } builder->parencount--; if (builder->stack.len == exp_stacklen) { break; } } else if (t->type == JIM_TT_SUBEXPR_COMMA) { if (!(flags & EXPR_FUNC_ARGS)) { if (builder->stack.len == exp_stacklen) { builder->token--; builder->level--; return JIM_OK; } Jim_SetResultFormatted(interp, "unexpected comma in expression: \"%#s\"", builder->exprObjPtr); return JIM_ERR; } else { if (builder->stack.len > exp_stacklen) { Jim_SetResultFormatted(interp, "too many arguments to math function"); return JIM_ERR; } } } else if (t->type == JIM_EXPROP_COLON) { if (!(flags & EXPR_TERNARY)) { if (builder->level != 1) { builder->token--; builder->level--; return JIM_OK; } Jim_SetResultFormatted(interp, ": without ? in expression: \"%#s\"", builder->exprObjPtr); return JIM_ERR; } if (builder->stack.len == exp_stacklen) { builder->token--; builder->level--; return JIM_OK; } } else if (TOKEN_IS_EXPR_OP(t->type)) { const struct Jim_ExprOperator *op; if (TOKEN_IS_EXPR_OP(prevtt) || TOKEN_IS_EXPR_START(prevtt)) { if (t->type == JIM_EXPROP_SUB) { t->type = JIM_EXPROP_UNARYMINUS; } else if (t->type == JIM_EXPROP_ADD) { t->type = JIM_EXPROP_UNARYPLUS; } } op = JimExprOperatorInfoByOpcode(t->type); if (op->precedence < precedence || (!(op->attr & OP_RIGHT_ASSOC) && op->precedence == precedence)) { builder->token--; break; } if (op->attr & OP_FUNC) { if (builder->token->type != JIM_TT_SUBEXPR_START) { Jim_SetResultString(interp, "missing arguments for math function", -1); return JIM_ERR; } builder->token++; if (op->arity == 0) { if (builder->token->type != JIM_TT_SUBEXPR_END) { Jim_SetResultString(interp, "too many arguments for math function", -1); return JIM_ERR; } builder->token++; goto noargs; } builder->parencount++; rc = ExprTreeBuildTree(interp, builder, 0, EXPR_FUNC_ARGS | EXPR_UNTIL_CLOSE, op->arity); } else if (t->type == JIM_EXPROP_TERNARY) { rc = ExprTreeBuildTree(interp, builder, op->precedence, EXPR_TERNARY, 2); } else { rc = ExprTreeBuildTree(interp, builder, op->precedence, 0, 1); } if (rc != JIM_OK) { return rc; } noargs: node = builder->next++; node->type = t->type; if (op->arity >= 3) { node->ternary = Jim_StackPop(&builder->stack); if (node->ternary == NULL) { goto missingoperand; } } if (op->arity >= 2) { node->right = Jim_StackPop(&builder->stack); if (node->right == NULL) { goto missingoperand; } } if (op->arity >= 1) { node->left = Jim_StackPop(&builder->stack); if (node->left == NULL) { missingoperand: Jim_SetResultFormatted(interp, "missing operand to %s in expression: \"%#s\"", op->name, builder->exprObjPtr); builder->next--; return JIM_ERR; } } Jim_StackPush(&builder->stack, node); } else { Jim_Obj *objPtr = NULL; if (!TOKEN_IS_EXPR_START(prevtt) && !TOKEN_IS_EXPR_OP(prevtt)) { Jim_SetResultFormatted(interp, "missing operator in expression: \"%#s\"", builder->exprObjPtr); return JIM_ERR; } if (t->type == JIM_TT_EXPR_INT || t->type == JIM_TT_EXPR_DOUBLE) { char *endptr; if (t->type == JIM_TT_EXPR_INT) { objPtr = Jim_NewIntObj(interp, jim_strtoull(t->token, &endptr)); } else { objPtr = Jim_NewDoubleObj(interp, strtod(t->token, &endptr)); } if (endptr != t->token + t->len) { Jim_FreeNewObj(interp, objPtr); objPtr = NULL; } } if (!objPtr) { objPtr = Jim_NewStringObj(interp, t->token, t->len); if (t->type == JIM_TT_CMD) { JimSetSourceInfo(interp, objPtr, builder->fileNameObj, t->line); } } node = builder->next++; node->objPtr = objPtr; Jim_IncrRefCount(node->objPtr); node->type = t->type; Jim_StackPush(&builder->stack, node); } } if (builder->stack.len == exp_stacklen) { builder->level--; return JIM_OK; } if ((flags & EXPR_FUNC_ARGS)) { Jim_SetResultFormatted(interp, "too %s arguments for math function", (builder->stack.len < exp_stacklen) ? "few" : "many"); } else { if (builder->stack.len < exp_stacklen) { if (builder->level == 0) { Jim_SetResultFormatted(interp, "empty expression"); } else { Jim_SetResultFormatted(interp, "syntax error in expression \"%#s\": premature end of expression", builder->exprObjPtr); } } else { Jim_SetResultFormatted(interp, "extra terms after expression"); } } return JIM_ERR; } static struct ExprTree *ExprTreeCreateTree(Jim_Interp *interp, const ParseTokenList *tokenlist, Jim_Obj *exprObjPtr, Jim_Obj *fileNameObj) { struct ExprTree *expr; struct ExprBuilder builder; int rc; struct JimExprNode *top = NULL; builder.parencount = 0; builder.level = 0; builder.token = builder.first_token = tokenlist->list; builder.exprObjPtr = exprObjPtr; builder.fileNameObj = fileNameObj; builder.nodes = malloc(sizeof(struct JimExprNode) * (tokenlist->count - 1)); memset(builder.nodes, 0, sizeof(struct JimExprNode) * (tokenlist->count - 1)); builder.next = builder.nodes; Jim_InitStack(&builder.stack); rc = ExprTreeBuildTree(interp, &builder, 0, 0, 1); if (rc == JIM_OK) { top = Jim_StackPop(&builder.stack); if (builder.parencount) { Jim_SetResultString(interp, "missing close parenthesis", -1); rc = JIM_ERR; } } Jim_FreeStack(&builder.stack); if (rc != JIM_OK) { ExprTreeFreeNodes(interp, builder.nodes, builder.next - builder.nodes); return NULL; } expr = Jim_Alloc(sizeof(*expr)); expr->inUse = 1; expr->expr = top; expr->nodes = builder.nodes; expr->len = builder.next - builder.nodes; assert(expr->len <= tokenlist->count - 1); return expr; } static int SetExprFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr) { int exprTextLen; const char *exprText; struct JimParserCtx parser; struct ExprTree *expr; ParseTokenList tokenlist; int line; Jim_Obj *fileNameObj; int rc = JIM_ERR; if (objPtr->typePtr == &sourceObjType) { fileNameObj = objPtr->internalRep.sourceValue.fileNameObj; line = objPtr->internalRep.sourceValue.lineNumber; } else { fileNameObj = interp->emptyObj; line = 1; } Jim_IncrRefCount(fileNameObj); exprText = Jim_GetString(objPtr, &exprTextLen); ScriptTokenListInit(&tokenlist); JimParserInit(&parser, exprText, exprTextLen, line); while (!parser.eof) { if (JimParseExpression(&parser) != JIM_OK) { ScriptTokenListFree(&tokenlist); Jim_SetResultFormatted(interp, "syntax error in expression: \"%#s\"", objPtr); expr = NULL; goto err; } ScriptAddToken(&tokenlist, parser.tstart, parser.tend - parser.tstart + 1, parser.tt, parser.tline); |
︙ | ︙ | |||
14034 14035 14036 14037 14038 14039 14040 | if (JimParseCheckMissing(interp, parser.missing.ch) == JIM_ERR) { ScriptTokenListFree(&tokenlist); Jim_DecrRefCount(interp, fileNameObj); return JIM_ERR; } | | | | < < < | < < | < < < < < < < < < | | | | | | | | | | | > | > > > > > > | | > > > > > > > | > > > > > > > | > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | | | < | | | < | | | | 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 | if (JimParseCheckMissing(interp, parser.missing.ch) == JIM_ERR) { ScriptTokenListFree(&tokenlist); Jim_DecrRefCount(interp, fileNameObj); return JIM_ERR; } expr = ExprTreeCreateTree(interp, &tokenlist, objPtr, fileNameObj); ScriptTokenListFree(&tokenlist); if (!expr) { goto err; } #ifdef DEBUG_SHOW_EXPR printf("==== Expr ====\n"); JimShowExprNode(expr->expr, 0); #endif rc = JIM_OK; err: Jim_DecrRefCount(interp, fileNameObj); Jim_FreeIntRep(interp, objPtr); Jim_SetIntRepPtr(objPtr, expr); objPtr->typePtr = &exprObjType; return rc; } static struct ExprTree *JimGetExpression(Jim_Interp *interp, Jim_Obj *objPtr) { if (objPtr->typePtr != &exprObjType) { if (SetExprFromAny(interp, objPtr) != JIM_OK) { return NULL; } } return (struct ExprTree *) Jim_GetIntRepPtr(objPtr); } #ifdef JIM_OPTIMIZATION static Jim_Obj *JimExprIntValOrVar(Jim_Interp *interp, struct JimExprNode *node) { if (node->type == JIM_TT_EXPR_INT) return node->objPtr; else if (node->type == JIM_TT_VAR) return Jim_GetVariable(interp, node->objPtr, JIM_NONE); else if (node->type == JIM_TT_DICTSUGAR) return JimExpandDictSugar(interp, node->objPtr); else return NULL; } #endif static int JimExprEvalTermNode(Jim_Interp *interp, struct JimExprNode *node) { if (TOKEN_IS_EXPR_OP(node->type)) { const struct Jim_ExprOperator *op = JimExprOperatorInfoByOpcode(node->type); return op->funcop(interp, node); } else { Jim_Obj *objPtr; switch (node->type) { case JIM_TT_EXPR_INT: case JIM_TT_EXPR_DOUBLE: case JIM_TT_EXPR_BOOLEAN: case JIM_TT_STR: Jim_SetResult(interp, node->objPtr); return JIM_OK; case JIM_TT_VAR: objPtr = Jim_GetVariable(interp, node->objPtr, JIM_ERRMSG); if (objPtr) { Jim_SetResult(interp, objPtr); return JIM_OK; } return JIM_ERR; case JIM_TT_DICTSUGAR: objPtr = JimExpandDictSugar(interp, node->objPtr); if (objPtr) { Jim_SetResult(interp, objPtr); return JIM_OK; } return JIM_ERR; case JIM_TT_ESC: if (Jim_SubstObj(interp, node->objPtr, &objPtr, JIM_NONE) == JIM_OK) { Jim_SetResult(interp, objPtr); return JIM_OK; } return JIM_ERR; case JIM_TT_CMD: return Jim_EvalObj(interp, node->objPtr); default: return JIM_ERR; } } } static int JimExprGetTerm(Jim_Interp *interp, struct JimExprNode *node, Jim_Obj **objPtrPtr) { int rc = JimExprEvalTermNode(interp, node); if (rc == JIM_OK) { *objPtrPtr = Jim_GetResult(interp); Jim_IncrRefCount(*objPtrPtr); } return rc; } static int JimExprGetTermBoolean(Jim_Interp *interp, struct JimExprNode *node) { if (JimExprEvalTermNode(interp, node) == JIM_OK) { return ExprBool(interp, Jim_GetResult(interp)); } return -1; } int Jim_EvalExpression(Jim_Interp *interp, Jim_Obj *exprObjPtr) { struct ExprTree *expr; int retcode = JIM_OK; expr = JimGetExpression(interp, exprObjPtr); if (!expr) { return JIM_ERR; } #ifdef JIM_OPTIMIZATION { Jim_Obj *objPtr; switch (expr->len) { case 1: objPtr = JimExprIntValOrVar(interp, expr->expr); if (objPtr) { Jim_SetResult(interp, objPtr); return JIM_OK; } break; case 2: if (expr->expr->type == JIM_EXPROP_NOT) { objPtr = JimExprIntValOrVar(interp, expr->expr->left); if (objPtr && JimIsWide(objPtr)) { Jim_SetResult(interp, JimWideValue(objPtr) ? interp->falseObj : interp->trueObj); return JIM_OK; } } break; case 3: objPtr = JimExprIntValOrVar(interp, expr->expr->left); if (objPtr && JimIsWide(objPtr)) { Jim_Obj *objPtr2 = JimExprIntValOrVar(interp, expr->expr->right); if (objPtr2 && JimIsWide(objPtr2)) { jim_wide wideValueA = JimWideValue(objPtr); jim_wide wideValueB = JimWideValue(objPtr2); int cmpRes; switch (expr->expr->type) { case JIM_EXPROP_LT: cmpRes = wideValueA < wideValueB; break; case JIM_EXPROP_LTE: cmpRes = wideValueA <= wideValueB; break; case JIM_EXPROP_GT: |
︙ | ︙ | |||
14170 14171 14172 14173 14174 14175 14176 | break; case JIM_EXPROP_NUMNE: cmpRes = wideValueA != wideValueB; break; default: goto noopt; } | | < | < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | < | < < > | | | | < | | | > > > | < | < | | | | | | | | | | | | | | | | 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 | break; case JIM_EXPROP_NUMNE: cmpRes = wideValueA != wideValueB; break; default: goto noopt; } Jim_SetResult(interp, cmpRes ? interp->trueObj : interp->falseObj); return JIM_OK; } } break; } } noopt: #endif expr->inUse++; retcode = JimExprEvalTermNode(interp, expr->expr); expr->inUse--; return retcode; } int Jim_GetBoolFromExpr(Jim_Interp *interp, Jim_Obj *exprObjPtr, int *boolPtr) { int retcode = Jim_EvalExpression(interp, exprObjPtr); if (retcode == JIM_OK) { switch (ExprBool(interp, Jim_GetResult(interp))) { case 0: *boolPtr = 0; break; case 1: *boolPtr = 1; break; case -1: retcode = JIM_ERR; break; } } return retcode; } typedef struct ScanFmtPartDescr { const char *arg; const char *prefix; size_t width; int pos; char type; char modifier; } ScanFmtPartDescr; typedef struct ScanFmtStringObj { jim_wide size; char *stringRep; size_t count; size_t convCount; size_t maxPos; const char *error; char *scratch; ScanFmtPartDescr descr[1]; } ScanFmtStringObj; static void FreeScanFmtInternalRep(Jim_Interp *interp, Jim_Obj *objPtr); static void DupScanFmtInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr); static void UpdateStringOfScanFmt(Jim_Obj *objPtr); |
︙ | ︙ | |||
14362 14363 14364 14365 14366 14367 14368 | static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { ScanFmtStringObj *fmtObj; char *buffer; int maxCount, i, approxSize, lastPos = -1; | | | | | | | | | | | | | | | | | | | | | | | > > > > | > | | | | | | > > > > > | 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 | static int SetScanFmtFromAny(Jim_Interp *interp, Jim_Obj *objPtr) { ScanFmtStringObj *fmtObj; char *buffer; int maxCount, i, approxSize, lastPos = -1; const char *fmt = Jim_String(objPtr); int maxFmtLen = Jim_Length(objPtr); const char *fmtEnd = fmt + maxFmtLen; int curr; Jim_FreeIntRep(interp, objPtr); for (i = 0, maxCount = 0; i < maxFmtLen; ++i) if (fmt[i] == '%') ++maxCount; approxSize = sizeof(ScanFmtStringObj) +(maxCount + 1) * sizeof(ScanFmtPartDescr) +maxFmtLen * sizeof(char) + 3 + 1 + maxFmtLen * sizeof(char) + 1 + maxFmtLen * sizeof(char) +(maxCount + 1) * sizeof(char) +1; fmtObj = (ScanFmtStringObj *) Jim_Alloc(approxSize); memset(fmtObj, 0, approxSize); fmtObj->size = approxSize; fmtObj->maxPos = 0; fmtObj->scratch = (char *)&fmtObj->descr[maxCount + 1]; fmtObj->stringRep = fmtObj->scratch + maxFmtLen + 3 + 1; memcpy(fmtObj->stringRep, fmt, maxFmtLen); buffer = fmtObj->stringRep + maxFmtLen + 1; objPtr->internalRep.ptr = fmtObj; objPtr->typePtr = &scanFmtStringObjType; for (i = 0, curr = 0; fmt < fmtEnd; ++fmt) { int width = 0, skip; ScanFmtPartDescr *descr = &fmtObj->descr[curr]; fmtObj->count++; descr->width = 0; if (*fmt != '%' || fmt[1] == '%') { descr->type = 0; descr->prefix = &buffer[i]; for (; fmt < fmtEnd; ++fmt) { if (*fmt == '%') { if (fmt[1] != '%') break; ++fmt; } buffer[i++] = *fmt; } buffer[i++] = 0; } ++fmt; if (fmt >= fmtEnd) goto done; descr->pos = 0; if (*fmt == '*') { descr->pos = -1; ++fmt; } else fmtObj->convCount++; if (sscanf(fmt, "%d%n", &width, &skip) == 1) { fmt += skip; if (descr->pos != -1 && *fmt == '$') { int prev; ++fmt; descr->pos = width; width = 0; if ((lastPos == 0 && descr->pos > 0) || (lastPos > 0 && descr->pos == 0)) { fmtObj->error = "cannot mix \"%\" and \"%n$\" conversion specifiers"; return JIM_ERR; } for (prev = 0; prev < curr; ++prev) { if (fmtObj->descr[prev].pos == -1) continue; if (fmtObj->descr[prev].pos == descr->pos) { fmtObj->error = "variable is assigned by multiple \"%n$\" conversion specifiers"; return JIM_ERR; } } if (descr->pos < 0) { fmtObj->error = "\"%n$\" conversion specifier is negative"; return JIM_ERR; } if (sscanf(fmt, "%d%n", &width, &skip) == 1) { descr->width = width; fmt += skip; } if (descr->pos > 0 && (size_t) descr->pos > fmtObj->maxPos) fmtObj->maxPos = descr->pos; } else { descr->width = width; } } if (lastPos == -1) lastPos = descr->pos; if (*fmt == '[') { int swapped = 1, beg = i, end, j; descr->type = '['; descr->arg = &buffer[i]; ++fmt; if (*fmt == '^') buffer[i++] = *fmt++; if (*fmt == ']') buffer[i++] = *fmt++; while (*fmt && *fmt != ']') buffer[i++] = *fmt++; if (*fmt != ']') { fmtObj->error = "unmatched [ in format string"; return JIM_ERR; } end = i; buffer[i++] = 0; while (swapped) { swapped = 0; for (j = beg + 1; j < end - 1; ++j) { if (buffer[j] == '-' && buffer[j - 1] > buffer[j + 1]) { char tmp = buffer[j - 1]; buffer[j - 1] = buffer[j + 1]; buffer[j + 1] = tmp; swapped = 1; } } } } else { if (fmt < fmtEnd && strchr("hlL", *fmt)) descr->modifier = tolower((int)*fmt++); if (fmt >= fmtEnd) { fmtObj->error = "missing scan conversion character"; return JIM_ERR; } descr->type = *fmt; if (strchr("efgcsndoxui", *fmt) == 0) { fmtObj->error = "bad scan conversion character"; return JIM_ERR; } else if (*fmt == 'c' && descr->width != 0) { |
︙ | ︙ | |||
14541 14542 14543 14544 14545 14546 14547 | char *p = buffer; while (*str) { int c; int n; if (!sdescr && isspace(UCHAR(*str))) | | | 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 | char *p = buffer; while (*str) { int c; int n; if (!sdescr && isspace(UCHAR(*str))) break; n = utf8_tounicode(str, &c); if (sdescr && !JimCharsetMatch(sdescr, c, JIM_CHARSET_SCAN)) break; while (n--) *p++ = *str++; } |
︙ | ︙ | |||
14564 14565 14566 14567 14568 14569 14570 | const char *tok; const ScanFmtPartDescr *descr = &fmtObj->descr[idx]; size_t scanned = 0; size_t anchor = pos; int i; Jim_Obj *tmpObj = NULL; | | | | | | | | | | | | | | | | | | | | | 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 | const char *tok; const ScanFmtPartDescr *descr = &fmtObj->descr[idx]; size_t scanned = 0; size_t anchor = pos; int i; Jim_Obj *tmpObj = NULL; *valObjPtr = 0; if (descr->prefix) { for (i = 0; pos < strLen && descr->prefix[i]; ++i) { if (isspace(UCHAR(descr->prefix[i]))) while (pos < strLen && isspace(UCHAR(str[pos]))) ++pos; else if (descr->prefix[i] != str[pos]) break; else ++pos; } if (pos >= strLen) { return -1; } else if (descr->prefix[i] != 0) return 0; } if (descr->type != 'c' && descr->type != '[' && descr->type != 'n') while (isspace(UCHAR(str[pos]))) ++pos; scanned = pos - anchor; if (descr->type == 'n') { *valObjPtr = Jim_NewIntObj(interp, anchor + scanned); } else if (pos >= strLen) { return -1; } else if (descr->type == 'c') { int c; scanned += utf8_tounicode(&str[pos], &c); *valObjPtr = Jim_NewIntObj(interp, c); return scanned; } else { if (descr->width > 0) { size_t sLen = utf8_strlen(&str[pos], strLen - pos); size_t tLen = descr->width > sLen ? sLen : descr->width; tmpObj = Jim_NewStringObjUtf8(interp, str + pos, tLen); tok = tmpObj->bytes; } else { tok = &str[pos]; } switch (descr->type) { case 'd': case 'o': case 'x': case 'u': case 'i':{ char *endp; jim_wide w; int base = descr->type == 'o' ? 8 : descr->type == 'x' ? 16 : descr->type == 'i' ? 0 : 10; if (base == 0) { w = jim_strtoull(tok, &endp); } else { w = strtoull(tok, &endp, base); } if (endp != tok) { *valObjPtr = Jim_NewIntObj(interp, w); scanned += endp - tok; } else { scanned = *tok ? 0 : -1; } break; } case 's': case '[':{ *valObjPtr = JimScanAString(interp, descr->arg, tok); scanned += Jim_Length(*valObjPtr); break; } case 'e': case 'f': case 'g':{ char *endp; double value = strtod(tok, &endp); if (endp != tok) { *valObjPtr = Jim_NewDoubleObj(interp, value); scanned += endp - tok; } else { scanned = *tok ? 0 : -1; } break; } |
︙ | ︙ | |||
14694 14695 14696 14697 14698 14699 14700 | int strLen = Jim_Utf8Length(interp, strObjPtr); Jim_Obj *resultList = 0; Jim_Obj **resultVec = 0; int resultc; Jim_Obj *emptyStr = 0; ScanFmtStringObj *fmtObj; | | | | | | | | | | | | | | | | 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 | int strLen = Jim_Utf8Length(interp, strObjPtr); Jim_Obj *resultList = 0; Jim_Obj **resultVec = 0; int resultc; Jim_Obj *emptyStr = 0; ScanFmtStringObj *fmtObj; JimPanic((fmtObjPtr->typePtr != &scanFmtStringObjType, "Jim_ScanString() for non-scan format")); fmtObj = (ScanFmtStringObj *) fmtObjPtr->internalRep.ptr; if (fmtObj->error != 0) { if (flags & JIM_ERRMSG) Jim_SetResultString(interp, fmtObj->error, -1); return 0; } emptyStr = Jim_NewEmptyStringObj(interp); Jim_IncrRefCount(emptyStr); resultList = Jim_NewListObj(interp, NULL, 0); if (fmtObj->maxPos > 0) { for (i = 0; i < fmtObj->maxPos; ++i) Jim_ListAppendElement(interp, resultList, emptyStr); JimListGetElements(interp, resultList, &resultc, &resultVec); } for (i = 0, pos = 0; i < fmtObj->count; ++i) { ScanFmtPartDescr *descr = &(fmtObj->descr[i]); Jim_Obj *value = 0; if (descr->type == 0) continue; if (scanned > 0) scanned = ScanOneEntry(interp, str, pos, strLen, fmtObj, i, &value); if (scanned == -1 && i == 0) goto eof; pos += scanned; if (value == 0) value = Jim_NewEmptyStringObj(interp); if (descr->pos == -1) { Jim_FreeNewObj(interp, value); } else if (descr->pos == 0) Jim_ListAppendElement(interp, resultList, value); else if (resultVec[descr->pos - 1] == emptyStr) { Jim_DecrRefCount(interp, resultVec[descr->pos - 1]); Jim_IncrRefCount(value); resultVec[descr->pos - 1] = value; } else { Jim_FreeNewObj(interp, value); goto err; } } Jim_DecrRefCount(interp, emptyStr); return resultList; eof: |
︙ | ︙ | |||
14790 14791 14792 14793 14794 14795 14796 | static void JimRandomBytes(Jim_Interp *interp, void *dest, unsigned int len) { Jim_PrngState *prng; unsigned char *destByte = (unsigned char *)dest; unsigned int si, sj, x; | | | | | | | 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 | static void JimRandomBytes(Jim_Interp *interp, void *dest, unsigned int len) { Jim_PrngState *prng; unsigned char *destByte = (unsigned char *)dest; unsigned int si, sj, x; if (interp->prngState == NULL) JimPrngInit(interp); prng = interp->prngState; for (x = 0; x < len; x++) { prng->i = (prng->i + 1) & 0xff; si = prng->sbox[prng->i]; prng->j = (prng->j + si) & 0xff; sj = prng->sbox[prng->j]; prng->sbox[prng->i] = sj; prng->sbox[prng->j] = si; *destByte++ = prng->sbox[(si + sj) & 0xff]; } } static void JimPrngSeed(Jim_Interp *interp, unsigned char *seed, int seedLen) { int i; Jim_PrngState *prng; if (interp->prngState == NULL) JimPrngInit(interp); prng = interp->prngState; for (i = 0; i < 256; i++) prng->sbox[i] = i; for (i = 0; i < seedLen; i++) { unsigned char t; t = prng->sbox[i & 0xFF]; prng->sbox[i & 0xFF] = prng->sbox[seed[i]]; prng->sbox[seed[i]] = t; } |
︙ | ︙ | |||
14851 14852 14853 14854 14855 14856 14857 | } if (argc == 3) { if (Jim_GetWide(interp, argv[2], &increment) != JIM_OK) return JIM_ERR; } intObjPtr = Jim_GetVariable(interp, argv[1], JIM_UNSHARED); if (!intObjPtr) { | | | | | | | | > | > | > | | | 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 | } if (argc == 3) { if (Jim_GetWide(interp, argv[2], &increment) != JIM_OK) return JIM_ERR; } intObjPtr = Jim_GetVariable(interp, argv[1], JIM_UNSHARED); if (!intObjPtr) { wideValue = 0; } else if (Jim_GetWide(interp, intObjPtr, &wideValue) != JIM_OK) { return JIM_ERR; } if (!intObjPtr || Jim_IsShared(intObjPtr)) { intObjPtr = Jim_NewIntObj(interp, wideValue + increment); if (Jim_SetVariable(interp, argv[1], intObjPtr) != JIM_OK) { Jim_FreeNewObj(interp, intObjPtr); return JIM_ERR; } } else { Jim_InvalidateStringRep(intObjPtr); JimWideValue(intObjPtr) = wideValue + increment; if (argv[1]->typePtr != &variableObjType) { Jim_SetVariable(interp, argv[1], intObjPtr); } } Jim_SetResult(interp, intObjPtr); return JIM_OK; } #define JIM_EVAL_SARGV_LEN 8 #define JIM_EVAL_SINTV_LEN 8 static int JimUnknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int retcode; if (interp->unknown_called > 50) { return JIM_ERR; } if (Jim_GetCommand(interp, interp->unknown, JIM_NONE) == NULL) return JIM_ERR; interp->unknown_called++; retcode = Jim_EvalObjPrefix(interp, interp->unknown, argc, argv); interp->unknown_called--; return retcode; } static int JimInvokeCommand(Jim_Interp *interp, int objc, Jim_Obj *const *objv) { int retcode; Jim_Cmd *cmdPtr; void *prevPrivData; #if 0 printf("invoke"); int j; for (j = 0; j < objc; j++) { printf(" '%s'", Jim_String(objv[j])); } printf("\n"); #endif if (interp->framePtr->tailcallCmd) { cmdPtr = interp->framePtr->tailcallCmd; interp->framePtr->tailcallCmd = NULL; } else { cmdPtr = Jim_GetCommand(interp, objv[0], JIM_ERRMSG); if (cmdPtr == NULL) { return JimUnknown(interp, objc, objv); } JimIncrCmdRefCount(cmdPtr); } if (interp->evalDepth == interp->maxEvalDepth) { Jim_SetResultString(interp, "Infinite eval recursion", -1); retcode = JIM_ERR; goto out; } interp->evalDepth++; prevPrivData = interp->cmdPrivData; Jim_SetEmptyResult(interp); if (cmdPtr->isproc) { retcode = JimCallProcedure(interp, cmdPtr, objc, objv); } else { interp->cmdPrivData = cmdPtr->u.native.privData; retcode = cmdPtr->u.native.cmdProc(interp, objc, objv); } interp->cmdPrivData = prevPrivData; interp->evalDepth--; out: JimDecrCmdRefCount(interp, cmdPtr); return retcode; } int Jim_EvalObjVector(Jim_Interp *interp, int objc, Jim_Obj *const *objv) { int i, retcode; for (i = 0; i < objc; i++) Jim_IncrRefCount(objv[i]); retcode = JimInvokeCommand(interp, objc, objv); for (i = 0; i < objc; i++) Jim_DecrRefCount(interp, objv[i]); return retcode; } int Jim_EvalObjPrefix(Jim_Interp *interp, Jim_Obj *prefix, int objc, Jim_Obj *const *objv) |
︙ | ︙ | |||
14987 14988 14989 14990 14991 14992 14993 | Jim_Free(nargv); return ret; } static void JimAddErrorToStack(Jim_Interp *interp, ScriptObj *script) { if (!interp->errorFlag) { | | | | | | 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 | Jim_Free(nargv); return ret; } static void JimAddErrorToStack(Jim_Interp *interp, ScriptObj *script) { if (!interp->errorFlag) { interp->errorFlag = 1; Jim_IncrRefCount(script->fileNameObj); Jim_DecrRefCount(interp, interp->errorFileNameObj); interp->errorFileNameObj = script->fileNameObj; interp->errorLine = script->linenr; JimResetStackTrace(interp); interp->addStackTrace++; } if (interp->addStackTrace > 0) { JimAppendStackTrace(interp, Jim_String(interp->errorProc), script->fileNameObj, script->linenr); if (Jim_Length(script->fileNameObj)) { interp->addStackTrace = 0; } |
︙ | ︙ | |||
15040 15041 15042 15043 15044 15045 15046 | case JIM_TT_CMD: switch (Jim_EvalObj(interp, token->objPtr)) { case JIM_OK: case JIM_RETURN: objPtr = interp->result; break; case JIM_BREAK: | | | | 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 | case JIM_TT_CMD: switch (Jim_EvalObj(interp, token->objPtr)) { case JIM_OK: case JIM_RETURN: objPtr = interp->result; break; case JIM_BREAK: return JIM_BREAK; case JIM_CONTINUE: return JIM_CONTINUE; default: return JIM_ERR; } break; default: JimPanic((1, |
︙ | ︙ | |||
15082 15083 15084 15085 15086 15087 15088 | for (i = 0; i < tokens; i++) { switch (JimSubstOneToken(interp, &token[i], &intv[i])) { case JIM_OK: case JIM_RETURN: break; case JIM_BREAK: if (flags & JIM_SUBST_FLAG) { | | | | | | | | > | | | | 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 | for (i = 0; i < tokens; i++) { switch (JimSubstOneToken(interp, &token[i], &intv[i])) { case JIM_OK: case JIM_RETURN: break; case JIM_BREAK: if (flags & JIM_SUBST_FLAG) { tokens = i; continue; } case JIM_CONTINUE: if (flags & JIM_SUBST_FLAG) { intv[i] = NULL; continue; } default: while (i--) { Jim_DecrRefCount(interp, intv[i]); } if (intv != sintv) { Jim_Free(intv); } return NULL; } Jim_IncrRefCount(intv[i]); Jim_String(intv[i]); totlen += intv[i]->length; } if (tokens == 1 && intv[0] && intv == sintv) { intv[0]->refCount--; return intv[0]; } objPtr = Jim_NewStringObjNoAlloc(interp, NULL, 0); if (tokens == 4 && token[0].type == JIM_TT_ESC && token[1].type == JIM_TT_ESC && token[2].type == JIM_TT_VAR) { objPtr->typePtr = &interpolatedObjType; objPtr->internalRep.dictSubstValue.varNameObjPtr = token[0].objPtr; objPtr->internalRep.dictSubstValue.indexObjPtr = intv[2]; Jim_IncrRefCount(intv[2]); } else if (tokens && intv[0] && intv[0]->typePtr == &sourceObjType) { JimSetSourceInfo(interp, objPtr, intv[0]->internalRep.sourceValue.fileNameObj, intv[0]->internalRep.sourceValue.lineNumber); } s = objPtr->bytes = Jim_Alloc(totlen + 1); objPtr->length = totlen; for (i = 0; i < tokens; i++) { if (intv[i]) { memcpy(s, intv[i]->bytes, intv[i]->length); s += intv[i]->length; Jim_DecrRefCount(interp, intv[i]); } } objPtr->bytes[totlen] = '\0'; if (intv != sintv) { Jim_Free(intv); } return objPtr; } |
︙ | ︙ | |||
15185 15186 15187 15188 15189 15190 15191 | Jim_Obj *sargv[JIM_EVAL_SARGV_LEN], **argv = NULL; Jim_Obj *prevScriptObj; if (Jim_IsList(scriptObjPtr) && scriptObjPtr->bytes == NULL) { return JimEvalObjList(interp, scriptObjPtr); } | | | 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 | Jim_Obj *sargv[JIM_EVAL_SARGV_LEN], **argv = NULL; Jim_Obj *prevScriptObj; if (Jim_IsList(scriptObjPtr) && scriptObjPtr->bytes == NULL) { return JimEvalObjList(interp, scriptObjPtr); } Jim_IncrRefCount(scriptObjPtr); script = JimGetScript(interp, scriptObjPtr); if (!JimScriptValid(interp, script)) { Jim_DecrRefCount(interp, scriptObjPtr); return JIM_ERR; } Jim_SetEmptyResult(interp); |
︙ | ︙ | |||
15221 15222 15223 15224 15225 15226 15227 | return JIM_OK; } } #endif script->inUse++; | | | | | | 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 | return JIM_OK; } } #endif script->inUse++; prevScriptObj = interp->currentScriptObj; interp->currentScriptObj = scriptObjPtr; interp->errorFlag = 0; argv = sargv; for (i = 0; i < script->len && retcode == JIM_OK; ) { int argc; int j; argc = token[i].objPtr->internalRep.scriptLineValue.argc; script->linenr = token[i].objPtr->internalRep.scriptLineValue.line; if (argc > JIM_EVAL_SARGV_LEN) argv = Jim_Alloc(sizeof(Jim_Obj *) * argc); i++; for (j = 0; j < argc; j++) { long wordtokens = 1; int expand = 0; Jim_Obj *wordObjPtr = NULL; |
︙ | ︙ | |||
15300 15301 15302 15303 15304 15305 15306 | Jim_IncrRefCount(wordObjPtr); i += wordtokens; if (!expand) { argv[j] = wordObjPtr; } else { | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | > | | | | 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 | Jim_IncrRefCount(wordObjPtr); i += wordtokens; if (!expand) { argv[j] = wordObjPtr; } else { int len = Jim_ListLength(interp, wordObjPtr); int newargc = argc + len - 1; int k; if (len > 1) { if (argv == sargv) { if (newargc > JIM_EVAL_SARGV_LEN) { argv = Jim_Alloc(sizeof(*argv) * newargc); memcpy(argv, sargv, sizeof(*argv) * j); } } else { argv = Jim_Realloc(argv, sizeof(*argv) * newargc); } } for (k = 0; k < len; k++) { argv[j++] = wordObjPtr->internalRep.listValue.ele[k]; Jim_IncrRefCount(wordObjPtr->internalRep.listValue.ele[k]); } Jim_DecrRefCount(interp, wordObjPtr); j--; argc += len - 1; } } if (retcode == JIM_OK && argc) { retcode = JimInvokeCommand(interp, argc, argv); if (Jim_CheckSignal(interp)) { retcode = JIM_SIGNAL; } } while (j-- > 0) { Jim_DecrRefCount(interp, argv[j]); } if (argv != sargv) { Jim_Free(argv); argv = sargv; } } if (retcode == JIM_ERR) { JimAddErrorToStack(interp, script); } else if (retcode != JIM_RETURN || interp->returnCode != JIM_ERR) { interp->addStackTrace = 0; } interp->currentScriptObj = prevScriptObj; Jim_FreeIntRep(interp, scriptObjPtr); scriptObjPtr->typePtr = &scriptObjType; Jim_SetIntRepPtr(scriptObjPtr, script); Jim_DecrRefCount(interp, scriptObjPtr); return retcode; } static int JimSetProcArg(Jim_Interp *interp, Jim_Obj *argNameObj, Jim_Obj *argValObj) { int retcode; const char *varname = Jim_String(argNameObj); if (*varname == '&') { Jim_Obj *objPtr; Jim_CallFrame *savedCallFrame = interp->framePtr; interp->framePtr = interp->framePtr->parent; objPtr = Jim_GetVariable(interp, argValObj, JIM_ERRMSG); interp->framePtr = savedCallFrame; if (!objPtr) { return JIM_ERR; } objPtr = Jim_NewStringObj(interp, varname + 1, -1); Jim_IncrRefCount(objPtr); retcode = Jim_SetVariableLink(interp, objPtr, argValObj, interp->framePtr->parent); Jim_DecrRefCount(interp, objPtr); } else { retcode = Jim_SetVariable(interp, argNameObj, argValObj); } return retcode; } static void JimSetProcWrongArgs(Jim_Interp *interp, Jim_Obj *procNameObj, Jim_Cmd *cmd) { Jim_Obj *argmsg = Jim_NewStringObj(interp, "", 0); int i; for (i = 0; i < cmd->u.proc.argListLen; i++) { Jim_AppendString(interp, argmsg, " ", 1); if (i == cmd->u.proc.argsPos) { if (cmd->u.proc.arglist[i].defaultObjPtr) { Jim_AppendString(interp, argmsg, "?", 1); Jim_AppendObj(interp, argmsg, cmd->u.proc.arglist[i].defaultObjPtr); Jim_AppendString(interp, argmsg, " ...?", -1); } else { Jim_AppendString(interp, argmsg, "?arg...?", -1); } } else { if (cmd->u.proc.arglist[i].defaultObjPtr) { Jim_AppendString(interp, argmsg, "?", 1); Jim_AppendObj(interp, argmsg, cmd->u.proc.arglist[i].nameObjPtr); Jim_AppendString(interp, argmsg, "?", 1); } else { const char *arg = Jim_String(cmd->u.proc.arglist[i].nameObjPtr); if (*arg == '&') { arg++; } Jim_AppendString(interp, argmsg, arg, -1); } } } Jim_SetResultFormatted(interp, "wrong # args: should be \"%#s%#s\"", procNameObj, argmsg); } #ifdef jim_ext_namespace int Jim_EvalNamespace(Jim_Interp *interp, Jim_Obj *scriptObj, Jim_Obj *nsObj) { Jim_CallFrame *callFramePtr; int retcode; callFramePtr = JimCreateCallFrame(interp, interp->framePtr, nsObj); callFramePtr->argv = &interp->emptyObj; callFramePtr->argc = 0; callFramePtr->procArgsObjPtr = NULL; callFramePtr->procBodyObjPtr = scriptObj; callFramePtr->staticVars = NULL; callFramePtr->fileNameObj = interp->emptyObj; callFramePtr->line = 0; Jim_IncrRefCount(scriptObj); interp->framePtr = callFramePtr; if (interp->framePtr->level == interp->maxCallFrameDepth) { Jim_SetResultString(interp, "Too many nested calls. Infinite recursion?", -1); retcode = JIM_ERR; } else { retcode = Jim_EvalObj(interp, scriptObj); } interp->framePtr = interp->framePtr->parent; JimFreeCallFrame(interp, callFramePtr, JIM_FCF_REUSE); return retcode; } #endif static int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc, Jim_Obj *const *argv) { Jim_CallFrame *callFramePtr; int i, d, retcode, optargs; ScriptObj *script; if (argc - 1 < cmd->u.proc.reqArity || (cmd->u.proc.argsPos < 0 && argc - 1 > cmd->u.proc.reqArity + cmd->u.proc.optArity)) { JimSetProcWrongArgs(interp, argv[0], cmd); return JIM_ERR; } if (Jim_Length(cmd->u.proc.bodyObjPtr) == 0) { return JIM_OK; } if (interp->framePtr->level == interp->maxCallFrameDepth) { Jim_SetResultString(interp, "Too many nested calls. Infinite recursion?", -1); return JIM_ERR; } callFramePtr = JimCreateCallFrame(interp, interp->framePtr, cmd->u.proc.nsObj); callFramePtr->argv = argv; callFramePtr->argc = argc; callFramePtr->procArgsObjPtr = cmd->u.proc.argListObjPtr; callFramePtr->procBodyObjPtr = cmd->u.proc.bodyObjPtr; callFramePtr->staticVars = cmd->u.proc.staticVars; script = JimGetScript(interp, interp->currentScriptObj); callFramePtr->fileNameObj = script->fileNameObj; callFramePtr->line = script->linenr; Jim_IncrRefCount(cmd->u.proc.argListObjPtr); Jim_IncrRefCount(cmd->u.proc.bodyObjPtr); interp->framePtr = callFramePtr; optargs = (argc - 1 - cmd->u.proc.reqArity); i = 1; for (d = 0; d < cmd->u.proc.argListLen; d++) { Jim_Obj *nameObjPtr = cmd->u.proc.arglist[d].nameObjPtr; if (d == cmd->u.proc.argsPos) { Jim_Obj *listObjPtr; int argsLen = 0; if (cmd->u.proc.reqArity + cmd->u.proc.optArity < argc - 1) { argsLen = argc - 1 - (cmd->u.proc.reqArity + cmd->u.proc.optArity); } listObjPtr = Jim_NewListObj(interp, &argv[i], argsLen); if (cmd->u.proc.arglist[d].defaultObjPtr) { nameObjPtr =cmd->u.proc.arglist[d].defaultObjPtr; } retcode = Jim_SetVariable(interp, nameObjPtr, listObjPtr); if (retcode != JIM_OK) { goto badargset; } i += argsLen; continue; } if (cmd->u.proc.arglist[d].defaultObjPtr == NULL || optargs-- > 0) { retcode = JimSetProcArg(interp, nameObjPtr, argv[i++]); } else { retcode = Jim_SetVariable(interp, nameObjPtr, cmd->u.proc.arglist[d].defaultObjPtr); } if (retcode != JIM_OK) { goto badargset; } } retcode = Jim_EvalObj(interp, cmd->u.proc.bodyObjPtr); badargset: retcode = JimInvokeDefer(interp, retcode); interp->framePtr = interp->framePtr->parent; JimFreeCallFrame(interp, callFramePtr, JIM_FCF_REUSE); if (interp->framePtr->tailcallObj) { do { Jim_Obj *tailcallObj = interp->framePtr->tailcallObj; interp->framePtr->tailcallObj = NULL; if (retcode == JIM_EVAL) { retcode = Jim_EvalObjList(interp, tailcallObj); if (retcode == JIM_RETURN) { interp->returnLevel++; } } Jim_DecrRefCount(interp, tailcallObj); } while (interp->framePtr->tailcallObj); if (interp->framePtr->tailcallCmd) { JimDecrCmdRefCount(interp, interp->framePtr->tailcallCmd); interp->framePtr->tailcallCmd = NULL; } } if (retcode == JIM_RETURN) { if (--interp->returnLevel <= 0) { retcode = interp->returnCode; interp->returnCode = JIM_OK; interp->returnLevel = 0; } } |
︙ | ︙ | |||
15709 15710 15711 15712 15713 15714 15715 | Jim_IncrRefCount(scriptObjPtr); prevScriptObj = interp->currentScriptObj; interp->currentScriptObj = scriptObjPtr; retcode = Jim_EvalObj(interp, scriptObjPtr); | | | | 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 | Jim_IncrRefCount(scriptObjPtr); prevScriptObj = interp->currentScriptObj; interp->currentScriptObj = scriptObjPtr; retcode = Jim_EvalObj(interp, scriptObjPtr); if (retcode == JIM_RETURN) { if (--interp->returnLevel <= 0) { retcode = interp->returnCode; interp->returnCode = JIM_OK; interp->returnLevel = 0; } } if (retcode == JIM_ERR) { interp->addStackTrace++; } interp->currentScriptObj = prevScriptObj; Jim_DecrRefCount(interp, scriptObjPtr); |
︙ | ︙ | |||
15748 15749 15750 15751 15752 15753 15754 | JimParseCmd(pc); return; } if (*pc->p == '$' && !(flags & JIM_SUBST_NOVAR)) { if (JimParseVar(pc) == JIM_OK) { return; } | | | 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 | JimParseCmd(pc); return; } if (*pc->p == '$' && !(flags & JIM_SUBST_NOVAR)) { if (JimParseVar(pc) == JIM_OK) { return; } pc->tstart = pc->p; flags |= JIM_SUBST_NOVAR; } while (pc->len) { if (*pc->p == '$' && !(flags & JIM_SUBST_NOVAR)) { break; } |
︙ | ︙ | |||
15779 15780 15781 15782 15783 15784 15785 | { int scriptTextLen; const char *scriptText = Jim_GetString(objPtr, &scriptTextLen); struct JimParserCtx parser; struct ScriptObj *script = Jim_Alloc(sizeof(*script)); ParseTokenList tokenlist; | | | | | | | > > > > | | < < | | 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 | { int scriptTextLen; const char *scriptText = Jim_GetString(objPtr, &scriptTextLen); struct JimParserCtx parser; struct ScriptObj *script = Jim_Alloc(sizeof(*script)); ParseTokenList tokenlist; ScriptTokenListInit(&tokenlist); JimParserInit(&parser, scriptText, scriptTextLen, 1); while (1) { JimParseSubst(&parser, flags); if (parser.eof) { break; } ScriptAddToken(&tokenlist, parser.tstart, parser.tend - parser.tstart + 1, parser.tt, parser.tline); } script->inUse = 1; script->substFlags = flags; script->fileNameObj = interp->emptyObj; Jim_IncrRefCount(script->fileNameObj); SubstObjAddTokens(interp, script, &tokenlist); ScriptTokenListFree(&tokenlist); #ifdef DEBUG_SHOW_SUBST { int i; printf("==== Subst ====\n"); for (i = 0; i < script->len; i++) { printf("[%2d] %s '%s'\n", i, jim_tt_name(script->token[i].type), Jim_String(script->token[i].objPtr)); } } #endif Jim_FreeIntRep(interp, objPtr); Jim_SetIntRepPtr(objPtr, script); objPtr->typePtr = &scriptObjType; return JIM_OK; } static ScriptObj *Jim_GetSubst(Jim_Interp *interp, Jim_Obj *objPtr, int flags) { if (objPtr->typePtr != &scriptObjType || ((ScriptObj *)Jim_GetIntRepPtr(objPtr))->substFlags != flags) SetSubstFromAny(interp, objPtr, flags); return (ScriptObj *) Jim_GetIntRepPtr(objPtr); } int Jim_SubstObj(Jim_Interp *interp, Jim_Obj *substObjPtr, Jim_Obj **resObjPtrPtr, int flags) { ScriptObj *script = Jim_GetSubst(interp, substObjPtr, flags); Jim_IncrRefCount(substObjPtr); script->inUse++; *resObjPtrPtr = JimInterpolateTokens(interp, script->token, script->len, flags); script->inUse--; Jim_DecrRefCount(interp, substObjPtr); if (*resObjPtrPtr == NULL) { return JIM_ERR; } return JIM_OK; } void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Jim_Obj *const *argv, const char *msg) { Jim_Obj *objPtr; Jim_Obj *listObjPtr; JimPanic((argc == 0, "Jim_WrongNumArgs() called with argc=0")); listObjPtr = Jim_NewListObj(interp, argv, argc); if (msg && *msg) { Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, msg, -1)); } Jim_IncrRefCount(listObjPtr); objPtr = Jim_ListJoin(interp, listObjPtr, " ", 1); Jim_DecrRefCount(interp, listObjPtr); Jim_SetResultFormatted(interp, "wrong # args: should be \"%#s\"", objPtr); } typedef void JimHashtableIteratorCallbackType(Jim_Interp *interp, Jim_Obj *listObjPtr, Jim_HashEntry *he, int type); #define JimTrivialMatch(pattern) (strpbrk((pattern), "*[?\\") == NULL) static Jim_Obj *JimHashtablePatternMatch(Jim_Interp *interp, Jim_HashTable *ht, Jim_Obj *patternObjPtr, JimHashtableIteratorCallbackType *callback, int type) { Jim_HashEntry *he; Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0); if (patternObjPtr && JimTrivialMatch(Jim_String(patternObjPtr))) { he = Jim_FindHashEntry(ht, Jim_String(patternObjPtr)); if (he) { callback(interp, listObjPtr, he, type); } } else { |
︙ | ︙ | |||
15905 15906 15907 15908 15909 15910 15911 | static void JimCommandMatch(Jim_Interp *interp, Jim_Obj *listObjPtr, Jim_HashEntry *he, int type) { Jim_Cmd *cmdPtr = Jim_GetHashEntryVal(he); Jim_Obj *objPtr; if (type == JIM_CMDLIST_PROCS && !cmdPtr->isproc) { | | | 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 | static void JimCommandMatch(Jim_Interp *interp, Jim_Obj *listObjPtr, Jim_HashEntry *he, int type) { Jim_Cmd *cmdPtr = Jim_GetHashEntryVal(he); Jim_Obj *objPtr; if (type == JIM_CMDLIST_PROCS && !cmdPtr->isproc) { return; } objPtr = Jim_NewStringObj(interp, he->key, -1); Jim_IncrRefCount(objPtr); if (type != JIM_CMDLIST_CHANNELS || Jim_AioFilehandle(interp, objPtr)) { |
︙ | ︙ | |||
15965 15966 15967 15968 15969 15970 15971 | { Jim_CallFrame *targetCallFrame; targetCallFrame = JimGetCallFrameByInteger(interp, levelObjPtr); if (targetCallFrame == NULL) { return JIM_ERR; } | | | 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 | { Jim_CallFrame *targetCallFrame; targetCallFrame = JimGetCallFrameByInteger(interp, levelObjPtr); if (targetCallFrame == NULL) { return JIM_ERR; } if (targetCallFrame == interp->topFramePtr) { Jim_SetResultFormatted(interp, "bad level \"%#s\"", levelObjPtr); return JIM_ERR; } if (info_level_cmd) { *objPtrPtr = Jim_NewListObj(interp, targetCallFrame->argv, targetCallFrame->argc); } |
︙ | ︙ | |||
16093 16094 16095 16096 16097 16098 16099 | for (i = 2; i < argc; i++) { if (Jim_GetWide(interp, argv[i], &wideValue) != JIM_OK) { doubleRes = (double)res; goto trydouble; } if (op == JIM_EXPROP_SUB) res -= wideValue; | | > > > > > | 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 | for (i = 2; i < argc; i++) { if (Jim_GetWide(interp, argv[i], &wideValue) != JIM_OK) { doubleRes = (double)res; goto trydouble; } if (op == JIM_EXPROP_SUB) res -= wideValue; else { if (wideValue == 0) { Jim_SetResultString(interp, "Division by zero", -1); return JIM_ERR; } res /= wideValue; } } Jim_SetResultInt(interp, res); return JIM_OK; trydouble: for (; i < argc; i++) { if (Jim_GetDouble(interp, argv[i], &doubleValue) != JIM_OK) return JIM_ERR; |
︙ | ︙ | |||
16152 16153 16154 16155 16156 16157 16158 | objPtr = Jim_GetVariable(interp, argv[1], JIM_ERRMSG); if (!objPtr) return JIM_ERR; Jim_SetResult(interp, objPtr); return JIM_OK; } | | | 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 | objPtr = Jim_GetVariable(interp, argv[1], JIM_ERRMSG); if (!objPtr) return JIM_ERR; Jim_SetResult(interp, objPtr); return JIM_OK; } if (Jim_SetVariable(interp, argv[1], argv[2]) != JIM_OK) return JIM_ERR; Jim_SetResult(interp, argv[2]); return JIM_OK; } static int Jim_UnsetCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
︙ | ︙ | |||
16195 16196 16197 16198 16199 16200 16201 | static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 3) { Jim_WrongNumArgs(interp, 1, argv, "condition body"); return JIM_ERR; } | | | 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 | static int Jim_WhileCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 3) { Jim_WrongNumArgs(interp, 1, argv, "condition body"); return JIM_ERR; } while (1) { int boolean, retval; if ((retval = Jim_GetBoolFromExpr(interp, argv[1], &boolean)) != JIM_OK) return retval; if (!boolean) break; |
︙ | ︙ | |||
16235 16236 16237 16238 16239 16240 16241 | Jim_Obj *stopVarNamePtr = NULL; if (argc != 5) { Jim_WrongNumArgs(interp, 1, argv, "start test next body"); return JIM_ERR; } | | | | | | | < < | | > > | > > > > > > | | | | | | | | | | | | | | | | 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 | Jim_Obj *stopVarNamePtr = NULL; if (argc != 5) { Jim_WrongNumArgs(interp, 1, argv, "start test next body"); return JIM_ERR; } if ((retval = Jim_EvalObj(interp, argv[1])) != JIM_OK) { return retval; } retval = Jim_GetBoolFromExpr(interp, argv[2], &boolean); #ifdef JIM_OPTIMIZATION if (retval == JIM_OK && boolean) { ScriptObj *incrScript; struct ExprTree *expr; jim_wide stop, currentVal; Jim_Obj *objPtr; int cmpOffset; expr = JimGetExpression(interp, argv[2]); incrScript = JimGetScript(interp, argv[3]); if (incrScript == NULL || incrScript->len != 3 || !expr || expr->len != 3) { goto evalstart; } if (incrScript->token[1].type != JIM_TT_ESC) { goto evalstart; } if (expr->expr->type == JIM_EXPROP_LT) { cmpOffset = 0; } else if (expr->expr->type == JIM_EXPROP_LTE) { cmpOffset = 1; } else { goto evalstart; } if (expr->expr->left->type != JIM_TT_VAR) { goto evalstart; } if (expr->expr->right->type != JIM_TT_VAR && expr->expr->right->type != JIM_TT_EXPR_INT) { goto evalstart; } if (!Jim_CompareStringImmediate(interp, incrScript->token[1].objPtr, "incr")) { goto evalstart; } if (!Jim_StringEqObj(incrScript->token[2].objPtr, expr->expr->left->objPtr)) { goto evalstart; } if (expr->expr->right->type == JIM_TT_EXPR_INT) { if (Jim_GetWide(interp, expr->expr->right->objPtr, &stop) == JIM_ERR) { goto evalstart; } } else { stopVarNamePtr = expr->expr->right->objPtr; Jim_IncrRefCount(stopVarNamePtr); stop = 0; } varNamePtr = expr->expr->left->objPtr; Jim_IncrRefCount(varNamePtr); objPtr = Jim_GetVariable(interp, varNamePtr, JIM_NONE); if (objPtr == NULL || Jim_GetWide(interp, objPtr, ¤tVal) != JIM_OK) { goto testcond; } while (retval == JIM_OK) { if (stopVarNamePtr) { objPtr = Jim_GetVariable(interp, stopVarNamePtr, JIM_NONE); if (objPtr == NULL || Jim_GetWide(interp, objPtr, &stop) != JIM_OK) { goto testcond; } } if (currentVal >= stop + cmpOffset) { break; } retval = Jim_EvalObj(interp, argv[4]); if (retval == JIM_OK || retval == JIM_CONTINUE) { retval = JIM_OK; objPtr = Jim_GetVariable(interp, varNamePtr, JIM_ERRMSG); if (objPtr == NULL) { retval = JIM_ERR; goto out; } if (!Jim_IsShared(objPtr) && objPtr->typePtr == &intObjType) { currentVal = ++JimWideValue(objPtr); Jim_InvalidateStringRep(objPtr); |
︙ | ︙ | |||
16356 16357 16358 16359 16360 16361 16362 | } goto out; } evalstart: #endif while (boolean && (retval == JIM_OK || retval == JIM_CONTINUE)) { | | | | | | | | 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 | } goto out; } evalstart: #endif while (boolean && (retval == JIM_OK || retval == JIM_CONTINUE)) { retval = Jim_EvalObj(interp, argv[4]); if (retval == JIM_OK || retval == JIM_CONTINUE) { JIM_IF_OPTIM(evalnext:) retval = Jim_EvalObj(interp, argv[3]); if (retval == JIM_OK || retval == JIM_CONTINUE) { JIM_IF_OPTIM(testcond:) retval = Jim_GetBoolFromExpr(interp, argv[2], &boolean); } } } JIM_IF_OPTIM(out:) if (stopVarNamePtr) { Jim_DecrRefCount(interp, stopVarNamePtr); } if (varNamePtr) { Jim_DecrRefCount(interp, varNamePtr); } |
︙ | ︙ | |||
16416 16417 16418 16419 16420 16421 16422 | while (((i < limit && incr > 0) || (i > limit && incr < 0)) && retval == JIM_OK) { retval = Jim_EvalObj(interp, bodyObjPtr); if (retval == JIM_OK || retval == JIM_CONTINUE) { Jim_Obj *objPtr = Jim_GetVariable(interp, argv[1], JIM_ERRMSG); retval = JIM_OK; | | | 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 | while (((i < limit && incr > 0) || (i > limit && incr < 0)) && retval == JIM_OK) { retval = Jim_EvalObj(interp, bodyObjPtr); if (retval == JIM_OK || retval == JIM_CONTINUE) { Jim_Obj *objPtr = Jim_GetVariable(interp, argv[1], JIM_ERRMSG); retval = JIM_OK; i += incr; if (objPtr && !Jim_IsShared(objPtr) && objPtr->typePtr == &intObjType) { if (argv[1]->typePtr != &variableObjType) { if (Jim_SetVariable(interp, argv[1], objPtr) != JIM_OK) { return JIM_ERR; } |
︙ | ︙ | |||
16481 16482 16483 16484 16485 16486 16487 | } static int JimForeachMapHelper(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int doMap) { int result = JIM_OK; int i, numargs; | | | | | | | | | | | | 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 | } static int JimForeachMapHelper(Jim_Interp *interp, int argc, Jim_Obj *const *argv, int doMap) { int result = JIM_OK; int i, numargs; Jim_ListIter twoiters[2]; Jim_ListIter *iters; Jim_Obj *script; Jim_Obj *resultObj; if (argc < 4 || argc % 2 != 0) { Jim_WrongNumArgs(interp, 1, argv, "varList list ?varList list ...? script"); return JIM_ERR; } script = argv[argc - 1]; numargs = (argc - 1 - 1); if (numargs == 2) { iters = twoiters; } else { iters = Jim_Alloc(numargs * sizeof(*iters)); } for (i = 0; i < numargs; i++) { JimListIterInit(&iters[i], argv[i + 1]); if (i % 2 == 0 && JimListIterDone(interp, &iters[i])) { result = JIM_ERR; } } if (result != JIM_OK) { Jim_SetResultString(interp, "foreach varlist is empty", -1); goto empty_varlist; } if (doMap) { resultObj = Jim_NewListObj(interp, NULL, 0); } else { resultObj = interp->emptyObj; } Jim_IncrRefCount(resultObj); while (1) { for (i = 0; i < numargs; i += 2) { if (!JimListIterDone(interp, &iters[i + 1])) { break; } } if (i == numargs) { break; } for (i = 0; i < numargs; i += 2) { Jim_Obj *varName; JimListIterInit(&iters[i], argv[i + 1]); while ((varName = JimListIterNext(interp, &iters[i])) != NULL) { Jim_Obj *valObj = JimListIterNext(interp, &iters[i + 1]); if (!valObj) { valObj = interp->emptyObj; } Jim_IncrRefCount(valObj); result = Jim_SetVariable(interp, varName, valObj); Jim_DecrRefCount(interp, valObj); if (result != JIM_OK) { goto err; } } |
︙ | ︙ | |||
16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 | } } out: result = JIM_OK; Jim_SetResult(interp, resultObj); err: Jim_DecrRefCount(interp, resultObj); if (numargs > 2) { Jim_Free(iters); } return result; } | > | 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 | } } out: result = JIM_OK; Jim_SetResult(interp, resultObj); err: Jim_DecrRefCount(interp, resultObj); empty_varlist: if (numargs > 2) { Jim_Free(iters); } return result; } |
︙ | ︙ | |||
16628 16629 16630 16631 16632 16633 16634 | static int Jim_IfCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int boolean, retval, current = 1, falsebody = 0; if (argc >= 3) { while (1) { | | | | | | | | 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 | static int Jim_IfCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int boolean, retval, current = 1, falsebody = 0; if (argc >= 3) { while (1) { if (current >= argc) goto err; if ((retval = Jim_GetBoolFromExpr(interp, argv[current++], &boolean)) != JIM_OK) return retval; if (current >= argc) goto err; if (Jim_CompareStringImmediate(interp, argv[current], "then")) current++; if (current >= argc) goto err; if (boolean) return Jim_EvalObj(interp, argv[current]); if (++current >= argc) { Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); return JIM_OK; } falsebody = current++; if (Jim_CompareStringImmediate(interp, argv[falsebody], "else")) { if (current != argc - 1) goto err; return Jim_EvalObj(interp, argv[current]); } else if (Jim_CompareStringImmediate(interp, argv[falsebody], "elseif")) continue; else if (falsebody != argc - 1) goto err; return Jim_EvalObj(interp, argv[falsebody]); } return JIM_OK; } err: |
︙ | ︙ | |||
16696 16697 16698 16699 16700 16701 16702 | if (rc != JIM_OK || Jim_GetLong(interp, Jim_GetResult(interp), &eq) != JIM_OK) { eq = -rc; } return eq; } | < < < > | | | 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 | if (rc != JIM_OK || Jim_GetLong(interp, Jim_GetResult(interp), &eq) != JIM_OK) { eq = -rc; } return eq; } static int Jim_SwitchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { enum { SWITCH_EXACT, SWITCH_GLOB, SWITCH_RE, SWITCH_CMD }; int matchOpt = SWITCH_EXACT, opt = 1, patCount, i; Jim_Obj *command = NULL, *scriptObj = NULL, *strObj; Jim_Obj **caseList; if (argc < 3) { wrongnumargs: Jim_WrongNumArgs(interp, 1, argv, "?options? string " "pattern body ... ?default body? or " "{pattern body ?pattern body ...?}"); return JIM_ERR; } |
︙ | ︙ | |||
16745 16746 16747 16748 16749 16750 16751 | } if ((argc - opt) < 2) goto wrongnumargs; } strObj = argv[opt++]; patCount = argc - opt; if (patCount == 1) { | < < | < | | | | | < < | < | | | | | | | | | 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 | } if ((argc - opt) < 2) goto wrongnumargs; } strObj = argv[opt++]; patCount = argc - opt; if (patCount == 1) { JimListGetElements(interp, argv[opt], &patCount, &caseList); } else caseList = (Jim_Obj **)&argv[opt]; if (patCount == 0 || patCount % 2 != 0) goto wrongnumargs; for (i = 0; scriptObj == NULL && i < patCount; i += 2) { Jim_Obj *patObj = caseList[i]; if (!Jim_CompareStringImmediate(interp, patObj, "default") || i < (patCount - 2)) { switch (matchOpt) { case SWITCH_EXACT: if (Jim_StringEqObj(strObj, patObj)) scriptObj = caseList[i + 1]; break; case SWITCH_GLOB: if (Jim_StringMatchObj(interp, patObj, strObj, 0)) scriptObj = caseList[i + 1]; break; case SWITCH_RE: command = Jim_NewStringObj(interp, "regexp", -1); case SWITCH_CMD:{ int rc = Jim_CommandMatchObj(interp, command, patObj, strObj, 0); if (argc - opt == 1) { JimListGetElements(interp, argv[opt], &patCount, &caseList); } if (rc < 0) { return -rc; } if (rc) scriptObj = caseList[i + 1]; break; } } } else { scriptObj = caseList[i + 1]; } } for (; i < patCount && Jim_CompareStringImmediate(interp, scriptObj, "-"); i += 2) scriptObj = caseList[i + 1]; if (scriptObj && Jim_CompareStringImmediate(interp, scriptObj, "-")) { Jim_SetResultFormatted(interp, "no body specified for pattern \"%#s\"", caseList[i - 2]); return JIM_ERR; } Jim_SetEmptyResult(interp); if (scriptObj) { return Jim_EvalObj(interp, scriptObj); } return JIM_OK; } static int Jim_ListCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { |
︙ | ︙ | |||
16918 16919 16920 16921 16922 16923 16924 | opt_all = 1; break; case OPT_COMMAND: if (i >= argc - 2) { goto wrongargs; } commandObj = argv[++i]; | | | 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 | opt_all = 1; break; case OPT_COMMAND: if (i >= argc - 2) { goto wrongargs; } commandObj = argv[++i]; case OPT_EXACT: case OPT_GLOB: case OPT_REGEXP: opt_match = option; break; } } |
︙ | ︙ | |||
16966 16967 16968 16969 16970 16971 16972 | } rc = JIM_ERR; goto done; } break; } | | | | 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 | } rc = JIM_ERR; goto done; } break; } if (!eq && opt_bool && opt_not && !opt_all) { continue; } if ((!opt_bool && eq == !opt_not) || (opt_bool && (eq || opt_all))) { Jim_Obj *resultObj; if (opt_bool) { resultObj = Jim_NewIntObj(interp, eq ^ opt_not); } else if (!opt_inline) { resultObj = Jim_NewIntObj(interp, i); |
︙ | ︙ | |||
16999 17000 17001 17002 17003 17004 17005 | } } if (opt_all) { Jim_SetResult(interp, listObjPtr); } else { | | | 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 | } } if (opt_all) { Jim_SetResult(interp, listObjPtr); } else { if (opt_bool) { Jim_SetResultBool(interp, opt_not); } else if (!opt_inline) { Jim_SetResultInt(interp, -1); } } |
︙ | ︙ | |||
17028 17029 17030 17031 17032 17033 17034 | if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "varName ?value value ...?"); return JIM_ERR; } listObjPtr = Jim_GetVariable(interp, argv[1], JIM_UNSHARED); if (!listObjPtr) { | | | 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 | if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "varName ?value value ...?"); return JIM_ERR; } listObjPtr = Jim_GetVariable(interp, argv[1], JIM_UNSHARED); if (!listObjPtr) { listObjPtr = Jim_NewListObj(interp, NULL, 0); new_obj = 1; } else if (Jim_IsShared(listObjPtr)) { listObjPtr = Jim_DuplicateObj(interp, listObjPtr); new_obj = 1; } |
︙ | ︙ | |||
17101 17102 17103 17104 17105 17106 17107 | len = Jim_ListLength(interp, listObj); first = JimRelToAbsIndex(len, first); last = JimRelToAbsIndex(len, last); JimRelToAbsRange(len, &first, &last, &rangeLen); | < | < < < < | < < < < | < | | | > | 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 | len = Jim_ListLength(interp, listObj); first = JimRelToAbsIndex(len, first); last = JimRelToAbsIndex(len, last); JimRelToAbsRange(len, &first, &last, &rangeLen); if (first > len) { first = len; } newListObj = Jim_NewListObj(interp, listObj->internalRep.listValue.ele, first); ListInsertElements(newListObj, -1, argc - 4, argv + 4); ListInsertElements(newListObj, -1, len - first - rangeLen, listObj->internalRep.listValue.ele + first + rangeLen); Jim_SetResult(interp, newListObj); return JIM_OK; } static int Jim_LsetCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc < 3) { Jim_WrongNumArgs(interp, 1, argv, "listVar ?index...? newVal"); return JIM_ERR; } else if (argc == 3) { if (Jim_SetVariable(interp, argv[1], argv[2]) != JIM_OK) return JIM_ERR; Jim_SetResult(interp, argv[2]); return JIM_OK; } return Jim_ListSetIndex(interp, argv[1], argv + 2, argc - 3, argv[argc - 1]); } static int Jim_LsortCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const argv[]) { static const char * const options[] = { "-ascii", "-nocase", "-increasing", "-decreasing", "-command", "-integer", "-real", "-index", "-unique", NULL }; enum { OPT_ASCII, OPT_NOCASE, OPT_INCREASING, OPT_DECREASING, OPT_COMMAND, OPT_INTEGER, OPT_REAL, OPT_INDEX, OPT_UNIQUE }; Jim_Obj *resObj; int i; int retCode; int shared; struct lsort_info info; if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "?options? list"); return JIM_ERR; } |
︙ | ︙ | |||
17221 17222 17223 17224 17225 17226 17227 | return JIM_ERR; } info.indexed = 1; i++; break; } } | > > | | | 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 | return JIM_ERR; } info.indexed = 1; i++; break; } } resObj = argv[argc - 1]; if ((shared = Jim_IsShared(resObj))) resObj = Jim_DuplicateObj(interp, resObj); retCode = ListSortElements(interp, resObj, &info); if (retCode == JIM_OK) { Jim_SetResult(interp, resObj); } else if (shared) { Jim_FreeNewObj(interp, resObj); } return retCode; } static int Jim_AppendCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) |
︙ | ︙ | |||
17251 17252 17253 17254 17255 17256 17257 | if (!stringObjPtr) return JIM_ERR; } else { int new_obj = 0; stringObjPtr = Jim_GetVariable(interp, argv[1], JIM_UNSHARED); if (!stringObjPtr) { | | > | 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 | if (!stringObjPtr) return JIM_ERR; } else { int new_obj = 0; stringObjPtr = Jim_GetVariable(interp, argv[1], JIM_UNSHARED); if (!stringObjPtr) { stringObjPtr = Jim_NewEmptyStringObj(interp); new_obj = 1; } else if (Jim_IsShared(stringObjPtr)) { new_obj = 1; stringObjPtr = Jim_DuplicateObj(interp, stringObjPtr); } for (i = 2; i < argc; i++) { Jim_AppendObj(interp, stringObjPtr, argv[i]); } if (Jim_SetVariable(interp, argv[1], stringObjPtr) != JIM_OK) { if (new_obj) { Jim_FreeNewObj(interp, stringObjPtr); } return JIM_ERR; } } Jim_SetResult(interp, stringObjPtr); return JIM_OK; } static int Jim_DebugCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { #if !defined(JIM_DEBUG_COMMAND) Jim_SetResultString(interp, "unsupported", -1); return JIM_ERR; |
︙ | ︙ | |||
17300 17301 17302 17303 17304 17305 17306 | rc = Jim_EvalObj(interp, argv[1]); } else { rc = Jim_EvalObj(interp, Jim_ConcatObj(interp, argc - 1, argv + 1)); } if (rc == JIM_ERR) { | | | | | < | | < < | 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 | rc = Jim_EvalObj(interp, argv[1]); } else { rc = Jim_EvalObj(interp, Jim_ConcatObj(interp, argc - 1, argv + 1)); } if (rc == JIM_ERR) { interp->addStackTrace++; } return rc; } static int Jim_UplevelCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc >= 2) { int retcode; Jim_CallFrame *savedCallFrame, *targetCallFrame; const char *str; savedCallFrame = interp->framePtr; str = Jim_String(argv[1]); if ((str[0] >= '0' && str[0] <= '9') || str[0] == '#') { targetCallFrame = Jim_GetCallFrameByLevel(interp, argv[1]); argc--; argv++; } else { targetCallFrame = Jim_GetCallFrameByLevel(interp, NULL); } if (targetCallFrame == NULL) { return JIM_ERR; } if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv - 1, "?level? command ?arg ...?"); return JIM_ERR; } interp->framePtr = targetCallFrame; if (argc == 2) { retcode = Jim_EvalObj(interp, argv[1]); } else { retcode = Jim_EvalObj(interp, Jim_ConcatObj(interp, argc - 1, argv + 1)); } interp->framePtr = savedCallFrame; return retcode; } else { Jim_WrongNumArgs(interp, 1, argv, "?level? command ?arg ...?"); return JIM_ERR; } } static int Jim_ExprCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int retcode; if (argc == 2) { retcode = Jim_EvalExpression(interp, argv[1]); } else if (argc > 2) { Jim_Obj *objPtr; objPtr = Jim_ConcatObj(interp, argc - 1, argv + 1); Jim_IncrRefCount(objPtr); retcode = Jim_EvalExpression(interp, objPtr); Jim_DecrRefCount(interp, objPtr); } else { Jim_WrongNumArgs(interp, 1, argv, "expression ?...?"); return JIM_ERR; } if (retcode != JIM_OK) return retcode; return JIM_OK; } static int Jim_BreakCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 1) { |
︙ | ︙ | |||
17436 17437 17438 17439 17440 17441 17442 | } if (i != argc - 1 && i != argc) { Jim_WrongNumArgs(interp, 1, argv, "?-code code? ?-errorinfo stacktrace? ?-level level? ?result?"); } | | | | | | | | | 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 | } if (i != argc - 1 && i != argc) { Jim_WrongNumArgs(interp, 1, argv, "?-code code? ?-errorinfo stacktrace? ?-level level? ?result?"); } if (stackTraceObj && returnCode == JIM_ERR) { JimSetStackTrace(interp, stackTraceObj); } if (errorCodeObj && returnCode == JIM_ERR) { Jim_SetGlobalVariableStr(interp, "errorCode", errorCodeObj); } interp->returnCode = returnCode; interp->returnLevel = level; if (i == argc - 1) { Jim_SetResult(interp, argv[i]); } return JIM_RETURN; } static int Jim_TailcallCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (interp->framePtr->level == 0) { Jim_SetResultString(interp, "tailcall can only be called from a proc or lambda", -1); return JIM_ERR; } else if (argc >= 2) { Jim_CallFrame *cf = interp->framePtr->parent; Jim_Cmd *cmdPtr = Jim_GetCommand(interp, argv[1], JIM_ERRMSG); if (cmdPtr == NULL) { return JIM_ERR; } JimPanic((cf->tailcallCmd != NULL, "Already have a tailcallCmd")); JimIncrCmdRefCount(cmdPtr); cf->tailcallCmd = cmdPtr; JimPanic((cf->tailcallObj != NULL, "Already have a tailcallobj")); cf->tailcallObj = Jim_NewListObj(interp, argv + 1, argc - 1); Jim_IncrRefCount(cf->tailcallObj); return JIM_EVAL; } return JIM_OK; } static int JimAliasCmd(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *cmdList; Jim_Obj *prefixListObj = Jim_CmdPrivData(interp); cmdList = Jim_DuplicateObj(interp, prefixListObj); Jim_ListInsertElements(interp, cmdList, Jim_ListLength(interp, cmdList), argc - 1, argv + 1); return JimEvalObjList(interp, cmdList); } static void JimAliasCmdDelete(Jim_Interp *interp, void *privData) |
︙ | ︙ | |||
17550 17551 17552 17553 17554 17555 17556 | cmd = JimCreateProcedureCmd(interp, argv[2], NULL, argv[3], NULL); } else { cmd = JimCreateProcedureCmd(interp, argv[2], argv[3], argv[4], NULL); } if (cmd) { | | | | | | | 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 | cmd = JimCreateProcedureCmd(interp, argv[2], NULL, argv[3], NULL); } else { cmd = JimCreateProcedureCmd(interp, argv[2], argv[3], argv[4], NULL); } if (cmd) { Jim_Obj *qualifiedCmdNameObj; const char *cmdname = JimQualifyName(interp, Jim_String(argv[1]), &qualifiedCmdNameObj); JimCreateCommand(interp, cmdname, cmd); JimUpdateProcNamespace(interp, cmd, cmdname); JimFreeQualifiedName(interp, qualifiedCmdNameObj); Jim_SetResult(interp, argv[1]); return JIM_OK; } return JIM_ERR; } static int Jim_LocalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int retcode; if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "cmd ?args ...?"); return JIM_ERR; } interp->local++; retcode = Jim_EvalObjVector(interp, argc - 1, argv + 1); interp->local--; if (retcode == 0) { Jim_Obj *cmdNameObj = Jim_GetResult(interp); if (Jim_GetCommand(interp, cmdNameObj, JIM_ERRMSG) == NULL) { return JIM_ERR; } if (interp->framePtr->localCommands == NULL) { |
︙ | ︙ | |||
17617 17618 17619 17620 17621 17622 17623 | int retcode; Jim_Cmd *cmdPtr = Jim_GetCommand(interp, argv[1], JIM_ERRMSG); if (cmdPtr == NULL || !cmdPtr->isproc || !cmdPtr->prevCmd) { Jim_SetResultFormatted(interp, "no previous command: \"%#s\"", argv[1]); return JIM_ERR; } | | | | | 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 | int retcode; Jim_Cmd *cmdPtr = Jim_GetCommand(interp, argv[1], JIM_ERRMSG); if (cmdPtr == NULL || !cmdPtr->isproc || !cmdPtr->prevCmd) { Jim_SetResultFormatted(interp, "no previous command: \"%#s\"", argv[1]); return JIM_ERR; } cmdPtr->u.proc.upcall++; JimIncrCmdRefCount(cmdPtr); retcode = Jim_EvalObjVector(interp, argc - 1, argv + 1); cmdPtr->u.proc.upcall--; JimDecrCmdRefCount(interp, cmdPtr); return retcode; } } |
︙ | ︙ | |||
17655 17656 17657 17658 17659 17660 17661 | if (len != 2 && len != 3) { Jim_SetResultFormatted(interp, "can't interpret \"%#s\" as a lambda expression", argv[1]); return JIM_ERR; } if (len == 3) { #ifdef jim_ext_namespace | | | | 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 | if (len != 2 && len != 3) { Jim_SetResultFormatted(interp, "can't interpret \"%#s\" as a lambda expression", argv[1]); return JIM_ERR; } if (len == 3) { #ifdef jim_ext_namespace nsObj = JimQualifyNameObj(interp, Jim_ListGetIndex(interp, argv[1], 2)); #else Jim_SetResultString(interp, "namespaces not enabled", -1); return JIM_ERR; #endif } argListObjPtr = Jim_ListGetIndex(interp, argv[1], 0); bodyObjPtr = Jim_ListGetIndex(interp, argv[1], 1); cmd = JimCreateProcedureCmd(interp, argListObjPtr, NULL, bodyObjPtr, nsObj); if (cmd) { nargv = Jim_Alloc((argc - 2 + 1) * sizeof(*nargv)); nargv[0] = Jim_NewStringObj(interp, "apply lambdaExpr", -1); Jim_IncrRefCount(nargv[0]); memcpy(&nargv[1], argv + 2, (argc - 2) * sizeof(*nargv)); ret = JimCallProcedure(interp, cmd, argc - 2 + 1, nargv); Jim_DecrRefCount(interp, nargv[0]); Jim_Free(nargv); |
︙ | ︙ | |||
17698 17699 17700 17701 17702 17703 17704 | static int Jim_UpvarCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; Jim_CallFrame *targetCallFrame; | | | | | | | | 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 | static int Jim_UpvarCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; Jim_CallFrame *targetCallFrame; if (argc > 3 && (argc % 2 == 0)) { targetCallFrame = Jim_GetCallFrameByLevel(interp, argv[1]); argc--; argv++; } else { targetCallFrame = Jim_GetCallFrameByLevel(interp, NULL); } if (targetCallFrame == NULL) { return JIM_ERR; } if (argc < 3) { Jim_WrongNumArgs(interp, 1, argv, "?level? otherVar localVar ?otherVar localVar ...?"); return JIM_ERR; } for (i = 1; i < argc; i += 2) { if (Jim_SetVariableLink(interp, argv[i + 1], argv[i], targetCallFrame) != JIM_OK) return JIM_ERR; } return JIM_OK; } static int Jim_GlobalCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int i; if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "varName ?varName ...?"); return JIM_ERR; } if (interp->framePtr->level == 0) return JIM_OK; for (i = 1; i < argc; i++) { const char *name = Jim_String(argv[i]); if (name[0] != ':' || name[1] != ':') { if (Jim_SetVariableLink(interp, argv[i], argv[i], interp->topFramePtr) != JIM_OK) return JIM_ERR; } } return JIM_OK; |
︙ | ︙ | |||
17765 17766 17767 17768 17769 17770 17771 | Jim_SetResultString(interp, "list must contain an even number of elements", -1); return NULL; } str = Jim_String(objPtr); strLen = Jim_Utf8Length(interp, objPtr); | | | | | | | | 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 | Jim_SetResultString(interp, "list must contain an even number of elements", -1); return NULL; } str = Jim_String(objPtr); strLen = Jim_Utf8Length(interp, objPtr); resultObjPtr = Jim_NewStringObj(interp, "", 0); while (strLen) { for (i = 0; i < numMaps; i += 2) { Jim_Obj *eachObjPtr; const char *k; int kl; eachObjPtr = Jim_ListGetIndex(interp, mapListObjPtr, i); k = Jim_String(eachObjPtr); kl = Jim_Utf8Length(interp, eachObjPtr); if (strLen >= kl && kl) { int rc; rc = JimStringCompareLen(str, k, kl, nocase); if (rc == 0) { if (noMatchStart) { Jim_AppendString(interp, resultObjPtr, noMatchStart, str - noMatchStart); noMatchStart = NULL; } Jim_AppendObj(interp, resultObjPtr, Jim_ListGetIndex(interp, mapListObjPtr, i + 1)); str += utf8_index(str, kl); strLen -= kl; break; } } } if (i == numMaps) { int c; if (noMatchStart == NULL) noMatchStart = str; str += utf8_tounicode(str, &c); strLen--; } } |
︙ | ︙ | |||
17836 17837 17838 17839 17840 17841 17842 | if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "option ?arguments ...?"); return JIM_ERR; } if (Jim_GetEnum(interp, argv[1], options, &option, NULL, JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) | | | | | | | | 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 | if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "option ?arguments ...?"); return JIM_ERR; } if (Jim_GetEnum(interp, argv[1], options, &option, NULL, JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) return Jim_CheckShowCommands(interp, argv[1], options); switch (option) { case OPT_LENGTH: case OPT_BYTELENGTH: if (argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "string"); return JIM_ERR; } if (option == OPT_LENGTH) { len = Jim_Utf8Length(interp, argv[2]); } else { len = Jim_Length(argv[2]); } Jim_SetResultInt(interp, len); return JIM_OK; case OPT_CAT:{ Jim_Obj *objPtr; if (argc == 3) { objPtr = argv[2]; } else { int i; objPtr = Jim_NewStringObj(interp, "", 0); for (i = 2; i < argc; i++) { Jim_AppendObj(interp, objPtr, argv[i]); } } Jim_SetResult(interp, objPtr); return JIM_OK; } case OPT_COMPARE: case OPT_EQUAL: { long opt_length = -1; int n = argc - 4; int i = 2; while (n > 0) { int subopt; if (Jim_GetEnum(interp, argv[i++], nocase_length_options, &subopt, NULL, JIM_ENUM_ABBREV) != JIM_OK) { badcompareargs: Jim_WrongNumArgs(interp, 2, argv, "?-nocase? ?-length int? string1 string2"); return JIM_ERR; } if (subopt == 0) { opt_case = 0; n--; } else { if (n < 2) { goto badcompareargs; } if (Jim_GetLong(interp, argv[i++], &opt_length) != JIM_OK) { return JIM_ERR; } n -= 2; } } if (n) { goto badcompareargs; } argv += argc - 2; if (opt_length < 0 && option != OPT_COMPARE && opt_case) { Jim_SetResultBool(interp, Jim_StringEqObj(argv[0], argv[1])); } else { if (opt_length >= 0) { n = JimStringCompareLen(Jim_String(argv[0]), Jim_String(argv[1]), opt_length, !opt_case); } else { |
︙ | ︙ | |||
18023 18024 18025 18026 18027 18028 18029 | Jim_SetResult(interp, objPtr); return JIM_OK; } case OPT_REVERSE:{ char *buf, *p; const char *str; | < | 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 | Jim_SetResult(interp, objPtr); return JIM_OK; } case OPT_REVERSE:{ char *buf, *p; const char *str; int i; if (argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "string"); return JIM_ERR; } |
︙ | ︙ | |||
18067 18068 18069 18070 18071 18072 18073 | if (idx != INT_MIN && idx != INT_MAX) { idx = JimRelToAbsIndex(len, idx); } if (idx < 0 || idx >= len || str == NULL) { Jim_SetResultString(interp, "", 0); } else if (len == Jim_Length(argv[2])) { | | | 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 | if (idx != INT_MIN && idx != INT_MAX) { idx = JimRelToAbsIndex(len, idx); } if (idx < 0 || idx >= len || str == NULL) { Jim_SetResultString(interp, "", 0); } else if (len == Jim_Length(argv[2])) { Jim_SetResultString(interp, str + idx, 1); } else { int c; int i = utf8_index(str, idx); Jim_SetResultString(interp, str + i, utf8_tounicode(str + i, &c)); } |
︙ | ︙ | |||
18221 18222 18223 18224 18225 18226 18227 | static int Jim_CatchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int exitCode = 0; int i; int sig = 0; | | | | 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 | static int Jim_CatchCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int exitCode = 0; int i; int sig = 0; jim_wide ignore_mask = (1 << JIM_EXIT) | (1 << JIM_EVAL) | (1 << JIM_SIGNAL); static const int max_ignore_code = sizeof(ignore_mask) * 8; Jim_SetGlobalVariableStr(interp, "errorCode", Jim_NewStringObj(interp, "NONE", -1)); for (i = 1; i < argc - 1; i++) { const char *arg = Jim_String(argv[i]); jim_wide option; int ignore; if (strcmp(arg, "--") == 0) { i++; break; } if (*arg != '-') { break; } |
︙ | ︙ | |||
18283 18284 18285 18286 18287 18288 18289 | if ((ignore_mask & (1 << JIM_SIGNAL)) == 0) { sig++; } interp->signal_level += sig; if (Jim_CheckSignal(interp)) { | | | | | | | 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 | if ((ignore_mask & (1 << JIM_SIGNAL)) == 0) { sig++; } interp->signal_level += sig; if (Jim_CheckSignal(interp)) { exitCode = JIM_SIGNAL; } else { exitCode = Jim_EvalObj(interp, argv[0]); interp->errorFlag = 0; } interp->signal_level -= sig; if (exitCode >= 0 && exitCode < max_ignore_code && (((unsigned jim_wide)1 << exitCode) & ignore_mask)) { return exitCode; } if (sig && exitCode == JIM_SIGNAL) { if (interp->signal_set_result) { interp->signal_set_result(interp, interp->sigmask); } else { Jim_SetResultInt(interp, interp->sigmask); } interp->sigmask = 0; |
︙ | ︙ | |||
18343 18344 18345 18346 18347 18348 18349 | } } } Jim_SetResultInt(interp, exitCode); return JIM_OK; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | < | < | < < | > > > | | < | < < | > > > > > | | < | | | < < | < | < | > | | < | < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > | | | | | > > | | > | < | > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 | } } } Jim_SetResultInt(interp, exitCode); return JIM_OK; } static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (argc != 3) { Jim_WrongNumArgs(interp, 1, argv, "oldName newName"); return JIM_ERR; } if (JimValidName(interp, "new procedure", argv[2])) { return JIM_ERR; } return Jim_RenameCommand(interp, Jim_String(argv[1]), Jim_String(argv[2])); } #define JIM_DICTMATCH_KEYS 0x0001 #define JIM_DICTMATCH_VALUES 0x002 int Jim_DictMatchTypes(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *patternObj, int match_type, int return_types) { Jim_HashEntry *he; Jim_Obj *listObjPtr; Jim_HashTableIterator htiter; if (SetDictFromAny(interp, objPtr) != JIM_OK) { return JIM_ERR; } listObjPtr = Jim_NewListObj(interp, NULL, 0); JimInitHashTableIterator(objPtr->internalRep.ptr, &htiter); while ((he = Jim_NextHashEntry(&htiter)) != NULL) { if (patternObj) { Jim_Obj *matchObj = (match_type == JIM_DICTMATCH_KEYS) ? (Jim_Obj *)he->key : Jim_GetHashEntryVal(he); if (!JimGlobMatch(Jim_String(patternObj), Jim_String(matchObj), 0)) { continue; } } if (return_types & JIM_DICTMATCH_KEYS) { Jim_ListAppendElement(interp, listObjPtr, (Jim_Obj *)he->key); } if (return_types & JIM_DICTMATCH_VALUES) { Jim_ListAppendElement(interp, listObjPtr, Jim_GetHashEntryVal(he)); } } Jim_SetResult(interp, listObjPtr); return JIM_OK; } int Jim_DictSize(Jim_Interp *interp, Jim_Obj *objPtr) { if (SetDictFromAny(interp, objPtr) != JIM_OK) { return -1; } return ((Jim_HashTable *)objPtr->internalRep.ptr)->used; } Jim_Obj *Jim_DictMerge(Jim_Interp *interp, int objc, Jim_Obj *const *objv) { Jim_Obj *objPtr = Jim_NewDictObj(interp, NULL, 0); int i; JimPanic((objc == 0, "Jim_DictMerge called with objc=0")); for (i = 0; i < objc; i++) { Jim_HashTable *ht; Jim_HashTableIterator htiter; Jim_HashEntry *he; if (SetDictFromAny(interp, objv[i]) != JIM_OK) { Jim_FreeNewObj(interp, objPtr); return NULL; } ht = objv[i]->internalRep.ptr; JimInitHashTableIterator(ht, &htiter); while ((he = Jim_NextHashEntry(&htiter)) != NULL) { Jim_ReplaceHashEntry(objPtr->internalRep.ptr, Jim_GetHashEntryKey(he), Jim_GetHashEntryVal(he)); } } return objPtr; } int Jim_DictInfo(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_HashTable *ht; unsigned int i; char buffer[100]; int sum = 0; int nonzero_count = 0; Jim_Obj *output; int bucket_counts[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (SetDictFromAny(interp, objPtr) != JIM_OK) { return JIM_ERR; } ht = (Jim_HashTable *)objPtr->internalRep.ptr; snprintf(buffer, sizeof(buffer), "%d entries in table, %d buckets\n", ht->used, ht->size); output = Jim_NewStringObj(interp, buffer, -1); for (i = 0; i < ht->size; i++) { Jim_HashEntry *he = ht->table[i]; int entries = 0; while (he) { entries++; he = he->next; } if (entries > 9) { bucket_counts[10]++; } else { bucket_counts[entries]++; } if (entries) { sum += entries; nonzero_count++; } } for (i = 0; i < 10; i++) { snprintf(buffer, sizeof(buffer), "number of buckets with %d entries: %d\n", i, bucket_counts[i]); Jim_AppendString(interp, output, buffer, -1); } snprintf(buffer, sizeof(buffer), "number of buckets with 10 or more entries: %d\n", bucket_counts[10]); Jim_AppendString(interp, output, buffer, -1); snprintf(buffer, sizeof(buffer), "average search distance for entry: %.1f", nonzero_count ? (double)sum / nonzero_count : 0.0); Jim_AppendString(interp, output, buffer, -1); Jim_SetResult(interp, output); return JIM_OK; } static int Jim_EvalEnsemble(Jim_Interp *interp, const char *basecmd, const char *subcmd, int argc, Jim_Obj *const *argv) { Jim_Obj *prefixObj = Jim_NewStringObj(interp, basecmd, -1); Jim_AppendString(interp, prefixObj, " ", 1); Jim_AppendString(interp, prefixObj, subcmd, -1); return Jim_EvalObjPrefix(interp, prefixObj, argc, argv); } static int JimDictWith(Jim_Interp *interp, Jim_Obj *dictVarName, Jim_Obj *const *keyv, int keyc, Jim_Obj *scriptObj) { int i; Jim_Obj *objPtr; Jim_Obj *dictObj; Jim_Obj **dictValues; int len; int ret = JIM_OK; dictObj = Jim_GetVariable(interp, dictVarName, JIM_ERRMSG); if (dictObj == NULL || Jim_DictKeysVector(interp, dictObj, keyv, keyc, &objPtr, JIM_ERRMSG) != JIM_OK) { return JIM_ERR; } if (Jim_DictPairs(interp, objPtr, &dictValues, &len) == JIM_ERR) { return JIM_ERR; } for (i = 0; i < len; i += 2) { if (Jim_SetVariable(interp, dictValues[i], dictValues[i + 1]) == JIM_ERR) { Jim_Free(dictValues); return JIM_ERR; } } if (Jim_Length(scriptObj)) { ret = Jim_EvalObj(interp, scriptObj); if (ret == JIM_OK && Jim_GetVariable(interp, dictVarName, 0) != NULL) { Jim_Obj **newkeyv = Jim_Alloc(sizeof(*newkeyv) * (keyc + 1)); for (i = 0; i < keyc; i++) { newkeyv[i] = keyv[i]; } for (i = 0; i < len; i += 2) { objPtr = Jim_GetVariable(interp, dictValues[i], 0); newkeyv[keyc] = dictValues[i]; Jim_SetDictKeysVector(interp, dictVarName, newkeyv, keyc + 1, objPtr, 0); } Jim_Free(newkeyv); } } Jim_Free(dictValues); return ret; } static int Jim_DictCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *objPtr; int types = JIM_DICTMATCH_KEYS; int option; static const char * const options[] = { "create", "get", "set", "unset", "exists", "keys", "size", "info", "merge", "with", "append", "lappend", "incr", "remove", "values", "for", "replace", "update", NULL }; enum { OPT_CREATE, OPT_GET, OPT_SET, OPT_UNSET, OPT_EXISTS, OPT_KEYS, OPT_SIZE, OPT_INFO, OPT_MERGE, OPT_WITH, OPT_APPEND, OPT_LAPPEND, OPT_INCR, OPT_REMOVE, OPT_VALUES, OPT_FOR, OPT_REPLACE, OPT_UPDATE, }; if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "subcommand ?arguments ...?"); return JIM_ERR; } if (Jim_GetEnum(interp, argv[1], options, &option, "subcommand", JIM_ERRMSG) != JIM_OK) { return Jim_CheckShowCommands(interp, argv[1], options); } switch (option) { case OPT_GET: if (argc < 3) { Jim_WrongNumArgs(interp, 2, argv, "dictionary ?key ...?"); return JIM_ERR; |
︙ | ︙ | |||
18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 | return JIM_ERR; } if (Jim_SetDictKeysVector(interp, argv[2], argv + 3, argc - 3, NULL, 0) != JIM_OK) { return JIM_ERR; } return JIM_OK; case OPT_KEYS: if (argc != 3 && argc != 4) { Jim_WrongNumArgs(interp, 2, argv, "dictionary ?pattern?"); return JIM_ERR; } | > > > | | > | | | | > > > > | > > > | 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 | return JIM_ERR; } if (Jim_SetDictKeysVector(interp, argv[2], argv + 3, argc - 3, NULL, 0) != JIM_OK) { return JIM_ERR; } return JIM_OK; case OPT_VALUES: types = JIM_DICTMATCH_VALUES; case OPT_KEYS: if (argc != 3 && argc != 4) { Jim_WrongNumArgs(interp, 2, argv, "dictionary ?pattern?"); return JIM_ERR; } return Jim_DictMatchTypes(interp, argv[2], argc == 4 ? argv[3] : NULL, types, types); case OPT_SIZE: if (argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "dictionary"); return JIM_ERR; } else if (Jim_DictSize(interp, argv[2]) < 0) { return JIM_ERR; } Jim_SetResultInt(interp, Jim_DictSize(interp, argv[2])); return JIM_OK; case OPT_MERGE: if (argc == 2) { return JIM_OK; } objPtr = Jim_DictMerge(interp, argc - 2, argv + 2); if (objPtr == NULL) { return JIM_ERR; } Jim_SetResult(interp, objPtr); return JIM_OK; case OPT_UPDATE: if (argc < 6 || argc % 2) { argc = 2; } break; case OPT_CREATE: if (argc % 2) { Jim_WrongNumArgs(interp, 2, argv, "?key value ...?"); return JIM_ERR; } objPtr = Jim_NewDictObj(interp, argv + 2, argc - 2); Jim_SetResult(interp, objPtr); return JIM_OK; case OPT_INFO: if (argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "dictionary"); return JIM_ERR; } return Jim_DictInfo(interp, argv[2]); case OPT_WITH: if (argc < 4) { Jim_WrongNumArgs(interp, 2, argv, "dictVar ?key ...? script"); return JIM_ERR; } return JimDictWith(interp, argv[2], argv + 3, argc - 4, argv[argc - 1]); } return Jim_EvalEnsemble(interp, "dict", options[option], argc - 2, argv + 2); } static int Jim_SubstCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { static const char * const options[] = { |
︙ | ︙ | |||
18762 18763 18764 18765 18766 18767 18768 | INFO_RETURNCODES, INFO_REFERENCES, INFO_ALIAS, }; #ifdef jim_ext_namespace int nons = 0; if (argc > 2 && Jim_CompareStringImmediate(interp, argv[1], "-nons")) { | | | < | | | 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 | INFO_RETURNCODES, INFO_REFERENCES, INFO_ALIAS, }; #ifdef jim_ext_namespace int nons = 0; if (argc > 2 && Jim_CompareStringImmediate(interp, argv[1], "-nons")) { argc--; argv++; nons = 1; } #endif if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "subcommand ?args ...?"); return JIM_ERR; } if (Jim_GetEnum(interp, argv[1], commands, &cmd, "subcommand", JIM_ERRMSG | JIM_ENUM_ABBREV) != JIM_OK) { return Jim_CheckShowCommands(interp, argv[1], commands); } switch (cmd) { case INFO_EXISTS: if (argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "varName"); return JIM_ERR; } Jim_SetResultBool(interp, Jim_GetVariable(interp, argv[2], 0) != NULL); |
︙ | ︙ | |||
18807 18808 18809 18810 18811 18812 18813 | return JIM_ERR; } Jim_SetResult(interp, (Jim_Obj *)cmdPtr->u.native.privData); return JIM_OK; } case INFO_CHANNELS: | | | | | | | | | | | | 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 | return JIM_ERR; } Jim_SetResult(interp, (Jim_Obj *)cmdPtr->u.native.privData); return JIM_OK; } case INFO_CHANNELS: mode++; #ifndef jim_ext_aio Jim_SetResultString(interp, "aio not enabled", -1); return JIM_ERR; #endif case INFO_PROCS: mode++; case INFO_COMMANDS: if (argc != 2 && argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "?pattern?"); return JIM_ERR; } #ifdef jim_ext_namespace if (!nons) { if (Jim_Length(interp->framePtr->nsObj) || (argc == 3 && JimGlobMatch("::*", Jim_String(argv[2]), 0))) { return Jim_EvalPrefix(interp, "namespace info", argc - 1, argv + 1); } } #endif Jim_SetResult(interp, JimCommandsList(interp, (argc == 3) ? argv[2] : NULL, mode)); break; case INFO_VARS: mode++; case INFO_LOCALS: mode++; case INFO_GLOBALS: if (argc != 2 && argc != 3) { Jim_WrongNumArgs(interp, 2, argv, "?pattern?"); return JIM_ERR; } #ifdef jim_ext_namespace if (!nons) { if (Jim_Length(interp->framePtr->nsObj) || (argc == 3 && JimGlobMatch("::*", Jim_String(argv[2]), 0))) { |
︙ | ︙ | |||
18949 18950 18951 18952 18953 18954 18955 | Jim_SetResult(interp, cmdPtr->u.proc.bodyObjPtr); break; case INFO_ARGS: Jim_SetResult(interp, cmdPtr->u.proc.argListObjPtr); break; case INFO_STATICS: if (cmdPtr->u.proc.staticVars) { | < | | 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 | Jim_SetResult(interp, cmdPtr->u.proc.bodyObjPtr); break; case INFO_ARGS: Jim_SetResult(interp, cmdPtr->u.proc.argListObjPtr); break; case INFO_STATICS: if (cmdPtr->u.proc.staticVars) { Jim_SetResult(interp, JimHashtablePatternMatch(interp, cmdPtr->u.proc.staticVars, NULL, JimVariablesMatch, JIM_VARLIST_LOCALS | JIM_VARLIST_VALUES)); } break; } break; } case INFO_VERSION: |
︙ | ︙ | |||
18983 18984 18985 18986 18987 18988 18989 | if (missing != ' ' && argc == 4) { Jim_SetVariable(interp, argv[3], Jim_NewStringObj(interp, &missing, 1)); } } break; case INFO_HOSTNAME: | | | | 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 | if (missing != ' ' && argc == 4) { Jim_SetVariable(interp, argv[3], Jim_NewStringObj(interp, &missing, 1)); } } break; case INFO_HOSTNAME: return Jim_Eval(interp, "os.gethostname"); case INFO_NAMEOFEXECUTABLE: return Jim_Eval(interp, "{info nameofexecutable}"); case INFO_RETURNCODES: if (argc == 2) { int i; Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0); |
︙ | ︙ | |||
19068 19069 19070 19071 19072 19073 19074 | return JIM_ERR; } if (option == OPT_VAR) { result = Jim_GetVariable(interp, objPtr, 0) != NULL; } else { | | | 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 | return JIM_ERR; } if (option == OPT_VAR) { result = Jim_GetVariable(interp, objPtr, 0) != NULL; } else { Jim_Cmd *cmd = Jim_GetCommand(interp, objPtr, JIM_NONE); if (cmd) { switch (option) { case OPT_COMMAND: result = 1; break; |
︙ | ︙ | |||
19111 19112 19113 19114 19115 19116 19117 | str = Jim_GetString(argv[1], &len); if (len == 0) { return JIM_OK; } strLen = Jim_Utf8Length(interp, argv[1]); | | | | 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 | str = Jim_GetString(argv[1], &len); if (len == 0) { return JIM_OK; } strLen = Jim_Utf8Length(interp, argv[1]); if (argc == 2) { splitChars = " \n\t\r"; splitLen = 4; } else { splitChars = Jim_String(argv[2]); splitLen = Jim_Utf8Length(interp, argv[2]); } noMatchStart = str; resObjPtr = Jim_NewListObj(interp, NULL, 0); if (splitLen) { Jim_Obj *objPtr; while (strLen--) { const char *sc = splitChars; int scLen = splitLen; int sl = utf8_tounicode(str, &c); while (scLen--) { |
︙ | ︙ | |||
19153 19154 19155 19156 19157 19158 19159 | else { Jim_Obj **commonObj = NULL; #define NUM_COMMON (128 - 9) while (strLen--) { int n = utf8_tounicode(str, &c); #ifdef JIM_OPTIMIZATION if (c >= 9 && c < 128) { | | | 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 | else { Jim_Obj **commonObj = NULL; #define NUM_COMMON (128 - 9) while (strLen--) { int n = utf8_tounicode(str, &c); #ifdef JIM_OPTIMIZATION if (c >= 9 && c < 128) { c -= 9; if (!commonObj) { commonObj = Jim_Alloc(sizeof(*commonObj) * NUM_COMMON); memset(commonObj, 0, sizeof(*commonObj) * NUM_COMMON); } if (!commonObj[c]) { commonObj[c] = Jim_NewStringObj(interp, str, 1); |
︙ | ︙ | |||
19187 19188 19189 19190 19191 19192 19193 | const char *joinStr; int joinStrLen; if (argc != 2 && argc != 3) { Jim_WrongNumArgs(interp, 1, argv, "list ?joinString?"); return JIM_ERR; } | | | 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 | const char *joinStr; int joinStrLen; if (argc != 2 && argc != 3) { Jim_WrongNumArgs(interp, 1, argv, "list ?joinString?"); return JIM_ERR; } if (argc == 2) { joinStr = " "; joinStrLen = 1; } else { joinStr = Jim_GetString(argv[2], &joinStrLen); } |
︙ | ︙ | |||
19466 19467 19468 19469 19470 19471 19472 | return 0; else if (step > 0 && start > end) return -1; else if (step < 0 && end > start) return -1; len = end - start; if (len < 0) | | | | 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 | return 0; else if (step > 0 && start > end) return -1; else if (step < 0 && end > start) return -1; len = end - start; if (len < 0) len = -len; if (step < 0) step = -step; len = 1 + ((len - 1) / step); if (len > INT_MAX) len = INT_MAX; return (int)((len < 0) ? -1 : len); } |
︙ | ︙ | |||
19642 19643 19644 19645 19646 19647 19648 | argv[0] = Jim_NewStringObj(interp, "errorInfo", -1); argv[1] = interp->result; Jim_EvalObjVector(interp, 2, argv); } | < | | > > > > > > > > > > > > > > > | | | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | > > > > > > > > | 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 | argv[0] = Jim_NewStringObj(interp, "errorInfo", -1); argv[1] = interp->result; Jim_EvalObjVector(interp, 2, argv); } static char **JimSortStringTable(const char *const *tablePtr) { int count; char **tablePtrSorted; for (count = 0; tablePtr[count]; count++) { } tablePtrSorted = Jim_Alloc(sizeof(char *) * (count + 1)); memcpy(tablePtrSorted, tablePtr, sizeof(char *) * count); qsort(tablePtrSorted, count, sizeof(char *), qsortCompareStringPointers); tablePtrSorted[count] = NULL; return tablePtrSorted; } static void JimSetFailedEnumResult(Jim_Interp *interp, const char *arg, const char *badtype, const char *prefix, const char *const *tablePtr, const char *name) { char **tablePtrSorted; int i; if (name == NULL) { name = "option"; } Jim_SetResultFormatted(interp, "%s%s \"%s\": must be ", badtype, name, arg); tablePtrSorted = JimSortStringTable(tablePtr); for (i = 0; tablePtrSorted[i]; i++) { if (tablePtrSorted[i + 1] == NULL && i > 0) { Jim_AppendString(interp, Jim_GetResult(interp), "or ", -1); } Jim_AppendStrings(interp, Jim_GetResult(interp), prefix, tablePtrSorted[i], NULL); if (tablePtrSorted[i + 1]) { Jim_AppendString(interp, Jim_GetResult(interp), ", ", -1); } } Jim_Free(tablePtrSorted); } int Jim_CheckShowCommands(Jim_Interp *interp, Jim_Obj *objPtr, const char *const *tablePtr) { if (Jim_CompareStringImmediate(interp, objPtr, "-commands")) { int i; char **tablePtrSorted = JimSortStringTable(tablePtr); Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0)); for (i = 0; tablePtrSorted[i]; i++) { Jim_ListAppendElement(interp, Jim_GetResult(interp), Jim_NewStringObj(interp, tablePtrSorted[i], -1)); } Jim_Free(tablePtrSorted); return JIM_OK; } return JIM_ERR; } static const Jim_ObjType getEnumObjType = { "get-enum", NULL, NULL, NULL, JIM_TYPE_REFERENCES }; int Jim_GetEnum(Jim_Interp *interp, Jim_Obj *objPtr, const char *const *tablePtr, int *indexPtr, const char *name, int flags) { const char *bad = "bad "; const char *const *entryPtr = NULL; int i; int match = -1; int arglen; const char *arg; if (objPtr->typePtr == &getEnumObjType) { if (objPtr->internalRep.ptrIntValue.ptr == tablePtr && objPtr->internalRep.ptrIntValue.int1 == flags) { *indexPtr = objPtr->internalRep.ptrIntValue.int2; return JIM_OK; } } arg = Jim_GetString(objPtr, &arglen); *indexPtr = -1; for (entryPtr = tablePtr, i = 0; *entryPtr != NULL; entryPtr++, i++) { if (Jim_CompareStringImmediate(interp, objPtr, *entryPtr)) { match = i; goto found; } if (flags & JIM_ENUM_ABBREV) { if (strncmp(arg, *entryPtr, arglen) == 0) { if (*arg == '-' && arglen == 1) { break; } if (match >= 0) { bad = "ambiguous "; goto ambiguous; } match = i; } } } if (match >= 0) { found: Jim_FreeIntRep(interp, objPtr); objPtr->typePtr = &getEnumObjType; objPtr->internalRep.ptrIntValue.ptr = (void *)tablePtr; objPtr->internalRep.ptrIntValue.int1 = flags; objPtr->internalRep.ptrIntValue.int2 = match; *indexPtr = match; return JIM_OK; } ambiguous: if (flags & JIM_ERRMSG) { JimSetFailedEnumResult(interp, arg, bad, "", tablePtr, name); |
︙ | ︙ | |||
19741 19742 19743 19744 19745 19746 19747 | int Jim_IsList(Jim_Obj *objPtr) { return objPtr->typePtr == &listObjType; } void Jim_SetResultFormatted(Jim_Interp *interp, const char *format, ...) { | | > > > > > > > > | 19634 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 | int Jim_IsList(Jim_Obj *objPtr) { return objPtr->typePtr == &listObjType; } void Jim_SetResultFormatted(Jim_Interp *interp, const char *format, ...) { int len = strlen(format); int extra = 0; int n = 0; const char *params[5]; int nobjparam = 0; Jim_Obj *objparam[5]; char *buf; va_list args; int i; va_start(args, format); for (i = 0; i < len && n < 5; i++) { int l; if (strncmp(format + i, "%s", 2) == 0) { params[n] = va_arg(args, char *); l = strlen(params[n]); } else if (strncmp(format + i, "%#s", 3) == 0) { Jim_Obj *objPtr = va_arg(args, Jim_Obj *); params[n] = Jim_GetString(objPtr, &l); objparam[nobjparam++] = objPtr; Jim_IncrRefCount(objPtr); } else { if (format[i] == '%') { i++; } continue; } n++; extra += l; } len += extra; buf = Jim_Alloc(len + 1); len = snprintf(buf, len + 1, format, params[0], params[1], params[2], params[3], params[4]); va_end(args); Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, buf, len)); for (i = 0; i < nobjparam; i++) { Jim_DecrRefCount(interp, objparam[i]); } } #ifndef jim_ext_package int Jim_PackageProvide(Jim_Interp *interp, const char *name, const char *ver, int flags) { return JIM_OK; |
︙ | ︙ | |||
19806 19807 19808 19809 19810 19811 19812 | #include <stdio.h> #include <string.h> static int subcmd_null(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { | | | 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 | #include <stdio.h> #include <string.h> static int subcmd_null(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { return JIM_OK; } static const jim_subcmd_type dummy_subcmd = { "dummy", NULL, subcmd_null, 0, 0, JIM_MODFLAG_HIDDEN }; |
︙ | ︙ | |||
19829 19830 19831 19832 19833 19834 19835 | } } } static void bad_subcmd(Jim_Interp *interp, const jim_subcmd_type * command_table, const char *type, Jim_Obj *cmd, Jim_Obj *subcmd) { | < < | < < | > > > > > > > > < < < < | < | | > > > > > > > > | | | | | | | | | | | | > > > > > > > | | | 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 | } } } static void bad_subcmd(Jim_Interp *interp, const jim_subcmd_type * command_table, const char *type, Jim_Obj *cmd, Jim_Obj *subcmd) { Jim_SetResultFormatted(interp, "%#s, %s command \"%#s\": should be ", cmd, type, subcmd); add_commands(interp, command_table, ", "); } static void show_cmd_usage(Jim_Interp *interp, const jim_subcmd_type * command_table, int argc, Jim_Obj *const *argv) { Jim_SetResultFormatted(interp, "Usage: \"%#s command ... \", where command is one of: ", argv[0]); add_commands(interp, command_table, ", "); } static void add_cmd_usage(Jim_Interp *interp, const jim_subcmd_type * ct, Jim_Obj *cmd) { if (cmd) { Jim_AppendStrings(interp, Jim_GetResult(interp), Jim_String(cmd), " ", NULL); } Jim_AppendStrings(interp, Jim_GetResult(interp), ct->cmd, NULL); if (ct->args && *ct->args) { Jim_AppendStrings(interp, Jim_GetResult(interp), " ", ct->args, NULL); } } static void set_wrong_args(Jim_Interp *interp, const jim_subcmd_type * command_table, Jim_Obj *subcmd) { Jim_SetResultString(interp, "wrong # args: should be \"", -1); add_cmd_usage(interp, command_table, subcmd); Jim_AppendStrings(interp, Jim_GetResult(interp), "\"", NULL); } static const Jim_ObjType subcmdLookupObjType = { "subcmd-lookup", NULL, NULL, NULL, JIM_TYPE_REFERENCES }; const jim_subcmd_type *Jim_ParseSubCmd(Jim_Interp *interp, const jim_subcmd_type * command_table, int argc, Jim_Obj *const *argv) { const jim_subcmd_type *ct; const jim_subcmd_type *partial = 0; int cmdlen; Jim_Obj *cmd; const char *cmdstr; int help = 0; if (argc < 2) { Jim_SetResultFormatted(interp, "wrong # args: should be \"%#s command ...\"\n" "Use \"%#s -help ?command?\" for help", argv[0], argv[0]); return 0; } cmd = argv[1]; if (cmd->typePtr == &subcmdLookupObjType) { if (cmd->internalRep.ptrIntValue.ptr == command_table) { ct = command_table + cmd->internalRep.ptrIntValue.int1; goto found; } } if (Jim_CompareStringImmediate(interp, cmd, "-help")) { if (argc == 2) { show_cmd_usage(interp, command_table, argc, argv); return &dummy_subcmd; } help = 1; cmd = argv[2]; } if (Jim_CompareStringImmediate(interp, cmd, "-commands")) { Jim_SetResult(interp, Jim_NewEmptyStringObj(interp)); add_commands(interp, command_table, " "); return &dummy_subcmd; } cmdstr = Jim_GetString(cmd, &cmdlen); for (ct = command_table; ct->cmd; ct++) { if (Jim_CompareStringImmediate(interp, cmd, ct->cmd)) { break; } if (strncmp(cmdstr, ct->cmd, cmdlen) == 0) { if (partial) { if (help) { show_cmd_usage(interp, command_table, argc, argv); return &dummy_subcmd; } bad_subcmd(interp, command_table, "ambiguous", argv[0], argv[1 + help]); return 0; } partial = ct; } continue; } if (partial && !ct->cmd) { ct = partial; } if (!ct->cmd) { if (help) { show_cmd_usage(interp, command_table, argc, argv); return &dummy_subcmd; } bad_subcmd(interp, command_table, "unknown", argv[0], argv[1 + help]); return 0; } if (help) { Jim_SetResultString(interp, "Usage: ", -1); add_cmd_usage(interp, ct, argv[0]); return &dummy_subcmd; } Jim_FreeIntRep(interp, cmd); cmd->typePtr = &subcmdLookupObjType; cmd->internalRep.ptrIntValue.ptr = (void *)command_table; cmd->internalRep.ptrIntValue.int1 = ct - command_table; found: if (argc - 2 < ct->minargs || (ct->maxargs >= 0 && argc - 2 > ct->maxargs)) { Jim_SetResultString(interp, "wrong # args: should be \"", -1); add_cmd_usage(interp, ct, argv[0]); Jim_AppendStrings(interp, Jim_GetResult(interp), "\"", NULL); return 0; } return ct; } int Jim_CallSubCmd(Jim_Interp *interp, const jim_subcmd_type * ct, int argc, Jim_Obj *const *argv) { int ret = JIM_ERR; |
︙ | ︙ | |||
20017 20018 20019 20020 20021 20022 20023 | } else if (uc <= 0xffff) { *p++ = 0xe0 | ((uc & 0xf000) >> 12); *p++ = 0x80 | ((uc & 0xfc0) >> 6); *p = 0x80 | (uc & 0x3f); return 3; } | | | 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 | } else if (uc <= 0xffff) { *p++ = 0xe0 | ((uc & 0xf000) >> 12); *p++ = 0x80 | ((uc & 0xfc0) >> 6); *p = 0x80 | (uc & 0x3f); return 3; } else { *p++ = 0xf0 | ((uc & 0x1c0000) >> 18); *p++ = 0x80 | ((uc & 0x3f000) >> 12); *p++ = 0x80 | ((uc & 0xfc0) >> 6); *p = 0x80 | (uc & 0x3f); return 4; } |
︙ | ︙ | |||
20144 20145 20146 20147 20148 20149 20150 | default: sawFlag = 0; continue; } *p++ = ch; format += step; step = utf8_tounicode(format, &ch); | > | | 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 | default: sawFlag = 0; continue; } *p++ = ch; format += step; step = utf8_tounicode(format, &ch); } while (sawFlag && (p - spec <= 5)); width = 0; if (isdigit(ch)) { width = strtoul(format, &end, 10); format = end; step = utf8_tounicode(format, &ch); |
︙ | ︙ | |||
20208 20209 20210 20211 20212 20213 20214 | useShort = 0; if (ch == 'h') { useShort = 1; format += step; step = utf8_tounicode(format, &ch); } else if (ch == 'l') { | | | 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 | useShort = 0; if (ch == 'h') { useShort = 1; format += step; step = utf8_tounicode(format, &ch); } else if (ch == 'l') { format += step; step = utf8_tounicode(format, &ch); if (ch == 'l') { format += step; step = utf8_tounicode(format, &ch); } } |
︙ | ︙ | |||
20235 20236 20237 20238 20239 20240 20241 | case '\0': msg = "format string ended in middle of field specifier"; goto errorMsg; case 's': { formatted_buf = Jim_GetString(objv[objIndex], &formatted_bytes); formatted_chars = Jim_Utf8Length(interp, objv[objIndex]); if (gotPrecision && (precision < formatted_chars)) { | | | | | 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 | case '\0': msg = "format string ended in middle of field specifier"; goto errorMsg; case 's': { formatted_buf = Jim_GetString(objv[objIndex], &formatted_bytes); formatted_chars = Jim_Utf8Length(interp, objv[objIndex]); if (gotPrecision && (precision < formatted_chars)) { formatted_chars = precision; formatted_bytes = utf8_index(formatted_buf, precision); } break; } case 'c': { jim_wide code; if (Jim_GetWide(interp, objv[objIndex], &code) != JIM_OK) { goto error; } formatted_bytes = utf8_getchars(spec, code); formatted_buf = spec; formatted_chars = 1; break; } case 'b': { unsigned jim_wide w; int length; int i; int j; if (Jim_GetWide(interp, objv[objIndex], (jim_wide *)&w) != JIM_OK) { goto error; } length = sizeof(w) * 8; if (num_buffer_size < length + 1) { num_buffer_size = length + 1; num_buffer = Jim_Realloc(num_buffer, num_buffer_size); } j = 0; for (i = length; i > 0; ) { |
︙ | ︙ | |||
20293 20294 20295 20296 20297 20298 20299 | case 'e': case 'E': case 'f': case 'g': case 'G': doubleType = 1; | | | | | 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 | case 'e': case 'E': case 'f': case 'g': case 'G': doubleType = 1; case 'd': case 'u': case 'o': case 'x': case 'X': { jim_wide w; double d; int length; if (width) { p += sprintf(p, "%ld", width); } if (gotPrecision) { p += sprintf(p, ".%ld", precision); } if (doubleType) { if (Jim_GetDouble(interp, objv[objIndex], &d) != JIM_OK) { goto error; } length = MAX_FLOAT_WIDTH; } else { |
︙ | ︙ | |||
20342 20343 20344 20345 20346 20347 20348 | } #endif } *p++ = (char) ch; *p = '\0'; | | > > > > > > > | | | 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 | } #endif } *p++ = (char) ch; *p = '\0'; if (width > 10000 || length > 10000 || precision > 10000) { Jim_SetResultString(interp, "format too long", -1); goto error; } if (width > length) { length = width; } if (gotPrecision) { length += precision; } if (num_buffer_size < length + 1) { num_buffer_size = length + 1; num_buffer = Jim_Realloc(num_buffer, num_buffer_size); } if (doubleType) { snprintf(num_buffer, length + 1, spec, d); } else { formatted_bytes = snprintf(num_buffer, length + 1, spec, w); } formatted_chars = formatted_bytes = strlen(num_buffer); formatted_buf = num_buffer; break; } default: { spec[0] = ch; spec[1] = '\0'; Jim_SetResultFormatted(interp, "bad field specifier \"%s\"", spec); goto error; } } |
︙ | ︙ | |||
20420 20421 20422 20423 20424 20425 20426 | #define REG_MAX_PAREN 100 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 | #define REG_MAX_PAREN 100 #define END 0 #define BOL 1 #define EOL 2 #define ANY 3 #define ANYOF 4 #define ANYBUT 5 #define BRANCH 6 #define BACK 7 #define EXACTLY 8 #define NOTHING 9 #define REP 10 #define REPMIN 11 #define REPX 12 #define REPXMIN 13 #define BOLX 14 #define EOLX 15 #define WORDA 16 #define WORDZ 17 #define OPENNC 1000 #define OPEN 1001 #define CLOSENC 2000 #define CLOSE 2001 #define CLOSE_END (CLOSE+REG_MAX_PAREN) #define REG_MAGIC 0xFADED00D #define OP(preg, p) (preg->program[p]) #define NEXT(preg, p) (preg->program[p + 1]) #define OPERAND(p) ((p) + 2) #define FAIL(R,M) { (R)->err = (M); return (M); } #define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?' || (c) == '{') #define META "^$.[()|?{+*" #define HASWIDTH 1 #define SIMPLE 2 #define SPSTART 4 #define WORST 0 #define MAX_REP_COUNT 1000000 static int reg(regex_t *preg, int paren, int *flagp ); static int regpiece(regex_t *preg, int *flagp ); static int regbranch(regex_t *preg, int *flagp ); static int regatom(regex_t *preg, int *flagp ); static int regnode(regex_t *preg, int op ); static int regnext(regex_t *preg, int p ); static void regc(regex_t *preg, int b ); static int reginsert(regex_t *preg, int op, int size, int opnd ); |
︙ | ︙ | |||
20518 20519 20520 20521 20522 20523 20524 | fprintf(stderr, "Compiling: '%s'\n", exp); #endif memset(preg, 0, sizeof(*preg)); if (exp == NULL) FAIL(preg, REG_ERR_NULL_ARGUMENT); | | | | | | | | | | | 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 | fprintf(stderr, "Compiling: '%s'\n", exp); #endif memset(preg, 0, sizeof(*preg)); if (exp == NULL) FAIL(preg, REG_ERR_NULL_ARGUMENT); preg->cflags = cflags; preg->regparse = exp; preg->proglen = (strlen(exp) + 1) * 5; preg->program = malloc(preg->proglen * sizeof(int)); if (preg->program == NULL) FAIL(preg, REG_ERR_NOMEM); regc(preg, REG_MAGIC); if (reg(preg, 0, &flags) == 0) { return preg->err; } if (preg->re_nsub >= REG_MAX_PAREN) FAIL(preg,REG_ERR_TOO_BIG); preg->regstart = 0; preg->reganch = 0; preg->regmust = 0; preg->regmlen = 0; scan = 1; if (OP(preg, regnext(preg, scan)) == END) { scan = OPERAND(scan); if (OP(preg, scan) == EXACTLY) { preg->regstart = preg->program[OPERAND(scan)]; } else if (OP(preg, scan) == BOL) preg->reganch++; if (flags&SPSTART) { |
︙ | ︙ | |||
20577 20578 20579 20580 20581 20582 20583 | #ifdef DEBUG regdump(preg); #endif return 0; } | | | | | | | | | | | | 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 | #ifdef DEBUG regdump(preg); #endif return 0; } static int reg(regex_t *preg, int paren, int *flagp ) { int ret; int br; int ender; int parno = 0; int flags; *flagp = HASWIDTH; if (paren) { if (preg->regparse[0] == '?' && preg->regparse[1] == ':') { preg->regparse += 2; parno = -1; } else { parno = ++preg->re_nsub; } ret = regnode(preg, OPEN+parno); } else ret = 0; br = regbranch(preg, &flags); if (br == 0) return 0; if (ret != 0) regtail(preg, ret, br); else ret = br; if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; while (*preg->regparse == '|') { preg->regparse++; br = regbranch(preg, &flags); if (br == 0) return 0; regtail(preg, ret, br); if (!(flags&HASWIDTH)) *flagp &= ~HASWIDTH; *flagp |= flags&SPSTART; } ender = regnode(preg, (paren) ? CLOSE+parno : END); regtail(preg, ret, ender); for (br = ret; br != 0; br = regnext(preg, br)) regoptail(preg, br, ender); if (paren && *preg->regparse++ != ')') { preg->err = REG_ERR_UNMATCHED_PAREN; return 0; } else if (!paren && *preg->regparse != '\0') { if (*preg->regparse == ')') { preg->err = REG_ERR_UNMATCHED_PAREN; return 0; |
︙ | ︙ | |||
20655 20656 20657 20658 20659 20660 20661 | static int regbranch(regex_t *preg, int *flagp ) { int ret; int chain; int latest; int flags; | | | | 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 | static int regbranch(regex_t *preg, int *flagp ) { int ret; int chain; int latest; int flags; *flagp = WORST; ret = regnode(preg, BRANCH); chain = 0; while (*preg->regparse != '\0' && *preg->regparse != ')' && *preg->regparse != '|') { latest = regpiece(preg, &flags); if (latest == 0) return 0; *flagp |= flags&HASWIDTH; if (chain == 0) { *flagp |= flags&SPSTART; } else { regtail(preg, chain, latest); } chain = latest; } if (chain == 0) (void) regnode(preg, NOTHING); return(ret); } static int regpiece(regex_t *preg, int *flagp) { |
︙ | ︙ | |||
20703 20704 20705 20706 20707 20708 20709 | } if (!(flags&HASWIDTH) && op != '?') { preg->err = REG_ERR_OPERAND_COULD_BE_EMPTY; return 0; } | | > > > > | 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 | } if (!(flags&HASWIDTH) && op != '?') { preg->err = REG_ERR_OPERAND_COULD_BE_EMPTY; return 0; } if (op == '{') { char *end; min = strtoul(preg->regparse + 1, &end, 10); if (end == preg->regparse + 1) { preg->err = REG_ERR_BAD_COUNT; return 0; } if (*end == '}') { max = min; } else if (*end == '\0') { preg->err = REG_ERR_UNMATCHED_BRACES; return 0; } else { preg->regparse = end; max = strtoul(preg->regparse + 1, &end, 10); if (*end != '}') { preg->err = REG_ERR_UNMATCHED_BRACES; return 0; |
︙ | ︙ | |||
20775 20776 20777 20778 20779 20780 20781 | } static void reg_addrange(regex_t *preg, int lower, int upper) { if (lower > upper) { reg_addrange(preg, upper, lower); } | | | 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 | } static void reg_addrange(regex_t *preg, int lower, int upper) { if (lower > upper) { reg_addrange(preg, upper, lower); } regc(preg, upper - lower + 1); regc(preg, lower); } static void reg_addrange_str(regex_t *preg, const char *str) { while (*str) { |
︙ | ︙ | |||
20843 20844 20845 20846 20847 20848 20849 | case 'f': *ch = '\f'; break; case 'n': *ch = '\n'; break; case 'r': *ch = '\r'; break; case 't': *ch = '\t'; break; case 'v': *ch = '\v'; break; case 'u': if (*s == '{') { | | | | 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 20782 20783 20784 20785 20786 20787 20788 20789 20790 | case 'f': *ch = '\f'; break; case 'n': *ch = '\n'; break; case 'r': *ch = '\r'; break; case 't': *ch = '\t'; break; case 'v': *ch = '\v'; break; case 'u': if (*s == '{') { n = parse_hex(s + 1, 6, ch); if (n > 0 && s[n + 1] == '}' && *ch >= 0 && *ch <= 0x1fffff) { s += n + 2; } else { *ch = 'u'; } } else if ((n = parse_hex(s, 4, ch)) > 0) { s += n; } break; |
︙ | ︙ | |||
20884 20885 20886 20887 20888 20889 20890 | int ret; int flags; int nocase = (preg->cflags & REG_ICASE); int ch; int n = reg_utf8_tounicode_case(preg->regparse, &ch, nocase); | | | | | | > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < | | | | | > | | | 20811 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 20824 20825 20826 20827 20828 20829 20830 20831 20832 20833 20834 20835 20836 20837 20838 20839 20840 20841 20842 20843 20844 20845 20846 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 20862 20863 20864 20865 20866 20867 20868 20869 20870 20871 20872 20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 20888 20889 20890 20891 20892 20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 | int ret; int flags; int nocase = (preg->cflags & REG_ICASE); int ch; int n = reg_utf8_tounicode_case(preg->regparse, &ch, nocase); *flagp = WORST; preg->regparse += n; switch (ch) { case '^': ret = regnode(preg, BOL); break; case '$': ret = regnode(preg, EOL); break; case '.': ret = regnode(preg, ANY); *flagp |= HASWIDTH|SIMPLE; break; case '[': { const char *pattern = preg->regparse; if (*pattern == '^') { ret = regnode(preg, ANYBUT); pattern++; } else ret = regnode(preg, ANYOF); if (*pattern == ']' || *pattern == '-') { reg_addrange(preg, *pattern, *pattern); pattern++; } while (*pattern && *pattern != ']') { int start; int end; enum { CC_ALPHA, CC_ALNUM, CC_SPACE, CC_BLANK, CC_UPPER, CC_LOWER, CC_DIGIT, CC_XDIGIT, CC_CNTRL, CC_GRAPH, CC_PRINT, CC_PUNCT, CC_NUM }; int cc; pattern += reg_utf8_tounicode_case(pattern, &start, nocase); if (start == '\\') { switch (*pattern) { case 's': pattern++; cc = CC_SPACE; goto cc_switch; case 'd': pattern++; cc = CC_DIGIT; goto cc_switch; case 'w': pattern++; reg_addrange(preg, '_', '_'); cc = CC_ALNUM; goto cc_switch; } pattern += reg_decode_escape(pattern, &start); if (start == 0) { preg->err = REG_ERR_NULL_CHAR; return 0; } } if (pattern[0] == '-' && pattern[1] && pattern[1] != ']') { pattern += utf8_tounicode(pattern, &end); pattern += reg_utf8_tounicode_case(pattern, &end, nocase); if (end == '\\') { pattern += reg_decode_escape(pattern, &end); if (end == 0) { preg->err = REG_ERR_NULL_CHAR; return 0; } } reg_addrange(preg, start, end); continue; } if (start == '[' && pattern[0] == ':') { static const char *character_class[] = { ":alpha:", ":alnum:", ":space:", ":blank:", ":upper:", ":lower:", ":digit:", ":xdigit:", ":cntrl:", ":graph:", ":print:", ":punct:", }; for (cc = 0; cc < CC_NUM; cc++) { n = strlen(character_class[cc]); if (strncmp(pattern, character_class[cc], n) == 0) { pattern += n + 1; break; } } if (cc != CC_NUM) { cc_switch: switch (cc) { case CC_ALNUM: reg_addrange(preg, '0', '9'); case CC_ALPHA: if ((preg->cflags & REG_ICASE) == 0) { reg_addrange(preg, 'a', 'z'); } reg_addrange(preg, 'A', 'Z'); break; case CC_SPACE: |
︙ | ︙ | |||
20988 20989 20990 20991 20992 20993 20994 | break; case CC_LOWER: reg_addrange(preg, 'a', 'z'); break; case CC_XDIGIT: reg_addrange(preg, 'a', 'f'); reg_addrange(preg, 'A', 'F'); | | | 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 | break; case CC_LOWER: reg_addrange(preg, 'a', 'z'); break; case CC_XDIGIT: reg_addrange(preg, 'a', 'f'); reg_addrange(preg, 'A', 'F'); case CC_DIGIT: reg_addrange(preg, '0', '9'); break; case CC_CNTRL: reg_addrange(preg, 0, 31); reg_addrange(preg, 127, 127); break; |
︙ | ︙ | |||
21012 21013 21014 21015 21016 21017 21018 | reg_addrange(preg, '[', '`'); reg_addrange(preg, '{', '~'); break; } continue; } } | | | 20957 20958 20959 20960 20961 20962 20963 20964 20965 20966 20967 20968 20969 20970 20971 | reg_addrange(preg, '[', '`'); reg_addrange(preg, '{', '~'); break; } continue; } } reg_addrange(preg, start, start); } regc(preg, '\0'); if (*pattern) { pattern++; } |
︙ | ︙ | |||
21035 21036 21037 21038 21039 21040 21041 | return 0; *flagp |= flags&(HASWIDTH|SPSTART); break; case '\0': case '|': case ')': preg->err = REG_ERR_INTERNAL; | | | 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 | return 0; *flagp |= flags&(HASWIDTH|SPSTART); break; case '\0': case '|': case ')': preg->err = REG_ERR_INTERNAL; return 0; case '?': case '+': case '*': case '{': preg->err = REG_ERR_COUNT_FOLLOWS_NOTHING; return 0; case '\\': |
︙ | ︙ | |||
21088 21089 21090 21091 21092 21093 21094 | case 's': case 'S': ret = regnode(preg, ch == 's' ? ANYOF : ANYBUT); reg_addrange_str(preg," \t\r\n\f\v"); regc(preg, '\0'); *flagp |= HASWIDTH|SIMPLE; break; | | | | | | | | | | | | 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 | case 's': case 'S': ret = regnode(preg, ch == 's' ? ANYOF : ANYBUT); reg_addrange_str(preg," \t\r\n\f\v"); regc(preg, '\0'); *flagp |= HASWIDTH|SIMPLE; break; default: preg->regparse--; goto de_fault; } break; de_fault: default: { int added = 0; preg->regparse -= n; ret = regnode(preg, EXACTLY); while (*preg->regparse && strchr(META, *preg->regparse) == NULL) { n = reg_utf8_tounicode_case(preg->regparse, &ch, (preg->cflags & REG_ICASE)); if (ch == '\\' && preg->regparse[n]) { if (strchr("<>mMwWdDsSAZ", preg->regparse[n])) { break; } n += reg_decode_escape(preg->regparse + n, &ch); if (ch == 0) { preg->err = REG_ERR_NULL_CHAR; return 0; } } if (ISMULT(preg->regparse[n])) { if (added) { break; } regc(preg, ch); added++; preg->regparse += n; break; } regc(preg, ch); added++; preg->regparse += n; } regc(preg, '\0'); *flagp |= HASWIDTH; |
︙ | ︙ | |||
21166 21167 21168 21169 21170 21171 21172 | } static int regnode(regex_t *preg, int op) { reg_grow(preg, 2); | | | | | | | | | | | | | | | | | | | | | | | 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 | } static int regnode(regex_t *preg, int op) { reg_grow(preg, 2); preg->program[preg->p++] = op; preg->program[preg->p++] = 0; return preg->p - 2; } static void regc(regex_t *preg, int b ) { reg_grow(preg, 1); preg->program[preg->p++] = b; } static int reginsert(regex_t *preg, int op, int size, int opnd ) { reg_grow(preg, size); memmove(preg->program + opnd + size, preg->program + opnd, sizeof(int) * (preg->p - opnd)); memset(preg->program + opnd, 0, sizeof(int) * size); preg->program[opnd] = op; preg->p += size; return opnd + size; } static void regtail(regex_t *preg, int p, int val) { int scan; int temp; int offset; scan = p; for (;;) { temp = regnext(preg, scan); if (temp == 0) break; scan = temp; } if (OP(preg, scan) == BACK) offset = scan - val; else offset = val - scan; preg->program[scan + 1] = offset; } static void regoptail(regex_t *preg, int p, int val ) { if (p != 0 && OP(preg, p) == BRANCH) { regtail(preg, OPERAND(p), val); } } static int regtry(regex_t *preg, const char *string ); static int regmatch(regex_t *preg, int prog); static int regrepeat(regex_t *preg, int p, int max); int regexec(regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags) { const char *s; int scan; if (preg == NULL || preg->program == NULL || string == NULL) { return REG_ERR_NULL_ARGUMENT; } if (*preg->program != REG_MAGIC) { return REG_ERR_CORRUPTED; } #ifdef DEBUG fprintf(stderr, "regexec: %s\n", string); regdump(preg); #endif preg->eflags = eflags; preg->pmatch = pmatch; preg->nmatch = nmatch; preg->start = string; for (scan = OPERAND(1); scan != 0; scan += regopsize(preg, scan)) { int op = OP(preg, scan); if (op == END) break; if (op == REPX || op == REPXMIN) preg->program[scan + 4] = 0; } if (preg->regmust != 0) { s = string; while ((s = str_find(s, preg->program[preg->regmust], preg->cflags & REG_ICASE)) != NULL) { if (prefix_cmp(preg->program + preg->regmust, preg->regmlen, s, preg->cflags & REG_ICASE) >= 0) { break; } s++; } if (s == NULL) return REG_NOMATCH; } preg->regbol = string; if (preg->reganch) { if (eflags & REG_NOTBOL) { goto nextline; } while (1) { if (regtry(preg, string)) { return REG_NOERROR; } if (*string) { nextline: if (preg->cflags & REG_NEWLINE) { string = strchr(string, '\n'); if (string) { preg->regbol = ++string; continue; } } } return REG_NOMATCH; } } s = string; if (preg->regstart != '\0') { while ((s = str_find(s, preg->regstart, preg->cflags & REG_ICASE)) != NULL) { if (regtry(preg, s)) return REG_NOERROR; s++; } } else while (1) { if (regtry(preg, s)) return REG_NOERROR; if (*s == '\0') { break; } else { int c; s += utf8_tounicode(s, &c); } } return REG_NOMATCH; } static int regtry( regex_t *preg, const char *string ) { int i; preg->reginput = string; for (i = 0; i < preg->nmatch; i++) { |
︙ | ︙ | |||
21377 21378 21379 21380 21381 21382 21383 | } return -1; } static int reg_range_find(const int *range, int c) { while (*range) { | | | | 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 | } return -1; } static int reg_range_find(const int *range, int c) { while (*range) { if (c >= range[1] && c <= (range[0] + range[1] - 1)) { return 1; } range += 2; } return 0; } static const char *str_find(const char *string, int c, int nocase) { if (nocase) { c = utf8_upper(c); } while (*string) { int ch; int n = reg_utf8_tounicode_case(string, &ch, nocase); if (c == ch) { return string; |
︙ | ︙ | |||
21433 21434 21435 21436 21437 21438 21439 | } save = preg->reginput; no = regrepeat(preg, scan + 5, max); if (no < min) { return 0; } if (matchmin) { | | | | | | | | | | | | | | | | | | | | | | | | 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 | } save = preg->reginput; no = regrepeat(preg, scan + 5, max); if (no < min) { return 0; } if (matchmin) { max = no; no = min; } while (1) { if (matchmin) { if (no > max) { break; } } else { if (no < min) { break; } } preg->reginput = save + utf8_index(save, no); reg_utf8_tounicode_case(preg->reginput, &c, (preg->cflags & REG_ICASE)); if (reg_iseol(preg, nextch) || c == nextch) { if (regmatch(preg, next)) { return(1); } } if (matchmin) { no++; } else { no--; } } return(0); } static int regmatchrepeat(regex_t *preg, int scan, int matchmin) { int *scanpt = preg->program + scan; int max = scanpt[2]; int min = scanpt[3]; if (scanpt[4] < min) { scanpt[4]++; if (regmatch(preg, scan + 5)) { return 1; } scanpt[4]--; return 0; } if (scanpt[4] > max) { return 0; } if (matchmin) { if (regmatch(preg, regnext(preg, scan))) { return 1; } scanpt[4]++; if (regmatch(preg, scan + 5)) { return 1; } scanpt[4]--; return 0; } if (scanpt[4] < max) { scanpt[4]++; if (regmatch(preg, scan + 5)) { return 1; } scanpt[4]--; } return regmatch(preg, regnext(preg, scan)); } static int regmatch(regex_t *preg, int prog) { int scan; int next; const char *save; scan = prog; #ifdef DEBUG if (scan != 0 && regnarrate) fprintf(stderr, "%s(\n", regprop(scan)); #endif while (scan != 0) { int n; int c; #ifdef DEBUG if (regnarrate) { fprintf(stderr, "%3d: %s...\n", scan, regprop(OP(preg, scan))); } #endif next = regnext(preg, scan); n = reg_utf8_tounicode_case(preg->reginput, &c, (preg->cflags & REG_ICASE)); switch (OP(preg, scan)) { case BOLX: if ((preg->eflags & REG_NOTBOL)) { return(0); } case BOL: if (preg->reginput != preg->regbol) { return(0); } break; case EOLX: if (c != 0) { return 0; } break; case EOL: if (!reg_iseol(preg, c)) { return(0); } break; case WORDA: if ((!isalnum(UCHAR(c))) && c != '_') return(0); if (preg->reginput > preg->regbol && (isalnum(UCHAR(preg->reginput[-1])) || preg->reginput[-1] == '_')) return(0); break; case WORDZ: if (preg->reginput > preg->regbol) { if (reg_iseol(preg, c) || !isalnum(UCHAR(c)) || c != '_') { c = preg->reginput[-1]; if (isalnum(UCHAR(c)) || c == '_') { break; } } } return(0); case ANY: if (reg_iseol(preg, c)) return 0; preg->reginput += n; break; |
︙ | ︙ | |||
21622 21623 21624 21625 21626 21627 21628 | preg->reginput += n; break; case NOTHING: break; case BACK: break; case BRANCH: | | | | | | 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 | preg->reginput += n; break; case NOTHING: break; case BACK: break; case BRANCH: if (OP(preg, next) != BRANCH) next = OPERAND(scan); else { do { save = preg->reginput; if (regmatch(preg, OPERAND(scan))) { return(1); } preg->reginput = save; scan = regnext(preg, scan); } while (scan != 0 && OP(preg, scan) == BRANCH); return(0); } break; case REP: case REPMIN: return regmatchsimplerepeat(preg, scan, OP(preg, scan) == REPMIN); case REPX: case REPXMIN: return regmatchrepeat(preg, scan, OP(preg, scan) == REPXMIN); case END: return 1; case OPENNC: case CLOSENC: return regmatch(preg, next); default: if (OP(preg, scan) >= OPEN+1 && OP(preg, scan) < CLOSE_END) { |
︙ | ︙ | |||
21693 21694 21695 21696 21697 21698 21699 | int ch; int n; scan = preg->reginput; opnd = OPERAND(p); switch (OP(preg, p)) { case ANY: | | | 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 | int ch; int n; scan = preg->reginput; opnd = OPERAND(p); switch (OP(preg, p)) { case ANY: while (!reg_iseol(preg, *scan) && count < max) { count++; scan++; } break; case EXACTLY: while (count < max) { |
︙ | ︙ | |||
21729 21730 21731 21732 21733 21734 21735 | if (reg_iseol(preg, ch) || reg_range_find(preg->program + opnd, ch) != 0) { break; } count++; scan += n; } break; | | | | 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 | if (reg_iseol(preg, ch) || reg_range_find(preg->program + opnd, ch) != 0) { break; } count++; scan += n; } break; default: preg->err = REG_ERR_INTERNAL; count = 0; break; } preg->reginput = scan; return(count); } |
︙ | ︙ | |||
21756 21757 21758 21759 21760 21761 21762 | return(p-offset); else return(p+offset); } static int regopsize(regex_t *preg, int p ) { | | | 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 | return(p-offset); else return(p+offset); } static int regopsize(regex_t *preg, int p ) { switch (OP(preg, p)) { case REP: case REPMIN: case REPX: case REPXMIN: return 5; |
︙ | ︙ | |||
21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 | return snprintf(errbuf, errbuf_size, "%s", err); } void regfree(regex_t *preg) { free(preg->program); } #endif #if defined(_WIN32) || defined(WIN32) #ifndef STRICT #define STRICT #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 | return snprintf(errbuf, errbuf_size, "%s", err); } void regfree(regex_t *preg) { free(preg->program); } #endif #include <string.h> void Jim_SetResultErrno(Jim_Interp *interp, const char *msg) { Jim_SetResultFormatted(interp, "%s: %s", msg, strerror(Jim_Errno())); } #if defined(__MINGW32__) #include <sys/stat.h> int Jim_Errno(void) { switch (GetLastError()) { case ERROR_FILE_NOT_FOUND: return ENOENT; case ERROR_PATH_NOT_FOUND: return ENOENT; case ERROR_TOO_MANY_OPEN_FILES: return EMFILE; case ERROR_ACCESS_DENIED: return EACCES; case ERROR_INVALID_HANDLE: return EBADF; case ERROR_BAD_ENVIRONMENT: return E2BIG; case ERROR_BAD_FORMAT: return ENOEXEC; case ERROR_INVALID_ACCESS: return EACCES; case ERROR_INVALID_DRIVE: return ENOENT; case ERROR_CURRENT_DIRECTORY: return EACCES; case ERROR_NOT_SAME_DEVICE: return EXDEV; case ERROR_NO_MORE_FILES: return ENOENT; case ERROR_WRITE_PROTECT: return EROFS; case ERROR_BAD_UNIT: return ENXIO; case ERROR_NOT_READY: return EBUSY; case ERROR_BAD_COMMAND: return EIO; case ERROR_CRC: return EIO; case ERROR_BAD_LENGTH: return EIO; case ERROR_SEEK: return EIO; case ERROR_WRITE_FAULT: return EIO; case ERROR_READ_FAULT: return EIO; case ERROR_GEN_FAILURE: return EIO; case ERROR_SHARING_VIOLATION: return EACCES; case ERROR_LOCK_VIOLATION: return EACCES; case ERROR_SHARING_BUFFER_EXCEEDED: return ENFILE; case ERROR_HANDLE_DISK_FULL: return ENOSPC; case ERROR_NOT_SUPPORTED: return ENODEV; case ERROR_REM_NOT_LIST: return EBUSY; case ERROR_DUP_NAME: return EEXIST; case ERROR_BAD_NETPATH: return ENOENT; case ERROR_NETWORK_BUSY: return EBUSY; case ERROR_DEV_NOT_EXIST: return ENODEV; case ERROR_TOO_MANY_CMDS: return EAGAIN; case ERROR_ADAP_HDW_ERR: return EIO; case ERROR_BAD_NET_RESP: return EIO; case ERROR_UNEXP_NET_ERR: return EIO; case ERROR_NETNAME_DELETED: return ENOENT; case ERROR_NETWORK_ACCESS_DENIED: return EACCES; case ERROR_BAD_DEV_TYPE: return ENODEV; case ERROR_BAD_NET_NAME: return ENOENT; case ERROR_TOO_MANY_NAMES: return ENFILE; case ERROR_TOO_MANY_SESS: return EIO; case ERROR_SHARING_PAUSED: return EAGAIN; case ERROR_REDIR_PAUSED: return EAGAIN; case ERROR_FILE_EXISTS: return EEXIST; case ERROR_CANNOT_MAKE: return ENOSPC; case ERROR_OUT_OF_STRUCTURES: return ENFILE; case ERROR_ALREADY_ASSIGNED: return EEXIST; case ERROR_INVALID_PASSWORD: return EPERM; case ERROR_NET_WRITE_FAULT: return EIO; case ERROR_NO_PROC_SLOTS: return EAGAIN; case ERROR_DISK_CHANGE: return EXDEV; case ERROR_BROKEN_PIPE: return EPIPE; case ERROR_OPEN_FAILED: return ENOENT; case ERROR_DISK_FULL: return ENOSPC; case ERROR_NO_MORE_SEARCH_HANDLES: return EMFILE; case ERROR_INVALID_TARGET_HANDLE: return EBADF; case ERROR_INVALID_NAME: return ENOENT; case ERROR_PROC_NOT_FOUND: return ESRCH; case ERROR_WAIT_NO_CHILDREN: return ECHILD; case ERROR_CHILD_NOT_COMPLETE: return ECHILD; case ERROR_DIRECT_ACCESS_HANDLE: return EBADF; case ERROR_SEEK_ON_DEVICE: return ESPIPE; case ERROR_BUSY_DRIVE: return EAGAIN; case ERROR_DIR_NOT_EMPTY: return EEXIST; case ERROR_NOT_LOCKED: return EACCES; case ERROR_BAD_PATHNAME: return ENOENT; case ERROR_LOCK_FAILED: return EACCES; case ERROR_ALREADY_EXISTS: return EEXIST; case ERROR_FILENAME_EXCED_RANGE: return ENAMETOOLONG; case ERROR_BAD_PIPE: return EPIPE; case ERROR_PIPE_BUSY: return EAGAIN; case ERROR_PIPE_NOT_CONNECTED: return EPIPE; case ERROR_DIRECTORY: return ENOTDIR; } return EINVAL; } pidtype waitpid(pidtype pid, int *status, int nohang) { DWORD ret = WaitForSingleObject(pid, nohang ? 0 : INFINITE); if (ret == WAIT_TIMEOUT || ret == WAIT_FAILED) { return JIM_BAD_PID; } GetExitCodeProcess(pid, &ret); *status = ret; CloseHandle(pid); return pid; } int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unlink_file) { char name[MAX_PATH]; HANDLE handle; if (!GetTempPath(MAX_PATH, name) || !GetTempFileName(name, filename_template ? filename_template : "JIM", 0, name)) { return -1; } handle = CreateFile(name, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY | (unlink_file ? FILE_FLAG_DELETE_ON_CLOSE : 0), NULL); if (handle == INVALID_HANDLE_VALUE) { goto error; } Jim_SetResultString(interp, name, -1); return _open_osfhandle((int)handle, _O_RDWR | _O_TEXT); error: Jim_SetResultErrno(interp, name); DeleteFile(name); return -1; } int Jim_OpenForWrite(const char *filename, int append) { if (strcmp(filename, "/dev/null") == 0) { filename = "nul:"; } int fd = _open(filename, _O_WRONLY | _O_CREAT | _O_TEXT | (append ? _O_APPEND : _O_TRUNC), _S_IREAD | _S_IWRITE); if (fd >= 0 && append) { _lseek(fd, 0L, SEEK_END); } return fd; } int Jim_OpenForRead(const char *filename) { if (strcmp(filename, "/dev/null") == 0) { filename = "nul:"; } return _open(filename, _O_RDONLY | _O_TEXT, 0); } #elif defined(HAVE_UNISTD_H) int Jim_MakeTempFile(Jim_Interp *interp, const char *filename_template, int unlink_file) { int fd; mode_t mask; Jim_Obj *filenameObj; if (filename_template == NULL) { const char *tmpdir = getenv("TMPDIR"); if (tmpdir == NULL || *tmpdir == '\0' || access(tmpdir, W_OK) != 0) { tmpdir = "/tmp/"; } filenameObj = Jim_NewStringObj(interp, tmpdir, -1); if (tmpdir[0] && tmpdir[strlen(tmpdir) - 1] != '/') { Jim_AppendString(interp, filenameObj, "/", 1); } Jim_AppendString(interp, filenameObj, "tcl.tmp.XXXXXX", -1); } else { filenameObj = Jim_NewStringObj(interp, filename_template, -1); } mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); #ifdef HAVE_MKSTEMP fd = mkstemp(filenameObj->bytes); #else if (mktemp(filenameObj->bytes) == NULL) { fd = -1; } else { fd = open(filenameObj->bytes, O_RDWR | O_CREAT | O_TRUNC); } #endif umask(mask); if (fd < 0) { Jim_SetResultErrno(interp, Jim_String(filenameObj)); Jim_FreeNewObj(interp, filenameObj); return -1; } if (unlink_file) { remove(Jim_String(filenameObj)); } Jim_SetResult(interp, filenameObj); return fd; } int Jim_OpenForWrite(const char *filename, int append) { return open(filename, O_WRONLY | O_CREAT | (append ? O_APPEND : O_TRUNC), 0666); } int Jim_OpenForRead(const char *filename) { return open(filename, O_RDONLY, 0); } #endif #if defined(_WIN32) || defined(WIN32) #ifndef STRICT #define STRICT #endif |
︙ | ︙ | |||
21877 21878 21879 21880 21881 21882 21883 | DIR *opendir(const char *name) { DIR *dir = 0; if (name && name[0]) { size_t base_length = strlen(name); | | | | | 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 | DIR *opendir(const char *name) { DIR *dir = 0; if (name && name[0]) { size_t base_length = strlen(name); const char *all = strchr("/\\", name[base_length - 1]) ? "*" : "/*"; if ((dir = (DIR *) Jim_Alloc(sizeof *dir)) != 0 && (dir->name = (char *)Jim_Alloc(base_length + strlen(all) + 1)) != 0) { strcat(strcpy(dir->name, name), all); if ((dir->handle = (long)_findfirst(dir->name, &dir->info)) != -1) dir->result.d_name = 0; else { Jim_Free(dir->name); Jim_Free(dir); dir = 0; } } else { Jim_Free(dir); dir = 0; errno = ENOMEM; } } else { errno = EINVAL; |
︙ | ︙ | |||
21914 21915 21916 21917 21918 21919 21920 | if (dir) { if (dir->handle != -1) result = _findclose(dir->handle); Jim_Free(dir->name); Jim_Free(dir); } | | | 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 | if (dir) { if (dir->handle != -1) result = _findclose(dir->handle); Jim_Free(dir->name); Jim_Free(dir); } if (result == -1) errno = EBADF; return result; } struct dirent *readdir(DIR * dir) { struct dirent *result = 0; |
︙ | ︙ | |||
21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 | else { errno = EBADF; } return result; } #endif #endif #ifndef JIM_BOOTSTRAP_LIB_ONLY #include <errno.h> #include <string.h> #ifdef USE_LINENOISE #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include "linenoise.h" #else #define MAX_LINE_LEN 512 #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > | > > > | 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 22125 22126 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 22142 22143 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 22164 22165 22166 22167 22168 22169 22170 22171 22172 22173 22174 | else { errno = EBADF; } return result; } #endif #endif #include <stdio.h> #include <signal.h> #ifndef SIGPIPE #define SIGPIPE 13 #endif #ifndef SIGINT #define SIGINT 2 #endif const char *Jim_SignalId(int sig) { static char buf[10]; switch (sig) { case SIGINT: return "SIGINT"; case SIGPIPE: return "SIGPIPE"; } snprintf(buf, sizeof(buf), "%d", sig); return buf; } #ifndef JIM_BOOTSTRAP_LIB_ONLY #include <errno.h> #include <string.h> #ifdef USE_LINENOISE #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif #include "linenoise.h" #else #define MAX_LINE_LEN 512 #endif #ifdef USE_LINENOISE static void JimCompletionCallback(const char *prefix, linenoiseCompletions *comp, void *userdata); static const char completion_callback_assoc_key[] = "interactive-completion"; #endif char *Jim_HistoryGetline(Jim_Interp *interp, const char *prompt) { #ifdef USE_LINENOISE struct JimCompletionInfo *compinfo = Jim_GetAssocData(interp, completion_callback_assoc_key); char *result; Jim_Obj *objPtr; long mlmode = 0; if (compinfo) { linenoiseSetCompletionCallback(JimCompletionCallback, compinfo); } objPtr = Jim_GetVariableStr(interp, "history::multiline", JIM_NONE); if (objPtr && Jim_GetLong(interp, objPtr, &mlmode) == JIM_NONE) { linenoiseSetMultiLine(mlmode); } result = linenoise(prompt); linenoiseSetCompletionCallback(NULL, NULL); return result; #else int len; char *line = malloc(MAX_LINE_LEN); fputs(prompt, stdout); fflush(stdout); |
︙ | ︙ | |||
21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000 22001 22002 22003 | linenoiseHistoryAdd(line); #endif } void Jim_HistorySave(const char *filename) { #ifdef USE_LINENOISE linenoiseHistorySave(filename); #endif } void Jim_HistoryShow(void) { #ifdef USE_LINENOISE | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 22219 22220 22221 22222 22223 22224 22225 22226 22227 22228 22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 22250 22251 22252 22253 22254 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 22276 22277 22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 22288 22289 22290 22291 22292 22293 22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 22306 22307 22308 22309 | linenoiseHistoryAdd(line); #endif } void Jim_HistorySave(const char *filename) { #ifdef USE_LINENOISE #ifdef HAVE_UMASK mode_t mask; mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); #endif linenoiseHistorySave(filename); #ifdef HAVE_UMASK umask(mask); #endif #endif } void Jim_HistoryShow(void) { #ifdef USE_LINENOISE int i; int len; char **history = linenoiseHistory(&len); for (i = 0; i < len; i++) { printf("%4d %s\n", i + 1, history[i]); } #endif } #ifdef USE_LINENOISE struct JimCompletionInfo { Jim_Interp *interp; Jim_Obj *command; }; static void JimCompletionCallback(const char *prefix, linenoiseCompletions *comp, void *userdata) { struct JimCompletionInfo *info = (struct JimCompletionInfo *)userdata; Jim_Obj *objv[2]; int ret; objv[0] = info->command; objv[1] = Jim_NewStringObj(info->interp, prefix, -1); ret = Jim_EvalObjVector(info->interp, 2, objv); if (ret == JIM_OK) { int i; Jim_Obj *listObj = Jim_GetResult(info->interp); int len = Jim_ListLength(info->interp, listObj); for (i = 0; i < len; i++) { linenoiseAddCompletion(comp, Jim_String(Jim_ListGetIndex(info->interp, listObj, i))); } } } static void JimHistoryFreeCompletion(Jim_Interp *interp, void *data) { struct JimCompletionInfo *compinfo = data; Jim_DecrRefCount(interp, compinfo->command); Jim_Free(compinfo); } #endif void Jim_HistorySetCompletion(Jim_Interp *interp, Jim_Obj *commandObj) { #ifdef USE_LINENOISE if (commandObj) { Jim_IncrRefCount(commandObj); } Jim_DeleteAssocData(interp, completion_callback_assoc_key); if (commandObj) { struct JimCompletionInfo *compinfo = Jim_Alloc(sizeof(*compinfo)); compinfo->interp = interp; compinfo->command = commandObj; Jim_SetAssocData(interp, completion_callback_assoc_key, JimHistoryFreeCompletion, compinfo); } #endif } int Jim_InteractivePrompt(Jim_Interp *interp) { int retcode = JIM_OK; char *history_file = NULL; #ifdef USE_LINENOISE const char *home; home = getenv("HOME"); if (home && isatty(STDIN_FILENO)) { int history_len = strlen(home) + sizeof("/.jim_history"); history_file = Jim_Alloc(history_len); snprintf(history_file, history_len, "%s/.jim_history", home); Jim_HistoryLoad(history_file); } Jim_HistorySetCompletion(interp, Jim_NewStringObj(interp, "tcl::autocomplete", -1)); #endif printf("Welcome to Jim version %d.%d\n", JIM_VERSION / 100, JIM_VERSION % 100); Jim_SetVariableStrWithStr(interp, JIM_INTERACTIVE, "1"); while (1) { |
︙ | ︙ | |||
22053 22054 22055 22056 22057 22058 22059 | scriptObjPtr = Jim_NewStringObj(interp, "", 0); Jim_IncrRefCount(scriptObjPtr); while (1) { char state; char *line; | | | | | 22328 22329 22330 22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 22347 22348 22349 22350 22351 22352 22353 22354 22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 | scriptObjPtr = Jim_NewStringObj(interp, "", 0); Jim_IncrRefCount(scriptObjPtr); while (1) { char state; char *line; line = Jim_HistoryGetline(interp, prompt); if (line == NULL) { if (errno == EINTR) { continue; } Jim_DecrRefCount(interp, scriptObjPtr); retcode = JIM_OK; goto out; } if (Jim_Length(scriptObjPtr) != 0) { Jim_AppendString(interp, scriptObjPtr, "\n", 1); } Jim_AppendString(interp, scriptObjPtr, line, -1); free(line); if (Jim_ScriptIsComplete(interp, scriptObjPtr, &state)) break; snprintf(prompt, sizeof(prompt), "%c> ", state); } #ifdef USE_LINENOISE if (strcmp(Jim_String(scriptObjPtr), "h") == 0) { Jim_HistoryShow(); Jim_DecrRefCount(interp, scriptObjPtr); continue; } Jim_HistoryAdd(Jim_String(scriptObjPtr)); if (history_file) { |
︙ | ︙ | |||
22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 | result = Jim_GetString(Jim_GetResult(interp), &reslen); if (reslen) { printf("%s\n", result); } } out: Jim_Free(history_file); return retcode; } #include <stdio.h> #include <stdlib.h> #include <string.h> extern int Jim_initjimshInit(Jim_Interp *interp); static void JimSetArgv(Jim_Interp *interp, int argc, char *const argv[]) { int n; Jim_Obj *listObj = Jim_NewListObj(interp, NULL, 0); | > | | 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 22398 22399 22400 22401 22402 22403 22404 22405 22406 22407 22408 | result = Jim_GetString(Jim_GetResult(interp), &reslen); if (reslen) { printf("%s\n", result); } } out: Jim_Free(history_file); return retcode; } #include <stdio.h> #include <stdlib.h> #include <string.h> extern int Jim_initjimshInit(Jim_Interp *interp); static void JimSetArgv(Jim_Interp *interp, int argc, char *const argv[]) { int n; Jim_Obj *listObj = Jim_NewListObj(interp, NULL, 0); for (n = 0; n < argc; n++) { Jim_Obj *obj = Jim_NewStringObj(interp, argv[n], -1); Jim_ListAppendElement(interp, listObj, obj); } Jim_SetVariableStr(interp, "argv", listObj); |
︙ | ︙ | |||
22144 22145 22146 22147 22148 22149 22150 | printf("jimsh version %d.%d\n", JIM_VERSION / 100, JIM_VERSION % 100); printf("Usage: %s\n", executable_name); printf("or : %s [options] [filename]\n", executable_name); printf("\n"); printf("Without options: Interactive mode\n"); printf("\n"); printf("Options:\n"); | | | | | | | | | | | | | > > > | > | 22420 22421 22422 22423 22424 22425 22426 22427 22428 22429 22430 22431 22432 22433 22434 22435 22436 22437 22438 22439 22440 22441 22442 22443 22444 22445 22446 22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 22472 22473 22474 22475 22476 22477 22478 22479 22480 22481 22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 | printf("jimsh version %d.%d\n", JIM_VERSION / 100, JIM_VERSION % 100); printf("Usage: %s\n", executable_name); printf("or : %s [options] [filename]\n", executable_name); printf("\n"); printf("Without options: Interactive mode\n"); printf("\n"); printf("Options:\n"); printf(" --version : prints the version string\n"); printf(" --help : prints this text\n"); printf(" -e CMD : executes command CMD\n"); printf(" NOTE: all subsequent options will be passed as arguments to the command\n"); printf(" [filename|-] : executes the script contained in the named file, or from stdin if \"-\"\n"); printf(" NOTE: all subsequent options will be passed to the script\n\n"); } int main(int argc, char *const argv[]) { int retcode; Jim_Interp *interp; char *const orig_argv0 = argv[0]; if (argc > 1 && strcmp(argv[1], "--version") == 0) { printf("%d.%d\n", JIM_VERSION / 100, JIM_VERSION % 100); return 0; } else if (argc > 1 && strcmp(argv[1], "--help") == 0) { usage(argv[0]); return 0; } interp = Jim_CreateInterp(); Jim_RegisterCoreCommands(interp); if (Jim_InitStaticExtensions(interp) != JIM_OK) { JimPrintErrorMessage(interp); } Jim_SetVariableStrWithStr(interp, "jim::argv0", orig_argv0); Jim_SetVariableStrWithStr(interp, JIM_INTERACTIVE, argc == 1 ? "1" : "0"); retcode = Jim_initjimshInit(interp); if (argc == 1) { if (retcode == JIM_ERR) { JimPrintErrorMessage(interp); } if (retcode != JIM_EXIT) { JimSetArgv(interp, 0, NULL); retcode = Jim_InteractivePrompt(interp); } } else { if (argc > 2 && strcmp(argv[1], "-e") == 0) { JimSetArgv(interp, argc - 3, argv + 3); retcode = Jim_Eval(interp, argv[2]); if (retcode != JIM_ERR) { printf("%s\n", Jim_String(Jim_GetResult(interp))); } } else { Jim_SetVariableStr(interp, "argv0", Jim_NewStringObj(interp, argv[1], -1)); JimSetArgv(interp, argc - 2, argv + 2); if (strcmp(argv[1], "-") == 0) { retcode = Jim_Eval(interp, "eval [info source [stdin read] stdin 1]"); } else { retcode = Jim_EvalFile(interp, argv[1]); } } if (retcode == JIM_ERR) { JimPrintErrorMessage(interp); } } if (retcode == JIM_EXIT) { retcode = Jim_GetExitCode(interp); |
︙ | ︙ |
Changes to autosetup/pkg-config.tcl.
1 2 3 4 5 | # Copyright (c) 2016 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # | | | | | | | | > | | | 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 | # Copyright (c) 2016 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # The 'pkg-config' module allows package information to be found via 'pkg-config'. # # If not cross-compiling, the package path should be determined automatically # by 'pkg-config'. # If cross-compiling, the default package path is the compiler sysroot. # If the C compiler doesn't support '-print-sysroot', the path can be supplied # by the '--sysroot' option or by defining 'SYSROOT'. # # 'PKG_CONFIG' may be set to use an alternative to 'pkg-config'. use cc module-options { sysroot:dir => "Override compiler sysroot for pkg-config search path" } # @pkg-config-init ?required? # # Initialises the 'pkg-config' system. Unless '$required' is set to 0, # it is a fatal error if a usable 'pkg-config' is not found . # # This command will normally be called automatically as required, # but it may be invoked explicitly if lack of 'pkg-config' is acceptable. # # Returns 1 if ok, or 0 if 'pkg-config' not found/usable (only if '$required' is 0). # proc pkg-config-init {{required 1}} { if {[is-defined HAVE_PKG_CONFIG]} { return [get-define HAVE_PKG_CONFIG] } set found 0 |
︙ | ︙ | |||
44 45 46 47 48 49 50 | } } else { msg-result $version define PKG_CONFIG_VERSION $version set found 1 | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | } } else { msg-result $version define PKG_CONFIG_VERSION $version set found 1 if {[opt-str sysroot o]} { define SYSROOT [file-normalize $o] msg-result "Using specified sysroot [get-define SYSROOT]" } elseif {[get-define build] ne [get-define host]} { if {[catch {exec-with-stderr [get-define CC] -print-sysroot} result errinfo] == 0} { # Use the compiler sysroot, if there is one define SYSROOT $result msg-result "Found compiler sysroot $result" } else { |
︙ | ︙ | |||
79 80 81 82 83 84 85 | } define HAVE_PKG_CONFIG $found return $found } # @pkg-config module ?requirements? # | | | | | | 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 | } define HAVE_PKG_CONFIG $found return $found } # @pkg-config module ?requirements? # # Use 'pkg-config' to find the given module meeting the given requirements. # e.g. # ## pkg-config pango >= 1.37.0 # # If found, returns 1 and sets 'HAVE_PKG_PANGO' to 1 along with: # ## PKG_PANGO_VERSION to the found version ## PKG_PANGO_LIBS to the required libs (--libs-only-l) ## PKG_PANGO_LDFLAGS to the required linker flags (--libs-only-L) ## PKG_PANGO_CFLAGS to the required compiler flags (--cflags) # # If not found, returns 0. # proc pkg-config {module args} { set ok [pkg-config-init] msg-checking "Checking for $module $args..." |
︙ | ︙ | |||
120 121 122 123 124 125 126 | define ${prefix}_LDFLAGS [exec pkg-config --libs-only-L $module] define ${prefix}_CFLAGS [exec pkg-config --cflags $module] return 1 } # @pkg-config-get module setting # | | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | define ${prefix}_LDFLAGS [exec pkg-config --libs-only-L $module] define ${prefix}_CFLAGS [exec pkg-config --cflags $module] return 1 } # @pkg-config-get module setting # # Convenience access to the results of 'pkg-config'. # # For example, '[pkg-config-get pango CFLAGS]' returns # the value of 'PKG_PANGO_CFLAGS', or '""' if not defined. proc pkg-config-get {module name} { set prefix [feature-define-name $module PKG_] get-define ${prefix}_${name} "" } |
Changes to autosetup/system.tcl.
1 2 3 4 5 6 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # This module supports common system interrogation and options | | | | | | > > | > > | > | > > > > > | > > > > > | > | | | > | | | | | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | | | | | > > | | < > > | | 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 | # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # @synopsis: # # This module supports common system interrogation and options # such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'. # # It also support the "feature" naming convention, where searching # for a feature such as 'sys/type.h' defines 'HAVE_SYS_TYPES_H'. # # It defines the following variables, based on '--prefix' unless overridden by the user: # ## datadir ## sysconfdir ## sharedstatedir ## localstatedir ## infodir ## mandir ## includedir # # If '--prefix' is not supplied, it defaults to '/usr/local' unless 'defaultprefix' is defined *before* # including the 'system' module. if {[is-defined defaultprefix]} { user-notice "Note: defaultprefix is deprecated. Use options-defaults to set default options" options-defaults [list prefix [get-define defaultprefix]] } module-options [subst -noc -nob { host:host-alias => {a complete or partial cpu-vendor-opsys for the system where the application will run (defaults to the same value as --build)} build:build-alias => {a complete or partial cpu-vendor-opsys for the system where the application will be built (defaults to the result of running config.guess)} prefix:dir=/usr/local => {the target directory for the build (default: '@default@')} # These (hidden) options are supported for autoconf/automake compatibility exec-prefix: bindir: sbindir: includedir: mandir: infodir: libexecdir: datadir: libdir: sysconfdir: sharedstatedir: localstatedir: runstatedir: maintainer-mode=0 dependency-tracking=0 silent-rules=0 }] # @check-feature name { script } # # defines feature '$name' to the return value of '$script', # which should be 1 if found or 0 if not found. # # e.g. the following will define 'HAVE_CONST' to 0 or 1. # ## check-feature const { ## cctest -code {const int _x = 0;} ## } proc check-feature {name code} { msg-checking "Checking for $name..." set r [uplevel 1 $code] define-feature $name $r if {$r} { msg-result "ok" } else { msg-result "not found" } return $r } # @have-feature name ?default=0? # # Returns the value of feature '$name' if defined, or '$default' if not. # # See 'feature-define-name' for how the "feature" name # is translated into the "define" name. # proc have-feature {name {default 0}} { get-define [feature-define-name $name] $default } # @define-feature name ?value=1? # # Sets the feature 'define' to '$value'. # # See 'feature-define-name' for how the "feature" name # is translated into the "define" name. # proc define-feature {name {value 1}} { define [feature-define-name $name] $value } # @feature-checked name # # Returns 1 if feature '$name' has been checked, whether true or not. # proc feature-checked {name} { is-defined [feature-define-name $name] } # @feature-define-name name ?prefix=HAVE_? # # Converts a "feature" name to the corresponding "define", # e.g. 'sys/stat.h' becomes 'HAVE_SYS_STAT_H'. # # Converts '*' to 'P' and all non-alphanumeric to underscore. # proc feature-define-name {name {prefix HAVE_}} { string toupper $prefix[regsub -all {[^a-zA-Z0-9]} [regsub -all {[*]} $name p] _] } # @write-if-changed filename contents ?script? # # If '$filename' doesn't exist, or it's contents are different to '$contents', # the file is written and '$script' is evaluated. # # Otherwise a "file is unchanged" message is displayed. proc write-if-changed {file buf {script {}}} { set old [readfile $file ""] if {$old eq $buf && [file exists $file]} { msg-result "$file is unchanged" } else { writefile $file $buf\n uplevel 1 $script } } # @include-file infile mapping # # The core of make-template, called recursively for each @include # directive found within that template so that this proc's result # is the fully-expanded template. # # The mapping parameter is how we expand @varname@ within the template. # We do that inline within this step only for @include directives which # can have variables in the filename arg. A separate substitution pass # happens when this recursive function returns, expanding the rest of # the variables. # proc include-file {infile mapping} { # A stack of true/false conditions, one for each nested conditional # starting with "true" set condstack {1} set result {} set linenum 0 foreach line [split [readfile $infile] \n] { incr linenum if {[regexp {^@(if|else|endif)(\s*)(.*)} $line -> condtype condspace condargs]} { if {$condtype eq "if"} { if {[string length $condspace] == 0} { autosetup-error "$infile:$linenum: Invalid expression: $line" } if {[llength $condargs] == 1} { # ABC => [get-define ABC] ni {0 ""} # !ABC => [get-define ABC] in {0 ""} lassign $condargs condvar if {[regexp {^!(.*)} $condvar -> condvar]} { set op in } else { set op ni } set condexpr "\[[list get-define $condvar]\] $op {0 {}}" } else { # Translate alphanumeric ABC into [get-define ABC] and leave the # rest of the expression untouched regsub -all {([A-Z][[:alnum:]_]*)} $condargs {[get-define \1]} condexpr } if {[catch [list expr $condexpr] condval]} { dputs $condval autosetup-error "$infile:$linenum: Invalid expression: $line" } dputs "@$condtype: $condexpr => $condval" } if {$condtype ne "if"} { if {[llength $condstack] <= 1} { autosetup-error "$infile:$linenum: Error: @$condtype missing @if" } elseif {[string length $condargs] && [string index $condargs 0] ne "#"} { autosetup-error "$infile:$linenum: Error: Extra arguments after @$condtype" } } switch -exact $condtype { if { # push condval lappend condstack $condval } else { # Toggle the last entry set condval [lpop condstack] set condval [expr {!$condval}] lappend condstack $condval } endif { if {[llength $condstack] == 0} { user-notice "$infile:$linenum: Error: @endif missing @if" } lpop condstack } } continue } elseif {[regexp {^@include\s+(.*)} $line -> filearg]} { set incfile [string map $mapping $filearg] if {[file exists $incfile]} { lappend ::autosetup(deps) [file-normalize $incfile] lappend result {*}[include-file $incfile $mapping] } else { user-error "$infile:$linenum: Include file $incfile is missing" } continue } elseif {[regexp {^@define\s+(\w+)\s+(.*)} $line -> var val]} { define $var $val continue } # Only output this line if the stack contains all "true" if {"0" in $condstack} { continue } lappend result $line } return $result } # @make-template template ?outfile? # # Reads the input file '<srcdir>/$template' and writes the output file '$outfile' # (unless unchanged). # If '$outfile' is blank/omitted, '$template' should end with '.in' which # is removed to create the output file name. # # Each pattern of the form '@define@' is replaced with the corresponding # "define", if it exists, or left unchanged if not. # # The special value '@srcdir@' is substituted with the relative # path to the source directory from the directory where the output # file is created, while the special value '@top_srcdir@' is substituted # with the relative path to the top level source directory. # # Conditional sections may be specified as follows: ## @if NAME eq "value" ## lines ## @else ## lines ## @endif # # Where 'NAME' is a defined variable name and '@else' is optional. # Note that variables names *must* start with an uppercase letter. # If the expression does not match, all lines through '@endif' are ignored. # # The alternative forms may also be used: ## @if NAME (true if the variable is defined, but not empty and not "0") ## @if !NAME (opposite of the form above) ## @if <general-tcl-expression> # # In the general Tcl expression, any words beginning with an uppercase letter # are translated into [get-define NAME] # # Expressions may be nested # proc make-template {template {out {}}} { set infile [file join $::autosetup(srcdir) $template] if {![file exists $infile]} { user-error "Template $template is missing" } |
︙ | ︙ | |||
167 168 169 170 171 172 173 | # Make sure the directory exists file mkdir $outdir # Set up srcdir and top_srcdir to be relative to the target dir define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir] define top_srcdir [relative-path $::autosetup(srcdir) $outdir] | > > > | | | | < < < < < < | | < | < | < | | < < > > | < | < < < < < < < < < < < < | | | | | > > > > > > > > > > | > < | > > < | | < < | > > > > | > > > > > > > > > > | 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 | # Make sure the directory exists file mkdir $outdir # Set up srcdir and top_srcdir to be relative to the target dir define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir] define top_srcdir [relative-path $::autosetup(srcdir) $outdir] # Build map from global defines to their values so they can be # substituted into @include file names. proc build-define-mapping {} { set mapping {} foreach {n v} [array get ::define] { lappend mapping @$n@ $v } return $mapping } set mapping [build-define-mapping] set result [include-file $infile $mapping] # Rebuild the define mapping in case we ran across @define # directives in the template or a file it @included, then # apply that mapping to the expanded template. set mapping [build-define-mapping] write-if-changed $out [string map $mapping [join $result \n]] { msg-result "Created [relative-path $out] from [relative-path $template]" } } # build/host tuples and cross-compilation prefix opt-str build build "" define build_alias $build if {$build eq ""} { define build [config_guess] } else { define build [config_sub $build] } opt-str host host "" define host_alias $host if {$host eq ""} { define host [get-define build] set cross "" } else { define host [config_sub $host] set cross $host- } define cross [get-env CROSS $cross] # build/host _cpu, _vendor and _os foreach type {build host} { set v [get-define $type] if {![regexp {^([^-]+)-([^-]+)-(.*)$} $v -> cpu vendor os]} { user-error "Invalid canonical $type: $v" } define ${type}_cpu $cpu define ${type}_vendor $vendor define ${type}_os $os } opt-str prefix prefix /usr/local # These are for compatibility with autoconf define target [get-define host] define prefix $prefix define builddir $autosetup(builddir) define srcdir $autosetup(srcdir) define top_srcdir $autosetup(srcdir) define abs_top_srcdir [file-normalize $autosetup(srcdir)] define abs_top_builddir [file-normalize $autosetup(builddir)] # autoconf supports all of these define exec_prefix [opt-str exec-prefix exec_prefix $prefix] foreach {name defpath} { bindir /bin sbindir /sbin libexecdir /libexec libdir /lib } { define $name [opt-str $name o $exec_prefix$defpath] } foreach {name defpath} { datadir /share sharedstatedir /com infodir /share/info mandir /share/man includedir /include } { define $name [opt-str $name o $prefix$defpath] } if {$prefix ne {/usr}} { opt-str sysconfdir sysconfdir $prefix/etc } else { opt-str sysconfdir sysconfdir /etc } define sysconfdir $sysconfdir define localstatedir [opt-str localstatedir o /var] define runstatedir [opt-str runstatedir o /run] define SHELL [get-env SHELL [find-an-executable sh bash ksh]] # These could be used to generate Makefiles following some automake conventions define AM_SILENT_RULES [opt-bool silent-rules] define AM_MAINTAINER_MODE [opt-bool maintainer-mode] define AM_DEPENDENCY_TRACKING [opt-bool dependency-tracking] # Windows vs. non-Windows switch -glob -- [get-define host] { *-*-ming* - *-*-cygwin - *-*-msys { define-feature windows define EXEEXT .exe } |
︙ | ︙ |
Changes to autosetup/tmake.auto.
︙ | ︙ | |||
19 20 21 22 23 24 25 | } cc-check-tools ar ranlib set objdir [get-env BUILDDIR objdir] make-config-header $objdir/include/autoconf.h | | > > < < < < < < < < | < < < < < < < | > > > > | | < < | 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 | } cc-check-tools ar ranlib set objdir [get-env BUILDDIR objdir] make-config-header $objdir/include/autoconf.h make-tmake-settings $objdir/settings.conf {[A-Z]*} *dir lib_* } autosetup_check_create project.spec \ {# Initial project.spec created by 'autosetup --init=tmake' tmake-require-version 0.7.3 # vim:set syntax=tcl: define? DESTDIR _install # XXX If configure creates additional/different files than include/autoconf.h # that should be reflected here Autosetup include/autoconf.h # e.g. for autoconf.h IncludePaths include ifconfig !CONFIGURED { # Not configured, so don't process subdirs AutoSubDirs off # And don't process this file any further ifconfig false } } if {![file exists build.spec]} { puts "Note: I don't see build.spec. Try running: tmake --genie" } } |
Changes to autosetup/tmake.tcl.
︙ | ︙ | |||
13 14 15 16 17 18 19 | module-options {} define CONFIGURED # @make-tmake-settings outfile patterns ... # | | | | | 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 | module-options {} define CONFIGURED # @make-tmake-settings outfile patterns ... # # Examines all defined variables which match the given patterns (defaults to '*') # and writes a tmake-compatible .conf file defining those variables. # For example, if 'ABC' is '"3 monkeys"' and 'ABC' matches a pattern, then the file will include: # ## define ABC {3 monkeys} # # If the file would be unchanged, it is not written. # # Typical usage is: # ## make-tmake-settings [get-env BUILDDIR objdir]/settings.conf {[A-Z]*} proc make-tmake-settings {file args} { file mkdir [file dirname $file] set lines {} if {[llength $args] == 0} { set args * } |
︙ | ︙ |
Changes to configure.
1 2 | #!/bin/sh dir="`dirname "$0"`/autosetup" | | | 1 2 3 | #!/bin/sh dir="`dirname "$0"`/autosetup" WRAPPER="$0"; export WRAPPER; exec "`"$dir/autosetup-find-tclsh"`" "$dir/autosetup" "$@" |
Changes to fossil.1.
|
| | | < < | | | | | | | | | > > > > | | > | 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 | .TH FOSSIL "1" "September 2018" "http://fossil-scm.org" "User Commands" .SH NAME fossil \- Distributed Version Control System .SH SYNOPSIS .B fossil \fIhelp\fR .br .B fossil \fIhelp COMMAND\fR .br .B fossil \fICOMMAND [OPTIONS]\fR .SH DESCRIPTION Fossil is a distributed version control system (DVCS) with built-in forum, wiki, ticket tracker, CGI/HTTP interface, and HTTP server. .SH Common COMMANDs: add clean help push timeline .br addremove clone import rebuild ui .br all commit info remote-url undo .br amend delete init revert unpublished .br annotate diff ls rm unversioned .br bisect export merge settings update .br blame extras mv sql version .br branch finfo open stash .br bundle fusefs praise status .br cat gdiff publish sync .br changes grep pull tag .SH FEATURES Features as described on the fossil home page. .HP 1. .B Integrated Bug Tracking, Wiki, Forum, and Technotes - In addition to doing distributed version control like Git and Mercurial, Fossil also supports bug tracking, wiki, forum, and technotes. .HP 2. .B Built-in Web Interface - Fossil has a built-in and intuitive web interface that promotes project situational awareness. Type "fossil ui" and Fossil automatically opens a web browser to a page that shows detailed graphical history and |
︙ | ︙ | |||
64 65 66 67 68 69 70 | .HP 4. .B Simple Networking - No custom protocols or TCP ports. Fossil uses plain old HTTP (or HTTPS or SSH) for all network communications, so it works fine from behind restrictive firewalls, including proxies. The protocol is bandwidth | | > | | | | > > > | 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 | .HP 4. .B Simple Networking - No custom protocols or TCP ports. Fossil uses plain old HTTP (or HTTPS or SSH) for all network communications, so it works fine from behind restrictive firewalls, including proxies. The protocol is bandwidth efficient to the point that Fossil can be used comfortably over dial-up or over the exceedingly slow Wifi on airliners. .HP 5. .B CGI/SCGI Enabled - No server is required, but if you want to set one up, Fossil supports four easy server configurations. .HP 6. .B Autosync - Fossil supports "autosync" mode which helps to keep projects moving forward by reducing the amount of needless forking and merging often associated with distributed projects. .HP 7. .B Robust & Reliable - Fossil stores content using an enduring file format in an SQLite database so that transactions are atomic even if interrupted by a power loss or system crash. Automatic self-checks verify that all aspects of the repository are consistent prior to each commit. .HP 8. .B Free and Open-Source - Uses the 2-clause BSD license. .SH DOCUMENTATION http://www.fossil-scm.org/ .br .B fossil \fIui\fR |
Changes to skins/ardoise/css.txt.
︙ | ︙ | |||
800 801 802 803 804 805 806 807 808 809 810 811 812 813 | ul.browser li.file:hover, ul.browser li.file:hover * { background-color: #333 } td.browser, td.tktDescLabel { vertical-align: top } div.filetreeline { display: table; width: 100%; white-space: nowrap } .filetree { | > > > > > > | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | ul.browser li.file:hover, ul.browser li.file:hover * { background-color: #333 } td.browser, td.tktDescLabel { vertical-align: top } td.tktTlOpen { color: #ffa0a0; } td.tktTlClosed { color: #555; } div.filetreeline { display: table; width: 100%; white-space: nowrap } .filetree { |
︙ | ︙ | |||
945 946 947 948 949 950 951 952 953 954 955 956 957 958 | .timelineSelected > .timelineVerboseCell { padding: .75em; border-radius: 5px; border: solid #ff8000; vertical-align: top; text-align: left; background: #442800 } .timelineCurrent > .timelineColumnarCell, .timelineCurrent > .timelineCompactCell, .timelineCurrent > .timelineDetailCell, .timelineCurrent > .timelineModernCell, .timelineCurrent > .timelineVerboseCell { vertical-align: top; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | .timelineSelected > .timelineVerboseCell { padding: .75em; border-radius: 5px; border: solid #ff8000; vertical-align: top; text-align: left; background: #442800 } span.timelineSelected { border-radius: 5px; border: solid #ff8000; vertical-align: top; text-align: left; background: #442800 } .timelineSelected {} .timelineSecondary {} .timelineSecondary > .timelineColumnarCell, .timelineSecondary > .timelineCompactCell, .timelineSecondary > .timelineDetailCell, .timelineSecondary > .timelineModernCell, .timelineSecondary > .timelineVerboseCell { padding: .75em; border-radius: 5px; border: solid #0080ff; vertical-align: top; text-align: left; background: #002844 } span.timelineSecondary { border-radius: 5px; border: solid #0080ff; vertical-align: top; text-align: left; background: #002844 } .timelineCurrent > .timelineColumnarCell, .timelineCurrent > .timelineCompactCell, .timelineCurrent > .timelineDetailCell, .timelineCurrent > .timelineModernCell, .timelineCurrent > .timelineVerboseCell { vertical-align: top; |
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | } .tl-arrow.merge.r { border-left: 3px solid #bbb } .tl-line.merge { width: 1px } .intLink[title="Add indentation"], .intLink[title="Center align"], .intLink[title="Dotted list"], .intLink[title="Left align"], .intLink[title="Numbered list"], .intLink[title="Remove formatting"], .intLink[title="Right align"], | > > > > > > > > > > > > > > > > > > > > > > > | 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 | } .tl-arrow.merge.r { border-left: 3px solid #bbb } .tl-line.merge { width: 1px } .tl-arrow.cherrypick { height: 1px; border-width: 2px 0; } .tl-arrow.cherrypick.l { border-right: 3px solid #bbb; } .tl-arrow.cherrypick.r { border-left: 3px solid #bbb; } .tl-line.cherrypick.h { width: 0px; border-top: 1px dashed #bbb; border-left: 0px dashed #bbb; background: rgba(255,255,255,0); } .tl-line.cherrypick.v { width: 0px; border-top: 0px dashed #bbb; border-left: 1px dashed #bbb; background: rgba(255,255,255,0); } .intLink[title="Add indentation"], .intLink[title="Center align"], .intLink[title="Dotted list"], .intLink[title="Left align"], .intLink[title="Numbered list"], .intLink[title="Remove formatting"], .intLink[title="Right align"], |
︙ | ︙ |
Changes to skins/blitz/css.txt.
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | tr.timelineCurrent { border-left: 2px solid orange; background-color: #ffc; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; } | | > > > | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | tr.timelineCurrent { border-left: 2px solid orange; background-color: #ffc; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; } .timelineSelected { border-left: 2px solid orange; background-color: #ffffe8; border-bottom: 1px solid #ddd; border-right: 1px solid #ddd; } .timelineSecondary { background-color: #e8ffff; } tr.timelineCurrent td.timelineTableCell { } tr.timelineBottom td { border-bottom: 0; } |
︙ | ︙ |
Changes to skins/bootstrap/footer.txt.
1 2 3 4 5 6 7 8 9 10 11 | <th1> if {! $is_index && ! $is_home} { html "</div>" } </th1> </div> <div id="push"></div> </div> <footer id="footer"> <p>© Copyright $<project_name>. All right reserved. Fossil $release_version · <a href="$home/timeline.rss">RSS</a></p> </footer> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <th1> if {! $is_index && ! $is_home} { html "</div>" } </th1> </div> <div id="push"></div> </div> <footer id="footer"> <p>© Copyright $<project_name>. All right reserved. Fossil $release_version · <a href="$home/timeline.rss">RSS</a></p> </footer> <script nonce="$<nonce>"> var tables = document.querySelectorAll('table'); for (var i = 0; i < tables.length; i++) { if (tables[i].id !== "timelineTable") tables[i].classList.add('table'); }; var submenus = document.querySelectorAll('.submenu'); for (var i = 0; i < submenus.length; i++) { |
︙ | ︙ |
Changes to skins/bootstrap/header.txt.
1 2 3 4 5 6 7 8 | <html lang="en"> <head> <meta charset="utf-8"> <base href="$baseurl/$current_page" /> <title>$<project_name>: $<title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$home/timeline.rss" /> <link rel="stylesheet" href="$home/style.css?default" type="text/css" media="screen" /> | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <html lang="en"> <head> <meta charset="utf-8"> <base href="$baseurl/$current_page" /> <title>$<project_name>: $<title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="Content-Security-Policy" content="$default_csp"/> <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="$home/timeline.rss" /> <link rel="stylesheet" href="$home/style.css?default" type="text/css" media="screen" /> <script nonce="$<nonce>"> function gebi(x){ if(/^#/.test(x)) x = x.substr(1); var e = document.getElementById(x); if(!e) throw new Error("Expecting element with ID "+x); else return e; } </script> |
︙ | ︙ | |||
112 113 114 115 116 117 118 | </div><!--/.nav-collapse --> </div> </div> <div class="content"> <th1> html "<div class='container'>" html "<ul class='breadcrumb'>" | | | | 113 114 115 116 117 118 119 120 121 122 123 | </div><!--/.nav-collapse --> </div> </div> <div class="content"> <th1> html "<div class='container'>" html "<ul class='breadcrumb'>" html "<li><a href='$home$index_page'>Home</a></li>" html "<li><a href='$home/$current_page'>[htmlize $title]</a></li>" html "</ul>" </th1> |
Changes to skins/default/css.txt.
︙ | ︙ | |||
141 142 143 144 145 146 147 148 149 | .udiff, .sbsdiff { font-size: .85em !important; overflow: auto; border: 1px solid #ccc; border-radius: 5px; } .content blockquote { background-color: rgba(65, 131, 196, 0.1); border-left: 3px solid #254769; | > > > | < | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | .udiff, .sbsdiff { font-size: .85em !important; overflow: auto; border: 1px solid #ccc; border-radius: 5px; } .content blockquote { padding: 0 15px; } div.forumHierRoot blockquote, div.forumHier blockquote, div.forumEdit blockquote { background-color: rgba(65, 131, 196, 0.1); border-left: 3px solid #254769; padding: .1em 1em; } table.report { cursor: auto; border-radius: 5px; border: 1px solid #ccc; margin: 1em 0; |
︙ | ︙ |
Changes to skins/default/header.txt.
︙ | ︙ | |||
15 16 17 18 19 20 21 | upvar home home if {[string range $url 0 [string length $current]] eq "/$current"} { html "<a href='$home$url' class='active $cls'>$name</a>\n" } else { html "<a href='$home$url' class='$cls'>$name</a>\n" } } | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | upvar home home if {[string range $url 0 [string length $current]] eq "/$current"} { html "<a href='$home$url' class='active $cls'>$name</a>\n" } else { html "<a href='$home$url' class='$cls'>$name</a>\n" } } html "<a id='hbbtn' href='/sitemap'>☰</a>" menulink $index_page Home {} if {[anycap jor]} { menulink /timeline Timeline {} } if {[hascap oh]} { menulink /dir?ci=tip Files desktoponly } |
︙ | ︙ |
Changes to skins/default/js.txt.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 | ******************************************************************************* ** ** This file contains the JS code specific to the Fossil default skin. ** Currently, the only thing this does is handle clicks on its hamburger ** menu button. */ (function() { var panel = document.getElementById("hbdrop"); if (!panel) return; // site admin might've nuked it var panelBorder = panel.style.border; | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > | | > > > > > | 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 | ******************************************************************************* ** ** This file contains the JS code specific to the Fossil default skin. ** Currently, the only thing this does is handle clicks on its hamburger ** menu button. */ (function() { var hbButton = document.getElementById("hbbtn"); if (!hbButton) return; // no hamburger button if (!document.addEventListener) { // Turn the button into a link to the sitemap for incompatible browsers. hbButton.href = "$home/sitemap"; return; } var panel = document.getElementById("hbdrop"); if (!panel) return; // site admin might've nuked it if (!panel.style) return; // shouldn't happen, but be sure var panelBorder = panel.style.border; var panelInitialized = false; // reset if browser window is resized var panelResetBorderTimerID = 0; // used to cancel post-animation tasks // Disable animation if this browser doesn't support CSS transitions. // // We need this ugly calling form for old browsers that don't allow // panel.style.hasOwnProperty('transition'); catering to old browsers // is the whole point here. var animate = panel.style.transition !== null && (typeof(panel.style.transition) == "string"); // The duration of the animation can be overridden from the default skin // header.txt by setting the "data-anim-ms" attribute of the panel. var animMS = panel.getAttribute("data-anim-ms"); if (animMS) { // not null or empty string, parse it animMS = parseInt(animMS); if (isNaN(animMS) || animMS == 0) animate = false; // disable animation if non-numeric or zero else if (animMS < 0) animMS = 400; // set default animation duration if negative } else // attribute is null or empty string, use default animMS = 400; // Calculate panel height despite its being hidden at call time. // Based on https://stackoverflow.com/a/29047447/142454 var panelHeight; // computed on first panel display function calculatePanelHeight() { // Clear the max-height CSS property in case the panel size is recalculated // after the browser window was resized. panel.style.maxHeight = ''; // Get initial panel styles so we can restore them below. var es = window.getComputedStyle(panel), edis = es.display, epos = es.position, evis = es.visibility; // Restyle the panel so we can measure its height while invisible. |
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 | // first call, where the div was initially invisible. If we were // to change the panel's visibility and height at the same time // instead, that would prevent the browser from seeing the height // change as a state transition, so it'd skip the CSS transition: // // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#JavaScript_examples function showPanel() { if (animate) { setTimeout(function() { panel.style.maxHeight = panelHeight; panel.style.border = panelBorder; }, 40); // 25ms is insufficient with Firefox 62 } | > > > > > > > > > > > > > > > > > > < | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > | > | > > > > > > > > | | | > | > | > | | | | | | | | | < | < | < < < < < < < < < < < | | | | | | | | | < | > | 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 | // first call, where the div was initially invisible. If we were // to change the panel's visibility and height at the same time // instead, that would prevent the browser from seeing the height // change as a state transition, so it'd skip the CSS transition: // // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#JavaScript_examples function showPanel() { // Cancel the timer to remove the panel border after the closing animation, // otherwise double-clicking the hamburger button with the panel opened will // remove the borders from the (closed and immediately reopened) panel. if (panelResetBorderTimerID) { clearTimeout(panelResetBorderTimerID); panelResetBorderTimerID = 0; } if (animate) { if (!panelInitialized) { panelInitialized = true; // Set up a CSS transition to animate the panel open and // closed. Only needs to be done once per page load. // Based on https://stackoverflow.com/a/29047447/142454 calculatePanelHeight(); panel.style.transition = 'max-height ' + animMS + 'ms ease-in-out'; panel.style.overflowY = 'hidden'; panel.style.maxHeight = '0'; } setTimeout(function() { panel.style.maxHeight = panelHeight; panel.style.border = panelBorder; }, 40); // 25ms is insufficient with Firefox 62 } panel.style.display = 'block'; document.addEventListener('keydown',panelKeydown,/* useCapture == */true); document.addEventListener('click',panelClick,false); } var panelKeydown = function(event) { var key = event.which || event.keyCode; if (key == 27) { event.stopPropagation(); // ignore other keydown handlers panelToggle(true); } }; var panelClick = function(event) { if (!panel.contains(event.target)) { // Call event.preventDefault() to have clicks outside the opened panel // just close the panel, and swallow clicks on links or form elements. //event.preventDefault(); panelToggle(true); } }; // Return true if the panel is showing. function panelShowing() { if (animate) { return panel.style.maxHeight == panelHeight; } else { return panel.style.display == 'block'; } } // Check if the specified HTML element has any child elements. Note that plain // text nodes, comments, and any spaces (presentational or not) are ignored. function hasChildren(element) { var childElement = element.firstChild; while (childElement) { if (childElement.nodeType == 1) // Node.ELEMENT_NODE == 1 return true; childElement = childElement.nextSibling; } return false; } // Reset the state of the panel to uninitialized if the browser window is // resized, so the dimensions are recalculated the next time it's opened. window.addEventListener('resize',function(event) { panelInitialized = false; },false); // Click handler for the hamburger button. hbButton.addEventListener('click',function(event) { // Break the event handler chain, or the handler for document → click // (about to be installed) may already be triggered by the current event. event.stopPropagation(); event.preventDefault(); // prevent browser from acting on <a> click panelToggle(false); },false); function panelToggle(suppressAnimation) { if (panelShowing()) { document.removeEventListener('keydown',panelKeydown,/* useCapture == */true); document.removeEventListener('click',panelClick,false); // Transition back to hidden state. if (animate) { if (suppressAnimation) { var transition = panel.style.transition; panel.style.transition = ''; panel.style.maxHeight = '0'; panel.style.border = 'none'; setTimeout(function() { // Make sure CSS transition won't take effect now, so restore it // asynchronously. Outer variable 'transition' still valid here. panel.style.transition = transition; }, 40); // 25ms is insufficient with Firefox 62 } else { panel.style.maxHeight = '0'; panelResetBorderTimerID = setTimeout(function() { // Browsers show a 1px high border line when maxHeight == 0, // our "hidden" state, so hide the borders in that state, too. panel.style.border = 'none'; panelResetBorderTimerID = 0; // clear ID of completed timer }, animMS); } } else { panel.style.display = 'none'; } } else { if (!hasChildren(panel)) { // Only get the sitemap once per page load: it isn't likely to // change on us. var xhr = new XMLHttpRequest(); xhr.onload = function() { var doc = xhr.responseXML; if (doc) { var sm = doc.querySelector("ul#sitemap"); if (sm && xhr.status == 200) { // Got sitemap. Insert it into the drop-down panel. panel.innerHTML = sm.outerHTML; // Display the panel showPanel(); } } // else, can't parse response as HTML or XML } xhr.open("GET", "$home/sitemap?popup"); // note the TH1 substitution! xhr.responseType = "document"; xhr.send(); } else { showPanel(); // just show what we built above } } } })(); |
Changes to skins/eagle/css.txt.
︙ | ︙ | |||
166 167 168 169 170 171 172 | border: 0; cellpadding: 0; font-family: "courier new"; border-spacing: 0px 2px; // border-collapse: collapse; } | | > > > | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | border: 0; cellpadding: 0; font-family: "courier new"; border-spacing: 0px 2px; // border-collapse: collapse; } .timelineSelected { background-color: #7EA2D9; } .timelineSecondary { background-color: #7EA27E; } /* commit node */ .tl-node { width: 10px; height: 10px; border: 1px solid #fff; background: #485D7B; |
︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | border-right: 3px solid #fff; } /* right merge arrow */ .tl-arrow.merge.r { border-left: 3px solid #fff; } /* Side-by-side diff */ table.sbsdiff { background-color: #485D7B; font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace; font-size: 8pt; border-collapse:collapse; | > > > > > > > > > > > > > > > > > > > > > > > > | 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 | border-right: 3px solid #fff; } /* right merge arrow */ .tl-arrow.merge.r { border-left: 3px solid #fff; } .tl-arrow.cherrypick { height: 1px; border-width: 2px 0; } .tl-arrow.cherrypick.l { border-right: 3px solid #fff; } .tl-arrow.cherrypick.r { border-left: 3px solid #fff; } .tl-line.cherrypick.h { width: 0px; border-top: 1px dashed #fff; border-left: 0px dashed #fff; background: rgba(255,255,255,0); } .tl-line.cherrypick.v { width: 0px; border-top: 0px dashed #fff; border-left: 1px dashed #fff; background: rgba(255,255,255,0); } /* Side-by-side diff */ table.sbsdiff { background-color: #485D7B; font-family: fixed, Dejavu Sans Mono, Monaco, Lucida Console, monospace; font-size: 8pt; border-collapse:collapse; |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 | /* format for values on ticket display page */ td.tktDspValue { text-align: left; vertical-align: top; background-color: #485D7B; } /* format for example table cells on the report edit page */ td.rpteditex { border-width: thin; border-color: white; border-style: solid; } | > > > > > > > > | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | /* format for values on ticket display page */ td.tktDspValue { text-align: left; vertical-align: top; background-color: #485D7B; } /* Ticket display on timelines */ td.tktTlOpen { color: #ffc0c0; } td.tktTlClose { color: #c0c0c0; } /* format for example table cells on the report edit page */ td.rpteditex { border-width: thin; border-color: white; border-style: solid; } |
︙ | ︙ |
Changes to skins/enhanced1/header.txt.
︙ | ︙ | |||
61 62 63 64 65 66 67 | set logourl [getLogoUrl $baseurl] </th1> <a href="$logourl"> <img src="$logo_image_url" border="0" alt="$project_name"> </a> </div> <div class="title">$<title></div> | | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | set logourl [getLogoUrl $baseurl] </th1> <a href="$logourl"> <img src="$logo_image_url" border="0" alt="$project_name"> </a> </div> <div class="title">$<title></div> <div class="status"><nobr><th1> if {[info exists login]} { puts "Logged in as $login" } else { puts "Not logged in" } </th1></nobr><small><div id="clock"></div></small></div> </div> |
︙ | ︙ |
Changes to skins/xekri/css.txt.
︙ | ︙ | |||
693 694 695 696 697 698 699 700 701 702 703 704 705 706 | /* format for values on ticket display page */ td.tktDspValue { background-color: #111; text-align: left; vertical-align: top; } /* format for ticket error messages */ span.tktError { color: #f00; font-weight: bold; } | > > > > > | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | /* format for values on ticket display page */ td.tktDspValue { background-color: #111; text-align: left; vertical-align: top; } /* Tickets on timelines */ td.tktTlOpen { color: #ffa0a0; } /* format for ticket error messages */ span.tktError { color: #f00; font-weight: bold; } |
︙ | ︙ | |||
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 | } .timelineTable .timelineSelected { background: #222; border: 0; box-shadow: none; } .timelineTable .timelineSelected .timelineTime { background: #333; border-radius: 1rem 0 0 1rem; box-shadow: 2px 2px 1px #000; } .timelineTable .timelineSelected .timelineColumnarCell { background: #333; box-shadow: 2px 2px 1px #000; } .timelineTable .timelineSelected .timelineModernCell , .timelineTable .timelineSelected .timelineCompactCell , .timelineTable .timelineSelected .timelineVerboseCell , .timelineTable .timelineSelected .timelineDetailCell { background: #333; border-radius: 0 1rem 1rem 0; box-shadow: 2px 2px 1px #000; } .timelineTable .timelineModernCell .timelineModernComment , .timelineTable .timelineModernCell .timelineModernDetail , .timelineTable .timelineCompactCell .timelineCompactComment , .timelineTable .timelineCompactCell .timelineCompactDetail , .timelineTable .timelineVerboseCell .timelineVerboseComment , .timelineTable .timelineVerboseCell .timelineVerboseDetail { | > > > > > > > > > | 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 | } .timelineTable .timelineSelected { background: #222; border: 0; box-shadow: none; } .timelineSelected {} .timelineSecondary {} .timelineTable .timelineSelected .timelineTime { background: #333; border-radius: 1rem 0 0 1rem; box-shadow: 2px 2px 1px #000; } .timelineTable .timelineSelected .timelineColumnarCell { background: #333; box-shadow: 2px 2px 1px #000; } .timelineTable .timelineSelected .timelineModernCell , .timelineTable .timelineSelected .timelineCompactCell , .timelineTable .timelineSelected .timelineVerboseCell , .timelineTable .timelineSelected .timelineDetailCell { background: #333; border-radius: 0 1rem 1rem 0; box-shadow: 2px 2px 1px #000; } span.timelineSelected { padding: 0 1em 0 1em; border-radius: 1rem; background: #333; box-shadow: 2px 2px 1px #000; } .timelineTable .timelineModernCell .timelineModernComment , .timelineTable .timelineModernCell .timelineModernDetail , .timelineTable .timelineCompactCell .timelineCompactComment , .timelineTable .timelineCompactCell .timelineCompactDetail , .timelineTable .timelineVerboseCell .timelineVerboseComment , .timelineTable .timelineVerboseCell .timelineVerboseDetail { |
︙ | ︙ |
Changes to src/add.c.
︙ | ︙ | |||
185 186 187 188 189 190 191 | db_multi_exec("UPDATE vfile SET deleted=0" " WHERE pathname=%Q %s AND deleted", zPath, filename_collation()); }else{ char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); int isExe = file_isexe(zFullname, RepoFILE); db_multi_exec( | | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | db_multi_exec("UPDATE vfile SET deleted=0" " WHERE pathname=%Q %s AND deleted", zPath, filename_collation()); }else{ char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); int isExe = file_isexe(zFullname, RepoFILE); db_multi_exec( "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink,mhash)" "VALUES(%d,0,0,0,%Q,%d,%d,NULL)", vid, zPath, isExe, file_islink(0)); fossil_free(zFullname); } if( db_changes() ){ fossil_print("ADDED %s\n", zPath); return 1; }else{ |
︙ | ︙ | |||
326 327 328 329 330 331 332 | file_tree_name(g.argv[i], &fullName, 0, 1); blob_reset(&fullName); file_canonical_name(g.argv[i], &fullName, 0); zName = blob_str(&fullName); isDir = file_isdir(zName, RepoFILE); if( isDir==1 ){ | | > | 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 | file_tree_name(g.argv[i], &fullName, 0, 1); blob_reset(&fullName); file_canonical_name(g.argv[i], &fullName, 0); zName = blob_str(&fullName); isDir = file_isdir(zName, RepoFILE); if( isDir==1 ){ vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE); }else if( isDir==0 ){ fossil_warning("not found: %s", zName); }else{ char *zTreeName = &zName[nRoot]; if( !forceFlag && glob_match(pIgnore, zTreeName) ){ Blob ans; char cReply; char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". " "Add it (a=all/y/N)? ", zTreeName); prompt_user(prompt, &ans); fossil_free(prompt); cReply = blob_str(&ans)[0]; blob_reset(&ans); if( cReply=='a' || cReply=='A' ){ forceFlag = 1; }else if( cReply!='y' && cReply!='Y' ){ blob_reset(&fullName); continue; |
︙ | ︙ | |||
675 676 677 678 679 680 681 | db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s)", filename_collation()); n = strlen(g.zLocalRoot); blob_init(&path, g.zLocalRoot, n-1); /* now we read the complete file structure into a temp table */ pClean = glob_create(zCleanFlag); pIgnore = glob_create(zIgnoreFlag); | | | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s)", filename_collation()); n = strlen(g.zLocalRoot); blob_init(&path, g.zLocalRoot, n-1); /* now we read the complete file structure into a temp table */ pClean = glob_create(zCleanFlag); pIgnore = glob_create(zIgnoreFlag); vfile_scan(&path, blob_size(&path), scanFlags, pClean, pIgnore, RepoFILE); glob_free(pIgnore); glob_free(pClean); nAdd = add_files_in_sfile(vid); /* step 2: search for missing files */ db_prepare(&q, "SELECT pathname, %Q || pathname, deleted FROM vfile" |
︙ | ︙ | |||
933 934 935 936 937 938 939 | int nOrig; file_tree_name(g.argv[i], &orig, 0, 1); zOrig = blob_str(&orig); nOrig = blob_size(&orig); db_prepare(&q, "SELECT pathname FROM vfile" " WHERE vid=%d" | | | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | int nOrig; file_tree_name(g.argv[i], &orig, 0, 1); zOrig = blob_str(&orig); nOrig = blob_size(&orig); db_prepare(&q, "SELECT pathname FROM vfile" " WHERE vid=%d" " AND (pathname='%q' %s OR (pathname>'%q/' %s AND pathname<'%q0' %s))" " ORDER BY 1", vid, zOrig, filename_collation(), zOrig, filename_collation(), zOrig, filename_collation() ); while( db_step(&q)==SQLITE_ROW ){ const char *zPath = db_column_text(&q, 0); int nPath = db_column_bytes(&q, 0); |
︙ | ︙ | |||
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | while( db_step(&q)==SQLITE_ROW ){ const char *zFrom = db_column_text(&q, 0); const char *zTo = db_column_text(&q, 1); mv_one_file(vid, zFrom, zTo, dryRunFlag); if( moveFiles ) add_file_to_move(zFrom, zTo); } db_finalize(&q); db_end_transaction(0); if( moveFiles ) process_files_to_move(dryRunFlag); } /* ** Function for stash_apply to be able to restore a file and indicate ** newly ADDED state. */ int stash_add_files_in_sfile(int vid){ return add_files_in_sfile(vid); } | > | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | while( db_step(&q)==SQLITE_ROW ){ const char *zFrom = db_column_text(&q, 0); const char *zTo = db_column_text(&q, 1); mv_one_file(vid, zFrom, zTo, dryRunFlag); if( moveFiles ) add_file_to_move(zFrom, zTo); } db_finalize(&q); undo_reset(); db_end_transaction(0); if( moveFiles ) process_files_to_move(dryRunFlag); } /* ** Function for stash_apply to be able to restore a file and indicate ** newly ADDED state. */ int stash_add_files_in_sfile(int vid){ return add_files_in_sfile(vid); } |
Changes to src/alerts.c.
︙ | ︙ | |||
108 109 110 111 112 113 114 | ** ** If the bOnlyIfEnabled option is true, then tables are only created ** if the email-send-method is something other than "off". */ void alert_schema(int bOnlyIfEnabled){ if( !alert_tables_exist() ){ if( bOnlyIfEnabled | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | ** ** If the bOnlyIfEnabled option is true, then tables are only created ** if the email-send-method is something other than "off". */ void alert_schema(int bOnlyIfEnabled){ if( !alert_tables_exist() ){ if( bOnlyIfEnabled && fossil_strcmp(db_get("email-send-method",0),"off")==0 ){ return; /* Don't create table for disabled email */ } db_multi_exec(zAlertInit/*works-like:""*/); alert_triggers_enable(); }else if( !db_table_has_column("repository","pending_alert","sentMod") ){ db_multi_exec( |
︙ | ︙ | |||
156 157 158 159 160 161 162 | } /* ** Return true if email alerts are active. */ int alert_enabled(void){ if( !alert_tables_exist() ) return 0; | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | } /* ** Return true if email alerts are active. */ int alert_enabled(void){ if( !alert_tables_exist() ) return 0; if( fossil_strcmp(db_get("email-send-method",0),"off")==0 ) return 0; return 1; } /* ** If the subscriber table does not exist, then paint an error message ** web page and return true. ** |
︙ | ︙ | |||
480 481 482 483 484 485 486 | p = fossil_malloc(sizeof(*p)); memset(p, 0, sizeof(*p)); blob_init(&p->out, 0, 0); p->mFlags = mFlags; if( zAltDest ){ p->zDest = zAltDest; }else{ | | | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | p = fossil_malloc(sizeof(*p)); memset(p, 0, sizeof(*p)); blob_init(&p->out, 0, 0); p->mFlags = mFlags; if( zAltDest ){ p->zDest = zAltDest; }else{ p->zDest = db_get("email-send-method",0); } if( fossil_strcmp(p->zDest,"off")==0 ) return p; if( emailerGetSetting(p, &p->zFrom, "email-self") ) return p; if( fossil_strcmp(p->zDest,"db")==0 ){ char *zErr; int rc; if( emailerGetSetting(p, &p->zDb, "email-send-db") ) return p; |
︙ | ︙ | |||
802 803 804 805 806 807 808 | blob_appendf(pOut, "%.72c\n", '='); } }else{ blob_init(&all, 0, 0); pOut = &all; } blob_append(pOut, blob_buffer(pHdr), blob_size(pHdr)); | > > | | 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | blob_appendf(pOut, "%.72c\n", '='); } }else{ blob_init(&all, 0, 0); pOut = &all; } blob_append(pOut, blob_buffer(pHdr), blob_size(pHdr)); if( p->zFrom==0 || p->zFrom[0]==0 ){ return; /* email-self is not set. Error will be reported separately */ }else if( zFromName ){ blob_appendf(pOut, "From: %s <%s@%s>\r\n", zFromName, alert_mailbox_name(zFromName), alert_hostname(p->zFrom)); blob_appendf(pOut, "X-Fossil-From: <%s>\r\n", p->zFrom); }else{ blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); } blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
︙ | ︙ | |||
844 845 846 847 848 849 850 | emailerError(p, "Failed to insert email message into output queue.\n" "%s", sqlite3_errmsg(p->db)); } }else if( p->zCmd ){ FILE *out = popen(p->zCmd, "w"); if( out ){ fwrite(blob_buffer(&all), 1, blob_size(&all), out); | | | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | emailerError(p, "Failed to insert email message into output queue.\n" "%s", sqlite3_errmsg(p->db)); } }else if( p->zCmd ){ FILE *out = popen(p->zCmd, "w"); if( out ){ fwrite(blob_buffer(&all), 1, blob_size(&all), out); pclose(out); }else{ emailerError(p, "Could not open output pipe \"%s\"", p->zCmd); } }else if( p->zDir ){ char *zFile = file_time_tempname(p->zDir, ".email"); blob_write_to_file(&all, zFile); fossil_free(zFile); |
︙ | ︙ | |||
920 921 922 923 924 925 926 | ** are sent when email-send-method is "relay". There should be an ** SMTP server configured as a Mail Submission Agent listening on the ** designated host and port and all times. */ /* | | | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 | ** are sent when email-send-method is "relay". There should be an ** SMTP server configured as a Mail Submission Agent listening on the ** designated host and port and all times. */ /* ** COMMAND: alerts* ** ** Usage: %fossil alerts SUBCOMMAND ARGS... ** ** Subcommands: ** ** pending Show all pending alerts. Useful for debugging. ** |
︙ | ︙ | |||
1999 2000 2001 2002 2003 2004 2005 | const char *zFrom; const char *zSub; /* First do non-forum post events */ db_prepare(&q, "SELECT" | > > > | | 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 | const char *zFrom; const char *zSub; /* First do non-forum post events */ db_prepare(&q, "SELECT" " CASE WHEN event.type='t'" " THEN (SELECT substr(tagname,5) FROM tag" " WHERE tagid=event.tagid AND tagname LIKE 'tkt-%%')" " ELSE blob.uuid END," /* 0 */ " datetime(event.mtime)," /* 1 */ " coalesce(ecomment,comment)" " || ' (user: ' || coalesce(euser,user,'?')" " || (SELECT case when length(x)>0 then ' tags: ' || x else '' end" " FROM (SELECT group_concat(substr(tagname,5), ', ') AS x" " FROM tag, tagxref" " WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid" |
︙ | ︙ | |||
2033 2034 2035 2036 2037 2038 2039 | p->type = db_column_text(&q, 3)[0]; p->needMod = db_column_int(&q, 4); p->zFromName = 0; p->pNext = 0; switch( p->type ){ case 'c': zType = "Check-In"; break; case 'f': zType = "Forum post"; break; | | | | 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 | p->type = db_column_text(&q, 3)[0]; p->needMod = db_column_int(&q, 4); p->zFromName = 0; p->pNext = 0; switch( p->type ){ case 'c': zType = "Check-In"; break; case 'f': zType = "Forum post"; break; case 't': zType = "Ticket Change"; break; case 'w': zType = "Wiki Edit"; break; } blob_init(&p->hdr, 0, 0); blob_init(&p->txt, 0, 0); blob_appendf(&p->txt,"== %s %s ==\n%s\n%s/info/%.20s\n", db_column_text(&q,1), zType, db_column_text(&q,2), |
︙ | ︙ | |||
2424 2425 2426 2427 2428 2429 2430 | const char *zEmail = db_column_text(&q, 1); const char *zCap = db_column_text(&q, 3); int nHit = 0; for(p=pEvents; p; p=p->pNext){ if( strchr(zSub,p->type)==0 ) continue; if( p->needMod ){ /* For events that require moderator approval, only send an alert | | > > | | | | | | > | 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 | const char *zEmail = db_column_text(&q, 1); const char *zCap = db_column_text(&q, 3); int nHit = 0; for(p=pEvents; p; p=p->pNext){ if( strchr(zSub,p->type)==0 ) continue; if( p->needMod ){ /* For events that require moderator approval, only send an alert ** if the recipient is a moderator for that type of event. Setup ** and Admin users always get notified. */ char xType = '*'; if( strpbrk(zCap,"as")==0 ){ switch( p->type ){ case 'f': xType = '5'; break; case 't': xType = 'q'; break; case 'w': xType = 'l'; break; } if( strchr(zCap,xType)==0 ) continue; } }else if( strchr(zCap,'s')!=0 || strchr(zCap,'a')!=0 ){ /* Setup and admin users can get any notification that does not ** require moderation */ }else{ /* Other users only see the alert if they have sufficient ** privilege to view the event itself */ char xType = '*'; |
︙ | ︙ | |||
2696 2697 2698 2699 2700 2701 2702 | return; } if( fossil_strcmp(P("name"),"test1")==0 ){ /* Visit the /announce/test1 page to see the CGI variables */ @ <p style='border: 1px solid black; padding: 1ex;'> cgi_print_all(0, 0); @ </p> | < | > > > > > > > | 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 | return; } if( fossil_strcmp(P("name"),"test1")==0 ){ /* Visit the /announce/test1 page to see the CGI variables */ @ <p style='border: 1px solid black; padding: 1ex;'> cgi_print_all(0, 0); @ </p> }else if( P("submit")!=0 && cgi_csrf_safe(1) ){ char *zErr = alert_send_announcement(); style_header("Announcement Sent"); if( zErr ){ @ <h1>Internal Error</h1> @ <p>The following error was reported by the system: @ <blockquote><pre> @ %h(zErr) @ </pre></blockquote> }else{ @ <p>The announcement has been sent.</p> } style_footer(); return; } else if( !alert_enabled() ){ style_header("Cannot Send Announcement"); @ <p>Either you have no subscribers yet, or email alerts are not yet @ <a href="https://fossil-scm.org/fossil/doc/trunk/www/alerts.md">set up</a> @ for this repository.</p> return; } style_header("Send Announcement"); @ <form method="POST"> @ <table class="subscribe"> if( g.perm.Admin ){ int aa = PB("aa"); int all = PB("all"); const char *aack = aa ? "checked" : ""; |
︙ | ︙ |
Changes to src/backoffice.c.
︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | # include <unistd.h> # include <sys/types.h> # include <signal.h> # include <errno.h> # include <fcntl.h> # define GETPID getpid #endif /* ** The BKOFCE_LEASE_TIME is the amount of time for which a single backoffice ** processing run is valid. Each backoffice run monopolizes the lease for ** at least this amount of time. Hopefully all backoffice processing is ** finished much faster than this - usually in less than a second. But ** regardless of how long each invocation lasts, successive backoffice runs | > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | # include <unistd.h> # include <sys/types.h> # include <signal.h> # include <errno.h> # include <fcntl.h> # define GETPID getpid #endif #include <time.h> /* ** The BKOFCE_LEASE_TIME is the amount of time for which a single backoffice ** processing run is valid. Each backoffice run monopolizes the lease for ** at least this amount of time. Hopefully all backoffice processing is ** finished much faster than this - usually in less than a second. But ** regardless of how long each invocation lasts, successive backoffice runs |
︙ | ︙ | |||
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 | Lease x; sqlite3_uint64 tmNow; if( backofficeDb ) return; if( g.zRepositoryName==0 ) return; if( g.db==0 ) return; if( !db_table_exists("repository","config") ) return; tmNow = time(0); backofficeReadLease(&x); if( x.tmNext>=tmNow && backofficeProcessExists(x.idNext) ){ /* Another backoffice process is already queued up to run. This ** process does not need to do any backoffice work. */ return; }else{ /* We need to run backup to be (at a minimum) on-deck */ backofficeDb = fossil_strdup(g.zRepositoryName); } } /* ** Check for errors prior to running backoffice_thread() or backoffice_run(). */ static void backoffice_error_check_one(int *pOnce){ if( *pOnce ){ fossil_panic("multiple calls to backoffice()"); | > > > > > > > > | 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 | Lease x; sqlite3_uint64 tmNow; if( backofficeDb ) return; if( g.zRepositoryName==0 ) return; if( g.db==0 ) return; if( !db_table_exists("repository","config") ) return; if( db_get_boolean("backoffice-disable",0) ) return; tmNow = time(0); backofficeReadLease(&x); if( x.tmNext>=tmNow && backofficeProcessExists(x.idNext) ){ /* Another backoffice process is already queued up to run. This ** process does not need to do any backoffice work. */ return; }else{ /* We need to run backup to be (at a minimum) on-deck */ backofficeDb = fossil_strdup(g.zRepositoryName); } } /* ** Call this routine to disable backoffice */ void backoffice_disable(void){ backofficeDb = "x"; } /* ** Check for errors prior to running backoffice_thread() or backoffice_run(). */ static void backoffice_error_check_one(int *pOnce){ if( *pOnce ){ fossil_panic("multiple calls to backoffice()"); |
︙ | ︙ | |||
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 | Lease x; sqlite3_uint64 tmNow; sqlite3_uint64 idSelf; int lastWarning = 0; int warningDelay = 30; static int once = 0; backoffice_error_check_one(&once); idSelf = backofficeProcessId(); while(1){ tmNow = time(0); db_begin_write(); backofficeReadLease(&x); if( x.tmNext>=tmNow && x.idNext!=idSelf && backofficeProcessExists(x.idNext) ){ /* Another backoffice process is already queued up to run. This ** process does not need to do any backoffice work and can stop ** immediately. */ db_end_transaction(0); break; } if( x.tmCurrent<tmNow && backofficeProcessDone(x.idCurrent) ){ /* This process can start doing backoffice work immediately */ x.idCurrent = idSelf; x.tmCurrent = tmNow + BKOFCE_LEASE_TIME; x.idNext = 0; x.tmNext = 0; backofficeWriteLease(&x); db_end_transaction(0); backofficeTrace("/***** Begin Backoffice Processing %d *****/\n", GETPID()); backoffice_work(); break; } if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",0) ){ /* If the no-delay flag is set, exit immediately rather than queuing ** up. Assume that some future request will come along and handle any ** necessary backoffice work. */ db_end_transaction(0); break; } /* This process needs to queue up and wait for the current lease ** to expire before continuing. */ x.idNext = idSelf; x.tmNext = (tmNow>x.tmCurrent ? tmNow : x.tmCurrent) + BKOFCE_LEASE_TIME; backofficeWriteLease(&x); | > > > > > > | 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 | Lease x; sqlite3_uint64 tmNow; sqlite3_uint64 idSelf; int lastWarning = 0; int warningDelay = 30; static int once = 0; if( sqlite3_db_readonly(g.db, 0) ) return; backoffice_error_check_one(&once); idSelf = backofficeProcessId(); while(1){ tmNow = time(0); db_begin_write(); backofficeReadLease(&x); if( x.tmNext>=tmNow && x.idNext!=idSelf && backofficeProcessExists(x.idNext) ){ /* Another backoffice process is already queued up to run. This ** process does not need to do any backoffice work and can stop ** immediately. */ db_end_transaction(0); backofficeTrace("/***** Backoffice Processing Not Needed In %d *****/\n", GETPID()); break; } if( x.tmCurrent<tmNow && backofficeProcessDone(x.idCurrent) ){ /* This process can start doing backoffice work immediately */ x.idCurrent = idSelf; x.tmCurrent = tmNow + BKOFCE_LEASE_TIME; x.idNext = 0; x.tmNext = 0; backofficeWriteLease(&x); db_end_transaction(0); backofficeTrace("/***** Begin Backoffice Processing %d *****/\n", GETPID()); backoffice_work(); break; } if( backofficeNoDelay || db_get_boolean("backoffice-nodelay",0) ){ /* If the no-delay flag is set, exit immediately rather than queuing ** up. Assume that some future request will come along and handle any ** necessary backoffice work. */ db_end_transaction(0); backofficeTrace( "/***** Backoffice No-Delay Exit For %d *****/\n", GETPID()); break; } /* This process needs to queue up and wait for the current lease ** to expire before continuing. */ x.idNext = idSelf; x.tmNext = (tmNow>x.tmCurrent ? tmNow : x.tmCurrent) + BKOFCE_LEASE_TIME; backofficeWriteLease(&x); |
︙ | ︙ | |||
522 523 524 525 526 527 528 | /* Here is where the actual work of the backoffice happens */ alert_backoffice(0); smtp_cleanup(); } /* | | | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | /* Here is where the actual work of the backoffice happens */ alert_backoffice(0); smtp_cleanup(); } /* ** COMMAND: backoffice* ** ** Usage: backoffice [OPTIONS...] [REPOSITORIES...] ** ** Run backoffice processing on the repositories listed. If no ** repository is specified, run it on the repository of the local checkout. ** ** This might be done by a cron job or similar to make sure backoffice ** processing happens periodically. Or, the --poll option can be used ** to run this command as a daemon that will periodically invoke backoffice ** on collection of repositories. ** ** OPTIONS: ** ** --debug Show what this command is doing. ** ** --nodelay Do not queue up or wait for a backoffice job ** to complete. If no work is available or if ** backoffice has run recently, return immediately. ** The --nodelay option is implied if more than ** one repository is listed on the command-line. ** ** --poll N Repeat backoffice calls for repositories that ** change in appoximately N-second intervals. ** N less than 1 turns polling off (the default). ** ** --trace Enable debugging output on stderr */ void backoffice_command(void){ int nPoll; const char *zPoll; int bDebug = 0; unsigned int nCmd = 0; if( find_option("trace",0,0)!=0 ) g.fAnyTrace = 1; if( find_option("nodelay",0,0)!=0 ) backofficeNoDelay = 1; zPoll = find_option("poll",0,1); nPoll = zPoll ? atoi(zPoll) : 0; bDebug = find_option("debug",0,0)!=0; /* Silently consume the -R or --repository flag, leaving behind its ** argument. This is for legacy compatibility. Older versions of the ** backoffice command only ran on a single repository that was specified ** using the -R option. */ (void)find_option("repository","R",0); verify_all_options(); if( g.argc>3 || nPoll>0 ){ /* Either there are multiple repositories named on the command-line ** or we are polling. In either case, each backoffice should be run ** using a separate sub-process */ int i; time_t iNow = 0; time_t ix; while( 1 /* exit via "break;" */){ time_t iNext = time(0); for(i=2; i<g.argc; i++){ Blob cmd; if( !file_isfile(g.argv[i], ExtFILE) ) continue; if( iNow && iNow>file_mtime(g.argv[i],ExtFILE) ) continue; blob_init(&cmd, 0, 0); blob_append_escaped_arg(&cmd, g.nameOfExe); blob_append(&cmd, " backoffice --nodelay", -1); if( g.fAnyTrace ){ blob_append(&cmd, " --trace", -1); } blob_append_escaped_arg(&cmd, g.argv[i]); nCmd++; if( bDebug ){ fossil_print("COMMAND[%u]: %s\n", nCmd, blob_str(&cmd)); } fossil_system(blob_str(&cmd)); blob_reset(&cmd); } if( nPoll<1 ) break; iNow = iNext; ix = time(0); if( ix < iNow+nPoll ){ sqlite3_int64 nMS = (iNow + nPoll - ix)*1000; if( bDebug )fossil_print("SLEEP: %lld\n", nMS); sqlite3_sleep((int)nMS); } } }else{ if( g.argc==3 ){ g.zRepositoryOption = g.argv[2]; g.argc--; } db_find_and_open_repository(0,0); backoffice_thread(); } } /* ** This is the main interface to backoffice from the rest of the system. ** This routine launches either backoffice_thread() directly or as a ** subprocess. */ |
︙ | ︙ | |||
584 585 586 587 588 589 590 591 592 593 594 595 596 597 | int i; setsid(); for(i=0; i<=2; i++){ close(i); open("/dev/null", O_RDWR); } for(i=3; i<100; i++){ close(i); } db_open_repository(backofficeDb); backofficeDb = "x"; backoffice_thread(); db_close(1); backofficeTrace("/***** Backoffice Child %d exits *****/\n", GETPID()); exit(0); } | > > > | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | int i; setsid(); for(i=0; i<=2; i++){ close(i); open("/dev/null", O_RDWR); } for(i=3; i<100; i++){ close(i); } g.fDebug = 0; g.httpIn = 0; g.httpOut = 0; db_open_repository(backofficeDb); backofficeDb = "x"; backoffice_thread(); db_close(1); backofficeTrace("/***** Backoffice Child %d exits *****/\n", GETPID()); exit(0); } |
︙ | ︙ |
Changes to src/bag.c.
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | */ struct Bag { int cnt; /* Number of integers in the bag */ int sz; /* Number of slots in a[] */ int used; /* Number of used slots in a[] */ int *a; /* Hash table of integers that are in the bag */ }; #endif /* ** Initialize a Bag structure */ void bag_init(Bag *p){ memset(p, 0, sizeof(*p)); | > > > > > > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | */ struct Bag { int cnt; /* Number of integers in the bag */ int sz; /* Number of slots in a[] */ int used; /* Number of used slots in a[] */ int *a; /* Hash table of integers that are in the bag */ }; /* ** An expression for statically initializing a Bag instance, to be ** assigned to Bag instances at their declaration point. It has ** the same effect as passing the Bag to bag_init(). */ #define Bag_INIT {0,0,0,0} #endif /* ** Initialize a Bag structure */ void bag_init(Bag *p){ memset(p, 0, sizeof(*p)); |
︙ | ︙ |
Changes to src/bisect.c.
︙ | ︙ | |||
170 171 172 173 174 175 176 | " || '%d')", rid); } /* ** Create a TEMP table named "bilog" that contains the complete history ** of the current bisect. */ | | | > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | " || '%d')", rid); } /* ** Create a TEMP table named "bilog" that contains the complete history ** of the current bisect. */ int bisect_create_bilog_table(int iCurrent, const char *zDesc){ char *zLog; Blob log, id; Stmt q; int cnt = 0; if( zDesc!=0 ){ blob_init(&log, 0, 0); while( zDesc[0]=='y' || zDesc[0]=='n' ){ int i; char c; int rid; if( blob_size(&log) ) blob_append(&log, " ", 1); if( zDesc[0]=='n' ) blob_append(&log, "-", 1); for(i=1; ((c = zDesc[i])>='0' && c<='9') || (c>='a' && c<='f'); i++){} if( i==1 ) break; rid = db_int(0, "SELECT rid FROM blob" " WHERE uuid LIKE '%.*q%%'" " AND EXISTS(SELECT 1 FROM plink WHERE cid=rid)", i-1, zDesc+1 ); if( rid==0 ) break; blob_appendf(&log, "%d", rid); zDesc += i; } }else{ zLog = db_lget("bisect-log",""); blob_init(&log, zLog, -1); } db_multi_exec( "CREATE TEMP TABLE bilog(" " seq INTEGER PRIMARY KEY," /* Sequence of events */ " stat TEXT," /* Type of occurrence */ " rid INTEGER UNIQUE" /* Check-in number */ ");" ); |
︙ | ︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | if( iCurrent>0 ){ db_bind_int(&q, ":seq", ++cnt); db_bind_text(&q, ":stat", "CURRENT"); db_bind_int(&q, ":rid", iCurrent); db_step(&q); } db_finalize(&q); } /* ** Show a chart of bisect "good" and "bad" versions. The chart can be ** sorted either chronologically by bisect time, or by check-in time. */ static void bisect_chart(int sortByCkinTime){ Stmt q; int iCurrent = db_lget_int("checkout",0); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | if( iCurrent>0 ){ db_bind_int(&q, ":seq", ++cnt); db_bind_text(&q, ":stat", "CURRENT"); db_bind_int(&q, ":rid", iCurrent); db_step(&q); } db_finalize(&q); return 1; } /* Return a permalink description of a bisect. Space is obtained from ** fossil_malloc() and should be freed by the caller. ** ** A bisect description consists of characters 'y' and 'n' and lowercase ** hex digits. Each term begins with 'y' or 'n' (success or failure) and ** is followed by a hash prefix in lowercase hex. */ char *bisect_permalink(void){ char *zLog = db_lget("bisect-log",""); char *zResult; Blob log; Blob link = BLOB_INITIALIZER; Blob id; blob_init(&log, zLog, -1); while( blob_token(&log, &id) ){ int rid = atoi(blob_str(&id)); char *zUuid = db_text(0,"SELECT lower(uuid) FROM blob WHERE rid=%d", rid<0 ? -rid : rid); blob_appendf(&link, "%c%.10s", rid<0 ? 'n' : 'y', zUuid); } zResult = mprintf("%s", blob_str(&link)); blob_reset(&link); blob_reset(&log); blob_reset(&id); return zResult; } /* ** Show a chart of bisect "good" and "bad" versions. The chart can be ** sorted either chronologically by bisect time, or by check-in time. */ static void bisect_chart(int sortByCkinTime){ Stmt q; int iCurrent = db_lget_int("checkout",0); bisect_create_bilog_table(iCurrent, 0); db_prepare(&q, "SELECT bilog.seq, bilog.stat," " substr(blob.uuid,1,16), datetime(event.mtime)," " blob.rid==%d" " FROM bilog, blob, event" " WHERE blob.rid=bilog.rid AND event.objid=bilog.rid" " AND event.type='ci'" |
︙ | ︙ | |||
232 233 234 235 236 237 238 239 240 241 242 243 244 245 | db_column_text(&q, 3), db_column_text(&q, 2), (db_column_int(&q, 4) && zGoodBad[0]!='C') ? " CURRENT" : ""); } db_finalize(&q); } /* ** COMMAND: bisect ** ** Usage: %fossil bisect SUBCOMMAND ... ** ** Run various subcommands useful for searching for bugs. ** | > > > > > > > > > > > | 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 | db_column_text(&q, 3), db_column_text(&q, 2), (db_column_int(&q, 4) && zGoodBad[0]!='C') ? " CURRENT" : ""); } db_finalize(&q); } /* ** Reset the bisect subsystem. */ void bisect_reset(void){ db_multi_exec( "DELETE FROM vvar WHERE name IN " " ('bisect-good', 'bisect-bad', 'bisect-log')" ); } /* ** COMMAND: bisect ** ** Usage: %fossil bisect SUBCOMMAND ... ** ** Run various subcommands useful for searching for bugs. ** |
︙ | ︙ | |||
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | char *zDisplay = db_lget("bisect-display","chart"); int m = (int)strlen(zDisplay); bisect_path(); pMid = path_midpoint(); if( pMid==0 ){ fossil_print("bisect complete\n"); }else{ g.argv[1] = "update"; g.argv[2] = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pMid->rid); g.argc = 3; g.fNoSync = 1; update_cmd(); } if( strncmp(zDisplay,"chart",m)==0 ){ bisect_chart(1); }else if( strncmp(zDisplay, "log", m)==0 ){ bisect_chart(0); }else if( strncmp(zDisplay, "status", m)==0 ){ | > > > | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | char *zDisplay = db_lget("bisect-display","chart"); int m = (int)strlen(zDisplay); bisect_path(); pMid = path_midpoint(); if( pMid==0 ){ fossil_print("bisect complete\n"); }else{ int nSpan = path_length(); int nStep = path_search_depth(); g.argv[1] = "update"; g.argv[2] = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pMid->rid); g.argc = 3; g.fNoSync = 1; update_cmd(); fossil_print("span: %d steps-remaining: %d\n", nSpan, nStep); } if( strncmp(zDisplay,"chart",m)==0 ){ bisect_chart(1); }else if( strncmp(zDisplay, "log", m)==0 ){ bisect_chart(0); }else if( strncmp(zDisplay, "status", m)==0 ){ |
︙ | ︙ | |||
409 410 411 412 413 414 415 | if( g.argc==3 ){ unsigned int i; for(i=0; i<count(aBisectOption); i++){ char *z = mprintf("bisect-%s", aBisectOption[i].zName); fossil_print(" %-15s %-6s ", aBisectOption[i].zName, db_lget(z, (char*)aBisectOption[i].zDefault)); fossil_free(z); | | | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | if( g.argc==3 ){ unsigned int i; for(i=0; i<count(aBisectOption); i++){ char *z = mprintf("bisect-%s", aBisectOption[i].zName); fossil_print(" %-15s %-6s ", aBisectOption[i].zName, db_lget(z, (char*)aBisectOption[i].zDefault)); fossil_free(z); comment_print(aBisectOption[i].zDesc, 0, 27, -1, get_comment_format()); } }else if( g.argc==4 || g.argc==5 ){ unsigned int i; n = strlen(g.argv[3]); for(i=0; i<count(aBisectOption); i++){ if( strncmp(g.argv[3], aBisectOption[i].zName, n)==0 ){ char *z = mprintf("bisect-%s", aBisectOption[i].zName); |
︙ | ︙ | |||
432 433 434 435 436 437 438 | if( i>=count(aBisectOption) ){ fossil_fatal("no such bisect option: %s", g.argv[3]); } }else{ usage("options ?NAME? ?VALUE?"); } }else if( strncmp(zCmd, "reset", n)==0 ){ | < < < | | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | if( i>=count(aBisectOption) ){ fossil_fatal("no such bisect option: %s", g.argv[3]); } }else{ usage("options ?NAME? ?VALUE?"); } }else if( strncmp(zCmd, "reset", n)==0 ){ bisect_reset(); }else if( strcmp(zCmd, "ui")==0 ){ char *newArgv[8]; newArgv[0] = g.argv[0]; newArgv[1] = "ui"; newArgv[2] = "--page"; newArgv[3] = "timeline?bisect"; newArgv[4] = 0; |
︙ | ︙ |
Changes to src/blob.c.
︙ | ︙ | |||
275 276 277 278 279 280 281 282 | pBlob->iCursor = 0; pBlob->blobFlags = 0; pBlob->xRealloc = blobReallocStatic; } /* ** Append text or data to the end of a blob. */ | > > > > > > > | > > > | > > > > > | > > > > > > > > > > > > > > > > > > > > < < | | < | > > | > | 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 | pBlob->iCursor = 0; pBlob->blobFlags = 0; pBlob->xRealloc = blobReallocStatic; } /* ** Append text or data to the end of a blob. ** ** The blob_append_full() routine is a complete implementation. ** The blob_append() routine only works for cases where nData>0 and ** no resizing is required, and falls back to blob_append_full() if ** either condition is not met, but runs faster in the common case ** where all conditions are met. The use of blob_append() is ** recommended, unless it is known in advance that nData<0. */ void blob_append_full(Blob *pBlob, const char *aData, int nData){ sqlite3_int64 nNew; assert( aData!=0 || nData==0 ); blob_is_init(pBlob); if( nData<0 ) nData = strlen(aData); if( nData==0 ) return; nNew = pBlob->nUsed; nNew += nData; if( nNew >= pBlob->nAlloc ){ nNew += pBlob->nAlloc; nNew += 100; if( nNew>=0x7fff0000 ){ blob_panic(); } pBlob->xRealloc(pBlob, (int)nNew); if( pBlob->nUsed + nData >= pBlob->nAlloc ){ blob_panic(); } } memcpy(&pBlob->aData[pBlob->nUsed], aData, nData); pBlob->nUsed += nData; pBlob->aData[pBlob->nUsed] = 0; /* Blobs are always nul-terminated */ } void blob_append(Blob *pBlob, const char *aData, int nData){ sqlite3_int64 nUsed; assert( aData!=0 || nData==0 ); /* blob_is_init(pBlob); // omitted for speed */ if( nData<=0 || pBlob->nUsed + nData >= pBlob->nAlloc ){ blob_append_full(pBlob, aData, nData); return; } nUsed = pBlob->nUsed; pBlob->nUsed += nData; pBlob->aData[pBlob->nUsed] = 0; memcpy(&pBlob->aData[nUsed], aData, nData); } /* ** Append a string literal to a blob. */ #if INTERFACE #define blob_append_string(BLOB,STR) blob_append(BLOB,STR,sizeof(STR)-1) #endif /* ** Append a single character to the blob */ void blob_append_char(Blob *pBlob, char c){ if( pBlob->nUsed+1 >= pBlob->nAlloc ){ blob_append_full(pBlob, &c, 1); }else{ pBlob->aData[pBlob->nUsed++] = c; } } /* ** Copy a blob */ void blob_copy(Blob *pTo, Blob *pFrom){ blob_is_init(pFrom); blob_zero(pTo); blob_append(pTo, blob_buffer(pFrom), blob_size(pFrom)); } /* ** Return a pointer to a null-terminated string for a blob. */ char *blob_str(Blob *p){ blob_is_init(p); if( p->nUsed==0 ){ blob_append_char(p, 0); /* NOTE: Changes nUsed. */ p->nUsed = 0; } if( p->nUsed<p->nAlloc ){ p->aData[p->nUsed] = 0; }else{ blob_materialize(p); } return p->aData; } /* ** Return a pointer to a null-terminated string for a blob that has |
︙ | ︙ | |||
1253 1254 1255 1256 1257 1258 1259 | #if defined(_WIN32) const char cQuote = '"'; /* Use "..." quoting on windows */ #else const char cQuote = '\''; /* Use '...' quoting on unix */ #endif for(i=0; (c = zIn[i])!=0; i++){ | > | | 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | #if defined(_WIN32) const char cQuote = '"'; /* Use "..." quoting on windows */ #else const char cQuote = '\''; /* Use '...' quoting on unix */ #endif for(i=0; (c = zIn[i])!=0; i++){ if( c==cQuote || (unsigned char)c<' ' || c=='\\' || c==';' || c=='*' || c=='?' || c=='[' ){ Blob bad; blob_token(pBlob, &bad); fossil_fatal("the [%s] argument to the \"%s\" command contains " "a character (ascii 0x%02x) that is a security risk", zIn, blob_str(&bad), c); } if( !needEscape && !fossil_isalnum(c) && c!='/' && c!='.' && c!='_' ){ |
︙ | ︙ | |||
1333 1334 1335 1336 1337 1338 1339 | blob_swap(pBlob, &temp); blob_reset(&temp); }else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){ zUtf8 = blob_buffer(pBlob); if( bomReverse ){ /* Found BOM, but with reversed bytes */ unsigned int i = blob_size(pBlob); | | | > | 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | blob_swap(pBlob, &temp); blob_reset(&temp); }else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){ zUtf8 = blob_buffer(pBlob); if( bomReverse ){ /* Found BOM, but with reversed bytes */ unsigned int i = blob_size(pBlob); while( i>1 ){ /* swap bytes of unicode representation */ char zTemp = zUtf8[--i]; zUtf8[i] = zUtf8[i-1]; zUtf8[--i] = zTemp; } } /* Make sure the blob contains two terminating 0-bytes */ blob_append(pBlob, "\000\000", 3); zUtf8 = blob_str(pBlob) + bomSize; zUtf8 = fossil_unicode_to_utf8(zUtf8); blob_reset(pBlob); blob_set_dynamic(pBlob, zUtf8); }else if( useMbcs && invalid_utf8(pBlob) ){ #if defined(_WIN32) || defined(__CYGWIN__) zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); blob_reset(pBlob); blob_append(pBlob, zUtf8, -1); fossil_mbcs_free(zUtf8); #else blob_cp1252_to_utf8(pBlob); #endif /* _WIN32 */ } } |
Changes to src/branch.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ** This file contains code used to create new branches within a repository. */ #include "config.h" #include "branch.h" #include <assert.h> /* | > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | ** This file contains code used to create new branches within a repository. */ #include "config.h" #include "branch.h" #include <assert.h> /* ** If RID refers to a check-in, return the name of the branch for that ** check-in. ** ** Space to hold the returned value is obtained from fossil_malloc() ** and should be freed by the caller. */ char *branch_of_rid(int rid){ char *zBr = 0; static Stmt q; db_static_prepare(&q, "SELECT value FROM tagxref" " WHERE rid=$rid AND tagid=%d" " AND tagtype>0", TAG_BRANCH); db_bind_int(&q, "$rid", rid); if( db_step(&q)==SQLITE_ROW ){ zBr = fossil_strdup(db_column_text(&q,0)); } db_reset(&q); if( zBr==0 ){ static char *zMain = 0; if( zMain==0 ) zMain = db_get("main-branch",0); zBr = fossil_strdup(zMain); } return zBr; } /* ** fossil branch new NAME BASIS ?OPTIONS? ** argv0 argv1 argv2 argv3 argv4 */ void branch_new(void){ int rootid; /* RID of the root check-in - what we branch off of */ int brid; /* RID of the branch check-in */ int noSign; /* True if the branch is unsigned */ int i; /* Loop counter */ |
︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | /* Commit */ db_end_transaction(0); /* Do an autosync push, if requested */ if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries",1),0); } #if INTERFACE /* ** Allows bits in the mBplqFlags parameter to branch_prepare_list_query(). */ #define BRL_CLOSED_ONLY 0x001 /* Show only closed branches */ #define BRL_OPEN_ONLY 0x002 /* Show only open branches */ #define BRL_BOTH 0x003 /* Show both open and closed branches */ #define BRL_OPEN_CLOSED_MASK 0x003 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | > > > > | < < < < | < < < < | | < < < < | | < < < < < > > > > > > > > > > | 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 | /* Commit */ db_end_transaction(0); /* Do an autosync push, if requested */ if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries",1),0); } /* ** Create a TEMP table named "tmp_brlist" with 7 columns: ** ** name Name of the branch ** mtime Time of last checkin on this branch ** isclosed True if the branch is closed ** mergeto Another branch this branch was merged into ** nckin Number of checkins on this branch ** ckin Hash of the last checkin on this branch ** bgclr Background color for this branch */ static const char createBrlistQuery[] = @ CREATE TEMP TABLE IF NOT EXISTS tmp_brlist AS @ SELECT @ tagxref.value AS name, @ max(event.mtime) AS mtime, @ EXISTS(SELECT 1 FROM tagxref AS tx @ WHERE tx.rid=tagxref.rid @ AND tx.tagid=(SELECT tagid FROM tag WHERE tagname='closed') @ AND tx.tagtype>0) AS isclosed, @ (SELECT tagxref.value @ FROM plink CROSS JOIN tagxref @ WHERE plink.pid=event.objid @ AND tagxref.rid=plink.cid @ AND tagxref.tagid=(SELECT tagid FROM tag WHERE tagname='branch') @ AND tagtype>0) AS mergeto, @ count(*) AS nckin, @ (SELECT uuid FROM blob WHERE rid=tagxref.rid) AS ckin, @ event.bgcolor AS bgclr @ FROM tagxref, tag, event @ WHERE tagxref.tagid=tag.tagid @ AND tagxref.tagtype>0 @ AND tag.tagname='branch' @ AND event.objid=tagxref.rid @ GROUP BY 1; ; /* Call this routine to create the TEMP table */ static void brlist_create_temp_table(void){ db_multi_exec(createBrlistQuery/*works-like:""*/); } #if INTERFACE /* ** Allows bits in the mBplqFlags parameter to branch_prepare_list_query(). */ #define BRL_CLOSED_ONLY 0x001 /* Show only closed branches */ #define BRL_OPEN_ONLY 0x002 /* Show only open branches */ #define BRL_BOTH 0x003 /* Show both open and closed branches */ #define BRL_OPEN_CLOSED_MASK 0x003 #define BRL_ORDERBY_MTIME 0x004 /* Sort by MTIME. (otherwise sort by name)*/ #define BRL_REVERSE 0x008 /* Reverse the sort order */ #endif /* INTERFACE */ /* ** Prepare a query that will list branches. ** ** If (which<0) then the query pulls only closed branches. If ** (which>0) then the query pulls all (closed and opened) ** branches. Else the query pulls currently-opened branches. */ void branch_prepare_list_query(Stmt *pQuery, int brFlags){ Blob sql; blob_init(&sql, 0, 0); brlist_create_temp_table(); switch( brFlags & BRL_OPEN_CLOSED_MASK ){ case BRL_CLOSED_ONLY: { blob_append_sql(&sql, "SELECT name FROM tmp_brlist WHERE isclosed" ); break; } case BRL_BOTH: { blob_append_sql(&sql, "SELECT name FROM tmp_brlist" ); break; } case BRL_OPEN_ONLY: { blob_append_sql(&sql, "SELECT name FROM tmp_brlist WHERE NOT isclosed" ); break; } } if( brFlags & BRL_ORDERBY_MTIME ){ blob_append_sql(&sql, " ORDER BY -mtime"); }else{ blob_append_sql(&sql, " ORDER BY name COLLATE nocase"); } if( brFlags & BRL_REVERSE ){ blob_append_sql(&sql," DESC"); } db_prepare_blob(pQuery, &sql); blob_reset(&sql); } /* ** If the branch named in the argument is open, return a RID for one of ** the open leaves of that branch. If the branch does not exists or is ** closed, return 0. */ |
︙ | ︙ | |||
274 275 276 277 278 279 280 | ** ** Print the name of the branch for the current check-out ** ** fossil branch info BRANCH-NAME ** ** Print information about a branch ** | | | > | | > | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | ** ** Print the name of the branch for the current check-out ** ** fossil branch info BRANCH-NAME ** ** Print information about a branch ** ** fossil branch list|ls ?OPTIONS? ** ** List all branches. Options: ** -a|--all List all branches. Default show only open branches ** -c|--closed List closed branches. ** -r Reverse the sort order ** -t Show recently changed branches first ** ** fossil branch new BRANCH-NAME BASIS ?OPTIONS? ** ** Create a new branch BRANCH-NAME off of check-in BASIS. ** Supported options for this subcommand include: ** --private branch is private (i.e., remains local) ** --bgcolor COLOR use COLOR instead of automatic background |
︙ | ︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 | }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){ Stmt q; int vid; char *zCurrent = 0; int brFlags = BRL_OPEN_ONLY; if( find_option("all","a",0)!=0 ) brFlags = BRL_BOTH; if( find_option("closed","c",0)!=0 ) brFlags = BRL_CLOSED_ONLY; if( g.localOpen ){ vid = db_lget_int("checkout", 0); zCurrent = db_text(0, "SELECT value FROM tagxref" " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH); } branch_prepare_list_query(&q, brFlags); | > > | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){ Stmt q; int vid; char *zCurrent = 0; int brFlags = BRL_OPEN_ONLY; if( find_option("all","a",0)!=0 ) brFlags = BRL_BOTH; if( find_option("closed","c",0)!=0 ) brFlags = BRL_CLOSED_ONLY; if( find_option("t",0,0)!=0 ) brFlags |= BRL_ORDERBY_MTIME; if( find_option("r",0,0)!=0 ) brFlags |= BRL_REVERSE; if( g.localOpen ){ vid = db_lget_int("checkout", 0); zCurrent = db_text(0, "SELECT value FROM tagxref" " WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH); } branch_prepare_list_query(&q, brFlags); |
︙ | ︙ | |||
364 365 366 367 368 369 370 | branch_new(); }else{ fossil_fatal("branch subcommand should be one of: " "current info list ls new"); } } | < < < < < < < < < < < < < < < < < < < < < < < < < < > | | | 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 | branch_new(); }else{ fossil_fatal("branch subcommand should be one of: " "current info list ls new"); } } /* ** This is the new-style branch-list page that shows the branch names ** together with their ages (time of last check-in) and whether or not ** they are closed or merged to another branch. ** ** Control jumps to this routine from brlist_page() (the /brlist handler) ** if there are no query parameters. */ static void new_brlist_page(void){ Stmt q; double rNow; int show_colors = PB("colors"); login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } style_header("Branches"); style_adunit_config(ADUNIT_RIGHT_OK); style_submenu_checkbox("colors", "Use Branch Colors", 0, 0); login_anonymous_available(); brlist_create_temp_table(); db_prepare(&q, "SELECT * FROM tmp_brlist ORDER BY mtime DESC"); rNow = db_double(0.0, "SELECT julianday('now')"); @ <div class="brlist"> @ <table class='sortable' data-column-types='tkNtt' data-init-sort='2'> @ <thead><tr> @ <th>Branch Name</th> @ <th>Last Change</th> @ <th>Check-ins</th> @ <th>Status</th> @ <th>Resolution</th> @ </tr></thead><tbody> while( db_step(&q)==SQLITE_ROW ){ const char *zBranch = db_column_text(&q, 0); double rMtime = db_column_double(&q, 1); |
︙ | ︙ | |||
443 444 445 446 447 448 449 | } } if( zBgClr && zBgClr[0] && show_colors ){ @ <tr style="background-color:%s(zBgClr)"> }else{ @ <tr> } | | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | } } if( zBgClr && zBgClr[0] && show_colors ){ @ <tr style="background-color:%s(zBgClr)"> }else{ @ <tr> } @ <td>%z(href("%R/timeline?r=%T",zBranch))%h(zBranch)</a></td> @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> @ <td>%d(nCkin)</td> fossil_free(zAge); @ <td>%s(isClosed?"closed":"")</td> if( zMergeTo ){ @ <td>merged into @ %z(href("%R/timeline?f=%!S",zLastCkin))%h(zMergeTo)</a></td> }else{ |
︙ | ︙ | |||
472 473 474 475 476 477 478 | ** is used to show all branches. If query parameters are present a ** fixed bullet list is shown. ** ** Query parameters: ** ** all Show all branches ** closed Show only closed branches | | > > > > | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | ** is used to show all branches. If query parameters are present a ** fixed bullet list is shown. ** ** Query parameters: ** ** all Show all branches ** closed Show only closed branches ** open Show only open branches ** colortest Show all branches with automatic color ** ** When there are no query parameters, a new-style /brlist page shows ** all branches in a sortable table. The new-style /brlist page is ** preferred and is the default. */ void brlist_page(void){ Stmt q; int cnt; int showClosed = P("closed")!=0; int showAll = P("all")!=0; int showOpen = P("open")!=0; |
︙ | ︙ | |||
556 557 558 559 560 561 562 | cnt++; } if( colorTest ){ const char *zColor = hash_color(zBr); @ <li><span style="background-color: %s(zColor)"> @ %h(zBr) → %s(zColor)</span></li> }else{ | | | 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | cnt++; } if( colorTest ){ const char *zColor = hash_color(zBr); @ <li><span style="background-color: %s(zColor)"> @ %h(zBr) → %s(zColor)</span></li> }else{ @ <li>%z(href("%R/timeline?r=%T",zBr))%h(zBr)</a></li> } } if( cnt ){ @ </ul> } db_finalize(&q); style_footer(); |
︙ | ︙ | |||
584 585 586 587 588 589 590 | " AND tagxref.tagid=tag.tagid" " AND tagxref.tagtype>0" " AND tag.tagname GLOB 'sym-*'", rid ); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); | | > > > > > > > > > > > > > > > | | | > > > > > > > | < | > > > > > > | | 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 | " AND tagxref.tagid=tag.tagid" " AND tagxref.tagtype>0" " AND tag.tagname GLOB 'sym-*'", rid ); while( db_step(&q)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q, 0); @ %z(href("%R/timeline?r=%T",zTagName))[timeline]</a> } db_finalize(&q); } /* ** WEBPAGE: brtimeline ** ** Show a timeline of all branches ** ** Query parameters: ** ** ng No graph ** nohidden Hide check-ins with "hidden" tag ** onlyhidden Show only check-ins with "hidden" tag ** brbg Background color by branch name ** ubg Background color by user name */ void brtimeline_page(void){ Blob sql = empty_blob; Stmt q; int tmFlags; /* Timeline display flags */ int fNoHidden = PB("nohidden")!=0; /* The "nohidden" query parameter */ int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */ login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } style_header("Branches"); style_submenu_element("List", "brlist"); login_anonymous_available(); timeline_ss_submenu(); cookie_render(); @ <h2>The initial check-in for each branch:</h2> blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, "AND blob.rid IN (SELECT rid FROM tagxref" " WHERE tagtype>0 AND tagid=%d AND srcid!=0)", TAG_BRANCH); if( fNoHidden || fOnlyHidden ){ const char* zUnaryOp = fNoHidden ? "NOT" : ""; blob_append_sql(&sql, " AND %s EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", zUnaryOp/*safe-for-%s*/, TAG_HIDDEN); } db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql)); blob_reset(&sql); /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too ** many descenders to (off-screen) parents. */ tmFlags = TIMELINE_DISJOINT | TIMELINE_NOSCROLL; if( PB("ng")==0 ) tmFlags |= TIMELINE_GRAPH; if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR; if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR; www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, brtimeline_extra); db_finalize(&q); style_footer(); } |
Changes to src/browse.c.
︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 | ** ** Query parameters: ** ** name=PATH Directory to display. Optional. Top-level if missing ** ci=LABEL Show only files in this check-in. Optional. ** type=TYPE TYPE=flat: use this display ** TYPE=tree: use the /tree display instead */ void page_dir(void){ char *zD = fossil_strdup(P("name")); int nD = zD ? strlen(zD)+1 : 0; int mxLen; int n; char *zPrefix; | > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | ** ** Query parameters: ** ** name=PATH Directory to display. Optional. Top-level if missing ** ci=LABEL Show only files in this check-in. Optional. ** type=TYPE TYPE=flat: use this display ** TYPE=tree: use the /tree display instead ** noreadme Do not attempt to display the README file. */ void page_dir(void){ char *zD = fossil_strdup(P("name")); int nD = zD ? strlen(zD)+1 : 0; int mxLen; int n; char *zPrefix; |
︙ | ︙ | |||
292 293 294 295 296 297 298 299 300 301 302 303 304 305 | } @ <li class="%z(fileext_class(zFN))">%z(zLink)%h(zFN)</a></li> } } db_finalize(&q); manifest_destroy(pM); @ </ul></div> /* If the directory contains a readme file, then display its content below ** the list of files */ db_prepare(&q, "SELECT x, u FROM localfiles" " WHERE x COLLATE nocase IN" | > > > > > > > > | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | } @ <li class="%z(fileext_class(zFN))">%z(zLink)%h(zFN)</a></li> } } db_finalize(&q); manifest_destroy(pM); @ </ul></div> /* If the "noreadme" query parameter is present, do not try to ** show the content of the README file. */ if( P("noreadme")!=0 ){ style_footer(); return; } /* If the directory contains a readme file, then display its content below ** the list of files */ db_prepare(&q, "SELECT x, u FROM localfiles" " WHERE x COLLATE nocase IN" |
︙ | ︙ | |||
940 941 942 943 944 945 946 | }else if( rAge*1440.0<90 ){ return mprintf("%.1f minutes", rAge*1440.0); }else if( rAge*24.0<36 ){ return mprintf("%.1f hours", rAge*24.0); }else if( rAge<365.0 ){ return mprintf("%.1f days", rAge); }else{ | | | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | }else if( rAge*1440.0<90 ){ return mprintf("%.1f minutes", rAge*1440.0); }else if( rAge*24.0<36 ){ return mprintf("%.1f hours", rAge*24.0); }else if( rAge<365.0 ){ return mprintf("%.1f days", rAge); }else{ return mprintf("%.2f years", rAge/365.2425); } } /* ** COMMAND: test-fileage ** ** Usage: %fossil test-fileage CHECKIN |
︙ | ︙ |
Changes to src/cache.c.
︙ | ︙ | |||
342 343 344 345 346 347 348 | " Should be one of: clear init list status", zCmd); } } /* ** WEBPAGE: cachestat ** | | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | " Should be one of: clear init list status", zCmd); } } /* ** WEBPAGE: cachestat ** ** Show information about the webpage cache. Requires Setup privilege. */ void cache_page(void){ sqlite3 *db; sqlite3_stmt *pStmt; char zBuf[100]; login_check_credentials(); |
︙ | ︙ |
Changes to src/capabilities.c.
︙ | ︙ | |||
89 90 91 92 93 94 95 | ** Delete a CapabilityString object. */ void capability_free(CapabilityString *p){ fossil_free(p); } /* | | > > > > | 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 | ** Delete a CapabilityString object. */ void capability_free(CapabilityString *p){ fossil_free(p); } /* ** Expand the capability string by including all capabilities for ** special users "nobody" and "anonymous". Also include "reader" ** if "u" is present and "developer" if "v" is present. */ void capability_expand(CapabilityString *pIn){ static char *zNobody = 0; static char *zAnon = 0; static char *zReader = 0; static char *zDev = 0; static char *zAdmin = "bcdefghijklmnopqrtwz234567AD"; int doneV = 0; if( pIn==0 ){ fossil_free(zNobody); zNobody = 0; fossil_free(zAnon); zAnon = 0; fossil_free(zReader); zReader = 0; fossil_free(zDev); zDev = 0; return; } if( zNobody==0 ){ zNobody = db_text(0, "SELECT cap FROM user WHERE login='nobody'"); zAnon = db_text(0, "SELECT cap FROM user WHERE login='anonymous'"); zReader = db_text(0, "SELECT cap FROM user WHERE login='reader'"); zDev = db_text(0, "SELECT cap FROM user WHERE login='developer'"); } pIn = capability_add(pIn, zAnon); pIn = capability_add(pIn, zNobody); if( pIn->x['a'] || pIn->x['s'] ){ pIn = capability_add(pIn, zAdmin); } if( pIn->x['v'] ){ pIn = capability_add(pIn, zDev); doneV = 1; } if( pIn->x['u'] ){ pIn = capability_add(pIn, zReader); if( pIn->x['v'] && !doneV ){ |
︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 | /* ** The following structure holds descriptions of the various capabilities. */ static struct Caps { char cCap; /* The capability letter */ unsigned short eClass; /* The "class" for this capability */ char *zAbbrev; /* Abbreviated mnemonic name */ char *zOneLiner; /* One-line summary */ } aCap[] = { | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | > > > | | | | | 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 | /* ** The following structure holds descriptions of the various capabilities. */ static struct Caps { char cCap; /* The capability letter */ unsigned short eClass; /* The "class" for this capability */ unsigned nUser; /* Number of users with this capability */ char *zAbbrev; /* Abbreviated mnemonic name */ char *zOneLiner; /* One-line summary */ } aCap[] = { { 'a', CAPCLASS_SUPER, 0, "Admin", "Create and delete users" }, { 'b', CAPCLASS_WIKI|CAPCLASS_TKT, 0, "Attach", "Add attchments to wiki or tickets" }, { 'c', CAPCLASS_TKT, 0, "Append-Tkt", "Append to existing tickets" }, { 'd', CAPCLASS_WIKI|CAPCLASS_TKT, 0, "Delete", "Delete wiki or tickets" }, { 'e', CAPCLASS_DATA, 0, "View-PII", "View sensitive info such as email addresses" }, { 'f', CAPCLASS_WIKI, 0, "New-Wiki", "Create new wiki pages" }, { 'g', CAPCLASS_DATA, 0, "Clone", "Clone the repository" }, { 'h', CAPCLASS_OTHER, 0, "Hyperlinks", "Show hyperlinks to detailed repository history" }, { 'i', CAPCLASS_CODE, 0, "Check-In", "Check-in code changes" }, { 'j', CAPCLASS_WIKI, 0, "Read-Wiki", "View wiki pages" }, { 'k', CAPCLASS_WIKI, 0, "Write-Wiki", "Edit wiki pages" }, { 'l', CAPCLASS_WIKI|CAPCLASS_SUPER, 0, "Mod-Wiki", "Moderator for wiki pages" }, { 'm', CAPCLASS_WIKI, 0, "Append-Wiki", "Append to wiki pages" }, { 'n', CAPCLASS_TKT, 0, "New-Tkt", "Create new tickets" }, { 'o', CAPCLASS_CODE, 0, "Check-Out", "Check out code" }, { 'p', CAPCLASS_OTHER, 0, "Password", "Change your own password" }, { 'q', CAPCLASS_TKT|CAPCLASS_SUPER, 0, "Mod-Tkt", "Moderate tickets" }, { 'r', CAPCLASS_TKT, 0, "Read-Tkt", "View tickets" }, { 's', CAPCLASS_SUPER, 0, "Superuser", "Setup and configure the respository" }, { 't', CAPCLASS_TKT, 0, "Reports", "Create new ticket report formats" }, { 'u', CAPCLASS_OTHER, 0, "Reader", "Inherit all the capabilities of the \"reader\" user" }, { 'v', CAPCLASS_OTHER, 0, "Developer", "Inherit all capabilities of the \"developer\" user" }, { 'w', CAPCLASS_TKT, 0, "Write-Tkt", "Edit tickets" }, { 'x', CAPCLASS_DATA, 0, "Private", "Push and/or pull private branches" }, { 'y', CAPCLASS_SUPER, 0, "Write-UV", "Push unversioned content" }, { 'z', CAPCLASS_CODE, 0, "Zip-Download", "Download a ZIP archive, tarball, or SQL archive" }, { '2', CAPCLASS_FORUM, 0, "Forum-Read", "Read forum posts by others" }, { '3', CAPCLASS_FORUM, 0, "Forum-Write", "Create new forum messages" }, { '4', CAPCLASS_FORUM, 0, "Forum-Trusted", "Create forum messages that bypass moderation" }, { '5', CAPCLASS_FORUM|CAPCLASS_SUPER, 0, "Forum-Mod", "Moderator for forum messages" }, { '6', CAPCLASS_FORUM|CAPCLASS_SUPER, 0, "Forum-Admin", "Grant capability '4' to other users" }, { '7', CAPCLASS_ALERT, 0, "Alerts", "Sign up for email alerts" }, { 'A', CAPCLASS_ALERT|CAPCLASS_SUPER, 0, "Announce", "Send announcements to all subscribers" }, { 'D', CAPCLASS_OTHER, 0, "Debug", "Enable debugging features" }, }; /* ** Populate the aCap[].nUser values based on the current content ** of the USER table. */ void capabilities_count(void){ int i; static int done = 0; Stmt q; if( done ) return; db_prepare(&q, "SELECT fullcap(cap) FROM user"); while( db_step(&q)==SQLITE_ROW ){ const char *zCap = db_column_text(&q, 0); if( zCap==0 || zCap[0]==0 ) continue; for(i=0; i<sizeof(aCap)/sizeof(aCap[0]); i++){ if( strchr(zCap, aCap[i].cCap) ) aCap[i].nUser++; } } db_finalize(&q); done = 1; } /* ** Generate HTML that lists all of the capability letters together with ** a brief summary of what each letter means. */ void capabilities_table(unsigned mClass){ int i; if( g.perm.Admin ) capabilities_count(); @ <table> @ <tbody> for(i=0; i<sizeof(aCap)/sizeof(aCap[0]); i++){ int n; if( (aCap[i].eClass & mClass)==0 ) continue; @ <tr><th valign="top">%c(aCap[i].cCap)</th> @ <td>%h(aCap[i].zAbbrev)</td><td>%h(aCap[i].zOneLiner)</td>\ n = aCap[i].nUser; if( n && g.perm.Admin ){ @ <td><a href="%R/setup_ulist?with=%c(aCap[i].cCap)">\ @ %d(n) user%s(n>1?"s":"")</a></td>\ } @ </tr> } @ </tbody> @ </table> } /* ** Generate a "capability summary table" that shows the major capabilities ** against the various user categories. */ void capability_summary(void){ Stmt q; db_prepare(&q, "WITH t(id,seq) AS (VALUES('nobody',1),('anonymous',2),('reader',3)," "('developer',4))" " SELECT id, fullcap(user.cap),seq,1" " FROM t LEFT JOIN user ON t.id=user.login" " UNION ALL" " SELECT 'New User Default', fullcap(%Q), 10, 1" " UNION ALL" " SELECT 'Regular User', fullcap(capunion(cap)), 20, count(*) FROM user" " WHERE cap NOT GLOB '*[as]*' AND login NOT IN (SELECT id FROM t)" " UNION ALL" " SELECT 'Adminstrator', fullcap(capunion(cap)), 30, count(*) FROM user" " WHERE cap GLOB '*[as]*'" " ORDER BY 3 ASC", db_get("default-perms","") ); @ <table id='capabilitySummary' cellpadding="0" cellspacing="0" border="1"> @ <tr><th> <th>Code<th>Forum<th>Tickets<th>Wiki\ @ <th>Unversioned Content</th></tr> while( db_step(&q)==SQLITE_ROW ){ const char *zId = db_column_text(&q, 0); const char *zCap = db_column_text(&q, 1); int n = db_column_int(&q, 3); int eType; static const char *const azType[] = { "off", "read", "write" }; static const char *const azClass[] = { "capsumOff", "capsumRead", "capsumWrite" }; if( n==0 ) continue; /* Code */ if( db_column_int(&q,2)<10 ){ @ <tr><th align="right"><tt>"%h(zId)"</tt></th> }else if( n>1 ){ |
︙ | ︙ |
Changes to src/cgi.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** | | | | | > > | > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains C functions and procedures used by CGI programs ** (Fossil launched as CGI) to interpret CGI environment variables, ** gather the results, and send they reply back to the CGI server. ** This file also contains routines for running a simple web-server ** (the "fossil ui" or "fossil server" command) and launching subprocesses ** to handle each inbound HTTP request using CGI. ** ** This file contains routines used by Fossil when it is acting as a ** CGI client. For the code used by Fossil when it is acting as a ** CGI server (for the /ext webpage) see the "extcgi.c" source file. */ #include "config.h" #ifdef _WIN32 # if !defined(_WIN32_WINNT) # define _WIN32_WINNT 0x0501 # endif # include <winsock2.h> |
︙ | ︙ | |||
137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /* ** Return a pointer to the CGI output blob. */ Blob *cgi_output_blob(void){ return pContent; } /* ** Combine the header and body of the CGI into a single string. */ static void cgi_combine_header_and_body(void){ int size = blob_size(&cgiContent[1]); if( size>0 ){ | > > > > > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | /* ** Return a pointer to the CGI output blob. */ Blob *cgi_output_blob(void){ return pContent; } /* ** Return complete text of the output header */ const char *cgi_header(void){ return blob_str(&cgiContent[0]); } /* ** Combine the header and body of the CGI into a single string. */ static void cgi_combine_header_and_body(void){ int size = blob_size(&cgiContent[1]); if( size>0 ){ |
︙ | ︙ | |||
160 161 162 163 164 165 166 | cgi_combine_header_and_body(); return blob_buffer(&cgiContent[0]); } /* ** Additional information used to form the HTTP reply */ | | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | cgi_combine_header_and_body(); return blob_buffer(&cgiContent[0]); } /* ** Additional information used to form the HTTP reply */ static const char *zContentType = "text/html"; /* Content type of the reply */ static const char *zReplyStatus = "OK"; /* Reply status description */ static int iReplyStatus = 200; /* Reply status code */ static Blob extraHeader = BLOB_INITIALIZER; /* Extra header text */ /* ** Set the reply content type */ void cgi_set_content_type(const char *zType){ |
︙ | ︙ | |||
336 337 338 339 340 341 342 | size = blob_size(&cgiContent[i]); if( size>0 ){ fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); } } } fflush(g.httpOut); | | | | 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 | size = blob_size(&cgiContent[i]); if( size>0 ){ fwrite(blob_buffer(&cgiContent[i]), 1, size, g.httpOut); } } } fflush(g.httpOut); CGIDEBUG(("-------- END cgi ---------\n")); /* After the webpage has been sent, do any useful background ** processing. */ g.cgiOutput = 2; if( g.db!=0 && iReplyStatus==200 ){ backoffice_check_if_needed(); } } /* ** Do a redirect request to the URL given in the argument. ** ** The URL must be relative to the base of the fossil server. */ NORETURN void cgi_redirect_with_status( const char *zURL, int iStat, const char *zStat ){ char *zLocation; CGIDEBUG(("redirect to %s\n", zURL)); if( strncmp(zURL,"http:",5)==0 || strncmp(zURL,"https:",6)==0 ){ |
︙ | ︙ | |||
475 476 477 478 479 480 481 482 483 484 485 486 487 488 | nUsedQP++; sortQP = 1; } /* ** Add another query parameter or cookie to the parameter set. ** zName is the name of the query parameter or cookie and zValue ** is its fully decoded value. ** ** Copies are made of both the zName and zValue parameters. */ void cgi_set_parameter(const char *zName, const char *zValue){ cgi_set_parameter_nocopy(mprintf("%s",zName), mprintf("%s",zValue), 0); } | > > > > > > > > > > > > > > > > > > > > > | 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 | nUsedQP++; sortQP = 1; } /* ** Add another query parameter or cookie to the parameter set. ** zName is the name of the query parameter or cookie and zValue ** is its fully decoded value. zName will be modified to be an ** all lowercase string. ** ** zName and zValue are not copied and must not change or be ** deallocated after this routine returns. This routine changes ** all ASCII alphabetic characters in zName to lower case. The ** caller must not change them back. */ void cgi_set_parameter_nocopy_tolower( char *zName, const char *zValue, int isQP ){ int i; for(i=0; zName[i]; i++){ zName[i] = fossil_tolower(zName[i]); } cgi_set_parameter_nocopy(zName, zValue, isQP); } /* ** Add another query parameter or cookie to the parameter set. ** zName is the name of the query parameter or cookie and zValue ** is its fully decoded value. ** ** Copies are made of both the zName and zValue parameters. */ void cgi_set_parameter(const char *zName, const char *zValue){ cgi_set_parameter_nocopy(mprintf("%s",zName), mprintf("%s",zValue), 0); } |
︙ | ︙ | |||
509 510 511 512 513 514 515 516 517 518 519 520 521 522 | if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){ aParamQP[i].zValue = zValue; assert( aParamQP[i].isQP ); return; } } cgi_set_parameter_nocopy(zName, zValue, 1); } /* ** Delete a parameter. */ void cgi_delete_parameter(const char *zName){ int i; | > > > > > | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){ aParamQP[i].zValue = zValue; assert( aParamQP[i].isQP ); return; } } cgi_set_parameter_nocopy(zName, zValue, 1); } void cgi_replace_query_parameter_tolower(char *zName, const char *zValue){ int i; for(i=0; zName[i]; i++){ zName[i] = fossil_tolower(zName[i]); } cgi_replace_query_parameter(zName, zValue); } /* ** Delete a parameter. */ void cgi_delete_parameter(const char *zName){ int i; |
︙ | ︙ | |||
547 548 549 550 551 552 553 | /* ** Add a query parameter. The zName portion is fixed but a copy ** must be made of zValue. */ void cgi_setenv(const char *zName, const char *zValue){ cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0); } | < | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | /* ** Add a query parameter. The zName portion is fixed but a copy ** must be made of zValue. */ void cgi_setenv(const char *zName, const char *zValue){ cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0); } /* ** Add a list of query parameters or cookies to the parameter set. ** ** Each parameter is of the form NAME=VALUE. Both the NAME and the ** VALUE may be url-encoded ("+" for space, "%HH" for other special ** characters). But this routine assumes that NAME contains no |
︙ | ︙ | |||
601 602 603 604 605 606 607 | z++; } dehttpize(zValue); }else{ if( *z ){ *z++ = 0; } zValue = ""; } | > | | > > > | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 | z++; } dehttpize(zValue); }else{ if( *z ){ *z++ = 0; } zValue = ""; } if( zName[0] && fossil_no_strange_characters(zName+1) ){ if( fossil_islower(zName[0]) ){ cgi_set_parameter_nocopy(zName, zValue, isQP); }else if( fossil_isupper(zName[0]) ){ cgi_set_parameter_nocopy_tolower(zName, zValue, isQP); } } #ifdef FOSSIL_ENABLE_JSON json_setenv( zName, cson_value_new_string(zValue,strlen(zValue)) ); #endif /* FOSSIL_ENABLE_JSON */ } } |
︙ | ︙ | |||
745 746 747 748 749 750 751 | zBoundry = get_line_from_string(&z, &len); if( zBoundry==0 ) return; while( (zLine = get_line_from_string(&z, &len))!=0 ){ if( zLine[0]==0 ){ int nContent = 0; zValue = get_bounded_content(&z, &len, zBoundry, &nContent); | | > | | | | > > > > > > > > | | > > > > > | | > > > > | 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 | zBoundry = get_line_from_string(&z, &len); if( zBoundry==0 ) return; while( (zLine = get_line_from_string(&z, &len))!=0 ){ if( zLine[0]==0 ){ int nContent = 0; zValue = get_bounded_content(&z, &len, zBoundry, &nContent); if( zName && zValue ){ if( fossil_islower(zName[0]) ){ cgi_set_parameter_nocopy(zName, zValue, 1); if( showBytes ){ cgi_set_parameter_nocopy(mprintf("%s:bytes", zName), mprintf("%d",nContent), 1); } }else if( fossil_isupper(zName[0]) ){ cgi_set_parameter_nocopy_tolower(zName, zValue, 1); if( showBytes ){ cgi_set_parameter_nocopy_tolower(mprintf("%s:bytes", zName), mprintf("%d",nContent), 1); } } } zName = 0; showBytes = 0; }else{ nArg = tokenize_line(zLine, count(azArg), azArg); for(i=0; i<nArg; i++){ int c = fossil_tolower(azArg[i][0]); int n = strlen(azArg[i]); if( c=='c' && sqlite3_strnicmp(azArg[i],"content-disposition:",n)==0 ){ i++; }else if( c=='n' && sqlite3_strnicmp(azArg[i],"name=",n)==0 ){ zName = azArg[++i]; }else if( c=='f' && sqlite3_strnicmp(azArg[i],"filename=",n)==0 ){ char *z = azArg[++i]; if( zName && z ){ if( fossil_islower(zName[0]) ){ cgi_set_parameter_nocopy(mprintf("%s:filename",zName), z, 1); }else if( fossil_isupper(zName[0]) ){ cgi_set_parameter_nocopy_tolower(mprintf("%s:filename",zName), z, 1); } } showBytes = 1; }else if( c=='c' && sqlite3_strnicmp(azArg[i],"content-type:",n)==0 ){ char *z = azArg[++i]; if( zName && z ){ if( fossil_islower(zName[0]) ){ cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z, 1); }else if( fossil_isupper(zName[0]) ){ cgi_set_parameter_nocopy_tolower(mprintf("%s:mimetype",zName), z, 1); } } } } } } } |
︙ | ︙ | |||
931 932 933 934 935 936 937 938 939 940 941 942 943 | ** ** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI and ** PATH_INFO when it is empty. */ void cgi_init(void){ char *z; const char *zType; int len; const char *zRequestUri = cgi_parameter("REQUEST_URI",0); const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); const char *zPathInfo = cgi_parameter("PATH_INFO",0); #ifdef FOSSIL_ENABLE_JSON | > > > > > | > > > > > > > > > > > > > > | 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 | ** ** SCGI typically omits PATH_INFO. CGI sometimes omits REQUEST_URI and ** PATH_INFO when it is empty. */ void cgi_init(void){ char *z; const char *zType; char *zSemi; int len; const char *zRequestUri = cgi_parameter("REQUEST_URI",0); const char *zScriptName = cgi_parameter("SCRIPT_NAME",0); const char *zPathInfo = cgi_parameter("PATH_INFO",0); #ifdef _WIN32 const char *zServerSoftware = cgi_parameter("SERVER_SOFTWARE",0); #endif #ifdef FOSSIL_ENABLE_JSON int noJson = P("no_json")!=0; if( noJson==0 ){ json_main_bootstrap(); } #endif g.isHTTP = 1; cgi_destination(CGI_BODY); if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME"); #ifdef _WIN32 /* The Microsoft IIS web server does not define REQUEST_URI, instead it uses ** PATH_INFO for virtually the same purpose. Define REQUEST_URI the same as ** PATH_INFO and redefine PATH_INFO with SCRIPT_NAME removed from the ** beginning. */ if( zServerSoftware && strstr(zServerSoftware, "Microsoft-IIS") ){ int i, j; cgi_set_parameter("REQUEST_URI", zPathInfo); for(i=0; zPathInfo[i]==zScriptName[i] && zPathInfo[i]; i++){} for(j=i; zPathInfo[j] && zPathInfo[j]!='?'; j++){} zPathInfo = mprintf("%.*s", j-i, zPathInfo+i); cgi_replace_parameter("PATH_INFO", zPathInfo); } #endif if( zRequestUri==0 ){ const char *z = zPathInfo; if( zPathInfo==0 ){ malformed_request("missing PATH_INFO and/or REQUEST_URI"); } if( z[0]=='/' ) z++; zRequestUri = mprintf("%s/%s", zScriptName, z); |
︙ | ︙ | |||
976 977 978 979 980 981 982 | z = (char*)P("REMOTE_ADDR"); if( z ){ g.zIpAddr = mprintf("%s", z); } len = atoi(PD("CONTENT_LENGTH", "0")); | | | | | < < < < < | < | < > | > > | < < < < | | | > > | | > > > > > > > > > > > > > > > > > > > > | 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 | z = (char*)P("REMOTE_ADDR"); if( z ){ g.zIpAddr = mprintf("%s", z); } len = atoi(PD("CONTENT_LENGTH", "0")); zType = P("CONTENT_TYPE"); zSemi = zType ? strchr(zType, ';') : 0; if( zSemi ){ g.zContentType = mprintf("%.*s", (int)(zSemi-zType), zType); zType = g.zContentType; }else{ g.zContentType = zType; } blob_zero(&g.cgiIn); if( len>0 && zType ){ if( fossil_strcmp(zType, "application/x-fossil")==0 ){ blob_read_from_channel(&g.cgiIn, g.httpIn, len); blob_uncompress(&g.cgiIn, &g.cgiIn); } #ifdef FOSSIL_ENABLE_JSON else if( noJson==0 && (fossil_strcmp(zType, "application/json")==0 || fossil_strcmp(zType,"text/plain")==0/*assume this MIGHT be JSON*/ || fossil_strcmp(zType,"application/javascript")==0) ){ g.json.isJsonMode = 1; cgi_parse_POST_JSON(g.httpIn, (unsigned int)len); /* FIXMEs: - See if fossil really needs g.cgiIn to be set for this purpose (i don't think it does). If it does then fill g.cgiIn and refactor to parse the JSON from there. - After parsing POST JSON, copy the "first layer" of keys/values to cgi_setenv(), honoring the upper-case distinction used in add_param_list(). However... - If we do that then we might get a disconnect in precedence of GET/POST arguments. i prefer for GET entries to take precedence over like-named POST entries, but in order for that to happen we need to process QUERY_STRING _after_ reading the POST data. */ cgi_set_content_type(json_guess_content_type()); } #endif /* FOSSIL_ENABLE_JSON */ else{ blob_read_from_channel(&g.cgiIn, g.httpIn, len); } } } /* ** Decode POST parameter information in the cgiIn content, if any. */ void cgi_decode_post_parameters(void){ int len = blob_size(&g.cgiIn); if( len==0 ) return; if( fossil_strcmp(g.zContentType,"application/x-www-form-urlencoded")==0 || strncmp(g.zContentType,"multipart/form-data",19)==0 ){ char *z = blob_str(&g.cgiIn); cgi_trace(z); if( g.zContentType[0]=='a' ){ add_param_list(z, '&'); }else{ process_multipart_form_data(z, len); } blob_init(&g.cgiIn, 0, 0); } } /* ** This is the comparison function used to sort the aParamQP[] array of ** query parameters and cookies. */ static int qparam_compare(const void *a, const void *b){ |
︙ | ︙ | |||
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 | if( j<i ){ memcpy(&aParamQP[j], &aParamQP[i], sizeof(aParamQP[j])); } j++; } nUsedQP = j; } /* Do a binary search for a matching query parameter */ lo = 0; hi = nUsedQP-1; while( lo<=hi ){ mid = (lo+hi)/2; c = fossil_strcmp(aParamQP[mid].zName, zName); if( c==0 ){ CGIDEBUG(("mem-match [%s] = [%s]\n", zName, aParamQP[mid].zValue)); return aParamQP[mid].zValue; }else if( c>0 ){ hi = mid-1; }else{ lo = mid+1; } } /* If no match is found and the name begins with an upper-case ** letter, then check to see if there is an environment variable | > > > > | > | | | 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 | if( j<i ){ memcpy(&aParamQP[j], &aParamQP[i], sizeof(aParamQP[j])); } j++; } nUsedQP = j; } /* Invoking with a NULL zName is just a way to cause the parameters ** to be sorted. So go ahead and bail out in that case */ if( zName==0 || zName[0]==0 ) return 0; /* Do a binary search for a matching query parameter */ lo = 0; hi = nUsedQP-1; while( lo<=hi ){ mid = (lo+hi)/2; c = fossil_strcmp(aParamQP[mid].zName, zName); if( c==0 ){ CGIDEBUG(("mem-match [%s] = [%s]\n", zName, aParamQP[mid].zValue)); return aParamQP[mid].zValue; }else if( c>0 ){ hi = mid-1; }else{ lo = mid+1; } } /* If no match is found and the name begins with an upper-case ** letter, then check to see if there is an environment variable ** with the given name. Handle environment variables with empty values ** the same as non-existent environment variables. */ if( fossil_isupper(zName[0]) ){ const char *zValue = fossil_getenv(zName); if( zValue && zValue[0] ){ cgi_set_parameter_nocopy(zName, zValue, 0); CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue)); return zValue; } } CGIDEBUG(("no-match [%s]\n", zName)); return zDefault; |
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 | if( cgi_parameter(z2,0)==0 ) return 0; } va_end(ap); return 1; } /* | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > | > | > > > > | > > | | > > | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | if( cgi_parameter(z2,0)==0 ) return 0; } va_end(ap); return 1; } /* ** Load all relevant environment variables into the parameter buffer. ** Invoke this routine prior to calling cgi_print_all() in order to see ** the full CGI environment. This routine intended for debugging purposes ** only. */ void cgi_load_environment(void){ /* The following is a list of environment variables that Fossil considers ** to be "relevant". */ static const char *const azCgiVars[] = { "COMSPEC", "DOCUMENT_ROOT", "GATEWAY_INTERFACE", "SCGI", "HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET", "HTTP_ACCEPT_ENCODING", "HTTP_ACCEPT_LANGUAGE", "HTTP_AUTHENICATION", "HTTP_CONNECTION", "HTTP_HOST", "HTTP_IF_NONE_MATCH", "HTTP_IF_MODIFIED_SINCE", "HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", "PATH_TRANSLATED", "QUERY_STRING", "REMOTE_ADDR", "REMOTE_PORT", "REMOTE_USER", "REQUEST_METHOD", "REQUEST_URI", "SCRIPT_FILENAME", "SCRIPT_NAME", "SERVER_PROTOCOL", "HOME", "FOSSIL_HOME", "USERNAME", "USER", "FOSSIL_USER", "SQLITE_TMPDIR", "TMPDIR", "TEMP", "TMP", "FOSSIL_VFS", "FOSSIL_FORCE_TICKET_MODERATION", "FOSSIL_FORCE_WIKI_MODERATION", "FOSSIL_TCL_PATH", "TH1_DELETE_INTERP", "TH1_ENABLE_DOCS", "TH1_ENABLE_HOOKS", "TH1_ENABLE_TCL", "REMOTE_HOST", }; int i; for(i=0; i<count(azCgiVars); i++) (void)P(azCgiVars[i]); } /* ** Print all query parameters on standard output. ** This is used for testing and debugging. ** ** Omit the values of the cookies unless showAll is true. ** ** The eDest parameter determines where the output is shown: ** ** eDest==0: Rendering as HTML into the CGI reply ** eDest==1: Written to stderr ** eDest==2: Written to cgi_debug */ void cgi_print_all(int showAll, unsigned int eDest){ int i; cgi_parameter("",""); /* Force the parameters into sorted order */ for(i=0; i<nUsedQP; i++){ const char *zName = aParamQP[i].zName; if( !showAll ){ if( fossil_stricmp("HTTP_COOKIE",zName)==0 ) continue; if( fossil_strnicmp("fossil-",zName,7)==0 ) continue; } switch( eDest ){ case 0: { cgi_printf("%h = %h <br />\n", zName, aParamQP[i].zValue); break; } case 1: { fossil_trace("%s = %s\n", zName, aParamQP[i].zValue); break; } case 2: { cgi_debug("%s = %s\n", zName, aParamQP[i].zValue); break; } } } } /* ** Export all untagged query parameters (but not cookies or environment ** variables) as hidden values of a form. |
︙ | ︙ | |||
1941 1942 1943 1944 1945 1946 1947 | if( x<=0 ) break; if( WIFSIGNALED(iStatus) && g.fAnyTrace ){ fprintf(stderr, "/***** Child %d exited on signal %d (%s) *****/\n", x, WTERMSIG(iStatus), strsignal(WTERMSIG(iStatus))); } nchildren--; } | | | 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 | if( x<=0 ) break; if( WIFSIGNALED(iStatus) && g.fAnyTrace ){ fprintf(stderr, "/***** Child %d exited on signal %d (%s) *****/\n", x, WTERMSIG(iStatus), strsignal(WTERMSIG(iStatus))); } nchildren--; } } } /* NOT REACHED */ fossil_exit(1); #endif /* NOT REACHED */ return 0; } |
︙ | ︙ | |||
1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 | return mprintf(""); }else{ return mprintf("%s, %d %s %02d %02d:%02d:%02d +0000", azDays[pTm->tm_wday], pTm->tm_mday, azMonths[pTm->tm_mon], pTm->tm_year+1900, pTm->tm_hour, pTm->tm_min, pTm->tm_sec); } } /* ** Parse an RFC822-formatted timestamp as we'd expect from HTTP and return ** a Unix epoch time. <= zero is returned on failure. ** ** Note that this won't handle all the _allowed_ HTTP formats, just the ** most popular one (the one generated by cgi_rfc822_datestamp(), actually). | > > > > > > > > > > > > > > > > > > > > | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 | return mprintf(""); }else{ return mprintf("%s, %d %s %02d %02d:%02d:%02d +0000", azDays[pTm->tm_wday], pTm->tm_mday, azMonths[pTm->tm_mon], pTm->tm_year+1900, pTm->tm_hour, pTm->tm_min, pTm->tm_sec); } } /* ** Returns an ISO8601-formatted time string suitable for debugging ** purposes. ** ** The value returned is always a string obtained from mprintf() and must ** be freed using fossil_free() to avoid a memory leak. */ char *cgi_iso8601_datestamp(void){ struct tm *pTm; time_t now = time(0); pTm = gmtime(&now); if( pTm==0 ){ return mprintf(""); }else{ return mprintf("%04d-%02d-%02d %02d:%02d:%02d", pTm->tm_year+1900, pTm->tm_mon, pTm->tm_mday, pTm->tm_hour, pTm->tm_min, pTm->tm_sec); } } /* ** Parse an RFC822-formatted timestamp as we'd expect from HTTP and return ** a Unix epoch time. <= zero is returned on failure. ** ** Note that this won't handle all the _allowed_ HTTP formats, just the ** most popular one (the one generated by cgi_rfc822_datestamp(), actually). |
︙ | ︙ | |||
2065 2066 2067 2068 2069 2070 2071 | ** Return true if information is coming from the loopback network. */ int cgi_is_loopback(const char *zIpAddr){ return fossil_strcmp(zIpAddr, "127.0.0.1")==0 || fossil_strcmp(zIpAddr, "::ffff:127.0.0.1")==0 || fossil_strcmp(zIpAddr, "::1")==0; } | > > > > > > > > > > > > > | 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 | ** Return true if information is coming from the loopback network. */ int cgi_is_loopback(const char *zIpAddr){ return fossil_strcmp(zIpAddr, "127.0.0.1")==0 || fossil_strcmp(zIpAddr, "::ffff:127.0.0.1")==0 || fossil_strcmp(zIpAddr, "::1")==0; } /* ** Return true if the HTTP request is likely to be from a small-screen ** mobile device. ** ** The returned value is a guess. Use it only for setting up defaults. */ int cgi_from_mobile(void){ const char *zAgent = P("HTTP_USER_AGENT"); if( zAgent==0 ) return 0; if( sqlite3_strglob("*iPad*", zAgent)==0 ) return 0; return sqlite3_strlike("%mobile%", zAgent, 0)==0; } |
Changes to src/checkin.c.
︙ | ︙ | |||
78 79 80 81 82 83 84 | int nRoot; /* length of g.zLocalRoot */ db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s," " mtime INTEGER, size INTEGER)", filename_collation()); nRoot = (int)strlen(g.zLocalRoot); if( argc==0 ){ blob_init(&name, g.zLocalRoot, nRoot - 1); | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | int nRoot; /* length of g.zLocalRoot */ db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s," " mtime INTEGER, size INTEGER)", filename_collation()); nRoot = (int)strlen(g.zLocalRoot); if( argc==0 ){ blob_init(&name, g.zLocalRoot, nRoot - 1); vfile_scan(&name, blob_size(&name), scanFlags, pIgnore, 0, RepoFILE); blob_reset(&name); }else{ for(i=0; i<argc; i++){ file_canonical_name(argv[i], &name, 0); zName = blob_str(&name); isDir = file_isdir(zName, RepoFILE); if( isDir==1 ){ vfile_scan(&name, nRoot-1, scanFlags, pIgnore, 0, RepoFILE); }else if( isDir==0 ){ fossil_warning("not found: %s", &zName[nRoot]); }else if( file_access(zName, R_OK) ){ fossil_fatal("cannot open %s", &zName[nRoot]); }else{ db_multi_exec( "INSERT OR IGNORE INTO sfile(pathname) VALUES(%Q)", |
︙ | ︙ | |||
305 306 307 308 309 310 311 | } blob_reset(&rewrittenPathname); db_finalize(&q); /* If C_MERGE, put merge contributors at the end of the report. */ skipFiles: if( flags & C_MERGE ){ | | < | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | } blob_reset(&rewrittenPathname); db_finalize(&q); /* If C_MERGE, put merge contributors at the end of the report. */ skipFiles: if( flags & C_MERGE ){ db_prepare(&q, "SELECT mhash, id FROM vmerge WHERE id<=0" ); while( db_step(&q)==SQLITE_ROW ){ if( flags & C_COMMENT ){ blob_append(report, "# ", 2); } if( flags & C_CLASSIFY ){ const char *zClass; switch( db_column_int(&q, 1) ){ |
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | } if( emptyDirsFlag ){ Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0)); Stmt q; Blob root; blob_init(&root, g.zLocalRoot, nRoot - 1); vfile_dir_scan(&root, blob_size(&root), scanFlags, pIgnore, | | | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | } if( emptyDirsFlag ){ Glob *pEmptyDirs = glob_create(db_get("empty-dirs", 0)); Stmt q; Blob root; blob_init(&root, g.zLocalRoot, nRoot - 1); vfile_dir_scan(&root, blob_size(&root), scanFlags, pIgnore, pEmptyDirs, RepoFILE); blob_reset(&root); db_prepare(&q, "SELECT %Q || x FROM dscan_temp" " WHERE x NOT IN (%s) AND y = 0" " ORDER BY 1 DESC", g.zLocalRoot, fossil_all_reserved_names(0) ); |
︙ | ︙ | |||
1208 1209 1210 1211 1212 1213 1214 | Blob fname; blob_zero(&fname); if( g.zLocalRoot!=0 ){ file_relative_name(g.zLocalRoot, &fname, 1); zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", blob_str(&fname)); }else{ | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | Blob fname; blob_zero(&fname); if( g.zLocalRoot!=0 ){ file_relative_name(g.zLocalRoot, &fname, 1); zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", blob_str(&fname)); }else{ file_tempname(&fname, "ci-comment",0); zFile = mprintf("%s", blob_str(&fname)); } blob_reset(&fname); } #if defined(_WIN32) blob_add_cr(pPrompt); #endif |
︙ | ︙ | |||
1633 1634 1635 1636 1637 1638 1639 | } db_finalize(&q); blob_appendf(pOut, "\n"); } free(zDate); db_prepare(&q, | | | < | 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 | } db_finalize(&q); blob_appendf(pOut, "\n"); } free(zDate); db_prepare(&q, "SELECT CASE vmerge.id WHEN -1 THEN '+' ELSE '-' END || mhash, merge" " FROM vmerge" " WHERE (vmerge.id=-1 OR vmerge.id=-2)" " ORDER BY 1"); while( db_step(&q)==SQLITE_ROW ){ const char *zCherrypickUuid = db_column_text(&q, 0); int mid = db_column_int(&q, 1); if( mid != vid ){ blob_appendf(pOut, "Q %s\n", zCherrypickUuid); } |
︙ | ︙ | |||
1665 1666 1667 1668 1669 1670 1671 | if( zColor && zColor[0] ){ /* One-time background color */ blob_appendf(pOut, "T +bgcolor * %F\n", zColor); } if( p->closeFlag ){ blob_appendf(pOut, "T +closed *\n"); } | | | 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 | if( zColor && zColor[0] ){ /* One-time background color */ blob_appendf(pOut, "T +bgcolor * %F\n", zColor); } if( p->closeFlag ){ blob_appendf(pOut, "T +closed *\n"); } db_prepare(&q, "SELECT mhash,merge FROM vmerge" " WHERE id %s ORDER BY 1", p->integrateFlag ? "IN(0,-4)" : "=(-4)"); while( db_step(&q)==SQLITE_ROW ){ const char *zIntegrateUuid = db_column_text(&q, 0); int rid = db_column_int(&q, 1); if( is_a_leaf(rid) && !db_exists("SELECT 1 FROM tagxref " " WHERE tagid=%d AND rid=%d AND tagtype>0", TAG_CLOSED, rid)){ |
︙ | ︙ | |||
1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 | } /* ** COMMAND: ci* ** COMMAND: commit ** ** Usage: %fossil commit ?OPTIONS? ?FILE...? ** ** Create a new version containing all of the changes in the current ** checkout. You will be prompted to enter a check-in comment unless ** the comment has been specified on the command-line using "-m" or a ** file containing the comment using -M. The editor defined in the ** "editor" fossil option (see %fossil help set) will be used, or from ** the "VISUAL" or "EDITOR" environment variables (in that order) if | > | 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 | } /* ** COMMAND: ci* ** COMMAND: commit ** ** Usage: %fossil commit ?OPTIONS? ?FILE...? ** or: %fossil ci ?OPTIONS? ?FILE...? ** ** Create a new version containing all of the changes in the current ** checkout. You will be prompted to enter a check-in comment unless ** the comment has been specified on the command-line using "-m" or a ** file containing the comment using -M. The editor defined in the ** "editor" fossil option (see %fossil help set) will be used, or from ** the "VISUAL" or "EDITOR" environment variables (in that order) if |
︙ | ︙ | |||
2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | ** --mimetype MIMETYPE mimetype of check-in comment ** -n|--dry-run If given, display instead of run actions ** --no-prompt This option disables prompting the user for ** input and assumes an answer of 'No' for every ** question. ** --no-warnings omit all warnings about file contents ** --nosign do not attempt to sign this commit with gpg ** --private do not sync changes and their descendants ** --hash verify file status using hashing rather ** than relying on file mtimes ** --tag TAG-NAME assign given tag TAG-NAME to the check-in ** --date-override DATETIME DATE to use instead of 'now' ** --user-override USER USER to use instead of the current default ** | > | 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 | ** --mimetype MIMETYPE mimetype of check-in comment ** -n|--dry-run If given, display instead of run actions ** --no-prompt This option disables prompting the user for ** input and assumes an answer of 'No' for every ** question. ** --no-warnings omit all warnings about file contents ** --nosign do not attempt to sign this commit with gpg ** --override-lock allow a check-in even though parent is locked ** --private do not sync changes and their descendants ** --hash verify file status using hashing rather ** than relying on file mtimes ** --tag TAG-NAME assign given tag TAG-NAME to the check-in ** --date-override DATETIME DATE to use instead of 'now' ** --user-override USER USER to use instead of the current default ** |
︙ | ︙ | |||
2065 2066 2067 2068 2069 2070 2071 | Blob manifest; /* Manifest in baseline form */ Blob muuid; /* Manifest uuid */ Blob cksum1, cksum2; /* Before and after commit checksums */ Blob cksum1b; /* Checksum recorded in the manifest */ int szD; /* Size of the delta manifest */ int szB; /* Size of the baseline manifest */ int nConflict = 0; /* Number of unresolved merge conflicts */ | | | | > > | 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 | Blob manifest; /* Manifest in baseline form */ Blob muuid; /* Manifest uuid */ Blob cksum1, cksum2; /* Before and after commit checksums */ Blob cksum1b; /* Checksum recorded in the manifest */ int szD; /* Size of the delta manifest */ int szB; /* Size of the baseline manifest */ int nConflict = 0; /* Number of unresolved merge conflicts */ int abortCommit = 0; /* Abort the commit due to text format conversions */ Blob ans; /* Answer to continuation prompts */ char cReply; /* First character of ans */ int bRecheck = 0; /* Repeat fork and closed-branch checks*/ memset(&sCiInfo, 0, sizeof(sCiInfo)); url_proxy_options(); /* --sha1sum is an undocumented alias for --hash for backwards compatiblity */ useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0; noSign = find_option("nosign",0,0)!=0; forceDelta = find_option("delta",0,0)!=0; forceBaseline = find_option("baseline",0,0)!=0; if( forceDelta && forceBaseline ){ fossil_fatal("cannot use --delta and --baseline together"); } dryRunFlag = find_option("dry-run","n",0)!=0; if( !dryRunFlag ){ dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ } zComment = find_option("comment","m",1); forceFlag = find_option("force", "f", 0)!=0; allowConflict = find_option("allow-conflict",0,0)!=0; allowEmpty = find_option("allow-empty",0,0)!=0; allowFork = find_option("allow-fork",0,0)!=0; if( find_option("override-lock",0,0)!=0 ) allowFork = 1; allowOlder = find_option("allow-older",0,0)!=0; noPrompt = find_option("no-prompt", 0, 0)!=0; noWarningFlag = find_option("no-warnings", 0, 0)!=0; sCiInfo.zBranch = find_option("branch","b",1); sCiInfo.zColor = find_option("bgcolor",0,1); sCiInfo.zBrClr = find_option("branchcolor",0,1); sCiInfo.closeFlag = find_option("close",0,0)!=0; |
︙ | ︙ | |||
2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 | sCiInfo.zUserOvrd = find_option("user-override",0,1); db_must_be_within_tree(); noSign = db_get_boolean("omitsign", 0)|noSign; if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } useCksum = db_get_boolean("repo-cksum", 1); outputManifest = db_get_manifest_setting(); verify_all_options(); /* Do not allow the creation of a new branch using an existing open ** branch name unless the --force flag is used */ if( sCiInfo.zBranch!=0 && !forceFlag && fossil_strcmp(sCiInfo.zBranch,"private")!=0 && branch_is_open(sCiInfo.zBranch) | > > > > > > > > > > > | 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 | sCiInfo.zUserOvrd = find_option("user-override",0,1); db_must_be_within_tree(); noSign = db_get_boolean("omitsign", 0)|noSign; if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } useCksum = db_get_boolean("repo-cksum", 1); outputManifest = db_get_manifest_setting(); verify_all_options(); /* Get the ID of the parent manifest artifact */ vid = db_lget_int("checkout", 0); if( vid==0 ){ useCksum = 1; if( sCiInfo.zBranch==0 ) { sCiInfo.zBranch=db_get("main-branch", 0); } }else if( content_is_private(vid) ){ g.markPrivate = 1; } /* Do not allow the creation of a new branch using an existing open ** branch name unless the --force flag is used */ if( sCiInfo.zBranch!=0 && !forceFlag && fossil_strcmp(sCiInfo.zBranch,"private")!=0 && branch_is_open(sCiInfo.zBranch) |
︙ | ︙ | |||
2149 2150 2151 2152 2153 2154 2155 | ** delta-manifests, or unless the delta-manifest is explicitly requested ** by the --delta option. */ if( !forceDelta && !db_get_boolean("seen-delta-manifest",0) ){ forceBaseline = 1; } | < < < < < < < < > > > > | | 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 | ** delta-manifests, or unless the delta-manifest is explicitly requested ** by the --delta option. */ if( !forceDelta && !db_get_boolean("seen-delta-manifest",0) ){ forceBaseline = 1; } /* ** Autosync if autosync is enabled and this is not a private check-in. */ if( !g.markPrivate ){ int syncFlags = SYNC_PULL; if( vid!=0 && !allowFork && !forceFlag ){ syncFlags |= SYNC_CKIN_LOCK; } if( autosync_loop(syncFlags, db_get_int("autosync-tries", 1), 1) ){ fossil_exit(1); } } /* Require confirmation to continue with the check-in if there is ** clock skew */ |
︙ | ︙ | |||
2263 2264 2265 2266 2267 2268 2269 | " WHERE is_selected(id)" " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") ){ fossil_fatal("none of the selected files have changed; use " "--allow-empty to override."); } | > > > > > | | | | | < | | < < < < < | | > | > > > > > > | > > | | | | | | | | | | | | | | | | | | | | > > > > > > > | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > | > > > > > < < < < | 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 | " WHERE is_selected(id)" " AND (chnged OR deleted OR rid=0 OR pathname!=origname)") ){ fossil_fatal("none of the selected files have changed; use " "--allow-empty to override."); } /* This loop checks for potential forks and for check-ins against a ** closed branch. The checks are repeated once after interactive ** check-in comment editing. */ do{ /* ** Do not allow a commit that will cause a fork unless the --allow-fork ** or --force flags is used, or unless this is a private check-in. ** The initial commit MUST have tags "trunk" and "sym-trunk". */ if( sCiInfo.zBranch==0 && allowFork==0 && forceFlag==0 && g.markPrivate==0 && (vid==0 || !is_a_leaf(vid) || g.ckinLockFail) ){ if( g.ckinLockFail ){ fossil_fatal("Might fork due to a check-in race with user \"%s\"\n" "Try \"update\" first, or --branch, or " "use --override-lock", g.ckinLockFail); }else{ fossil_fatal("Would fork. \"update\" first or use --branch or " "--allow-fork."); } } /* ** Do not allow a commit against a closed leaf unless the commit ** ends up on a different branch. */ if( /* parent check-in has the "closed" tag... */ db_exists("SELECT 1 FROM tagxref" " WHERE tagid=%d AND rid=%d AND tagtype>0", TAG_CLOSED, vid) /* ... and the new check-in has no --branch option or the --branch ** option does not actually change the branch */ && (sCiInfo.zBranch==0 || db_exists("SELECT 1 FROM tagxref" " WHERE tagid=%d AND rid=%d AND tagtype>0" " AND value=%Q", TAG_BRANCH, vid, sCiInfo.zBranch)) ){ fossil_fatal("cannot commit against a closed leaf"); } /* Always exit the loop on the second pass */ if( bRecheck ) break; /* Get the check-in comment. This might involve prompting the ** user for the check-in comment, in which case we should resync ** to renew the check-in lock and repeat the checks for conflicts. */ if( zComment ){ blob_zero(&comment); blob_append(&comment, zComment, -1); }else if( zComFile ){ blob_zero(&comment); blob_read_from_file(&comment, zComFile, ExtFILE); blob_to_utf8_no_bom(&comment, 1); }else if( dryRunFlag ){ blob_zero(&comment); }else if( !noPrompt ){ char *zInit = db_text(0,"SELECT value FROM vvar WHERE name='ci-comment'"); prepare_commit_comment(&comment, zInit, &sCiInfo, vid); if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); cReply = blob_str(&ans)[0]; blob_reset(&ans); if( cReply!='y' && cReply!='Y' ){ fossil_exit(1); } } free(zInit); db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment); db_end_transaction(0); db_begin_transaction(); if( !g.markPrivate && vid!=0 && !allowFork && !forceFlag ){ /* Do another auto-pull, renewing the check-in lock. Then set ** bRecheck so that we loop back above to verify that the check-in ** is still not against a closed branch and still won't fork. */ int syncFlags = SYNC_PULL|SYNC_CKIN_LOCK; if( autosync_loop(syncFlags, db_get_int("autosync-tries", 1), 1) ){ fossil_exit(1); } bRecheck = 1; } } }while( bRecheck ); if( blob_size(&comment)==0 ){ if( !dryRunFlag ){ if( !noPrompt ){ prompt_user("empty check-in comment. continue (y/N)? ", &ans); cReply = blob_str(&ans)[0]; blob_reset(&ans); }else{ fossil_print("Abandoning commit due to empty check-in comment\n"); cReply = 'N'; } if( cReply!='y' && cReply!='Y' ){ fossil_exit(1); } } } /* ** Step 1: Compute an aggregate MD5 checksum over the disk image ** of every file in vid. The file names are part of the checksum. ** The resulting checksum is the same as is expected on the R-card ** of a manifest. |
︙ | ︙ | |||
2398 2399 2400 2401 2402 2403 2404 | blob_reset(&fname); } nrid = content_put(&content); blob_reset(&content); if( rid>0 ){ content_deltify(rid, &nrid, 1, 0); } | | > | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 | blob_reset(&fname); } nrid = content_put(&content); blob_reset(&content); if( rid>0 ){ content_deltify(rid, &nrid, 1, 0); } db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d", nrid,nrid,id); db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); } db_finalize(&q); if( nConflict && !allowConflict ){ fossil_fatal("abort due to unresolved merge conflicts; " "use --allow-conflict to override"); }else if( abortCommit ){ |
︙ | ︙ | |||
2506 2507 2508 2509 2510 2511 2512 | dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){ fossil_fatal("%s", g.zErrMsg); } assert( blob_is_reset(&manifest) ); content_deltify(vid, &nvid, 1, 0); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); | < | | 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 | dryRunFlag ? MC_NONE : MC_PERMIT_HOOKS)==0 ){ fossil_fatal("%s", g.zErrMsg); } assert( blob_is_reset(&manifest) ); content_deltify(vid, &nvid, 1, 0); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); db_prepare(&q, "SELECT mhash,merge FROM vmerge WHERE id=-4"); while( db_step(&q)==SQLITE_ROW ){ const char *zIntegrateUuid = db_column_text(&q, 0); if( is_a_leaf(db_column_int(&q, 1)) ){ fossil_print("Closed: %s\n", zIntegrateUuid); }else{ fossil_print("Not_Closed: %s (not a leaf any more)\n", zIntegrateUuid); } |
︙ | ︙ | |||
2533 2534 2535 2536 2537 2538 2539 | } /* Update the vfile and vmerge tables */ db_multi_exec( "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND is_selected(id);" "DELETE FROM vmerge;" "UPDATE vfile SET vid=%d;" | | | | 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 | } /* Update the vfile and vmerge tables */ db_multi_exec( "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND is_selected(id);" "DELETE FROM vmerge;" "UPDATE vfile SET vid=%d;" "UPDATE vfile SET rid=mrid, mhash=NULL, chnged=0, deleted=0, origname=NULL" " WHERE is_selected(id);" , vid, nvid ); db_set_checkout(nvid); /* Update the isexe and islink columns of the vfile table */ db_prepare(&q, "UPDATE vfile SET isexe=:exec, islink=:link" " WHERE vid=:vid AND pathname=:path AND (isexe!=:exec OR islink!=:link)" ); db_bind_int(&q, ":vid", nvid); |
︙ | ︙ | |||
2613 2614 2615 2616 2617 2618 2619 | get_checkin_taglist(nvid, &tagslist); blob_write_to_file(&tagslist, zManifestFile); blob_reset(&tagslist); free(zManifestFile); } if( !g.markPrivate ){ | > | > | 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 | get_checkin_taglist(nvid, &tagslist); blob_write_to_file(&tagslist, zManifestFile); blob_reset(&tagslist); free(zManifestFile); } if( !g.markPrivate ){ int syncFlags = SYNC_PUSH | SYNC_PULL | SYNC_IFABLE; int nTries = db_get_int("autosync-tries",1); autosync_loop(syncFlags, nTries, 0); } if( count_nonbranch_children(vid)>1 ){ fossil_print("**** warning: a fork has occurred *****\n"); } } |
Changes to src/checkout.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 44 45 | return db_exists("SELECT 1 FROM vfile WHERE chnged" " OR coalesce(origname!=pathname,0)"); } /* ** Undo the current check-out. Unlink all files from the disk. ** Clear the VFILE table. */ void uncheckout(int vid){ | > > > > > | > > > > > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > > > | 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 | return db_exists("SELECT 1 FROM vfile WHERE chnged" " OR coalesce(origname!=pathname,0)"); } /* ** Undo the current check-out. Unlink all files from the disk. ** Clear the VFILE table. ** ** Also delete any directory that becomes empty as a result of deleting ** files due to this operation, as long as that directory is not the ** current working directory and is not on the empty-dirs list. */ void uncheckout(int vid){ char *zPwd; if( vid<=0 ) return; sqlite3_create_function(g.db, "dirname",1,SQLITE_UTF8,0, file_dirname_sql_function, 0, 0); sqlite3_create_function(g.db, "unlink",1,SQLITE_UTF8,0, file_delete_sql_function, 0, 0); sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0, file_rmdir_sql_function, 0, 0); db_multi_exec( "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID", filename_collation() ); db_multi_exec( "INSERT OR IGNORE INTO dir_to_delete(name)" " SELECT dirname(pathname) FROM vfile" " WHERE vid=%d AND mrid>0", vid ); do{ db_multi_exec( "INSERT OR IGNORE INTO dir_to_delete(name)" " SELECT dirname(name) FROM dir_to_delete;" ); }while( db_changes() ); db_multi_exec( "SELECT unlink(%Q||pathname) FROM vfile" " WHERE vid=%d AND mrid>0;", g.zLocalRoot, vid ); ensure_empty_dirs_created(1); zPwd = file_getcwd(0,0); db_multi_exec( "SELECT rmdir(%Q||name) FROM dir_to_delete" " WHERE (%Q||name)<>%Q ORDER BY name DESC", g.zLocalRoot, g.zLocalRoot, zPwd ); fossil_free(zPwd); db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid); } /* ** Given the abbreviated UUID name of a version, load the content of that ** version in the VFILE table. Return the VID for the version. |
︙ | ︙ | |||
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 | ** The --latest flag can be used in place of VERSION to checkout the ** latest version in the repository. ** ** Options: ** --force Ignore edited files in the current checkout ** --keep Only update the manifest and manifest.uuid files ** --force-missing Force checkout even if content is missing ** ** See also: update */ void checkout_cmd(void){ int forceFlag; /* Force checkout even if edits exist */ int forceMissingFlag; /* Force checkout even if missing content */ int keepFlag; /* Do not change any files on disk */ int latestFlag; /* Checkout the latest version */ char *zVers; /* Version to checkout */ int promptFlag; /* True to prompt before overwriting */ int vid, prior; Blob cksum1, cksum1b, cksum2; db_must_be_within_tree(); db_begin_transaction(); forceFlag = find_option("force","f",0)!=0; forceMissingFlag = find_option("force-missing",0,0)!=0; keepFlag = find_option("keep",0,0)!=0; latestFlag = find_option("latest",0,0)!=0; promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; /* We should be done with options.. */ verify_all_options(); if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ usage("VERSION|--latest ?--force? ?--keep?"); } | > > > > > | 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 | ** The --latest flag can be used in place of VERSION to checkout the ** latest version in the repository. ** ** Options: ** --force Ignore edited files in the current checkout ** --keep Only update the manifest and manifest.uuid files ** --force-missing Force checkout even if content is missing ** --setmtime Set timestamps of all files to match their SCM-side ** times (the timestamp of the last checkin which modified ** them). ** ** See also: update */ void checkout_cmd(void){ int forceFlag; /* Force checkout even if edits exist */ int forceMissingFlag; /* Force checkout even if missing content */ int keepFlag; /* Do not change any files on disk */ int latestFlag; /* Checkout the latest version */ char *zVers; /* Version to checkout */ int promptFlag; /* True to prompt before overwriting */ int vid, prior; int setmtimeFlag; /* --setmtime. Set mtimes on files */ Blob cksum1, cksum1b, cksum2; db_must_be_within_tree(); db_begin_transaction(); forceFlag = find_option("force","f",0)!=0; forceMissingFlag = find_option("force-missing",0,0)!=0; keepFlag = find_option("keep",0,0)!=0; latestFlag = find_option("latest",0,0)!=0; promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0; setmtimeFlag = find_option("setmtime",0,0)!=0; /* We should be done with options.. */ verify_all_options(); if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){ usage("VERSION|--latest ?--force? ?--keep?"); } |
︙ | ︙ | |||
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 | " ORDER BY event.mtime DESC"); if( zVers==0 ){ zVers = db_text(0, "SELECT uuid FROM event, blob" " WHERE event.objid=blob.rid AND event.type='ci'" " ORDER BY event.mtime DESC"); } if( zVers==0 ){ return; } }else{ zVers = g.argv[2]; } vid = load_vfile(zVers, forceMissingFlag); if( prior==vid ){ db_end_transaction(0); return; } if( !keepFlag ){ uncheckout(prior); } db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( !keepFlag ){ vfile_to_disk(vid, 0, !g.fQuiet, promptFlag); } checkout_set_all_exe(vid); manifest_to_disk(vid); | > > | | > | 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 | " ORDER BY event.mtime DESC"); if( zVers==0 ){ zVers = db_text(0, "SELECT uuid FROM event, blob" " WHERE event.objid=blob.rid AND event.type='ci'" " ORDER BY event.mtime DESC"); } if( zVers==0 ){ db_end_transaction(0); return; } }else{ zVers = g.argv[2]; } vid = load_vfile(zVers, forceMissingFlag); if( prior==vid ){ if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); db_end_transaction(0); return; } if( !keepFlag ){ uncheckout(prior); } db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( !keepFlag ){ vfile_to_disk(vid, 0, !g.fQuiet, promptFlag); } checkout_set_all_exe(vid); manifest_to_disk(vid); ensure_empty_dirs_created(0); db_set_checkout(vid); undo_reset(); db_multi_exec("DELETE FROM vmerge"); if( !keepFlag && db_get_boolean("repo-cksum",1) ){ vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); vfile_aggregate_checksum_disk(vid, &cksum2); if( blob_compare(&cksum1, &cksum2) ){ fossil_print("WARNING: manifest checksum does not agree with disk\n"); } if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){ fossil_print("WARNING: manifest checksum does not agree with manifest\n"); } } if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME); db_end_transaction(0); } /* ** Unlink the local database file */ static void unlink_local_database(int manifestOnly){ |
︙ | ︙ |
Changes to src/clone.c.
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 | ** ** By default, your current login name is used to create the default ** admin user. This can be overridden using the -A|--admin-user ** parameter. ** ** Options: ** --admin-user|-A USERNAME Make USERNAME the administrator ** --nocompress Omit extra delta compression ** --once Don't remember the URI. ** --private Also clone private branches | > | | > > > > | 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 | ** ** By default, your current login name is used to create the default ** admin user. This can be overridden using the -A|--admin-user ** parameter. ** ** Options: ** --admin-user|-A USERNAME Make USERNAME the administrator ** --httpauth|-B USER:PASS Add HTTP Basic Authorization to requests ** --nocompress Omit extra delta compression ** --once Don't remember the URI. ** --private Also clone private branches ** --save-http-password Remember the HTTP password without asking ** --ssh-command|-c SSH Use SSH as the "ssh" command ** --ssl-identity FILENAME Use the SSL identity if requested by the server ** -u|--unversioned Also sync unversioned content ** -v|--verbose Show more statistics in output ** ** See also: init */ void clone_cmd(void){ char *zPassword; const char *zDefaultUser; /* Optional name of the default user */ const char *zHttpAuth; /* HTTP Authorization user:pass information */ int nErr = 0; int urlFlags = URL_PROMPT_PW | URL_REMEMBER; int syncFlags = SYNC_CLONE; int noCompress = find_option("nocompress",0,0)!=0; /* Also clone private branches */ if( find_option("private",0,0)!=0 ) syncFlags |= SYNC_PRIVATE; if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; if( find_option("save-http-password",0,0)!=0 ){ urlFlags &= ~URL_PROMPT_PW; urlFlags |= URL_REMEMBER_PW; } if( find_option("verbose","v",0)!=0) syncFlags |= SYNC_VERBOSE; if( find_option("unversioned","u",0)!=0 ) syncFlags |= SYNC_UNVERSIONED; zHttpAuth = find_option("httpauth","B",1); zDefaultUser = find_option("admin-user","A",1); clone_ssh_find_options(); url_proxy_options(); |
︙ | ︙ | |||
312 313 314 315 316 317 318 | void download_page(void){ login_check_credentials(); style_header("Download Page"); if( !g.perm.Zip ){ @ <p>Bummer. You do not have permission to download. if( g.zLogin==0 || g.zLogin[0]==0 ){ @ Maybe it would work better if you | | | | 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 | void download_page(void){ login_check_credentials(); style_header("Download Page"); if( !g.perm.Zip ){ @ <p>Bummer. You do not have permission to download. if( g.zLogin==0 || g.zLogin[0]==0 ){ @ Maybe it would work better if you @ %z(href("%R/login"))logged in</a>. }else{ @ Contact the site administrator and ask them to give @ you "Download Zip" privileges. } }else{ const char *zDLTag = db_get("download-tag","trunk"); const char *zNm = db_get("short-project-name","download"); char *zUrl = href("%R/zip/%t/%t.zip", zDLTag, zNm); @ <p>ZIP Archive: %z(zUrl)%h(zNm).zip</a> zUrl = href("%R/tarball/%t/%t.tar.gz", zDLTag, zNm); @ <p>Tarball: %z(zUrl)%h(zNm).tar.gz</a> zUrl = href("%R/sqlar/%t/%t.sqlar", zDLTag, zNm); @ <p>SQLite Archive: %z(zUrl)%h(zNm).sqlar</a> } if( !g.perm.Clone ){ @ <p>You are not authorized to clone this repository. if( g.zLogin==0 || g.zLogin[0]==0 ){ @ Maybe you would be able to clone if you @ %z(href("%R/login"))logged in</a>. }else{ @ Contact the site administrator and ask them to give @ you "Clone" privileges in order to clone. } }else{ const char *zNm = db_get("short-project-name","clone"); @ <p>Clone the repository using this command: @ <blockquote><pre> @ fossil clone %s(g.zBaseURL) %h(zNm).fossil @ </pre></blockquote> } style_footer(); } |
Changes to src/comformat.c.
1 2 3 4 5 6 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ |
︙ | ︙ | |||
25 26 27 28 29 30 31 | # include <windows.h> #else # include <termios.h> # include <sys/ioctl.h> #endif #if INTERFACE | | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # include <windows.h> #else # include <termios.h> # include <sys/ioctl.h> #endif #if INTERFACE #define COMMENT_PRINT_NONE ((u32)0x00000000) /* No flags = non-legacy. */ #define COMMENT_PRINT_LEGACY ((u32)0x00000001) /* Use legacy algorithm. */ #define COMMENT_PRINT_TRIM_CRLF ((u32)0x00000002) /* Trim leading CR/LF. */ #define COMMENT_PRINT_TRIM_SPACE ((u32)0x00000004) /* Trim leading/trailing. */ #define COMMENT_PRINT_WORD_BREAK ((u32)0x00000008) /* Break lines on words. */ #define COMMENT_PRINT_ORIG_BREAK ((u32)0x00000010) /* Break before original. */ #define COMMENT_PRINT_DEFAULT (COMMENT_PRINT_LEGACY) /* Defaults. */ #define COMMENT_PRINT_UNSET (-1) /* Not initialized. */ #endif /* ** This is the previous value used by most external callers when they ** needed to specify a default maximum line length to be used with the ** comment_print() function. */ |
︙ | ︙ | |||
93 94 95 96 97 98 99 | *pMaxChars = COMMENT_LEGACY_LINE_LENGTH - indent; return -1; #endif } /* ** This function checks the current line being printed against the original | | | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | < < < | 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 | *pMaxChars = COMMENT_LEGACY_LINE_LENGTH - indent; return -1; #endif } /* ** This function checks the current line being printed against the original ** comment text. Upon matching, it updates the provided character and line ** counts, if applicable. The caller needs to emit a new line, if desired. */ static int comment_check_orig( const char *zOrigText, /* [in] Original comment text ONLY, may be NULL. */ const char *zLine, /* [in] The comment line to print. */ int *pCharCnt, /* [in/out] Pointer to the line character count. */ int *pLineCnt /* [in/out] Pointer to the total line count. */ ){ if( zOrigText && fossil_strcmp(zLine, zOrigText)==0 ){ if( pCharCnt ) *pCharCnt = 0; if( pLineCnt ) (*pLineCnt)++; return 1; } return 0; } /* ** This function scans the specified comment line starting just after the ** initial index and returns the index of the next spacing character -OR- ** zero if such a character cannot be found. For the purposes of this ** algorithm, the NUL character is treated the same as a spacing character. */ static int comment_next_space( const char *zLine, /* [in] The comment line being printed. */ int index, /* [in] The current character index being handled. */ int *distUTF8 /* [out] Distance to next space in UTF-8 sequences. */ ){ int nextIndex = index + 1; int fNonASCII=0; for(;;){ char c = zLine[nextIndex]; if( (c&0x80)==0x80 ) fNonASCII=1; if( c==0 || fossil_isspace(c) ){ if( distUTF8 ){ if( fNonASCII!=0 ){ *distUTF8 = strlen_utf8(&zLine[index], nextIndex-index); }else{ *distUTF8 = nextIndex-index; } } return nextIndex; } nextIndex++; } return 0; /* NOT REACHED */ } /* ** Count the number of UTF-8 sequences in a string. Incomplete, ill-formed and ** overlong sequences are counted as one sequence. The invalid lead bytes 0xC0 ** to 0xC1 and 0xF5 to 0xF7 are allowed to initiate (ill-formed) 2- and 4-byte ** sequences, respectively, the other invalid lead bytes 0xF8 to 0xFF are ** treated as invalid 1-byte sequences (as lone trail bytes). ** Combining characters and East Asian Wide and Fullwidth characters are counted ** as one, so this function does not calculate the effective "display width". */ int strlen_utf8(const char *zString, int lengthBytes){ int i; /* Counted bytes. */ int lengthUTF8; /* Counted UTF-8 sequences. */ #if 0 assert( lengthBytes>=0 ); #endif for(i=0, lengthUTF8=0; i<lengthBytes; i++, lengthUTF8++){ char c = zString[i]; int cchUTF8=1; /* Code units consumed. */ int maxUTF8=1; /* Expected sequence length. */ if( (c&0xe0)==0xc0 )maxUTF8=2; /* UTF-8 lead byte 110vvvvv */ else if( (c&0xf0)==0xe0 )maxUTF8=3; /* UTF-8 lead byte 1110vvvv */ else if( (c&0xf8)==0xf0 )maxUTF8=4; /* UTF-8 lead byte 11110vvv */ while( cchUTF8<maxUTF8 && i<lengthBytes-1 && (zString[i+1]&0xc0)==0x80 ){ /* UTF-8 trail byte 10vvvvvv */ cchUTF8++; i++; } } return lengthUTF8; } /* ** This function is called when printing a logical comment line to calculate ** the necessary indenting. The caller needs to emit the indenting spaces. */ static void comment_calc_indent( const char *zLine, /* [in] The comment line being printed. */ int indent, /* [in] Number of spaces to indent, zero for none. */ int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */ int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ int *piIndex /* [in/out] Pointer to first non-space character. */ ){ if( zLine && piIndex ){ int index = *piIndex; if( trimCrLf ){ while( zLine[index]=='\r' || zLine[index]=='\n' ){ index++; } } if( trimSpace ){ while( fossil_isspace(zLine[index]) ){ index++; } |
︙ | ︙ | |||
177 178 179 180 181 182 183 | int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */ int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */ int origBreak, /* [in] Non-zero to break before original comment. */ int *pLineCnt, /* [in/out] Pointer to the total line count. */ const char **pzLine /* [out] Pointer to the end of the logical line. */ ){ | | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | | > > > | | | > | | | > > > > > > > > > > > | | > > > > > > | 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 | int trimCrLf, /* [in] Non-zero to trim leading/trailing CR/LF. */ int trimSpace, /* [in] Non-zero to trim leading/trailing spaces. */ int wordBreak, /* [in] Non-zero to try breaking on word boundaries. */ int origBreak, /* [in] Non-zero to break before original comment. */ int *pLineCnt, /* [in/out] Pointer to the total line count. */ const char **pzLine /* [out] Pointer to the end of the logical line. */ ){ int index = 0, charCnt = 0, lineCnt = 0, maxChars, i; char zBuf[400]; int iBuf=0; /* Output buffer and counter. */ int cchUTF8, maxUTF8; /* Helper variables to count UTF-8 sequences. */ if( !zLine ) return; if( lineChars<=0 ) return; #if 0 assert( indent<sizeof(zBuf)-5 ); /* See following comments to explain */ assert( origIndent<sizeof(zBuf)-5 ); /* these limits. */ #endif if( indent>sizeof(zBuf)-6 ){ /* Limit initial indent to fit output buffer. */ indent = sizeof(zBuf)-6; } comment_calc_indent(zLine, indent, trimCrLf, trimSpace, &index); if( indent>0 ){ for(i=0; i<indent; i++){ zBuf[iBuf++] = ' '; } } if( origIndent>sizeof(zBuf)-6 ){ /* Limit line indent to fit output buffer. */ origIndent = sizeof(zBuf)-6; } maxChars = lineChars; for(;;){ int useChars = 1; char c = zLine[index]; /* Flush the output buffer if there's no space left for at least one more ** (potentially 4-byte) UTF-8 sequence, one level of indentation spaces, ** a new line, and a terminating NULL. */ if( iBuf>sizeof(zBuf)-origIndent-6 ){ zBuf[iBuf]=0; iBuf=0; fossil_print("%s", zBuf); } if( c==0 ){ break; }else{ if( origBreak && index>0 ){ const char *zCurrent = &zLine[index]; if( comment_check_orig(zOrigText, zCurrent, &charCnt, &lineCnt) ){ zBuf[iBuf++] = '\n'; comment_calc_indent(zLine, origIndent, trimCrLf, trimSpace, &index); for( i=0; i<origIndent; i++ ){ zBuf[iBuf++] = ' '; } maxChars = lineChars; } } index++; } if( c=='\n' ){ lineCnt++; charCnt = 0; useChars = 0; }else if( c=='\t' ){ int distUTF8; int nextIndex = comment_next_space(zLine, index, &distUTF8); if( nextIndex<=0 || distUTF8>maxChars ){ break; } charCnt++; useChars = COMMENT_TAB_WIDTH; if( maxChars<useChars ){ zBuf[iBuf++] = ' '; break; } }else if( wordBreak && fossil_isspace(c) ){ int distUTF8; int nextIndex = comment_next_space(zLine, index, &distUTF8); if( nextIndex<=0 || distUTF8>maxChars ){ break; } charCnt++; }else{ charCnt++; } assert( c!='\n' || charCnt==0 ); zBuf[iBuf++] = c; /* Skip over UTF-8 sequences, see comment on strlen_utf8() for details. */ cchUTF8=1; /* Code units consumed. */ maxUTF8=1; /* Expected sequence length. */ if( (c&0xe0)==0xc0 )maxUTF8=2; /* UTF-8 lead byte 110vvvvv */ else if( (c&0xf0)==0xe0 )maxUTF8=3; /* UTF-8 lead byte 1110vvvv */ else if( (c&0xf8)==0xf0 )maxUTF8=4; /* UTF-8 lead byte 11110vvv */ while( cchUTF8<maxUTF8 && (zLine[index]&0xc0)==0x80 ){ /* UTF-8 trail byte 10vvvvvv */ cchUTF8++; zBuf[iBuf++] = zLine[index++]; } maxChars -= useChars; if( maxChars<=0 ) break; if( c=='\n' ) break; } if( charCnt>0 ){ zBuf[iBuf++] = '\n'; lineCnt++; } /* Flush the remaining output buffer. */ if( iBuf>0 ){ zBuf[iBuf]=0; iBuf=0; fossil_print("%s", zBuf); } if( pLineCnt ){ *pLineCnt += lineCnt; } if( pzLine ){ *pzLine = zLine + index; } |
︙ | ︙ | |||
257 258 259 260 261 262 263 | */ static int comment_print_legacy( const char *zText, /* The comment text to be printed. */ int indent, /* Number of spaces to indent each non-initial line. */ int width /* Maximum number of characters per line. */ ){ int maxChars = width - indent; | | > > | | | > > > > > > > > > > > > > > > | | 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 | */ static int comment_print_legacy( const char *zText, /* The comment text to be printed. */ int indent, /* Number of spaces to indent each non-initial line. */ int width /* Maximum number of characters per line. */ ){ int maxChars = width - indent; int si, sk, i, k, kc; int doIndent = 0; char *zBuf; char zBuffer[400]; int lineCnt = 0; int cchUTF8, maxUTF8; /* Helper variables to count UTF-8 sequences. */ if( width<0 ){ comment_set_maxchars(indent, &maxChars); } if( zText==0 ) zText = "(NULL)"; if( maxChars<=0 ){ maxChars = strlen(zText); } /* Ensure the buffer can hold the longest-possible UTF-8 sequences. */ if( maxChars >= (sizeof(zBuffer)/4-1) ){ zBuf = fossil_malloc(maxChars*4+1); }else{ zBuf = zBuffer; } for(;;){ while( fossil_isspace(zText[0]) ){ zText++; } if( zText[0]==0 ){ if( doIndent==0 ){ fossil_print("\n"); lineCnt = 1; } if( zBuf!=zBuffer) fossil_free(zBuf); return lineCnt; } for(sk=si=i=k=kc=0; zText[i] && kc<maxChars; i++){ char c = zText[i]; kc++; /* Count complete UTF-8 sequences. */ /* Skip over UTF-8 sequences, see comment on strlen_utf8() for details. */ cchUTF8=1; /* Code units consumed. */ maxUTF8=1; /* Expected sequence length. */ if( (c&0xe0)==0xc0 )maxUTF8=2; /* UTF-8 lead byte 110vvvvv */ else if( (c&0xf0)==0xe0 )maxUTF8=3; /* UTF-8 lead byte 1110vvvv */ else if( (c&0xf8)==0xf0 )maxUTF8=4; /* UTF-8 lead byte 11110vvv */ if( maxUTF8>1 ){ zBuf[k++] = c; while( cchUTF8<maxUTF8 && (zText[i+1]&0xc0)==0x80 ){ /* UTF-8 trail byte 10vvvvvv */ cchUTF8++; zBuf[k++] = zText[++i]; } } else if( fossil_isspace(c) ){ si = i; sk = k; if( k==0 || zBuf[k-1]!=' ' ){ zBuf[k++] = ' '; } }else{ zBuf[k] = c; |
︙ | ︙ | |||
408 409 410 411 412 413 414 415 416 417 418 419 420 421 | comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0, maxChars, trimCrLf, trimSpace, wordBreak, origBreak, &lineCnt, &zLine); if( !zLine || !zLine[0] ) break; } return lineCnt; } /* ** ** COMMAND: test-comment-format ** ** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT? ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | comment_print_line(zOrigText, zLine, indent, zLine>zText ? indent : 0, maxChars, trimCrLf, trimSpace, wordBreak, origBreak, &lineCnt, &zLine); if( !zLine || !zLine[0] ) break; } return lineCnt; } /* ** Return the "COMMENT_PRINT_*" flags specified by the following sources, ** evaluated in the following cascading order: ** ** 1. The global --comfmtflags (alias --comment-format) command-line option. ** 2. The local (per-repository) "comment-format" setting. ** 3. The global (all-repositories) "comment-format" setting. ** 4. The default value COMMENT_PRINT_DEFAULT. */ int get_comment_format(){ int comFmtFlags; /* The global command-line option is present, or the value has been cached. */ if( g.comFmtFlags!=COMMENT_PRINT_UNSET ){ comFmtFlags = g.comFmtFlags; return comFmtFlags; } /* Load the local (per-repository) or global (all-repositories) value, and use ** g.comFmtFlags as a cache. */ comFmtFlags = db_get_int("comment-format", COMMENT_PRINT_UNSET); if( comFmtFlags!=COMMENT_PRINT_UNSET ){ g.comFmtFlags = comFmtFlags; return comFmtFlags; } /* Fallback to the default value. */ comFmtFlags = COMMENT_PRINT_DEFAULT; return comFmtFlags; } /* ** ** COMMAND: test-comment-format ** ** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?ORIGTEXT? ** |
︙ | ︙ |
Changes to src/configure.c.
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | const char *zName; /* Name of the configuration parameter */ int groupMask; /* Which config groups is it part of */ } aConfig[] = { { "css", CONFIGSET_CSS }, { "header", CONFIGSET_SKIN }, { "footer", CONFIGSET_SKIN }, { "details", CONFIGSET_SKIN }, { "logo-mimetype", CONFIGSET_SKIN }, { "logo-image", CONFIGSET_SKIN }, { "background-mimetype", CONFIGSET_SKIN }, { "background-image", CONFIGSET_SKIN }, { "timeline-block-markup", CONFIGSET_SKIN }, { "timeline-max-comment", CONFIGSET_SKIN }, { "timeline-plaintext", CONFIGSET_SKIN }, { "adunit", CONFIGSET_SKIN }, { "adunit-omit-if-admin", CONFIGSET_SKIN }, { "adunit-omit-if-user", CONFIGSET_SKIN }, { "sitemap-docidx", CONFIGSET_SKIN }, { "sitemap-download", CONFIGSET_SKIN }, { "sitemap-license", CONFIGSET_SKIN }, { "sitemap-contact", CONFIGSET_SKIN }, | > > > > > > | 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 | const char *zName; /* Name of the configuration parameter */ int groupMask; /* Which config groups is it part of */ } aConfig[] = { { "css", CONFIGSET_CSS }, { "header", CONFIGSET_SKIN }, { "footer", CONFIGSET_SKIN }, { "details", CONFIGSET_SKIN }, { "js", CONFIGSET_SKIN }, { "logo-mimetype", CONFIGSET_SKIN }, { "logo-image", CONFIGSET_SKIN }, { "background-mimetype", CONFIGSET_SKIN }, { "background-image", CONFIGSET_SKIN }, { "timeline-block-markup", CONFIGSET_SKIN }, { "timeline-date-format", CONFIGSET_SKIN }, { "timeline-dwelltime", CONFIGSET_SKIN }, { "timeline-closetime", CONFIGSET_SKIN }, { "timeline-max-comment", CONFIGSET_SKIN }, { "timeline-plaintext", CONFIGSET_SKIN }, { "timeline-truncate-at-blank", CONFIGSET_SKIN }, { "timeline-utc", CONFIGSET_SKIN }, { "adunit", CONFIGSET_SKIN }, { "adunit-omit-if-admin", CONFIGSET_SKIN }, { "adunit-omit-if-user", CONFIGSET_SKIN }, { "sitemap-docidx", CONFIGSET_SKIN }, { "sitemap-download", CONFIGSET_SKIN }, { "sitemap-license", CONFIGSET_SKIN }, { "sitemap-contact", CONFIGSET_SKIN }, |
︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 | { "encoding-glob", CONFIGSET_PROJ }, { "empty-dirs", CONFIGSET_PROJ }, { "allow-symlinks", CONFIGSET_PROJ }, { "dotfiles", CONFIGSET_PROJ }, { "parent-project-code", CONFIGSET_PROJ }, { "parent-project-name", CONFIGSET_PROJ }, { "hash-policy", CONFIGSET_PROJ }, #ifdef FOSSIL_ENABLE_LEGACY_MV_RM { "mv-rm-files", CONFIGSET_PROJ }, #endif { "ticket-table", CONFIGSET_TKT }, { "ticket-common", CONFIGSET_TKT }, | > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | { "encoding-glob", CONFIGSET_PROJ }, { "empty-dirs", CONFIGSET_PROJ }, { "allow-symlinks", CONFIGSET_PROJ }, { "dotfiles", CONFIGSET_PROJ }, { "parent-project-code", CONFIGSET_PROJ }, { "parent-project-name", CONFIGSET_PROJ }, { "hash-policy", CONFIGSET_PROJ }, { "comment-format", CONFIGSET_PROJ }, #ifdef FOSSIL_ENABLE_LEGACY_MV_RM { "mv-rm-files", CONFIGSET_PROJ }, #endif { "ticket-table", CONFIGSET_TKT }, { "ticket-common", CONFIGSET_TKT }, |
︙ | ︙ | |||
417 418 419 420 421 422 423 | } blob_append_sql(&sql, "REPLACE INTO "); }else{ blob_append_sql(&sql, "INSERT OR IGNORE INTO "); } blob_append_sql(&sql, "\"%w\"(\"%w\",mtime", &zName[1], aType[ii].zPrimKey); | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | } blob_append_sql(&sql, "REPLACE INTO "); }else{ blob_append_sql(&sql, "INSERT OR IGNORE INTO "); } blob_append_sql(&sql, "\"%w\"(\"%w\",mtime", &zName[1], aType[ii].zPrimKey); if( fossil_stricmp(zName,"/subscriber")==0 ) alert_schema(0); for(jj=2; jj<nToken; jj+=2){ blob_append_sql(&sql, ",\"%w\"", azToken[jj]); } blob_append_sql(&sql,") VALUES(%s,%s", azToken[1] /*safe-for-%s*/, azToken[0]/*safe-for-%s*/); for(jj=2; jj<nToken; jj+=2){ blob_append_sql(&sql, ",%s", azToken[jj+1] /*safe-for-%s*/); |
︙ | ︙ |
Changes to src/content.c.
︙ | ︙ | |||
97 98 99 100 101 102 103 | contentCache.szTotal += blob_size(pBlob); p->content = *pBlob; blob_zero(pBlob); bag_insert(&contentCache.inCache, rid); } /* | | > > | > > > > > | 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 | contentCache.szTotal += blob_size(pBlob); p->content = *pBlob; blob_zero(pBlob); bag_insert(&contentCache.inCache, rid); } /* ** Clear the content cache. If it is passed true, it ** also frees all associated memory, otherwise it may ** retain parts for future uses of the cache. */ void content_clear_cache(int bFreeIt){ int i; for(i=0; i<contentCache.n; i++){ blob_reset(&contentCache.a[i].content); } bag_clear(&contentCache.missing); bag_clear(&contentCache.available); bag_clear(&contentCache.inCache); contentCache.n = 0; contentCache.szTotal = 0; if(bFreeIt){ fossil_free(contentCache.a); contentCache.a = 0; contentCache.nAlloc = 0; } } /* ** Return the srcid associated with rid. Or return 0 if rid is ** original content and not a delta. */ int delta_source_rid(int rid){ |
︙ | ︙ | |||
596 597 598 599 600 601 602 | db_exec(&s1); rid = db_last_insert_rowid(); if( !pBlob ){ db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid); } } if( g.markPrivate || isPrivate ){ | | | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | db_exec(&s1); rid = db_last_insert_rowid(); if( !pBlob ){ db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid); } } if( g.markPrivate || isPrivate ){ db_multi_exec("INSERT OR IGNORE INTO private VALUES(%d)", rid); markAsUnclustered = 0; } if( nBlob==0 ) blob_reset(&cmpr); /* If the srcId is specified, then the data we just added is ** really a delta. Record this fact in the delta table. */ |
︙ | ︙ | |||
1216 1217 1218 1219 1220 1221 1222 | ** WARNING: This command destroys data and can cause you to lose work. ** Make sure you have a backup copy before using this command! ** ** WARNING: You must run "fossil rebuild" after this command to rebuild ** the metadata. ** ** Note that the arguments are the integer raw RID values from the BLOB table, | | | 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | ** WARNING: This command destroys data and can cause you to lose work. ** Make sure you have a backup copy before using this command! ** ** WARNING: You must run "fossil rebuild" after this command to rebuild ** the metadata. ** ** Note that the arguments are the integer raw RID values from the BLOB table, ** not artifact hashes or labels. */ void test_content_erase(void){ int i; Blob x; char c; Stmt q; prompt_user("This command erases information from the repository and\n" |
︙ | ︙ |
Added src/copybtn.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 | /* Manage "Copy Buttons" linked to target elements, to copy the text (or, parts ** thereof) of the target elements to the clipboard. ** ** Newly created buttons are <span> elements with an SVG background icon, ** defined by the "copy-button" class in the default CSS style sheet, and are ** assigned the element ID "copy-<idTarget>". ** ** To simplify customization, the only properties modified for HTML-defined ** buttons are the "onclick" handler, and the "transition" and "opacity" styles ** (used for animation). ** ** For HTML-defined buttons, either initCopyButtonById(), or initCopyButton(), ** needs to be called to attach the "onclick" handler (done automatically from ** a handler attached to the "DOMContentLoaded" event). ** ** The initialization functions do not overwrite the "data-copytarget" and ** "data-copylength" attributes with empty or null values for <idTarget> and ** <cchLength>, respectively. Set <cchLength> to "-1" to explicitly remove the ** previous copy length limit. ** ** HTML snippet for statically created buttons: ** ** <span class="copy-button" id="copy-<idTarget>" ** data-copytarget="<idTarget>" data-copylength="<cchLength>"></span> */ function makeCopyButton(idTarget,bFlipped,cchLength){ var elButton = document.createElement("span"); elButton.className = "copy-button"; if( bFlipped ) elButton.className += " copy-button-flipped"; elButton.id = "copy-" + idTarget; initCopyButton(elButton,idTarget,cchLength); return elButton; } function initCopyButtonById(idButton,idTarget,cchLength){ idButton = idButton || "copy-" + idTarget; var elButton = document.getElementById(idButton); if( elButton ) initCopyButton(elButton,idTarget,cchLength); return elButton; } function initCopyButton(elButton,idTarget,cchLength){ elButton.style.transition = ""; elButton.style.opacity = 1; if( idTarget ) elButton.setAttribute("data-copytarget",idTarget); if( cchLength ) elButton.setAttribute("data-copylength",cchLength); elButton.onclick = clickCopyButton; return elButton; } setTimeout(function(){ var aButtons = document.getElementsByClassName("copy-button"); for ( var i=0; i<aButtons.length; i++ ){ initCopyButton(aButtons[i],0,0); } },1); /* The onclick handler for the "Copy Button". */ var lockCopyText = false; function clickCopyButton(e){ e.preventDefault(); /* Mandatory for <a> and <button>. */ e.stopPropagation(); if( lockCopyText ) return; lockCopyText = true; this.style.transition = "opacity 400ms ease-in-out"; this.style.opacity = 0; var idTarget = this.getAttribute("data-copytarget"); var elTarget = document.getElementById(idTarget); if( elTarget ){ var text = elTarget.innerText.replace(/^\s+|\s+$/g,''); var cchLength = parseInt(this.getAttribute("data-copylength")); if( !isNaN(cchLength) && cchLength>0 ){ text = text.slice(0,cchLength); // Assume single-byte chars. } copyTextToClipboard(text); } setTimeout(function(id){ var elButton = document.getElementById(id); if( elButton ){ elButton.style.transition = ""; elButton.style.opacity = 1; } lockCopyText = false; }.bind(null,this.id),400); } /* Create a temporary <textarea> element and copy the contents to clipboard. */ function copyTextToClipboard(text){ if( window.clipboardData && window.clipboardData.setData ){ clipboardData.setData('Text',text); }else{ var x = document.createElement("textarea"); x.style.position = 'fixed'; x.value = text; document.body.appendChild(x); x.select(); try{ document.execCommand('copy'); }catch(err){ }finally{ document.body.removeChild(x); } } } |
Changes to src/db.c.
︙ | ︙ | |||
84 85 86 87 88 89 90 | else #endif /* FOSSIL_ENABLE_JSON */ if( g.xferPanic && g.cgiOutput==1 ){ cgi_reset_content(); @ error Database\serror:\s%F(z) cgi_reply(); } | | > > > > > > > > > > > > | 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 | else #endif /* FOSSIL_ENABLE_JSON */ if( g.xferPanic && g.cgiOutput==1 ){ cgi_reset_content(); @ error Database\serror:\s%F(z) cgi_reply(); } fossil_fatal("Database error: %s", z); } /* ** Check a result code. If it is not SQLITE_OK, print the ** corresponding error message and exit. */ static void db_check_result(int rc, Stmt *pStmt){ if( rc!=SQLITE_OK ){ db_err("SQL error (%d,%d: %s) while running [%s]", rc, sqlite3_extended_errcode(g.db), sqlite3_errmsg(g.db), blob_str(&pStmt->sql)); } } /* ** All static variable that a used by only this file are gathered into ** the following structure. */ static struct DbLocalData { |
︙ | ︙ | |||
115 116 117 118 119 120 121 122 123 124 125 126 127 128 | } db = {0, 0, 0, 0, 0, 0, }; /* ** Arrange for the given file to be deleted on a failure. */ void db_delete_on_failure(const char *zFilename){ assert( db.nDeleteOnFail<count(db.azDeleteOnFail) ); db.azDeleteOnFail[db.nDeleteOnFail++] = fossil_strdup(zFilename); } /* ** Return the transaction nesting depth. 0 means we are currently ** not in a transaction. */ | > | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | } db = {0, 0, 0, 0, 0, 0, }; /* ** Arrange for the given file to be deleted on a failure. */ void db_delete_on_failure(const char *zFilename){ assert( db.nDeleteOnFail<count(db.azDeleteOnFail) ); if( zFilename==0 ) return; db.azDeleteOnFail[db.nDeleteOnFail++] = fossil_strdup(zFilename); } /* ** Return the transaction nesting depth. 0 means we are currently ** not in a transaction. */ |
︙ | ︙ | |||
359 360 361 362 363 364 365 366 367 368 369 370 371 372 | va_list ap; va_start(ap, zFormat); rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap); va_end(ap); } return rc; } /* Prepare a statement using text placed inside a Blob ** using blob_append_sql(). */ int db_prepare_blob(Stmt *pStmt, Blob *pSql){ int rc; char *zSql; | > > > > > > | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | va_list ap; va_start(ap, zFormat); rc = db_vprepare(pStmt, DB_PREPARE_PERSISTENT, zFormat, ap); va_end(ap); } return rc; } /* Return TRUE if static Stmt object pStmt has been initialized. */ int db_static_stmt_is_init(Stmt *pStmt){ return blob_size(&pStmt->sql)>0; } /* Prepare a statement using text placed inside a Blob ** using blob_append_sql(). */ int db_prepare_blob(Stmt *pStmt, Blob *pSql){ int rc; char *zSql; |
︙ | ︙ | |||
469 470 471 472 473 474 475 | /* ** Reset or finalize a statement. */ int db_reset(Stmt *pStmt){ int rc; db_stats(pStmt); rc = sqlite3_reset(pStmt->pStmt); | | | | 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 | /* ** Reset or finalize a statement. */ int db_reset(Stmt *pStmt){ int rc; db_stats(pStmt); rc = sqlite3_reset(pStmt->pStmt); db_check_result(rc, pStmt); return rc; } int db_finalize(Stmt *pStmt){ int rc; if( pStmt->pNext ){ pStmt->pNext->pPrev = pStmt->pPrev; } if( pStmt->pPrev ){ pStmt->pPrev->pNext = pStmt->pNext; }else if( db.pAllStmt==pStmt ){ db.pAllStmt = pStmt->pNext; } pStmt->pNext = 0; pStmt->pPrev = 0; db_stats(pStmt); blob_reset(&pStmt->sql); rc = sqlite3_finalize(pStmt->pStmt); db_check_result(rc, pStmt); pStmt->pStmt = 0; return rc; } /* ** Return the rowid of the most recent insert */ |
︙ | ︙ | |||
567 568 569 570 571 572 573 | ** invalid when the statement is stepped or reset. */ void db_ephemeral_blob(Stmt *pStmt, int N, Blob *pBlob){ blob_init(pBlob, sqlite3_column_blob(pStmt->pStmt, N), sqlite3_column_bytes(pStmt->pStmt, N)); } | < < < < < < < < < < | > > > > > > > > > > > > > | 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 | ** invalid when the statement is stepped or reset. */ void db_ephemeral_blob(Stmt *pStmt, int N, Blob *pBlob){ blob_init(pBlob, sqlite3_column_blob(pStmt->pStmt, N), sqlite3_column_bytes(pStmt->pStmt, N)); } /* ** Execute a single prepared statement until it finishes. */ int db_exec(Stmt *pStmt){ int rc; while( (rc = db_step(pStmt))==SQLITE_ROW ){} rc = db_reset(pStmt); db_check_result(rc, pStmt); return rc; } /* ** COMMAND: test-db-exec-error ** ** Invoke the db_exec() interface with an erroneous SQL statement ** in order to verify the error handling logic. */ void db_test_db_exec_cmd(void){ Stmt err; db_find_and_open_repository(0,0); db_prepare(&err, "INSERT INTO repository.config(name) VALUES(NULL);"); db_exec(&err); } /* ** Print the output of one or more SQL queries on standard output. ** This routine is used for debugging purposes only. */ int db_debug(const char *zSql, ...){ Blob sql; |
︙ | ︙ | |||
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 | db_finalize(&s); return z; } /* ** Initialize a new database file with the given schema. If anything ** goes wrong, call db_err() to exit. */ void db_init_database( const char *zFileName, /* Name of database file to create */ const char *zSchema, /* First part of schema */ ... /* Additional SQL to run. Terminate with NULL. */ ){ sqlite3 *db; int rc; const char *zSql; va_list ap; | > > > | > | > > > | 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 | db_finalize(&s); return z; } /* ** Initialize a new database file with the given schema. If anything ** goes wrong, call db_err() to exit. ** ** If zFilename is NULL, then create an empty repository in an in-memory ** database. */ void db_init_database( const char *zFileName, /* Name of database file to create */ const char *zSchema, /* First part of schema */ ... /* Additional SQL to run. Terminate with NULL. */ ){ sqlite3 *db; int rc; const char *zSql; va_list ap; db = db_open(zFileName ? zFileName : ":memory:"); sqlite3_exec(db, "BEGIN EXCLUSIVE", 0, 0, 0); rc = sqlite3_exec(db, zSchema, 0, 0, 0); if( rc!=SQLITE_OK ){ db_err("%s", sqlite3_errmsg(db)); } va_start(ap, zSchema); while( (zSql = va_arg(ap, const char*))!=0 ){ rc = sqlite3_exec(db, zSql, 0, 0, 0); if( rc!=SQLITE_OK ){ db_err("%s", sqlite3_errmsg(db)); } } va_end(ap); sqlite3_exec(db, "COMMIT", 0, 0, 0); if( zFileName || g.db!=0 ){ sqlite3_close(db); }else{ g.db = db; } } /* ** Function to return the number of seconds since 1970. This is ** the same as strftime('%s','now') but is more compact. */ void db_now_function( |
︙ | ︙ | |||
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | /* ** zDbName is the name of a database file. Attach zDbName using ** the name zLabel. */ void db_attach(const char *zDbName, const char *zLabel){ Blob key; blob_init(&key, 0, 0); db_maybe_obtain_encryption_key(zDbName, &key); if( fossil_getenv("FOSSIL_USE_SEE_TEXTKEY")==0 ){ char *zCmd = sqlite3_mprintf("ATTACH DATABASE %Q AS %Q KEY %Q", zDbName, zLabel, blob_str(&key)); db_multi_exec(zCmd /*works-like:""*/); fossil_secure_zero(zCmd, strlen(zCmd)); | > | 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | /* ** zDbName is the name of a database file. Attach zDbName using ** the name zLabel. */ void db_attach(const char *zDbName, const char *zLabel){ Blob key; if( db_table_exists(zLabel,"sqlite_master") ) return; blob_init(&key, 0, 0); db_maybe_obtain_encryption_key(zDbName, &key); if( fossil_getenv("FOSSIL_USE_SEE_TEXTKEY")==0 ){ char *zCmd = sqlite3_mprintf("ATTACH DATABASE %Q AS %Q KEY %Q", zDbName, zLabel, blob_str(&key)); db_multi_exec(zCmd /*works-like:""*/); fossil_secure_zero(zCmd, strlen(zCmd)); |
︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | /* ** Close the per-user database file in ~/.fossil */ void db_close_config(){ int iSlot = db_database_slot("configdb"); if( iSlot>0 ){ db_detach("configdb"); | < < | > > > | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | /* ** Close the per-user database file in ~/.fossil */ void db_close_config(){ int iSlot = db_database_slot("configdb"); if( iSlot>0 ){ db_detach("configdb"); }else if( g.dbConfig ){ sqlite3_wal_checkpoint(g.dbConfig, 0); sqlite3_close(g.dbConfig); g.dbConfig = 0; }else if( g.db && 0==iSlot ){ int rc; sqlite3_wal_checkpoint(g.db, 0); rc = sqlite3_close(g.db); if( g.fSqlTrace ) fossil_trace("-- db_close_config(%d)\n", rc); g.db = 0; }else{ return; } fossil_free(g.zConfigDbName); g.zConfigDbName = 0; } /* ** Open the user database in "~/.fossil". Create the database anew if ** it does not already exist. ** ** If the useAttach flag is 0 (the usual case) then the user database is |
︙ | ︙ | |||
1374 1375 1376 1377 1378 1379 1380 | zHome = fossil_getenv("FOSSIL_HOME"); #if defined(_WIN32) || defined(__CYGWIN__) if( zHome==0 ){ zHome = fossil_getenv("LOCALAPPDATA"); if( zHome==0 ){ zHome = fossil_getenv("APPDATA"); if( zHome==0 ){ | > > | | | > | | | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | zHome = fossil_getenv("FOSSIL_HOME"); #if defined(_WIN32) || defined(__CYGWIN__) if( zHome==0 ){ zHome = fossil_getenv("LOCALAPPDATA"); if( zHome==0 ){ zHome = fossil_getenv("APPDATA"); if( zHome==0 ){ zHome = fossil_getenv("USERPROFILE"); if( zHome==0 ){ char *zDrive = fossil_getenv("HOMEDRIVE"); char *zPath = fossil_getenv("HOMEPATH"); if( zDrive && zPath ) zHome = mprintf("%s%s", zDrive, zPath); } } } } if( zHome==0 ){ if( isOptional ) return 0; fossil_panic("cannot locate home directory - please set the " "FOSSIL_HOME, LOCALAPPDATA, APPDATA, USERPROFILE, " "or HOMEDRIVE / HOMEPATH environment variables"); } #else if( zHome==0 ){ zHome = fossil_getenv("HOME"); } if( zHome==0 ){ if( isOptional ) return 0; |
︙ | ︙ | |||
1471 1472 1473 1474 1475 1476 1477 | /* ** If zDbName is a valid local database file, open it and return ** true. If it is not a valid local database file, return 0. */ static int isValidLocalDb(const char *zDbName){ i64 lsize; | < | > > > > > > > > | > > > | > | | | > > > > > | 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 | /* ** If zDbName is a valid local database file, open it and return ** true. If it is not a valid local database file, return 0. */ static int isValidLocalDb(const char *zDbName){ i64 lsize; if( file_access(zDbName, F_OK) ) return 0; lsize = file_size(zDbName, ExtFILE); if( lsize%1024!=0 || lsize<4096 ) return 0; db_open_or_attach(zDbName, "localdb"); /* Check to see if the checkout database has the lastest schema changes. ** The most recent schema change (2019-01-19) is the addition of the ** vmerge.mhash and vfile.mhash fields. If the schema has the vmerge.mhash ** column, assume everything else is up-to-date. */ if( db_table_has_column("localdb","vmerge","mhash") ){ return 1; /* This is a checkout database with the latest schema */ } /* If there is no vfile table, then assume we have picked up something ** that is not even close to being a valid checkout database */ if( !db_table_exists("localdb","vfile") ){ return 0; /* Not a DB */ } /* If the "isexe" column is missing from the vfile table, then ** add it now. This code added on 2010-03-06. After all users have ** upgraded, this code can be safely deleted. */ if( !db_table_has_column("localdb","vfile","isexe") ){ db_multi_exec("ALTER TABLE vfile ADD COLUMN isexe BOOLEAN DEFAULT 0"); } /* If "islink"/"isLink" columns are missing from tables, then ** add them now. This code added on 2011-01-17 and 2011-08-27. ** After all users have upgraded, this code can be safely deleted. */ if( !db_table_has_column("localdb","vfile","isLink") ){ db_multi_exec("ALTER TABLE vfile ADD COLUMN islink BOOLEAN DEFAULT 0"); if( db_local_table_exists_but_lacks_column("stashfile", "isLink") ){ db_multi_exec("ALTER TABLE stashfile ADD COLUMN isLink BOOL DEFAULT 0"); } if( db_local_table_exists_but_lacks_column("undo", "isLink") ){ db_multi_exec("ALTER TABLE undo ADD COLUMN isLink BOOLEAN DEFAULT 0"); } if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){ db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0"); } } /* The design of the checkout database changed on 2019-01-19, adding the mhash ** column to vfile and vmerge and changing the UNIQUE index on vmerge into ** a PRIMARY KEY that includes the new mhash column. However, we must have ** the repository database at hand in order to do the migration, so that ** step is deferred. */ return 1; } /* ** Locate the root directory of the local repository tree. The root ** directory is found by searching for a file named "_FOSSIL_" or ".fslckout" ** that contains a valid repository database. |
︙ | ︙ | |||
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 | const char *db_repository_filename(void){ static char *zRepo = 0; assert( g.localOpen ); assert( g.zLocalRoot ); if( zRepo==0 ){ zRepo = db_lget("repository", 0); if( zRepo && !file_is_absolute_path(zRepo) ){ zRepo = mprintf("%s%s", g.zLocalRoot, zRepo); } } return zRepo; } /* ** Returns non-zero if the default value for the "allow-symlinks" setting | > > | 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | const char *db_repository_filename(void){ static char *zRepo = 0; assert( g.localOpen ); assert( g.zLocalRoot ); if( zRepo==0 ){ zRepo = db_lget("repository", 0); if( zRepo && !file_is_absolute_path(zRepo) ){ char * zFree = zRepo; zRepo = mprintf("%s%s", g.zLocalRoot, zRepo); fossil_free(zFree); } } return zRepo; } /* ** Returns non-zero if the default value for the "allow-symlinks" setting |
︙ | ︙ | |||
1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 | db_set_int("hash-policy", g.eHashPolicy, 0); } /* Make a change to the CHECK constraint on the BLOB table for ** version 2.0 and later. */ rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */ } /* ** Return true if there have been any changes to the repository ** database since it was opened. ** ** Changes to "config" and "localdb" and "temp" do not count. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | db_set_int("hash-policy", g.eHashPolicy, 0); } /* Make a change to the CHECK constraint on the BLOB table for ** version 2.0 and later. */ rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */ /* Additional checks that occur when opening the checkout database */ if( g.localOpen ){ /* If the repository database that was just opened has been ** eplaced by a clone of the same project, with different RID ** values, then renumber the RID values stored in various tables ** of the checkout database, so that the repository and checkout ** databases align. */ if( !db_fingerprint_ok() ){ if( find_option("no-rid-adjust",0,0)!=0 ){ /* The --no-rid-adjust command-line option bypasses the RID value ** updates. Intended for use during debugging, especially to be ** able to run "fossil sql" after a database swap. */ fossil_print( "WARNING: repository change detected, but no adjust made.\n" ); }else if( find_option("rid-renumber-dryrun",0,0)!=0 ){ /* the --rid-renumber-dryrun option shows how RID values would be ** renumbered, but does not actually perform the renumbering. ** This is a debugging-only option. */ vfile_rid_renumbering_event(1); exit(0); }else{ char *z; stash_rid_renumbering_event(); vfile_rid_renumbering_event(0); undo_reset(); bisect_reset(); z = db_fingerprint(0, 1); db_lset("fingerprint", z); fossil_free(z); fossil_print( "WARNING: The repository database has been replaced by a clone.\n" "Bisect history and undo have been lost.\n" ); } } /* Make sure the checkout database schema migration of 2019-01-20 ** has occurred. ** ** The 2019-01-19 migration is the addition of the vmerge.mhash and ** vfile.mhash columns and making the vmerge.mhash column part of the ** PRIMARY KEY for vmerge. */ if( !db_table_has_column("localdb", "vfile", "mhash") ){ db_multi_exec("ALTER TABLE vfile ADD COLUMN mhash;"); db_multi_exec( "UPDATE vfile" " SET mhash=(SELECT uuid FROM blob WHERE blob.rid=vfile.mrid)" " WHERE mrid!=rid;" ); if( !db_table_has_column("localdb", "vmerge", "mhash") ){ db_multi_exec("ALTER TABLE vmerge RENAME TO old_vmerge;"); db_multi_exec(zLocalSchemaVmerge /*works-like:""*/); db_multi_exec( "INSERT OR IGNORE INTO vmerge(id,merge,mhash)" " SELECT id, merge, blob.uuid FROM old_vmerge, blob" " WHERE old_vmerge.merge=blob.rid;" "DROP TABLE old_vmerge;" ); } } } } /* ** Return true if there have been any changes to the repository ** database since it was opened. ** ** Changes to "config" and "localdb" and "temp" do not count. |
︙ | ︙ | |||
1674 1675 1676 1677 1678 1679 1680 | return g.iRepoDataVers != v; } /* ** Flags for the db_find_and_open_repository() function. */ #if INTERFACE | | | > | 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | return g.iRepoDataVers != v; } /* ** Flags for the db_find_and_open_repository() function. */ #if INTERFACE #define OPEN_OK_NOT_FOUND 0x001 /* Do not error out if not found */ #define OPEN_ANY_SCHEMA 0x002 /* Do not error if schema is wrong */ #define OPEN_SUBSTITUTE 0x004 /* Fake in-memory repo if not found */ #endif /* ** Try to find the repository and open it. Use the -R or --repository ** option to locate the repository. If no such option is available, then ** use the repository of the open checkout if there is one. ** |
︙ | ︙ | |||
1708 1709 1710 1711 1712 1713 1714 | } db_open_repository(zRep); if( g.repositoryOpen ){ if( (bFlags & OPEN_ANY_SCHEMA)==0 ) db_verify_schema(); return; } rep_not_found: | | > > > > > | 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | } db_open_repository(zRep); if( g.repositoryOpen ){ if( (bFlags & OPEN_ANY_SCHEMA)==0 ) db_verify_schema(); return; } rep_not_found: if( bFlags & OPEN_OK_NOT_FOUND ){ /* No errors if the database is not found */ if( bFlags & OPEN_SUBSTITUTE ){ db_create_repository(0); } }else{ #ifdef FOSSIL_ENABLE_JSON g.json.resultCode = FSL_JSON_E_DB_NOT_FOUND; #endif if( nArgUsed==0 ){ fossil_fatal("use --repository or -R to specify the repository database"); }else{ fossil_fatal("specify the repository name as a command-line argument"); |
︙ | ︙ | |||
1938 1939 1940 1941 1942 1943 1944 | if( zUser==0 ){ zUser = "root"; } db_multi_exec( "INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser ); db_multi_exec( | | | | 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 | if( zUser==0 ){ zUser = "root"; } db_multi_exec( "INSERT OR IGNORE INTO user(login, info) VALUES(%Q,'')", zUser ); db_multi_exec( "UPDATE user SET cap='s', pw=%Q" " WHERE login=%Q", fossil_random_password(10), zUser ); if( !setupUserOnly ){ db_multi_exec( "INSERT OR IGNORE INTO user(login,pw,cap,info)" " VALUES('anonymous',hex(randomblob(8)),'hmnc','Anon');" "INSERT OR IGNORE INTO user(login,pw,cap,info)" " VALUES('nobody','','gjorz','Nobody');" |
︙ | ︙ | |||
2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 | db_swap_connections(); z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); db_swap_connections(); } if( pSetting!=0 && pSetting->versionable ){ /* This is a versionable setting, try and get the info from a ** checked out file */ z = db_get_versioned(zName, z); } if( z==0 ){ if( zDefault==0 && pSetting && pSetting->def[0] ){ z = fossil_strdup(pSetting->def); }else{ z = fossil_strdup(zDefault); } | > > > > | 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 | db_swap_connections(); z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); db_swap_connections(); } if( pSetting!=0 && pSetting->versionable ){ /* This is a versionable setting, try and get the info from a ** checked out file */ char * zZ = z; z = db_get_versioned(zName, z); if(zZ != z){ fossil_free(zZ); } } if( z==0 ){ if( zDefault==0 && pSetting && pSetting->def[0] ){ z = fossil_strdup(pSetting->def); }else{ z = fossil_strdup(zDefault); } |
︙ | ︙ | |||
2608 2609 2610 2611 2612 2613 2614 | } if( globalFlag && g.repositoryOpen ){ db_multi_exec("DELETE FROM config WHERE name=%Q", zName); } } int db_get_boolean(const char *zName, int dflt){ char *zVal = db_get(zName, dflt ? "on" : "off"); | | > | > > > | 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 | } if( globalFlag && g.repositoryOpen ){ db_multi_exec("DELETE FROM config WHERE name=%Q", zName); } } int db_get_boolean(const char *zName, int dflt){ char *zVal = db_get(zName, dflt ? "on" : "off"); if( is_truth(zVal) ){ dflt = 1; }else if( is_false(zVal) ){ dflt = 0; } fossil_free(zVal); return dflt; } int db_get_versioned_boolean(const char *zName, int dflt){ char *zVal = db_get_versioned(zName, 0); if( zVal==0 ) return dflt; if( is_truth(zVal) ) return 1; if( is_false(zVal) ) return 0; |
︙ | ︙ | |||
2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 | ** Options: ** --empty Initialize checkout as being empty, but still connected ** with the local repository. If you commit this checkout, ** it will become a new "initial" commit in the repository. ** --keep Only modify the manifest and manifest.uuid files ** --nested Allow opening a repository inside an opened checkout ** --force-missing Force opening a repository with missing content ** ** See also: close */ void cmd_open(void){ int emptyFlag; int keepFlag; int forceMissingFlag; int allowNested; int allowSymlinks; static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; url_proxy_options(); emptyFlag = find_option("empty",0,0)!=0; keepFlag = find_option("keep",0,0)!=0; forceMissingFlag = find_option("force-missing",0,0)!=0; allowNested = find_option("nested",0,0)!=0; /* We should be done with options.. */ verify_all_options(); if( g.argc!=3 && g.argc!=4 ){ usage("REPOSITORY-FILENAME ?VERSION?"); } if( !allowNested && db_open_local(0) ){ fossil_fatal("already within an open tree rooted at %s", g.zLocalRoot); } db_open_repository(g.argv[2]); /* Figure out which revision to open. */ if( !emptyFlag ){ if( g.argc==4 ){ g.zOpenRevision = g.argv[3]; }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){ | > > > > > | | 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 | ** Options: ** --empty Initialize checkout as being empty, but still connected ** with the local repository. If you commit this checkout, ** it will become a new "initial" commit in the repository. ** --keep Only modify the manifest and manifest.uuid files ** --nested Allow opening a repository inside an opened checkout ** --force-missing Force opening a repository with missing content ** --setmtime Set timestamps of all files to match their SCM-side ** times (the timestamp of the last checkin which modified ** them). ** ** See also: close */ void cmd_open(void){ int emptyFlag; int keepFlag; int forceMissingFlag; int allowNested; int allowSymlinks; int setmtimeFlag; /* --setmtime. Set mtimes on files */ static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; url_proxy_options(); emptyFlag = find_option("empty",0,0)!=0; keepFlag = find_option("keep",0,0)!=0; forceMissingFlag = find_option("force-missing",0,0)!=0; allowNested = find_option("nested",0,0)!=0; setmtimeFlag = find_option("setmtime",0,0)!=0; /* We should be done with options.. */ verify_all_options(); if( g.argc!=3 && g.argc!=4 ){ usage("REPOSITORY-FILENAME ?VERSION?"); } if( !allowNested && db_open_local(0) ){ fossil_fatal("already within an open tree rooted at %s", g.zLocalRoot); } db_open_repository(g.argv[2]); /* Figure out which revision to open. */ if( !emptyFlag ){ if( g.argc==4 ){ g.zOpenRevision = g.argv[3]; }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){ g.zOpenRevision = db_get("main-branch", 0); } } if( g.zOpenRevision ){ /* Since the repository is open and we know the revision now, ** refresh the allow-symlinks flag. Since neither the local ** checkout nor the configuration database are open at this |
︙ | ︙ | |||
2845 2846 2847 2848 2849 2850 2851 | } #if defined(_WIN32) || defined(__CYGWIN__) # define LOCALDB_NAME "./_FOSSIL_" #else # define LOCALDB_NAME "./.fslckout" #endif | | | 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 | } #if defined(_WIN32) || defined(__CYGWIN__) # define LOCALDB_NAME "./_FOSSIL_" #else # define LOCALDB_NAME "./.fslckout" #endif db_init_database(LOCALDB_NAME, zLocalSchema, zLocalSchemaVmerge, #ifdef FOSSIL_LOCAL_WAL "COMMIT; PRAGMA journal_mode=WAL; BEGIN;", #endif (char*)0); db_delete_on_failure(LOCALDB_NAME); db_open_local(0); if( allowSymlinks>=0 ){ |
︙ | ︙ | |||
2870 2871 2872 2873 2874 2875 2876 | ** point, this will probably be the setting value from the ** repository or global configuration databases. */ g.allowSymlinks = db_get_boolean("allow-symlinks", db_allow_symlinks_by_default()); } db_lset("repository", g.argv[2]); db_record_repository_filename(g.argv[2]); | | > > > > > > | 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 | ** point, this will probably be the setting value from the ** repository or global configuration databases. */ g.allowSymlinks = db_get_boolean("allow-symlinks", db_allow_symlinks_by_default()); } db_lset("repository", g.argv[2]); db_record_repository_filename(g.argv[2]); db_set_checkout(0); azNewArgv[0] = g.argv[0]; g.argv = azNewArgv; if( !emptyFlag ){ g.argc = 3; if( g.zOpenRevision ){ azNewArgv[g.argc-1] = g.zOpenRevision; }else{ azNewArgv[g.argc-1] = "--latest"; } if( keepFlag ){ azNewArgv[g.argc++] = "--keep"; } if( forceMissingFlag ){ azNewArgv[g.argc++] = "--force-missing"; } checkout_cmd(); } if( setmtimeFlag ){ int const vid = db_lget_int("checkout", 0); if(vid!=0){ vfile_check_signature(vid, CKSIG_SETMTIME); } } g.argc = 2; info_cmd(); } /* ** Print the current value of a setting identified by the pSetting |
︙ | ︙ | |||
2939 2940 2941 2942 2943 2944 2945 | /* ** Define all settings, which can be controlled via the set/unset ** command. ** ** var is the name of the internal configuration name for db_(un)set. ** If var is 0, the settings name is used. ** | | | > > > | > > | 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 | /* ** Define all settings, which can be controlled via the set/unset ** command. ** ** var is the name of the internal configuration name for db_(un)set. ** If var is 0, the settings name is used. ** ** width is the length for the edit field on the behavior page, 0 is ** used for on/off checkboxes. A negative value indicates that that ** page should not render this setting. Such values may be rendered ** separately/manually on another page, e.g., /setup_access, and are ** exposed via the CLI settings command. ** ** The behaviour page doesn't use a special layout. It lists all ** set-commands and displays the 'set'-help as info. */ struct Setting { const char *name; /* Name of the setting */ const char *var; /* Internal variable name used by db_set() */ int width; /* Width of display. 0 for boolean values and ** negative for values which should not appear ** on the /setup_settings page. */ int versionable; /* Is this setting versionable? */ int forceTextArea; /* Force using a text area for display? */ const char *def; /* Default value */ }; #endif /* INTERFACE */ /* |
︙ | ︙ | |||
3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 | */ /* ** SETTING: backoffice-nodelay boolean default=off ** If backoffice-nodelay is true, then the backoffice processing ** will never invoke sleep(). If it has nothing useful to do, ** it simply exits. */ /* ** SETTING: backoffice-logfile width=40 ** If backoffice-logfile is not an empty string and is a valid ** filename, then a one-line message is appended to that file ** every time the backoffice runs. This can be used for debugging, ** to ensure that backoffice is running appropriately. */ | > > > > > > > > > > > > > > | 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 | */ /* ** SETTING: backoffice-nodelay boolean default=off ** If backoffice-nodelay is true, then the backoffice processing ** will never invoke sleep(). If it has nothing useful to do, ** it simply exits. */ /* ** SETTING: backoffice-disable boolean default=off ** If backoffice-disable is true, then the automatic backoffice ** processing is disabled. Automatic backoffice processing is the ** backoffice work that normally runs after each web page is ** rendered. Backoffice processing that is triggered by the ** "fossil backoffice" command is unaffected by this setting. ** ** Backoffice processing does things such as delivering ** email notifications. So if this setting is true, and if ** there is no cron job periodically running "fossil backoffice", ** email notifications and other work normally done by the ** backoffice will not occur. */ /* ** SETTING: backoffice-logfile width=40 ** If backoffice-logfile is not an empty string and is a valid ** filename, then a one-line message is appended to that file ** every time the backoffice runs. This can be used for debugging, ** to ensure that backoffice is running appropriately. */ |
︙ | ︙ | |||
3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 | ** Example: *.a,*.lib,*.o */ /* ** SETTING: clearsign boolean default=off ** When enabled, fossil will attempt to sign all commits ** with gpg. When disabled, commits will be unsigned. */ /* ** SETTING: crlf-glob width=40 versionable block-text ** The value is a comma or newline-separated list of GLOB patterns for ** text files in which it is ok to have CR, CR+LF or mixed ** line endings. Set to "*" to disable CR+LF checking. ** The crnl-glob setting is a compatibility alias. */ | > > > > > > > > > > > > > > > > > > > > > > > | 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 | ** Example: *.a,*.lib,*.o */ /* ** SETTING: clearsign boolean default=off ** When enabled, fossil will attempt to sign all commits ** with gpg. When disabled, commits will be unsigned. */ /* ** SETTING: comment-format width=16 default=1 ** Set the default options for printing timeline comments to the console. ** ** The global --comfmtflags command-line option (or alias --comment-format) ** overrides this setting. ** ** Possible values are: ** 1 Activate the legacy comment printing format (default). ** ** Or a bitwise combination of the following flags: ** 0 Activate the newer (non-legacy) comment printing format. ** 2 Trim leading and trailing CR and LF characters. ** 4 Trim leading and trailing white space characters. ** 8 Attempt to break lines on word boundaries. ** 16 Break lines before the original comment embedded in other text. ** ** Note: To preserve line breaks, activate the newer (non-legacy) comment ** printing format (i.e. set to "0", or a combination not including "1"). ** ** Note: The options for timeline comments displayed on the web UI can be ** configured through the /setup_timeline web page. */ /* ** SETTING: crlf-glob width=40 versionable block-text ** The value is a comma or newline-separated list of GLOB patterns for ** text files in which it is ok to have CR, CR+LF or mixed ** line endings. Set to "*" to disable CR+LF checking. ** The crnl-glob setting is a compatibility alias. */ |
︙ | ︙ | |||
3186 3187 3188 3189 3190 3191 3192 | /* ** SETTING: keep-glob width=40 versionable block-text ** The value is a comma or newline-separated list of GLOB ** patterns specifying files that the "clean" command will keep. */ /* ** SETTING: localauth boolean default=off | | | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 | /* ** SETTING: keep-glob width=40 versionable block-text ** The value is a comma or newline-separated list of GLOB ** patterns specifying files that the "clean" command will keep. */ /* ** SETTING: localauth boolean default=off ** If enabled, require that HTTP connections from the loopback ** address (127.0.0.1) be authenticated by password. If false, ** some HTTP requests might be granted full "Setup" user ** privileges without having to present login credentials. ** This mechanism allows the "fossil ui" command to provide ** full access to the repository without requiring the user to ** log in first. ** ** In order for full "Setup" privilege to be granted without a ** login, the following conditions must be met: ** ** (1) This setting ("localauth") must be off ** (2) The HTTP request arrive over the loopback TCP/IP ** address (127.0.01) or else via SSH. ** (3) The request must be HTTP, not HTTPS. (This ** restriction is designed to help prevent accidentally ** providing "Setup" privileges to requests arriving ** over a reverse proxy.) ** (4) The command that launched the fossil server must be ** one of the following: ** (a) "fossil ui" ** (b) "fossil server" with the --localauth option ** (c) "fossil http" with the --localauth option ** (d) CGI with the "localauth" setting in the cgi script. ** ** For maximum security, set "localauth" to 1. However, because ** of the other restrictions (2) through (4), it should be safe ** to leave "localauth" set to 0 in most installations, and ** especially on cloned repositories on workstations. Leaving ** "localauth" at 0 makes the "fossil ui" command more convenient ** to use. */ /* ** SETTING: lock-timeout width=25 default=60 ** This is the number of seconds that a check-in lock will be held on ** the server before the lock expires. The default is a 60-second delay. ** Set this value to zero to disable the check-in lock mechanism. ** ** This value should be set on the server to which users auto-sync ** their work. This setting has no affect on client repositories. The ** check-in lock mechanism is only effective if all users are auto-syncing ** to the same server. ** ** Check-in locks are an advisory mechanism designed to help prevent ** accidental forks due to a check-in race in installations where many ** user are committing to the same branch and auto-sync is enabled. ** As forks are harmless, there is no danger in disabling this mechanism. ** However, keeping check-in locks turned on can help prevent unnecessary ** confusion. */ /* ** SETTING: main-branch width=40 default=trunk ** The value is the primary branch for the project. */ /* ** SETTING: manifest width=5 versionable |
︙ | ︙ | |||
3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 | /* ** SETTING: proxy width=32 default=off ** URL of the HTTP proxy. If undefined or "off" then ** the "http_proxy" environment variable is consulted. ** If the http_proxy environment variable is undefined ** then a direct HTTP connection is used. */ /* ** SETTING: relative-paths boolean default=on ** When showing changes and extras, report paths relative ** to the current working directory. */ /* ** SETTING: repo-cksum boolean default=on ** Compute checksums over all files in each checkout as a double-check ** of correctness. Disable this on large repositories for a performance ** improvement. */ /* ** SETTING: self-register boolean default=off ** Allow users to register themselves through the HTTP UI. ** This is useful if you want to see other names than ** "Anonymous" in e.g. ticketing system. On the other hand ** users can not be deleted. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 | /* ** SETTING: proxy width=32 default=off ** URL of the HTTP proxy. If undefined or "off" then ** the "http_proxy" environment variable is consulted. ** If the http_proxy environment variable is undefined ** then a direct HTTP connection is used. */ /* ** SETTING: redirect-to-https default=0 width=-1 ** Specifies whether or not to redirect http:// requests to ** https:// URIs. A value of 0 (the default) means not to ** redirect, 1 means to redirect only the /login page, and 2 ** means to always redirect. */ /* ** SETTING: relative-paths boolean default=on ** When showing changes and extras, report paths relative ** to the current working directory. */ /* ** SETTING: repo-cksum boolean default=on ** Compute checksums over all files in each checkout as a double-check ** of correctness. Disable this on large repositories for a performance ** improvement. */ /* ** SETTING: repolist-skin width=2 default=0 ** If non-zero then use this repository as the skin for a repository list ** such as created by the one of: ** ** 1) fossil server DIRECTORY --repolist ** 2) fossil ui DIRECTORY --repolist ** 3) fossil http DIRECTORY --repolist ** 4) (The "repolist" option in a CGI script) ** 5) fossil all ui ** 6) fossil all server ** ** All repositories are searched (in lexicographical order) and the first ** repository with a non-zero "repolist-skin" value is used as the skin ** for the repository list page. If none of the repositories on the list ** have a non-zero "repolist-skin" setting then the repository list is ** displayed using unadorned HTML ("skinless"). ** ** If repolist-skin has a value of 2, then the repository is omitted from ** the list in use cases 1 through 4, but not for 5 and 6. */ /* ** SETTING: self-register boolean default=off ** Allow users to register themselves through the HTTP UI. ** This is useful if you want to see other names than ** "Anonymous" in e.g. ticketing system. On the other hand ** users can not be deleted. */ |
︙ | ︙ | |||
3301 3302 3303 3304 3305 3306 3307 | ** If enabled Tcl integration commands will be added to the TH1 ** interpreter, allowing arbitrary Tcl expressions and ** scripts to be evaluated from TH1. Additionally, the Tcl ** interpreter will be able to evaluate arbitrary TH1 ** expressions and scripts. */ /* | | > > > > > > | | | 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 | ** If enabled Tcl integration commands will be added to the TH1 ** interpreter, allowing arbitrary Tcl expressions and ** scripts to be evaluated from TH1. Additionally, the Tcl ** interpreter will be able to evaluate arbitrary TH1 ** expressions and scripts. */ /* ** SETTING: tcl-setup width=40 block-text ** This is the setup script to be evaluated after creating ** and initializing the Tcl interpreter. By default, this ** is empty and no extra setup is performed. */ #endif /* FOSSIL_ENABLE_TCL */ /* ** SETTING: tclsh width=80 default=tclsh ** Name of the external TCL interpreter used for such things ** as running the GUI diff viewer launched by the --tk option ** of the various "diff" commands. */ #ifdef FOSSIL_ENABLE_TH1_DOCS /* ** SETTING: th1-docs boolean default=off ** If enabled, this allows embedded documentation files to contain ** arbitrary TH1 scripts that are evaluated on the server. If native ** Tcl integration is also enabled, this setting has the ** potential to allow anybody with check-in privileges to ** do almost anything that the associated operating system ** user account could do. Extreme caution should be used ** when enabling this setting. */ #endif #ifdef FOSSIL_ENABLE_TH1_HOOKS /* ** SETTING: th1-hooks boolean default=off ** If enabled, special TH1 commands will be called before and ** after any Fossil command or web page. */ #endif /* ** SETTING: th1-setup width=40 block-text ** This is the setup script to be evaluated after creating ** and initializing the TH1 interpreter. By default, this ** is empty and no extra setup is performed. */ /* ** SETTING: th1-uri-regexp width=40 block-text ** Specify which URI's are allowed in HTTP requests from ** TH1 scripts. If empty, no HTTP requests are allowed ** whatsoever. */ /* ** SETTING: uv-sync boolean default=off ** If true, automatically send unversioned files as part |
︙ | ︙ | |||
3661 3662 3663 3664 3665 3666 3667 | */ void test_database_name_cmd(void){ db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); fossil_print("Repository database: %s\n", g.zRepositoryName); fossil_print("Local database: %s\n", g.zLocalDbName); fossil_print("Config database: %s\n", g.zConfigDbName); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 | */ void test_database_name_cmd(void){ db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); fossil_print("Repository database: %s\n", g.zRepositoryName); fossil_print("Local database: %s\n", g.zLocalDbName); fossil_print("Config database: %s\n", g.zConfigDbName); } /* ** Compute a "fingerprint" on the repository. A fingerprint is used ** to verify that that the repository has not been replaced by a clone ** of the same repository. More precisely, a fingerprint are used to ** verify that the mapping between SHA3 hashes and RID values is unchanged. ** ** The checkout database ("localdb") stores RID values. When associating ** a checkout database against a repository database, it is useful to verify ** the fingerprint so that we know tha the RID values in the checkout ** database still correspond to the correct entries in the BLOB table of ** the repository. ** ** The fingerprint is based on the RCVFROM table. When constructing a ** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to ** accomplish this.) When verifying an old fingerprint, use the same ** RCVFROM entry that generated the fingerprint in the first place. ** ** The fingerprint consists of the rcvid, a "/", and the MD5 checksum of ** the remaining fields of the RCVFROM table entry. MD5 is used for this ** because it is 4x faster than SHA3 and 5x faster than SHA1, and there ** are no security concerns - this is just a checksum, not a security ** token. */ char *db_fingerprint(int rcvid, int iVersion){ char *z = 0; Blob sql = BLOB_INITIALIZER; Stmt q; if( iVersion==0 ){ /* The original fingerprint algorithm used "quote(mtime)". But this ** could give slightly different answers depending on how the floating- ** point hardware is configured. For example, it gave different ** answers on native Linux versus running under valgrind. */ blob_append_sql(&sql, "SELECT rcvid, quote(uid), quote(mtime), quote(nonce), quote(ipaddr)" " FROM rcvfrom" ); }else{ /* These days, we use "datetime(mtime)" for more consistent answers */ blob_append_sql(&sql, "SELECT rcvid, quote(uid), datetime(mtime), quote(nonce), quote(ipaddr)" " FROM rcvfrom" ); } if( rcvid<=0 ){ blob_append_sql(&sql, " ORDER BY rcvid DESC LIMIT 1"); }else{ blob_append_sql(&sql, " WHERE rcvid=%d", rcvid); } db_prepare_blob(&q, &sql); blob_reset(&sql); if( db_step(&q)==SQLITE_ROW ){ int i; md5sum_init(); for(i=1; i<=4; i++){ md5sum_step_text(db_column_text(&q,i),-1); } z = mprintf("%d/%s",db_column_int(&q,0),md5sum_finish(0)); } db_finalize(&q); return z; } /* ** COMMAND: test-fingerprint ** ** Usage: %fossil test-fingerprint ?RCVID? ** ** Display the repository fingerprint using the supplied RCVID or ** using the latest RCVID if not is given on the command line. ** Show both the legacy and the newer version of the fingerprint, ** and the currently stored fingerprint if there is one. */ void test_fingerprint(void){ int rcvid = 0; db_find_and_open_repository(OPEN_ANY_SCHEMA,0); if( g.argc==3 ){ rcvid = atoi(g.argv[2]); }else if( g.argc!=2 ){ fossil_fatal("wrong number of arguments"); } fossil_print("legacy: %z\n", db_fingerprint(rcvid, 0)); fossil_print("version-1: %z\n", db_fingerprint(rcvid, 1)); if( g.localOpen ){ fossil_print("localdb: %z\n", db_lget("fingerprint","(none)")); fossil_print("db_fingerprint_ok(): %d\n", db_fingerprint_ok()); } fossil_print("Fossil version: %s - %.10s %.19s\n", RELEASE_VERSION, MANIFEST_DATE, MANIFEST_UUID); } /* ** Set the value of the "checkout" entry in the VVAR table. ** ** Also set "fingerprint" and "checkout-hash". */ void db_set_checkout(int rid){ char *z; db_lset_int("checkout", rid); if (rid != 0) { z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); db_lset("checkout-hash", z); fossil_free(z); z = db_fingerprint(0, 1); db_lset("fingerprint", z); fossil_free(z); } } /* ** Verify that the fingerprint recorded in the "fingerprint" entry ** of the VVAR table matches the fingerprint on the currently ** connected repository. Return true if the fingerprint is ok, and ** return false if the fingerprint does not match. */ int db_fingerprint_ok(void){ char *zCkout; /* The fingerprint recorded in the checkout database */ char *zRepo; /* The fingerprint of the repository */ int rc; /* Result */ if( !db_lget_int("checkout", 0) ){ /* We have an empty checkout, fingerprint is still NULL. */ return 2; } zCkout = db_text(0,"SELECT value FROM localdb.vvar WHERE name='fingerprint'"); if( zCkout==0 ){ /* This is an older checkout that does not record a fingerprint. ** We have to assume everything is ok */ return 2; } zRepo = db_fingerprint(atoi(zCkout), 1); rc = fossil_strcmp(zCkout,zRepo)==0; fossil_free(zRepo); /* If the initial test fails, try again using the older fingerprint ** algorithm */ if( !rc ){ zRepo = db_fingerprint(atoi(zCkout), 0); rc = fossil_strcmp(zCkout,zRepo)==0; fossil_free(zRepo); } fossil_free(zCkout); return rc; } |
Changes to src/default_css.txt.
︙ | ︙ | |||
36 37 38 39 40 41 42 | font-size: small; } tr.timelineCurrent { padding: .1em .2em; border: 1px dashed #446979; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5); } | | > > > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | font-size: small; } tr.timelineCurrent { padding: .1em .2em; border: 1px dashed #446979; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5); } .timelineSelected { padding: .1em .2em; border: 2px solid lightgray; background-color: #ffc; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5); } .timelineSecondary { background-color: #cff; } tr.timelineSelected td { border-radius: 0; border-width: 0; } tr.timelineCurrent td { border-radius: 0; border-width: 0; |
︙ | ︙ | |||
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | } .tl-arrow.merge.r { border-left: 3px solid #000; } .tl-line.merge { width: 1px; } .tl-arrow.warp { margin-left: 1px; border-width: 3px 0; border-left: 7px solid #600000; } .tl-line.warp { background: #600000; } span.tagDsp { font-weight: bold; } span.wikiError { font-weight: bold; color: red; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | } .tl-arrow.merge.r { border-left: 3px solid #000; } .tl-line.merge { width: 1px; } .tl-arrow.cherrypick { height: 1px; border-width: 2px 0; } .tl-arrow.cherrypick.l { border-right: 3px solid #000; } .tl-arrow.cherrypick.r { border-left: 3px solid #000; } .tl-line.cherrypick.h { width: 0px; border-top: 1px dashed #000; border-left: 0px dashed #000; background: rgba(255,255,255,0); } .tl-line.cherrypick.v { width: 0px; border-top: 0px dashed #000; border-left: 1px dashed #000; background: rgba(255,255,255,0); } .tl-arrow.warp { margin-left: 1px; border-width: 3px 0; border-left: 7px solid #600000; } .tl-line.warp { background: #600000; } .tl-line.dotted.v { width: 0px; border-left-width: 2px; border-left-style: dotted; background: rgba(255,255,255,0); } .tl-tooltip { text-align: center; padding: 5px 1em; border: 1px solid black; border-radius: 6px; position: absolute; z-index: 100; box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.75); } span.tagDsp { font-weight: bold; } span.wikiError { font-weight: bold; color: red; } |
︙ | ︙ | |||
193 194 195 196 197 198 199 | div.columns > ul { margin: 0; padding: 0 0 0 1em; } div.columns > ul li:first-child { margin-top:0px; } | | > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | div.columns > ul { margin: 0; padding: 0 0 0 1em; } div.columns > ul li:first-child { margin-top:0px; } .columns li { break-inside: avoid; page-break-inside: avoid; } .filetree { margin: 1em 0; line-height: 1.5; } .filetree > ul { display: inline-block; |
︙ | ︙ | |||
411 412 413 414 415 416 417 418 419 420 421 422 423 424 | td.tktDspLabel { text-align: right; } td.tktDspValue { text-align: left; vertical-align: top; background-color: #d0d0d0; } span.tktError { color: red; font-weight: bold; } table.rpteditex { float: right; | > > > > > > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | td.tktDspLabel { text-align: right; } td.tktDspValue { text-align: left; vertical-align: top; background-color: #d0d0d0; } td.tktTlOpen { color: #800; } td.tktTlClosed { color: #888; } span.tktError { color: red; font-weight: bold; } table.rpteditex { float: right; |
︙ | ︙ | |||
726 727 728 729 730 731 732 | } .capsumWrite { background-color: #ffb; } label { white-space: nowrap; } | > > > > > > > > > > > > > > > > > > > > > > > | 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 | } .capsumWrite { background-color: #ffb; } label { white-space: nowrap; } .copy-button { display: inline-block; width: 14px; height: 14px; //Note: .24em is slightly smaller than the average width of a normal space. margin: -2px .24em 0 0; padding: 0; border: 0; vertical-align: middle; //Note: the mkcss utility does not support line breaks in data URIs. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0,0,14,14'%3E%3Cpath style='fill:black;opacity:0' d='M14,14H0V0h14v14z'/%3E%3Cpath style='fill:rgb(240,240,240)' d='M1,0h6.6l2,2h1l3.4,3.4v8.6h-10v-2h-3z'/%3E%3Cpath style='fill:rgb(64,64,64)' d='M2,1h5l3,3v7h-8z'/%3E%3Cpath style='fill:rgb(248,248,248)' d='M3,2h3.6l2.4,2.4v5.6h-6z'/%3E%3Cpath style='fill:rgb(80,128,208)' d='M4,5h4v1h-4zm0,2h4v1h-4z'/%3E%3Cpath style='fill:rgb(64,64,64)' d='M5,3h5l3,3v7h-8z'/%3E%3Cpath style='fill:rgb(248,248,248)' d='M10,4.4v1.6h1.6zm-4,-0.6h3v3h-3zm0,3h6v5.4h-6z'/%3E%3Cpath style='fill:rgb(80,128,208)' d='M7,8h4v1h-4zm0,2h4v1h-4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; cursor: pointer; } .copy-button-flipped { //Note: .16em is suitable for element grouping. margin-left: .16em; margin-right: 0; } .nobr { white-space: nowrap; } |
Added src/deltafunc.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* ** Copyright (c) 2019 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This module implements SQL interfaces to the delta logic. The code ** here is adapted from the ext/misc/fossildelta.c extension in SQLite. */ #include "config.h" #include "deltafunc.h" /* ** SQL functions: delta_create(X,Y) ** ** Return a delta that will transform X into Y. */ static void deltaCreateFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *aOrig; int nOrig; /* old blob */ const char *aNew; int nNew; /* new blob */ char *aOut; int nOut; /* output delta */ assert( argc==2 ); if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return; nOrig = sqlite3_value_bytes(argv[0]); aOrig = (const char*)sqlite3_value_blob(argv[0]); nNew = sqlite3_value_bytes(argv[1]); aNew = (const char*)sqlite3_value_blob(argv[1]); aOut = sqlite3_malloc64(nNew+70); if( aOut==0 ){ sqlite3_result_error_nomem(context); }else{ nOut = delta_create(aOrig, nOrig, aNew, nNew, aOut); if( nOut<0 ){ sqlite3_free(aOut); sqlite3_result_error(context, "cannot create fossil delta", -1); }else{ sqlite3_result_blob(context, aOut, nOut, sqlite3_free); } } } /* ** SQL functions: delta_apply(X,D) ** ** Return the result of applying delta D to input X. */ static void deltaApplyFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *aOrig; int nOrig; /* The X input */ const char *aDelta; int nDelta; /* The input delta (D) */ char *aOut; int nOut, nOut2; /* The output */ assert( argc==2 ); if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; if( sqlite3_value_type(argv[1])==SQLITE_NULL ) return; nOrig = sqlite3_value_bytes(argv[0]); aOrig = (const char*)sqlite3_value_blob(argv[0]); nDelta = sqlite3_value_bytes(argv[1]); aDelta = (const char*)sqlite3_value_blob(argv[1]); /* Figure out the size of the output */ nOut = delta_output_size(aDelta, nDelta); if( nOut<0 ){ sqlite3_result_error(context, "corrupt fossil delta", -1); return; } aOut = sqlite3_malloc64((sqlite3_int64)nOut+1); if( aOut==0 ){ sqlite3_result_error_nomem(context); }else{ nOut2 = delta_apply(aOrig, nOrig, aDelta, nDelta, aOut); if( nOut2!=nOut ){ sqlite3_free(aOut); sqlite3_result_error(context, "corrupt fossil delta", -1); }else{ sqlite3_result_blob(context, aOut, nOut, sqlite3_free); } } } /* ** SQL functions: delta_output_size(D) ** ** Return the size of the output that results from applying delta D. */ static void deltaOutputSizeFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *aDelta; int nDelta; /* The input delta (D) */ int nOut; /* Size of output */ assert( argc==1 ); if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; nDelta = sqlite3_value_bytes(argv[0]); aDelta = (const char*)sqlite3_value_blob(argv[0]); /* Figure out the size of the output */ nOut = delta_output_size(aDelta, nDelta); if( nOut<0 ){ sqlite3_result_error(context, "corrupt fossil delta", -1); return; }else{ sqlite3_result_int(context, nOut); } } /***************************************************************************** ** Table-valued SQL function: delta_parse(DELTA) ** ** Schema: ** ** CREATE TABLE delta_parse( ** op TEXT, ** a1 INT, ** a2 ANY, ** delta HIDDEN BLOB ** ); ** ** Given an input DELTA, this function parses the delta and returns ** rows for each entry in the delta. The op column has one of the ** values SIZE, COPY, INSERT, CHECKSUM, ERROR. ** ** Assuming no errors, the first row has op='SIZE'. a1 is the size of ** the output in bytes and a2 is NULL. ** ** After the initial SIZE row, there are zero or more 'COPY' and/or 'INSERT' ** rows. A COPY row means content is copied from the source into the ** output. Column a1 is the number of bytes to copy and a2 is the offset ** into source from which to begin copying. An INSERT row means to ** insert text into the output stream. Column a1 is the number of bytes ** to insert and column is a BLOB that contains the text to be inserted. ** ** The last row of a well-formed delta will have an op value of 'CHECKSUM'. ** The a1 column will be the value of the checksum and a2 will be NULL. ** ** If the input delta is not well-formed, then a row with an op value ** of 'ERROR' is returned. The a1 value of the ERROR row is the offset ** into the delta where the error was encountered and a2 is NULL. */ typedef struct deltaparsevtab_vtab deltaparsevtab_vtab; typedef struct deltaparsevtab_cursor deltaparsevtab_cursor; struct deltaparsevtab_vtab { sqlite3_vtab base; /* Base class - must be first */ /* No additional information needed */ }; struct deltaparsevtab_cursor { sqlite3_vtab_cursor base; /* Base class - must be first */ char *aDelta; /* The delta being parsed */ int nDelta; /* Number of bytes in the delta */ int iCursor; /* Current cursor location */ int eOp; /* Name of current operator */ unsigned int a1, a2; /* Arguments to current operator */ int iNext; /* Next cursor value */ }; /* Operator names: */ static const char *const azOp[] = { "SIZE", "COPY", "INSERT", "CHECKSUM", "ERROR", "EOF" }; #define DELTAPARSE_OP_SIZE 0 #define DELTAPARSE_OP_COPY 1 #define DELTAPARSE_OP_INSERT 2 #define DELTAPARSE_OP_CHECKSUM 3 #define DELTAPARSE_OP_ERROR 4 #define DELTAPARSE_OP_EOF 5 /* ** Read bytes from *pz and convert them into a positive integer. When ** finished, leave *pz pointing to the first character past the end of ** the integer. The *pLen parameter holds the length of the string ** in *pz and is decremented once for each character in the integer. */ static unsigned int deltaGetInt(const char **pz, int *pLen){ static const signed char zValue[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 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, -1, -1, -1, -1, 36, -1, 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, -1, -1, -1, 63, -1, }; unsigned int v = 0; int c; unsigned char *z = (unsigned char*)*pz; unsigned char *zStart = z; while( (c = zValue[0x7f&*(z++)])>=0 ){ v = (v<<6) + c; } z--; *pLen -= z - zStart; *pz = (char*)z; return v; } /* ** The deltaparsevtabConnect() method is invoked to create a new ** deltaparse virtual table. ** ** Think of this routine as the constructor for deltaparsevtab_vtab objects. ** ** All this routine needs to do is: ** ** (1) Allocate the deltaparsevtab_vtab object and initialize all fields. ** ** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the ** result set of queries against the virtual table will look like. */ static int deltaparsevtabConnect( sqlite3 *db, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVtab, char **pzErr ){ deltaparsevtab_vtab *pNew; int rc; rc = sqlite3_declare_vtab(db, "CREATE TABLE x(op,a1,a2,delta HIDDEN)" ); /* For convenience, define symbolic names for the index to each column. */ #define DELTAPARSEVTAB_OP 0 #define DELTAPARSEVTAB_A1 1 #define DELTAPARSEVTAB_A2 2 #define DELTAPARSEVTAB_DELTA 3 if( rc==SQLITE_OK ){ pNew = sqlite3_malloc64( sizeof(*pNew) ); *ppVtab = (sqlite3_vtab*)pNew; if( pNew==0 ) return SQLITE_NOMEM; memset(pNew, 0, sizeof(*pNew)); } return rc; } /* ** This method is the destructor for deltaparsevtab_vtab objects. */ static int deltaparsevtabDisconnect(sqlite3_vtab *pVtab){ deltaparsevtab_vtab *p = (deltaparsevtab_vtab*)pVtab; sqlite3_free(p); return SQLITE_OK; } /* ** Constructor for a new deltaparsevtab_cursor object. */ static int deltaparsevtabOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ deltaparsevtab_cursor *pCur; pCur = sqlite3_malloc( sizeof(*pCur) ); if( pCur==0 ) return SQLITE_NOMEM; memset(pCur, 0, sizeof(*pCur)); *ppCursor = &pCur->base; return SQLITE_OK; } /* ** Destructor for a deltaparsevtab_cursor. */ static int deltaparsevtabClose(sqlite3_vtab_cursor *cur){ deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur; sqlite3_free(pCur->aDelta); sqlite3_free(pCur); return SQLITE_OK; } /* ** Advance a deltaparsevtab_cursor to its next row of output. */ static int deltaparsevtabNext(sqlite3_vtab_cursor *cur){ deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur; const char *z; int i = 0; pCur->iCursor = pCur->iNext; z = pCur->aDelta + pCur->iCursor; pCur->a1 = deltaGetInt(&z, &i); switch( z[0] ){ case '@': { z++; pCur->a2 = deltaGetInt(&z, &i); pCur->eOp = DELTAPARSE_OP_COPY; pCur->iNext = (int)(&z[1] - pCur->aDelta); break; } case ':': { z++; pCur->a2 = (unsigned int)(z - pCur->aDelta); pCur->eOp = DELTAPARSE_OP_INSERT; pCur->iNext = (int)(&z[pCur->a1] - pCur->aDelta); break; } case ';': { pCur->eOp = DELTAPARSE_OP_CHECKSUM; pCur->iNext = pCur->nDelta; break; } default: { if( pCur->iNext==pCur->nDelta ){ pCur->eOp = DELTAPARSE_OP_EOF; }else{ pCur->eOp = DELTAPARSE_OP_ERROR; pCur->iNext = pCur->nDelta; } break; } } return SQLITE_OK; } /* ** Return values of columns for the row at which the deltaparsevtab_cursor ** is currently pointing. */ static int deltaparsevtabColumn( sqlite3_vtab_cursor *cur, /* The cursor */ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ int i /* Which column to return */ ){ deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur; switch( i ){ case DELTAPARSEVTAB_OP: { sqlite3_result_text(ctx, azOp[pCur->eOp], -1, SQLITE_STATIC); break; } case DELTAPARSEVTAB_A1: { sqlite3_result_int(ctx, pCur->a1); break; } case DELTAPARSEVTAB_A2: { if( pCur->eOp==DELTAPARSE_OP_COPY ){ sqlite3_result_int(ctx, pCur->a2); }else if( pCur->eOp==DELTAPARSE_OP_INSERT ){ sqlite3_result_blob(ctx, pCur->aDelta+pCur->a2, pCur->a1, SQLITE_TRANSIENT); } break; } case DELTAPARSEVTAB_DELTA: { sqlite3_result_blob(ctx, pCur->aDelta, pCur->nDelta, SQLITE_TRANSIENT); break; } } return SQLITE_OK; } /* ** Return the rowid for the current row. In this implementation, the ** rowid is the same as the output value. */ static int deltaparsevtabRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur; *pRowid = pCur->iCursor; return SQLITE_OK; } /* ** Return TRUE if the cursor has been moved off of the last ** row of output. */ static int deltaparsevtabEof(sqlite3_vtab_cursor *cur){ deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor*)cur; return pCur->eOp==DELTAPARSE_OP_EOF; } /* ** This method is called to "rewind" the deltaparsevtab_cursor object back ** to the first row of output. This method is always called at least ** once prior to any call to deltaparsevtabColumn() or deltaparsevtabRowid() or ** deltaparsevtabEof(). */ static int deltaparsevtabFilter( sqlite3_vtab_cursor *pVtabCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ deltaparsevtab_cursor *pCur = (deltaparsevtab_cursor *)pVtabCursor; const char *a; int i = 0; pCur->eOp = DELTAPARSE_OP_ERROR; if( idxNum!=1 ){ return SQLITE_OK; } pCur->nDelta = sqlite3_value_bytes(argv[0]); a = (const char*)sqlite3_value_blob(argv[0]); if( pCur->nDelta==0 || a==0 ){ return SQLITE_OK; } pCur->aDelta = sqlite3_malloc64( pCur->nDelta+1 ); if( pCur->aDelta==0 ){ pCur->nDelta = 0; return SQLITE_NOMEM; } memcpy(pCur->aDelta, a, pCur->nDelta); pCur->aDelta[pCur->nDelta] = 0; a = pCur->aDelta; pCur->eOp = DELTAPARSE_OP_SIZE; pCur->a1 = deltaGetInt(&a, &i); if( a[0]!='\n' ){ pCur->eOp = DELTAPARSE_OP_ERROR; pCur->a1 = pCur->a2 = 0; pCur->iNext = pCur->nDelta; return SQLITE_OK; } a++; pCur->iNext = (unsigned int)(a - pCur->aDelta); return SQLITE_OK; } /* ** SQLite will invoke this method one or more times while planning a query ** that uses the virtual table. This routine needs to create ** a query plan for each invocation and compute an estimated cost for that ** plan. */ static int deltaparsevtabBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ int i; for(i=0; i<pIdxInfo->nConstraint; i++){ if( pIdxInfo->aConstraint[i].iColumn != DELTAPARSEVTAB_DELTA ) continue; if( pIdxInfo->aConstraint[i].usable==0 ) continue; if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; pIdxInfo->aConstraintUsage[i].argvIndex = 1; pIdxInfo->aConstraintUsage[i].omit = 1; pIdxInfo->estimatedCost = (double)1; pIdxInfo->estimatedRows = 10; pIdxInfo->idxNum = 1; return SQLITE_OK; } pIdxInfo->idxNum = 0; pIdxInfo->estimatedCost = (double)0x7fffffff; pIdxInfo->estimatedRows = 0x7fffffff; return SQLITE_CONSTRAINT; } /* ** This following structure defines all the methods for the ** virtual table. */ static sqlite3_module deltaparsevtabModule = { /* iVersion */ 0, /* xCreate */ 0, /* xConnect */ deltaparsevtabConnect, /* xBestIndex */ deltaparsevtabBestIndex, /* xDisconnect */ deltaparsevtabDisconnect, /* xDestroy */ 0, /* xOpen */ deltaparsevtabOpen, /* xClose */ deltaparsevtabClose, /* xFilter */ deltaparsevtabFilter, /* xNext */ deltaparsevtabNext, /* xEof */ deltaparsevtabEof, /* xColumn */ deltaparsevtabColumn, /* xRowid */ deltaparsevtabRowid, /* xUpdate */ 0, /* xBegin */ 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ 0 }; /* ** Invoke this routine to register the various delta functions. */ int deltafunc_init(sqlite3 *db){ int rc = SQLITE_OK; rc = sqlite3_create_function(db, "delta_create", 2, SQLITE_UTF8, 0, deltaCreateFunc, 0, 0); if( rc==SQLITE_OK ){ rc = sqlite3_create_function(db, "delta_apply", 2, SQLITE_UTF8, 0, deltaApplyFunc, 0, 0); } if( rc==SQLITE_OK ){ rc = sqlite3_create_function(db, "delta_output_size", 1, SQLITE_UTF8, 0, deltaOutputSizeFunc, 0, 0); } if( rc==SQLITE_OK ){ rc = sqlite3_create_module(db, "delta_parse", &deltaparsevtabModule, 0); } return rc; } |
Changes to src/descendants.c.
︙ | ︙ | |||
181 182 183 184 185 186 187 188 189 190 191 192 193 194 | " ORDER BY mtime DESC LIMIT %d" " )" "INSERT INTO ok" " SELECT rid FROM ancestor;", rid, rid, directOnly ? "AND plink.isPrim" : "", N ); } /* ** Compute all direct ancestors (merge ancestors do not count) ** for the check-in rid and put them in a table named "ancestor". ** Label each generation with consecutive integers going backwards ** in time such that rid has the smallest generation number and the oldest ** direct ancestor as the largest generation number. | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | " ORDER BY mtime DESC LIMIT %d" " )" "INSERT INTO ok" " SELECT rid FROM ancestor;", rid, rid, directOnly ? "AND plink.isPrim" : "", N ); } /* ** Compute the youngest ancestor of record ID rid that is a member of ** branch zBranch. */ int compute_youngest_ancestor_in_branch(int rid, const char *zBranch){ return db_int(0, "WITH RECURSIVE " " ancestor(rid, mtime) AS (" " SELECT %d, mtime FROM event WHERE objid=%d " " UNION " " SELECT plink.pid, event.mtime" " FROM ancestor, plink, event" " WHERE plink.cid=ancestor.rid" " AND event.objid=plink.pid" " ORDER BY mtime DESC" " )" " SELECT ancestor.rid FROM ancestor" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagxref.rid=ancestor.rid" " AND value=%Q AND tagtype>0)" " LIMIT 1", rid, rid, TAG_BRANCH, zBranch ); } /* ** Compute all direct ancestors (merge ancestors do not count) ** for the check-in rid and put them in a table named "ancestor". ** Label each generation with consecutive integers going backwards ** in time such that rid has the smallest generation number and the oldest ** direct ancestor as the largest generation number. |
︙ | ︙ | |||
431 432 433 434 435 436 437 | zLastBr = fossil_strdup(zBr); if( multipleFlag ) n = 0; } n++; sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n); fossil_print("%6s ", zLineNo); z = mprintf("%s [%S] %s", zDate, zId, zCom); | | > > > > > > > > > > > > | > > > > > | | | > > > | 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 | zLastBr = fossil_strdup(zBr); if( multipleFlag ) n = 0; } n++; sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n); fossil_print("%6s ", zLineNo); z = mprintf("%s [%S] %s", zDate, zId, zCom); comment_print(z, zCom, 7, width, get_comment_format()); fossil_free(z); } fossil_free(zLastBr); db_finalize(&q); } /* ** WEBPAGE: leaves ** ** Show leaf check-ins in a timeline. By default only open leaves ** are listed. ** ** A "leaf" is a check-in with no children in the same branch. A ** "closed leaf" is a leaf that has a "closed" tag. An "open leaf" ** is a leaf without a "closed" tag. ** ** Query parameters: ** ** all Show all leaves ** closed Show only closed leaves ** ng No graph ** nohidden Hide check-ins with "hidden" tag ** onlyhidden Show only check-ins with "hidden" tag ** brbg Background color by branch name ** ubg Background color by user name */ void leaves_page(void){ Blob sql; Stmt q; int showAll = P("all")!=0; int showClosed = P("closed")!=0; int fNg = PB("ng")!=0; /* Flag for the "ng" query parameter */ int fNoHidden = PB("nohidden")!=0; /* "nohidden" query parameter */ int fOnlyHidden = PB("onlyhidden")!=0; /* "onlyhidden" query parameter */ int fBrBg = PB("brbg")!=0; /* Flag for the "brbg" query parameter */ int fUBg = PB("ubg")!=0; /* Flag for the "ubg" query parameter */ HQuery url; /* URL to /leaves plus query parameters */ int tmFlags; /* Timeline display flags */ login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } url_initialize(&url, "leaves"); if( fNg ) url_add_parameter(&url, "ng", ""); if( fNoHidden ) url_add_parameter(&url, "nohidden", ""); if( fOnlyHidden ) url_add_parameter(&url, "onlyhidden", ""); if( fBrBg ) url_add_parameter(&url, "brbg", ""); if( fUBg ) url_add_parameter(&url, "ubg", ""); if( !showAll ){ style_submenu_element("All", "%s", url_render(&url, "all", "", 0, 0)); } if( !showClosed ){ style_submenu_element("Closed", "%s", url_render(&url, "closed", "", 0, 0)); } if( showClosed || showAll ){ style_submenu_element("Open", "%s", url_render(&url, 0, 0, 0, 0)); } url_reset(&url); style_header("Leaves"); login_anonymous_available(); timeline_ss_submenu(); cookie_render(); #if 0 style_sidebox_begin("Nomenclature:", "33%"); @ <ol> @ <li> A <div class="sideboxDescribed">leaf</div> @ is a check-in with no descendants in the same branch.</li> @ <li> An <div class="sideboxDescribed">open leaf</div> @ is a leaf that does not have a "closed" tag |
︙ | ︙ | |||
503 504 505 506 507 508 509 510 511 | blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND blob.rid IN leaf"); if( showClosed ){ blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid")); }else if( !showAll ){ blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); } db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql)); blob_reset(&sql); | > > > > > > > > > > > > > | | 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 | blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND blob.rid IN leaf"); if( showClosed ){ blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid")); }else if( !showAll ){ blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); } if( fNoHidden || fOnlyHidden ){ const char* zUnaryOp = fNoHidden ? "NOT" : ""; blob_append_sql(&sql, " AND %s EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", zUnaryOp/*safe-for-%s*/, TAG_HIDDEN); } db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql)); blob_reset(&sql); /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too ** many descenders to (off-screen) parents. */ tmFlags = TIMELINE_LEAFONLY | TIMELINE_DISJOINT | TIMELINE_NOSCROLL; if( fNg==0 ) tmFlags |= TIMELINE_GRAPH; if( fBrBg ) tmFlags |= TIMELINE_BRCOLOR; if( fUBg ) tmFlags |= TIMELINE_UCOLOR; www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0); db_finalize(&q); @ <br /> style_footer(); } #if INTERFACE /* Flag parameters to compute_uses_file() */ |
︙ | ︙ |
Changes to src/diff.c.
︙ | ︙ | |||
438 439 440 441 442 443 444 | if( html ) blob_appendf(pOut, "<span class=\"diffln\">"); /* * If the patch changes an empty file or results in an empty file, * the block header must use 0,0 as position indicator and not 1,0. * Otherwise, patch would be confused and may reject the diff. */ blob_appendf(pOut,"@@ -%d,%d +%d,%d @@", | | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | if( html ) blob_appendf(pOut, "<span class=\"diffln\">"); /* * If the patch changes an empty file or results in an empty file, * the block header must use 0,0 as position indicator and not 1,0. * Otherwise, patch would be confused and may reject the diff. */ blob_appendf(pOut,"@@ -%d,%d +%d,%d @@", na ? a+skip+1 : a+skip, na, nb ? b+skip+1 : b+skip, nb); if( html ) blob_appendf(pOut, "</span>"); blob_append(pOut, "\n", 1); } /* Show the initial common area */ a += skip; b += skip; |
︙ | ︙ |
Changes to src/diffcmd.c.
︙ | ︙ | |||
211 212 213 214 215 216 217 | } blob_reset(&out); } /* Release memory resources */ blob_reset(&file2); }else{ | < | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | } blob_reset(&out); } /* Release memory resources */ blob_reset(&file2); }else{ Blob nameFile1; /* Name of temporary file to old pFile1 content */ Blob cmd; /* Text of command to run */ if( !fIncludeBinary ){ Blob file2; if( isBin1 ){ fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY); |
︙ | ︙ | |||
244 245 246 247 248 249 250 | return; } blob_reset(&file2); } /* Construct a temporary file to hold pFile1 based on the name of ** zFile2 */ | | < < < < | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | return; } blob_reset(&file2); } /* Construct a temporary file to hold pFile1 based on the name of ** zFile2 */ file_tempname(&nameFile1, zFile2, "orig"); blob_write_to_file(pFile1, blob_str(&nameFile1)); /* Construct the external diff command */ blob_zero(&cmd); blob_append(&cmd, zDiffCmd, -1); if( fSwapDiff ){ blob_append_escaped_arg(&cmd, zFile2); |
︙ | ︙ | |||
315 316 317 318 319 320 321 | /* Release memory resources */ blob_reset(&out); }else{ Blob cmd; Blob temp1; Blob temp2; | < < < < < < < < | | < < | 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 | /* Release memory resources */ blob_reset(&out); }else{ Blob cmd; Blob temp1; Blob temp2; if( !fIncludeBinary ){ if( isBin1 || isBin2 ){ fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY); return; } if( zBinGlob ){ Glob *pBinary = glob_create(zBinGlob); if( glob_match(pBinary, zName) ){ fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY); glob_free(pBinary); return; } glob_free(pBinary); } } /* Construct a temporary file names */ file_tempname(&temp1, zName, "before"); file_tempname(&temp2, zName, "after"); blob_write_to_file(pFile1, blob_str(&temp1)); blob_write_to_file(pFile2, blob_str(&temp2)); /* Construct the external diff command */ blob_zero(&cmd); blob_append(&cmd, zDiffCmd, -1); blob_append_escaped_arg(&cmd, blob_str(&temp1)); blob_append_escaped_arg(&cmd, blob_str(&temp2)); /* Run the external diff command */ fossil_system(blob_str(&cmd)); /* Delete the temporary file and clean up memory used */ file_delete(blob_str(&temp1)); file_delete(blob_str(&temp2)); blob_reset(&temp1); blob_reset(&temp2); blob_reset(&cmd); } } /* |
︙ | ︙ | |||
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 | ** (3) Delete the temp file. */ void diff_tk(const char *zSubCmd, int firstArg){ int i; Blob script; const char *zTempFile = 0; char *zCmd; blob_zero(&script); blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", g.nameOfExe, zSubCmd); find_option("html",0,0); find_option("side-by-side","y",0); find_option("internal","i",0); find_option("verbose","v",0); /* The undocumented --script FILENAME option causes the Tk script to ** be written into the FILENAME instead of being run. This is used ** for testing and debugging. */ zTempFile = find_option("script",0,1); for(i=firstArg; i<g.argc; i++){ const char *z = g.argv[i]; if( sqlite3_strglob("*}*",z) ){ blob_appendf(&script, " {%/}", z); }else{ int j; blob_append(&script, " ", 1); for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]); } } blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); if( zTempFile ){ blob_write_to_file(&script, zTempFile); | > > > > > | | | 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 | ** (3) Delete the temp file. */ void diff_tk(const char *zSubCmd, int firstArg){ int i; Blob script; const char *zTempFile = 0; char *zCmd; const char *zTclsh; blob_zero(&script); blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", g.nameOfExe, zSubCmd); find_option("html",0,0); find_option("side-by-side","y",0); find_option("internal","i",0); find_option("verbose","v",0); zTclsh = find_option("tclsh",0,1); if( zTclsh==0 ){ zTclsh = db_get("tclsh",0); } /* The undocumented --script FILENAME option causes the Tk script to ** be written into the FILENAME instead of being run. This is used ** for testing and debugging. */ zTempFile = find_option("script",0,1); for(i=firstArg; i<g.argc; i++){ const char *z = g.argv[i]; if( sqlite3_strglob("*}*",z) ){ blob_appendf(&script, " {%/}", z); }else{ int j; blob_append(&script, " ", 1); for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]); } } blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); if( zTempFile ){ blob_write_to_file(&script, zTempFile); fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); }else{ #if defined(FOSSIL_ENABLE_TCL) Th_FossilInit(TH_INIT_DEFAULT); if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script), blob_size(&script), 1, 1, 0)==TCL_OK ){ blob_reset(&script); return; } /* * If evaluation of the Tcl script fails, the reason may be that Tk * could not be found by the loaded Tcl, or that Tcl cannot be loaded * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback * to using the external "tclsh", if available. */ #endif zTempFile = write_blob_to_temp_file(&script); zCmd = mprintf("\"%s\" \"%s\"", zTclsh, zTempFile); fossil_system(zCmd); file_delete(zTempFile); fossil_free(zCmd); } blob_reset(&script); } |
︙ | ︙ | |||
838 839 840 841 842 843 844 845 846 847 848 849 850 851 | ** --exec-rel-paths Force relative path names with external commands. ** --from|-r VERSION Select VERSION as source for the diff ** --internal|-i Use internal diff logic ** --new-file|-N Show complete text of added and deleted files ** --numstat Show only the number of lines delete and added ** --side-by-side|-y Side-by-side diff ** --strip-trailing-cr Strip trailing CR ** --tk Launch a Tcl/Tk GUI for display ** --to VERSION Select VERSION as target for the diff ** --undo Diff against the "undo" buffer ** --unified Unified diff ** -v|--verbose Output complete text of added or deleted files ** -w|--ignore-all-space Ignore white space when comparing lines ** -W|--width <num> Width of lines in side-by-side diff | > | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | ** --exec-rel-paths Force relative path names with external commands. ** --from|-r VERSION Select VERSION as source for the diff ** --internal|-i Use internal diff logic ** --new-file|-N Show complete text of added and deleted files ** --numstat Show only the number of lines delete and added ** --side-by-side|-y Side-by-side diff ** --strip-trailing-cr Strip trailing CR ** --tclsh PATH Tcl/Tk used for --tk (default: "tclsh") ** --tk Launch a Tcl/Tk GUI for display ** --to VERSION Select VERSION as target for the diff ** --undo Diff against the "undo" buffer ** --unified Unified diff ** -v|--verbose Output complete text of added or deleted files ** -w|--ignore-all-space Ignore white space when comparing lines ** -W|--width <num> Width of lines in side-by-side diff |
︙ | ︙ | |||
862 863 864 865 866 867 868 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ const char *zBinGlob = 0; /* Treat file names matching this as binary */ int fIncludeBinary = 0; /* Include binary files for external diff */ int againstUndo = 0; /* Diff against files in the undo buffer */ u64 diffFlags = 0; /* Flags to control the DIFF */ FileDirList *pFileDir = 0; /* Restrict the diff to these files */ | | | 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */ const char *zBinGlob = 0; /* Treat file names matching this as binary */ int fIncludeBinary = 0; /* Include binary files for external diff */ int againstUndo = 0; /* Diff against files in the undo buffer */ u64 diffFlags = 0; /* Flags to control the DIFF */ FileDirList *pFileDir = 0; /* Restrict the diff to these files */ if( find_option("tk",0,0)!=0 || has_option("tclsh") ){ diff_tk("diff", 2); return; } isGDiff = g.argv[1][0]=='g'; isInternDiff = find_option("internal","i",0)!=0; zFrom = find_option("from", "r", 1); zTo = find_option("to", 0, 1); |
︙ | ︙ |
Changes to src/dispatch.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #define CMDFLAG_TEST 0x0004 /* Commands for testing only */ #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */ #define CMDFLAG_COMMAND 0x0010 /* A command */ #define CMDFLAG_SETTING 0x0020 /* A setting */ #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */ #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */ #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ /**************************************************************************/ /* Values for the 2nd parameter to dispatch_name_search() */ #define CMDFLAG_ANY 0x0038 /* Match anything */ #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */ #endif /* INTERFACE */ | > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #define CMDFLAG_TEST 0x0004 /* Commands for testing only */ #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */ #define CMDFLAG_COMMAND 0x0010 /* A command */ #define CMDFLAG_SETTING 0x0020 /* A setting */ #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */ #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */ #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */ /**************************************************************************/ /* Values for the 2nd parameter to dispatch_name_search() */ #define CMDFLAG_ANY 0x0038 /* Match anything */ #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */ #endif /* INTERFACE */ |
︙ | ︙ | |||
193 194 195 196 197 198 199 200 201 202 203 204 205 206 | zName = ""; }else{ if( *z ){ *z++ = 0; } zValue = ""; } if( fossil_islower(zName[0]) ){ cgi_replace_query_parameter(zName, zValue); } } return 0; } /* ** Fill Blob with a space-separated list of all command names that | > > | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | zName = ""; }else{ if( *z ){ *z++ = 0; } zValue = ""; } if( fossil_islower(zName[0]) ){ cgi_replace_query_parameter(zName, zValue); }else if( fossil_isupper(zName[0]) ){ cgi_replace_query_parameter_tolower(zName, zValue); } } return 0; } /* ** Fill Blob with a space-separated list of all command names that |
︙ | ︙ | |||
263 264 265 266 267 268 269 | int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER; int useHtml = find_option("html","h",0)!=0; if( find_option("www","w",0) ){ mask = CMDFLAG_WEBPAGE; } if( find_option("everything","e",0) ){ | | > | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER; int useHtml = find_option("html","h",0)!=0; if( find_option("www","w",0) ){ mask = CMDFLAG_WEBPAGE; } if( find_option("everything","e",0) ){ mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | CMDFLAG_SETTING | CMDFLAG_TEST; } if( find_option("settings","s",0) ){ mask = CMDFLAG_SETTING; } if( find_option("test","t",0) ){ mask |= CMDFLAG_TEST; } |
︙ | ︙ | |||
363 364 365 366 367 368 369 | const char *z = aCommand[i].zName; const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :""; const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":""; if( '/'==*z || strncmp(z,"test",4)==0 ) continue; if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue; @ <li><a href="%R/help?cmd=%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a></li> } | | | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | const char *z = aCommand[i].zName; const char *zBoldOn = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"<b>" :""; const char *zBoldOff = aCommand[i].eCmdFlags&CMDFLAG_1ST_TIER?"</b>":""; if( '/'==*z || strncmp(z,"test",4)==0 ) continue; if( (aCommand[i].eCmdFlags & CMDFLAG_SETTING)!=0 ) continue; @ <li><a href="%R/help?cmd=%s(z)">%s(zBoldOn)%s(z)%s(zBoldOff)</a></li> } @ </ul></div> @ <a name='webpages'></a> @ <h1>Available web UI pages:</h1> @ <div class="columns" style="column-width: 18ex;"> @ <ul> for(i=0; i<MX_COMMAND; i++){ const char *z = aCommand[i].zName; |
︙ | ︙ | |||
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 | const char *z = aCommand[i].zName; if( (aCommand[i].eCmdFlags & cmdMask)==0 ) continue; if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue; aCmd[nCmd++] = aCommand[i].zName; } multi_column_list(aCmd, nCmd); } /* ** COMMAND: help ** ** Usage: %fossil help TOPIC ** or: %fossil TOPIC --help ** ** Display information on how to use TOPIC, which may be a command, webpage, or ** setting. Webpage names begin with "/". To display a list of available ** topics, use one of: ** ** %fossil help Show common commands ** %fossil help -a|--all Show both common and auxiliary commands ** %fossil help -s|--setting Show setting names ** %fossil help -t|--test Show test commands only ** %fossil help -x|--aux Show auxiliary commands only ** %fossil help -w|--www Show list of webpages */ void help_cmd(void){ int rc; int isPage = 0; const char *z; const char *zCmdOrPage; const char *zCmdOrPagePlural; const CmdOrPage *pCmd = 0; if( g.argc<3 ){ z = g.argv[0]; fossil_print( "Usage: %s help TOPIC\n" | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > | 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 | const char *z = aCommand[i].zName; if( (aCommand[i].eCmdFlags & cmdMask)==0 ) continue; if( zPrefix && memcmp(zPrefix, z, nPrefix)!=0 ) continue; aCmd[nCmd++] = aCommand[i].zName; } multi_column_list(aCmd, nCmd); } /* ** Documentation on universal command-line options. */ /* @-comment: # */ static const char zOptions[] = @ Command-line options common to all commands: @ @ --args FILENAME Read additional arguments and options from FILENAME @ --cgitrace Active CGI tracing @ --comfmtflags VALUE Set comment formatting flags to VALUE @ --comment-format VALUE Alias for --comfmtflags @ --errorlog FILENAME Log errors to FILENAME @ --help Show help on the command rather than running it @ --httptrace Trace outbound HTTP requests @ --localtime Display times using the local timezone @ --no-th-hook Do not run TH1 hooks @ --quiet Reduce the amount of output @ --sqlstats Show SQL usage statistics when done @ --sqltrace Trace all SQL commands @ --sshtrace Trace SSH activity @ --ssl-identity NAME Set the SSL identity to NAME @ --systemtrace Trace calls to system() @ --user|-U USER Make the default user be USER @ --utc Display times using UTC @ --vfs NAME Cause SQLite to use the NAME VFS ; /* ** COMMAND: help ** ** Usage: %fossil help TOPIC ** or: %fossil TOPIC --help ** ** Display information on how to use TOPIC, which may be a command, webpage, or ** setting. Webpage names begin with "/". To display a list of available ** topics, use one of: ** ** %fossil help Show common commands ** %fossil help -a|--all Show both common and auxiliary commands ** %fossil help -o|--options Show command-line options common to all cmds ** %fossil help -s|--setting Show setting names ** %fossil help -t|--test Show test commands only ** %fossil help -x|--aux Show auxiliary commands only ** %fossil help -w|--www Show list of webpages */ void help_cmd(void){ int rc; int isPage = 0; const char *z; const char *zCmdOrPage; const char *zCmdOrPagePlural; const CmdOrPage *pCmd = 0; if( g.argc<3 ){ z = g.argv[0]; fossil_print( "Usage: %s help TOPIC\n" "Common commands: (use \"%s help help\" for more options)\n", z, z); command_list(0, CMDFLAG_1ST_TIER); version_cmd(); return; } if( find_option("options","o",0) ){ fossil_print("%s", zOptions); return; } if( find_option("all","a",0) ){ command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER); return; } else if( find_option("www","w",0) ){ command_list(0, CMDFLAG_WEBPAGE); |
︙ | ︙ |
Changes to src/doc.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 | int n; const unsigned char *x; /* A table of mimetypes based on file content prefixes */ static const struct { const char *zPrefix; /* The file prefix */ | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | int n; const unsigned char *x; /* A table of mimetypes based on file content prefixes */ static const struct { const char *zPrefix; /* The file prefix */ const int size; /* Length of the prefix */ const char *zMimetype; /* The corresponding mimetype */ } aMime[] = { { "GIF87a", 6, "image/gif" }, { "GIF89a", 6, "image/gif" }, { "\211PNG\r\n\032\n", 8, "image/png" }, { "\377\332\377", 3, "image/jpeg" }, { "\377\330\377", 3, "image/jpeg" }, |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 | { "vcd", 3, "application/x-cdlink" }, { "vda", 3, "application/vda" }, { "viv", 3, "video/vnd.vivo" }, { "vivo", 4, "video/vnd.vivo" }, { "vrml", 4, "model/vrml" }, { "wav", 3, "audio/x-wav" }, { "wax", 3, "audio/x-ms-wax" }, { "wiki", 4, "text/x-fossil-wiki" }, { "wma", 3, "audio/x-ms-wma" }, { "wmv", 3, "video/x-ms-wmv" }, { "wmx", 3, "video/x-ms-wmx" }, { "wrl", 3, "model/vrml" }, { "wvx", 3, "video/x-ms-wvx" }, { "xbm", 3, "image/x-xbitmap" }, | > | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | { "vcd", 3, "application/x-cdlink" }, { "vda", 3, "application/vda" }, { "viv", 3, "video/vnd.vivo" }, { "vivo", 4, "video/vnd.vivo" }, { "vrml", 4, "model/vrml" }, { "wav", 3, "audio/x-wav" }, { "wax", 3, "audio/x-ms-wax" }, { "webp", 4, "image/webp" }, { "wiki", 4, "text/x-fossil-wiki" }, { "wma", 3, "audio/x-ms-wma" }, { "wmv", 3, "video/x-ms-wmv" }, { "wmx", 3, "video/x-ms-wmx" }, { "wrl", 3, "model/vrml" }, { "wvx", 3, "video/x-ms-wvx" }, { "xbm", 3, "image/x-xbitmap" }, |
︙ | ︙ | |||
420 421 422 423 424 425 426 | int seenTitle = 0; while( fossil_isspace(zIn[0]) ) zIn++; if( fossil_strnicmp(zIn,"<div",4)!=0 ) return 0; zIn += 4; while( zIn[0] ){ if( fossil_isspace(zIn[0]) ) zIn++; | | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | int seenTitle = 0; while( fossil_isspace(zIn[0]) ) zIn++; if( fossil_strnicmp(zIn,"<div",4)!=0 ) return 0; zIn += 4; while( zIn[0] ){ if( fossil_isspace(zIn[0]) ) zIn++; if( zIn[0]=='>' ) break; zAttr = zIn; while( fossil_isalnum(zIn[0]) || zIn[0]=='-' ) zIn++; nAttr = (int)(zIn - zAttr); while( fossil_isspace(zIn[0]) ) zIn++; if( zIn[0]!='=' ) continue; zIn++; while( fossil_isspace(zIn[0]) ) zIn++; |
︙ | ︙ | |||
449 450 451 452 453 454 455 | } if( nAttr==5 && fossil_strnicmp(zAttr,"class",5)==0 ){ if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0; seenClass = 1; if( seenTitle ) return 1; } if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){ | > > > | > > > > | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | } if( nAttr==5 && fossil_strnicmp(zAttr,"class",5)==0 ){ if( nValue!=10 || fossil_strnicmp(zValue,"fossil-doc",10)!=0 ) return 0; seenClass = 1; if( seenTitle ) return 1; } if( nAttr==10 && fossil_strnicmp(zAttr,"data-title",10)==0 ){ /* The text argument to data-title="" will have had any characters that ** are special to HTML encoded. We need to decode these before turning ** the text into a title, as the title text will be reencoded later */ char *zTitle = mprintf("%.*s", nValue, zValue); int i; for(i=0; fossil_isspace(zTitle[i]); i++){} html_to_plaintext(zTitle+i, pTitle); fossil_free(zTitle); seenTitle = 1; if( seenClass ) return 1; } } return seenClass; } |
︙ | ︙ | |||
497 498 499 500 501 502 503 504 505 506 507 508 | rid = db_int(0, "SELECT rid FROM vcache" " WHERE vid=%d AND fname=%Q", vid, zName); if( rid && content_get(rid, pContent)==0 ){ rid = 0; } return rid; } /* ** Transfer content to the output. During the transfer, when text of ** the following form is seen: ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > | > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | rid = db_int(0, "SELECT rid FROM vcache" " WHERE vid=%d AND fname=%Q", vid, zName); if( rid && content_get(rid, pContent)==0 ){ rid = 0; } return rid; } /* ** Check to verify that z[i] is contained within HTML markup. ** ** This works by looking backwards in the string for the most recent ** '<' or '>' character. If a '<' is found first, then we assume that ** z[i] is within markup. If a '>' is seen or neither character is seen, ** then z[i] is not within markup. */ static int isWithinHtmlMarkup(const char *z, int i){ while( i>=0 && z[i]!='>' && z[i]!='<' ){ i--; } return z[i]=='<'; } /* ** Check to see if z[i] is contained within an href='...' of markup. */ static int isWithinHref(const char *z, int i){ while( i>5 && !fossil_isspace(z[i]) && z[i]!='\'' && z[i]!='"' && z[i]!='>' ){ i--; } if( i<=6 ) return 0; if( z[i]!='\'' && z[i]!='\"' ) return 0; if( strncmp(&z[i-5],"href=",5)!=0 ) return 0; if( !fossil_isspace(z[i-6]) ) return 0; return 1; } /* ** Transfer content to the output. During the transfer, when text of ** the following form is seen: ** ** href="$ROOT/..." ** action="$ROOT/..." ** href=".../doc/$SELF/..." ** ** Convert $ROOT to the root URI of the repository, and $SELF to the ** version number of the /doc/ document currently being displayed (if any). ** Allow ' in place of " and any case for href or action. ** ** Efforts are made to limit this translation to cases where the text is ** fully contained with an HTML markup element. */ void convert_href_and_output(Blob *pIn){ int i, base; int n = blob_size(pIn); char *z = blob_buffer(pIn); for(base=0, i=7; i<n; i++){ if( z[i]=='$' && strncmp(&z[i],"$ROOT/", 6)==0 && (z[i-1]=='\'' || z[i-1]=='"') && i-base>=9 && ((fossil_strnicmp(&z[i-6],"href=",5)==0 && fossil_isspace(z[i-7])) || (fossil_strnicmp(&z[i-8],"action=",7)==0 && fossil_isspace(z[i-9])) ) && isWithinHtmlMarkup(z, i-6) ){ blob_append(cgi_output_blob(), &z[base], i-base); blob_appendf(cgi_output_blob(), "%R"); base = i+5; }else if( z[i]=='$' && strncmp(&z[i-5],"/doc/$SELF/", 11)==0 && isWithinHref(z,i-5) && isWithinHtmlMarkup(z, i-5) && strncmp(g.zPath, "doc/",4)==0 ){ int j; for(j=4; g.zPath[j] && g.zPath[j]!='/'; j++){} blob_append(cgi_output_blob(), &z[base], i-base); blob_appendf(cgi_output_blob(), "%.*s", j-4, g.zPath+4); base = i+5; } } blob_append(cgi_output_blob(), &z[base], i-base); } /* ** Render a document as the reply to the HTTP request. The body ** of the document is contained in pBody. The body might be binary. ** The mimetype is in zMimetype. */ void document_render( Blob *pBody, /* Document content */ const char *zMime, /* MIME-type */ const char *zDefaultTitle, /* Default title */ const char *zFilename /* Name of the file being rendered */ ){ Blob title; blob_init(&title,0,0); if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ Blob tail; style_adunit_config(ADUNIT_RIGHT_OK); if( wiki_find_title(pBody, &title, &tail) ){ style_header("%s", blob_str(&title)); wiki_convert(&tail, 0, WIKI_BUTTONS); }else{ style_header("%s", zDefaultTitle); wiki_convert(pBody, 0, WIKI_BUTTONS); } style_footer(); }else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){ Blob tail = BLOB_INITIALIZER; markdown_to_html(pBody, &title, &tail); if( blob_size(&title)>0 ){ style_header("%s", blob_str(&title)); }else{ style_header("%s", zDefaultTitle); } convert_href_and_output(&tail); style_footer(); }else if( fossil_strcmp(zMime, "text/plain")==0 ){ style_header("%s", zDefaultTitle); @ <blockquote><pre> @ %h(blob_str(pBody)) @ </pre></blockquote> style_footer(); }else if( fossil_strcmp(zMime, "text/html")==0 && doc_is_embedded_html(pBody, &title) ){ if( blob_size(&title)==0 ) blob_append(&title,zFilename,-1); style_header("%s", blob_str(&title)); convert_href_and_output(pBody); style_footer(); #ifdef FOSSIL_ENABLE_TH1_DOCS }else if( Th_AreDocsEnabled() && fossil_strcmp(zMime, "application/x-th1")==0 ){ int raw = P("raw")!=0; if( !raw ){ Blob tail; blob_zero(&tail); if( wiki_find_title(pBody, &title, &tail) ){ style_header("%s", blob_str(&title)); Th_Render(blob_str(&tail)); blob_reset(&tail); }else{ style_header("%h", zFilename); Th_Render(blob_str(pBody)); } }else{ Th_Render(blob_str(pBody)); } if( !raw ){ style_footer(); } #endif }else{ cgi_set_content_type(zMime); cgi_set_content(pBody); } } /* ** WEBPAGE: uv ** WEBPAGE: doc ** URL: /uv/FILE ** URL: /doc/CHECKIN/FILE ** |
︙ | ︙ | |||
616 617 618 619 620 621 622 623 624 625 626 627 628 629 | zCheckin = mprintf("%.*s", i, zName); if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){ zCheckin = "tip"; } } if( nMiss==count(azSuffix) ){ zName = "404.md"; }else if( zName[i]==0 ){ assert( nMiss>=0 && nMiss<count(azSuffix) ); zName = azSuffix[nMiss]; }else if( !isUV ){ zName += i; } while( zName[0]=='/' ){ zName++; } | > | 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | zCheckin = mprintf("%.*s", i, zName); if( fossil_strcmp(zCheckin,"ckout")==0 && g.localOpen==0 ){ zCheckin = "tip"; } } if( nMiss==count(azSuffix) ){ zName = "404.md"; zDfltTitle = "Not Found"; }else if( zName[i]==0 ){ assert( nMiss>=0 && nMiss<count(azSuffix) ); zName = azSuffix[nMiss]; }else if( !isUV ){ zName += i; } while( zName[0]=='/' ){ zName++; } |
︙ | ︙ | |||
688 689 690 691 692 693 694 | Th_Store("doc_name", zName); if( vid ){ Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'" " FROM blob WHERE rid=%d", vid)); Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event" " WHERE objid=%d AND type='ci'", vid)); } | < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | Th_Store("doc_name", zName); if( vid ){ Th_Store("doc_version", db_text(0, "SELECT '[' || substr(uuid,1,10) || ']'" " FROM blob WHERE rid=%d", vid)); Th_Store("doc_date", db_text(0, "SELECT datetime(mtime) FROM event" " WHERE objid=%d AND type='ci'", vid)); } document_render(&filebody, zMime, zDfltTitle, zName); if( nMiss>=count(azSuffix) ) cgi_set_status(404, "Not Found"); db_end_transaction(0); return; /* Jump here when unable to locate the document */ doc_not_found: db_end_transaction(0); |
︙ | ︙ |
Changes to src/encode.c.
︙ | ︙ | |||
312 313 314 315 316 317 318 | } /* ** Decode a fossilized string in-place. */ void defossilize(char *z){ int i, j, c; | | | > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } /* ** Decode a fossilized string in-place. */ void defossilize(char *z){ int i, j, c; char *zSlash = strchr(z, '\\'); if( zSlash==0 ) return; i = zSlash - z; for(j=i; (c=z[i])!=0; i++){ if( c=='\\' && z[i+1] ){ i++; switch( z[i] ){ case 'n': c = '\n'; break; case 's': c = ' '; break; case 't': c = '\t'; break; |
︙ | ︙ | |||
374 375 376 377 378 379 380 | || (c&0xFFFFF800)==0xD800 || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } } return c; } /* | | > > | | < | > | 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 | || (c&0xFFFFF800)==0xD800 || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } } return c; } /* ** Encode a UTF8 string as a JSON string literal (without the surrounding ** "...") and return a pointer to the encoding. Space to hold the encoding ** is obtained from fossil_malloc() and must be freed by the caller. */ char *encode_json_string_literal(const char *zStr){ const unsigned char *z; char *zOut; u32 c; int n, i, j; z = (const unsigned char*)zStr; n = 0; while( (c = fossil_utf8_read(&z))!=0 ){ if( c=='\\' || c=='"' ){ n += 2; }else if( c<' ' || c>=0x7f ){ if( c=='\n' || c=='\r' ){ n += 2; }else{ n += 6; } }else{ n++; } } zOut = fossil_malloc(n+1); if( zOut==0 ) return 0; z = (const unsigned char*)zStr; i = 0; while( (c = fossil_utf8_read(&z))!=0 ){ if( c=='\\' ){ zOut[i++] = '\\'; zOut[i++] = c; }else if( c<' ' || c>=0x7f ){ zOut[i++] = '\\'; if( c=='\n' ){ |
︙ | ︙ | |||
423 424 425 426 427 428 429 430 431 432 433 434 435 436 | i += 4; } }else{ zOut[i++] = c; } } zOut[i] = 0; } /* ** The characters used for HTTP base64 encoding. */ static unsigned char zBase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | > | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | i += 4; } }else{ zOut[i++] = c; } } zOut[i] = 0; return zOut; } /* ** The characters used for HTTP base64 encoding. */ static unsigned char zBase[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
︙ | ︙ | |||
641 642 643 644 645 646 647 648 649 650 651 652 653 654 | /* ** Return true if the input string contains only valid base-16 digits. ** If any invalid characters appear in the string, return false. */ int validate16(const char *zIn, int nIn){ int i; if( nIn<0 ) nIn = (int)strlen(zIn); for(i=0; i<nIn; i++, zIn++){ if( zDecode[zIn[0]&0xff]>63 ){ return zIn[0]==0; } } return 1; } | > > > | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | /* ** Return true if the input string contains only valid base-16 digits. ** If any invalid characters appear in the string, return false. */ int validate16(const char *zIn, int nIn){ int i; if( nIn<0 ) nIn = (int)strlen(zIn); if( zIn[nIn]==0 ){ return strspn(zIn,"0123456789abcdefABCDEF")==nIn; } for(i=0; i<nIn; i++, zIn++){ if( zDecode[zIn[0]&0xff]>63 ){ return zIn[0]==0; } } return 1; } |
︙ | ︙ |
Changes to src/event.c.
︙ | ︙ | |||
355 356 357 358 359 360 361 362 363 364 365 366 367 368 | ** w=TEXT Complete text of the technote. ** t=TEXT Time of the technote on the timeline (ISO 8601) ** c=TEXT Timeline comment ** g=TEXT Tags associated with this technote ** mimetype=TEXT Mimetype for w= text ** newclr Use a background color ** clr=TEXT Background color to use if newclr */ void eventedit_page(void){ char *zTag; int rid = 0; Blob event; const char *zId; int n; | > > > > | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | ** w=TEXT Complete text of the technote. ** t=TEXT Time of the technote on the timeline (ISO 8601) ** c=TEXT Timeline comment ** g=TEXT Tags associated with this technote ** mimetype=TEXT Mimetype for w= text ** newclr Use a background color ** clr=TEXT Background color to use if newclr ** ** For GET requests, when editing an existing technote newclr and clr ** are implied if a custom color has been set on the previous version ** of the technote. */ void eventedit_page(void){ char *zTag; int rid = 0; Blob event; const char *zId; int n; |
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 | login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki)); return; } /* Figure out the color */ if( rid ){ zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid); }else{ zClr = ""; isNew = 1; } if( P("newclr") ){ zClr = PD("clr",zClr); if( zClr[0] ) zClrFlag = " checked"; | > > > > > > > > > | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | login_needed(g.anon.Write && (rid ? g.anon.WrWiki : g.anon.NewWiki)); return; } /* Figure out the color */ if( rid ){ zClr = db_text("", "SELECT bgcolor FROM event WHERE objid=%d", rid); if( zClr && zClr[0] ){ const char * zRequestMethod = P("REQUEST_METHOD"); if(zRequestMethod && 'G'==zRequestMethod[0]){ /* Apply saved color by defaut for GET requests ** (e.g., an Edit menu link). */ zClrFlag = " checked"; } } }else{ zClr = ""; isNew = 1; } if( P("newclr") ){ zClr = PD("clr",zClr); if( zClr[0] ) zClrFlag = " checked"; |
︙ | ︙ | |||
530 531 532 533 534 535 536 | @ </td></tr> @ <tr><th align="right" valign="top">Tags:</th> @ <td valign="top"> @ <input type="text" name="g" size="40" value="%h(zTags)" /> @ </td></tr> | | > | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | @ </td></tr> @ <tr><th align="right" valign="top">Tags:</th> @ <td valign="top"> @ <input type="text" name="g" size="40" value="%h(zTags)" /> @ </td></tr> @ <tr><th align="right" valign="top">\ @ %z(href("%R/markup_help"))Markup Style</a>:</th> @ <td valign="top"> mimetype_option_menu(zMimetype); @ </td></tr> @ <tr><th align="right" valign="top">Page Content:</th> @ <td valign="top"> @ <textarea name="w" class="technoteedit" cols="80" |
︙ | ︙ |
Changes to src/export.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | */ static struct { const char *zTrunkName; /* Name of trunk branch */ } gexport; #if INTERFACE /* | | < | < < < < < | | | | > > > > > > > | 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 | */ static struct { const char *zTrunkName; /* Name of trunk branch */ } gexport; #if INTERFACE /* ** Each line in a git-fast-export "marK" file is an instance of ** this object. */ struct mark_t { char *name; /* Name of the mark. Also starts with ":" */ int rid; /* Corresponding object in the BLOB table */ char uuid[65]; /* The GIT hash name for this object */ }; #endif #if defined(_WIN32) || defined(WIN32) # undef popen # define popen _popen # undef pclose # define pclose _pclose #endif /* ** Output a "committer" record for the given user. ** NOTE: the given user name may be an email itself. */ static void print_person(const char *zUser){ static Stmt q; |
︙ | ︙ | |||
167 168 169 170 171 172 173 | printf(" %s <%s>", zName, zEmail); free(zName); free(zEmail); db_reset(&q); } | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | printf(" %s <%s>", zName, zEmail); free(zName); free(zEmail); db_reset(&q); } #define REFREPLACEMENT '_' /* ** Output a sanitized git named reference. ** https://git-scm.com/docs/git-check-ref-format ** This implementation assumes we are only printing ** the branch or tag part of the reference. */ |
︙ | ︙ | |||
208 209 210 211 212 213 214 | case '^': case ':': case '?': case '*': case '[': case '\\': zEncoded[w]=REFREPLACEMENT; | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | case '^': case ':': case '?': case '*': case '[': case '\\': zEncoded[w]=REFREPLACEMENT; break; } } /* Cannot begin with a . or / */ if( zEncoded[0]=='.' || zEncoded[0] == '/' ) zEncoded[0]=REFREPLACEMENT; if( i>0 ){ i--; w--; /* Or end with a . or / */ |
︙ | ︙ | |||
295 296 297 298 299 300 301 | return NULL; } } return zMark; } /* | > | < < | | | | > | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | return NULL; } } return zMark; } /* ** Parse a single line of the mark file. Store the result in the mark object. ** ** "line" is a single line of input. ** This function returns -1 in the case that the line is blank, malformed, or ** the rid/uuid named in 'line' does not match what is in the repository ** database. Otherwise, 0 is returned. ** ** mark->name is dynamically allocated, and owned by the caller. */ int parse_mark(char *line, struct mark_t *mark){ char *cur_tok; char type_; cur_tok = strtok(line, " \t"); if( !cur_tok || strlen(cur_tok)<2 ){ return -1; |
︙ | ︙ | |||
359 360 361 362 363 364 365 | /* insert a cross-ref into the 'xmark' table */ insert_commit_xref(mark->rid, mark->name, mark->uuid); return 0; } /* | < | | | | | | > | | | > | | | | 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 | /* insert a cross-ref into the 'xmark' table */ insert_commit_xref(mark->rid, mark->name, mark->uuid); return 0; } /* ** Import the marks specified in file 'f'; ** If 'blobs' is non-null, insert all blob marks into it. ** If 'vers' is non-null, insert all commit marks into it. ** If 'unused_marks' is non-null, upon return of this function, all values ** x >= *unused_marks are free to use as marks, i.e. they do not clash with ** any marks appearing in the marks file. ** ** Each line in the file must be at most 100 characters in length. This ** seems like a reasonable maximum for a 40-character uuid, and 1-13 ** character rid. ** ** The function returns -1 if any of the lines in file 'f' are malformed, ** or the rid/uuid information doesn't match what is in the repository ** database. Otherwise, 0 is returned. */ int import_marks(FILE* f, Bag *blobs, Bag *vers, unsigned int *unused_mark){ char line[101]; while(fgets(line, sizeof(line), f)){ struct mark_t mark; if( strlen(line)==100 && line[99]!='\n' ){ /* line too long */ |
︙ | ︙ | |||
450 451 452 453 454 455 456 | do{ export_mark(f, rid, 'c'); }while( (rid = bag_next(vers, rid))!=0 ); } } } | | | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | do{ export_mark(f, rid, 'c'); }while( (rid = bag_next(vers, rid))!=0 ); } } } /* This is the original header command (and hence documentation) for ** the "fossil export" command: ** ** Usage: %fossil export --git ?OPTIONS? ?REPOSITORY? ** ** Write an export of all check-ins to standard output. The export is ** written in the git-fast-export file format assuming the --git option is ** provided. The git-fast-export format is currently the only VCS ** interchange format supported, though other formats may be added in ** the future. |
︙ | ︙ | |||
481 482 483 484 485 486 487 488 489 490 491 492 493 494 | ** --export-marks FILE export rids of exported data to FILE ** --import-marks FILE read rids of data to ignore from FILE ** --rename-trunk NAME use NAME as name of exported trunk branch ** --repository|-R REPOSITORY export the given REPOSITORY ** ** See also: import */ void export_cmd(void){ Stmt q, q2, q3; Bag blobs, vers; unsigned int unused_mark = 1; const char *markfile_in; const char *markfile_out; | > > > > > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | ** --export-marks FILE export rids of exported data to FILE ** --import-marks FILE read rids of data to ignore from FILE ** --rename-trunk NAME use NAME as name of exported trunk branch ** --repository|-R REPOSITORY export the given REPOSITORY ** ** See also: import */ /* ** COMMAND: export* ** ** This command is deprecated. Use "fossil git export" instead. */ void export_cmd(void){ Stmt q, q2, q3; Bag blobs, vers; unsigned int unused_mark = 1; const char *markfile_in; const char *markfile_out; |
︙ | ︙ | |||
505 506 507 508 509 510 511 | db_find_and_open_repository(0, 2); verify_all_options(); if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } db_multi_exec("CREATE TEMPORARY TABLE oldblob(rid INTEGER PRIMARY KEY)"); db_multi_exec("CREATE TEMPORARY TABLE oldcommit(rid INTEGER PRIMARY KEY)"); | | > | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | db_find_and_open_repository(0, 2); verify_all_options(); if( g.argc!=2 && g.argc!=3 ){ usage("--git ?REPOSITORY?"); } db_multi_exec("CREATE TEMPORARY TABLE oldblob(rid INTEGER PRIMARY KEY)"); db_multi_exec("CREATE TEMPORARY TABLE oldcommit(rid INTEGER PRIMARY KEY)"); db_multi_exec("CREATE TEMP TABLE xmark(tname TEXT UNIQUE, trid INT," " tuuid TEXT)"); db_multi_exec("CREATE INDEX xmark_trid ON xmark(trid)"); if( markfile_in!=0 ){ Stmt qb,qc; FILE *f; int rid; f = fossil_fopen(markfile_in, "r"); |
︙ | ︙ | |||
752 753 754 755 756 757 758 | ** tid INTEGER PRIMARY KEY, -- Check-in id ** tseq INT -- integer total order on check-ins. ** ); ** ** This table contains all check-ins of the repository in topological ** order. "Topological order" means that every parent check-in comes ** before all of its children. Topological order is *almost* the same | | | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | ** tid INTEGER PRIMARY KEY, -- Check-in id ** tseq INT -- integer total order on check-ins. ** ); ** ** This table contains all check-ins of the repository in topological ** order. "Topological order" means that every parent check-in comes ** before all of its children. Topological order is *almost* the same ** thing as "ORDER BY event.mtime". Differences only arise when there ** are timewarps. In as much as Git hates timewarps, we have to compute ** a correct topological order when doing an export. ** ** Since mtime is a usually already nearly in topological order, the ** algorithm is to start with mtime, then make adjustments as necessary ** for timewarps. This is not a great algorithm for the general case, ** but it is very fast for the overwhelmingly common case where there |
︙ | ︙ | |||
833 834 835 836 837 838 839 | */ void test_topological_sort(void){ int n; db_find_and_open_repository(0, 0); n = topological_sort_checkins(1); fossil_print("%d reorderings required\n", n); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 | */ void test_topological_sort(void){ int n; db_find_and_open_repository(0, 0); n = topological_sort_checkins(1); fossil_print("%d reorderings required\n", n); } /*************************************************************************** ** Implementation of the "fossil git" command follows. We hope that the ** new code that follows will largely replace the legacy "fossil export" ** and "fossil import" code above. */ /* Verbosity level. Higher means more output. ** ** 0 print nothing at all ** 1 Errors only ** 2 Progress information (This is the default) ** 3 Extra details */ #define VERB_ERROR 1 #define VERB_NORMAL 2 #define VERB_EXTRA 3 static int gitmirror_verbosity = VERB_NORMAL; /* ** Output routine that depends on verbosity */ static void gitmirror_message(int iLevel, const char *zFormat, ...){ va_list ap; if( iLevel>gitmirror_verbosity ) return; va_start(ap, zFormat); fossil_vprint(zFormat, ap); va_end(ap); } /* ** Convert characters of z[] that are not allowed to be in branch or ** tag names into "_". */ static void gitmirror_sanitize_name(char *z){ static unsigned char aSafe[] = { /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 2x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* 3x */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, /* 5x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6x */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, /* 7x */ }; unsigned char *zu = (unsigned char*)z; int i; for(i=0; zu[i]; i++){ if( zu[i]>0x7f || !aSafe[zu[i]] ){ zu[i] = '_'; }else if( zu[i]=='/' && (i==0 || zu[i+1]==0 || zu[i+1]=='/') ){ zu[i] = '_'; }else if( zu[i]=='.' && (zu[i+1]==0 || zu[i+1]=='.' || (i>0 && zu[i-1]=='.')) ){ zu[i] = '_'; } } } /* ** Quote a filename as a C-style string using \\ and \" if necessary. ** If quoting is not necessary, just return a copy of the input string. ** ** The return value is a held in memory obtained from fossil_malloc() ** and must be freed by the caller. */ static char *gitmirror_quote_filename_if_needed(const char *zIn){ int i, j; char c; int nSpecial = 0; char *zOut; for(i=0; (c = zIn[i])!=0; i++){ if( c=='\\' || c=='"' || c=='\n' ){ nSpecial++; } } if( nSpecial==0 ){ return fossil_strdup(zIn); } zOut = fossil_malloc( i+nSpecial+3 ); zOut[0] = '"'; for(i=0, j=1; (c = zIn[i])!=0; i++){ if( c=='\\' || c=='"' || c=='\n' ){ zOut[j++] = '\\'; if( c=='\n' ){ zOut[j++] = 'n'; }else{ zOut[j++] = c; } }else{ zOut[j++] = c; } } zOut[j++] = '"'; zOut[j] = 0; return zOut; } /* ** Find the Git-name corresponding to the Fossil-name zUuid. ** ** If the mark does not exist and if the bCreate flag is false, then ** return NULL. If the mark does not exist and the bCreate flag is true, ** then create the mark. ** ** The string returned is obtained from fossil_malloc() and should ** be freed by the caller. */ static char *gitmirror_find_mark(const char *zUuid, int isFile, int bCreate){ static Stmt sFind, sIns; db_static_prepare(&sFind, "SELECT coalesce(githash,printf(':%%d',id))" " FROM mirror.mmark WHERE uuid=:uuid AND isfile=:isfile" ); db_bind_text(&sFind, ":uuid", zUuid); db_bind_int(&sFind, ":isfile", isFile!=0); if( db_step(&sFind)==SQLITE_ROW ){ char *zMark = fossil_strdup(db_column_text(&sFind, 0)); db_reset(&sFind); return zMark; } db_reset(&sFind); if( !bCreate ){ return 0; } db_static_prepare(&sIns, "INSERT INTO mirror.mmark(uuid,isfile) VALUES(:uuid,:isfile)" ); db_bind_text(&sIns, ":uuid", zUuid); db_bind_int(&sIns, ":isfile", isFile!=0); db_step(&sIns); db_reset(&sIns); return mprintf(":%d", db_last_insert_rowid()); } /* This is the SHA3-256 hash of an empty file */ static const char zEmptySha3[] = "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a"; /* ** Export a single file named by zUuid. ** ** Return 0 on success and non-zero on any failure. ** ** If zUuid is a shunned file, then treat it as if it were any empty file. ** But files that are missing from the repository but have not been officially ** shunned cause an error return. Except, if bPhantomOk is true, then missing ** files are replaced by an empty file. */ static int gitmirror_send_file(FILE *xCmd, const char *zUuid, int bPhantomOk){ char *zMark; int rid; int rc; Blob data; rid = fast_uuid_to_rid(zUuid); if( rid<0 ){ if( bPhantomOk || uuid_is_shunned(zUuid) ){ gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); zUuid = zEmptySha3; }else{ return 1; } }else{ rc = content_get(rid, &data); if( rc==0 ){ if( bPhantomOk ){ blob_init(&data, 0, 0); gitmirror_message(VERB_EXTRA, "missing file: %s\n", zUuid); zUuid = zEmptySha3; }else{ return 1; } } } zMark = gitmirror_find_mark(zUuid, 1, 1); if( zMark[0]==':' ){ fprintf(xCmd, "blob\nmark %s\ndata %d\n", zMark, blob_size(&data)); fwrite(blob_buffer(&data), 1, blob_size(&data), xCmd); fprintf(xCmd, "\n"); } fossil_free(zMark); blob_reset(&data); return 0; } /* ** Transfer a check-in over to the mirror. "rid" is the BLOB.RID for ** the check-in to export. ** ** If any ancestor of the check-in has not yet been exported, then ** invoke this routine recursively to export the ancestor first. ** This can only happen on a timewarp, so deep nesting is unlikely. ** ** Before sending the check-in, first make sure all associated files ** have already been exported, and send "blob" records for any that ** have not been. Update the MIRROR.MMARK table so that it holds the ** marks for the exported files. ** ** Return zero on success and non-zero if the export should be stopped. */ static int gitmirror_send_checkin( FILE *xCmd, /* Write fast-import text on this pipe */ int rid, /* BLOB.RID for the check-in to export */ const char *zUuid, /* BLOB.UUID for the check-in to export */ int *pnLimit, /* Stop when the counter reaches zero */ int fManifest /* MFESTFLG_* values */ ){ Manifest *pMan; /* The check-in to be output */ int i; /* Loop counter */ int iParent; /* Which immediate ancestor is primary. -1 for none */ Stmt q; /* An SQL query */ char *zBranch; /* The branch of the check-in */ char *zMark; /* The Git-name of the check-in */ Blob sql; /* String of SQL for part of the query */ Blob comment; /* The comment text for the check-in */ int nErr = 0; /* Number of errors */ int bPhantomOk; /* True if phantom files should be ignored */ char buf[24]; pMan = manifest_get(rid, CFTYPE_MANIFEST, 0); if( pMan==0 ){ /* Must be a phantom. Return without doing anything, and in particular ** without creating a mark for this check-in. */ gitmirror_message(VERB_NORMAL, "missing check-in: %s\n", zUuid); return 0; } /* Check to see if any parent logins have not yet been processed, and ** if so, create them */ for(i=0; i<pMan->nParent; i++){ char *zPMark = gitmirror_find_mark(pMan->azParent[i], 0, 0); if( zPMark==0 ){ int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pMan->azParent[i]); int rc = gitmirror_send_checkin(xCmd, prid, pMan->azParent[i], pnLimit, fManifest); if( rc || *pnLimit<=0 ){ manifest_destroy(pMan); return 1; } } fossil_free(zPMark); } /* Ignore phantom files on check-ins that are over one year old */ bPhantomOk = db_int(0, "SELECT %.6f<julianday('now','-1 year')", pMan->rDate); /* Make sure all necessary files have been exported */ db_prepare(&q, "SELECT uuid FROM files_of_checkin(%Q)" " WHERE uuid NOT IN (SELECT uuid FROM mirror.mmark)", zUuid ); while( db_step(&q)==SQLITE_ROW ){ const char *zFUuid = db_column_text(&q, 0); int n = gitmirror_send_file(xCmd, zFUuid, bPhantomOk); nErr += n; if( n ) gitmirror_message(VERB_ERROR, "missing file: %s\n", zFUuid); } db_finalize(&q); /* If some required files could not be exported, abandon the check-in ** export */ if( nErr ){ gitmirror_message(VERB_ERROR, "export of %s abandoned due to missing files\n", zUuid); *pnLimit = 0; return 1; } /* Figure out which branch this check-in is a member of */ zBranch = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=%d", TAG_BRANCH, rid ); if( fossil_strcmp(zBranch,"trunk")==0 ){ fossil_free(zBranch); zBranch = mprintf("master"); }else if( zBranch==0 ){ zBranch = mprintf("unknown"); }else{ gitmirror_sanitize_name(zBranch); } /* Export the check-in */ fprintf(xCmd, "commit refs/heads/%s\n", zBranch); fossil_free(zBranch); zMark = gitmirror_find_mark(zUuid,0,1); fprintf(xCmd, "mark %s\n", zMark); fossil_free(zMark); sqlite3_snprintf(sizeof(buf), buf, "%lld", (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0) ); fprintf(xCmd, "committer %s <%s@noemail.net> %s +0000\n", pMan->zUser, pMan->zUser, buf ); blob_init(&comment, pMan->zComment, -1); if( blob_size(&comment)==0 ){ blob_append(&comment, "(no comment)", -1); } blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid); fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment)); blob_reset(&comment); iParent = -1; /* Which ancestor is the primary parent */ for(i=0; i<pMan->nParent; i++){ char *zOther = gitmirror_find_mark(pMan->azParent[i],0,0); if( zOther==0 ) continue; if( iParent<0 ){ iParent = i; fprintf(xCmd, "from %s\n", zOther); }else{ fprintf(xCmd, "merge %s\n", zOther); } fossil_free(zOther); } if( iParent>=0 ){ db_prepare(&q, "SELECT filename FROM files_of_checkin(%Q)" " EXCEPT SELECT filename FROM files_of_checkin(%Q)", pMan->azParent[iParent], zUuid ); while( db_step(&q)==SQLITE_ROW ){ fprintf(xCmd, "D %s\n", db_column_text(&q,0)); } db_finalize(&q); } blob_init(&sql, 0, 0); blob_append_sql(&sql, "SELECT filename, uuid, perm FROM files_of_checkin(%Q)", zUuid ); if( pMan->nParent ){ blob_append_sql(&sql, " EXCEPT SELECT filename, uuid, perm FROM files_of_checkin(%Q)", pMan->azParent[0]); } db_prepare(&q, "SELECT x.filename, x.perm," " coalesce(mmark.githash,printf(':%%d',mmark.id))" " FROM (%s) AS x, mirror.mmark" " WHERE mmark.uuid=x.uuid AND isfile", blob_sql_text(&sql) ); blob_reset(&sql); while( db_step(&q)==SQLITE_ROW ){ const char *zFilename = db_column_text(&q,0); const char *zMode = db_column_text(&q,1); const char *zMark = db_column_text(&q,2); const char *zGitMode = "100644"; char *zFNQuoted = 0; if( zMode ){ if( strchr(zMode,'x') ) zGitMode = "100755"; if( strchr(zMode,'l') ) zGitMode = "120000"; } zFNQuoted = gitmirror_quote_filename_if_needed(zFilename); fprintf(xCmd,"M %s %s %s\n", zGitMode, zMark, zFNQuoted); fossil_free(zFNQuoted); } db_finalize(&q); /* Include Fossil-generated auxiliary files in the check-in */ if( fManifest & MFESTFLG_RAW ){ Blob manifest; content_get(rid, &manifest); fprintf(xCmd,"M 100644 inline manifest\ndata %d\n%s\n", blob_size(&manifest), blob_str(&manifest)); blob_reset(&manifest); } if( fManifest & MFESTFLG_UUID ){ int n = (int)strlen(zUuid); fprintf(xCmd,"M 100644 inline manifest.uuid\ndata %d\n%s\n", n, zUuid); } if( fManifest & MFESTFLG_TAGS ){ Blob tagslist; blob_init(&tagslist, 0, 0); get_checkin_taglist(rid, &tagslist); fprintf(xCmd,"M 100644 inline manifest.tags\ndata %d\n%s\n", blob_size(&tagslist), blob_str(&tagslist)); blob_reset(&tagslist); } /* The check-in is finished, so decrement the counter */ (*pnLimit)--; return 0; } /* ** Implementation of the "fossil git export" command. */ void gitmirror_export_command(void){ const char *zLimit; /* Text of the --limit flag */ int nLimit = 0x7fffffff; /* Numeric value of the --limit flag */ int nTotal = 0; /* Total number of check-ins to export */ char *zMirror; /* Name of the mirror */ char *z; /* Generic string */ char *zCmd; /* git command to run as a subprocess */ const char *zDebug = 0; /* Value of the --debug flag */ const char *zAutoPush = 0; /* Value of the --autopush flag */ char *zPushUrl; /* URL to sync the mirror to */ double rEnd; /* time of most recent export */ int rc; /* Result code */ int bForce; /* Do the export and sync even if no changes*/ int bNeedRepack = 0; /* True if we should run repack at the end */ int fManifest; /* Current "manifest" setting */ FILE *xCmd; /* Pipe to the "git fast-import" command */ FILE *pMarks; /* Git mark files */ Stmt q; /* Queries */ char zLine[200]; /* One line of a mark file */ zDebug = find_option("debug",0,1); db_find_and_open_repository(0, 0); zLimit = find_option("limit", 0, 1); if( zLimit ){ nLimit = (unsigned int)atoi(zLimit); if( nLimit<=0 ) fossil_fatal("--limit must be positive"); } zAutoPush = find_option("autopush",0,1); bForce = find_option("force","f",0)!=0; gitmirror_verbosity = VERB_NORMAL; while( find_option("quiet","q",0)!=0 ){ gitmirror_verbosity--; } while( find_option("verbose","v",0)!=0 ){ gitmirror_verbosity++; } verify_all_options(); if( g.argc!=4 && g.argc!=3 ){ usage("export ?MIRROR?"); } if( g.argc==4 ){ Blob mirror; file_canonical_name(g.argv[3], &mirror, 0); db_set("last-git-export-repo", blob_str(&mirror), 0); blob_reset(&mirror); } zMirror = db_get("last-git-export-repo", 0); if( zMirror==0 ){ fossil_fatal("no Git repository specified"); } /* Make sure the GIT repository directory exists */ rc = file_mkdir(zMirror, ExtFILE, 0); if( rc ) fossil_fatal("cannot create directory \"%s\"", zMirror); /* Make sure GIT has been initialized */ z = mprintf("%s/.git", zMirror); if( !file_isdir(z, ExtFILE) ){ zCmd = mprintf("git init \"%s\"",zMirror); gitmirror_message(VERB_NORMAL, "%s\n", zCmd); rc = fossil_system(zCmd); if( rc ){ fossil_fatal("cannot initialize the git repository using: \"%s\"", zCmd); } fossil_free(zCmd); bNeedRepack = 1; } fossil_free(z); /* Make sure the .mirror_state subdirectory exists */ z = mprintf("%s/.mirror_state", zMirror); rc = file_mkdir(z, ExtFILE, 0); if( rc ) fossil_fatal("cannot create directory \"%s\"", z); fossil_free(z); /* Attach the .mirror_state/db database */ db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror); db_begin_write(); db_multi_exec( "CREATE TABLE IF NOT EXISTS mirror.mconfig(\n" " key TEXT PRIMARY KEY,\n" " Value ANY\n" ") WITHOUT ROWID;\n" "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" " id INTEGER PRIMARY KEY,\n" " uuid TEXT,\n" " isfile BOOLEAN,\n" " githash TEXT,\n" " UNIQUE(uuid,isfile)\n" ");" ); if( !db_table_has_column("mirror","mmark","isfile") ){ db_multi_exec( "ALTER TABLE mirror.mmark RENAME TO mmark_old;" "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" " id INTEGER PRIMARY KEY,\n" " uuid TEXT,\n" " isfile BOOLEAN,\n" " githash TEXT,\n" " UNIQUE(uuid,isfile)\n" ");" "INSERT OR IGNORE INTO mirror.mmark(id,uuid,githash,isfile)" " SELECT id,uuid,githash," " NOT EXISTS(SELECT 1 FROM repository.event, repository.blob" " WHERE event.objid=blob.rid" " AND blob.uuid=mmark_old.uuid)" " FROM mirror.mmark_old;\n" "DROP TABLE mirror.mmark_old;\n" ); } /* Change the autopush setting if the --autopush flag is present */ if( zAutoPush ){ if( is_false(zAutoPush) ){ db_multi_exec("DELETE FROM mirror.mconfig WHERE key='autopush'"); }else{ db_multi_exec( "REPLACE INTO mirror.mconfig(key,value)" "VALUES('autopush',%Q)", zAutoPush ); } } /* See if there is any work to be done. Exit early if not, before starting ** the "git fast-import" command. */ if( !bForce && !db_exists("SELECT 1 FROM event WHERE type IN ('ci','t')" " AND mtime>coalesce((SELECT value FROM mconfig" " WHERE key='start'),0.0)") ){ gitmirror_message(VERB_NORMAL, "no changes\n"); db_commit_transaction(); return; } /* Do we need to include manifest files in the clone? */ fManifest = db_get_manifest_setting(); /* Change to the MIRROR directory so that the Git commands will work */ rc = file_chdir(zMirror, 0); if( rc ) fossil_fatal("cannot change the working directory to \"%s\"", zMirror); /* Start up the git fast-import command */ if( zDebug ){ if( fossil_strcmp(zDebug,"stdout")==0 ){ xCmd = stdout; }else{ xCmd = fopen(zDebug, "wb"); if( xCmd==0 ) fossil_fatal("cannot open file \"%s\" for writing", zDebug); } }else{ zCmd = mprintf("git fast-import" " --export-marks=.mirror_state/marks.txt" " --quiet --done"); gitmirror_message(VERB_NORMAL, "%s\n", zCmd); xCmd = popen(zCmd, "w"); if( zCmd==0 ){ fossil_fatal("cannot start the \"git fast-import\" command"); } fossil_free(zCmd); } /* Run the export */ rEnd = 0.0; db_multi_exec( "CREATE TEMP TABLE tomirror(objid,mtime,uuid);\n" "INSERT INTO tomirror " "SELECT objid, mtime, blob.uuid FROM event, blob\n" " WHERE type='ci'" " AND mtime>coalesce((SELECT value FROM mconfig WHERE key='start'),0.0)" " AND blob.rid=event.objid" " AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark WHERE NOT isfile);" ); nTotal = db_int(0, "SELECT count(*) FROM tomirror"); if( nLimit<nTotal ){ nTotal = nLimit; }else if( nLimit>nTotal ){ nLimit = nTotal; } db_prepare(&q, "SELECT objid, mtime, uuid FROM tomirror ORDER BY mtime" ); while( nLimit && db_step(&q)==SQLITE_ROW ){ int rid = db_column_int(&q, 0); double rMTime = db_column_double(&q, 1); const char *zUuid = db_column_text(&q, 2); if( rMTime>rEnd ) rEnd = rMTime; rc = gitmirror_send_checkin(xCmd, rid, zUuid, &nLimit, fManifest); if( rc ) break; gitmirror_message(VERB_NORMAL,"%d/%d \r", nTotal-nLimit, nTotal); fflush(stdout); } db_finalize(&q); fprintf(xCmd, "done\n"); if( zDebug ){ if( xCmd!=stdout ) fclose(xCmd); }else{ pclose(xCmd); } gitmirror_message(VERB_NORMAL, "%d check-ins added to the %s\n", nTotal-nLimit, zMirror); /* Read the export-marks file. Transfer the new marks over into ** the import-marks file. */ pMarks = fopen(".mirror_state/marks.txt", "rb"); if( pMarks ){ db_prepare(&q, "UPDATE mirror.mmark SET githash=:githash WHERE id=:id"); while( fgets(zLine, sizeof(zLine), pMarks) ){ int j, k; if( zLine[0]!=':' ) continue; db_bind_int(&q, ":id", atoi(zLine+1)); for(j=1; zLine[j] && zLine[j]!=' '; j++){} if( zLine[j]!=' ' ) continue; j++; if( zLine[j]==0 ) continue; for(k=j; fossil_isalnum(zLine[k]); k++){} zLine[k] = 0; db_bind_text(&q, ":githash", &zLine[j]); db_step(&q); db_reset(&q); } db_finalize(&q); fclose(pMarks); file_delete(".mirror_state/marks.txt"); }else{ fossil_fatal("git fast-import didn't generate a marks file!"); } db_multi_exec( "CREATE INDEX IF NOT EXISTS mirror.mmarkx1 ON mmark(githash);" ); /* Do any tags that have been created since the start time */ db_prepare(&q, "SELECT substr(tagname,5), githash" " FROM (SELECT tagxref.tagid AS xtagid, tagname, rid, max(mtime) AS mtime" " FROM tagxref JOIN tag ON tag.tagid=tagxref.tagid" " WHERE tag.tagname GLOB 'sym-*'" " AND tagxref.tagtype=1" " AND tagxref.mtime > coalesce((SELECT value FROM mconfig" " WHERE key='start'),0.0)" " GROUP BY tagxref.tagid) AS tx" " JOIN blob ON tx.rid=blob.rid" " JOIN mmark ON mmark.uuid=blob.uuid;" ); while( db_step(&q)==SQLITE_ROW ){ char *zTagname = fossil_strdup(db_column_text(&q,0)); const char *zObj = db_column_text(&q,1); char *zTagCmd; gitmirror_sanitize_name(zTagname); zTagCmd = mprintf("git tag -f \"%s\" %s", zTagname, zObj); fossil_free(zTagname); gitmirror_message(VERB_NORMAL, "%s\n", zTagCmd); fossil_system(zTagCmd); fossil_free(zTagCmd); } db_finalize(&q); /* Update all references that might have changed since the start time */ db_prepare(&q, "SELECT" " tagxref.value AS name," " max(event.mtime) AS mtime," " mmark.githash AS gitckin" " FROM tagxref, tag, event, blob, mmark" " WHERE tagxref.tagid=tag.tagid" " AND tagxref.tagtype>0" " AND tag.tagname='branch'" " AND event.objid=tagxref.rid" " AND event.mtime > coalesce((SELECT value FROM mconfig" " WHERE key='start'),0.0)" " AND blob.rid=tagxref.rid" " AND mmark.uuid=blob.uuid" " GROUP BY 1" ); while( db_step(&q)==SQLITE_ROW ){ char *zBrname = fossil_strdup(db_column_text(&q,0)); const char *zObj = db_column_text(&q,2); char *zRefCmd; if( fossil_strcmp(zBrname,"trunk")==0 ){ fossil_free(zBrname); zBrname = fossil_strdup("master"); }else{ gitmirror_sanitize_name(zBrname); } zRefCmd = mprintf("git update-ref \"refs/heads/%s\" %s", zBrname, zObj); fossil_free(zBrname); gitmirror_message(VERB_NORMAL, "%s\n", zRefCmd); fossil_system(zRefCmd); fossil_free(zRefCmd); } db_finalize(&q); /* Update the start time */ if( rEnd>0.0 ){ db_prepare(&q, "REPLACE INTO mirror.mconfig(key,value) VALUES('start',:x)"); db_bind_double(&q, ":x", rEnd); db_step(&q); db_finalize(&q); } db_commit_transaction(); /* Maybe run a git repack */ if( bNeedRepack ){ const char *zRepack = "git repack -adf"; gitmirror_message(VERB_NORMAL, "%s\n", zRepack); fossil_system(zRepack); } /* Optionally do a "git push" */ zPushUrl = db_text(0, "SELECT value FROM mconfig WHERE key='autopush'"); if( zPushUrl ){ char *zPushCmd; UrlData url; if( sqlite3_strglob("http*", zPushUrl)==0 ){ url_parse_local(zPushUrl, 0, &url); zPushCmd = mprintf("git push --mirror %s", url.canonical); }else{ zPushCmd = mprintf("git push --mirror %s", zPushUrl); } gitmirror_message(VERB_NORMAL, "%s\n", zPushCmd); fossil_free(zPushCmd); zPushCmd = mprintf("git push --mirror %s", zPushUrl); fossil_system(zPushCmd); fossil_free(zPushCmd); } } /* ** Implementation of the "fossil git status" command. ** ** Show the status of a "git export". */ void gitmirror_status_command(void){ char *zMirror; char *z; int n, k; db_find_and_open_repository(0, 0); verify_all_options(); zMirror = db_get("last-git-export-repo", 0); if( zMirror==0 ){ fossil_print("Git mirror: none\n"); return; } fossil_print("Git mirror: %s\n", zMirror); db_multi_exec("ATTACH '%q/.mirror_state/db' AS mirror;", zMirror); z = db_text(0, "SELECT datetime(value) FROM mconfig WHERE key='start'"); if( z ){ double rAge = db_double(0.0, "SELECT julianday('now') - value" " FROM mconfig WHERE key='start'"); if( rAge>1.0/86400.0 ){ fossil_print("Last export: %s (%z ago)\n", z, human_readable_age(rAge)); }else{ fossil_print("Last export: %s (moments ago)\n", z); } } z = db_text(0, "SELECT value FROM mconfig WHERE key='autopush'"); if( z==0 ){ fossil_print("Autopush: off\n"); }else{ UrlData url; url_parse_local(z, 0, &url); fossil_print("Autopush: %s\n", url.canonical); } n = db_int(0, "SELECT count(*) FROM event" " WHERE type='ci'" " AND mtime>coalesce((SELECT value FROM mconfig" " WHERE key='start'),0.0)" ); if( n==0 ){ fossil_print("Status: up-to-date\n"); }else{ fossil_print("Status: %d check-in%s awaiting export\n", n, n==1 ? "" : "s"); } n = db_int(0, "SELECT count(*) FROM mmark WHERE isfile"); k = db_int(0, "SELECT count(*) FROm mmark WHERE NOT isfile"); fossil_print("Exported: %d check-ins and %d file blobs\n", k, n); } /* ** COMMAND: git ** ** Usage: %fossil git SUBCOMMAND ** ** Do incremental import or export operations between Fossil and Git. ** Subcommands: ** ** fossil git export [MIRROR] [OPTIONS] ** ** Write content from the Fossil repository into the Git repository ** in directory MIRROR. The Git repository is created if it does not ** already exist. If the Git repository does already exist, then ** new content added to fossil since the previous export is appended. ** ** Repeat this command whenever new checkins are added to the Fossil ** repository in order to reflect those changes into the mirror. If ** the MIRROR option is omitted, the repository from the previous ** invocation is used. ** ** The MIRROR directory will contain a subdirectory named ** ".mirror_state" that contains information that Fossil needs to ** do incremental exports. Do not attempt to manage or edit the files ** in that directory since doing so can disrupt future incremental ** exports. ** ** Options: ** --autopush URL Automatically do a 'git push' to URL. The ** URL is remembered and used on subsequent exports ** to the same repository. Or if URL is "off" the ** auto-push mechanism is disabled ** --debug FILE Write fast-export text to FILE rather than ** piping it into "git fast-import". ** --force|-f Do the export even if nothing has changed ** --limit N Add no more than N new check-ins to MIRROR. ** Useful for debugging ** --quiet|-q Reduce output. Repeat for even less output. ** --verbose|-v More output. ** ** fossil git import MIRROR ** ** TBD... ** ** fossil git status ** ** Show the status of the current Git mirror, if there is one. */ void gitmirror_command(void){ char *zCmd; int nCmd; if( g.argc<3 ){ usage("export ARGS..."); } zCmd = g.argv[2]; nCmd = (int)strlen(zCmd); if( nCmd>2 && strncmp(zCmd,"export",nCmd)==0 ){ gitmirror_export_command(); }else if( nCmd>2 && strncmp(zCmd,"import",nCmd)==0 ){ fossil_fatal("not yet implemented - check back later"); }else if( nCmd>2 && strncmp(zCmd,"status",nCmd)==0 ){ gitmirror_status_command(); }else { fossil_fatal("unknown subcommand \"%s\": should be one of " "\"export\", \"import\", \"status\"", zCmd); } } |
Added src/extcgi.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* ** Copyright (c) 2019 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@sqlite.org ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code to invoke CGI-based extensions to the ** Fossil server via the /ext webpage. ** ** The /ext webpage acts like a recursive webserver, relaying the ** HTTP request to some other component - usually another CGI. ** ** Before doing the relay, /ext examines the login cookie to see ** if the HTTP request is coming from a validated user, and if so ** /ext sets some additional environment variables that the extension ** CGI script can use. In this way, the extension CGI scripts use the ** same login system as the main repository, and appear to be ** an integrated part of the repository. */ #include "config.h" #include "extcgi.h" #include <assert.h> #if defined(_WIN32) || defined(WIN32) # undef popen # define popen _popen # undef pclose # define pclose _pclose #endif /* ** These are the environment variables that should be set for CGI ** extension programs: */ static const char *azCgiEnv[] = { "AUTH_TYPE", "AUTH_CONTENT", "CONTENT_LENGTH", "CONTENT_TYPE", "DOCUMENT_ROOT", "FOSSIL_CAPABILITIES", "FOSSIL_NONCE", "FOSSIL_REPOSITORY", "FOSSIL_URI", "FOSSIL_USER", "GATEWAY_INTERFACE", "HTTPS", "HTTP_ACCEPT", /* "HTTP_ACCEPT_ENCODING", // omitted from sub-cgi */ "HTTP_COOKIE", "HTTP_HOST", "HTTP_IF_MODIFIED_SINCE", "HTTP_IF_NONE_MATCH", "HTTP_REFERER", "HTTP_USER_AGENT", "PATH_INFO", "QUERY_STRING", "REMOTE_ADDR", "REMOTE_USER", "REQUEST_METHOD", "REQUEST_URI", "SCRIPT_DIRECTORY", "SCRIPT_FILENAME", "SCRIPT_NAME", "SERVER_NAME", "SERVER_PORT", "SERVER_PROTOCOL", }; /* ** Check a pathname to determine if it is acceptable for use as ** extension CGI. Some pathnames are excluded for security reasons. ** Return NULL on success or a static error string if there is ** a failure. */ const char *ext_pathname_ok(const char *zName){ int i; const char *zFailReason = 0; for(i=0; zName[i]; i++){ char c = zName[i]; if( (c=='.' || c=='-') && (i==0 || zName[i-1]=='/') ){ zFailReason = "path element begins with '.' or '-'"; break; } if( !fossil_isalnum(c) && c!='_' && c!='-' && c!='.' && c!='/' ){ zFailReason = "illegal character in path"; break; } } return zFailReason; } /* ** The *pzPath input is a pathname obtained from mprintf(). ** ** If ** ** (1) zPathname is the name of a directory, and ** (2) the name ends with "/", and ** (3) the directory contains a file named index.html, index.wiki, ** or index.md (in that order) ** ** then replace the input with a revised name that includes the index.* ** file and return non-zero (true). If any condition is not met, return ** zero and leave the input pathname unchanged. */ static int isDirWithIndexFile(char **pzPath){ static const char *azIndexNames[] = { "index.html", "index.wiki", "index.md" }; int i; if( file_isdir(*pzPath, ExtFILE)!=1 ) return 0; if( sqlite3_strglob("*/", *pzPath)!=0 ) return 0; for(i=0; i<sizeof(azIndexNames)/sizeof(azIndexNames[0]); i++){ char *zNew = mprintf("%s%s", *pzPath, azIndexNames[i]); if( file_isfile(zNew, ExtFILE) ){ fossil_free(*pzPath); *pzPath = zNew; return 1; } fossil_free(zNew); } return 0; } /* ** WEBPAGE: ext raw-content ** ** Relay an HTTP request to secondary CGI after first checking the ** login credentials and setting auxiliary environment variables ** so that the secondary CGI can be aware of the credentials and ** capabilities of the Fossil user. ** ** The /ext page is only functional if the "extroot: DIR" setting is ** found in the CGI script that launched Fossil, or if the "--extroot DIR" ** flag is present when Fossil is lauched using the "server", "ui", or ** "http" commands. DIR must be an absolute pathname (relative to the ** chroot jail) of the root of the file hierarchy that implements the CGI ** functionality. Executable files are CGI. Non-executable files are ** static content. ** ** The path after the /ext is the path to the CGI script or static file ** relative to DIR. For security, this path may not contain characters ** other than ASCII letters or digits, ".", "-", "/", and "_". If the ** "." or "-" characters are present in the path then they may not follow ** a "/". ** ** If the path after /ext ends with "/" and is the name of a directory then ** that directory is searched for files named "index.html", "index.wiki", ** and "index.md" (in that order) and if found, those filenames are ** appended to the path. */ void ext_page(void){ const char *zName = P("name"); /* Path information after /ext */ char *zPath = 0; /* Complete path from extroot */ int nRoot; /* Number of bytes in the extroot name */ char *zScript = 0; /* Name of the CGI script */ int nScript = 0; /* Bytes in the CGI script name */ const char *zFailReason = "???";/* Reason for failure */ int i; /* Loop counter */ const char *zMime = 0; /* MIME type of the reply */ int fdFromChild = -1; /* File descriptor for reading from child */ FILE *toChild = 0; /* FILE for sending to child */ FILE *fromChild = 0; /* FILE for reading from child */ int pidChild = 0; /* Process id of the child */ int rc; /* Reply code from subroutine call */ int nContent = -1; /* Content length */ const char *zPathInfo; /* Original PATH_INFO value */ Blob reply; /* The reply */ char zLine[1000]; /* One line of the CGI reply */ zPathInfo = P("PATH_INFO"); login_check_credentials(); blob_init(&reply, 0, 0); if( g.zExtRoot==0 ){ zFailReason = "extroot is not set"; goto ext_not_found; } if( file_is_absolute_path(g.zExtRoot)==0 ){ zFailReason = "extroot is a relative pathname"; goto ext_not_found; } if( zName==0 ){ zFailReason = "no path beyond /ext"; goto ext_not_found; } zFailReason = ext_pathname_ok(zName); if( zFailReason ) goto ext_not_found; zFailReason = "???"; if( file_isdir(g.zExtRoot,ExtFILE)!=1 ){ zFailReason = "extroot is not a directory"; goto ext_not_found; } zPath = mprintf("%s/%s", g.zExtRoot, zName); nRoot = (int)strlen(g.zExtRoot); if( file_isfile(zPath, ExtFILE) || isDirWithIndexFile(&zPath) ){ nScript = (int)strlen(zPath); zScript = zPath; }else{ for(i=nRoot+1; zPath[i]; i++){ char c = zPath[i]; if( c=='/' ){ int isDir, isFile; zPath[i] = 0; isDir = file_isdir(zPath, ExtFILE); isFile = isDir==2 ? file_isfile(zPath, ExtFILE) : 0; zPath[i] = c; if( isDir==0 ){ zFailReason = "path does not match any file or script"; goto ext_not_found; } if( isFile!=0 ){ zScript = mprintf("%.*s", i, zPath); nScript = i; break; } } } } if( nScript==0 ){ zFailReason = "path does not match any file or script"; goto ext_not_found; } assert( nScript>=nRoot+1 ); style_set_current_page("ext/%s", &zScript[nRoot+1]); zMime = mimetype_from_name(zScript); if( zMime==0 ) zMime = "application/octet-stream"; if( !file_isexe(zScript, ExtFILE) ){ /* File is not executable. Must be a regular file. In that case, ** disallow extra path elements */ if( zPath[nScript]!=0 ){ zFailReason = "extra path elements after filename"; goto ext_not_found; } blob_read_from_file(&reply, zScript, ExtFILE); document_render(&reply, zMime, zName, zName); return; } /* If we reach this point, that means we are dealing with an executable ** file name zScript. Run that file as CGI. */ cgi_replace_parameter("DOCUMENT_ROOT", g.zExtRoot); cgi_replace_parameter("SCRIPT_FILENAME", zScript); cgi_replace_parameter("SCRIPT_NAME", mprintf("%T/ext/%T",g.zTop,zScript+nRoot+1)); cgi_replace_parameter("SCRIPT_DIRECTORY", file_dirname(zScript)); cgi_replace_parameter("PATH_INFO", zName + strlen(zScript+nRoot+1)); if( g.zLogin ){ cgi_replace_parameter("REMOTE_USER", g.zLogin); cgi_set_parameter_nocopy("FOSSIL_USER", g.zLogin, 0); } cgi_set_parameter_nocopy("FOSSIL_NONCE", style_nonce(), 0); cgi_set_parameter_nocopy("FOSSIL_REPOSITORY", g.zRepositoryName, 0); cgi_set_parameter_nocopy("FOSSIL_URI", g.zTop, 0); cgi_set_parameter_nocopy("FOSSIL_CAPABILITIES", db_text("","SELECT fullcap(cap) FROM user WHERE login=%Q", g.zLogin ? g.zLogin : "nobody"), 0); cgi_replace_parameter("GATEWAY_INTERFACE","CGI/1.0"); for(i=0; i<sizeof(azCgiEnv)/sizeof(azCgiEnv[0]); i++){ (void)P(azCgiEnv[i]); } fossil_clearenv(); for(i=0; i<sizeof(azCgiEnv)/sizeof(azCgiEnv[0]); i++){ const char *zVal = P(azCgiEnv[i]); if( zVal ) fossil_setenv(azCgiEnv[i], zVal); } fossil_setenv("HTTP_ACCEPT_ENCODING",""); rc = popen2(zScript, &fdFromChild, &toChild, &pidChild, 1); if( rc ){ zFailReason = "cannot exec CGI child process"; goto ext_not_found; } fromChild = fdopen(fdFromChild, "rb"); if( fromChild==0 ){ zFailReason = "cannot open FILE to read from CGI child process"; goto ext_not_found; } if( blob_size(&g.cgiIn)>0 ){ size_t nSent, toSend; unsigned char *data = (unsigned char*)blob_buffer(&g.cgiIn); toSend = (size_t)blob_size(&g.cgiIn); do{ nSent = fwrite(data, 1, toSend, toChild); if( nSent<=0 ){ zFailReason = "unable to send all content to the CGI child process"; goto ext_not_found; } toSend -= nSent; data += nSent; }while( toSend>0 ); fflush(toChild); } if( g.perm.Debug && P("fossil-ext-debug")!=0 ){ /* For users with Debug privilege, if the "fossil-ext-debug" query ** parameter exists, then show raw output from the CGI */ zMime = "text/plain"; }else{ while( fgets(zLine,sizeof(zLine),fromChild) ){ for(i=0; zLine[i] && zLine[i]!='\r' && zLine[i]!='\n'; i++){} zLine[i] = 0; if( i==0 ) break; if( fossil_strnicmp(zLine,"Location:",9)==0 ){ fclose(fromChild); fclose(toChild); cgi_redirect(&zLine[10]); /* no return */ }else if( fossil_strnicmp(zLine,"Status:",7)==0 ){ int j; for(i=7; fossil_isspace(zLine[i]); i++){} for(j=i; fossil_isdigit(zLine[j]); j++){} while( fossil_isspace(zLine[j]) ){ j++; } cgi_set_status(atoi(&zLine[i]), &zLine[j]); }else if( fossil_strnicmp(zLine,"Content-Length:",15)==0 ){ nContent = atoi(&zLine[15]); }else if( fossil_strnicmp(zLine,"Content-Type:",13)==0 ){ int j; for(i=13; fossil_isspace(zLine[i]); i++){} for(j=i; zLine[j] && zLine[j]!=';'; j++){} zMime = mprintf("%.*s", j-i, &zLine[i]); } } } blob_read_from_channel(&reply, fromChild, nContent); zFailReason = 0; /* Indicate success */ ext_not_found: fossil_free(zPath); if( fromChild ){ fclose(fromChild); }else if( fdFromChild>2 ){ close(fdFromChild); } if( toChild ) fclose(toChild); if( zFailReason==0 ){ document_render(&reply, zMime, zName, zName); }else{ cgi_set_status(404, "Not Found"); @ <h1>Not Found</h1> @ <p>Page not found: %h(zPathInfo)</p> if( g.perm.Debug ){ @ <p>Reason for failure: %h(zFailReason)</p> } } return; } /* ** Create a temporary SFILE table and fill it with one entry for each file ** in the extension document root directory (g.zExtRoot). The SFILE table ** looks like this: ** ** CREATE TEMP TABLE sfile( ** pathname TEXT PRIMARY KEY, ** isexe BOOLEAN ** ) WITHOUT ROWID; */ void ext_files(void){ Blob base; db_multi_exec( "CREATE TEMP TABLE sfile(\n" " pathname TEXT PRIMARY KEY,\n" " isexe BOOLEAN\n" ") WITHOUT ROWID;" ); blob_init(&base, g.zExtRoot, -1); vfile_scan(&base, blob_size(&base), SCAN_ALL|SCAN_ISEXE, 0, 0, ExtFILE); blob_zero(&base); } /* ** WEBPAGE: extfilelist ** ** List all files in the extension CGI document root and its subfolders. */ void ext_filelist_page(void){ Stmt q; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } ext_files(); style_header("CGI Extension Filelist"); @ <table border="0" cellspacing="0" cellpadding="3"> @ <tbody> db_prepare(&q, "SELECT pathname, isexe FROM sfile" " ORDER BY pathname"); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q,0); int isExe = db_column_int(&q,1); @ <tr> if( ext_pathname_ok(zName)!=0 ){ @ <td><span style="opacity:0.5;">%h(zName)</span></td> @ <td>data file</td> }else{ @ <td><a href="%R/ext/%h(zName)">%h(zName)</a></td> if( isExe ){ @ <td>CGI</td> }else{ @ <td>static content</td> } } @ </tr> } db_finalize(&q); @ </tbody> @ </table> style_footer(); } |
Changes to src/file.c.
︙ | ︙ | |||
435 436 437 438 439 440 441 442 443 444 445 446 447 448 | const char *zTail = file_tail(z); if( zTail && zTail!=z ){ return mprintf("%.*s", (int)(zTail-z-1), z); }else{ return 0; } } /* ** Rename a file or directory. ** Returns zero upon success. */ int file_rename( const char *zFrom, | > > > > > > > > > > > > > > > > > > > | 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 | const char *zTail = file_tail(z); if( zTail && zTail!=z ){ return mprintf("%.*s", (int)(zTail-z-1), z); }else{ return 0; } } /* SQL Function: file_dirname(NAME) ** ** Return the directory for NAME */ void file_dirname_sql_function( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zName = (const char*)sqlite3_value_text(argv[0]); char *zDir; if( zName==0 ) return; zDir = file_dirname(zName); if( zDir ){ sqlite3_result_text(context,zDir,-1,fossil_free); } } /* ** Rename a file or directory. ** Returns zero upon success. */ int file_rename( const char *zFrom, |
︙ | ︙ | |||
592 593 594 595 596 597 598 599 600 601 602 603 604 605 | #else char *z = fossil_utf8_to_path(zFilename, 0); rc = unlink(zFilename); #endif fossil_path_free(z); return rc; } /* ** Create a directory called zName, if it does not already exist. ** If forceFlag is 1, delete any prior non-directory object ** with the same name. ** ** Return the number of errors. | > > > > > > > > > > > > > > > > > > > > | 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 | #else char *z = fossil_utf8_to_path(zFilename, 0); rc = unlink(zFilename); #endif fossil_path_free(z); return rc; } /* SQL Function: file_delete(NAME) ** ** Remove file NAME. Return zero on success and non-zero if anything goes ** wrong. */ void file_delete_sql_function( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zName = (const char*)sqlite3_value_text(argv[0]); int rc; if( zName==0 ){ rc = 1; }else{ rc = file_delete(zName); } sqlite3_result_int(context, rc); } /* ** Create a directory called zName, if it does not already exist. ** If forceFlag is 1, delete any prior non-directory object ** with the same name. ** ** Return the number of errors. |
︙ | ︙ | |||
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | } } } free(zName); return rc; } /* ** Removes the directory named in the argument, if it exists. The directory ** must be empty and cannot be the current directory or the root directory. ** ** Returns zero upon success. */ int file_rmdir(const char *zName){ int rc = file_isdir(zName, RepoFILE); if( rc==2 ) return 1; /* cannot remove normal file */ if( rc==1 ){ #if defined(_WIN32) wchar_t *zMbcs = fossil_utf8_to_path(zName, 1); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | 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 | } } } free(zName); return rc; } #if defined(_WIN32) /* ** Returns non-zero if the specified name represents a real directory, i.e. ** not a junction or symbolic link. This is important for some operations, ** e.g. removing directories via _wrmdir(), because its detection of empty ** directories will (apparently) not work right for junctions and symbolic ** links, etc. */ int file_is_normal_dir(wchar_t *zName){ /* ** Mask off attributes, applicable to directories, that are harmless for ** our purposes. This may need to be updated if other attributes should ** be ignored by this function. */ DWORD dwAttributes = GetFileAttributesW(zName); if( dwAttributes==INVALID_FILE_ATTRIBUTES ) return 0; dwAttributes &= ~( FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_COMPRESSED | FILE_ATTRIBUTE_ENCRYPTED | FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED ); return dwAttributes==FILE_ATTRIBUTE_DIRECTORY; } /* ** COMMAND: test-is-normal-dir ** ** Usage: %fossil test-is-normal-dir NAME... ** ** Returns non-zero if the specified names represent real directories, i.e. ** not junctions, symbolic links, etc. */ void test_is_normal_dir(void){ int i; for(i=2; i<g.argc; i++){ wchar_t *zMbcs = fossil_utf8_to_path(g.argv[i], 1); fossil_print("ATTRS \"%s\" -> %lx\n", g.argv[i], GetFileAttributesW(zMbcs)); fossil_print("ISDIR \"%s\" -> %d\n", g.argv[i], file_is_normal_dir(zMbcs)); fossil_path_free(zMbcs); } } #endif /* ** Removes the directory named in the argument, if it exists. The directory ** must be empty and cannot be the current directory or the root directory. ** ** Returns zero upon success. */ int file_rmdir(const char *zName){ int rc = file_isdir(zName, RepoFILE); if( rc==2 ) return 1; /* cannot remove normal file */ if( rc==1 ){ #if defined(_WIN32) wchar_t *zMbcs = fossil_utf8_to_path(zName, 1); if( file_is_normal_dir(zMbcs) ){ rc = _wrmdir(zMbcs); }else{ rc = ENOTDIR; /* junction, symbolic link, etc. */ } #else char *zMbcs = fossil_utf8_to_path(zName, 1); rc = rmdir(zName); #endif fossil_path_free(zMbcs); return rc; } return 0; } /* SQL Function: rmdir(NAME) ** ** Try to remove the directory NAME. Return zero on success and non-zero ** for failure. */ void file_rmdir_sql_function( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zName = (const char*)sqlite3_value_text(argv[0]); int rc; if( zName==0 ){ rc = 1; }else{ rc = file_rmdir(zName); } sqlite3_result_int(context, rc); } /* ** Return true if the filename given is a valid filename for ** a file in a repository. Valid filenames follow all of the ** following rules: ** ** * Does not begin with "/" |
︙ | ︙ | |||
767 768 769 770 771 772 773 774 775 776 777 778 779 780 | if( z[i+2]=='/' || z[i+2]==0 ) return 0; if( z[i+2]=='.' && (z[i+3]=='/' || z[i+3]==0) ) return 0; } } } if( z[i-1]=='/' ) return 0; return 1; } /* ** If the last component of the pathname in z[0]..z[j-1] is something ** other than ".." then back it out and return true. If the last ** component is empty or if it is ".." then return false. */ | > > > > > > > > > > > > > > > > > | 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 | if( z[i+2]=='/' || z[i+2]==0 ) return 0; if( z[i+2]=='.' && (z[i+3]=='/' || z[i+3]==0) ) return 0; } } } if( z[i-1]=='/' ) return 0; return 1; } int file_is_simple_pathname_nonstrict(const char *z){ unsigned char c = (unsigned char) z[0]; if( c=='/' || c==0 ) return 0; if( c=='.' ){ if( z[1]=='/' || z[1]==0 ) return 0; if( z[1]=='.' && (z[2]=='/' || z[2]==0) ) return 0; } while( (z = strchr(z+1, '/'))!=0 ){ if( z[1]=='/' ) return 0; if( z[1]==0 ) return 0; if( z[1]=='.' ){ if( z[2]=='/' || z[2]==0 ) return 0; if( z[2]=='.' && (z[3]=='/' || z[3]==0) ) return 0; } } return 1; } /* ** If the last component of the pathname in z[0]..z[j-1] is something ** other than ".." then back it out and return true. If the last ** component is empty or if it is ".." then return false. */ |
︙ | ︙ | |||
888 889 890 891 892 893 894 895 | /* ** Get the current working directory. ** ** On windows, the name is converted from unicode to UTF8 and all '\\' ** characters are converted to '/'. No conversions are needed on ** unix. */ | > > > | > > > > > > | 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 | /* ** Get the current working directory. ** ** On windows, the name is converted from unicode to UTF8 and all '\\' ** characters are converted to '/'. No conversions are needed on ** unix. ** ** Store the value of the CWD in zBuf which is nBuf bytes in size. ** or if zBuf==0, allocate space to hold the result using fossil_malloc(). */ char *file_getcwd(char *zBuf, int nBuf){ char zTemp[2000]; if( zBuf==0 ){ zBuf = zTemp; nBuf = sizeof(zTemp); } #ifdef _WIN32 win32_getcwd(zBuf, nBuf); #else if( getcwd(zBuf, nBuf-1)==0 ){ if( errno==ERANGE ){ fossil_panic("pwd too big: max %d", nBuf-1); }else{ fossil_panic("cannot find current working directory; %s", strerror(errno)); } } #endif return zBuf==zTemp ? fossil_strdup(zBuf) : zBuf; } /* ** Return true if zPath is an absolute pathname. Return false ** if it is relative. */ int file_is_absolute_path(const char *zPath){ |
︙ | ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | blob_set(pPath, &zUri[i]); }else{ blob_set(pPath, "/"); } } /* | | > > > > > > > | | 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 | blob_set(pPath, &zUri[i]); }else{ blob_set(pPath, "/"); } } /* ** Construct a random temporary filename into pBuf where the name of ** the temporary file is derived from zBasis. The suffix on the temp ** file is the same as the suffix on zBasis, and the temp file has ** the root of zBasis in its name. ** ** If zTag is not NULL, then try to create the temp-file using zTag ** as a differentiator. If that fails, or if zTag is NULL, then use ** a bunch of random characters as the tag. */ void file_tempname(Blob *pBuf, const char *zBasis, const char *zTag){ #if defined(_WIN32) const char *azDirs[] = { 0, /* GetTempPath */ 0, /* TEMP */ 0, /* TMP */ ".", }; |
︙ | ︙ | |||
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 | "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; unsigned int i; const char *zDir = "."; int cnt = 0; char zRand[16]; #if defined(_WIN32) wchar_t zTmpPath[MAX_PATH]; if( GetTempPathW(MAX_PATH, zTmpPath) ){ azDirs[0] = fossil_path_to_utf8(zTmpPath); /* Removing trailing \ from the temp path */ | > > | 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; unsigned int i; const char *zDir = "."; int cnt = 0; char zRand[16]; int nBasis; const char *zSuffix; #if defined(_WIN32) wchar_t zTmpPath[MAX_PATH]; if( GetTempPathW(MAX_PATH, zTmpPath) ){ azDirs[0] = fossil_path_to_utf8(zTmpPath); /* Removing trailing \ from the temp path */ |
︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 | for(i=0; i<count(azDirs); i++){ if( azDirs[i]==0 ) continue; if( !file_isdir(azDirs[i], ExtFILE) ) continue; zDir = azDirs[i]; break; } do{ blob_zero(pBuf); if( cnt++>20 ) fossil_panic("cannot generate a temporary filename"); | > > > > > > > > > > > > > > > > > > > > > | | | | | > > | > | 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 | for(i=0; i<count(azDirs); i++){ if( azDirs[i]==0 ) continue; if( !file_isdir(azDirs[i], ExtFILE) ) continue; zDir = azDirs[i]; break; } assert( zBasis!=0 ); zSuffix = 0; for(i=0; zBasis[i]; i++){ if( zBasis[i]=='/' || zBasis[i]=='\\' ){ zBasis += i+1; i = -1; }else if( zBasis[i]=='.' ){ zSuffix = zBasis + i; } } if( zSuffix==0 || zSuffix<=zBasis ){ zSuffix = ""; nBasis = i; }else{ nBasis = (int)(zSuffix - zBasis); } if( nBasis==0 ){ nBasis = 6; zBasis = "fossil"; } do{ blob_zero(pBuf); if( cnt++>20 ) fossil_panic("cannot generate a temporary filename"); if( zTag==0 ){ sqlite3_randomness(15, zRand); for(i=0; i<15; i++){ zRand[i] = (char)zChars[ ((unsigned char)zRand[i])%(sizeof(zChars)-1) ]; } zRand[15] = 0; zTag = zRand; } blob_appendf(pBuf, "%s/%.*s~%s%s", zDir, nBasis, zBasis, zTag, zSuffix); zTag = 0; }while( file_size(blob_str(pBuf), ExtFILE)>=0 ); #if defined(_WIN32) fossil_path_free((char *)azDirs[0]); fossil_path_free((char *)azDirs[1]); fossil_path_free((char *)azDirs[2]); /* Change all \ characters in the windows path into / so that they can |
︙ | ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | zDir, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, cnt++, r%1000000, zSuffix); } /* ** COMMAND: test-tempname | | | > > | | 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 | zDir, tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, cnt++, r%1000000, zSuffix); } /* ** COMMAND: test-tempname ** Usage: fossil test-name [--time SUFFIX] [--tag NAME] BASENAME ... ** ** Generate temporary filenames derived from BASENAME. Use the --time ** option to generate temp names based on the time of day. If --tag NAME ** is specified, try to use NAME as the differentiator in the temp file. */ void file_test_tempname(void){ int i; const char *zSuffix = find_option("time",0,1); Blob x = BLOB_INITIALIZER; char *z; const char *zTag = find_option("tag",0,1); verify_all_options(); for(i=2; i<g.argc; i++){ if( zSuffix ){ z = file_time_tempname(g.argv[i], zSuffix); fossil_print("%s\n", z); fossil_free(z); }else{ file_tempname(&x, g.argv[i], zTag); fossil_print("%s\n", blob_str(&x)); blob_reset(&x); } } } |
︙ | ︙ | |||
1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | #else rc = putenv(zString); /* NOTE: Cannot free the string on POSIX. */ /* fossil_free(zString); */ #endif return rc; } /* ** Like fopen() but always takes a UTF8 argument. ** ** This function assumes ExtFILE. In other words, symbolic links ** are always followed. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 | #else rc = putenv(zString); /* NOTE: Cannot free the string on POSIX. */ /* fossil_free(zString); */ #endif return rc; } /* ** Clear all environment variables */ int fossil_clearenv(void){ #ifdef _WIN32 int rc = 0; LPWCH zzEnv = GetEnvironmentStringsW(); if( zzEnv ){ LPCWSTR zEnv = zzEnv; /* read-only */ while( 1 ){ LPWSTR zNewEnv = _wcsdup(zEnv); /* writable */ if( zNewEnv ){ LPWSTR zEquals = wcsstr(zNewEnv, L"="); if( zEquals ){ zEquals[1] = 0; /* no value */ if( zNewEnv==zEquals || _wputenv(zNewEnv)==0 ){ /* via CRT */ /* do nothing */ }else{ zEquals[0] = 0; /* name only */ if( !SetEnvironmentVariableW(zNewEnv, NULL) ){ /* via Win32 */ rc = 1; } } if( rc==0 ){ zEnv += (lstrlenW(zEnv) + 1); /* double NUL term? */ if( zEnv[0]==0 ){ free(zNewEnv); break; /* no more vars */ } } }else{ rc = 1; } }else{ rc = 1; } free(zNewEnv); if( rc!=0 ) break; } if( !FreeEnvironmentStringsW(zzEnv) ){ rc = 2; } }else{ rc = 1; } return rc; #else extern char **environ; environ = 0; return 0; #endif } /* ** Like fopen() but always takes a UTF8 argument. ** ** This function assumes ExtFILE. In other words, symbolic links ** are always followed. */ |
︙ | ︙ | |||
1593 1594 1595 1596 1597 1598 1599 | /* ** Return non-NULL if zFilename contains pathname elements that ** are reserved on Windows. The returned string is the disallowed ** path element. */ const char *file_is_win_reserved(const char *zPath){ | | | 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 | /* ** Return non-NULL if zFilename contains pathname elements that ** are reserved on Windows. The returned string is the disallowed ** path element. */ const char *file_is_win_reserved(const char *zPath){ static const char *const azRes[] = { "CON", "PRN", "AUX", "NUL", "COM", "LPT" }; static char zReturn[5]; int i; while( zPath[0] ){ for(i=0; i<count(azRes); i++){ if( sqlite3_strnicmp(zPath, azRes[i], 3)==0 && ((i>=4 && fossil_isdigit(zPath[3]) && (zPath[4]=='/' || zPath[4]=='.' || zPath[4]==0)) |
︙ | ︙ | |||
1693 1694 1695 1696 1697 1698 1699 | if( g.argc!=3 && g.argc!=4 ){ usage("NAME [GLOB] [-nodots]"); } zDir = g.argv[2]; zGlob = g.argc==4 ? g.argv[3] : 0; fossil_print("%d\n", file_directory_size(zDir, zGlob, omitDotFiles)); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 | if( g.argc!=3 && g.argc!=4 ){ usage("NAME [GLOB] [-nodots]"); } zDir = g.argv[2]; zGlob = g.argc==4 ? g.argv[3] : 0; fossil_print("%d\n", file_directory_size(zDir, zGlob, omitDotFiles)); } /* ** Internal helper for touch_cmd(). zAbsName must be resolvable as-is ** to an existing file - this function does not expand/normalize ** it. i.e. it "really should" be an absolute path. zTreeName is ** strictly cosmetic: it is used when dryRunFlag, verboseFlag, or ** quietFlag generate output, and is assumed to be a repo-relative or ** or subdir-relative filename. ** ** newMTime is the file's new timestamp (Unix epoch). ** ** Returns 1 if it sets zAbsName's mtime, 0 if it does not (indicating ** that the file already has that timestamp or a warning was emitted ** or was not found). If dryRunFlag is true then it outputs the name ** of the file it would have timestamped but does not stamp the ** file. If verboseFlag is true, it outputs a message if the file's ** timestamp is actually modified. If quietFlag is true then the ** output of non-fatal warning messages is suppressed. ** ** As a special case, if newMTime is 0 then this function emits a ** warning (unless quietFlag is true), does NOT set the timestamp, and ** returns 0. The timestamp is known to be zero when ** mtime_of_manifest_file() is asked to provide the timestamp for a ** file which is currently undergoing an uncommitted merge (though ** this may depend on exactly where that merge is happening the ** history of the project). */ static int touch_cmd_stamp_one_file(char const *zAbsName, char const *zTreeName, i64 newMtime, int dryRunFlag, int verboseFlag, int quietFlag){ i64 currentMtime; if(newMtime==0){ if( quietFlag==0 ){ fossil_print("SKIPPING timestamp of 0: %s\n", zTreeName); } return 0; } currentMtime = file_mtime(zAbsName, 0); if(currentMtime<0){ fossil_print("SKIPPING: cannot stat file: %s\n", zAbsName); return 0; }else if(currentMtime==newMtime){ return 0; }else if( dryRunFlag!=0 ){ fossil_print( "dry-run: %s\n", zTreeName ); }else{ file_set_mtime(zAbsName, newMtime); if( verboseFlag!=0 ){ fossil_print( "touched %s\n", zTreeName ); } } return 1; } /* ** Internal helper for touch_cmd(). If the given file name is found in ** the given checkout version, which MUST be the checkout version ** currently populating the vfile table, the vfile.mrid value for the ** file is returned, else 0 is returned. zName must be resolvable ** as-is from the vfile table - this function neither expands nor ** normalizes it, though it does compare using the repo's ** filename_collation() preference. */ static int touch_cmd_vfile_mrid( int vid, char const *zName ){ int mrid = 0; static Stmt q = empty_Stmt_m; db_static_prepare(&q, "SELECT vfile.mrid " "FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid " "WHERE vid=:vid AND pathname=:pathname %s", filename_collation()); db_bind_int(&q, ":vid", vid); db_bind_text(&q, ":pathname", zName); if(SQLITE_ROW==db_step(&q)){ mrid = db_column_int(&q, 0); } db_reset(&q); return mrid; } /* ** COMMAND: touch* ** ** Usage: %fossil touch ?OPTIONS? ?FILENAME...? ** ** For each file in the current checkout matching one of the provided ** list of glob patterns and/or file names, the file's mtime is ** updated to a value specified by one of the flags --checkout, ** --checkin, or --now. ** ** If neither glob patterns nor filenames are provided, it operates on ** all files managed by the currently checked-out version. ** ** This command gets its name from the conventional Unix "touch" ** command. ** ** Options: ** --now Stamp each affected file with the current time. ** This is the default behavior. ** -c|--checkin Stamp each affected file with the time of the ** most recent check-in which modified that file. ** -C|--checkout Stamp each affected file with the time of the ** currently-checked-out version. ** -g GLOBLIST Comma-separated list of glob patterns. ** -G GLOBFILE Similar to -g but reads its globs from a ** fossil-conventional glob list file. ** -v|-verbose Outputs extra information about its globs ** and each file it touches. ** -n|--dry-run Outputs which files would require touching, ** but does not touch them. ** -q|--quiet Suppress warnings, e.g. when skipping unmanaged ** or out-of-tree files. ** ** Only one of --now, --checkin, and --checkout may be used. The ** default is --now. ** ** Only one of -g or -G may be used. If neither is provided and no ** additional filenames are provided, the effect is as if a glob of ** '*' were provided, i.e. all files belonging to the ** currently-checked-out version. Note that all glob patterns provided ** via these flags are always evaluated as if they are relative to the ** top of the source tree, not the current working (sub)directory. ** Filenames provided without these flags, on the other hand, are ** treated as relative to the current directory. ** ** As a special case, files currently undergoing an uncommitted merge ** might not get timestamped with --checkin because it may be ** impossible for fossil to choose between multiple potential ** timestamps. A non-fatal warning is emitted for such cases. ** */ void touch_cmd(){ const char * zGlobList; /* -g List of glob patterns */ const char * zGlobFile; /* -G File of glob patterns */ Glob * pGlob = 0; /* List of glob patterns */ int verboseFlag; int dryRunFlag; int vid; /* Checkout version */ int changeCount = 0; /* Number of files touched */ int quietFlag = 0; /* -q|--quiet */ int timeFlag; /* -1==--checkin, 1==--checkout, 0==--now */ i64 nowTime = 0; /* Timestamp of --now or --checkout */ Stmt q; Blob absBuffer = empty_blob; /* Absolute filename buffer */ verboseFlag = find_option("verbose","v",0)!=0; quietFlag = find_option("quiet","q",0)!=0 || g.fQuiet; dryRunFlag = find_option("dry-run","n",0)!=0 || find_option("dryrun",0,0)!=0; zGlobList = find_option("glob", "g",1); zGlobFile = find_option("globfile", "G",1); if(zGlobList && zGlobFile){ fossil_fatal("Options -g and -G may not be used together."); } { int const ci = (find_option("checkin","c",0) || find_option("check-in",0,0)) ? 1 : 0; int const co = find_option("checkout","C",0) ? 1 : 0; int const now = find_option("now",0,0) ? 1 : 0; if(ci + co + now > 1){ fossil_fatal("Options --checkin, --checkout, and --now may " "not be used together."); }else if(co){ timeFlag = 1; if(verboseFlag){ fossil_print("Timestamp = current checkout version.\n"); } }else if(ci){ timeFlag = -1; if(verboseFlag){ fossil_print("Timestamp = checkin in which each file was " "most recently modified.\n"); } }else{ timeFlag = 0; if(verboseFlag){ fossil_print("Timestamp = current system time.\n"); } } } verify_all_options(); db_must_be_within_tree(); vid = db_lget_int("checkout", 0); if(vid==0){ fossil_fatal("Cannot determine checkout version."); } if(zGlobList){ pGlob = *zGlobList ? glob_create(zGlobList) : 0; }else if(zGlobFile){ Blob globs = empty_blob; blob_read_from_file(&globs, zGlobFile, ExtFILE); pGlob = glob_create( globs.aData ); blob_reset(&globs); } if( pGlob && verboseFlag!=0 ){ int i; for(i=0; i<pGlob->nPattern; ++i){ fossil_print("glob: %s\n", pGlob->azPattern[i]); } } db_begin_transaction(); if(timeFlag==0){/*--now*/ nowTime = time(0); }else if(timeFlag>0){/*--checkout: get the checkout manifest's timestamp*/ assert(vid>0); nowTime = db_int64(-1, "SELECT CAST(strftime('%%s'," "(SELECT mtime FROM event WHERE objid=%d)" ") AS INTEGER)", vid); if(nowTime<0){ fossil_fatal("Could not determine checkout version's time!"); } }else{ /* --checkin */ assert(0 == nowTime); } if((pGlob && pGlob->nPattern>0) || g.argc<3){ /* ** We have either (1) globs or (2) no trailing filenames. If there ** are neither globs nor filenames then we operate on all managed ** files. */ db_prepare(&q, "SELECT vfile.mrid, pathname " "FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid " "WHERE vid=%d", vid); while(SQLITE_ROW==db_step(&q)){ int const fid = db_column_int(&q, 0); const char * zName = db_column_text(&q, 1); i64 newMtime = nowTime; char const * zAbs = 0; /* absolute path */ absBuffer.nUsed = 0; assert(timeFlag<0 ? newMtime==0 : newMtime>0); if(pGlob){ if(glob_match(pGlob, zName)==0) continue; } blob_appendf( &absBuffer, "%s%s", g.zLocalRoot, zName ); zAbs = blob_str(&absBuffer); if( newMtime || mtime_of_manifest_file(vid, fid, &newMtime)==0 ){ changeCount += touch_cmd_stamp_one_file( zAbs, zName, newMtime, dryRunFlag, verboseFlag, quietFlag ); } } db_finalize(&q); } glob_free(pGlob); pGlob = 0; if(g.argc>2){ /* ** Trailing filenames on the command line. These require extra ** care to avoid modifying unmanaged or out-of-tree files and ** finding an associated --checkin timestamp. */ int i; Blob treeNameBuf = empty_blob; /* Buffer for file_tree_name(). */ for( i = 2; i < g.argc; ++i, blob_reset(&treeNameBuf) ){ char const * zArg = g.argv[i]; char const * zTreeFile; /* repo-relative filename */ char const * zAbs; /* absolute filename */ i64 newMtime = nowTime; int nameCheck; int fid; /* vfile.mrid of file */ nameCheck = file_tree_name( zArg, &treeNameBuf, 0, 0 ); if(nameCheck==0){ if(quietFlag==0){ fossil_print("SKIPPING out-of-tree file: %s\n", zArg); } continue; } zTreeFile = blob_str(&treeNameBuf); fid = touch_cmd_vfile_mrid( vid, zTreeFile ); if(fid==0){ if(quietFlag==0){ fossil_print("SKIPPING unmanaged file: %s\n", zArg); } continue; } absBuffer.nUsed = 0; blob_appendf(&absBuffer, "%s%s", g.zLocalRoot, zTreeFile); zAbs = blob_str(&absBuffer); if(timeFlag<0){/*--checkin*/ if(mtime_of_manifest_file( vid, fid, &newMtime )!=0){ fossil_fatal("Could not resolve --checkin mtime of %s", zTreeFile); } }else{ assert(newMtime>0); } changeCount += touch_cmd_stamp_one_file( zAbs, zArg, newMtime, dryRunFlag, verboseFlag, quietFlag ); } } db_end_transaction(0); blob_reset(&absBuffer); if( dryRunFlag!=0 ){ fossil_print("dry-run: would have touched %d file(s)\n", changeCount); }else{ fossil_print("Touched %d file(s)\n", changeCount); } } |
Changes to src/finfo.c.
︙ | ︙ | |||
213 214 215 216 217 218 219 | char *zOut; if( zBr==0 ) zBr = "trunk"; if( iBrief ){ fossil_print("%s ", zDate); zOut = mprintf( "[%S] %s (user: %s, artifact: [%S], branch: %s)", zCiUuid, zCom, zUser, zFileUuid, zBr); | | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | char *zOut; if( zBr==0 ) zBr = "trunk"; if( iBrief ){ fossil_print("%s ", zDate); zOut = mprintf( "[%S] %s (user: %s, artifact: [%S], branch: %s)", zCiUuid, zCom, zUser, zFileUuid, zBr); comment_print(zOut, zCom, 11, iWidth, get_comment_format()); fossil_free(zOut); }else{ blob_reset(&line); blob_appendf(&line, "%S ", zCiUuid); blob_appendf(&line, "%.10s ", zDate); blob_appendf(&line, "%8.8s ", zUser); blob_appendf(&line, "%8.8s ", zBr); blob_appendf(&line,"%-39.39s", zCom ); comment_print(blob_str(&line), zCom, 0, iWidth, get_comment_format()); } } db_finalize(&q); blob_reset(&fname); } } |
︙ | ︙ | |||
328 329 330 331 332 333 334 335 336 337 338 339 340 341 | tmFlags = timeline_ss_submenu(); if( tmFlags & TIMELINE_COLUMNAR ){ zStyle = "Columnar"; }else if( tmFlags & TIMELINE_COMPACT ){ zStyle = "Compact"; }else if( tmFlags & TIMELINE_VERBOSE ){ zStyle = "Verbose"; }else{ zStyle = "Modern"; } url_initialize(&url, "finfo"); if( brBg ) url_add_parameter(&url, "brbg", 0); if( uBg ) url_add_parameter(&url, "ubg", 0); baseCheckin = name_to_rid_www("ci"); | > > | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | tmFlags = timeline_ss_submenu(); if( tmFlags & TIMELINE_COLUMNAR ){ zStyle = "Columnar"; }else if( tmFlags & TIMELINE_COMPACT ){ zStyle = "Compact"; }else if( tmFlags & TIMELINE_VERBOSE ){ zStyle = "Verbose"; }else if( tmFlags & TIMELINE_CLASSIC ){ zStyle = "Classic"; }else{ zStyle = "Modern"; } url_initialize(&url, "finfo"); if( brBg ) url_add_parameter(&url, "brbg", 0); if( uBg ) url_add_parameter(&url, "ubg", 0); baseCheckin = name_to_rid_www("ci"); |
︙ | ︙ | |||
449 450 451 452 453 454 455 456 457 458 459 460 461 462 | fossil_free(zUuid); } }else{ blob_appendf(&title, "History of "); hyperlinked_path(zFilename, &title, 0, "tree", ""); if( fShowId ) blob_appendf(&title, " (%d)", fnid); } @ <h2>%b(&title)</h2> blob_reset(&title); pGraph = graph_init(); @ <table id="timelineTable%d(iTableId)" class="timelineTable"> if( baseCheckin ){ db_prepare(&qparent, "SELECT DISTINCT pid FROM mlink" | > > > | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | fossil_free(zUuid); } }else{ blob_appendf(&title, "History of "); hyperlinked_path(zFilename, &title, 0, "tree", ""); if( fShowId ) blob_appendf(&title, " (%d)", fnid); } if( uBg ){ blob_append(&title, " (color-coded by user)", -1); } @ <h2>%b(&title)</h2> blob_reset(&title); pGraph = graph_init(); @ <table id="timelineTable%d(iTableId)" class="timelineTable"> if( baseCheckin ){ db_prepare(&qparent, "SELECT DISTINCT pid FROM mlink" |
︙ | ︙ | |||
501 502 503 504 505 506 507 | if( zBr==0 ) zBr = "trunk"; if( uBg ){ zBgClr = hash_color(zUser); }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); } gidx = graph_add_row(pGraph, frid>0 ? frid : fpid+1000000000, | | | 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | if( zBr==0 ) zBr = "trunk"; if( uBg ){ zBgClr = hash_color(zUser); }else if( brBg || zBgClr==0 || zBgClr[0]==0 ){ zBgClr = strcmp(zBr,"trunk")==0 ? "" : hash_color(zBr); } gidx = graph_add_row(pGraph, frid>0 ? frid : fpid+1000000000, nParent, 0, aParent, zBr, zBgClr, zUuid, 0); if( strncmp(zDate, zPrevDate, 10) ){ sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); @ <tr><td> @ <div class="divider timelineDate">%s(zPrevDate)</div> @ </td><td></td><td></td></tr> } |
︙ | ︙ | |||
571 572 573 574 575 576 577 | @ check-in: \ hyperlink_to_uuid(zCkin); if( fShowId ){ @ (%d(fmid)) } @ user: \ hyperlink_to_user(zUser, zDate, ","); | | | 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | @ check-in: \ hyperlink_to_uuid(zCkin); if( fShowId ){ @ (%d(fmid)) } @ user: \ hyperlink_to_user(zUser, zDate, ","); @ branch: %z(href("%R/timeline?t=%T",zBr))%h(zBr)</a>, if( tmFlags & (TIMELINE_COMPACT|TIMELINE_VERBOSE) ){ @ size: %d(szFile)) }else{ @ size: %d(szFile) } if( zUuid && origCheckin==0 ){ if( nParent==0 ){ |
︙ | ︙ | |||
641 642 643 644 645 646 647 | @ </span> } @ </td></tr> } db_finalize(&q); db_finalize(&qparent); if( pGraph ){ | | | > | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | @ </span> } @ </td></tr> } db_finalize(&q); db_finalize(&qparent); if( pGraph ){ graph_finish(pGraph, 0, TIMELINE_DISJOINT); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ @ <tr class="timelineBottom" id="btm-%d(iTableId)">\ @ <td></td><td></td><td></td></tr> } } @ </table> timeline_output_graph_javascript(pGraph, TIMELINE_FILEDIFF, iTableId); style_footer(); } |
︙ | ︙ | |||
775 776 777 778 779 780 781 | /* 5 */ " (SELECT uuid FROM blob WHERE rid=mlink.pmid)," /* 6 */ " mperm," /* 7 */ " isaux" " FROM mlink WHERE mid=%d ORDER BY 1", mid ); @ <h1>MLINK table for check-in %h(zCI)</h1> | | | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | /* 5 */ " (SELECT uuid FROM blob WHERE rid=mlink.pmid)," /* 6 */ " mperm," /* 7 */ " isaux" " FROM mlink WHERE mid=%d ORDER BY 1", mid ); @ <h1>MLINK table for check-in %h(zCI)</h1> render_checkin_context(mid, 0, 1); style_table_sorter(); @ <hr /> @ <div class='brlist'> @ <table class='sortable' data-column-types='ttxtttt' data-init-sort='1'> @ <thead><tr> @ <th>File</th> @ <th>Parent<br>Check-in</th> |
︙ | ︙ |
Changes to src/foci.c.
︙ | ︙ | |||
119 120 121 122 123 124 125 | ** ** (0) A full scan. Visit every manifest in the repo. (Slow) ** (1) checkinID=?. visit only the single manifest specified. ** (2) symName=? visit only the single manifest specified. */ static int fociBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ int i; | | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** ** (0) A full scan. Visit every manifest in the repo. (Slow) ** (1) checkinID=?. visit only the single manifest specified. ** (2) symName=? visit only the single manifest specified. */ static int fociBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ int i; pIdxInfo->estimatedCost = 1000000000.0; for(i=0; i<pIdxInfo->nConstraint; i++){ if( !pIdxInfo->aConstraint[i].usable ) continue; if( pIdxInfo->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ && (pIdxInfo->aConstraint[i].iColumn==FOCI_CHECKINID || pIdxInfo->aConstraint[i].iColumn==FOCI_SYMNAME) ){ if( pIdxInfo->aConstraint[i].iColumn==FOCI_CHECKINID ){ pIdxInfo->idxNum = 1; }else{ |
︙ | ︙ |
Changes to src/forum.c.
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 | ** a reply. */ struct ForumEntry { int fpid; /* rid for this entry */ int fprev; /* zero if initial entry. non-zero if an edit */ int firt; /* This entry replies to firt */ int mfirt; /* Root in-reply-to */ char *zUuid; /* Artifact hash */ ForumEntry *pLeaf; /* Most recent edit for this entry */ | > > | > | 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 | ** a reply. */ struct ForumEntry { int fpid; /* rid for this entry */ int fprev; /* zero if initial entry. non-zero if an edit */ int firt; /* This entry replies to firt */ int mfirt; /* Root in-reply-to */ int nReply; /* Number of replies to this entry */ int sid; /* Serial ID number */ char *zUuid; /* Artifact hash */ ForumEntry *pLeaf; /* Most recent edit for this entry */ ForumEntry *pEdit; /* This entry is an edit of pEdit */ ForumEntry *pNext; /* Next in chronological order */ ForumEntry *pPrev; /* Previous in chronological order */ ForumEntry *pDisplay; /* Next in display order */ int nIndent; /* Number of levels of indentation for this entry */ }; /* ** A single instance of the following tracks all entries for a thread. */ struct ForumThread { ForumEntry *pFirst; /* First entry in chronological order */ ForumEntry *pLast; /* Last entry in chronological order */ ForumEntry *pDisplay; /* Entries in display order */ ForumEntry *pTail; /* Last on the display list */ int mxIndent; /* Maximum indentation level */ }; #endif /* INTERFACE */ /* ** Delete a complete ForumThread and all its entries. */ static void forumthread_delete(ForumThread *pThread){ |
︙ | ︙ | |||
102 103 104 105 106 107 108 | /* ** Extend the display list for pThread by adding all entries that ** reference fpid. The first such entry will be no earlier then ** entry "p". */ static void forumthread_display_order( | | | < < > > | | > | | | | > | > > > > > > > > > | 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 | /* ** Extend the display list for pThread by adding all entries that ** reference fpid. The first such entry will be no earlier then ** entry "p". */ static void forumthread_display_order( ForumThread *pThread, /* The complete thread */ ForumEntry *pBase /* Add replies to this entry */ ){ ForumEntry *p; ForumEntry *pPrev = 0; for(p=pBase->pNext; p; p=p->pNext){ if( p->fprev==0 && p->mfirt==pBase->fpid ){ if( pPrev ){ pPrev->nIndent = pBase->nIndent + 1; forumentry_add_to_display(pThread, pPrev); forumthread_display_order(pThread, pPrev); } pBase->nReply++; pPrev = p; } } if( pPrev ){ pPrev->nIndent = pBase->nIndent + 1; if( pPrev->nIndent>pThread->mxIndent ) pThread->mxIndent = pPrev->nIndent; forumentry_add_to_display(pThread, pPrev); forumthread_display_order(pThread, pPrev); } } /* ** Construct a ForumThread object given the root record id. */ static ForumThread *forumthread_create(int froot, int computeHierarchy){ ForumThread *pThread; ForumEntry *pEntry; Stmt q; int sid = 1; pThread = fossil_malloc( sizeof(*pThread) ); memset(pThread, 0, sizeof(*pThread)); db_prepare(&q, "SELECT fpid, firt, fprev, (SELECT uuid FROM blob WHERE rid=fpid)" " FROM forumpost" " WHERE froot=%d ORDER BY fmtime", froot ); while( db_step(&q)==SQLITE_ROW ){ pEntry = fossil_malloc( sizeof(*pEntry) ); memset(pEntry, 0, sizeof(*pEntry)); pEntry->fpid = db_column_int(&q, 0); pEntry->firt = db_column_int(&q, 1); pEntry->fprev = db_column_int(&q, 2); pEntry->zUuid = fossil_strdup(db_column_text(&q,3)); pEntry->mfirt = pEntry->firt; pEntry->sid = sid++; pEntry->pPrev = pThread->pLast; pEntry->pNext = 0; if( pThread->pLast==0 ){ pThread->pFirst = pEntry; }else{ pThread->pLast->pNext = pEntry; } |
︙ | ︙ | |||
175 176 177 178 179 180 181 182 | } } if( computeHierarchy ){ /* Compute the hierarchical display order */ pEntry = pThread->pFirst; pEntry->nIndent = 1; forumentry_add_to_display(pThread, pEntry); | > | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | } } if( computeHierarchy ){ /* Compute the hierarchical display order */ pEntry = pThread->pFirst; pEntry->nIndent = 1; pThread->mxIndent = 1; forumentry_add_to_display(pThread, pEntry); forumthread_display_order(pThread, pEntry); } /* Return the result */ return pThread; } /* |
︙ | ︙ | |||
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | ForumEntry *p; db_find_and_open_repository(0,0); verify_all_options(); if( g.argc!=3 ) usage("THREADID"); zName = g.argv[2]; fpid = symbolic_name_to_rid(zName, "f"); if( fpid<=0 ){ fossil_fatal("Unknown or ambiguous forum id: \"%s\"", zName); } froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); if( froot==0 ){ fossil_fatal("Not a forum post: \"%s\"", zName); } fossil_print("fpid = %d\n", fpid); fossil_print("froot = %d\n", froot); pThread = forumthread_create(froot, 1); fossil_print("Chronological:\n"); | > > > | | | | > | 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 | ForumEntry *p; db_find_and_open_repository(0,0); verify_all_options(); if( g.argc!=3 ) usage("THREADID"); zName = g.argv[2]; fpid = symbolic_name_to_rid(zName, "f"); if( fpid<=0 ){ fpid = db_int(0, "SELECT rid FROM blob WHERE rid=%d", atoi(zName)); } if( fpid<=0 ){ fossil_fatal("Unknown or ambiguous forum id: \"%s\"", zName); } froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); if( froot==0 ){ fossil_fatal("Not a forum post: \"%s\"", zName); } fossil_print("fpid = %d\n", fpid); fossil_print("froot = %d\n", froot); pThread = forumthread_create(froot, 1); fossil_print("Chronological:\n"); /* 123456789 123456789 123456789 123456789 123456789 123456789 */ fossil_print(" fpid firt fprev mfirt pLeaf nReply\n"); for(p=pThread->pFirst; p; p=p->pNext){ fossil_print("%9d %9d %9d %9d %9d %9d\n", p->fpid, p->firt, p->fprev, p->mfirt, p->pLeaf ? p->pLeaf->fpid : 0, p->nReply); } fossil_print("\nDisplay\n"); for(p=pThread->pDisplay; p; p=p->pDisplay){ fossil_print("%*s", (p->nIndent-1)*3, ""); if( p->pLeaf ){ fossil_print("%d->%d\n", p->fpid, p->pLeaf->fpid); }else{ |
︙ | ︙ | |||
263 264 265 266 267 268 269 270 271 272 273 274 275 276 | }else{ @ <i>Deleted</i> } if( zClass ){ @ </div> } } /* ** Display all posts in a forum thread in chronological order */ static void forum_display_chronological(int froot, int target){ ForumThread *pThread = forumthread_create(froot, 0); ForumEntry *p; | > > > > > > > > > > > > > > > > > > | 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 | }else{ @ <i>Deleted</i> } if( zClass ){ @ </div> } } /* ** Generate the buttons in the display that allow a forum supervisor to ** mark a user as trusted. Only do this if: ** ** (1) The poster is an individual, not a special user like "anonymous" ** (2) The current user has Forum Supervisor privilege */ static void generateTrustControls(Manifest *pPost){ if( !g.perm.AdminForum ) return; if( login_is_special(pPost->zUser) ) return; @ <br> @ <label><input type="checkbox" name="trust"> @ Trust user "%h(pPost->zUser)" @ so that future posts by "%h(pPost->zUser)" do not require moderation. @ </label> @ <input type="hidden" name="trustuser" value="%h(pPost->zUser)"> } /* ** Display all posts in a forum thread in chronological order */ static void forum_display_chronological(int froot, int target){ ForumThread *pThread = forumthread_create(froot, 0); ForumEntry *p; |
︙ | ︙ | |||
290 291 292 293 294 295 296 | }else{ @ <div id="forum%d(p->fpid)" class="forumTime"> } if( pPost->zThreadTitle ){ @ <h1>%h(pPost->zThreadTitle)</h1> } zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate); | | | > > > > > | > | | < < < < | | 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 | }else{ @ <div id="forum%d(p->fpid)" class="forumTime"> } if( pPost->zThreadTitle ){ @ <h1>%h(pPost->zThreadTitle)</h1> } zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate); @ <p>(%d(p->sid)) By %h(pPost->zUser) on %h(zDate) fossil_free(zDate); if( p->pEdit ){ @ edit of %z(href("%R/forumpost/%S?t=c",p->pEdit->zUuid))\ @ %d(p->pEdit->sid)</a> } if( g.perm.Debug ){ @ <span class="debug">\ @ <a href="%R/artifact/%h(p->zUuid)">(artifact)</a></span> } if( p->firt ){ ForumEntry *pIrt = p->pPrev; while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; if( pIrt ){ @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))\ @ %d(pIrt->sid)</a> } } if( p->pLeaf ){ @ updated by %z(href("%R/forumpost/%S?t=c",p->pLeaf->zUuid))\ @ %d(p->pLeaf->sid)</a> } if( p->fpid!=target ){ @ %z(href("%R/forumpost/%S?t=c",p->zUuid))[link]</a> } isPrivate = content_is_private(p->fpid); sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; if( isPrivate && !g.perm.ModForum && !sameUser ){ @ <p><span class="modpending">Awaiting Moderator Approval</span></p> }else{ forum_render(0, pPost->zMimetype, pPost->zWiki, 0); |
︙ | ︙ | |||
338 339 340 341 342 343 344 345 346 347 348 349 350 351 | @ <input type="submit" name="nullout" value="Delete"> } }else if( g.perm.ModForum ){ /* Provide moderators with moderation buttons for posts that ** are pending moderation */ @ <input type="submit" name="approve" value="Approve"> @ <input type="submit" name="reject" value="Reject"> }else if( sameUser ){ /* A post that is pending moderation can be deleted by the ** person who originally submitted the post */ @ <input type="submit" name="reject" value="Delete"> } @ </form></p> } | > | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | @ <input type="submit" name="nullout" value="Delete"> } }else if( g.perm.ModForum ){ /* Provide moderators with moderation buttons for posts that ** are pending moderation */ @ <input type="submit" name="approve" value="Approve"> @ <input type="submit" name="reject" value="Reject"> generateTrustControls(pPost); }else if( sameUser ){ /* A post that is pending moderation can be deleted by the ** person who originally submitted the post */ @ <input type="submit" name="reject" value="Delete"> } @ </form></p> } |
︙ | ︙ | |||
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 | ForumEntry *p; Manifest *pPost, *pOPost; int fpid; const char *zUuid; char *zDate; const char *zSel; int notAnon = login_is_individual(); pThread = forumthread_create(froot, 1); for(p=pThread->pFirst; p; p=p->pNext){ if( p->fpid==target ){ while( p->pEdit ) p = p->pEdit; target = p->fpid; break; } } for(p=pThread->pDisplay; p; p=p->pDisplay){ int isPrivate; /* True for posts awaiting moderation */ int sameUser; /* True if reader is also the poster */ pOPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); if( p->pLeaf ){ fpid = p->pLeaf->fpid; zUuid = p->pLeaf->zUuid; pPost = manifest_get(fpid, CFTYPE_FORUM, 0); }else{ fpid = p->fpid; zUuid = p->zUuid; pPost = pOPost; } zSel = p->fpid==target ? " forumSel" : ""; if( p->nIndent==1 ){ @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'> }else{ @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \ | > > > > | | | | > > > > > > > > | 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 | ForumEntry *p; Manifest *pPost, *pOPost; int fpid; const char *zUuid; char *zDate; const char *zSel; int notAnon = login_is_individual(); int iIndentScale = 4; pThread = forumthread_create(froot, 1); for(p=pThread->pFirst; p; p=p->pNext){ if( p->fpid==target ){ while( p->pEdit ) p = p->pEdit; target = p->fpid; break; } } while( iIndentScale>1 && iIndentScale*pThread->mxIndent>25 ){ iIndentScale--; } for(p=pThread->pDisplay; p; p=p->pDisplay){ int isPrivate; /* True for posts awaiting moderation */ int sameUser; /* True if reader is also the poster */ pOPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); if( p->pLeaf ){ fpid = p->pLeaf->fpid; zUuid = p->pLeaf->zUuid; pPost = manifest_get(fpid, CFTYPE_FORUM, 0); }else{ fpid = p->fpid; zUuid = p->zUuid; pPost = pOPost; } zSel = p->fpid==target ? " forumSel" : ""; if( p->nIndent==1 ){ @ <div id='forum%d(fpid)' class='forumHierRoot%s(zSel)'> }else{ @ <div id='forum%d(fpid)' class='forumHier%s(zSel)' \ @ style='margin-left: %d((p->nIndent-1)*iIndentScale)ex;'> } pPost = manifest_get(fpid, CFTYPE_FORUM, 0); if( pPost==0 ) continue; if( pPost->zThreadTitle ){ @ <h1>%h(pPost->zThreadTitle)</h1> } zDate = db_text(0, "SELECT datetime(%.17g)", pOPost->rDate); @ <p>(%d(p->pLeaf?p->pLeaf->sid:p->sid)) By %h(pOPost->zUser) on %h(zDate) fossil_free(zDate); if( g.perm.Debug ){ @ <span class="debug">\ @ <a href="%R/artifact/%h(p->zUuid)">(artifact)</a></span> } if( p->pLeaf ){ zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate); if( fossil_strcmp(pOPost->zUser,pPost->zUser)==0 ){ @ and edited on %h(zDate) }else{ @ as edited by %h(pPost->zUser) on %h(zDate) } fossil_free(zDate); if( g.perm.Debug ){ @ <span class="debug">\ @ <a href="%R/artifact/%h(p->pLeaf->zUuid)">(artifact)</a></span> } manifest_destroy(pOPost); } if( fpid!=target ){ @ %z(href("%R/forumpost/%S",zUuid))[link]</a> } if( p->firt ){ ForumEntry *pIrt = p->pPrev; while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; if( pIrt ){ @ in reply to %z(href("%R/forumpost/%S?t=h",pIrt->zUuid))\ @ %d(pIrt->sid)</a> } } isPrivate = content_is_private(fpid); sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; if( isPrivate && !g.perm.ModForum && !sameUser ){ @ <p><span class="modpending">Awaiting Moderator Approval</span></p> }else{ forum_render(0, pPost->zMimetype, pPost->zWiki, 0); |
︙ | ︙ | |||
444 445 446 447 448 449 450 451 452 453 454 455 456 457 | @ <input type="submit" name="nullout" value="Delete"> } }else if( g.perm.ModForum ){ /* Provide moderators with moderation buttons for posts that ** are pending moderation */ @ <input type="submit" name="approve" value="Approve"> @ <input type="submit" name="reject" value="Reject"> }else if( sameUser ){ /* A post that is pending moderation can be deleted by the ** person who originally submitted the post */ @ <input type="submit" name="reject" value="Delete"> } @ </form></p> } | > | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | @ <input type="submit" name="nullout" value="Delete"> } }else if( g.perm.ModForum ){ /* Provide moderators with moderation buttons for posts that ** are pending moderation */ @ <input type="submit" name="approve" value="Approve"> @ <input type="submit" name="reject" value="Reject"> generateTrustControls(pPost); }else if( sameUser ){ /* A post that is pending moderation can be deleted by the ** person who originally submitted the post */ @ <input type="submit" name="reject" value="Delete"> } @ </form></p> } |
︙ | ︙ | |||
469 470 471 472 473 474 475 | ** it's entire thread. The selected posting is enclosed within ** <div class='forumSel'>...</div>. Javascript is used to move the ** selected posting into view after the page loads. ** ** Query parameters: ** ** name=X REQUIRED. The hash of the post to display | > | > | > | | | > > | > > > < | < | 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 | ** it's entire thread. The selected posting is enclosed within ** <div class='forumSel'>...</div>. Javascript is used to move the ** selected posting into view after the page loads. ** ** Query parameters: ** ** name=X REQUIRED. The hash of the post to display ** t=MODE Display mode. MODE is 'c' for chronological or ** 'h' for hierarchical, or 'a' for automatic. */ void forumpost_page(void){ forumthread_page(); } /* ** WEBPAGE: forumthread ** ** Show all forum messages associated with a particular message thread. ** The result is basically the same as /forumpost except that none of ** the postings in the thread are selected. ** ** Query parameters: ** ** name=X REQUIRED. The hash of any post of the thread. ** t=MODE Display mode. MODE is 'c' for chronological or ** 'h' for hierarchical, or 'a' for automatic. */ void forumthread_page(void){ int fpid; int froot; const char *zName = P("name"); const char *zMode = PD("t","a"); login_check_credentials(); if( !g.perm.RdForum ){ login_needed(g.anon.RdForum); return; } if( zName==0 ){ webpage_error("Missing \"name=\" query parameter"); } fpid = symbolic_name_to_rid(zName, "f"); if( fpid<=0 ){ webpage_error("Unknown or ambiguous forum id: \"%s\"", zName); } style_header("Forum"); froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); if( froot==0 ){ webpage_error("Not a forum post: \"%s\"", zName); } if( fossil_strcmp(g.zPath,"forumthread")==0 ) fpid = 0; if( zMode[0]=='a' ){ if( cgi_from_mobile() ){ zMode = "c"; /* Default to chronological on mobile */ }else{ zMode = "h"; } } if( zMode[0]=='c' ){ style_submenu_element("Hierarchical", "%R/%s/%s?t=h", g.zPath, zName); forum_display_chronological(froot, fpid); }else{ style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName); forum_display_hierarchical(froot, fpid); } style_load_js("forum.js"); style_footer(); } /* |
︙ | ︙ | |||
640 641 642 643 644 645 646 | const char *zTitle, const char *zMimetype, const char *zContent ){ if( zTitle ){ @ Title: <input type="input" name="title" value="%h(zTitle)" size="50"><br> } | | | 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | const char *zTitle, const char *zMimetype, const char *zContent ){ if( zTitle ){ @ Title: <input type="input" name="title" value="%h(zTitle)" size="50"><br> } @ %z(href("%R/markup_help"))Markup style</a>: mimetype_option_menu(zMimetype); @ <br><textarea name="content" class="wikiedit" cols="80" \ @ rows="25" wrap="virtual">%h(zContent)</textarea><br> } /* ** WEBPAGE: forumnew |
︙ | ︙ | |||
738 739 740 741 742 743 744 | } if( P("preview") ){ @ <h1>Preview:</h1> forum_render(zTitle, zMimetype, zContent, "forumEdit"); } style_header("New Forum Thread"); @ <form action="%R/forume1" method="POST"> | | | 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | } if( P("preview") ){ @ <h1>Preview:</h1> forum_render(zTitle, zMimetype, zContent, "forumEdit"); } style_header("New Forum Thread"); @ <form action="%R/forume1" method="POST"> @ <h1>New Thread:</h1> forum_from_line(); forum_entry_widget(zTitle, zMimetype, zContent); @ <input type="submit" name="preview" value="Preview"> if( P("preview") ){ @ <input type="submit" name="submit" value="Submit"> }else{ @ <input type="submit" name="submit" value="Submit" disabled> |
︙ | ︙ | |||
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 | ** Edit an existing forum message. ** Query parameters: ** ** fpid=X Hash of the post to be editted. REQUIRED */ void forumedit_page(void){ int fpid; Manifest *pPost = 0; const char *zMimetype = 0; const char *zContent = 0; const char *zTitle = 0; int isCsrfSafe; int isDelete = 0; login_check_credentials(); if( !g.perm.WrForum ){ login_needed(g.anon.WrForum); return; } fpid = symbolic_name_to_rid(PD("fpid",""), "f"); if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ webpage_error("Missing or invalid fpid query parameter"); } if( P("cancel") ){ cgi_redirectf("%R/forumpost/%S",P("fpid")); return; } isCsrfSafe = cgi_csrf_safe(1); if( g.perm.ModForum && isCsrfSafe ){ if( P("approve") ){ moderation_approve(fpid); cgi_redirectf("%R/forumpost/%S",P("fpid")); return; } if( P("reject") ){ char *zParent = db_text(0, "SELECT uuid FROM forumpost, blob" | > > > > > > > > > > > > > > > > | 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 | ** Edit an existing forum message. ** Query parameters: ** ** fpid=X Hash of the post to be editted. REQUIRED */ void forumedit_page(void){ int fpid; int froot; Manifest *pPost = 0; Manifest *pRootPost = 0; const char *zMimetype = 0; const char *zContent = 0; const char *zTitle = 0; char *zDate = 0; int isCsrfSafe; int isDelete = 0; login_check_credentials(); if( !g.perm.WrForum ){ login_needed(g.anon.WrForum); return; } fpid = symbolic_name_to_rid(PD("fpid",""), "f"); if( fpid<=0 || (pPost = manifest_get(fpid, CFTYPE_FORUM, 0))==0 ){ webpage_error("Missing or invalid fpid query parameter"); } froot = db_int(0, "SELECT froot FROM forumpost WHERE fpid=%d", fpid); if( froot==0 || (pRootPost = manifest_get(froot, CFTYPE_FORUM, 0))==0 ){ webpage_error("fpid does not appear to be a forum post: \"%d\"", fpid); } if( P("cancel") ){ cgi_redirectf("%R/forumpost/%S",P("fpid")); return; } isCsrfSafe = cgi_csrf_safe(1); if( g.perm.ModForum && isCsrfSafe ){ if( P("approve") ){ const char *zUserToTrust; moderation_approve(fpid); if( g.perm.AdminForum && PB("trust") && (zUserToTrust = P("trustuser"))!=0 ){ db_multi_exec("UPDATE user SET cap=cap||'4' " "WHERE login=%Q AND cap NOT GLOB '*4*'", zUserToTrust); } cgi_redirectf("%R/forumpost/%S",P("fpid")); return; } if( P("reject") ){ char *zParent = db_text(0, "SELECT uuid FROM forumpost, blob" |
︙ | ︙ | |||
877 878 879 880 881 882 883 884 885 886 887 888 889 890 | forum_entry_widget(zTitle, zMimetype, zContent); }else{ /* Reply */ zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); zContent = PDT("content",""); style_header("Reply"); @ <h1>Replying To:</h1> forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit"); if( P("preview") ){ @ <h1>Preview:</h1> forum_render(0, zMimetype,zContent, "forumEdit"); } @ <h1>Enter Reply:</h1> @ <form action="%R/forume2" method="POST"> | > > > > > > | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | forum_entry_widget(zTitle, zMimetype, zContent); }else{ /* Reply */ zMimetype = PD("mimetype",DEFAULT_FORUM_MIMETYPE); zContent = PDT("content",""); style_header("Reply"); @ <h1>Replying To:</h1> if( pRootPost->zThreadTitle ){ @ <h3>%h(pRootPost->zThreadTitle)</h3> } zDate = db_text(0, "SELECT datetime(%.17g)", pPost->rDate); @ <p>%h(pPost->zThreadTitle ? "Post" : "Reply") by %h(pPost->zUser) on %h(zDate) fossil_free(zDate); forum_render(0, pPost->zMimetype, pPost->zWiki, "forumEdit"); if( P("preview") ){ @ <h1>Preview:</h1> forum_render(0, zMimetype,zContent, "forumEdit"); } @ <h1>Enter Reply:</h1> @ <form action="%R/forume2" method="POST"> |
︙ | ︙ | |||
935 936 937 938 939 940 941 | srchFlags = search_restrict(SRCH_FORUM); if( !g.perm.RdForum ){ login_needed(g.anon.RdForum); return; } style_header("Forum"); if( g.perm.WrForum ){ | > > > > > > | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | srchFlags = search_restrict(SRCH_FORUM); if( !g.perm.RdForum ){ login_needed(g.anon.RdForum); return; } style_header("Forum"); if( g.perm.WrForum ){ style_submenu_element("New Thread","%R/forumnew"); }else{ /* Can't combine this with previous case using the ternary operator * because that causes an error yelling about "non-constant format" * with some compilers. I can't see it, since both expressions have * the same format, but I'm no C spec lawyer. */ style_submenu_element("New Thread","%R/login"); } if( g.perm.ModForum && moderation_needed() ){ style_submenu_element("Moderation Requests", "%R/modreq"); } if( (srchFlags & SRCH_FORUM)!=0 ){ if( search_screen(SRCH_FORUM, 0) ){ style_submenu_element("Recent Threads","%R/forum"); |
︙ | ︙ |
Changes to src/forum.js.
︙ | ︙ | |||
12 13 14 15 16 17 18 | if(x[0]){ var w = window.innerHeight; var h = x[0].scrollHeight; var y = absoluteY(x[0]); if( w>h ) y = y + (h-w)/2; if( y>0 ) window.scrollTo(0, y); } | | | 12 13 14 15 16 17 18 19 | if(x[0]){ var w = window.innerHeight; var h = x[0].scrollHeight; var y = absoluteY(x[0]); if( w>h ) y = y + (h-w)/2; if( y>0 ) window.scrollTo(0, y); } })() |
Changes to src/fshell.c.
︙ | ︙ | |||
107 108 109 110 111 112 113 | printf("could not fork a child process to handle the command\n"); fflush(stdout); continue; } if( childPid==0 ){ /* This is the child process */ int main(int, char**); | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | printf("could not fork a child process to handle the command\n"); fflush(stdout); continue; } if( childPid==0 ){ /* This is the child process */ int main(int, char**); fossil_main(nArg, azArg); exit(0); }else{ /* The parent process */ int status; waitpid(childPid, &status, 0); } } |
︙ | ︙ |
Added src/fuzz.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* ** Copyright (c) 2019 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) * ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code to connect Fossil to libFuzzer. Do a web search ** for "libfuzzer" for details about that fuzzing platform. ** ** To build on linux (the only platform for which this works at ** present) first do ** ** ./configure ** ** Then edit the Makefile as follows: ** ** (1) Change CC to be "clang-6.0" or some other compiler that ** supports libFuzzer ** ** (2) Chagne APPNAME to "fossil-fuzz" ** ** (3) Add "-fsanitize=fuzzer" and "-DFOSSIL_FUZZ" to TCCFLAGS. Perhaps ** make the first change "-fsanitize=fuzzer,undefined,address" for ** extra, but slower, testing. ** ** Then build the fuzzer using: ** ** make clean fossil-fuzz ** ** To run the fuzzer, create a working directory ("cases"): ** ** mkdir cases ** ** Then seed the working directory with example input files. For example, ** if fuzzing the wiki formatter, perhaps copy *.wiki into cases. Then ** run the fuzzer thusly: ** ** fossil-fuzz cases ** ** The default is to fuzz the Fossil-wiki translator. Use the --fuzztype TYPE ** option to fuzz different aspects of the system. */ #include "config.h" #include "fuzz.h" #include <stdint.h> #if LOCAL_INTERFACE /* ** Type of fuzzing: */ #define FUZZ_WIKI 0 /* The Fossil-Wiki formatter */ #define FUZZ_MARKDOWN 1 /* The Markdown formatter */ #define FUZZ_ARTIFACT 2 /* Fuzz the artifact parser */ #endif /* The type of fuzzing to do */ static int eFuzzType = FUZZ_WIKI; /* The fuzzer invokes this routine once for each fuzzer input */ int LLVMFuzzerTestOneInput(const uint8_t *aData, size_t nByte){ Blob in, out; blob_init(&in, 0, 0); blob_append(&in, (char*)aData, (int)nByte); blob_zero(&out); switch( eFuzzType ){ case FUZZ_WIKI: { Blob title = BLOB_INITIALIZER; wiki_convert(&in, &out, 0); blob_reset(&out); markdown_to_html(&in, &title, &out); blob_reset(&title); break; } } blob_reset(&in); blob_reset(&out); return 0; } /* ** Check fuzzer command-line options. */ static void fuzzer_options(void){ const char *zType; db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); db_multi_exec("PRAGMA query_only=1;"); zType = find_option("fuzztype",0,1); if( zType==0 || fossil_strcmp(zType,"wiki")==0 ){ eFuzzType = FUZZ_WIKI; }else if( fossil_strcmp(zType,"markdown")==0 ){ eFuzzType = FUZZ_MARKDOWN; }else{ fossil_fatal("unknown fuzz type: \"%s\"", zType); } } /* Libfuzzer invokes this routine once prior to start-up to ** process command-line options. */ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){ expand_args_option(*pArgc, *pArgv); fuzzer_options(); *pArgc = g.argc; *pArgv = g.argv; return 0; } /* ** COMMAND: test-fuzz ** ** Usage: %fossil test-fuzz [-type TYPE] INPUTFILE... ** ** Run a fuzz test using INPUTFILE as the test data. TYPE can be one of: ** ** wiki Fuzz the Fossil-wiki translator ** markdown Fuzz the markdown translator ** artifact Fuzz the artifact parser */ void fuzz_command(void){ Blob in; int i; fuzzer_options(); verify_all_options(); for(i=2; i<g.argc; i++){ blob_read_from_file(&in, g.argv[i], ExtFILE); LLVMFuzzerTestOneInput((const uint8_t*)in.aData, (size_t)in.nUsed); fossil_print("%s\n", g.argv[i]); blob_reset(&in); } } |
Changes to src/graph.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ******************************************************************************* ** ** This file contains code to compute a revision history graph. */ #include "config.h" #include "graph.h" #include <assert.h> #if INTERFACE #define GR_MAX_RAIL 40 /* Max number of "rails" to display */ /* The graph appears vertically beside a timeline. Each row in the ** timeline corresponds to a row in the graph. GraphRow.idx is 0 for ** the top-most row and increases moving down. Hence (in the absence of ** time skew) parents have a larger index than their children. ** ** The nParent field is -1 for entires that do not participate in the graph ** but which are included just so that we can capture their background color. */ struct GraphRow { int rid; /* The rid for the check-in */ | > > > > > > > > > > > > > > > > > > > > | > > | > > > > | | | > > > > > > > > | 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 | ******************************************************************************* ** ** This file contains code to compute a revision history graph. */ #include "config.h" #include "graph.h" #include <assert.h> /* Notes: ** ** The graph is laid out in 1 or more "rails". A "rail" is a vertical ** band in the graph in which one can place nodes or arrows connecting ** nodes. There can be between 1 and GR_MAX_RAIL rails. If the graph ** is to complex to be displayed in GR_MAX_RAIL rails, it is omitted. ** ** A "riser" is the thick line that comes out of the top of a node and ** goes up to the next node on the branch, or to the top of the screen. ** A "descender" is a thick line that comes out of the bottom of a node ** and proceeds down to the bottom of the page. ** ** Invoke graph_init() to create a new GraphContext object. Then ** call graph_add_row() to add nodes, one by one, to the graph. ** Nodes must be added in display order, from top to bottom. ** Then invoke graph_render() to run the layout algorithm. The ** layout algorithm computes which rails all of the nodes sit on, and ** the rails used for merge arrows. */ #if INTERFACE #define GR_MAX_RAIL 40 /* Max number of "rails" to display */ /* The graph appears vertically beside a timeline. Each row in the ** timeline corresponds to a row in the graph. GraphRow.idx is 0 for ** the top-most row and increases moving down. Hence (in the absence of ** time skew) parents have a larger index than their children. ** ** The nParent field is -1 for entires that do not participate in the graph ** but which are included just so that we can capture their background color. */ struct GraphRow { int rid; /* The rid for the check-in */ i8 nParent; /* Number of parents. */ i8 nCherrypick; /* Subset of aParent that are cherrypicks */ i8 nNonCherrypick; /* Number of non-cherrypick parents */ int *aParent; /* Array of parents. 0 element is primary .*/ char *zBranch; /* Branch name */ char *zBgClr; /* Background Color */ char zUuid[HNAME_MAX+1]; /* Check-in for file ID */ GraphRow *pNext; /* Next row down in the list of all rows */ GraphRow *pPrev; /* Previous row */ int idx; /* Row index. Top row is smallest. */ int idxTop; /* Direct descendent highest up on the graph */ GraphRow *pChild; /* Child immediately above this node */ u8 isDup; /* True if this is duplicate of a prior entry */ u8 isLeaf; /* True if this is a leaf node */ u8 isStepParent; /* pChild is actually a step-child */ u8 hasNormalOutMerge; /* Is parent of at laest 1 non-cherrypick merge */ u8 timeWarp; /* Child is earlier in time */ u8 bDescender; /* True if riser from bottom of graph to here. */ u8 selfUp; /* Space above this node but belonging */ i8 iRail; /* Which rail this check-in appears on. 0-based.*/ i8 mergeOut; /* Merge out to this rail. -1 if no merge-out */ u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */ int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */ int mergeUpto; /* Draw the mergeOut rail up to this level */ int cherrypickUpto; /* Continue the mergeOut rail up to here */ u64 mergeDown; /* Draw merge lines up from bottom of graph */ u64 cherrypickDown; /* Draw cherrypick lines up from bottom */ u64 railInUse; /* Mask of occupied rails at this row */ }; /* Context while building a graph */ struct GraphContext { int nErr; /* Number of errors encountered */ int mxRail; /* Number of rails required to render the graph */ GraphRow *pFirst; /* First row in the list. Top row of graph. */ GraphRow *pLast; /* Last row in the list. Bottom row of graph. */ int nBranch; /* Number of distinct branches */ char **azBranch; /* Names of the branches */ int nRow; /* Number of rows */ int nHash; /* Number of slots in apHash[] */ GraphRow **apHash; /* Hash table of GraphRow objects. Key: rid */ u8 aiRailMap[GR_MAX_RAIL]; /* Mapping of rails to actually columns */ }; #endif /* The N-th bit */ #define BIT(N) (((u64)1)<<(N)) /* ** Number of rows before and answer a node with a riser or descender ** that goes off-screen before we can reuse that rail. */ #define RISER_MARGIN 4 /* ** Malloc for zeroed space. Panic if unable to provide the ** requested space. */ void *safeMalloc(int nByte){ void *p = fossil_malloc(nByte); |
︙ | ︙ | |||
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 | /* ** Add a new row to the graph context. Rows are added from top to bottom. */ int graph_add_row( GraphContext *p, /* The context to which the row is added */ int rid, /* RID for the check-in */ int nParent, /* Number of parents */ int *aParent, /* Array of parents */ const char *zBranch, /* Branch for this check-in */ const char *zBgClr, /* Background color. NULL or "" for white. */ const char *zUuid, /* hash name of the object being graphed */ int isLeaf /* True if this row is a leaf */ ){ GraphRow *pRow; int nByte; static int nRow = 0; if( p->nErr ) return 0; nByte = sizeof(GraphRow); if( nParent>0 ) nByte += sizeof(pRow->aParent[0])*nParent; pRow = (GraphRow*)safeMalloc( nByte ); pRow->aParent = nParent>0 ? (int*)&pRow[1] : 0; pRow->rid = rid; pRow->nParent = nParent; pRow->zBranch = persistBranchName(p, zBranch); if( zUuid==0 ) zUuid = ""; sqlite3_snprintf(sizeof(pRow->zUuid), pRow->zUuid, "%s", zUuid); pRow->isLeaf = isLeaf; memset(pRow->aiRiser, -1, sizeof(pRow->aiRiser)); if( zBgClr==0 ) zBgClr = ""; pRow->zBgClr = persistBranchName(p, zBgClr); | > > > > > > | 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 | /* ** Add a new row to the graph context. Rows are added from top to bottom. */ int graph_add_row( GraphContext *p, /* The context to which the row is added */ int rid, /* RID for the check-in */ int nParent, /* Number of parents */ int nCherrypick, /* How many of aParent[] are actually cherrypicks */ int *aParent, /* Array of parents */ const char *zBranch, /* Branch for this check-in */ const char *zBgClr, /* Background color. NULL or "" for white. */ const char *zUuid, /* hash name of the object being graphed */ int isLeaf /* True if this row is a leaf */ ){ GraphRow *pRow; int nByte; static int nRow = 0; if( p->nErr ) return 0; nByte = sizeof(GraphRow); if( nParent>0 ) nByte += sizeof(pRow->aParent[0])*nParent; pRow = (GraphRow*)safeMalloc( nByte ); pRow->aParent = nParent>0 ? (int*)&pRow[1] : 0; pRow->rid = rid; if( nCherrypick>=nParent ){ nCherrypick = nParent-1; /* Safety. Should never happen. */ } pRow->nParent = nParent; pRow->nCherrypick = nCherrypick; pRow->nNonCherrypick = nParent - nCherrypick; pRow->zBranch = persistBranchName(p, zBranch); if( zUuid==0 ) zUuid = ""; sqlite3_snprintf(sizeof(pRow->zUuid), pRow->zUuid, "%s", zUuid); pRow->isLeaf = isLeaf; memset(pRow->aiRiser, -1, sizeof(pRow->aiRiser)); if( zBgClr==0 ) zBgClr = ""; pRow->zBgClr = persistBranchName(p, zBgClr); |
︙ | ︙ | |||
232 233 234 235 236 237 238 | int iBestDist = 9999; u64 inUseMask = 0; for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){} while( pRow && pRow->idx<=btm ){ inUseMask |= pRow->railInUse; pRow = pRow->pNext; } | | | > | > > > > > > > > > > > | > | > | < > > > > > > > > > > | | > > | > > | > > > > > > > | > > > > | 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 | int iBestDist = 9999; u64 inUseMask = 0; for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){} while( pRow && pRow->idx<=btm ){ inUseMask |= pRow->railInUse; pRow = pRow->pNext; } for(i=0; i<GR_MAX_RAIL; i++){ if( (inUseMask & BIT(i))==0 ){ int dist; if( iNearto<=0 ){ iBest = i; break; } dist = i - iNearto; if( dist<0 ) dist = -dist; if( dist<iBestDist ){ iBestDist = dist; iBest = i; } } } if( iBestDist>1000 ) p->nErr++; if( iBest>p->mxRail ) p->mxRail = iBest; return iBest; } /* ** Assign all children of node pBottom to the same rail as pBottom. */ static void assignChildrenToRail(GraphRow *pBottom, u32 tmFlags){ int iRail = pBottom->iRail; GraphRow *pCurrent; GraphRow *pPrior; u64 mask = ((u64)1)<<iRail; pBottom->railInUse |= mask; pPrior = pBottom; for(pCurrent=pBottom->pChild; pCurrent; pCurrent=pCurrent->pChild){ assert( pPrior->idx > pCurrent->idx ); assert( pCurrent->iRail<0 ); if( pPrior->timeWarp ) break; pCurrent->iRail = iRail; pCurrent->railInUse |= mask; pPrior->aiRiser[iRail] = pCurrent->idx; while( pPrior->idx > pCurrent->idx ){ pPrior->railInUse |= mask; pPrior = pPrior->pPrev; assert( pPrior!=0 ); } } /* Mask of additional rows for the riser to infinity */ if( !pPrior->isLeaf && (tmFlags & TIMELINE_DISJOINT)==0 ){ int n = RISER_MARGIN; GraphRow *p; pPrior->selfUp = 0; for(p=pPrior; p && (n--)>0; p=p->pPrev){ pPrior->selfUp++; p->railInUse |= mask; } } } /* ** Create a merge-arrow riser going from pParent up to pChild. */ static void createMergeRiser( GraphContext *p, GraphRow *pParent, GraphRow *pChild, int isCherrypick ){ int u; u64 mask; GraphRow *pLoop; if( pParent->mergeOut<0 ){ u = pParent->aiRiser[pParent->iRail]; if( u>0 && u<pChild->idx ){ /* The thick arrow up to the next primary child of pDesc goes ** further up than the thin merge arrow riser, so draw them both ** on the same rail. */ pParent->mergeOut = pParent->iRail; }else if( pParent->idx - pChild->idx < pParent->selfUp ){ pParent->mergeOut = pParent->iRail; }else{ /* The thin merge arrow riser is taller than the thick primary ** child riser, so use separate rails. */ int iTarget = pParent->iRail; pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1, iTarget); mask = BIT(pParent->mergeOut); for(pLoop=pChild->pNext; pLoop && pLoop->rid!=pParent->rid; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } } } if( isCherrypick ){ if( pParent->cherrypickUpto==0 || pParent->cherrypickUpto > pChild->idx ){ pParent->cherrypickUpto = pChild->idx; } }else{ pParent->hasNormalOutMerge = 1; if( pParent->mergeUpto==0 || pParent->mergeUpto > pChild->idx ){ pParent->mergeUpto = pChild->idx; } } pChild->mergeIn[pParent->mergeOut] = isCherrypick ? 2 : 1; } /* ** Compute the maximum rail number. */ static void find_max_rail(GraphContext *p){ GraphRow *pRow; p->mxRail = 0; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->iRail>p->mxRail ) p->mxRail = pRow->iRail; if( pRow->mergeOut>p->mxRail ) p->mxRail = pRow->mergeOut; while( p->mxRail<GR_MAX_RAIL && (pRow->mergeDown|pRow->cherrypickDown)>(BIT(p->mxRail+1)-1) ){ p->mxRail++; } } } /* ** Draw a riser from pRow upward to indicate that it is going ** to a node that is off the graph to the top. */ static void riser_to_top(GraphRow *pRow){ u64 mask = BIT(pRow->iRail); int n = RISER_MARGIN; pRow->aiRiser[pRow->iRail] = 0; while( pRow && (n--)>0 ){ pRow->railInUse |= mask; pRow = pRow->pPrev; } } /* ** Compute the complete graph ** ** When primary or merge parents are off-screen, normally a line is drawn ** from the node down to the bottom of the graph. This line is called a ** "descender". But if the omitDescenders flag is true, then lines down ** to the bottom of the screen are omitted. ** ** The tmFlags parameter is zero or more of the TIMELINE_* constants. ** Only the following are honored: ** ** TIMELINE_DISJOINT: Omit descenders ** TIMELINE_FILLGAPS: Use step-children ** TIMELINE_XMERGE: Omit off-graph merge lines */ void graph_finish(GraphContext *p, const char *zLeftBranch, u32 tmFlags){ GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent; int i, j; u64 mask; int hasDup = 0; /* True if one or more isDup entries */ const char *zTrunk; u8 *aMap; /* Copy of p->aiRailMap */ int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0; int nTimewarp = 0; int riserMargin = (tmFlags & TIMELINE_DISJOINT) ? 0 : RISER_MARGIN; /* If mergeRiserFrom[X]==Y that means rail X holds a merge riser ** coming up from the bottom of the graph from off-screen check-in Y ** where Y is the RID. There is no riser on rail X if mergeRiserFrom[X]==0. */ int mergeRiserFrom[GR_MAX_RAIL]; |
︙ | ︙ | |||
389 390 391 392 393 394 395 | ** ** Each node has one primary parent and zero or more "merge" parents. ** A merge parent is a prior check-in from which changes were merged into ** the current check-in. If a merge parent is not in the visible section ** of this graph, then no arrows will be drawn for it, so remove it from ** the aParent[] array. */ | | > > | > > > > > | | | 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 | ** ** Each node has one primary parent and zero or more "merge" parents. ** A merge parent is a prior check-in from which changes were merged into ** the current check-in. If a merge parent is not in the visible section ** of this graph, then no arrows will be drawn for it, so remove it from ** the aParent[] array. */ if( (tmFlags & (TIMELINE_DISJOINT|TIMELINE_XMERGE))!=0 ){ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ for(i=1; i<pRow->nParent; i++){ if( hashFind(p, pRow->aParent[i])==0 ){ memmove(pRow->aParent+i, pRow->aParent+i+1, sizeof(pRow->aParent[0])*(pRow->nParent-i-1)); pRow->nParent--; if( i<pRow->nNonCherrypick ){ pRow->nNonCherrypick--; }else{ pRow->nCherrypick--; } i--; } } } } /* If the primary parent is in a different branch, but there are ** other parents in the same branch, reorder the parents to make ** the parent from the same branch the primary parent. */ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->isDup ) continue; if( pRow->nNonCherrypick<2 ) continue; /* Not a fork */ pParent = hashFind(p, pRow->aParent[0]); if( pParent==0 ) continue; /* Parent off-screen */ if( pParent->zBranch==pRow->zBranch ) continue; /* Same branch */ for(i=1; i<pRow->nNonCherrypick; i++){ pParent = hashFind(p, pRow->aParent[i]); if( pParent && pParent->zBranch==pRow->zBranch ){ int t = pRow->aParent[0]; pRow->aParent[0] = pRow->aParent[i]; pRow->aParent[i] = t; break; } |
︙ | ︙ | |||
438 439 440 441 442 443 444 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->isDup ) continue; if( pRow->nParent<=0 ) continue; /* Root node */ pParent = hashFind(p, pRow->aParent[0]); if( pParent==0 ) continue; /* Parent off-screen */ if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */ if( pParent->idx <= pRow->idx ){ | | | < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > < < < < < < | < < < > | | | 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 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->isDup ) continue; if( pRow->nParent<=0 ) continue; /* Root node */ pParent = hashFind(p, pRow->aParent[0]); if( pParent==0 ) continue; /* Parent off-screen */ if( pParent->zBranch!=pRow->zBranch ) continue; /* Different branch */ if( pParent->idx <= pRow->idx ){ pParent->timeWarp = 1; nTimewarp++; }else if( pRow->idxTop < pParent->idxTop ){ pParent->pChild = pRow; pParent->idxTop = pRow->idxTop; } } if( tmFlags & TIMELINE_FILLGAPS ){ /* If a node has no pChild and there is a node higher up in the graph ** that is in the same branch and has no in-graph parent, then ** make the lower node a step-child of the upper node. This will ** be represented on the graph by a thick dotted line without an arrowhead. */ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->pChild ) continue; for(pLoop=pRow->pPrev; pLoop; pLoop=pLoop->pPrev){ if( pLoop->nParent>0 && pLoop->zBranch==pRow->zBranch && hashFind(p,pLoop->aParent[0])==0 ){ pRow->pChild = pLoop; pRow->isStepParent = 1; pLoop->aParent[0] = pRow->rid; break; } } } } /* Set the idxTop values for all entries. The idxTop value is the ** "idx" value for the top entry in its stack of children. */ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ GraphRow *pChild = pRow->pChild; if( pChild && pRow->idxTop>pChild->idxTop ){ pRow->idxTop = pChild->idxTop; } } /* Identify rows where the primary parent is off screen. Assign ** each to a rail and draw descenders downward. ** ** Strive to put the "trunk" branch on far left. */ zTrunk = persistBranchName(p, "trunk"); for(i=0; i<2; i++){ for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ if( i==0 && pRow->zBranch!=zTrunk ) continue; if( pRow->iRail>=0 ) continue; if( pRow->isDup ) continue; if( pRow->nParent<0 ) continue; if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){ pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx+riserMargin, 0); if( p->mxRail>=GR_MAX_RAIL ) return; mask = BIT(pRow->iRail); if( !omitDescenders ){ int n = RISER_MARGIN; pRow->bDescender = pRow->nParent>0; for(pLoop=pRow; pLoop && (n--)>0; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } } assignChildrenToRail(pRow, tmFlags); } } } /* Assign rails to all rows that are still unassigned. */ for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
︙ | ︙ | |||
509 510 511 512 513 514 515 | if( p->mxRail>=GR_MAX_RAIL ) return; pRow->railInUse = BIT(pRow->iRail); continue; } if( pParent->idx>pRow->idx ){ /* Common case: Child occurs after parent and is above the ** parent in the timeline */ | | > | > > | | > > > > > > | 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 | if( p->mxRail>=GR_MAX_RAIL ) return; pRow->railInUse = BIT(pRow->iRail); continue; } if( pParent->idx>pRow->idx ){ /* Common case: Child occurs after parent and is above the ** parent in the timeline */ pRow->iRail = findFreeRail(p, pRow->idxTop, pParent->idx, pParent->iRail); if( p->mxRail>=GR_MAX_RAIL ) return; pParent->aiRiser[pRow->iRail] = pRow->idx; }else{ /* Timewarp case: Child occurs earlier in time than parent and ** appears below the parent in the timeline. */ int iDownRail = ++p->mxRail; if( iDownRail<1 ) iDownRail = ++p->mxRail; pRow->iRail = ++p->mxRail; if( p->mxRail>=GR_MAX_RAIL ) return; pRow->railInUse = BIT(pRow->iRail); pParent->aiRiser[iDownRail] = pRow->idx; mask = BIT(iDownRail); for(pLoop=p->pFirst; pLoop; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } } } mask = BIT(pRow->iRail); pRow->railInUse |= mask; if( pRow->pChild ){ assignChildrenToRail(pRow, tmFlags); }else if( !omitDescenders && count_nonbranch_children(pRow->rid)!=0 ){ if( !pRow->timeWarp ) riser_to_top(pRow); } if( pParent ){ if( pParent->idx>pRow->idx ){ /* Common case: Parent is below current row in the graph */ for(pLoop=pParent->pPrev; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){ pLoop->railInUse |= mask; } }else{ /* Timewarp case: Parent is above current row in the graph */ for(pLoop=pParent->pNext; pLoop && pLoop!=pRow; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } } } } /* ** Insert merge rails and merge arrows */ |
︙ | ︙ | |||
558 559 560 561 562 563 564 | for(j=0; j<GR_MAX_RAIL; j++){ if( mergeRiserFrom[j]==parentRid ){ iMrail = j; break; } } if( iMrail==-1 ){ | | > > > > | | > | | > > > > > > > > > > > > > > > > > > > > > > | 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 | for(j=0; j<GR_MAX_RAIL; j++){ if( mergeRiserFrom[j]==parentRid ){ iMrail = j; break; } } if( iMrail==-1 ){ iMrail = findFreeRail(p, pRow->idx, p->pLast->idx, 0); if( p->mxRail>=GR_MAX_RAIL ) return; mergeRiserFrom[iMrail] = parentRid; } mask = BIT(iMrail); if( i>=pRow->nNonCherrypick ){ pRow->mergeIn[iMrail] = 2; pRow->cherrypickDown |= mask; }else{ pRow->mergeIn[iMrail] = 1; pRow->mergeDown |= mask; } for(pLoop=pRow->pNext; pLoop; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } }else{ /* Merge from an on-screen node */ createMergeRiser(p, pDesc, pRow, i>=pRow->nNonCherrypick); if( p->mxRail>=GR_MAX_RAIL ) return; } } } /* ** Insert merge rails from primaries to duplicates. */ if( hasDup ){ int dupRail; int mxRail; find_max_rail(p); mxRail = p->mxRail; dupRail = mxRail+1; if( p->mxRail>=GR_MAX_RAIL ) return; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( !pRow->isDup ) continue; pRow->iRail = dupRail; pDesc = hashFind(p, pRow->rid); assert( pDesc!=0 && pDesc!=pRow ); createMergeRiser(p, pDesc, pRow, 0); if( pDesc->mergeOut>mxRail ) mxRail = pDesc->mergeOut; } if( dupRail<=mxRail ){ dupRail = mxRail+1; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->isDup ) pRow->iRail = dupRail; } } if( mxRail>=GR_MAX_RAIL ) return; } /* ** Find the maximum rail number. */ find_max_rail(p); /* ** Compute the rail mapping. */ aMap = p->aiRailMap; for(i=0; i<=p->mxRail; i++) aMap[i] = i; if( zLeftBranch && nTimewarp==0 ){ char *zLeft = persistBranchName(p, zLeftBranch); j = 0; for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ if( pRow->zBranch==zLeft && aMap[pRow->iRail]>=j ){ for(i=0; i<=p->mxRail; i++){ if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++; } aMap[pRow->iRail] = j++; } } cgi_printf("<!-- aiRailMap ="); for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]); cgi_printf(" -->\n"); } p->nErr = 0; } |
Changes to src/graph.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 | /* This module contains javascript needed to render timeline graphs in Fossil. ** ** Prior to sourcing this script, there should be a separate ** <script type='application/json' id='timeline-data-NN'> for each graph, ** each containing JSON like this: ** ** { "iTableId": INTEGER, // Table sequence number (NN) ** "circleNodes": BOOLEAN, // True for circle nodes. False for squares ** "showArrowheads": BOOLEAN, // True for arrowheads. False to omit ** "iRailPitch": INTEGER, // Spacing between vertical lines (px) ** "colorGraph": BOOLEAN, // True to put color on graph lines ** "nomo": BOOLEAN, // True to join merge lines with rails ** "iTopRow": INTEGER, // Index of top-most row in the graph ** "omitDescenders": BOOLEAN, // Omit ancestor lines off bottom of screen ** "fileDiff": BOOLEAN, // True for file diff. False for check-in ** "scrollToSelect": BOOLEAN, // Scroll to selection on first render ** "nrail": INTEGER, // Number of vertical "rails" ** "baseUrl": TEXT, // Top-level URL ** "rowinfo": ROWINFO-ARRAY } ** ** The rowinfo field is an array of structures, one per entry in the timeline, ** where each structure has the following fields: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node | > > > > > > | | | | | | > | > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | 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 | /* This module contains javascript needed to render timeline graphs in Fossil. ** ** There can be multiple graphs on a single webpage, but this script is only ** loaded once. ** ** Prior to sourcing this script, there should be a separate ** <script type='application/json' id='timeline-data-NN'> for each graph, ** each containing JSON like this: ** ** { "iTableId": INTEGER, // Table sequence number (NN) ** "circleNodes": BOOLEAN, // True for circle nodes. False for squares ** "showArrowheads": BOOLEAN, // True for arrowheads. False to omit ** "iRailPitch": INTEGER, // Spacing between vertical lines (px) ** "colorGraph": BOOLEAN, // True to put color on graph lines ** "nomo": BOOLEAN, // True to join merge lines with rails ** "iTopRow": INTEGER, // Index of top-most row in the graph ** "omitDescenders": BOOLEAN, // Omit ancestor lines off bottom of screen ** "fileDiff": BOOLEAN, // True for file diff. False for check-in ** "scrollToSelect": BOOLEAN, // Scroll to selection on first render ** "nrail": INTEGER, // Number of vertical "rails" ** "baseUrl": TEXT, // Top-level URL ** "dwellTimeout": INTEGER, // Tooltip show delay in milliseconds ** "closeTimeout": INTEGER, // Tooltip close delay in milliseconds ** "hashDigits": INTEGER, // Limit of tooltip hashes ("hash-digits") ** "rowinfo": ROWINFO-ARRAY } ** ** The rowinfo field is an array of structures, one per entry in the timeline, ** where each structure has the following fields: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node ** is iTopRow and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. ** d: If exists and true then there is a "descender" - an arrow ** coming from the bottom of the page straight up to this node. ** mo: "merge-out". If it exists, this is the rail position ** for the upward portion of a merge arrow. The merge arrow goes as ** a solid normal merge line up to the row identified by "mu" and ** then as a dashed cherrypick merge line up further to "cu". ** If this value is omitted if there are no merge children. ** mu: The id of the row which is the top of the merge-out arrow. ** Only exists if "mo" exists. ** cu: Extend the mu merge arrow up to this row as a cherrypick ** merge line, if this value exists. ** u: Draw a thick child-line out of the top of this node and up to ** the node with an id equal to this value. 0 if it is straight to ** the top of the page, -1 if there is no thick-line riser. ** f: 0x01: a leaf node. ** au: An array of integers that define thick-line risers for branches. ** The integers are in pairs. For each pair, the first integer is ** is the rail on which the riser should run and the second integer ** is the id of the node upto which the riser should run. If there ** are no risers, this array does not exist. ** mi: "merge-in". An array of integer rail positions from which ** merge arrows should be drawn into this node. If the value is ** negative, then the rail position is the absolute value of mi[] ** and a thin merge-arrow descender is drawn to the bottom of ** the screen. This array is omitted if there are no inbound ** merges. ** ci: "cherrypick-in". Like "mi" except for cherrypick merges. ** omitted if there are no cherrypick merges. ** h: The artifact hash of the object being graphed */ /* The amendCss() function does a one-time change to the CSS to account ** for the "circleNodes" and "showArrowheads" settings. Do this change ** only once, even if there are multiple graphs being rendered. */ var amendCssOnce = 1; // Only change the CSS one time function amendCss(circleNodes,showArrowheads){ if( !amendCssOnce ) return; var css = ""; if( circleNodes ){ css += ".tl-node, .tl-node:after { border-radius: 50%; }"; } if( !showArrowheads ){ css += ".tl-arrow.u { display: none; }"; } if( css!=="" ){ var style = document.createElement("style"); style.textContent = css; document.querySelector("head").appendChild(style); } amendCssOnce = 0; } /* The <span> object that holds the tooltip */ var tooltipObj = document.createElement("span"); tooltipObj.className = "tl-tooltip"; tooltipObj.style.display = "none"; document.getElementsByClassName("content")[0].appendChild(tooltipObj); tooltipObj.onmouseenter = function(){ /* Hold the tooltip constant as long as the mouse is over the tooltip. ** In other words, do not let any of the timers changes the tooltip while ** the mouse is directly over the tooltip. This makes it easier for the ** user to move over top of the "copy-button" or the hyperlink to the ** /info page. */ stopCloseTimer(); stopDwellTimer(); tooltipInfo.ixHover = tooltipInfo.ixActive; } tooltipObj.onmouseleave = function(){ if (tooltipInfo.ixActive != -1) resumeCloseTimer(); }; /* State information for the tooltip popup and its timers */ window.tooltipInfo = { dwellTimeout: 250, /* The tooltip dwell timeout. */ closeTimeout: 3000, /* The tooltip close timeout. */ hashDigits: 16, /* Limit of tooltip hashes ("hash-digits"). */ idTimer: 0, /* The tooltip dwell timer id */ idTimerClose: 0, /* The tooltip close timer id */ ixHover: -1, /* The mouse is over a thick riser arrow for ** tx.rowinfo[ixHover]. Or -2 when the mouse is ** over a graph node. Or -1 when the mouse is not ** over anything. */ ixActive: -1, /* The item shown in the tooltip is tx.rowinfo[ixActive]. ** ixActive is -1 if the tooltip is not visible */ nodeHover: null, /* Graph node under mouse when ixHover==-2 */ idNodeActive: 0, /* Element ID of the graph node with the tooltip. */ posX: 0, posY: 0 /* The last mouse position. */ }; /* Functions used to control the tooltip popup and its timer */ function onKeyDown(event){ /* Hide the tooltip when ESC key pressed */ var key = event.which || event.keyCode; if( key==27 ){ event.stopPropagation(); hideGraphTooltip(); } } function hideGraphTooltip(){ /* Hide the tooltip */ document.removeEventListener('keydown',onKeyDown,/* useCapture == */true); stopCloseTimer(); tooltipObj.style.display = "none"; tooltipInfo.ixActive = -1; tooltipInfo.idNodeActive = 0; } document.body.onunload = hideGraphTooltip function stopDwellTimer(){ if(tooltipInfo.idTimer!=0){ clearTimeout(tooltipInfo.idTimer); tooltipInfo.idTimer = 0; } } function resumeCloseTimer(){ /* This timer must be stopped explicitly to reset the elapsed timeout. */ if(tooltipInfo.idTimerClose==0 && tooltipInfo.closeTimeout>0) { tooltipInfo.idTimerClose = setTimeout(function(){ tooltipInfo.idTimerClose = 0; hideGraphTooltip(); },tooltipInfo.closeTimeout); } } function stopCloseTimer(){ if(tooltipInfo.idTimerClose!=0){ clearTimeout(tooltipInfo.idTimerClose); tooltipInfo.idTimerClose = 0; } } /* Construct that graph corresponding to the timeline-data-N object that ** is passed in by the tx parameter */ function TimelineGraph(tx){ var topObj = document.getElementById("timelineTable"+tx.iTableId); amendCss(tx.circleNodes, tx.showArrowheads); tooltipInfo.dwellTimeout = tx.dwellTimeout tooltipInfo.closeTimeout = tx.closeTimeout tooltipInfo.hashDigits = tx.hashDigits topObj.onclick = clickOnGraph topObj.ondblclick = dblclickOnGraph topObj.onmousemove = function(e) { var ix = findTxIndex(e); topObj.style.cursor = (ix<0) ? "" : "pointer" mouseOverGraph(e,ix,null); }; topObj.onmouseleave = function(e) { /* Hide the tooltip if the mouse is outside the "timelineTableN" element, ** and outside the tooltip. */ if(e.relatedTarget && e.relatedTarget != tooltipObj){ tooltipInfo.ixHover = -1; hideGraphTooltip(); stopDwellTimer(); stopCloseTimer(); } }; function mouseOverNode(e){ /* Invoked by mousemove events over a graph node */ e.stopPropagation() mouseOverGraph(e,-2,this) } /* Combined mousemove handler for graph nodes and rails. */ function mouseOverGraph(e,ix,node){ stopDwellTimer(); // Mouse movement: reset the dwell timer. var ownTooltip = // Check if the hovered element already has the tooltip. (ix>=0 && ix==tooltipInfo.ixActive) || (ix==-2 && tooltipInfo.idNodeActive==node.id); if(ownTooltip) stopCloseTimer(); // ownTooltip: clear the close timer. else resumeCloseTimer(); // !ownTooltip: resume the close timer. tooltipInfo.ixHover = ix; tooltipInfo.nodeHover = node; tooltipInfo.posX = e.clientX; tooltipInfo.posY = e.clientY; if(ix!=-1 && !ownTooltip && tooltipInfo.dwellTimeout>0){ // Go dwell timer. tooltipInfo.idTimer = setTimeout(function(){ tooltipInfo.idTimer = 0; stopCloseTimer(); showGraphTooltip(); },tooltipInfo.dwellTimeout); } } var canvasDiv; var railPitch; var mergeOffset; var node, arrow, arrowSmall, line, mArrow, mLine, wArrow, wLine; function initGraph(){ var parent = topObj.rows[0].cells[1]; parent.style.verticalAlign = "top"; canvasDiv = document.createElement("div"); canvasDiv.className = "tl-canvas"; canvasDiv.style.position = "absolute"; parent.appendChild(canvasDiv); var elems = {}; var elemClasses = [ "rail", "mergeoffset", "node", "arrow u", "arrow u sm", "line", "arrow merge r", "line merge", "arrow warp", "line warp", "line cherrypick", "line dotted" ]; for( var i=0; i<elemClasses.length; i++ ){ var cls = elemClasses[i]; var elem = document.createElement("div"); elem.className = "tl-" + cls; if( cls.indexOf("line")==0 ) elem.className += " v"; canvasDiv.appendChild(elem); var k = cls.replace(/\s/g, "_"); var r = elem.getBoundingClientRect(); var w = Math.round(r.right - r.left); var h = Math.round(r.bottom - r.top); elems[k] = {w: w, h: h, cls: cls}; } node = elems.node; arrow = elems.arrow_u; arrowSmall = elems.arrow_u_sm; line = elems.line; mArrow = elems.arrow_merge_r; mLine = elems.line_merge; cpLine = elems.line_cherrypick; wArrow = elems.arrow_warp; wLine = elems.line_warp; dotLine = elems.line_dotted; var minRailPitch = Math.ceil((node.w+line.w)/2 + mArrow.w + 1); if( window.innerWidth<400 ){ railPitch = minRailPitch; }else{ if( tx.iRailPitch>0 ){ railPitch = tx.iRailPitch; |
︙ | ︙ | |||
150 151 152 153 154 155 156 | if( h ) n.style.height = h+"px"; if( color ) n.style.backgroundColor = color; n.className = "tl-"+cls; canvasDiv.appendChild(n); return n; } function absoluteY(obj){ | | < | | | > | > > > > > | | | | > | > > > > > > > > > > > > > > > > > > | < > > > > > > | > | > | > > > > > > > > > > | > > > > | > > > | > > | | > > > > > | > > > > | | > > > > > > > | > > > > > > > | | | | | | | | | | | > | | | > | | > | > | > | | | > | | | > > | | | | | | > | > | | > > > > > > > > > > > > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | if( h ) n.style.height = h+"px"; if( color ) n.style.backgroundColor = color; n.className = "tl-"+cls; canvasDiv.appendChild(n); return n; } function absoluteY(obj){ var y = 0; do{ y += obj.offsetTop; }while( obj = obj.offsetParent ); return y; } function absoluteX(obj){ var x = 0; do{ x += obj.offsetLeft; }while( obj = obj.offsetParent ); return x; } function miLineY(p){ return p.y + node.h - mLine.w - 1; } function drawLine(elem,color,x0,y0,x1,y1){ var cls = elem.cls + " "; if( x1===null ){ x1 = x0+elem.w; cls += "v"; }else{ y1 = y0+elem.w; cls += "h"; } return drawBox(cls,color,x0,y0,x1,y1); } function drawUpArrow(from,to,color,id){ var y = to.y + node.h; var arrowSpace = from.y - y + (!from.id || from.r!=to.r ? node.h/2 : 0); var arw = arrowSpace < arrow.h*1.5 ? arrowSmall : arrow; var x = to.x + (node.w-line.w)/2; var y0 = from.y + node.h/2; var y1 = Math.ceil(to.y + node.h + arw.h/2); var n = drawLine(line,color,x,y0,null,y1); addToolTip(n,id) x = to.x + (node.w-arw.w)/2; n = drawBox(arw.cls,null,x,y); if(color) n.style.borderBottomColor = color; addToolTip(n,id) } function drawDotted(from,to,color,id){ var x = to.x + (node.w-line.w)/2; var y0 = from.y + node.h/2; var y1 = Math.ceil(to.y + node.h); var n = drawLine(dotLine,null,x,y0,null,y1) if( color ) n.style.borderColor = color addToolTip(n,id) } function addToolTip(n,id){ if( id ) n.setAttribute("data-ix",id-tx.iTopRow) } /* Draw thin horizontal or vertical lines representing merges */ function drawMergeLine(x0,y0,x1,y1){ drawLine(mLine,null,x0,y0,x1,y1); } function drawCherrypickLine(x0,y0,x1,y1){ drawLine(cpLine,null,x0,y0,x1,y1); } /* Draw an arrow representing an in-bound merge from the "rail"-th rail ** over to the node of "p". Make is a checkpoint merge is "isCP" is true */ function drawMergeArrow(p,rail,isCP){ var x0 = rail*railPitch + node.w/2; if( rail in mergeLines ){ x0 += mergeLines[rail]; if( p.r<rail ) x0 += mLine.w; }else{ x0 += (p.r<rail ? -1 : 1)*line.w/2; } var x1 = mArrow.w ? mArrow.w/2 : -node.w/2; x1 = p.x + (p.r<rail ? node.w + Math.ceil(x1) : -x1); var y = miLineY(p); var x = p.x + (p.r<rail ? node.w : -mArrow.w); var cls; if( isCP ){ drawCherrypickLine(x0,y,x1,null); cls = "arrow cherrypick " + (p.r<rail ? "l" : "r"); }else{ drawMergeLine(x0,y,x1,null); cls = "arrow merge " + (p.r<rail ? "l" : "r"); } drawBox(cls,null,x,y+(mLine.w-mArrow.h)/2); } function drawNode(p, btm){ if( p.bg ){ var e = document.getElementById("mc"+p.id); if(e) e.style.backgroundColor = p.bg; e = document.getElementById("md"+p.id); if(e) e.style.backgroundColor = p.bg; } if( p.r<0 ) return; if( p.u>0 ) drawUpArrow(p,tx.rowinfo[p.u-tx.iTopRow],p.fg,p.id); if( p.sb>0 ) drawDotted(p,tx.rowinfo[p.sb-tx.iTopRow],p.fg,p.id); var cls = node.cls; if( p.hasOwnProperty('mi') && p.mi.length ) cls += " merge"; if( p.f&1 ) cls += " leaf"; var n = drawBox(cls,p.bg,p.x,p.y); n.id = "tln"+p.id; n.onclick = clickOnNode; n.ondblclick = dblclickOnNode; n.onmousemove = mouseOverNode; n.style.zIndex = 10; if( !tx.omitDescenders ){ if( p.u==0 ){ if( p.hasOwnProperty('mo') && p.r==p.mo ){ var ix = p.hasOwnProperty('cu') ? p.cu : p.mu; var top = tx.rowinfo[ix-tx.iTopRow] drawUpArrow(p,{x: p.x, y: top.y-node.h}, p.fg, p.id); }else if( p.y>100 ){ drawUpArrow(p,{x: p.x, y: p.y-50}, p.fg, p.id); }else{ drawUpArrow(p,{x: p.x, y: 0},p.fg, p.id); } } if( p.hasOwnProperty('d') ){ if( p.y + 150 >= btm ){ drawUpArrow({x: p.x, y: btm - node.h/2},p,p.fg,p.id); }else{ drawUpArrow({x: p.x, y: p.y+50},p,p.fg,p.id); drawDotted({x: p.x, y: p.y+63},{x: p.x, y: p.y+50-node.h/2},p.fg,p.id); } } } if( p.hasOwnProperty('mo') ){ var x0 = p.x + node.w/2; var x1 = p.mo*railPitch + node.w/2; var u = tx.rowinfo[p.mu-tx.iTopRow]; var y1 = miLineY(u); if( p.u<=0 || p.mo!=p.r ){ if( p.u==0 && p.mo==p.r ){ mergeLines[p.mo] = u.r<p.r ? -mergeOffset-mLine.w : mergeOffset; }else{ mergeLines[p.mo] = -mLine.w/2; } x1 += mergeLines[p.mo] var y0 = p.y+2; if( p.mu==p.id ){ drawCherrypickLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); y1 = y0; }else{ drawMergeLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); drawMergeLine(x1,y0+mLine.w,null,y1); } if( p.hasOwnProperty('cu') ){ var u2 = tx.rowinfo[p.cu-tx.iTopRow]; var y2 = miLineY(u2); drawCherrypickLine(x1,y1,null,y2); } }else if( mergeOffset ){ mergeLines[p.mo] = u.r<p.r ? -mergeOffset-mLine.w : mergeOffset; x1 += mergeLines[p.mo]; if( p.mu<p.id ){ drawMergeLine(x1,p.y+node.h/2,null,y1); } if( p.hasOwnProperty('cu') ){ var u2 = tx.rowinfo[p.cu-tx.iTopRow]; var y2 = miLineY(u2); drawCherrypickLine(x1,y1,null,y2); } }else{ delete mergeLines[p.mo]; } } if( p.hasOwnProperty('au') ){ for( var i=0; i<p.au.length; i+=2 ){ var rail = p.au[i]; var x0 = p.x + node.w/2; var x1 = rail*railPitch + (node.w-line.w)/2; if( x0<x1 ){ x0 = Math.ceil(x0); x1 += line.w; } var y0 = p.y + (node.h-line.w)/2; var u = tx.rowinfo[p.au[i+1]-tx.iTopRow]; if( u.id<p.id ){ // normal thick up-arrow drawLine(line,u.fg,x0,y0,x1,null); drawUpArrow(p,u,u.fg,u.id); }else{ // timewarp: The child node occurs before the parent var y1 = u.y + (node.h-line.w)/2; var n = drawLine(wLine,u.fg,x0,y0,x1,null); addToolTip(n,u.id) n = drawLine(wLine,u.fg,x1-line.w,y0,null,y1+line.w); addToolTip(n,u.id) n = drawLine(wLine,u.fg,x1,y1,u.x-wArrow.w/2,null); addToolTip(n,u.id) var x = u.x-wArrow.w; var y = u.y+(node.h-wArrow.h)/2; n = drawBox(wArrow.cls,null,x,y); addToolTip(n,u.id) if( u.fg ) n.style.borderLeftColor = u.fg; } } } if( p.hasOwnProperty('mi') ){ for( var i=0; i<p.mi.length; i++ ){ var rail = p.mi[i]; if( rail<0 ){ rail = -rail; mergeLines[rail] = -mLine.w/2; var x = rail*railPitch + (node.w-mLine.w)/2; var y = miLineY(p); drawMergeLine(x,y,null,mergeBtm[rail]); mergeBtm[rail] = y; } drawMergeArrow(p,rail,0); } } if( p.hasOwnProperty('ci') ){ for( var i=0; i<p.ci.length; i++ ){ var rail = p.ci[i]; if( rail<0 ){ rail = -rail; mergeLines[rail] = -mLine.w/2; var x = rail*railPitch + (node.w-mLine.w)/2; var y = miLineY(p); drawCherrypickLine(x,y,null,mergeBtm[rail]); mergeBtm[rail] = y; } drawMergeArrow(p,rail,1); } } } var mergeLines; var mergeBtm = new Array; function renderGraph(){ mergeLines = {}; canvasDiv.innerHTML = ""; var canvasY = absoluteY(canvasDiv); for(var i=0; i<tx.rowinfo.length; i++ ){ var e = document.getElementById("m"+tx.rowinfo[i].id); tx.rowinfo[i].y = absoluteY(e) - canvasY; tx.rowinfo[i].x = tx.rowinfo[i].r*railPitch; } var tlBtm = document.getElementById(tx.bottomRowId); if( tlBtm.offsetHeight<node.h ){ tlBtm.style.height = node.h + "px"; } var btm = absoluteY(tlBtm) - canvasY + tlBtm.offsetHeight; for( var i=0; i<tx.nrail; i++) mergeBtm[i] = btm; for( var i=tx.rowinfo.length-1; i>=0; i-- ){ drawNode(tx.rowinfo[i], btm); } } var selRow; function clickOnNode(e){ hideGraphTooltip() var p = tx.rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-tx.iTopRow]; if( !selRow ){ selRow = p; this.className += " sel"; canvasDiv.className += " sel"; }else if( selRow==p ){ selRow = null; this.className = this.className.replace(" sel", ""); canvasDiv.className = canvasDiv.className.replace(" sel", ""); }else{ if( tx.fileDiff ){ location.href=tx.baseUrl + "/fdiff?v1="+selRow.h+"&v2="+p.h }else{ location.href=tx.baseUrl + "/vdiff?from="+selRow.h+"&to="+p.h } } e.stopPropagation() } function dblclickOnNode(e){ var p = tx.rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-tx.iTopRow]; window.location.href = tx.baseUrl+"/info/"+p.h e.stopPropagation() } function findTxIndex(e){ if( !tx.rowinfo ) return -1; /* Look at all the graph elements. If any graph elements that is near ** the click-point "e" and has a "data-ix" attribute, then return ** the value of that attribute. Otherwise return -1 */ var x = e.clientX + window.pageXOffset - absoluteX(canvasDiv); var y = e.clientY + window.pageYOffset - absoluteY(canvasDiv); var aNode = canvasDiv.childNodes var nNode = aNode.length; var i; for(i=0;i<nNode;i++){ var n = aNode[i] if( !n.hasAttribute("data-ix") ) continue; if( x<n.offsetLeft-5 ) continue; if( x>n.offsetLeft+n.offsetWidth+5 ) continue; if( y<n.offsetTop-5 ) continue; if( y>n.offsetTop+n.offsetHeight ) continue; return n.getAttribute("data-ix") } return -1 } /* Compute the hyperlink for the branch graph for tx.rowinfo[ix] */ function branchHyperlink(ix){ var br = tx.rowinfo[ix].br var dest = tx.baseUrl + "/timeline?r=" + encodeURIComponent(br) dest += tx.fileDiff ? "&m&cf=" : "&m&c=" dest += encodeURIComponent(tx.rowinfo[ix].h) return dest } function clickOnGraph(e){ stopCloseTimer(); stopDwellTimer(); tooltipInfo.ixHover = findTxIndex(e); tooltipInfo.posX = e.clientX; tooltipInfo.posY = e.clientY; showGraphTooltip(); } function showGraphTooltip(){ var html = null var ix = -1 if( tooltipInfo.ixHover==-2 ){ ix = parseInt(tooltipInfo.nodeHover.id.match(/\d+$/)[0],10)-tx.iTopRow var h = tx.rowinfo[ix].h var dest = tx.baseUrl + "/info/" + h h = h.slice(0,tooltipInfo.hashDigits); // Assume single-byte characters. if( tx.fileDiff ){ html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>" }else{ html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>" } tooltipInfo.ixActive = -2; tooltipInfo.idNodeActive = tooltipInfo.nodeHover.id; }else if( tooltipInfo.ixHover>=0 ){ ix = tooltipInfo.ixHover var br = tx.rowinfo[ix].br var dest = branchHyperlink(ix) var hbr = br.replace(/&/g, "&") .replace(/</g, "<") .replace(/>/g, ">") .replace(/"/g, """) .replace(/'/g, "'"); html = "branch <a id=\"tooltip-link\" href=\""+dest+"\">"+hbr+"</a>" tooltipInfo.ixActive = ix; tooltipInfo.idNodeActive = 0; } if( html ){ /* Setup while hidden, to ensure proper dimensions. */ var s = getComputedStyle(document.body) if( tx.rowinfo[ix].bg.length ){ tooltipObj.style.backgroundColor = tx.rowinfo[ix].bg }else{ tooltipObj.style.backgroundColor = s.getPropertyValue('background-color') } tooltipObj.style.borderColor = tooltipObj.style.color = s.getPropertyValue('color') tooltipObj.style.visibility = "hidden" tooltipObj.innerHTML = html tooltipObj.insertBefore(makeCopyButton("tooltip-link",0,0), tooltipObj.childNodes[1]); tooltipObj.style.display = "inline" tooltipObj.style.position = "absolute" var x = tooltipInfo.posX + 4 + window.pageXOffset - absoluteX(tooltipObj.offsetParent) tooltipObj.style.left = x+"px" var y = tooltipInfo.posY + window.pageYOffset - tooltipObj.clientHeight - 4 - absoluteY(tooltipObj.offsetParent) tooltipObj.style.top = y+"px" tooltipObj.style.visibility = "visible" document.addEventListener('keydown',onKeyDown,/* useCapture == */true); }else{ hideGraphTooltip() } } function dblclickOnGraph(e){ var ix = findTxIndex(e); hideGraphTooltip() if( ix>=0 ){ var dest = branchHyperlink(ix) window.location.href = dest } } function changeDisplay(selector,value){ var x = document.getElementsByClassName(selector); var n = x.length; for(var i=0; i<n; i++) {x[i].style.display = value;} } function changeDisplayById(id,value){ |
︙ | ︙ | |||
388 389 390 391 392 393 394 395 396 397 398 399 400 401 | lx = topObj.getElementsByClassName('timelineDateRow'); for(i=0; i<lx.length; i++){ var rx = lx[i]; if( rx.getAttribute('data-reordered') ) break; rx.setAttribute('data-reordered',1); rx.appendChild(rx.firstChild); rx.insertBefore(rx.childNodes[1],rx.firstChild); } } } /* Look for all timeline-data-NN objects. Load each one and draw ** a graph for each one. */ | > > > > > > > | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | lx = topObj.getElementsByClassName('timelineDateRow'); for(i=0; i<lx.length; i++){ var rx = lx[i]; if( rx.getAttribute('data-reordered') ) break; rx.setAttribute('data-reordered',1); rx.appendChild(rx.firstChild); rx.insertBefore(rx.childNodes[1],rx.firstChild); } /* Do not show the HH:MM timestamps on very narrow displays ** as they take up too much horizontal space. */ lx = topObj.getElementsByClassName('timelineHistLink'); for(i=0; i<lx.length; i++){ var rx = lx[i]; rx.style.display="none"; } } } /* Look for all timeline-data-NN objects. Load each one and draw ** a graph for each one. */ |
︙ | ︙ |
Changes to src/hname.c.
︙ | ︙ | |||
214 215 216 217 218 219 220 | return HPOLICY_AUTO; } } /* ** Names of the hash policies. */ | | | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | return HPOLICY_AUTO; } } /* ** Names of the hash policies. */ static const char *const azPolicy[] = { "sha1", "auto", "sha3", "sha3-only", "shun-sha1" }; /* Return the name of the current hash policy. */ const char *hpolicy_name(void){ return azPolicy[g.eHashPolicy]; |
︙ | ︙ |
Changes to src/href.js.
︙ | ︙ | |||
32 33 34 35 36 37 38 | function antiRobotDefense(){ var x = document.getElementById("href-data"); var jx = x.textContent || x.innerText; var g = JSON.parse(jx); var isOperaMini = Object.prototype.toString.call(window.operamini)==="[object OperaMini]"; if(g.mouseover && !isOperaMini){ | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | function antiRobotDefense(){ var x = document.getElementById("href-data"); var jx = x.textContent || x.innerText; var g = JSON.parse(jx); var isOperaMini = Object.prototype.toString.call(window.operamini)==="[object OperaMini]"; if(g.mouseover && !isOperaMini){ document.getElementsByTagName("body")[0].onmousemove=function(){ setTimeout(setAllHrefs, g.delay); } }else{ setTimeout(setAllHrefs, g.delay); } } antiRobotDefense(); |
Changes to src/http.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #define isatty(d) _isatty(d) #endif #ifndef fileno #define fileno(s) _fileno(s) #endif #endif /* Maximum number of HTTP Authorization attempts */ #define MAX_HTTP_AUTH 2 /* Keep track of HTTP Basic Authorization failures */ static int fSeenHttpAuth = 0; /* | > > > > > > > > > > > > | 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 | #define isatty(d) _isatty(d) #endif #ifndef fileno #define fileno(s) _fileno(s) #endif #endif #if INTERFACE /* ** Bits of the mHttpFlags parameter to http_exchange() */ #define HTTP_USE_LOGIN 0x00001 /* Add a login card to the sync message */ #define HTTP_GENERIC 0x00002 /* Generic HTTP request */ #define HTTP_VERBOSE 0x00004 /* HTTP status messages */ #define HTTP_QUIET 0x00008 /* No surplus output */ #define HTTP_NOCOMPRESS 0x00010 /* Omit payload compression */ #endif /* Maximum number of HTTP Authorization attempts */ #define MAX_HTTP_AUTH 2 /* Keep track of HTTP Basic Authorization failures */ static int fSeenHttpAuth = 0; /* |
︙ | ︙ | |||
95 96 97 98 99 100 101 | } /* ** Construct an appropriate HTTP request header. Write the header ** into pHdr. This routine initializes the pHdr blob. pPayload is ** the complete payload (including the login card) already compressed. */ | | | > | > > > | | < < < < < > > > | | | | | | > > | 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 | } /* ** Construct an appropriate HTTP request header. Write the header ** into pHdr. This routine initializes the pHdr blob. pPayload is ** the complete payload (including the login card) already compressed. */ static void http_build_header( Blob *pPayload, /* the payload that will be sent */ Blob *pHdr, /* construct the header here */ const char *zAltMimetype /* Alternative mimetype */ ){ int nPayload = pPayload ? blob_size(pPayload) : 0; blob_zero(pHdr); blob_appendf(pHdr, "%s %s%s HTTP/1.0\r\n", nPayload>0 ? "POST" : "GET", g.url.path, g.url.path[0]==0 ? "/" : ""); if( g.url.proxyAuth ){ blob_appendf(pHdr, "Proxy-Authorization: %s\r\n", g.url.proxyAuth); } if( g.zHttpAuth && g.zHttpAuth[0] ){ const char *zCredentials = g.zHttpAuth; char *zEncoded = encode64(zCredentials, -1); blob_appendf(pHdr, "Authorization: Basic %s\r\n", zEncoded); fossil_free(zEncoded); } blob_appendf(pHdr, "Host: %s\r\n", g.url.hostname); blob_appendf(pHdr, "User-Agent: %s\r\n", get_user_agent()); if( g.url.isSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); if( nPayload ){ if( zAltMimetype ){ blob_appendf(pHdr, "Content-Type: %s\r\n", zAltMimetype); }else if( g.fHttpTrace ){ blob_appendf(pHdr, "Content-Type: application/x-fossil-debug\r\n"); }else{ blob_appendf(pHdr, "Content-Type: application/x-fossil\r\n"); } blob_appendf(pHdr, "Content-Length: %d\r\n", blob_size(pPayload)); } blob_append(pHdr, "\r\n", 2); } /* ** Use Fossil credentials for HTTP Basic Authorization prompt */ static int use_fossil_creds_for_httpauth_prompt(void){ Blob x; |
︙ | ︙ | |||
198 199 200 201 202 203 204 | ** in pRecv. pRecv is assumed to be uninitialized when ** this routine is called - this routine will initialize it. ** ** The server address is contain in the "g" global structure. The ** url_parse() routine should have been called prior to this routine ** in order to fill this structure appropriately. */ | | > > > > > > > > > | | | | | | | | > | | 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 | ** in pRecv. pRecv is assumed to be uninitialized when ** this routine is called - this routine will initialize it. ** ** The server address is contain in the "g" global structure. The ** url_parse() routine should have been called prior to this routine ** in order to fill this structure appropriately. */ int http_exchange( Blob *pSend, /* Message to be sent */ Blob *pReply, /* Write the reply here */ int mHttpFlags, /* Flags. See above */ int maxRedirect, /* Max number of redirects */ const char *zAltMimetype /* Alternative mimetype if not NULL */ ){ Blob login; /* The login card */ Blob payload; /* The complete payload including login card */ Blob hdr; /* The HTTP request header */ int closeConnection; /* True to close the connection when done */ int iLength; /* Expected length of the reply payload */ int iRecvLen; /* Received length of the reply payload */ int rc = 0; /* Result code */ int iHttpVersion; /* Which version of HTTP protocol server uses */ char *zLine; /* A single line of the reply header */ int i; /* Loop counter */ int isError = 0; /* True if the reply is an error message */ int isCompressed = 1; /* True if the reply is compressed */ if( transport_open(&g.url) ){ fossil_warning("%s", transport_errmsg(&g.url)); return 1; } /* Construct the login card and prepare the complete payload */ if( blob_size(pSend)==0 ){ blob_zero(&payload); }else{ blob_zero(&login); if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login); if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){ payload = login; blob_append(&payload, blob_buffer(pSend), blob_size(pSend)); }else{ blob_compress2(&login, pSend, &payload); blob_reset(&login); } } /* Construct the HTTP request header */ http_build_header(&payload, &hdr, zAltMimetype); /* When tracing, write the transmitted HTTP message both to standard ** output and into a file. The file can then be used to drive the ** server-side like this: ** ** ./fossil test-http <http-request-1.txt */ |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | transport_log(out); free(zOutFile); } /* ** Send the request to the server. */ transport_send(&g.url, &hdr); transport_send(&g.url, &payload); blob_reset(&hdr); blob_reset(&payload); transport_flip(&g.url); /* ** Read and interpret the server reply */ closeConnection = 1; iLength = -1; while( (zLine = transport_receive_line(&g.url))!=0 && zLine[0]!=0 ){ | > > > > > > | > | > | | | > > | > > > > > > > | > > > | > | > | 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 | transport_log(out); free(zOutFile); } /* ** Send the request to the server. */ if( mHttpFlags & HTTP_VERBOSE ){ fossil_print("URL: %s\n", g.url.canonical); fossil_print("Sending %d byte header and %d byte payload\n", blob_size(&hdr), blob_size(&payload)); } transport_send(&g.url, &hdr); transport_send(&g.url, &payload); blob_reset(&hdr); blob_reset(&payload); transport_flip(&g.url); /* ** Read and interpret the server reply */ closeConnection = 1; iLength = -1; while( (zLine = transport_receive_line(&g.url))!=0 && zLine[0]!=0 ){ if( mHttpFlags & HTTP_VERBOSE ){ fossil_print("Read: [%s]\n", zLine); } if( fossil_strnicmp(zLine, "http/1.", 7)==0 ){ if( sscanf(zLine, "HTTP/1.%d %d", &iHttpVersion, &rc)!=2 ) goto write_err; if( rc==401 ){ if( fSeenHttpAuth++ < MAX_HTTP_AUTH ){ if( g.zHttpAuth ){ if( g.zHttpAuth ) free(g.zHttpAuth); } g.zHttpAuth = prompt_for_httpauth_creds(); transport_close(&g.url); return http_exchange(pSend, pReply, mHttpFlags, maxRedirect, zAltMimetype); } } if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){ int ii; for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} while( zLine[ii]==' ' ) ii++; fossil_warning("server says: %s", &zLine[ii]); goto write_err; } if( iHttpVersion==0 ){ closeConnection = 1; }else{ closeConnection = 0; } }else if( g.url.isSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){ if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err; if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){ int ii; for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} while( zLine[ii]==' ' ) ii++; fossil_warning("server says: %s", &zLine[ii]); goto write_err; } closeConnection = 0; }else if( fossil_strnicmp(zLine, "content-length:", 15)==0 ){ for(i=15; fossil_isspace(zLine[i]); i++){} iLength = atoi(&zLine[i]); }else if( fossil_strnicmp(zLine, "connection:", 11)==0 ){ char c; for(i=11; fossil_isspace(zLine[i]); i++){} c = zLine[i]; if( c=='c' || c=='C' ){ closeConnection = 1; }else if( c=='k' || c=='K' ){ closeConnection = 0; } }else if( ( rc==301 || rc==302 || rc==307 || rc==308 ) && fossil_strnicmp(zLine, "location:", 9)==0 ){ int i, j; int wasHttps; if ( --maxRedirect == 0){ fossil_warning("redirect limit exceeded"); goto write_err; } for(i=9; zLine[i] && zLine[i]==' '; i++){} if( zLine[i]==0 ){ fossil_warning("malformed redirect: %s", zLine); goto write_err; } j = strlen(zLine) - 1; while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){ j -= 4; zLine[j] = 0; } if( (mHttpFlags & HTTP_QUIET)==0 ){ fossil_print("redirect with status %d to %s\n", rc, &zLine[i]); } wasHttps = g.url.isHttps; url_parse(&zLine[i], 0); if( wasHttps && !g.url.isHttps ){ fossil_warning("cannot redirect from HTTPS to HTTP"); goto write_err; } transport_close(&g.url); transport_global_shutdown(&g.url); fSeenHttpAuth = 0; if( g.zHttpAuth ) free(g.zHttpAuth); g.zHttpAuth = get_httpauth(); if( rc==301 || rc==308 ) url_remember(); return http_exchange(pSend, pReply, mHttpFlags, maxRedirect, zAltMimetype); }else if( fossil_strnicmp(zLine, "content-type: ", 14)==0 ){ if( fossil_strnicmp(&zLine[14], "application/x-fossil-debug", -1)==0 ){ isCompressed = 0; }else if( fossil_strnicmp(&zLine[14], "application/x-fossil-uncompressed", -1)==0 ){ isCompressed = 0; }else{ if( (mHttpFlags & HTTP_GENERIC)==0 && fossil_strnicmp(&zLine[14], "application/x-fossil", -1)!=0 ){ isError = 1; } } } } if( iLength<0 ){ fossil_warning("server did not reply"); goto write_err; } |
︙ | ︙ | |||
416 417 418 419 420 421 422 | /* ** Jump to here if an error is seen. */ write_err: transport_close(&g.url); return 1; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* ** Jump to here if an error is seen. */ write_err: transport_close(&g.url); return 1; } /* ** COMMAND: test-httpmsg ** ** Usage: %fossil test-httpmsg URL ?PAYLOAD? ?OPTIONS? ** ** Send an HTTP message to URL and get the reply. PAYLOAD is a file containing ** the payload, or "-" to read payload from standard input. a POST message ** is sent if PAYLOAD is specified and is non-empty. If PAYLOAD is omitted ** or is an empty file, then a GET message is sent. ** ** Options: ** ** --compress Use ZLIB compression on the payload ** --mimetype TYPE Mimetype of the payload ** --out FILE Store the reply in FILE ** -v Verbose output */ void test_wget_command(void){ const char *zMimetype; const char *zInFile; const char *zOutFile; Blob in, out; unsigned int mHttpFlags = HTTP_GENERIC|HTTP_NOCOMPRESS; zMimetype = find_option("mimetype",0,1); zOutFile = find_option("out","o",1); if( find_option("verbose","v",0)!=0 ) mHttpFlags |= HTTP_VERBOSE; if( find_option("compress",0,0)!=0 ) mHttpFlags &= ~HTTP_NOCOMPRESS; db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_ANY_SCHEMA, 0); if( g.argc!=3 && g.argc!=4 ){ usage("URL ?PAYLOAD?"); } zInFile = g.argc==4 ? g.argv[3] : 0; url_parse(g.argv[2], 0); if( g.url.protocol[0]!='h' ){ fossil_fatal("the %s command supports only http: and https:", g.argv[1]); } if( zInFile ){ blob_read_from_file(&in, zInFile, ExtFILE); if( zMimetype==0 ){ if( fossil_strcmp(zInFile,"-")==0 ){ zMimetype = "application/x-unknown"; }else{ zMimetype = mimetype_from_name(zInFile); } } }else{ blob_init(&in, 0, 0); } blob_init(&out, 0, 0); if( (mHttpFlags & HTTP_VERBOSE)==0 && zOutFile==0 ){ zOutFile = "-"; mHttpFlags |= HTTP_QUIET; } http_exchange(&in, &out, mHttpFlags, 4, zMimetype); if( zOutFile ) blob_write_to_file(&out, zOutFile); blob_zero(&in); blob_zero(&out); } |
Changes to src/http_socket.c.
︙ | ︙ | |||
194 195 196 197 198 199 200 | return rc; } /* ** Send content out over the open socket connection. */ size_t socket_send(void *NotUsed, const void *pContent, size_t N){ | | | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | return rc; } /* ** Send content out over the open socket connection. */ size_t socket_send(void *NotUsed, const void *pContent, size_t N){ ssize_t sent; size_t total = 0; while( N>0 ){ sent = send(iSocket, pContent, N, 0); if( sent<=0 ) break; total += (size_t)sent; N -= (size_t)sent; pContent = (void*)&((char*)pContent)[sent]; } return total; } /* ** Receive content back from the open socket connection. |
︙ | ︙ |
Changes to src/http_ssl.c.
︙ | ︙ | |||
385 386 387 388 389 390 391 392 | } /* Set the Global.zIpAddr variable to the server we are talking to. ** This is used to populate the ipaddr column of the rcvfrom table, ** if any files are received from the server. */ { /* IPv4 only code */ | > > > > > > > > | > > | 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 | } /* Set the Global.zIpAddr variable to the server we are talking to. ** This is used to populate the ipaddr column of the rcvfrom table, ** if any files are received from the server. */ { /* As soon as libressl implements BIO_ADDR_hostname_string/BIO_get_conn_address. * check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable */ #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \ && !defined(LIBRESSL_VERSION_NUMBER) char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1); g.zIpAddr = mprintf("%s", ip); OPENSSL_free(ip); #else /* IPv4 only code */ const unsigned char *ip; ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2); g.zIpAddr = mprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); #endif } X509_free(cert); return 0; } /* |
︙ | ︙ |
Changes to src/http_transport.c.
︙ | ︙ | |||
78 79 80 81 82 83 84 | /* ** Check zFossil to see if it is a reasonable "fossil" command to ** run on the server. Do not allow an attacker to substitute something ** like "/bin/rm". */ static int is_safe_fossil_command(const char *zFossil){ | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | /* ** Check zFossil to see if it is a reasonable "fossil" command to ** run on the server. Do not allow an attacker to substitute something ** like "/bin/rm". */ static int is_safe_fossil_command(const char *zFossil){ static const char *const azSafe[] = { "*/fossil", "*/fossil.exe", "*/echo" }; int i; for(i=0; i<sizeof(azSafe)/sizeof(azSafe[0]); i++){ if( sqlite3_strglob(azSafe[i], zFossil)==0 ) return 1; if( strcmp(azSafe[i]+2, zFossil)==0 ) return 1; } return 0; } |
︙ | ︙ | |||
138 139 140 141 142 143 144 | blob_append_escaped_arg(&zCmd, pUrlData->path); }else{ fossil_panic("ssh:// URI does not specify a path to the repository"); } if( g.fSshTrace ){ fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */ } | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | blob_append_escaped_arg(&zCmd, pUrlData->path); }else{ fossil_panic("ssh:// URI does not specify a path to the repository"); } if( g.fSshTrace ){ fossil_print("%s\n", blob_str(&zCmd)); /* Show the whole SSH command */ } popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid, 0); if( sshPid==0 ){ socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); } blob_reset(&zCmd); return sshPid==0; } |
︙ | ︙ | |||
163 164 165 166 167 168 169 | int transport_open(UrlData *pUrlData){ int rc = 0; if( transport.isOpen==0 ){ if( pUrlData->isSsh ){ rc = transport_ssh_open(pUrlData); if( rc==0 ) transport.isOpen = 1; }else if( pUrlData->isHttps ){ | | | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | int transport_open(UrlData *pUrlData){ int rc = 0; if( transport.isOpen==0 ){ if( pUrlData->isSsh ){ rc = transport_ssh_open(pUrlData); if( rc==0 ) transport.isOpen = 1; }else if( pUrlData->isHttps ){ #ifdef FOSSIL_ENABLE_SSL rc = ssl_open(pUrlData); if( rc==0 ) transport.isOpen = 1; #else socket_set_errmsg("HTTPS: Fossil has been compiled without SSL support"); rc = 1; #endif }else if( pUrlData->isFile ){ sqlite3_uint64 iRandId; sqlite3_randomness(sizeof(iRandId), &iRandId); transport.zOutFile = mprintf("%s-%llu-out.http", g.zRepositoryName, iRandId); transport.zInFile = mprintf("%s-%llu-in.http", g.zRepositoryName, iRandId); |
︙ | ︙ | |||
237 238 239 240 241 242 243 | char *z = blob_buffer(toSend); int n = blob_size(toSend); transport.nSent += n; if( pUrlData->isSsh ){ fwrite(z, 1, n, sshOut); fflush(sshOut); }else if( pUrlData->isHttps ){ | | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | char *z = blob_buffer(toSend); int n = blob_size(toSend); transport.nSent += n; if( pUrlData->isSsh ){ fwrite(z, 1, n, sshOut); fflush(sshOut); }else if( pUrlData->isHttps ){ #ifdef FOSSIL_ENABLE_SSL int sent; while( n>0 ){ sent = ssl_send(0, z, n); /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */ if( sent<=0 ) break; n -= sent; } #endif }else if( pUrlData->isFile ){ fwrite(z, 1, n, transport.pFile); }else{ int sent; while( n>0 ){ sent = socket_send(0, z, n); /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */ |
︙ | ︙ |
Changes to src/import.c.
︙ | ︙ | |||
210 211 212 213 214 215 216 | } /* ** Use data accumulated in gg from a "tag" record to add a new ** control artifact to the BLOB table. */ static void finish_tag(void){ | < > > | 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 | } /* ** Use data accumulated in gg from a "tag" record to add a new ** control artifact to the BLOB table. */ static void finish_tag(void){ if( gg.zDate && gg.zTag && gg.zFrom && gg.zUser ){ Blob record, cksum; blob_zero(&record); blob_appendf(&record, "D %s\n", gg.zDate); blob_appendf(&record, "T +sym-%F%F%F %s", gimport.zTagPre, gg.zTag, gimport.zTagSuf, gg.zFrom); if( gg.zComment ){ blob_appendf(&record, " %F", gg.zComment); } blob_appendf(&record, "\nU %F\n", gg.zUser); md5sum_blob(&record, &cksum); blob_appendf(&record, "Z %b\n", &cksum); fast_insert_content(&record, 0, 0, 1); blob_reset(&cksum); blob_reset(&record); } import_reset(0); } /* ** Compare two ImportFile objects for sorting */ |
︙ | ︙ | |||
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | ** tag or not. So make an entry in the XTAG table to record this tag ** but overwrite that entry if a later instance of the same tag appears. ** ** This behavior seems like a bug in git-fast-export, but it is easier ** to work around the problem than to fix git-fast-export. */ if( gg.tagCommit && gg.zDate && gg.zUser && gg.zFrom ){ blob_appendf(&record, "D %s\n", gg.zDate); blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zBranchPre, gg.zBranch, gimport.zBranchSuf, gg.zPrevCheckin); blob_appendf(&record, "U %F\n", gg.zUser); md5sum_blob(&record, &cksum); blob_appendf(&record, "Z %b\n", &cksum); db_multi_exec( "INSERT OR REPLACE INTO xtag(tname, tcontent)" " VALUES(%Q,%Q)", gg.zBranch, blob_str(&record) ); | > > < > | 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 | ** tag or not. So make an entry in the XTAG table to record this tag ** but overwrite that entry if a later instance of the same tag appears. ** ** This behavior seems like a bug in git-fast-export, but it is easier ** to work around the problem than to fix git-fast-export. */ if( gg.tagCommit && gg.zDate && gg.zUser && gg.zFrom ){ record.nUsed = 0 /*in case fast_insert_comment() did not indirectly blob_reset() it */; blob_appendf(&record, "D %s\n", gg.zDate); blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zBranchPre, gg.zBranch, gimport.zBranchSuf, gg.zPrevCheckin); blob_appendf(&record, "U %F\n", gg.zUser); md5sum_blob(&record, &cksum); blob_appendf(&record, "Z %b\n", &cksum); db_multi_exec( "INSERT OR REPLACE INTO xtag(tname, tcontent)" " VALUES(%Q,%Q)", gg.zBranch, blob_str(&record) ); blob_reset(&cksum); } blob_reset(&record); fossil_free(gg.zPrevBranch); gg.zPrevBranch = gg.zBranch; gg.zBranch = 0; import_reset(0); } /* |
︙ | ︙ | |||
609 610 611 612 613 614 615 | got = fread(gg.aData, 1, gg.nData, pIn); if( got!=gg.nData ){ fossil_panic("short read: got %d of %d bytes", got, gg.nData); } gg.aData[got] = '\0'; if( gg.zComment==0 && (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){ | | | | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | got = fread(gg.aData, 1, gg.nData, pIn); if( got!=gg.nData ){ fossil_panic("short read: got %d of %d bytes", got, gg.nData); } gg.aData[got] = '\0'; if( gg.zComment==0 && (gg.xFinish==finish_commit || gg.xFinish==finish_tag) ){ /* Strip trailing newline, it's appended to the comment. */ if( gg.aData[got-1] == '\n' ) gg.aData[got-1] = '\0'; gg.zComment = gg.aData; gg.aData = 0; gg.nData = 0; } } }else if( (!ggit.authorFlag && strncmp(zLine, "author ", 7)==0) |
︙ | ︙ | |||
641 642 643 644 645 646 647 | if( (zTo=strchr(z, '>'))==NULL ) goto malformed_line; *(++zTo) = '\0'; /* Lookup user by contact info. */ fossil_free(gg.zUser); gg.zUser = db_text(0, "SELECT login FROM user WHERE info=%Q", z); if( gg.zUser==NULL ){ /* If there is no user with this contact info, | | | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | if( (zTo=strchr(z, '>'))==NULL ) goto malformed_line; *(++zTo) = '\0'; /* Lookup user by contact info. */ fossil_free(gg.zUser); gg.zUser = db_text(0, "SELECT login FROM user WHERE info=%Q", z); if( gg.zUser==NULL ){ /* If there is no user with this contact info, * then use the email address as the username. */ if ( (z=strchr(z, '<'))==NULL ) goto malformed_line; z++; *(zTo-1) = '\0'; gg.zUser = fossil_strdup(z); } secSince1970 = 0; for(zTo++; fossil_isdigit(*zTo); zTo++){ |
︙ | ︙ |
Changes to src/info.c.
︙ | ︙ | |||
115 116 117 118 119 120 121 | zTags = info_tags_of_checkin(rid, 0); if( zTags && zTags[0] ){ fossil_print("tags: %s\n", zTags); } free(zTags); if( zComment ){ fossil_print("comment: "); | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | zTags = info_tags_of_checkin(rid, 0); if( zTags && zTags[0] ){ fossil_print("tags: %s\n", zTags); } free(zTags); if( zComment ){ fossil_print("comment: "); comment_print(zComment, 0, 14, -1, get_comment_format()); free(zComment); } } /* ** Print information about the URLs used to access a repository and ** checkouts in a repository. |
︙ | ︙ | |||
178 179 180 181 182 183 184 | ** With no arguments, provide information about the current tree. ** If an argument is specified, provide information about the object ** in the repository of the current tree that the argument refers ** to. Or if the argument is the name of a repository, show ** information about that repository. ** ** If the argument is a repository name, then the --verbose option shows | | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | ** With no arguments, provide information about the current tree. ** If an argument is specified, provide information about the object ** in the repository of the current tree that the argument refers ** to. Or if the argument is the name of a repository, show ** information about that repository. ** ** If the argument is a repository name, then the --verbose option shows ** all known check-out locations for that repository and all URLs used ** to access the repository. The --verbose is (currently) a no-op if ** the argument is the name of a object within the repository. ** ** Use the "finfo" command to get information about a specific ** file in a checkout. ** ** Options: |
︙ | ︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | i64 fsize; int verboseFlag = find_option("verbose","v",0)!=0; if( !verboseFlag ){ verboseFlag = find_option("detail","l",0)!=0; /* deprecated */ } if( g.argc==3 && (fsize = file_size(g.argv[2], ExtFILE))>0 && (fsize&0x1ff)==0 ){ db_open_config(0, 0); db_open_repository(g.argv[2]); db_record_repository_filename(g.argv[2]); fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); | > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | i64 fsize; int verboseFlag = find_option("verbose","v",0)!=0; if( !verboseFlag ){ verboseFlag = find_option("detail","l",0)!=0; /* deprecated */ } if( g.argc==3 && file_isfile(g.argv[2], ExtFILE) && (fsize = file_size(g.argv[2], ExtFILE))>0 && (fsize&0x1ff)==0 ){ db_open_config(0, 0); db_open_repository(g.argv[2]); db_record_repository_filename(g.argv[2]); fossil_print("project-name: %s\n", db_get("project-name", "<unnamed>")); |
︙ | ︙ | |||
249 250 251 252 253 254 255 | } } /* ** Show the context graph (immediate parents and children) for ** check-in rid. */ | | > > > > > > | | > > > | | | | > > | | | > > > > > > > > | > > | > > > > > | | 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 | } } /* ** Show the context graph (immediate parents and children) for ** check-in rid. */ void render_checkin_context(int rid, int rid2, int parentsOnly){ Blob sql; Stmt q; int rx[2]; int i, n; rx[0] = rid; rx[1] = rid2; n = rid2 ? 2 : 1; blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);" "DELETE FROM ok;" ); for(i=0; i<n; i++){ db_multi_exec( "INSERT OR IGNORE INTO ok VALUES(%d);" "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;", rx[i], rx[i] ); } if( !parentsOnly ){ for(i=0; i<n; i++){ db_multi_exec( "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;", rx[i] ); if( db_table_exists("repository","cherrypick") ){ db_multi_exec( "INSERT OR IGNORE INTO ok " " SELECT parentid FROM cherrypick WHERE childid=%d;" "INSERT OR IGNORE INTO ok " " SELECT childid FROM cherrypick WHERE parentid=%d;", rx[i], rx[i] ); } } } blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_GRAPH |TIMELINE_FILLGAPS |TIMELINE_NOSCROLL |TIMELINE_XMERGE |TIMELINE_CHPICK, 0, 0, 0, rid, rid2, 0); db_finalize(&q); } /* ** Show a graph all wiki, tickets, and check-ins that refer to object zUuid. ** ** If zLabel is not NULL and the graph is not empty, then output zLabel as |
︙ | ︙ | |||
300 301 302 303 304 305 306 | if( !db_exists("SELECT 1 FROM ok") ) return; if( zLabel ) cgi_printf("%s", zLabel); blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL, | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | if( !db_exists("SELECT 1 FROM ok") ) return; if( zLabel ) cgi_printf("%s", zLabel); blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL, 0, 0, 0, 0, 0, 0); db_finalize(&q); } /* ** WEBPAGE: test-backlinks ** ** Show a timeline of all check-ins and other events that have entries |
︙ | ︙ | |||
333 334 335 336 337 338 339 | " WHERE blob.uuid BETWEEN backlink.target AND (backlink.target||'x')" ); blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL, | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | " WHERE blob.uuid BETWEEN backlink.target AND (backlink.target||'x')" ); blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL, 0, 0, 0, 0, 0, 0); db_finalize(&q); style_footer(); } /* ** Append the difference between artifacts to the output |
︙ | ︙ | |||
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | " WHERE tagxref.rid=%d;" "INSERT OR IGNORE INTO ok " " SELECT tagxref.origid" " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" " WHERE tagxref.rid=%d;", rid, rid, rid ); db_multi_exec( "SELECT tag.tagid, tagname, " " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," " value, datetime(tagxref.mtime,toLocal()), tagtype," " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)" " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" " WHERE tagxref.rid=%d" " ORDER BY tagname /*sort*/", rid, rid, rid ); blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL, | > > | | | | | | | | < > | 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 | " WHERE tagxref.rid=%d;" "INSERT OR IGNORE INTO ok " " SELECT tagxref.origid" " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" " WHERE tagxref.rid=%d;", rid, rid, rid ); #if 0 db_multi_exec( "SELECT tag.tagid, tagname, " " (SELECT uuid FROM blob WHERE rid=tagxref.srcid AND rid!=%d)," " value, datetime(tagxref.mtime,toLocal()), tagtype," " (SELECT uuid FROM blob WHERE rid=tagxref.origid AND rid!=%d)" " FROM tagxref JOIN tag ON tagxref.tagid=tag.tagid" " WHERE tagxref.rid=%d" " ORDER BY tagname /*sort*/", rid, rid, rid ); #endif blob_zero(&sql); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC"); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL, 0, 0, 0, rid, 0, 0); db_finalize(&q); style_footer(); } /* ** WEBPAGE: vinfo ** WEBPAGE: ci ** URL: /ci/ARTIFACTID ** OR: /ci?name=ARTIFACTID ** ** Display information about a particular check-in. The exact ** same information is shown on the /info page if the name query ** parameter to /info describes a check-in. ** ** The ARTIFACTID can be a unique prefix for the HASH of the check-in, ** or a tag or branch name that identifies the check-in. */ void ci_page(void){ Stmt q1, q2, q3; int rid; int isLeaf; int diffType; /* 0: no diff, 1: unified, 2: side-by-side */ u64 diffFlags; /* Flag parameter for text_diff() */ const char *zName; /* Name of the check-in to be displayed */ const char *zUuid; /* UUID of zName */ const char *zParent; /* UUID of the parent check-in (if any) */ const char *zRe; /* regex parameter */ ReCompiled *pRe = 0; /* regex */ const char *zW; /* URL param for ignoring whitespace */ const char *zPage = "vinfo"; /* Page that shows diffs */ const char *zPageHide = "ci"; /* Page that hides diffs */ const char *zBrName; /* Branch name */ login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } zName = P("name"); rid = name_to_rid_www("name"); if( rid==0 ){ style_header("Check-in Information Error"); |
︙ | ︙ | |||
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 | "SELECT uuid, datetime(mtime,toLocal()), user, comment," " datetime(omtime,toLocal()), mtime" " FROM blob, event" " WHERE blob.rid=%d" " AND event.objid=%d", rid, rid ); cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); if( db_step(&q1)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q1, 0); int nUuid = db_column_bytes(&q1, 0); char *zEUser, *zEComment; const char *zUser; const char *zOrigUser; const char *zComment; const char *zDate; const char *zOrigDate; style_header("Check-in [%S]", zUuid); login_anonymous_available(); zEUser = db_text(0, "SELECT value FROM tagxref" " WHERE tagid=%d AND rid=%d AND tagtype>0", TAG_USER, rid); | > > > > | 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 | "SELECT uuid, datetime(mtime,toLocal()), user, comment," " datetime(omtime,toLocal()), mtime" " FROM blob, event" " WHERE blob.rid=%d" " AND event.objid=%d", rid, rid ); zBrName = branch_of_rid(rid); cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); if( db_step(&q1)==SQLITE_ROW ){ const char *zUuid = db_column_text(&q1, 0); int nUuid = db_column_bytes(&q1, 0); char *zEUser, *zEComment; const char *zUser; const char *zOrigUser; const char *zComment; const char *zDate; const char *zOrigDate; int okWiki = 0; Blob wiki_read_links = BLOB_INITIALIZER; Blob wiki_add_links = BLOB_INITIALIZER; style_header("Check-in [%S]", zUuid); login_anonymous_available(); zEUser = db_text(0, "SELECT value FROM tagxref" " WHERE tagid=%d AND rid=%d AND tagtype>0", TAG_USER, rid); |
︙ | ︙ | |||
739 740 741 742 743 744 745 | } db_prepare(&q2,"SELECT substr(tag.tagname,5) FROM tagxref, tag " " WHERE rid=%d AND tagtype>0 " " AND tag.tagid=tagxref.tagid " " AND +tag.tagname GLOB 'sym-*'", rid); while( db_step(&q2)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q2, 0); | > > > | > > > > > > > > > > > > > > > > > > | > | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | | 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 | } db_prepare(&q2,"SELECT substr(tag.tagname,5) FROM tagxref, tag " " WHERE rid=%d AND tagtype>0 " " AND tag.tagid=tagxref.tagid " " AND +tag.tagname GLOB 'sym-*'", rid); while( db_step(&q2)==SQLITE_ROW ){ const char *zTagName = db_column_text(&q2, 0); if( fossil_strcmp(zTagName,zBrName)==0 ){ cgi_printf(" | "); style_copy_button(1, "name-br", 0, 0, "%z%h</a>", href("%R/timeline?r=%T&unhide",zTagName), zTagName); cgi_printf("\n"); if( wiki_tagid2("branch",zTagName)!=0 ){ blob_appendf(&wiki_read_links, " | %z%h</a>", href("%R/wiki?name=branch/%h",zTagName), zTagName); }else if( g.perm.Write && g.perm.WrWiki ){ blob_appendf(&wiki_add_links, " | %z%h</a>", href("%R/wikiedit?name=branch/%h",zTagName), zTagName); } }else{ @ | %z(href("%R/timeline?t=%T&unhide",zTagName))%h(zTagName)</a> if( wiki_tagid2("tag",zTagName)!=0 ){ blob_appendf(&wiki_read_links, " | %z%h</a>", href("%R/wiki?name=tag/%h",zTagName), zTagName); }else if( g.perm.Write && g.perm.WrWiki ){ blob_appendf(&wiki_add_links, " | %z%h</a>", href("%R/wikiedit?name=tag/%h",zTagName), zTagName); } } } db_finalize(&q2); @ </td></tr> @ <tr><th>Files:</th> @ <td> @ %z(href("%R/tree?ci=%!S",zUuid))files</a> @ | %z(href("%R/fileage?name=%!S",zUuid))file ages</a> @ | %z(href("%R/tree?nofiles&type=tree&ci=%!S",zUuid))folders</a> @ </td> @ </tr> @ <tr><th>%s(hname_alg(nUuid)):</th><td> style_copy_button(1, "hash-ci", 0, 2, "%.32s<wbr>%s", zUuid, zUuid+32); if( g.perm.Setup ){ @ (Record ID: %d(rid)) } @ </td></tr> @ <tr><th>User & Date:</th><td> hyperlink_to_user(zUser,zDate," on "); hyperlink_to_date(zDate, "</td></tr>"); if( zEComment ){ @ <tr><th>Original Comment:</th> @ <td class="infoComment">%!W(zComment)</td></tr> } if( fossil_strcmp(zDate, zOrigDate)!=0 || fossil_strcmp(zOrigUser, zUser)!=0 ){ @ <tr><th>Original User & Date:</th><td> hyperlink_to_user(zOrigUser,zOrigDate," on "); hyperlink_to_date(zOrigDate, "</td></tr>"); } if( g.perm.Admin ){ db_prepare(&q2, "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)," " blob.rcvid" " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)" " WHERE blob.rid=%d", rid ); if( db_step(&q2)==SQLITE_ROW ){ const char *zIpAddr = db_column_text(&q2, 0); const char *zUser = db_column_text(&q2, 1); const char *zDate = db_column_text(&q2, 2); int rcvid = db_column_int(&q2,3); if( zUser==0 || zUser[0]==0 ) zUser = "unknown"; @ <tr><th>Received From:</th> @ <td>%h(zUser) @ %h(zIpAddr) on %s(zDate) \ @ (<a href="%R/rcvfrom?rcvid=%d(rcvid)">Rcvid %d(rcvid)</a>)</td></tr> } db_finalize(&q2); } /* Only show links to read wiki pages if the users can read wiki ** and if the wiki pages already exist */ if( g.perm.RdWiki && ((okWiki = wiki_tagid2("checkin",zUuid))!=0 || blob_size(&wiki_read_links)>0) && db_get_boolean("wiki-about",1) ){ const char *zLinks = blob_str(&wiki_read_links); @ <tr><th>Wiki:</th><td>\ if( okWiki ){ @ %z(href("%R/wiki?name=checkin/%s",zUuid))this checkin</a>\ }else if( zLinks[0] ){ zLinks += 3; } @ %s(zLinks)</td></tr> } /* Only show links to create new wiki pages if the users can write wiki ** and if the wiki pages do not already exist */ if( g.perm.WrWiki && g.perm.RdWiki && g.perm.Write && (blob_size(&wiki_add_links)>0 || !okWiki) && db_get_boolean("wiki-about",1) ){ const char *zLinks = blob_str(&wiki_add_links); @ <tr><th>Add Wiki:</th><td>\ if( !okWiki ){ @ %z(href("%R/wikiedit?name=checkin/%s",zUuid))this checkin</a>\ }else if( zLinks[0] ){ zLinks += 3; } @ %s(zLinks)</td></tr> } if( g.perm.Hyperlink ){ @ <tr><th>Other Links:</th> @ <td> if( fossil_strcmp(zBrName, db_get("main-branch",0))!=0 ){ @ %z(href("%R/vdiff?branch=%!S", zUuid))branch diff</a> | } @ %z(href("%R/artifact/%!S",zUuid))manifest</a> @ | %z(href("%R/ci_tags/%!S",zUuid))tags</a> if( g.perm.Admin ){ @ | %z(href("%R/mlink?ci=%!S",zUuid))mlink table</a> } if( g.anon.Write ){ @ | %z(href("%R/ci_edit?r=%!S",zUuid))edit</a> } @ </td> @ </tr> } @ </table> blob_reset(&wiki_read_links); blob_reset(&wiki_add_links); }else{ style_header("Check-in Information"); login_anonymous_available(); } db_finalize(&q1); if( !PB("nowiki") ){ wiki_render_associated("checkin", zUuid, 0); } render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n"); @ <div class="section">Context</div> render_checkin_context(rid, 0, 0); @ <div class="section">Changes</div> @ <div class="sectionmenu"> diffFlags = construct_diff_flags(diffType); zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; if( diffType!=0 ){ @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\ @ Hide Diffs</a> |
︙ | ︙ | |||
889 890 891 892 893 894 895 896 897 898 899 900 901 902 | int rid; Manifest *pWiki; char *zUuid; char *zDate; Blob wiki; int modPending; const char *zModAction; login_check_credentials(); if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } rid = name_to_rid_www("name"); if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){ style_header("Wiki Page Information Error"); @ No such object: %h(P("name")) | > > | 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | int rid; Manifest *pWiki; char *zUuid; char *zDate; Blob wiki; int modPending; const char *zModAction; int tagid; int ridNext; login_check_credentials(); if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } rid = name_to_rid_www("name"); if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){ style_header("Wiki Page Information Error"); @ No such object: %h(P("name")) |
︙ | ︙ | |||
935 936 937 938 939 940 941 | @ <tr><th>Artifact ID:</th> @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a> if( g.perm.Setup ){ @ (%d(rid)) } modPending = moderation_pending_www(rid); @ </td></tr> | | > > > > > > > > > | 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 | @ <tr><th>Artifact ID:</th> @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a> if( g.perm.Setup ){ @ (%d(rid)) } modPending = moderation_pending_www(rid); @ </td></tr> @ <tr><th>Page Name:</th>\ @ <td>%z(href("%R/whistory?name=%h",pWiki->zWikiTitle))\ @ %h(pWiki->zWikiTitle)</a></td></tr> @ <tr><th>Date:</th><td> hyperlink_to_date(zDate, "</td></tr>"); @ <tr><th>Original User:</th><td> hyperlink_to_user(pWiki->zUser, zDate, "</td></tr>"); if( pWiki->zMimetype ){ @ <tr><th>Mimetype:</th><td>%h(pWiki->zMimetype)</td></tr> } if( pWiki->nParent>0 ){ int i; @ <tr><th>Parent%s(pWiki->nParent==1?"":"s"):</th><td> for(i=0; i<pWiki->nParent; i++){ char *zParent = pWiki->azParent[i]; @ %z(href("info/%!S",zParent))%s(zParent)</a> @ %z(href("%R/wdiff?id=%!S&pid=%!S",zUuid,zParent))(diff)</a> } @ </td></tr> } tagid = wiki_tagid(pWiki->zWikiTitle); if( tagid>0 && (ridNext = wiki_next(tagid, pWiki->rDate))>0 ){ char *zId = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", ridNext); @ <tr><th>Next</th> @ <td>%z(href("%R/info/%!S",zId))%s(zId)</a></td> } @ </table> if( g.perm.ModWiki && modPending ){ @ <div class="section">Moderation</div> @ <blockquote> @ <form method="POST" action="%R/winfo/%s(zUuid)"> @ <label><input type="radio" name="modaction" value="delete"> |
︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | if( !is_a_version(rid) ){ webpage_error("Artifact %s is not a check-in.", P(zParam)); return 0; } return manifest_get(rid, CFTYPE_MANIFEST, 0); } /* ** Output a description of a check-in */ static void checkin_description(int rid){ Stmt q; db_prepare(&q, "SELECT datetime(mtime), coalesce(euser,user)," | > | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | if( !is_a_version(rid) ){ webpage_error("Artifact %s is not a check-in.", P(zParam)); return 0; } return manifest_get(rid, CFTYPE_MANIFEST, 0); } #if 0 /* not used */ /* ** Output a description of a check-in */ static void checkin_description(int rid){ Stmt q; db_prepare(&q, "SELECT datetime(mtime), coalesce(euser,user)," |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 | } @ date: hyperlink_to_date(zDate, ")"); tag_private_status(rid); } db_finalize(&q); } /* ** WEBPAGE: vdiff ** URL: /vdiff?from=TAG&to=TAG ** ** Show the difference between two check-ins identified by the from= and | > | 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | } @ date: hyperlink_to_date(zDate, ")"); tag_private_status(rid); } db_finalize(&q); } #endif /* not used */ /* ** WEBPAGE: vdiff ** URL: /vdiff?from=TAG&to=TAG ** ** Show the difference between two check-ins identified by the from= and |
︙ | ︙ | |||
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | ManifestFile *pFileFrom, *pFileTo; const char *zBranch; const char *zFrom; const char *zTo; const char *zRe; const char *zW; const char *zGlob; ReCompiled *pRe = 0; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } login_anonymous_available(); cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); cookie_render(); zRe = P("regex"); if( zRe ) re_compile(&pRe, zRe, 0); zBranch = P("branch"); | > > > | > > > | > > > | > | | | | | | > | | | > | > > > | > > > > > > > > > > > > > > > > > | | > | > | < > | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 | ManifestFile *pFileFrom, *pFileTo; const char *zBranch; const char *zFrom; const char *zTo; const char *zRe; const char *zW; const char *zGlob; char *zQuery; char *zMergeOrigin = 0; ReCompiled *pRe = 0; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } login_anonymous_available(); load_control(); cookie_link_parameter("diff","diff","2"); diffType = atoi(PD("diff","2")); cookie_render(); zRe = P("regex"); if( zRe ) re_compile(&pRe, zRe, 0); zBranch = P("branch"); if( zBranch && zBranch[0]==0 ) zBranch = 0; if( zBranch ){ zQuery = mprintf("branch=%T", zBranch); zMergeOrigin = mprintf("merge-in:%s", zBranch); cgi_replace_parameter("from", zMergeOrigin); cgi_replace_parameter("to", zBranch); }else{ zQuery = mprintf("from=%T&to=%T",PD("from",""),PD("to","")); } pTo = vdiff_parse_manifest("to", &ridTo); if( pTo==0 ) return; pFrom = vdiff_parse_manifest("from", &ridFrom); if( pFrom==0 ) return; zGlob = P("glob"); zFrom = P("from"); zTo = P("to"); if(zGlob && !*zGlob){ zGlob = NULL; } diffFlags = construct_diff_flags(diffType); zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; if( zBranch==0 ){ style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo); } if( diffType!=0 ){ style_submenu_element("Hide Diff", "%R/vdiff?%s&diff=0%s%T%s", zQuery, zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); } if( diffType!=2 ){ style_submenu_element("Side-by-Side Diff", "%R/vdiff?%s&diff=2%s%T%s", zQuery, zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); } if( diffType!=1 ) { style_submenu_element("Unified Diff", "%R/vdiff?%s&diff=1%s%T%s", zQuery, zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); } if( zBranch==0 ){ style_submenu_element("Invert", "%R/vdiff?from=%T&to=%T&%s%T%s", zTo, zFrom, zGlob ? "&glob=" : "", zGlob ? zGlob : "", zW); } if( zGlob ){ style_submenu_element("Clear glob", "%R/vdiff?%s&%s", zQuery, zW); }else{ style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); } if( diffType!=0 ){ style_submenu_checkbox("w", "Ignore Whitespace", 0, 0); } if( zBranch ){ style_header("Changes On Branch %h", zBranch); }else{ style_header("Check-in Differences"); } if( P("nohdr")==0 ){ if( zBranch ){ char *zRealBranch = branch_of_rid(ridTo); char *zToUuid = rid_to_uuid(ridTo); char *zFromUuid = rid_to_uuid(ridFrom); @ <h2>Changes In Branch \ @ %z(href("%R/timeline?r=%T",zRealBranch))%h(zRealBranch)</a> if( ridTo != symbolic_name_to_rid(zRealBranch,"ci") ){ @ Through %z(href("%R/info/%!S",zToUuid))[%S(zToUuid)]</a> } @ Excluding Merge-Ins</h2> @ <p>This is equivalent to a diff from @ <span class='timelineSelected'>\ @ %z(href("%R/info/%!S",zFromUuid))%S(zFromUuid)</a></span> @ to <span class='timelineSelected timelineSecondary'>\ @ %z(href("%R/info/%!S",zToUuid))%S(zToUuid)</a></span></p> }else{ @ <h2>Difference From <span class='timelineSelected'>\ @ %z(href("%R/info/%h",zFrom))%h(zFrom)</a></span> @ To <span class='timelineSelected timelineSecondary'>\ @ %z(href("%R/info/%h",zTo))%h(zTo)</a></span></h2> } render_checkin_context(ridFrom, ridTo, 0); if( pRe ){ @ <p><b>Only differences that match regular expression "%h(zRe)" @ are shown.</b></p> } if( zGlob ){ @ <p><b>Only files matching the glob "%h(zGlob)" are shown.</b></p> } @<hr /><p> } fossil_free(zQuery); manifest_file_rewind(pFrom); pFileFrom = manifest_file_next(pFrom, 0); manifest_file_rewind(pTo); pFileTo = manifest_file_next(pTo, 0); while( pFileFrom || pFileTo ){ int cmp; |
︙ | ︙ | |||
1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | #define OBJTYPE_FORUM 0x0200 /* ** Possible flags for the second parameter to ** object_description() */ #define OBJDESC_DETAIL 0x0001 /* more detail */ #endif /* ** Write a description of an object to the www reply. ** ** If the object is a file then mention: ** | > | 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 | #define OBJTYPE_FORUM 0x0200 /* ** Possible flags for the second parameter to ** object_description() */ #define OBJDESC_DETAIL 0x0001 /* more detail */ #define OBJDESC_BASE 0x0002 /* Set <base> using this object */ #endif /* ** Write a description of an object to the www reply. ** ** If the object is a file then mention: ** |
︙ | ︙ | |||
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | Stmt q; int cnt = 0; int nWiki = 0; int objType = 0; char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); int showDetail = (objdescFlags & OBJDESC_DETAIL)!=0; char *prevName = 0; db_prepare(&q, "SELECT filename.name, datetime(event.mtime,toLocal())," " coalesce(event.ecomment,event.comment)," " coalesce(event.euser,event.user)," " b.uuid, mlink.mperm," " coalesce((SELECT value FROM tagxref" | > | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 | Stmt q; int cnt = 0; int nWiki = 0; int objType = 0; char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); int showDetail = (objdescFlags & OBJDESC_DETAIL)!=0; char *prevName = 0; int bNeedBase = (objdescFlags & OBJDESC_BASE)!=0; db_prepare(&q, "SELECT filename.name, datetime(event.mtime,toLocal())," " coalesce(event.ecomment,event.comment)," " coalesce(event.euser,event.user)," " b.uuid, mlink.mperm," " coalesce((SELECT value FROM tagxref" |
︙ | ︙ | |||
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 | @ <li>Symbolic link objType |= OBJTYPE_SYMLINK; }else if( mPerm==PERM_EXE ){ @ <li>Executable file objType |= OBJTYPE_EXE; }else{ @ <li>File } objType |= OBJTYPE_CONTENT; @ %z(href("%R/finfo?name=%T&m=%!S",zName,zUuid))%h(zName)</a> tag_private_status(rid); if( showDetail ){ @ <ul> } | > > > > | 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 | @ <li>Symbolic link objType |= OBJTYPE_SYMLINK; }else if( mPerm==PERM_EXE ){ @ <li>Executable file objType |= OBJTYPE_EXE; }else{ @ <li>File if( bNeedBase ){ bNeedBase = 0; style_set_current_page("doc/%S/%s",zVers,zName); } } objType |= OBJTYPE_CONTENT; @ %z(href("%R/finfo?name=%T&m=%!S",zName,zUuid))%h(zName)</a> tag_private_status(rid); if( showDetail ){ @ <ul> } |
︙ | ︙ | |||
1658 1659 1660 1661 1662 1663 1664 | ** ** Return the uninterpreted content of an artifact. Used primarily ** to view artifacts that are images. */ void rawartifact_page(void){ int rid = 0; char *zUuid; | < < > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | ** ** Return the uninterpreted content of an artifact. Used primarily ** to view artifacts that are images. */ void rawartifact_page(void){ int rid = 0; char *zUuid; if( P("ci") && P("filename") ){ rid = artifact_from_ci_and_filename(0, 0); } if( rid==0 ){ rid = name_to_rid_www("name"); } login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } if( rid==0 ) fossil_redirect_home(); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); if( fossil_strcmp(P("name"), zUuid)==0 && login_is_nobody() ){ g.isConst = 1; } free(zUuid); deliver_artifact(rid, P("m")); } /* ** WEBPAGE: secureraw ** URL: /secureraw/HASH?m=TYPE ** ** Return the uninterpreted content of an artifact. This is similar ** to /raw except in this case the only way to specify the artifact ** is by the full-length SHA1 or SHA3 hash. Abbreviations are not ** accepted. */ void secure_rawartifact_page(void){ int rid = 0; const char *zUuid = PD("name", ""); login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zUuid); if( rid==0 ){ cgi_set_status(404, "Not Found"); @ Unknown artifact: "%h(zUuid)" return; } g.isConst = 1; deliver_artifact(rid, P("m")); } /* ** Generate a verbatim artifact as the result of an HTTP request. ** If zMime is not NULL, use it as the MIME-type. If zMime is ** NULL, guess at the MIME-type based on the filename ** associated with the artifact. */ void deliver_artifact(int rid, const char *zMime){ Blob content; if( zMime==0 ){ char *zFName = db_text(0, "SELECT filename.name FROM mlink, filename" " WHERE mlink.fid=%d" " AND filename.fnid=mlink.fnid", rid); if( !zFName ){ /* Look also at the attachment table */ zFName = db_text(0, "SELECT attachment.filename FROM attachment, blob" |
︙ | ︙ | |||
1778 1779 1780 1781 1782 1783 1784 1785 | g.zTop, zUuid); }else{ style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } style_header("Hex Artifact Content"); zUuid = db_text("?","SELECT uuid FROM blob WHERE rid=%d", rid); if( g.perm.Setup ){ | > > | | | 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 | g.zTop, zUuid); }else{ style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } style_header("Hex Artifact Content"); zUuid = db_text("?","SELECT uuid FROM blob WHERE rid=%d", rid); @ <h2>Artifact style_copy_button(1, "hash-ar", 0, 2, "%s", zUuid); if( g.perm.Setup ){ @ (%d(rid)):</h2> }else{ @ :</h2> } blob_zero(&downloadName); if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL; object_description(rid, objdescFlags, &downloadName); style_submenu_element("Download", "%s/raw/%T?name=%s", g.zTop, blob_str(&downloadName), zUuid); @ <hr /> |
︙ | ︙ | |||
1976 1977 1978 1979 1980 1981 1982 | const char *zMime; Blob downloadName; int renderAsWiki = 0; int renderAsHtml = 0; int objType; int asText; const char *zUuid; | | | 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 | const char *zMime; Blob downloadName; int renderAsWiki = 0; int renderAsHtml = 0; int objType; int asText; const char *zUuid; u32 objdescFlags = OBJDESC_BASE; int descOnly = fossil_strcmp(g.zPath,"whatis")==0; int isFile = fossil_strcmp(g.zPath,"file")==0; const char *zLn = P("ln"); const char *zName = P("name"); HQuery url; url_initialize(&url, g.zPath); |
︙ | ︙ | |||
2047 2048 2049 2050 2051 2052 2053 | url_add_parameter(&url, "verbose", "1"); objdescFlags |= OBJDESC_DETAIL; } zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid); if( isFile ){ @ <h2>Latest version of file '%h(zName)':</h2> style_submenu_element("Artifact", "%R/artifact/%S", zUuid); | > > > | | | | | > > > | 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 | url_add_parameter(&url, "verbose", "1"); objdescFlags |= OBJDESC_DETAIL; } zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid); if( isFile ){ @ <h2>Latest version of file '%h(zName)':</h2> style_submenu_element("Artifact", "%R/artifact/%S", zUuid); }else{ @ <h2>Artifact style_copy_button(1, "hash-ar", 0, 2, "%s", zUuid); if( g.perm.Setup ){ @ (%d(rid)):</h2> }else{ @ :</h2> } } blob_zero(&downloadName); asText = P("txt")!=0; if( asText ) objdescFlags &= ~OBJDESC_BASE; objType = object_description(rid, objdescFlags, &downloadName); if( !descOnly && P("download")!=0 ){ cgi_redirectf("%R/raw/%T?name=%s", blob_str(&downloadName), db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid)); /*NOTREACHED*/ } if( g.perm.Admin ){ |
︙ | ︙ | |||
2091 2092 2093 2094 2095 2096 2097 | db_finalize(&q); } style_submenu_element("Download", "%R/raw/%T?name=%s", blob_str(&downloadName), zUuid); if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){ style_submenu_element("Check-ins Using", "%R/timeline?n=200&uf=%s", zUuid); } | < | 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 | db_finalize(&q); } style_submenu_element("Download", "%R/raw/%T?name=%s", blob_str(&downloadName), zUuid); if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){ style_submenu_element("Check-ins Using", "%R/timeline?n=200&uf=%s", zUuid); } zMime = mimetype_from_name(blob_str(&downloadName)); if( zMime ){ if( fossil_strcmp(zMime, "text/html")==0 ){ if( asText ){ style_submenu_element("Html", "%s", url_render(&url, "txt", 0, 0, 0)); }else{ renderAsHtml = 1; |
︙ | ︙ | |||
2117 2118 2119 2120 2121 2122 2123 | } if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){ style_submenu_element("Parsed", "%R/info/%s", zUuid); } if( descOnly ){ style_submenu_element("Content", "%R/artifact/%s", zUuid); }else{ | < < < | > > > > | > > | > > > | > > > > > > > > > > | | | 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 | } if( (objType & (OBJTYPE_WIKI|OBJTYPE_TICKET))!=0 ){ style_submenu_element("Parsed", "%R/info/%s", zUuid); } if( descOnly ){ style_submenu_element("Content", "%R/artifact/%s", zUuid); }else{ @ <hr /> content_get(rid, &content); if( renderAsWiki ){ wiki_render_by_mimetype(&content, zMime); }else if( renderAsHtml ){ @ <iframe src="%R/raw/%T(blob_str(&downloadName))?name=%s(zUuid)" @ width="100%%" frameborder="0" marginwidth="0" marginheight="0" @ sandbox="allow-same-origin" id="ifm1"> @ </iframe> @ <script nonce="%h(style_nonce())"> @ document.getElementById("ifm1").addEventListener("load", @ function(){ @ this.height=this.contentDocument.documentElement.scrollHeight + 75; @ } @ ); @ </script> }else{ style_submenu_element("Hex", "%s/hexdump?name=%s", g.zTop, zUuid); if( zLn==0 || atoi(zLn)==0 ){ style_submenu_checkbox("ln", "Line Numbers", 0, 0); } blob_to_utf8_no_bom(&content, 0); zMime = mimetype_from_content(&content); @ <blockquote> if( zMime==0 ){ const char *z, *zFileName, *zExt; z = blob_str(&content); zFileName = db_text(0, "SELECT name FROM mlink, filename" " WHERE filename.fnid=mlink.fnid" " AND mlink.fid=%d", rid); zExt = zFileName ? strrchr(zFileName, '.') : 0; if( zLn ){ output_text_with_line_numbers(z, zLn); }else if( zExt && zExt[1] ){ @ <pre> @ <code class="language-%s(zExt+1)">%h(z)</code> @ </pre> }else{ @ <pre> @ %h(z) @ </pre> } }else if( strncmp(zMime, "image/", 6)==0 ){ @ <p>(file is %d(blob_size(&content)) bytes of image data)</i></p> @ <p><img src="%R/raw/%s(zUuid)?m=%s(zMime)"></p> style_submenu_element("Image", "%R/raw/%s?m=%s", zUuid, zMime); }else{ @ <i>(file is %d(blob_size(&content)) bytes of binary data)</i> } @ </blockquote> } } |
︙ | ︙ | |||
2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 | ambiguous_page(); return; } rc = name_to_uuid(&uuid, -1, "*"); if( rc==1 ){ if( validate16(zName, nLen) ){ if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){ tktview_page(); return; } if( db_exists("SELECT 1 FROM tag" " WHERE tagname GLOB 'event-%q*'", zName) ){ event_page(); return; | > | 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 | ambiguous_page(); return; } rc = name_to_uuid(&uuid, -1, "*"); if( rc==1 ){ if( validate16(zName, nLen) ){ if( db_exists("SELECT 1 FROM ticket WHERE tkt_uuid GLOB '%q*'", zName) ){ cgi_set_parameter_nocopy("tl","1",0); tktview_page(); return; } if( db_exists("SELECT 1 FROM tag" " WHERE tagname GLOB 'event-%q*'", zName) ){ event_page(); return; |
︙ | ︙ | |||
2470 2471 2472 2473 2474 2475 2476 | change_sym_tag(zNewBranch,"*"); } /* ** The apply_newtags method is called after all newtags have been added ** and the control artifact is completed and then written to the DB. */ | | > > > > > > > > > | > > > > > > | | | | < | > > | 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | change_sym_tag(zNewBranch,"*"); } /* ** The apply_newtags method is called after all newtags have been added ** and the control artifact is completed and then written to the DB. */ static void apply_newtags( Blob *ctrl, int rid, const char *zUuid, const char *zUserOvrd, /* The user name on the control artifact */ int fDryRun /* Print control artifact, but make no changes */ ){ Stmt q; int nChng = 0; db_prepare(&q, "SELECT tag, prefix, value FROM newtags" " ORDER BY prefix || tag"); while( db_step(&q)==SQLITE_ROW ){ const char *zTag = db_column_text(&q, 0); const char *zPrefix = db_column_text(&q, 1); const char *zValue = db_column_text(&q, 2); nChng++; if( zValue ){ blob_appendf(ctrl, "T %s%F %s %F\n", zPrefix, zTag, zUuid, zValue); }else{ blob_appendf(ctrl, "T %s%F %s\n", zPrefix, zTag, zUuid); } } db_finalize(&q); if( nChng>0 ){ int nrid; Blob cksum; if( zUserOvrd && zUserOvrd[0] ){ blob_appendf(ctrl, "U %F\n", zUserOvrd); }else{ blob_appendf(ctrl, "U %F\n", login_name()); } md5sum_blob(ctrl, &cksum); blob_appendf(ctrl, "Z %b\n", &cksum); if( fDryRun ){ assert( g.isHTTP==0 ); /* Only print control artifact in console mode. */ fossil_print("%s", blob_str(ctrl)); blob_reset(ctrl); }else{ db_begin_transaction(); g.markPrivate = content_is_private(rid); nrid = content_put(ctrl); manifest_crosslink(nrid, ctrl, MC_PERMIT_HOOKS); db_end_transaction(0); } assert( blob_is_reset(ctrl) ); } } /* ** This method checks that the date can be parsed. ** Returns 1 if datetime() can validate, 0 otherwise. */ |
︙ | ︙ | |||
2639 2640 2641 2642 2643 2644 2645 | if( P(zLabel) ) cancel_special(zTag); } db_finalize(&q); if( zHideFlag[0] ) hide_branch(); if( zCloseFlag[0] ) close_leaf(rid); if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); | | | 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 | if( P(zLabel) ) cancel_special(zTag); } db_finalize(&q); if( zHideFlag[0] ) hide_branch(); if( zCloseFlag[0] ) close_leaf(rid); if( zNewTagFlag[0] && zNewTag[0] ) add_tag(zNewTag); if( zNewBrFlag[0] && zNewBranch[0] ) change_branch(rid,zNewBranch); apply_newtags(&ctrl, rid, zUuid, 0, 0); cgi_redirectf("%R/ci/%S", zUuid); } blob_zero(&comment); blob_append(&comment, zNewComment, -1); zUuid[10] = 0; style_header("Edit Check-in [%s]", zUuid); if( P("preview") ){ |
︙ | ︙ | |||
2780 2781 2782 2783 2784 2785 2786 | @ Cancel tag <b>%h(&zTagName[4])</b></label> } } db_finalize(&q); @ </td></tr> if( !zBranchName ){ | | | 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 | @ Cancel tag <b>%h(&zTagName[4])</b></label> } } db_finalize(&q); @ </td></tr> if( !zBranchName ){ zBranchName = db_get("main-branch", 0); } if( !zNewBranch || !zNewBranch[0]){ zNewBranch = zBranchName; } @ <tr><th align="right" valign="top">Branching:</th> @ <td valign="top"> @ <label><input id="newbr" type="checkbox" name="newbr" \ |
︙ | ︙ | |||
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 | ** --bgcolor COLOR Apply COLOR to this check-in ** --branchcolor COLOR Apply and propagate COLOR to the branch ** --tag TAG Add new TAG to this check-in ** --cancel TAG Cancel TAG from this check-in ** --branch NAME Make this check-in the start of branch NAME ** --hide Hide branch starting from this check-in ** --close Mark this "leaf" as closed ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. */ | > > > | 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 | ** --bgcolor COLOR Apply COLOR to this check-in ** --branchcolor COLOR Apply and propagate COLOR to the branch ** --tag TAG Add new TAG to this check-in ** --cancel TAG Cancel TAG from this check-in ** --branch NAME Make this check-in the start of branch NAME ** --hide Hide branch starting from this check-in ** --close Mark this "leaf" as closed ** -n|--dry-run Print control artifact, but make no changes ** --date-override DATETIME Set the change time on the control artifact ** --user-override USER Set the user name on the control artifact ** ** DATETIME may be "now" or "YYYY-MM-DDTHH:MM:SS.SSS". If in ** year-month-day form, it may be truncated, the "T" may be replaced by ** a space, and it may also name a timezone offset from UTC as "-HH:MM" ** (westward) or "+HH:MM" (eastward). Either no timezone suffix or "Z" ** means UTC. */ |
︙ | ︙ | |||
2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 | int fClose; /* True if leaf should be closed */ int fHide; /* True if branch should be hidden */ int fPropagateColor; /* True if color propagates before amend */ int fNewPropagateColor = 0; /* True if color propagates after amend */ int fHasHidden = 0; /* True if hidden tag already set */ int fHasClosed = 0; /* True if closed tag already set */ int fEditComment; /* True if editor to be used for comment */ const char *zChngTime; /* The change time on the control artifact */ const char *zUuid; Blob ctrl; Blob comment; char *zNow; int nTags, nCancels; int i; Stmt q; | > > | 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 | int fClose; /* True if leaf should be closed */ int fHide; /* True if branch should be hidden */ int fPropagateColor; /* True if color propagates before amend */ int fNewPropagateColor = 0; /* True if color propagates after amend */ int fHasHidden = 0; /* True if hidden tag already set */ int fHasClosed = 0; /* True if closed tag already set */ int fEditComment; /* True if editor to be used for comment */ int fDryRun; /* Print control artifact, make no changes */ const char *zChngTime; /* The change time on the control artifact */ const char *zUserOvrd; /* The user name on the control artifact */ const char *zUuid; Blob ctrl; Blob comment; char *zNow; int nTags, nCancels; int i; Stmt q; |
︙ | ︙ | |||
2948 2949 2950 2951 2952 2953 2954 | } zNewDate = find_option("date",0,1); zNewUser = find_option("author",0,1); pzNewTags = find_repeatable_option("tag",0,&nTags); pzCancelTags = find_repeatable_option("cancel",0,&nCancels); fClose = find_option("close",0,0)!=0; fHide = find_option("hide",0,0)!=0; | > > | > > | 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 | } zNewDate = find_option("date",0,1); zNewUser = find_option("author",0,1); pzNewTags = find_repeatable_option("tag",0,&nTags); pzCancelTags = find_repeatable_option("cancel",0,&nCancels); fClose = find_option("close",0,0)!=0; fHide = find_option("hide",0,0)!=0; fDryRun = find_option("dry-run","n",0)!=0; if( fDryRun==0 ) fDryRun = find_option("dryrun","n",0)!=0; zChngTime = find_option("date-override",0,1); if( zChngTime==0 ) zChngTime = find_option("chngtime",0,1); zUserOvrd = find_option("user-override",0,1); db_find_and_open_repository(0,0); user_select(); verify_all_options(); if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); rid = name_to_typed_rid(g.argv[2], "ci"); if( rid==0 && !is_a_version(rid) ) fossil_fatal("no such check-in"); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
︙ | ︙ | |||
3044 3045 3046 3047 3048 3049 3050 | cancel_tag(rid,pzCancelTags[i]); } fossil_free((void *)pzCancelTags); } if( fHide && !fHasHidden ) hide_branch(); if( fClose && !fHasClosed ) close_leaf(rid); if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); | | > | | > > > > | 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 | cancel_tag(rid,pzCancelTags[i]); } fossil_free((void *)pzCancelTags); } if( fHide && !fHasHidden ) hide_branch(); if( fClose && !fHasClosed ) close_leaf(rid); if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch); apply_newtags(&ctrl, rid, zUuid, zUserOvrd, fDryRun); if( fDryRun==0 ){ show_common_info(rid, "uuid:", 1, 0); } if( g.localOpen ){ manifest_to_disk(rid); } } |
Changes to src/json_status.c.
︙ | ︙ | |||
152 153 154 155 156 157 158 | cson_object_set( oPay, "errorCount", json_new_int( nErr ) ); db_finalize(&q); #if 0 /* TODO: add "merged with" status. First need (A) to decide on a structure and (B) to set up some tests for the multi-merge case.*/ | < | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | cson_object_set( oPay, "errorCount", json_new_int( nErr ) ); db_finalize(&q); #if 0 /* TODO: add "merged with" status. First need (A) to decide on a structure and (B) to set up some tests for the multi-merge case.*/ db_prepare(&q, "SELECT mhash, id FROM vmerge WHERE id<=0"); while( db_step(&q)==SQLITE_ROW ){ const char *zLabel = "MERGED_WITH"; switch( db_column_int(&q, 1) ){ case -1: zLabel = "CHERRYPICK "; break; case -2: zLabel = "BACKOUT "; break; case -4: zLabel = "INTEGRATE "; break; } |
︙ | ︙ |
Changes to src/json_user.c.
︙ | ︙ | |||
184 185 186 187 188 189 190 | #undef CSTR cson_int_t uid = cson_value_get_integer( cson_object_get(pUser, "uid") ); char const tgtHasSetup = zCap && (NULL!=strchr(zCap, 's')); char tgtHadSetup = 0; Blob sql = empty_blob; Stmt q = empty_Stmt; | < < < < < < < | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | #undef CSTR cson_int_t uid = cson_value_get_integer( cson_object_get(pUser, "uid") ); char const tgtHasSetup = zCap && (NULL!=strchr(zCap, 's')); char tgtHadSetup = 0; Blob sql = empty_blob; Stmt q = empty_Stmt; if(uid<=0 && (!zName||!*zName)){ return json_set_err(FSL_JSON_E_MISSING_ARGS, "One of 'uid' or 'name' is required."); }else if(uid>0){ zNameFree = db_text(NULL, "SELECT login FROM user WHERE uid=%d",uid); if(!zNameFree){ return json_set_err(FSL_JSON_E_RESOURCE_NOT_FOUND, |
︙ | ︙ |
Changes to src/loadctrl.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 | } /* ** Abort the current operation of the load average of the host computer ** is too high. */ void load_control(void){ | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | } /* ** Abort the current operation of the load average of the host computer ** is too high. */ void load_control(void){ double mxLoad = atof(db_get("max-loadavg", 0)); if( mxLoad<=0.0 || mxLoad>=load_average() ) return; style_header("Server Overload"); @ <h2>The server load is currently too high. @ Please try again later.</h2> @ <p>Current load average: %f(load_average()).<br /> @ Load average limit: %f(mxLoad)</p> |
︙ | ︙ |
Changes to src/login.c.
︙ | ︙ | |||
432 433 434 435 436 437 438 | ** string frequently, but it always seems to include the following text: */ if( sqlite3_strglob("*Safari/537.36Mozilla/5.0*", zAgent)==0 ) return 0; if( sqlite3_strglob("*Firefox/[1-9]*", zAgent)==0 ) return 1; if( sqlite3_strglob("*Chrome/[1-9]*", zAgent)==0 ) return 1; if( sqlite3_strglob("*(compatible;?MSIE?[1789]*", zAgent)==0 ) return 1; | | > > | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | ** string frequently, but it always seems to include the following text: */ if( sqlite3_strglob("*Safari/537.36Mozilla/5.0*", zAgent)==0 ) return 0; if( sqlite3_strglob("*Firefox/[1-9]*", zAgent)==0 ) return 1; if( sqlite3_strglob("*Chrome/[1-9]*", zAgent)==0 ) return 1; if( sqlite3_strglob("*(compatible;?MSIE?[1789]*", zAgent)==0 ) return 1; if( sqlite3_strglob("*Trident/[1-9]*;?rv:[1-9]*", zAgent)==0 ){ return 1; /* IE11+ */ } if( sqlite3_strglob("*AppleWebKit/[1-9]*(KHTML*", zAgent)==0 ) return 1; return 0; } if( strncmp(zAgent, "Opera/", 6)==0 ) return 1; if( strncmp(zAgent, "Safari/", 7)==0 ) return 1; if( strncmp(zAgent, "Lynx/", 5)==0 ) return 1; if( strncmp(zAgent, "NetSurf/", 8)==0 ) return 1; |
︙ | ︙ | |||
510 511 512 513 514 515 516 | ** to self-registered users. */ int login_self_register_available(const char *zNeeded){ CapabilityString *pCap; int rc; if( !db_get_boolean("self-register",0) ) return 0; if( zNeeded==0 ) return 1; | | | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | ** to self-registered users. */ int login_self_register_available(const char *zNeeded){ CapabilityString *pCap; int rc; if( !db_get_boolean("self-register",0) ) return 0; if( zNeeded==0 ) return 1; pCap = capability_add(0, db_get("default-perms", 0)); capability_expand(pCap); rc = capability_has_any(pCap, zNeeded); capability_free(pCap); return rc; } /* |
︙ | ︙ | |||
547 548 549 550 551 552 553 | int uid; /* User id logged in user */ char *zSha1Pw; const char *zIpAddr; /* IP address of requestor */ const char *zReferer; int noAnon = P("noanon")!=0; login_check_credentials(); | | < < < < < < < < < < < < < < < < < < < < < < < | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | int uid; /* User id logged in user */ char *zSha1Pw; const char *zIpAddr; /* IP address of requestor */ const char *zReferer; int noAnon = P("noanon")!=0; login_check_credentials(); fossil_redirect_to_https_if_needed(1); sqlite3_create_function(g.db, "constant_time_cmp", 2, SQLITE_UTF8, 0, constant_time_cmp_function, 0, 0); zUsername = P("u"); zPasswd = P("p"); anonFlag = g.zLogin==0 && PB("anon"); /* Handle log-out requests */ |
︙ | ︙ | |||
718 719 720 721 722 723 724 725 726 727 728 729 730 731 | } if( anonFlag ){ @ <input type="hidden" name="anon" value="1" /> } if( g.zLogin ){ @ <p>Currently logged in as <b>%h(g.zLogin)</b>. @ <input type="submit" name="out" value="Logout"></p> }else{ @ <table class="login_out"> @ <tr> @ <td class="form_label">User ID:</td> if( anonFlag ){ @ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td> }else{ | > | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | } if( anonFlag ){ @ <input type="hidden" name="anon" value="1" /> } if( g.zLogin ){ @ <p>Currently logged in as <b>%h(g.zLogin)</b>. @ <input type="submit" name="out" value="Logout"></p> @ </form> }else{ @ <table class="login_out"> @ <tr> @ <td class="form_label">User ID:</td> if( anonFlag ){ @ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td> }else{ |
︙ | ︙ | |||
912 913 914 915 916 917 918 | " AND length(cap)>0" " AND length(pw)>0" " AND constant_time_cmp(cookie,%Q)=0", zLogin, zRemoteAddr, zCookie ); return uid; } | < < < < < < < < < < < < < < < < | | | > > | 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 | " AND length(cap)>0" " AND length(pw)>0" " AND constant_time_cmp(cookie,%Q)=0", zLogin, zRemoteAddr, zCookie ); return uid; } /* ** Attempt to use Basic Authentication to establish the user. Return the ** (non-zero) uid if successful. Return 0 if it does not work. */ static int login_basic_authentication(const char *zIpAddr){ const char *zAuth = PD("HTTP_AUTHORIZATION", 0); int i; int uid = 0; int nDecode = 0; char *zDecode = 0; const char *zUsername = 0; const char *zPasswd = 0; if( zAuth==0 ) return 0; /* Fail: No Authentication: header */ while( fossil_isspace(zAuth[0]) ) zAuth++; /* Skip leading whitespace */ if( strncmp(zAuth, "Basic ", 6)!=0 ){ return 0; /* Fail: Not Basic Authentication */ } /* Parse out the username and password, separated by a ":" */ zAuth += 6; while( fossil_isspace(zAuth[0]) ) zAuth++; zDecode = decode64(zAuth, &nDecode); for(i=0; zDecode[i] && zDecode[i]!=':'; i++){} |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | } /* If the request didn't provide a login cookie or the login cookie didn't ** match a known valid user, check the HTTP "Authorization" header and ** see if those credentials are valid for a known user. */ if( uid==0 && db_get_boolean("http_authentication_ok",0) ){ | | | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | } /* If the request didn't provide a login cookie or the login cookie didn't ** match a known valid user, check the HTTP "Authorization" header and ** see if those credentials are valid for a known user. */ if( uid==0 && db_get_boolean("http_authentication_ok",0) ){ uid = login_basic_authentication(zIpAddr); } /* If no user found yet, try to log in as "nobody" */ if( uid==0 ){ uid = db_int(0, "SELECT uid FROM user WHERE login='nobody'"); if( uid==0 ){ /* If there is no user "nobody", then make one up - with no privileges */ |
︙ | ︙ | |||
1194 1195 1196 1197 1198 1199 1200 | */ zPublicPages = db_get("public-pages",0); if( zPublicPages!=0 ){ Glob *pGlob = glob_create(zPublicPages); const char *zUri = PD("REQUEST_URI",""); zUri += (int)strlen(g.zTop); if( glob_match(pGlob, zUri) ){ | | | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | */ zPublicPages = db_get("public-pages",0); if( zPublicPages!=0 ){ Glob *pGlob = glob_create(zPublicPages); const char *zUri = PD("REQUEST_URI",""); zUri += (int)strlen(g.zTop); if( glob_match(pGlob, zUri) ){ login_set_capabilities(db_get("default-perms", 0), 0); } glob_free(pGlob); } } /* ** Memory of settings |
︙ | ︙ | |||
1261 1262 1263 1264 1265 1266 1267 | p->RdWiki = p->WrWiki = p->NewWiki = p->ApndWiki = p->Hyperlink = p->Clone = p->NewTkt = p->Password = p->RdAddr = p->TktFmt = p->Attach = p->ApndTkt = p->ModWiki = p->ModTkt = p->Delete = p->RdForum = p->WrForum = p->ModForum = p->WrTForum = p->AdminForum = | | < | 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 | p->RdWiki = p->WrWiki = p->NewWiki = p->ApndWiki = p->Hyperlink = p->Clone = p->NewTkt = p->Password = p->RdAddr = p->TktFmt = p->Attach = p->ApndTkt = p->ModWiki = p->ModTkt = p->Delete = p->RdForum = p->WrForum = p->ModForum = p->WrTForum = p->AdminForum = p->EmailAlert = p->Announce = p->Debug = 1; /* Fall thru into Read/Write */ case 'i': p->Read = p->Write = 1; break; case 'o': p->Read = 1; break; case 'z': p->Zip = 1; break; case 'd': p->Delete = 1; break; case 'h': p->Hyperlink = 1; break; |
︙ | ︙ | |||
1459 1460 1461 1462 1463 1464 1465 | }else #endif /* FOSSIL_ENABLE_JSON */ { const char *zUrl = PD("REQUEST_URI", "index"); const char *zQS = P("QUERY_STRING"); Blob redir; blob_init(&redir, 0, 0); | | < | > | 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 | }else #endif /* FOSSIL_ENABLE_JSON */ { const char *zUrl = PD("REQUEST_URI", "index"); const char *zQS = P("QUERY_STRING"); Blob redir; blob_init(&redir, 0, 0); if( fossil_wants_https(1) ){ blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrl); }else{ blob_appendf(&redir, "%R/login?g=%T", zUrl); } if( zQS && zQS[0] ){ blob_appendf(&redir, "%%3f%T", zQS); } if( anonOk ) blob_append(&redir, "&anon", 5); cgi_redirect(blob_str(&redir)); /* NOTREACHED */ assert(0); } } /* |
︙ | ︙ | |||
1537 1538 1539 1540 1541 1542 1543 | if( !db_get_boolean("self-register", 0) ){ style_header("Registration not possible"); @ <p>This project does not allow user self-registration. Please contact the @ project administrator to obtain an account.</p> style_footer(); return; } | | | 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 | if( !db_get_boolean("self-register", 0) ){ style_header("Registration not possible"); @ <p>This project does not allow user self-registration. Please contact the @ project administrator to obtain an account.</p> style_footer(); return; } zPerms = db_get("default-perms", 0); /* Prompt the user for email alerts if this repository is configured for ** email alerts and if the default permissions include "7" */ canDoAlerts = alert_tables_exist() && db_int(0, "SELECT fullcap(%Q) GLOB '*7*'", zPerms ); doAlerts = canDoAlerts && atoi(PD("alerts","1"))!=0; |
︙ | ︙ | |||
1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 | /* ** Attempt to join a login-group. ** ** If problems arise, leave an error message in *pzErrMsg. */ void login_group_join( const char *zRepo, /* Repository file in the login group */ const char *zLogin, /* Login name for the other repo */ const char *zPassword, /* Password to prove we are authorized to join */ const char *zNewName, /* Name of new login group if making a new one */ char **pzErrMsg /* Leave an error message here */ ){ Blob fullName; /* Blob for finding full pathnames */ sqlite3 *pOther; /* The other repository */ int rc; /* Return code from sqlite3 functions */ char *zOtherProjCode; /* Project code for pOther */ | > < | 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | /* ** Attempt to join a login-group. ** ** If problems arise, leave an error message in *pzErrMsg. */ void login_group_join( const char *zRepo, /* Repository file in the login group */ int bPwRequired, /* True if the login,password is required */ const char *zLogin, /* Login name for the other repo */ const char *zPassword, /* Password to prove we are authorized to join */ const char *zNewName, /* Name of new login group if making a new one */ char **pzErrMsg /* Leave an error message here */ ){ Blob fullName; /* Blob for finding full pathnames */ sqlite3 *pOther; /* The other repository */ int rc; /* Return code from sqlite3 functions */ char *zOtherProjCode; /* Project code for pOther */ char *zSelfRepo; /* Name of our repository */ char *zSelfLabel; /* Project-name for our repository */ char *zSelfProjCode; /* Our project-code */ char *zSql; /* SQL to run on all peers */ const char *zSelf; /* The ATTACH name of our repository */ *pzErrMsg = 0; /* Default to no errors */ |
︙ | ︙ | |||
1922 1923 1924 1925 1926 1927 1928 | /* Attach the other repository. Make sure the username/password is ** valid and has Setup permission. */ db_attach(zRepo, "other"); zOtherProjCode = db_text("x", "SELECT value FROM other.config" " WHERE name='project-code'"); | > > | | | | | | | | | | | > | 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 | /* Attach the other repository. Make sure the username/password is ** valid and has Setup permission. */ db_attach(zRepo, "other"); zOtherProjCode = db_text("x", "SELECT value FROM other.config" " WHERE name='project-code'"); if( bPwRequired ){ char *zPwHash; /* Password hash on pOther */ zPwHash = sha1_shared_secret(zPassword, zLogin, zOtherProjCode); if( !db_exists( "SELECT 1 FROM other.user" " WHERE login=%Q AND cap GLOB '*s*'" " AND (pw=%Q OR pw=%Q)", zLogin, zPassword, zPwHash) ){ db_detach("other"); *pzErrMsg = "The supplied username/password does not correspond to a" " user Setup permission on the other repository."; return; } } /* Create all the necessary CONFIG table entries on both the ** other repository and on our own repository. */ zSelfProjCode = abbreviated_project_code(zSelfProjCode); zOtherProjCode = abbreviated_project_code(zOtherProjCode); |
︙ | ︙ | |||
2003 2004 2005 2006 2007 2008 2009 2010 | login_group_sql(zSql, "<li> ", "</li>", pzErrMsg); fossil_free(zSql); db_multi_exec( "DELETE FROM config " " WHERE name GLOB 'peer-*'" " OR name GLOB 'login-group-*';" ); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | login_group_sql(zSql, "<li> ", "</li>", pzErrMsg); fossil_free(zSql); db_multi_exec( "DELETE FROM config " " WHERE name GLOB 'peer-*'" " OR name GLOB 'login-group-*';" ); } /* ** COMMAND: login-group* ** ** Usage: %fossil login-group ** or: %fossil login-group join REPO [-name NAME] ** or: %fossil login-group leave ** ** With no arguments, this command shows the login-group to which the ** repository belongs. ** ** The "join" command adds this repository to login group to which REPO ** belongs, or creates a new login group between itself and REPO if REPO ** does not already belong to a login-group. When creating a new login- ** group, the name of the new group is determined by the "--name" option. ** ** The "leave" command takes the repository out of whatever login group ** it is currently a part of. ** ** About Login Groups: ** ** A login-group is a set of repositories that share user credentials. ** If a user is logged into one member of the group, then that user can ** access any other group member as long as they have an entry in the ** USER table of that member. If a user changes their password using ** web interface, their password is also automatically changed in every ** other member of the login group. */ void login_group_command(void){ const char *zLGName; const char *zCmd; int nCmd; Stmt q; db_find_and_open_repository(0,0); if( g.argc>2 ){ zCmd = g.argv[2]; nCmd = (int)strlen(zCmd); if( strncmp(zCmd,"join",nCmd)==0 && nCmd>=1 ){ const char *zNewName = find_option("name",0,1); const char *zOther; char *zErr = 0; verify_all_options(); if( g.argc!=4 ){ fossil_fatal("unknown extra arguments to \"login-group join\""); } zOther = g.argv[3]; login_group_leave(&zErr); sqlite3_free(zErr); zErr = 0; login_group_join(zOther,0,0,0,zNewName,&zErr); if( zErr ){ fossil_fatal("%s", zErr); } }else if( strncmp(zCmd,"leave",nCmd)==0 && nCmd>=1 ){ verify_all_options(); if( g.argc!=3 ){ fossil_fatal("unknown extra arguments to \"login-group leave\""); } zLGName = login_group_name(); if( zLGName ){ char *zErr = 0; fossil_print("Leaving login-group \"%s\"\n", zLGName); login_group_leave(&zErr); if( zErr ) fossil_fatal("Oops: %s", zErr); return; } }else{ fossil_fatal("unknown command \"%s\" - should be \"join\" or \"leave\"", zCmd); } } /* Show the current login group information */ zLGName = login_group_name(); if( zLGName==0 ){ fossil_print("Not currently a part of any login-group\n"); return; } fossil_print("Now part of login-group \"%s\" with:\n", zLGName); db_prepare(&q, "SELECT value FROM config WHERE name LIKE 'peer-name-%%'"); while( db_step(&q)==SQLITE_ROW ){ fossil_print(" %s\n", db_column_text(&q,0)); } db_finalize(&q); } |
Changes to src/lookslike.c.
︙ | ︙ | |||
361 362 363 364 365 366 367 | ** clause D98 of conformance (section 3.10) of the Unicode standard. */ int starts_with_utf16_bom( const Blob *pContent, /* IN: Blob content to perform BOM detection on. */ int *pnByte, /* OUT: The number of bytes used for the BOM. */ int *pbReverse /* OUT: Non-zero for BOM in reverse byte-order. */ ){ | | > | > | | | 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 | ** clause D98 of conformance (section 3.10) of the Unicode standard. */ int starts_with_utf16_bom( const Blob *pContent, /* IN: Blob content to perform BOM detection on. */ int *pnByte, /* OUT: The number of bytes used for the BOM. */ int *pbReverse /* OUT: Non-zero for BOM in reverse byte-order. */ ){ const unsigned char *z = (unsigned char *)blob_buffer(pContent); int bomSize = sizeof(unsigned short); int size = blob_size(pContent); unsigned short i0; if( size<bomSize ) goto noBom; /* No: cannot read BOM. */ if( size>=(2*bomSize) && z[2]==0 && z[3]==0 ) goto noBom; memcpy(&i0, z, sizeof(i0)); if( i0==0xfeff ){ if( pbReverse ) *pbReverse = 0; }else if( i0==0xfffe ){ if( pbReverse ) *pbReverse = 1; }else{ static const int one = 1; noBom: if( pbReverse ) *pbReverse = *(char *) &one; return 0; /* No: UTF-16 byte-order-mark not found. */ } |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # include "cson_amalgamation.h" /* JSON API. */ # include "json_detail.h" #endif #ifdef HAVE_BACKTRACE # include <execinfo.h> #endif /* ** Maximum number of auxiliary parameters on reports */ #define MX_AUX 5 /* ** Holds flags for fossil user permissions. | > > > > > > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # include "cson_amalgamation.h" /* JSON API. */ # include "json_detail.h" #endif #ifdef HAVE_BACKTRACE # include <execinfo.h> #endif /* ** Default length of a timeout for serving an HTTP request. Changable ** using the "--timeout N" command-line option or via "timeout: N" in the ** CGI script. */ #ifndef FOSSIL_DEFAULT_TIMEOUT # define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */ #endif /* ** Maximum number of auxiliary parameters on reports */ #define MX_AUX 5 /* ** Holds flags for fossil user permissions. |
︙ | ︙ | |||
94 95 96 97 98 99 100 | char Zip; /* z: download zipped artifact via /zip URL */ char Private; /* x: can send and receive private content */ char WrUnver; /* y: can push unversioned content */ char RdForum; /* 2: Read forum posts */ char WrForum; /* 3: Create new forum posts */ char WrTForum; /* 4: Post to forums not subject to moderation */ char ModForum; /* 5: Moderate (approve or reject) forum posts */ | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | char Zip; /* z: download zipped artifact via /zip URL */ char Private; /* x: can send and receive private content */ char WrUnver; /* y: can push unversioned content */ char RdForum; /* 2: Read forum posts */ char WrForum; /* 3: Create new forum posts */ char WrTForum; /* 4: Post to forums not subject to moderation */ char ModForum; /* 5: Moderate (approve or reject) forum posts */ char AdminForum; /* 6: Grant capability 4 to other users */ char EmailAlert; /* 7: Sign up for email notifications */ char Announce; /* A: Send announcements */ char Debug; /* D: show extra Fossil debugging features */ /* These last two are included to block infinite recursion */ char XReader; /* u: Inherit all privileges of "reader" */ char XDeveloper; /* v: Inherit all privileges of "developer" */ }; |
︙ | ︙ | |||
138 139 140 141 142 143 144 | const char *zErrlog; /* Log errors to this file, if not NULL */ int isConst; /* True if the output is unchanging & cacheable */ const char *zVfsName; /* The VFS to use for database connections */ sqlite3 *db; /* The connection to the databases */ sqlite3 *dbConfig; /* Separate connection for global_config table */ char *zAuxSchema; /* Main repository aux-schema */ int dbIgnoreErrors; /* Ignore database errors if true */ | | > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | const char *zErrlog; /* Log errors to this file, if not NULL */ int isConst; /* True if the output is unchanging & cacheable */ const char *zVfsName; /* The VFS to use for database connections */ sqlite3 *db; /* The connection to the databases */ sqlite3 *dbConfig; /* Separate connection for global_config table */ char *zAuxSchema; /* Main repository aux-schema */ int dbIgnoreErrors; /* Ignore database errors if true */ char *zConfigDbName; /* Path of the config database. NULL if not open */ sqlite3_int64 now; /* Seconds since 1970 */ int repositoryOpen; /* True if the main repository database is open */ unsigned iRepoDataVers; /* Initial data version for repository database */ char *zRepositoryOption; /* Most recent cached repository option value */ char *zRepositoryName; /* Name of the repository database file */ char *zLocalDbName; /* Name of the local database file */ char *zOpenRevision; /* Check-in version to use during database open */ const char *zCmdName; /* Name of the Fossil command currently running */ int localOpen; /* True if the local database is open */ char *zLocalRoot; /* The directory holding the local database */ int minPrefix; /* Number of digits needed for a distinct UUID */ int eHashPolicy; /* Current hash policy. One of HPOLICY_* */ int fSqlTrace; /* True if --sqltrace flag is present */ int fSqlStats; /* True if --sqltrace or --sqlstats are present */ int fSqlPrint; /* True if --sqlprint flag is present */ |
︙ | ︙ | |||
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 | int fNoSync; /* Do not do an autosync ever. --nosync */ int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */ char *zPath; /* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ char *zHttpsURL; /* zBaseURL translated to https: */ char *zTop; /* Parent directory of zPath */ const char *zContentType; /* The content type of the input HTTP request */ int iErrPriority; /* Priority of current error message */ char *zErrMsg; /* Text of an error message */ int sslNotAvailable; /* SSL is not available. Do not redirect to https: */ Blob cgiIn; /* Input to an xfer www method */ int cgiOutput; /* 0: command-line 1: CGI. 2: after CGI */ int xferPanic; /* Write error messages in XFER protocol */ int fullHttpReply; /* True for full HTTP reply. False for CGI reply */ Th_Interp *interp; /* The TH1 interpreter */ char *th1Setup; /* The TH1 post-creation setup script, if any */ int th1Flags; /* The TH1 integration state flags */ FILE *httpIn; /* Accept HTTP input from here */ FILE *httpOut; /* Send HTTP output here */ int xlinkClusterOnly; /* Set when cloning. Only process clusters */ int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ int *aCommitFile; /* Array of files to be committed */ int markPrivate; /* All new artifacts are private if true */ int clockSkewSeen; /* True if clocks on client and server out of sync */ int wikiFlags; /* Wiki conversion flags applied to %W */ char isHTTP; /* True if server/CGI modes, else assume CLI. */ char javascriptHyperlink; /* If true, set href= using script, not HTML */ Blob httpHeader; /* Complete text of the HTTP request header */ UrlData url; /* Information about current URL */ const char *zLogin; /* Login name. NULL or "" if not logged in. */ const char *zSSLIdentity; /* Value of --ssl-identity option, filename of ** SSL client identity */ int useLocalauth; /* No login required if from 127.0.0.1 */ int noPswd; /* Logged in without password (on 127.0.0.1) */ int userUid; /* Integer user id */ int isHuman; /* True if access by a human, not a spider or bot */ | > > | > | 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 | int fNoSync; /* Do not do an autosync ever. --nosync */ int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */ char *zPath; /* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ char *zHttpsURL; /* zBaseURL translated to https: */ char *zTop; /* Parent directory of zPath */ const char *zExtRoot; /* Document root for the /ext sub-website */ const char *zContentType; /* The content type of the input HTTP request */ int iErrPriority; /* Priority of current error message */ char *zErrMsg; /* Text of an error message */ int sslNotAvailable; /* SSL is not available. Do not redirect to https: */ Blob cgiIn; /* Input to an xfer www method */ int cgiOutput; /* 0: command-line 1: CGI. 2: after CGI */ int xferPanic; /* Write error messages in XFER protocol */ int fullHttpReply; /* True for full HTTP reply. False for CGI reply */ Th_Interp *interp; /* The TH1 interpreter */ char *th1Setup; /* The TH1 post-creation setup script, if any */ int th1Flags; /* The TH1 integration state flags */ FILE *httpIn; /* Accept HTTP input from here */ FILE *httpOut; /* Send HTTP output here */ int xlinkClusterOnly; /* Set when cloning. Only process clusters */ int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */ int *aCommitFile; /* Array of files to be committed */ int markPrivate; /* All new artifacts are private if true */ char *ckinLockFail; /* Check-in lock failure received from server */ int clockSkewSeen; /* True if clocks on client and server out of sync */ int wikiFlags; /* Wiki conversion flags applied to %W */ char isHTTP; /* True if server/CGI modes, else assume CLI. */ char javascriptHyperlink; /* If true, set href= using script, not HTML */ Blob httpHeader; /* Complete text of the HTTP request header */ UrlData url; /* Information about current URL */ const char *zLogin; /* Login name. NULL or "" if not logged in. */ const char *zSSLIdentity; /* Value of --ssl-identity option, filename of ** SSL client identity */ int useLocalauth; /* No login required if from 127.0.0.1 */ int noPswd; /* Logged in without password (on 127.0.0.1) */ int userUid; /* Integer user id */ int isHuman; /* True if access by a human, not a spider or bot */ int comFmtFlags; /* Zero or more "COMMENT_PRINT_*" bit flags, should be ** accessed through get_comment_format(). */ /* Information used to populate the RCVFROM table */ int rcvid; /* The rcvid. 0 if not yet defined. */ char *zIpAddr; /* The remote IP address */ char *zNonce; /* The nonce used for login */ /* permissions available to current user */ |
︙ | ︙ | |||
313 314 315 316 317 318 319 320 321 322 323 324 325 326 | Global g; /* ** atexit() handler which frees up "some" of the resources ** used by fossil. */ static void fossil_atexit(void) { #if USE_SEE /* ** Zero, unlock, and free the saved database encryption key now. */ db_unsave_encryption_key(); #endif #if defined(_WIN32) || defined(__BIONIC__) | > > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | Global g; /* ** atexit() handler which frees up "some" of the resources ** used by fossil. */ static void fossil_atexit(void) { static int once = 0; if( once++ ) return; /* Ensure that this routine only runs once */ #if USE_SEE /* ** Zero, unlock, and free the saved database encryption key now. */ db_unsave_encryption_key(); #endif #if defined(_WIN32) || defined(__BIONIC__) |
︙ | ︙ | |||
347 348 349 350 351 352 353 354 355 356 357 358 359 360 | cson_value_free(g.json.gc.v); memset(&g.json, 0, sizeof(g.json)); #endif free(g.zErrMsg); if(g.db){ db_close(0); } /* ** FIXME: The next two lines cannot always be enabled; however, they ** are very useful for tracking down TH1 memory leaks. */ if( fossil_getenv("TH1_DELETE_INTERP")!=0 ){ if( g.interp ){ Th_DeleteInterp(g.interp); g.interp = 0; | > > > | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | cson_value_free(g.json.gc.v); memset(&g.json, 0, sizeof(g.json)); #endif free(g.zErrMsg); if(g.db){ db_close(0); } manifest_clear_cache(); content_clear_cache(1); rebuild_clear_cache(); /* ** FIXME: The next two lines cannot always be enabled; however, they ** are very useful for tracking down TH1 memory leaks. */ if( fossil_getenv("TH1_DELETE_INTERP")!=0 ){ if( g.interp ){ Th_DeleteInterp(g.interp); g.interp = 0; |
︙ | ︙ | |||
370 371 372 373 374 375 376 | ** (2) Read the file FILENAME ** (3) Use the contents of FILE to replace the two removed arguments: ** (a) Ignore blank lines in the file ** (b) Each non-empty line of the file is an argument, except ** (c) If the line begins with "-" and contains a space, it is broken ** into two arguments at the space. */ | | > | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | ** (2) Read the file FILENAME ** (3) Use the contents of FILE to replace the two removed arguments: ** (a) Ignore blank lines in the file ** (b) Each non-empty line of the file is an argument, except ** (c) If the line begins with "-" and contains a space, it is broken ** into two arguments at the space. */ void expand_args_option(int argc, void *argv){ Blob file = empty_blob; /* Content of the file */ Blob line = empty_blob; /* One line of the file */ unsigned int nLine; /* Number of lines in the file*/ unsigned int i, j, k; /* Loop counters */ int n; /* Number of bytes in one line */ unsigned int nArg; /* Number of new arguments */ char *z; /* General use string pointer */ char **newArgv; /* New expanded g.argv under construction */ const char *zFileName; /* input file name */ FILE *inFile; /* input FILE */ #if defined(_WIN32) wchar_t buf[MAX_PATH]; #endif |
︙ | ︙ | |||
409 410 411 412 413 414 415 | if( z[0]=='-' ) z++; if( z[0]==0 ) return; /* Stop searching at "--" */ if( fossil_strcmp(z, "args")==0 ) break; } if( i>=g.argc-1 ) return; zFileName = g.argv[i+1]; | | | > > > | | | < > > | | | | | < > > | | < | < > > > > > | 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 | if( z[0]=='-' ) z++; if( z[0]==0 ) return; /* Stop searching at "--" */ if( fossil_strcmp(z, "args")==0 ) break; } if( i>=g.argc-1 ) return; zFileName = g.argv[i+1]; if( strcmp(zFileName,"-")==0 ){ inFile = stdin; }else if( !file_isfile(zFileName, ExtFILE) ){ fossil_fatal("Not an ordinary file: \"%s\"", zFileName); }else{ inFile = fossil_fopen(zFileName,"rb"); if( inFile==0 ){ fossil_fatal("Cannot open -args file [%s]", zFileName); } } blob_read_from_channel(&file, inFile, -1); if(stdin != inFile){ fclose(inFile); } inFile = NULL; blob_to_utf8_no_bom(&file, 1); z = blob_str(&file); for(k=0, nLine=1; z[k]; k++) if( z[k]=='\n' ) nLine++; if( nLine>100000000 ) fossil_fatal("too many command-line arguments"); nArg = g.argc + nLine*2; newArgv = fossil_malloc( sizeof(char*)*nArg ); for(j=0; j<i; j++) newArgv[j] = g.argv[j]; blob_rewind(&file); while( (n = blob_line(&file, &line))>0 ){ if( n<1 ){ /* Reminder: corner-case: a line with 1 byte and no newline. */ continue; } z = blob_buffer(&line); if('\n'==z[n-1]){ z[n-1] = 0; } if((n>1) && ('\r'==z[n-2])){ if(n==2) continue /*empty line*/; z[n-2] = 0; } if(!z[0]) continue; if( j>=nArg ){ fossil_fatal("malformed command-line arguments"); } newArgv[j++] = z; if( z[0]=='-' ){ for(k=1; z[k] && !fossil_isspace(z[k]); k++){} if( z[k] ){ z[k] = 0; k++; if( z[k] ) newArgv[j++] = &z[k]; |
︙ | ︙ | |||
564 565 566 567 568 569 570 571 572 573 | ** This function attempts to find command line options known to contain ** bitwise flags and initializes the associated global variables. After ** this function executes, all global variables (i.e. in the "g" struct) ** containing option-settable bitwise flag fields must be initialized. */ static void fossil_init_flags_from_options(void){ const char *zValue = find_option("comfmtflags", 0, 1); if( zValue ){ g.comFmtFlags = atoi(zValue); }else{ | > > > | | 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | ** This function attempts to find command line options known to contain ** bitwise flags and initializes the associated global variables. After ** this function executes, all global variables (i.e. in the "g" struct) ** containing option-settable bitwise flag fields must be initialized. */ static void fossil_init_flags_from_options(void){ const char *zValue = find_option("comfmtflags", 0, 1); if( zValue==0 ){ zValue = find_option("comment-format", 0, 1); } if( zValue ){ g.comFmtFlags = atoi(zValue); }else{ g.comFmtFlags = COMMENT_PRINT_UNSET; /* Command-line option not found. */ } } /* ** Check to see if the Fossil binary contains an appended repository ** file using the appendvfs extension. If so, change command-line arguments ** to cause Fossil to launch with "fossil ui" on that repo. |
︙ | ︙ | |||
593 594 595 596 597 598 599 | return 0; } } /* ** This procedure runs first. */ | > > > | | | < | | > | | | > > > > > > | 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 | return 0; } } /* ** This procedure runs first. */ #if defined(FOSSIL_FUZZ) /* Do not include a main() procedure when building for fuzz testing. ** libFuzzer will supply main(). */ #elif defined(_WIN32) && !defined(BROKEN_MINGW_CMDLINE) int _dowildcard = -1; /* This turns on command-line globbing in MinGW-w64 */ int wmain(int argc, wchar_t **argv){ return fossil_main(argc, argv); } #elif defined(_WIN32) int _CRT_glob = 0x0001; /* See MinGW bug #2062 */ int main(int argc, char **argv){ return fossil_main(argc, argv); } #else int main(int argc, char **argv){ return fossil_main(argc, argv); } #endif /* All the work of main() is done by a separate procedure "fossil_main()". ** We have to break this out, because fossil_main() is sometimes called ** separately (by the "shell" command) but we do not want atwait() handlers ** being called by separate invocations of fossil_main(). */ int fossil_main(int argc, char **argv){ const char *zCmdName = "unknown"; const CmdOrPage *pCmd = 0; int rc; #if !defined(_WIN32_WCE) if( fossil_getenv("FOSSIL_BREAK") ){ if( isatty(0) && isatty(2) ){ |
︙ | ︙ | |||
769 770 771 772 773 774 775 776 777 778 779 780 781 782 | g.httpOut = stdout; g.fullHttpReply = !g.isHTTP; fossil_panic("file descriptor 2 is not open. (fd=%d, errno=%d)", fd, x); } } #endif rc = dispatch_name_search(zCmdName, CMDFLAG_COMMAND|CMDFLAG_PREFIX, &pCmd); if( rc==1 ){ #ifdef FOSSIL_ENABLE_TH1_HOOKS if( !g.isHTTP && !g.fNoThHook ){ rc = Th_CommandHook(zCmdName, 0); }else{ rc = TH_OK; | > | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | g.httpOut = stdout; g.fullHttpReply = !g.isHTTP; fossil_panic("file descriptor 2 is not open. (fd=%d, errno=%d)", fd, x); } } #endif g.zCmdName = zCmdName; rc = dispatch_name_search(zCmdName, CMDFLAG_COMMAND|CMDFLAG_PREFIX, &pCmd); if( rc==1 ){ #ifdef FOSSIL_ENABLE_TH1_HOOKS if( !g.isHTTP && !g.fNoThHook ){ rc = Th_CommandHook(zCmdName, 0); }else{ rc = TH_OK; |
︙ | ︙ | |||
861 862 863 864 865 866 867 | g.argv[i] = g.argv[j]; } g.argc = i; } /* | | > > | > > > > | > > > | > > > | > | 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 | g.argv[i] = g.argv[j]; } g.argc = i; } /* ** Look for a command-line option. If present, remove it from the ** argument list and return a pointer to either the flag's name (if ** hasArg==0), sans leading - or --, or its value (if hasArg==1). ** Return NULL if the flag is not found. ** ** zLong is the "long" form of the flag and zShort is the ** short/abbreviated form (typically a single letter, but it may be ** longer). zLong must not be NULL, but zShort may be. ** ** hasArg==0 means the option is a flag. It is either present or not. ** hasArg==1 means the option has an argument, in which case a pointer ** to the argument's value is returned. For zLong, a flag value (if ** hasValue==1) may either be in the form (--flag=value) or (--flag ** value). For zShort, only the latter form is accepted. ** ** If a standalone argument of "--" is encountered in the argument ** list while searching for the given flag(s), this routine stops ** searching and NULL is returned. */ const char *find_option(const char *zLong, const char *zShort, int hasArg){ int i; int nLong; const char *zReturn = 0; assert( hasArg==0 || hasArg==1 ); nLong = strlen(zLong); for(i=1; i<g.argc; i++){ char *z; if( i+hasArg >= g.argc ) break; z = g.argv[i]; if( z[0]!='-' ) continue; z++; if( z[0]=='-' ){ if( z[1]==0 ){ /* Stop processing at "--" without consuming it. verify_all_options() will consume this flag. */ break; } z++; } if( strncmp(z,zLong,nLong)==0 ){ if( hasArg && z[nLong]=='=' ){ zReturn = &z[nLong+1]; |
︙ | ︙ | |||
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | zReturn = g.argv[i+hasArg]; remove_from_argv(i, 1+hasArg); break; } } return zReturn; } /* ** Look for multiple occurrences of a command-line option with the ** corresponding argument. ** ** Return a malloc allocated array of pointers to the arguments. ** ** pnUsedArgs is used to store the number of matched arguments. ** | > > > > > > > > > > > > > > > > > > > > > > | > > > | 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 | zReturn = g.argv[i+hasArg]; remove_from_argv(i, 1+hasArg); break; } } return zReturn; } /* Return true if zOption exists in the command-line arguments, ** but do not remove it from the list or otherwise process it. */ int has_option(const char *zOption){ int i; int n = (int)strlen(zOption); for(i=1; i<g.argc; i++){ char *z = g.argv[i]; if( z[0]!='-' ) continue; z++; if( z[0]=='-' ){ if( z[1]==0 ){ /* Stop processing at "--" */ break; } z++; } if( strncmp(z,zOption,n)==0 && (z[n]==0 || z[n]=='=') ) return 1; } return 0; } /* ** Look for multiple occurrences of a command-line option with the ** corresponding argument. ** ** Return a malloc allocated array of pointers to the arguments. ** ** pnUsedArgs is used to store the number of matched arguments. ** ** Caller is responsible for freeing allocated memory by passing the ** head of the array (not each entry) to fossil_free(). (The ** individual entries have the same lifetime as values returned from ** find_option().) */ const char **find_repeatable_option( const char *zLong, const char *zShort, int *pnUsedArgs ){ const char *zOption; |
︙ | ︙ | |||
958 959 960 961 962 963 964 965 966 967 968 | return g.zRepositoryOption; } /* ** Verify that there are no unprocessed command-line options. If ** Any remaining command-line argument begins with "-" print ** an error message and quit. */ void verify_all_options(void){ int i; for(i=1; i<g.argc; i++){ | > > > > > > > > > > > > > | > > > > > > | | | > < < < < < | 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 | return g.zRepositoryOption; } /* ** Verify that there are no unprocessed command-line options. If ** Any remaining command-line argument begins with "-" print ** an error message and quit. ** ** Exception: if "--" is encountered, it is consumed from the argument ** list and this function immediately returns. The effect is to treat ** all arguments after "--" as non-flags (conventionally used to ** enable passing-in of filenames which start with a dash). ** ** This function must normally only be called one time per app ** invokation. The exception is commands which process their ** arguments, call this to confirm that there are no extraneous flags, ** then modify the arguments list for forwarding to another ** (sub)command (which itself will call this to confirm its own ** arguments). */ void verify_all_options(void){ int i; for(i=1; i<g.argc; i++){ const char * arg = g.argv[i]; if( arg[0]=='-' ){ if( arg[1]=='-' && arg[2]==0 ){ /* Remove "--" from the list and treat all following ** arguments as non-flags. */ remove_from_argv(i, 1); break; }else if( arg[1]!=0 ){ fossil_fatal( "unrecognized command-line option or missing argument: %s", arg); } } } } /* ** This function returns a human readable version string. */ const char *get_version(){ static const char version[] = RELEASE_VERSION " " MANIFEST_VERSION " " MANIFEST_DATE " UTC"; |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | ** leading "http://" and the host and port. ** ** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME ** environment variables. However, if zAltBase is not NULL then it ** is the argument to the --baseurl option command-line option and ** g.zBaseURL and g.zTop is set from that instead. */ | | | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | ** leading "http://" and the host and port. ** ** The g.zBaseURL is normally set based on HTTP_HOST and SCRIPT_NAME ** environment variables. However, if zAltBase is not NULL then it ** is the argument to the --baseurl option command-line option and ** g.zBaseURL and g.zTop is set from that instead. */ void set_base_url(const char *zAltBase){ int i; const char *zHost; const char *zMode; const char *zCur; if( g.zBaseURL!=0 ) return; if( zAltBase ){ |
︙ | ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | db_open_repository(zRepo); } } #endif return zRepo; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | db_open_repository(zRepo); } } #endif return zRepo; } /* ** Called whenever a crash is encountered while processing a webpage. */ void sigsegv_handler(int x){ #if HAVE_BACKTRACE void *array[20]; size_t size; |
︙ | ︙ | |||
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | if( g.fAnyTrace ){ fprintf(stderr,"/***** sigpipe received by subprocess %d ****\n", getpid()); } #endif db_panic_close(); exit(1); } /* ** Preconditions: ** ** * Environment variables are set up according to the CGI standard. ** ** If the repository is known, it has already been opened. If unknown, | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 | if( g.fAnyTrace ){ fprintf(stderr,"/***** sigpipe received by subprocess %d ****\n", getpid()); } #endif db_panic_close(); exit(1); } /* ** Return true if it is appropriate to redirect requests to HTTPS. ** ** Redirect to https is appropriate if all of the above are true: ** (1) The redirect-to-https flag has a valud of iLevel or greater. ** (2) The current connection is http, not https or ssh ** (3) The sslNotAvailable flag is clear */ int fossil_wants_https(int iLevel){ if( g.sslNotAvailable ) return 0; if( db_get_int("redirect-to-https",0)<iLevel ) return 0; if( P("HTTPS")!=0 ) return 0; return 1; } /* ** Redirect to the equivalent HTTPS request if the current connection is ** insecure and if the redirect-to-https flag greater than or equal to ** iLevel. iLevel is 1 for /login pages and 2 for every other page. */ int fossil_redirect_to_https_if_needed(int iLevel){ if( fossil_wants_https(iLevel) ){ const char *zQS = P("QUERY_STRING"); char *zURL; if( zQS==0 || zQS[0]==0 ){ zURL = mprintf("%s%T", g.zHttpsURL, P("PATH_INFO")); }else if( zQS[0]!=0 ){ zURL = mprintf("%s%T?%s", g.zHttpsURL, P("PATH_INFO"), zQS); } cgi_redirect_with_status(zURL, 301, "Moved Permanently"); return 1; } return 0; } /* ** Preconditions: ** ** * Environment variables are set up according to the CGI standard. ** ** If the repository is known, it has already been opened. If unknown, |
︙ | ︙ | |||
1660 1661 1662 1663 1664 1665 1666 | /* If we reach this point, it means that the search of the PATH_INFO ** string is finished. Either zRepo contains the name of the ** repository to be used, or else no repository could be found an ** some kind of error response is required. */ if( szFile<1024 ){ set_base_url(0); | | | 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 | /* If we reach this point, it means that the search of the PATH_INFO ** string is finished. Either zRepo contains the name of the ** repository to be used, or else no repository could be found an ** some kind of error response is required. */ if( szFile<1024 ){ set_base_url(0); if( (zPathInfo[0]==0 || strcmp(zPathInfo,"/")==0) && allowRepoList && repo_list_page() ){ /* Will return a list of repositories */ }else if( zNotFound ){ cgi_redirect(zNotFound); }else{ #ifdef FOSSIL_ENABLE_JSON |
︙ | ︙ | |||
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 | zPathInfo = "/xfer"; } /* Use the first element of PATH_INFO as the page name ** and deliver the appropriate page back to the user. */ set_base_url(0); if( zPathInfo==0 || zPathInfo[0]==0 || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){ /* Second special case: If the PATH_INFO is blank, issue a redirect to ** the home page identified by the "index-page" setting in the repository ** CONFIG table, to "/index" if there no "index-page" setting. */ #ifdef FOSSIL_ENABLE_JSON if(g.json.isJsonMode){ | > | 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | zPathInfo = "/xfer"; } /* Use the first element of PATH_INFO as the page name ** and deliver the appropriate page back to the user. */ set_base_url(0); if( fossil_redirect_to_https_if_needed(2) ) return; if( zPathInfo==0 || zPathInfo[0]==0 || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){ /* Second special case: If the PATH_INFO is blank, issue a redirect to ** the home page identified by the "index-page" setting in the repository ** CONFIG table, to "/index" if there no "index-page" setting. */ #ifdef FOSSIL_ENABLE_JSON if(g.json.isJsonMode){ |
︙ | ︙ | |||
1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 | #endif { @ <h1>Server Configuration Error</h1> @ <p>The database schema on the server is out-of-date. Please ask @ the administrator to run <b>fossil rebuild</b>.</p> } }else{ if( g.fCgiTrace ){ fossil_trace("######## Calling %s #########\n", pCmd->zName); cgi_print_all(1, 1); } #ifdef FOSSIL_ENABLE_TH1_HOOKS { /* | > > > | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 | #endif { @ <h1>Server Configuration Error</h1> @ <p>The database schema on the server is out-of-date. Please ask @ the administrator to run <b>fossil rebuild</b>.</p> } }else{ if( (pCmd->eCmdFlags & CMDFLAG_RAWCONTENT)==0 ){ cgi_decode_post_parameters(); } if( g.fCgiTrace ){ fossil_trace("######## Calling %s #########\n", pCmd->zName); cgi_print_all(1, 1); } #ifdef FOSSIL_ENABLE_TH1_HOOKS { /* |
︙ | ︙ | |||
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 | ** ** HOME: PATH Shorthand for "setenv: HOME PATH" ** ** debug: FILE Causing debugging information to be written ** into FILE. ** ** errorlog: FILE Warnings, errors, and panics written to FILE. ** ** redirect: REPO URL Extract the "name" query parameter and search ** REPO for a check-in or ticket that matches the ** value of "name", then redirect to URL. There ** can be multiple "redirect:" lines that are ** processed in order. If the REPO is "*", then ** an unconditional redirect to URL is taken. | > > > > > > | 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 | ** ** HOME: PATH Shorthand for "setenv: HOME PATH" ** ** debug: FILE Causing debugging information to be written ** into FILE. ** ** errorlog: FILE Warnings, errors, and panics written to FILE. ** ** timeout: SECONDS Do not run for longer than SECONDS. The default ** timeout is FOSSIL_DEFAULT_TIMEOUT (600) seconds. ** ** extroot: DIR Directory that is the root of the sub-CGI tree ** on the /ext page. ** ** redirect: REPO URL Extract the "name" query parameter and search ** REPO for a check-in or ticket that matches the ** value of "name", then redirect to URL. There ** can be multiple "redirect:" lines that are ** processed in order. If the REPO is "*", then ** an unconditional redirect to URL is taken. |
︙ | ︙ | |||
2042 2043 2044 2045 2046 2047 2048 | const char *zFile; const char *zNotFound = 0; char **azRedirect = 0; /* List of repositories to redirect to */ int nRedirect = 0; /* Number of entries in azRedirect */ Glob *pFileGlob = 0; /* Pattern for files */ int allowRepoList = 0; /* Allow lists of repository files */ Blob config, line, key, value, value2; | | < < < < > > > > > > > > > > | 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 | const char *zFile; const char *zNotFound = 0; char **azRedirect = 0; /* List of repositories to redirect to */ int nRedirect = 0; /* Number of entries in azRedirect */ Glob *pFileGlob = 0; /* Pattern for files */ int allowRepoList = 0; /* Allow lists of repository files */ Blob config, line, key, value, value2; /* Initialize the CGI environment. */ g.httpOut = stdout; g.httpIn = stdin; fossil_binary_mode(g.httpOut); fossil_binary_mode(g.httpIn); g.cgiOutput = 1; fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); /* Find the name of the CGI control file */ if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){ zFile = g.argv[2]; }else if( g.argc>=2 ){ zFile = g.argv[1]; }else{ cgi_panic("No CGI control file specified"); } /* Read and parse the CGI control file. */ blob_read_from_file(&config, zFile, ExtFILE); while( blob_line(&config, &line) ){ if( !blob_token(&line, &key) ) continue; if( blob_buffer(&key)[0]=='#' ) continue; if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){ /* repository: FILENAME ** |
︙ | ︙ | |||
2148 2149 2150 2151 2152 2153 2154 | */ blob_token(&line,&value2); fossil_setenv(blob_str(&value), blob_str(&value2)); blob_reset(&value); blob_reset(&value2); continue; } | < < < < < < < < < < > > > > > > > > > > > > > > > > > > | 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 | */ blob_token(&line,&value2); fossil_setenv(blob_str(&value), blob_str(&value2)); blob_reset(&value); blob_reset(&value2); continue; } if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){ /* errorlog: FILENAME ** ** Causes messages from warnings, errors, and panics to be appended ** to FILENAME. */ g.zErrlog = mprintf("%s", blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "extroot:") && blob_token(&line, &value) ){ /* extroot: DIRECTORY ** ** Enables the /ext webpage to use sub-cgi rooted at DIRECTORY */ g.zExtRoot = mprintf("%s", blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){ /* timeout: SECONDS ** ** Set an alarm() that kills the process after SECONDS. The ** default value is FOSSIL_DEFAULT_TIMEOUT (600) seconds. */ fossil_set_timeout(atoi(blob_str(&value))); continue; } if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){ /* HOME: VALUE ** ** Set CGI parameter "HOME" to VALUE. This is legacy. Use ** setenv: instead. */ |
︙ | ︙ | |||
2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 | ** name of the subdirectory under the skins/ directory that holds ** the elements of the built-in skin. If LABEL does not match, ** this directive is a silent no-op. */ skin_use_alternative(blob_str(&value)); blob_reset(&value); continue; } } blob_reset(&config); if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){ cgi_panic("Unable to find or open the project repository"); } cgi_init(); | > > > > > > > > > > > > > > > | 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 | ** name of the subdirectory under the skins/ directory that holds ** the elements of the built-in skin. If LABEL does not match, ** this directive is a silent no-op. */ skin_use_alternative(blob_str(&value)); blob_reset(&value); continue; } if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){ /* cgi-debug: FILENAME ** ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go ** into FILENAME. Useful for debugging CGI configuration problems. */ char *zNow = cgi_iso8601_datestamp(); cgi_load_environment(); g.fDebug = fossil_fopen(blob_str(&value), "ab"); blob_reset(&value); cgi_debug("-------- BEGIN cgi at %s --------\n", zNow); fossil_free(zNow); cgi_print_all(1,2); continue; } } blob_reset(&config); if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){ cgi_panic("Unable to find or open the project repository"); } cgi_init(); |
︙ | ︙ | |||
2236 2237 2238 2239 2240 2241 2242 | file_simplify_name(g.zRepositoryName, -1, 0); }else{ if( isDir==0 && fCreate ){ const char *zPassword; db_create_repository(zRepo); db_open_repository(zRepo); db_begin_transaction(); | | | | 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 | file_simplify_name(g.zRepositoryName, -1, 0); }else{ if( isDir==0 && fCreate ){ const char *zPassword; db_create_repository(zRepo); db_open_repository(zRepo); db_begin_transaction(); g.eHashPolicy = HPOLICY_SHA3; db_set_int("hash-policy", HPOLICY_SHA3, 0); db_initial_setup(0, "now", g.zLogin); db_end_transaction(0); fossil_print("project-id: %s\n", db_get("project-code", 0)); fossil_print("server-id: %s\n", db_get("server-code", 0)); zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin); fossil_print("admin-user: %s (initial password is \"%s\")\n", g.zLogin, zPassword); |
︙ | ︙ | |||
2320 2321 2322 2323 2324 2325 2326 2327 | ** ** If the --localauth option is given, then automatic login is performed ** for requests coming from localhost, if the "localauth" setting is not ** enabled. ** ** Options: ** --baseurl URL base URL (useful with reverse proxies) ** --files GLOB comma-separate glob patterns for static file to serve | > < > | 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 | ** ** If the --localauth option is given, then automatic login is performed ** for requests coming from localhost, if the "localauth" setting is not ** enabled. ** ** Options: ** --baseurl URL base URL (useful with reverse proxies) ** --extroot DIR document root for the /ext extension mechanism ** --files GLOB comma-separate glob patterns for static file to serve ** --host NAME specify hostname of the server ** --https signal a request coming in via https ** --in FILE Take input from FILE instead of standard input ** --ipaddr ADDR Assume the request comes from the given IP address ** --localauth enable automatic login for local connections ** --nocompress do not compress HTTP replies ** --nodelay omit backoffice processing if it would delay process exit ** --nojail drop root privilege but do not enter the chroot jail ** --nossl signal that no SSL connections are available ** --notfound URL use URL as "HTTP 404, object not found" page. ** --out FILE write results to FILE instead of to standard output ** --repolist If REPOSITORY is directory, URL "/" lists all repos |
︙ | ︙ | |||
2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 | skin_override(); zNotFound = find_option("notfound", 0, 1); noJail = find_option("nojail",0,0)!=0; allowRepoList = find_option("repolist",0,0)!=0; g.useLocalauth = find_option("localauth", 0, 0)!=0; g.sslNotAvailable = find_option("nossl", 0, 0)!=0; g.fNoHttpCompress = find_option("nocompress",0,0)!=0; zInFile = find_option("in",0,1); if( zInFile ){ g.httpIn = fossil_fopen(zInFile, "rb"); if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile); }else{ g.httpIn = stdin; } zOutFile = find_option("out",0,1); if( zOutFile ){ | > > | 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 | skin_override(); zNotFound = find_option("notfound", 0, 1); noJail = find_option("nojail",0,0)!=0; allowRepoList = find_option("repolist",0,0)!=0; g.useLocalauth = find_option("localauth", 0, 0)!=0; g.sslNotAvailable = find_option("nossl", 0, 0)!=0; g.fNoHttpCompress = find_option("nocompress",0,0)!=0; g.zExtRoot = find_option("extroot",0,1); zInFile = find_option("in",0,1); if( zInFile ){ backoffice_disable(); g.httpIn = fossil_fopen(zInFile, "rb"); if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile); }else{ g.httpIn = stdin; } zOutFile = find_option("out",0,1); if( zOutFile ){ |
︙ | ︙ | |||
2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 | const char *zIpAddr; /* IP address of remote client */ Th_InitTraceLog(); login_set_capabilities("sx", 0); g.useLocalauth = 1; g.httpIn = stdin; g.httpOut = stdout; find_server_repository(2, 0); g.cgiOutput = 1; g.fNoHttpCompress = 1; g.fullHttpReply = 1; zIpAddr = cgi_ssh_remote_addr(0); if( zIpAddr && zIpAddr[0] ){ g.fSshClient |= CGI_SSH_CLIENT; ssh_request_loop(zIpAddr, 0); }else{ cgi_set_parameter("REMOTE_ADDR", "127.0.0.1"); cgi_handle_http_request(0); | > > > | | 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 | const char *zIpAddr; /* IP address of remote client */ Th_InitTraceLog(); login_set_capabilities("sx", 0); g.useLocalauth = 1; g.httpIn = stdin; g.httpOut = stdout; fossil_binary_mode(g.httpOut); fossil_binary_mode(g.httpIn); g.zExtRoot = find_option("extroot",0,1); find_server_repository(2, 0); g.cgiOutput = 1; g.fNoHttpCompress = 1; g.fullHttpReply = 1; zIpAddr = cgi_ssh_remote_addr(0); if( zIpAddr && zIpAddr[0] ){ g.fSshClient |= CGI_SSH_CLIENT; ssh_request_loop(zIpAddr, 0); }else{ cgi_set_parameter("REMOTE_ADDR", "127.0.0.1"); cgi_handle_http_request(0); process_one_web_page(0, 0, 1); } } #if !defined(_WIN32) #if !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__HAIKU__) /* ** Search for an executable on the PATH environment variable. |
︙ | ︙ | |||
2511 2512 2513 2514 2515 2516 2517 | } return 0; } #endif #endif /* | > | > | > > > > > > > > > > > > > > > > | 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 | } return 0; } #endif #endif /* ** Respond to a SIGALRM by writing a message to the error log (if there ** is one) and exiting. */ #ifndef _WIN32 static void sigalrm_handler(int x){ fossil_panic("TIMEOUT"); } #endif /* ** Arrange to timeout using SIGALRM after N seconds. Or if N==0, cancel ** any pending timeout. ** ** Bugs: ** (1) This only works on unix systems. ** (2) Any call to sleep() or sqlite3_sleep() will cancel the alarm. */ void fossil_set_timeout(int N){ #ifndef _WIN32 signal(SIGALRM, sigalrm_handler); alarm(N); #endif } /* ** COMMAND: server* ** COMMAND: ui ** ** Usage: %fossil server ?OPTIONS? ?REPOSITORY? |
︙ | ︙ | |||
2563 2564 2565 2566 2567 2568 2569 | ** --localauth option is present and the "localauth" setting is off and the ** connection is from localhost. The "ui" command also enables --repolist ** by default. ** ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --create Create a new REPOSITORY if it does not already exist | | | > | > > | > | | | 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 | ** --localauth option is present and the "localauth" setting is off and the ** connection is from localhost. The "ui" command also enables --repolist ** by default. ** ** Options: ** --baseurl URL Use URL as the base (useful for reverse proxies) ** --create Create a new REPOSITORY if it does not already exist ** --extroot DIR Document root for the /ext extension mechanism ** --files GLOBLIST Comma-separated list of glob patterns for static files ** --localauth enable automatic login for requests from localhost ** --localhost listen on 127.0.0.1 only (always true for "ui") ** --https Indicates that the input is coming through a reverse ** proxy that has already translated HTTPS into HTTP. ** --max-latency N Do not let any single HTTP request run for more than N ** seconds (only works on unix) ** --nocompress Do not compress HTTP replies ** --nojail Drop root privileges but do not enter the chroot jail ** --nossl signal that no SSL connections are available (Always ** set by default for the "ui" command) ** --notfound URL Redirect ** --page PAGE Start "ui" on PAGE. ex: --page "timeline?y=ci" ** -P|--port TCPPORT listen to request on port TCPPORT ** --th-trace trace TH1 execution (for debugging purposes) ** --repolist If REPOSITORY is dir, URL "/" lists repos. ** --scgi Accept SCGI rather than HTTP ** --skin LABEL Use override skin LABEL ** --usepidkey Use saved encryption key from parent process. This is ** only necessary when using SEE on Windows. ** ** See also: cgi, http, winsrv */ void cmd_webserver(void){ int iPort, mxPort; /* Range of TCP ports allowed */ const char *zPort; /* Value of the --port option */ const char *zBrowser; /* Name of web browser program */ char *zBrowserCmd = 0; /* Command to launch the web browser */ int isUiCmd; /* True if command is "ui", not "server' */ const char *zNotFound; /* The --notfound option or NULL */ int flags = 0; /* Server flags */ #if !defined(_WIN32) int noJail; /* Do not enter the chroot jail */ const char *zTimeout = 0; /* Max runtime of any single HTTP request */ #endif int allowRepoList; /* List repositories on URL "/" */ const char *zAltBase; /* Argument to the --baseurl option */ const char *zFileGlob; /* Static content must match this */ char *zIpAddr = 0; /* Bind to this IP address */ int fCreate = 0; /* The --create flag */ const char *zInitPage = 0; /* Start on this page. --page option */ #if defined(_WIN32) && USE_SEE const char *zPidKey; #endif #if defined(_WIN32) const char *zStopperFile; /* Name of file used to terminate server */ zStopperFile = find_option("stopper", 0, 1); #endif if( g.zErrlog==0 ){ g.zErrlog = "-"; } g.zExtRoot = find_option("extroot",0,1); zFileGlob = find_option("files-urlenc",0,1); if( zFileGlob ){ char *z = mprintf("%s", zFileGlob); dehttpize(z); zFileGlob = z; }else{ zFileGlob = find_option("files",0,1); } skin_override(); #if !defined(_WIN32) noJail = find_option("nojail",0,0)!=0; zTimeout = find_option("max-latency",0,1); #endif g.useLocalauth = find_option("localauth", 0, 0)!=0; Th_InitTraceLog(); zPort = find_option("port", "P", 1); isUiCmd = g.argv[1][0]=='u'; if( isUiCmd ){ zInitPage = find_option("page", 0, 1); } zNotFound = find_option("notfound", 0, 1); allowRepoList = find_option("repolist",0,0)!=0; if( find_option("nocompress",0,0)!=0 ) g.fNoHttpCompress = 1; zAltBase = find_option("baseurl", 0, 1); fCreate = find_option("create",0,0)!=0; if( find_option("scgi", 0, 0)!=0 ) flags |= HTTP_SERVER_SCGI; if( zAltBase ){ set_base_url(zAltBase); } g.sslNotAvailable = find_option("nossl", 0, 0)!=0 || isUiCmd; if( find_option("https",0,0)!=0 ){ cgi_replace_parameter("HTTPS","on"); } if( find_option("localhost", 0, 0)!=0 ){ flags |= HTTP_SERVER_LOCALHOST; } |
︙ | ︙ | |||
2734 2735 2736 2737 2738 2739 2740 | } if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; db_close(1); if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ fossil_fatal("unable to listen on TCP socket %d", iPort); } | > > > > > > > > > | < | > > | 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 | } if( g.repositoryOpen ) flags |= HTTP_SERVER_HAD_REPOSITORY; if( g.localOpen ) flags |= HTTP_SERVER_HAD_CHECKOUT; db_close(1); if( cgi_http_server(iPort, mxPort, zBrowserCmd, zIpAddr, flags) ){ fossil_fatal("unable to listen on TCP socket %d", iPort); } /* For the parent process, the cgi_http_server() command above never ** returns (except in the case of an error). Instead, for each incoming ** client connection, a child process is created, file descriptors 0 ** and 1 are bound to that connection, and the child returns. ** ** So, when control reaches this point, we are running as a ** child process, the HTTP or SCGI request is pending on file ** descriptor 0 and the reply should be written to file descriptor 1. */ if( zTimeout ){ fossil_set_timeout(atoi(zTimeout)); }else{ fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); } g.httpIn = stdin; g.httpOut = stdout; #if !defined(_WIN32) signal(SIGSEGV, sigsegv_handler); signal(SIGPIPE, sigpipe_handler); |
︙ | ︙ | |||
2843 2844 2845 2846 2847 2848 2849 | ** case=6 Call webpage_assert() ** case=7 Call webpage_error() */ void test_warning_page(void){ int iCase = atoi(PD("case","0")); int i; login_check_credentials(); | | | 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 | ** case=6 Call webpage_assert() ** case=7 Call webpage_error() */ void test_warning_page(void){ int iCase = atoi(PD("case","0")); int i; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Warning Test Page"); style_submenu_element("Error Log","%R/errorlog"); if( iCase<1 || iCase>4 ){ @ <p>Generate a message to the <a href="%R/errorlog">error log</a> |
︙ | ︙ |
Changes to src/main.mk.
︙ | ︙ | |||
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 | $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/content.c \ $(SRCDIR)/cookies.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/dispatch.c \ $(SRCDIR)/doc.c \ $(SRCDIR)/encode.c \ $(SRCDIR)/etag.c \ $(SRCDIR)/event.c \ $(SRCDIR)/export.c \ $(SRCDIR)/file.c \ $(SRCDIR)/finfo.c \ $(SRCDIR)/foci.c \ $(SRCDIR)/forum.c \ $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ | > > > | 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 | $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/content.c \ $(SRCDIR)/cookies.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/deltafunc.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/dispatch.c \ $(SRCDIR)/doc.c \ $(SRCDIR)/encode.c \ $(SRCDIR)/etag.c \ $(SRCDIR)/event.c \ $(SRCDIR)/export.c \ $(SRCDIR)/extcgi.c \ $(SRCDIR)/file.c \ $(SRCDIR)/finfo.c \ $(SRCDIR)/foci.c \ $(SRCDIR)/forum.c \ $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ |
︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | $(SRCDIR)/popen.c \ $(SRCDIR)/pqueue.c \ $(SRCDIR)/printf.c \ $(SRCDIR)/publish.c \ $(SRCDIR)/purge.c \ $(SRCDIR)/rebuild.c \ $(SRCDIR)/regexp.c \ $(SRCDIR)/report.c \ $(SRCDIR)/rss.c \ $(SRCDIR)/schema.c \ $(SRCDIR)/search.c \ $(SRCDIR)/security_audit.c \ $(SRCDIR)/setup.c \ $(SRCDIR)/setupuser.c \ | > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | $(SRCDIR)/popen.c \ $(SRCDIR)/pqueue.c \ $(SRCDIR)/printf.c \ $(SRCDIR)/publish.c \ $(SRCDIR)/purge.c \ $(SRCDIR)/rebuild.c \ $(SRCDIR)/regexp.c \ $(SRCDIR)/repolist.c \ $(SRCDIR)/report.c \ $(SRCDIR)/rss.c \ $(SRCDIR)/schema.c \ $(SRCDIR)/search.c \ $(SRCDIR)/security_audit.c \ $(SRCDIR)/setup.c \ $(SRCDIR)/setupuser.c \ |
︙ | ︙ | |||
206 207 208 209 210 211 212 213 214 215 216 217 218 219 | $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/../skins/xekri/css.txt \ $(SRCDIR)/../skins/xekri/details.txt \ $(SRCDIR)/../skins/xekri/footer.txt \ $(SRCDIR)/../skins/xekri/header.txt \ $(SRCDIR)/ci_edit.js \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/forum.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ $(SRCDIR)/markdown.md \ $(SRCDIR)/menu.js \ | > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/../skins/xekri/css.txt \ $(SRCDIR)/../skins/xekri/details.txt \ $(SRCDIR)/../skins/xekri/footer.txt \ $(SRCDIR)/../skins/xekri/header.txt \ $(SRCDIR)/ci_edit.js \ $(SRCDIR)/copybtn.js \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/forum.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ $(SRCDIR)/markdown.md \ $(SRCDIR)/menu.js \ |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat_.c \ $(OBJDIR)/configure_.c \ $(OBJDIR)/content_.c \ $(OBJDIR)/cookies_.c \ $(OBJDIR)/db_.c \ $(OBJDIR)/delta_.c \ $(OBJDIR)/deltacmd_.c \ $(OBJDIR)/descendants_.c \ $(OBJDIR)/diff_.c \ $(OBJDIR)/diffcmd_.c \ $(OBJDIR)/dispatch_.c \ $(OBJDIR)/doc_.c \ $(OBJDIR)/encode_.c \ $(OBJDIR)/etag_.c \ $(OBJDIR)/event_.c \ $(OBJDIR)/export_.c \ $(OBJDIR)/file_.c \ $(OBJDIR)/finfo_.c \ $(OBJDIR)/foci_.c \ $(OBJDIR)/forum_.c \ $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ | > > > | 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 | $(OBJDIR)/comformat_.c \ $(OBJDIR)/configure_.c \ $(OBJDIR)/content_.c \ $(OBJDIR)/cookies_.c \ $(OBJDIR)/db_.c \ $(OBJDIR)/delta_.c \ $(OBJDIR)/deltacmd_.c \ $(OBJDIR)/deltafunc_.c \ $(OBJDIR)/descendants_.c \ $(OBJDIR)/diff_.c \ $(OBJDIR)/diffcmd_.c \ $(OBJDIR)/dispatch_.c \ $(OBJDIR)/doc_.c \ $(OBJDIR)/encode_.c \ $(OBJDIR)/etag_.c \ $(OBJDIR)/event_.c \ $(OBJDIR)/export_.c \ $(OBJDIR)/extcgi_.c \ $(OBJDIR)/file_.c \ $(OBJDIR)/finfo_.c \ $(OBJDIR)/foci_.c \ $(OBJDIR)/forum_.c \ $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ |
︙ | ︙ | |||
312 313 314 315 316 317 318 319 320 321 322 323 324 325 | $(OBJDIR)/popen_.c \ $(OBJDIR)/pqueue_.c \ $(OBJDIR)/printf_.c \ $(OBJDIR)/publish_.c \ $(OBJDIR)/purge_.c \ $(OBJDIR)/rebuild_.c \ $(OBJDIR)/regexp_.c \ $(OBJDIR)/report_.c \ $(OBJDIR)/rss_.c \ $(OBJDIR)/schema_.c \ $(OBJDIR)/search_.c \ $(OBJDIR)/security_audit_.c \ $(OBJDIR)/setup_.c \ $(OBJDIR)/setupuser_.c \ | > | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | $(OBJDIR)/popen_.c \ $(OBJDIR)/pqueue_.c \ $(OBJDIR)/printf_.c \ $(OBJDIR)/publish_.c \ $(OBJDIR)/purge_.c \ $(OBJDIR)/rebuild_.c \ $(OBJDIR)/regexp_.c \ $(OBJDIR)/repolist_.c \ $(OBJDIR)/report_.c \ $(OBJDIR)/rss_.c \ $(OBJDIR)/schema_.c \ $(OBJDIR)/search_.c \ $(OBJDIR)/security_audit_.c \ $(OBJDIR)/setup_.c \ $(OBJDIR)/setupuser_.c \ |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat.o \ $(OBJDIR)/configure.o \ $(OBJDIR)/content.o \ $(OBJDIR)/cookies.o \ $(OBJDIR)/db.o \ $(OBJDIR)/delta.o \ $(OBJDIR)/deltacmd.o \ $(OBJDIR)/descendants.o \ $(OBJDIR)/diff.o \ $(OBJDIR)/diffcmd.o \ $(OBJDIR)/dispatch.o \ $(OBJDIR)/doc.o \ $(OBJDIR)/encode.o \ $(OBJDIR)/etag.o \ $(OBJDIR)/event.o \ $(OBJDIR)/export.o \ $(OBJDIR)/file.o \ $(OBJDIR)/finfo.o \ $(OBJDIR)/foci.o \ $(OBJDIR)/forum.o \ $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ | > > > | 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 | $(OBJDIR)/comformat.o \ $(OBJDIR)/configure.o \ $(OBJDIR)/content.o \ $(OBJDIR)/cookies.o \ $(OBJDIR)/db.o \ $(OBJDIR)/delta.o \ $(OBJDIR)/deltacmd.o \ $(OBJDIR)/deltafunc.o \ $(OBJDIR)/descendants.o \ $(OBJDIR)/diff.o \ $(OBJDIR)/diffcmd.o \ $(OBJDIR)/dispatch.o \ $(OBJDIR)/doc.o \ $(OBJDIR)/encode.o \ $(OBJDIR)/etag.o \ $(OBJDIR)/event.o \ $(OBJDIR)/export.o \ $(OBJDIR)/extcgi.o \ $(OBJDIR)/file.o \ $(OBJDIR)/finfo.o \ $(OBJDIR)/foci.o \ $(OBJDIR)/forum.o \ $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ |
︙ | ︙ | |||
449 450 451 452 453 454 455 456 457 458 459 460 461 462 | $(OBJDIR)/popen.o \ $(OBJDIR)/pqueue.o \ $(OBJDIR)/printf.o \ $(OBJDIR)/publish.o \ $(OBJDIR)/purge.o \ $(OBJDIR)/rebuild.o \ $(OBJDIR)/regexp.o \ $(OBJDIR)/report.o \ $(OBJDIR)/rss.o \ $(OBJDIR)/schema.o \ $(OBJDIR)/search.o \ $(OBJDIR)/security_audit.o \ $(OBJDIR)/setup.o \ $(OBJDIR)/setupuser.o \ | > | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | $(OBJDIR)/popen.o \ $(OBJDIR)/pqueue.o \ $(OBJDIR)/printf.o \ $(OBJDIR)/publish.o \ $(OBJDIR)/purge.o \ $(OBJDIR)/rebuild.o \ $(OBJDIR)/regexp.o \ $(OBJDIR)/repolist.o \ $(OBJDIR)/report.o \ $(OBJDIR)/rss.o \ $(OBJDIR)/schema.o \ $(OBJDIR)/search.o \ $(OBJDIR)/security_audit.o \ $(OBJDIR)/setup.o \ $(OBJDIR)/setupuser.o \ |
︙ | ︙ | |||
494 495 496 497 498 499 500 | $(OBJDIR)/wikiformat.o \ $(OBJDIR)/winfile.o \ $(OBJDIR)/winhttp.o \ $(OBJDIR)/wysiwyg.o \ $(OBJDIR)/xfer.o \ $(OBJDIR)/xfersetup.o \ $(OBJDIR)/zip.o | < < < < < | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | $(OBJDIR)/wikiformat.o \ $(OBJDIR)/winfile.o \ $(OBJDIR)/winhttp.o \ $(OBJDIR)/wysiwyg.o \ $(OBJDIR)/xfer.o \ $(OBJDIR)/xfersetup.o \ $(OBJDIR)/zip.o all: $(OBJDIR) $(APPNAME) install: all mkdir -p $(INSTALLDIR) cp $(APPNAME) $(INSTALLDIR) codecheck: $(TRANS_SRC) $(OBJDIR)/codecheck1 $(OBJDIR)/codecheck1 $(TRANS_SRC) $(OBJDIR): |
︙ | ︙ | |||
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h $(OBJDIR)/default_css.h: $(SRCDIR)/default_css.txt $(OBJDIR)/mkcss $(OBJDIR)/mkcss $(SRCDIR)/default_css.txt $(OBJDIR)/default_css.h # Setup the options used to compile the included SQLite library. SQLITE_OPTIONS = -DNDEBUG=1 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ | > < > < | 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 | $(OBJDIR)/mkversion $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest $(SRCDIR)/../VERSION >$(OBJDIR)/VERSION.h $(OBJDIR)/default_css.h: $(SRCDIR)/default_css.txt $(OBJDIR)/mkcss $(OBJDIR)/mkcss $(SRCDIR)/default_css.txt $(OBJDIR)/default_css.h # Setup the options used to compile the included SQLite library. SQLITE_OPTIONS = -DNDEBUG=1 \ -DSQLITE_DQS=0 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_STMTVTAB \ -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB # Setup the options used to compile the included SQLite shell. SHELL_OPTIONS = -DNDEBUG=1 \ -DSQLITE_DQS=0 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_STMTVTAB \ -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ |
︙ | ︙ | |||
675 676 677 678 679 680 681 | $(OBJDIR)/th_lang.o \ $(OBJDIR)/th_tcl.o \ $(OBJDIR)/cson_amalgamation.o $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ) $(OBJDIR)/codecheck1 $(TRANS_SRC) | | | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | $(OBJDIR)/th_lang.o \ $(OBJDIR)/th_tcl.o \ $(OBJDIR)/cson_amalgamation.o $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ) $(OBJDIR)/codecheck1 $(TRANS_SRC) $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" # $(SRCDIR)/../manifest: # noop |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \ $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h \ $(OBJDIR)/content_.c:$(OBJDIR)/content.h \ $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \ $(OBJDIR)/db_.c:$(OBJDIR)/db.h \ $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \ $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \ $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \ $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \ $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \ $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \ $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \ $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \ $(OBJDIR)/etag_.c:$(OBJDIR)/etag.h \ $(OBJDIR)/event_.c:$(OBJDIR)/event.h \ $(OBJDIR)/export_.c:$(OBJDIR)/export.h \ $(OBJDIR)/file_.c:$(OBJDIR)/file.h \ $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \ $(OBJDIR)/forum_.c:$(OBJDIR)/forum.h \ $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ | > > > | 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 | $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \ $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h \ $(OBJDIR)/content_.c:$(OBJDIR)/content.h \ $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \ $(OBJDIR)/db_.c:$(OBJDIR)/db.h \ $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \ $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \ $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \ $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \ $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \ $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \ $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \ $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \ $(OBJDIR)/etag_.c:$(OBJDIR)/etag.h \ $(OBJDIR)/event_.c:$(OBJDIR)/event.h \ $(OBJDIR)/export_.c:$(OBJDIR)/export.h \ $(OBJDIR)/extcgi_.c:$(OBJDIR)/extcgi.h \ $(OBJDIR)/file_.c:$(OBJDIR)/file.h \ $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \ $(OBJDIR)/forum_.c:$(OBJDIR)/forum.h \ $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ |
︙ | ︙ | |||
784 785 786 787 788 789 790 791 792 793 794 795 796 797 | $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \ $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \ $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \ $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \ $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \ $(OBJDIR)/report_.c:$(OBJDIR)/report.h \ $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \ $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \ $(OBJDIR)/search_.c:$(OBJDIR)/search.h \ $(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \ $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \ $(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \ | > | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \ $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \ $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \ $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \ $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \ $(OBJDIR)/repolist_.c:$(OBJDIR)/repolist.h \ $(OBJDIR)/report_.c:$(OBJDIR)/report.h \ $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \ $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \ $(OBJDIR)/search_.c:$(OBJDIR)/search.h \ $(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \ $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \ $(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \ |
︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/deltacmd.c >$@ $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/descendants.c >$@ $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c | > > > > > > > > | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/deltacmd.c >$@ $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/deltafunc.c >$@ $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/descendants.c >$@ $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c |
︙ | ︙ | |||
1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 | $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/export.c >$@ $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c $(OBJDIR)/export.h: $(OBJDIR)/headers $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/file.c >$@ $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c | > > > > > > > > | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/export.c >$@ $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c $(OBJDIR)/export.h: $(OBJDIR)/headers $(OBJDIR)/extcgi_.c: $(SRCDIR)/extcgi.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/extcgi.c >$@ $(OBJDIR)/extcgi.o: $(OBJDIR)/extcgi_.c $(OBJDIR)/extcgi.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/extcgi.o -c $(OBJDIR)/extcgi_.c $(OBJDIR)/extcgi.h: $(OBJDIR)/headers $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/file.c >$@ $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c |
︙ | ︙ | |||
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 | $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/fusefs.c >$@ $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h: $(OBJDIR)/headers $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/glob.c >$@ $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c | > > > > > > > > | 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/fusefs.c >$@ $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h: $(OBJDIR)/headers $(OBJDIR)/fuzz_.c: $(SRCDIR)/fuzz.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/fuzz.c >$@ $(OBJDIR)/fuzz.o: $(OBJDIR)/fuzz_.c $(OBJDIR)/fuzz.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fuzz.o -c $(OBJDIR)/fuzz_.c $(OBJDIR)/fuzz.h: $(OBJDIR)/headers $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/glob.c >$@ $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c |
︙ | ︙ | |||
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 | $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/regexp.c >$@ $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h: $(OBJDIR)/headers $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/report.c >$@ $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c | > > > > > > > > | 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 | $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/regexp.c >$@ $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h: $(OBJDIR)/headers $(OBJDIR)/repolist_.c: $(SRCDIR)/repolist.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/repolist.c >$@ $(OBJDIR)/repolist.o: $(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/repolist.o -c $(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h: $(OBJDIR)/headers $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(OBJDIR)/translate $(OBJDIR)/translate $(SRCDIR)/report.c >$@ $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c |
︙ | ︙ |
Changes to src/makeheaders.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 | ** liability, whether in contract, strict liability, or tort (including ** negligence or otherwise) arising in any way out of the use of this ** software, even if advised of the possibility of such damage. ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. | < | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** liability, whether in contract, strict liability, or tort (including ** negligence or otherwise) arising in any way out of the use of this ** software, even if advised of the possibility of such damage. ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <memory.h> #include <sys/stat.h> #include <assert.h> |
︙ | ︙ | |||
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 | }else if( type & PS_Private ){ StringAppend(&str, "private:\n", 0); pDecl->extraType = PS_Private; } } StringAppend(&str, " ", 0); zDecl = TokensToString(pFirst, pLast, ";\n", pClass, 2); StringAppend(&str, zDecl, 0); SafeFree(zDecl); pDecl->zExtra = StrDup(StringGet(&str), 0); StringReset(&str); return 0; } | > > > > > > > > > > | 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | }else if( type & PS_Private ){ StringAppend(&str, "private:\n", 0); pDecl->extraType = PS_Private; } } StringAppend(&str, " ", 0); zDecl = TokensToString(pFirst, pLast, ";\n", pClass, 2); if(strncmp(zDecl, pClass->zText, pClass->nText)==0){ /* If member initializer list is found after a constructor, ** skip that part. */ char * colon = strchr(zDecl, ':'); if(colon!=0 && colon[1]!=0){ *colon++ = ';'; *colon++ = '\n'; *colon = 0; } } StringAppend(&str, zDecl, 0); SafeFree(zDecl); pDecl->zExtra = StrDup(StringGet(&str), 0); StringReset(&str); return 0; } |
︙ | ︙ | |||
1782 1783 1784 1785 1786 1787 1788 | } pName = FindDeclName(pFirst,pLast); if( pName==0 ){ fprintf(stderr,"%s:%d: Malformed function or procedure definition.\n", zFilename, pFirst->nLine); return 1; } | > > > | | 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | } pName = FindDeclName(pFirst,pLast); if( pName==0 ){ fprintf(stderr,"%s:%d: Malformed function or procedure definition.\n", zFilename, pFirst->nLine); return 1; } if( strncmp(pName->zText,"main",pName->nText)==0 ){ /* skip main() decl. */ return 0; } /* ** At this point we've isolated a procedure declaration between pFirst ** and pLast with the name pName. */ #ifdef DEBUG if( debugMask & PARSER ){ printf("**** Found routine: %.*s on line %d...\n", pName->nText, |
︙ | ︙ | |||
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 | return 0; } pFirst = pFirst->pNext; } return 1; } /* ** This routine is called whenever we encounter a ";" or "=". The stuff ** between pFirst and pLast constitutes either a typedef or a global ** variable definition. Do the right thing. */ static int ProcessDecl(Token *pFirst, Token *pEnd, int flags){ | > > > > > > > > > > > > | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 | return 0; } pFirst = pFirst->pNext; } return 1; } /* ** Return TRUE if pFirst is the first token of a static assert. */ static int isStaticAssert(Token *pFirst){ if( (pFirst->nText==13 && strncmp(pFirst->zText, "static_assert", 13)==0) || (pFirst->nText==14 && strncmp(pFirst->zText, "_Static_assert", 14)==0) ){ return 1; }else{ return 0; } } /* ** This routine is called whenever we encounter a ";" or "=". The stuff ** between pFirst and pLast constitutes either a typedef or a global ** variable definition. Do the right thing. */ static int ProcessDecl(Token *pFirst, Token *pEnd, int flags){ |
︙ | ︙ | |||
1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | } if( pFirst==0 || !isLocal ){ return nErr; } }else if( flags & PS_Method ){ /* Methods are declared by their class. Don't declare separately. */ return nErr; } isVar = (flags & (PS_Typedef|PS_Method))==0 && isVariableDef(pFirst,pEnd); if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0 && (flags & PS_Extern)==0 ){ fprintf(stderr,"%s:%d: Can't define a variable in this context\n", zFilename, pFirst->nLine); nErr++; | > > | 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 | } if( pFirst==0 || !isLocal ){ return nErr; } }else if( flags & PS_Method ){ /* Methods are declared by their class. Don't declare separately. */ return nErr; }else if( isStaticAssert(pFirst) ){ return 0; } isVar = (flags & (PS_Typedef|PS_Method))==0 && isVariableDef(pFirst,pEnd); if( isVar && (flags & (PS_Interface|PS_Export|PS_Local))!=0 && (flags & PS_Extern)==0 ){ fprintf(stderr,"%s:%d: Can't define a variable in this context\n", zFilename, pFirst->nLine); nErr++; |
︙ | ︙ | |||
3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 | zNew[j] = malloc( n + 1 ); if( zNew[j] ){ strcpy( zNew[j], zBuf ); } } } } newArgc = argc + nNew - 1; for(i=0; i<=index; i++){ zNew[i] = argv[i]; } for(i=nNew + index + 1; i<newArgc; i++){ zNew[i] = argv[i + 1 - nNew]; } | > | 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 | zNew[j] = malloc( n + 1 ); if( zNew[j] ){ strcpy( zNew[j], zBuf ); } } } } fclose(in); newArgc = argc + nNew - 1; for(i=0; i<=index; i++){ zNew[i] = argv[i]; } for(i=nNew + index + 1; i<newArgc; i++){ zNew[i] = argv[i + 1 - nNew]; } |
︙ | ︙ |
Changes to src/makemake.tcl.
︙ | ︙ | |||
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 | comformat configure content cookies db delta deltacmd descendants diff diffcmd dispatch doc encode etag event export file finfo foci forum fshell fusefs glob graph gzip hname http http_socket http_transport | > > > | 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 | comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event extcgi export file finfo foci forum fshell fusefs fuzz glob graph gzip hname http http_socket http_transport |
︙ | ︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | popen pqueue printf publish purge rebuild regexp report rss schema search security_audit setup setupuser | > | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser |
︙ | ︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | ../skins/*/*.txt } # Options used to compile the included SQLite library. # set SQLITE_OPTIONS { -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 | > < | 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 | ../skins/*/*.txt } # Options used to compile the included SQLite library. # set SQLITE_OPTIONS { -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB |
︙ | ︙ | |||
305 306 307 308 309 310 311 | writeln -nonewline " \\\n \$(OBJDIR)/${s}_.c" } writeln "\n" writeln -nonewline "OBJ =" foreach s [lsort $src] { writeln -nonewline " \\\n \$(OBJDIR)/$s.o" } | < < < | | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | writeln -nonewline " \\\n \$(OBJDIR)/${s}_.c" } writeln "\n" writeln -nonewline "OBJ =" foreach s [lsort $src] { writeln -nonewline " \\\n \$(OBJDIR)/$s.o" } writeln [string map [list \ <<<SQLITE_OPTIONS>>> [join $SQLITE_OPTIONS " \\\n "] \ <<<SHELL_OPTIONS>>> [join $SHELL_OPTIONS " \\\n "] \ <<<MINIZ_OPTIONS>>> [join $MINIZ_OPTIONS " \\\n "]] { all: $(OBJDIR) $(APPNAME) install: all mkdir -p $(INSTALLDIR) cp $(APPNAME) $(INSTALLDIR) codecheck: $(TRANS_SRC) $(OBJDIR)/codecheck1 $(OBJDIR)/codecheck1 $(TRANS_SRC) $(OBJDIR): |
︙ | ︙ | |||
437 438 439 440 441 442 443 | $(OBJDIR)/th_tcl.o <<<NEXT_LINE>>> $(OBJDIR)/cson_amalgamation.o }] writeln { $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ) $(OBJDIR)/codecheck1 $(TRANS_SRC) | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | $(OBJDIR)/th_tcl.o <<<NEXT_LINE>>> $(OBJDIR)/cson_amalgamation.o }] writeln { $(APPNAME): $(OBJDIR)/headers $(OBJDIR)/codecheck1 $(OBJ) $(EXTRAOBJ) $(OBJDIR)/codecheck1 $(TRANS_SRC) $(TCC) $(TCCFLAGS) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" # $(SRCDIR)/../manifest: # noop |
︙ | ︙ | |||
692 693 694 695 696 697 698 | else SSLCONFIG = mingw64 ZLIBCONFIG = ZLIBTARGETS = endif #### Disable creation of the OpenSSL shared libraries. Also, disable support | | | | | 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 | else SSLCONFIG = mingw64 ZLIBCONFIG = ZLIBTARGETS = endif #### Disable creation of the OpenSSL shared libraries. Also, disable support # for SSLv3 (i.e. thereby forcing the use of TLS). # SSLCONFIG += no-ssl3 no-weak-ssl-ciphers no-shared #### When using zlib, make sure that OpenSSL is configured to use the zlib # that Fossil knows about (i.e. the one within the source tree). # ifndef FOSSIL_ENABLE_MINIZ SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1d OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
︙ | ︙ | |||
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | BLDTARGETS = else BLDTARGETS = zlib endif openssl: $(BLDTARGETS) cd $(OPENSSLLIBDIR);./Configure --cross-compile-prefix=$(PREFIX) $(SSLCONFIG) $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) build_libs clean-openssl: $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) clean tcl: cd $(TCLSRCDIR)/win;./configure | > | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | BLDTARGETS = else BLDTARGETS = zlib endif openssl: $(BLDTARGETS) cd $(OPENSSLLIBDIR);./Configure --cross-compile-prefix=$(PREFIX) $(SSLCONFIG) sed -i -e 's/^PERL=C:\\.*$$/PERL=perl.exe/i' $(OPENSSLLIBDIR)/Makefile $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) build_libs clean-openssl: $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) clean tcl: cd $(TCLSRCDIR)/win;./configure |
︙ | ︙ | |||
1474 1475 1476 1477 1478 1479 1480 | # # This file is automatically generated. Instead of editing this # file, edit "makemake.tcl" then run "tclsh makemake.tcl" # to regenerate this file. # B = .. SRCDIR = $(B)\src | > | | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | # # This file is automatically generated. Instead of editing this # file, edit "makemake.tcl" then run "tclsh makemake.tcl" # to regenerate this file. # B = .. SRCDIR = $(B)\src T = msvcbld OBJDIR = $(T) OX = $(OBJDIR) O = .obj E = .exe P = .pdb INSTALLDIR = . !ifdef DESTDIR |
︙ | ︙ | |||
1576 1577 1578 1579 1580 1581 1582 | # Enable support for the SQLite Encryption Extension? !ifndef USE_SEE USE_SEE = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 | | | | | | < < | < < < < < < < < < < < < | < < < < < < < < < < < < | < < < < < < < < < < | 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | # Enable support for the SQLite Encryption Extension? !ifndef USE_SEE USE_SEE = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 SSLDIR = $(B)\compat\openssl-1.1.1d SSLINCDIR = $(SSLDIR)\include !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLLIBDIR = $(SSLDIR) !else SSLLIBDIR = $(SSLDIR) !endif SSLLFLAGS = /nologo /opt:ref /debug SSLLIB = libssl.lib libcrypto.lib user32.lib gdi32.lib crypt32.lib !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64" !message Using 'x64' platform for OpenSSL... SSLCONFIG = VC-WIN64A no-asm no-ssl3 no-weak-ssl-ciphers !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLCONFIG = $(SSLCONFIG) shared !else SSLCONFIG = $(SSLCONFIG) no-shared !endif !elseif "$(PLATFORM)"=="ia64" !message Using 'ia64' platform for OpenSSL... SSLCONFIG = VC-WIN64I no-asm no-ssl3 no-weak-ssl-ciphers !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLCONFIG = $(SSLCONFIG) shared !else SSLCONFIG = $(SSLCONFIG) no-shared !endif !else !message Assuming 'x86' platform for OpenSSL... SSLCONFIG = VC-WIN32 no-asm no-ssl3 no-weak-ssl-ciphers !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLCONFIG = $(SSLCONFIG) shared !else SSLCONFIG = $(SSLCONFIG) no-shared !endif !endif !endif !if $(FOSSIL_ENABLE_TCL)!=0 TCLDIR = $(B)\compat\tcl-8.6 TCLSRCDIR = $(TCLDIR) |
︙ | ︙ | |||
1841 1842 1843 1844 1845 1846 1847 | } writeln "!if \$(FOSSIL_ENABLE_MINIZ)!=0" writeln -nonewline " " writeln "\"\$(OX)\\miniz\$O\" \\"; incr i writeln "!endif" writeln -nonewline " \"\$(OX)\\fossil.res\"\n\n" writeln [string map [list <<<NEXT_LINE>>> \\] { | > | > | > > | | | 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 | } writeln "!if \$(FOSSIL_ENABLE_MINIZ)!=0" writeln -nonewline " " writeln "\"\$(OX)\\miniz\$O\" \\"; incr i writeln "!endif" writeln -nonewline " \"\$(OX)\\fossil.res\"\n\n" writeln [string map [list <<<NEXT_LINE>>> \\] { !ifndef BASEAPPNAME BASEAPPNAME = fossil !endif APPNAME = $(OX)\$(BASEAPPNAME)$(E) PDBNAME = $(OX)\$(BASEAPPNAME)$(P) APPMANIFEST = $(APPNAME).manifest APPTARGETS = all: "$(OX)" "$(APPNAME)" install: "$(APPNAME)" echo F | xcopy /Y "$(APPNAME)" "$(INSTALLDIR)"\* !if $(DEBUG)!=0 echo F | xcopy /Y "$(PDBNAME)" "$(INSTALLDIR)"\* |
︙ | ︙ | |||
1876 1877 1878 1879 1880 1881 1882 | !if $(FOSSIL_ENABLE_SSL)!=0 openssl: @echo Building OpenSSL from "$(SSLDIR)"... !if "$(PERLDIR)" != "" @set "PATH=$(PERLDIR);$(PATH)" !endif @pushd "$(SSLDIR)" && "$(PERL)" Configure $(SSLCONFIG) && popd | < | | | | 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 | !if $(FOSSIL_ENABLE_SSL)!=0 openssl: @echo Building OpenSSL from "$(SSLDIR)"... !if "$(PERLDIR)" != "" @set "PATH=$(PERLDIR);$(PATH)" !endif @pushd "$(SSLDIR)" && "$(PERL)" Configure $(SSLCONFIG) && popd !if $(FOSSIL_ENABLE_WINXP)!=0 @pushd "$(SSLDIR)" && "$(MAKE)" "CC=cl $(XPCFLAGS)" "LFLAGS=$(XPLDFLAGS)" && popd !else @pushd "$(SSLDIR)" && "$(MAKE)" && popd !endif clean-openssl: @pushd "$(SSLDIR)" && "$(MAKE)" clean && popd !endif !if $(FOSSIL_ENABLE_MINIZ)==0 !if $(FOSSIL_BUILD_ZLIB)!=0 APPTARGETS = $(APPTARGETS) zlib !endif |
︙ | ︙ |
Changes to src/manifest.c.
︙ | ︙ | |||
66 67 68 69 70 71 72 | /* ** A parsed manifest or cluster. */ struct Manifest { Blob content; /* The original content blob */ int type; /* Type of artifact. One of CFTYPE_xxxxx */ int rid; /* The blob-id for this manifest */ | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | /* ** A parsed manifest or cluster. */ struct Manifest { Blob content; /* The original content blob */ int type; /* Type of artifact. One of CFTYPE_xxxxx */ int rid; /* The blob-id for this manifest */ const char *zBaseline;/* Baseline manifest. The B card. */ Manifest *pBaseline; /* The actual baseline manifest */ char *zComment; /* Decoded comment. The C card. */ double rDate; /* Date and time from D card. 0.0 if no D card. */ char *zUser; /* Name of the user from the U card. */ char *zRepoCksum; /* MD5 checksum of the baseline content. R card. */ char *zWiki; /* Text of the wiki page. W card. */ char *zWikiTitle; /* Name of the wiki page. L card. */ |
︙ | ︙ | |||
128 129 130 131 132 133 134 | } manifestCardTypes[] = { /* Allowed Required */ /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "DZ" }, /* Wants to be "CDUZ" ----^^^^ ** but we must limit for historical compatibility */ /* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" }, /* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" }, | | | | 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 | } manifestCardTypes[] = { /* Allowed Required */ /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "DZ" }, /* Wants to be "CDUZ" ----^^^^ ** but we must limit for historical compatibility */ /* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" }, /* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" }, /* CFTYPE_WIKI 4 */ { "CDLNPUWZ", "DLUWZ" }, /* CFTYPE_TICKET 5 */ { "DJKUZ", "DJKUZ" }, /* CFTYPE_ATTACHMENT 6 */ { "ACDNUZ", "ADZ" }, /* CFTYPE_EVENT 7 */ { "CDENPTUWZ", "DEWZ" }, /* CFTYPE_FORUM 8 */ { "DGHINPUWZ", "DUWZ" }, }; /* ** Names of manifest types */ static const char *const azNameOfMType[] = { "manifest", "cluster", "tag", "wiki", "ticket", "attachment", "technote", |
︙ | ︙ | |||
316 317 318 319 320 321 322 | ** checksum. Return 0 if there is no Z-card. Return 1 if the Z-card ** exists and is correct. Return 2 if the Z-card exists and has the wrong ** value. ** ** 0123456789 123456789 123456789 123456789 ** Z aea84f4f863865a8d59d0384e4d2a41c */ | | > > | > < | | > | | | < | | 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 | ** checksum. Return 0 if there is no Z-card. Return 1 if the Z-card ** exists and is correct. Return 2 if the Z-card exists and has the wrong ** value. ** ** 0123456789 123456789 123456789 123456789 ** Z aea84f4f863865a8d59d0384e4d2a41c */ static int verify_z_card(const char *z, int n, Blob *pErr){ const char *zHash; if( n<35 ) return 0; if( z[n-35]!='Z' || z[n-34]!=' ' ) return 0; md5sum_init(); md5sum_step_text(z, n-35); zHash = md5sum_finish(0); if( memcmp(&z[n-33], zHash, 32)==0 ){ return 1; }else{ blob_appendf(pErr, "incorrect Z-card cksum: expected %.32s", zHash); return 2; } } /* ** A structure used for rapid parsing of the Manifest file */ typedef struct ManifestText ManifestText; struct ManifestText { char *z; /* The first character of the next token */ char *zEnd; /* One character beyond the end of the manifest */ int atEol; /* True if z points to the start of a new line */ }; /* ** Return a pointer to the next token. The token is zero-terminated. ** Return NULL if there are no more tokens on the current line. */ static char *next_token(ManifestText *p, int *pLen){ char *zStart; int n; if( p->atEol ) return 0; zStart = p->z; n = strcspn(p->z, " \n"); p->atEol = p->z[n]=='\n'; p->z[n] = 0; p->z += n+1; if( pLen ) *pLen = n; return zStart; } /* ** Return the card-type for the next card. Or, return 0 if there are no ** more cards or if we are not at the end of the current card. */ |
︙ | ︙ | |||
380 381 382 383 384 385 386 387 388 389 390 391 392 393 | return c; } /* ** Shorthand for a control-artifact parsing error */ #define SYNTAX(T) {zErr=(T); goto manifest_syntax_error;} /* ** Parse a blob into a Manifest object. The Manifest object ** takes over the input blob and will free it when the ** Manifest object is freed. Zeros are inserted into the blob ** as string terminators so that blob should not be used again. ** | > > > > > > > > > > > > > | 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 | return c; } /* ** Shorthand for a control-artifact parsing error */ #define SYNTAX(T) {zErr=(T); goto manifest_syntax_error;} /* ** A cache of manifest IDs which manifest_parse() has seen in this ** session. */ static Bag seenManifests = Bag_INIT; /* ** Frees all memory owned by the manifest "has-seen" cache. Intended ** to be called only from the app's atexit() handler. */ void manifest_clear_cache(){ bag_clear(&seenManifests); } /* ** Parse a blob into a Manifest object. The Manifest object ** takes over the input blob and will free it when the ** Manifest object is freed. Zeros are inserted into the blob ** as string terminators so that blob should not be used again. ** |
︙ | ︙ | |||
424 425 426 427 428 429 430 | char *z; int n; char *zUuid; int sz = 0; int isRepeat; int nSelfTag = 0; /* Number of T cards referring to this manifest */ int nSimpleTag = 0; /* Number of T cards with "+" prefix */ | < | | | 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 | char *z; int n; char *zUuid; int sz = 0; int isRepeat; int nSelfTag = 0; /* Number of T cards referring to this manifest */ int nSimpleTag = 0; /* Number of T cards with "+" prefix */ const char *zErr = 0; unsigned int m; unsigned int seenCard = 0; /* Which card types have been seen */ char zErrBuf[100]; /* Write error messages here */ if( rid==0 ){ isRepeat = 1; }else if( bag_find(&seenManifests, rid) ){ isRepeat = 1; }else{ isRepeat = 0; bag_insert(&seenManifests, rid); } /* Every structural artifact ends with a '\n' character. Exit early ** if that is not the case for this artifact. */ if( !isRepeat ) g.parseCnt[0]++; z = blob_materialize(pContent); |
︙ | ︙ | |||
465 466 467 468 469 470 471 | if( n<10 || z[0]<'A' || z[0]>'Z' || z[1]!=' ' ){ blob_reset(pContent); blob_appendf(pErr, "line 1 not recognized"); return 0; } /* Then verify the Z-card. */ | | < | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | if( n<10 || z[0]<'A' || z[0]>'Z' || z[1]!=' ' ){ blob_reset(pContent); blob_appendf(pErr, "line 1 not recognized"); return 0; } /* Then verify the Z-card. */ if( verify_z_card(z, n, pErr)==2 ){ blob_reset(pContent); return 0; } /* Allocate a Manifest object to hold the parsed control artifact. */ p = fossil_malloc( sizeof(*p) ); memset(p, 0, sizeof(*p)); |
︙ | ︙ | |||
507 508 509 510 511 512 513 | int nTarget = 0, nSrc = 0; zName = next_token(&x, 0); zTarget = next_token(&x, &nTarget); zSrc = next_token(&x, &nSrc); if( zName==0 || zTarget==0 ) goto manifest_syntax_error; if( p->zAttachName!=0 ) goto manifest_syntax_error; defossilize(zName); | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | int nTarget = 0, nSrc = 0; zName = next_token(&x, 0); zTarget = next_token(&x, &nTarget); zSrc = next_token(&x, &nSrc); if( zName==0 || zTarget==0 ) goto manifest_syntax_error; if( p->zAttachName!=0 ) goto manifest_syntax_error; defossilize(zName); if( !file_is_simple_pathname_nonstrict(zName) ){ SYNTAX("invalid filename on A-card"); } defossilize(zTarget); if( !hname_validate(zTarget,nTarget) && !wiki_name_is_wellformed((const unsigned char *)zTarget) ){ SYNTAX("invalid target on A-card"); } |
︙ | ︙ | |||
605 606 607 608 609 610 611 | ** other control file. The filename and old-name are fossil-encoded. */ case 'F': { char *zName, *zPerm, *zPriorName; zName = next_token(&x,0); if( zName==0 ) SYNTAX("missing filename on F-card"); defossilize(zName); | | | | 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 | ** other control file. The filename and old-name are fossil-encoded. */ case 'F': { char *zName, *zPerm, *zPriorName; zName = next_token(&x,0); if( zName==0 ) SYNTAX("missing filename on F-card"); defossilize(zName); if( !file_is_simple_pathname_nonstrict(zName) ){ SYNTAX("F-card filename is not a simple path"); } zUuid = next_token(&x, &sz); if( p->zBaseline==0 || zUuid!=0 ){ if( !hname_validate(zUuid,sz) ){ SYNTAX("F-card hash invalid"); } } zPerm = next_token(&x,0); zPriorName = next_token(&x,0); if( zPriorName ){ defossilize(zPriorName); if( !file_is_simple_pathname_nonstrict(zPriorName) ){ SYNTAX("F-card old filename is not a simple path"); } } if( p->nFile>=p->nFileAlloc ){ p->nFileAlloc = p->nFileAlloc*2 + 10; p->aFile = fossil_realloc(p->aFile, p->nFileAlloc*sizeof(p->aFile[0]) ); |
︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | blob_copy(&b2, &b); blob_zero(&err); p = manifest_parse(&b2, 0, &err); if( p==0 ) fossil_print("ERROR: %s\n", blob_str(&err)); blob_reset(&err); manifest_destroy(p); } } /* ** COMMAND: test-parse-all-blobs ** | > | > > > > > > | | 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 | blob_copy(&b2, &b); blob_zero(&err); p = manifest_parse(&b2, 0, &err); if( p==0 ) fossil_print("ERROR: %s\n", blob_str(&err)); blob_reset(&err); manifest_destroy(p); } blob_reset(&b); } /* ** COMMAND: test-parse-all-blobs ** ** Usage: %fossil test-parse-all-blobs [--limit N] ** ** Parse all entries in the BLOB table that are believed to be non-data ** artifacts and report any errors. Run this test command on historical ** repositories after making any changes to the manifest_parse() ** implementation to confirm that the changes did not break anything. ** ** If the --limit N argument is given, parse no more than N blobs */ void manifest_test_parse_all_blobs_cmd(void){ Manifest *p; Blob err; Stmt q; int nTest = 0; int nErr = 0; int N = 1000000000; const char *z; db_find_and_open_repository(0, 0); z = find_option("limit", 0, 1); if( z ) N = atoi(z); verify_all_options(); db_prepare(&q, "SELECT DISTINCT objid FROM EVENT"); while( (N--)>0 && db_step(&q)==SQLITE_ROW ){ int id = db_column_int(&q,0); fossil_print("Checking %d \r", id); nTest++; fflush(stdout); blob_init(&err, 0, 0); p = manifest_get(id, CFTYPE_ANY, &err); if( p==0 ){ |
︙ | ︙ | |||
1694 1695 1696 1697 1698 1699 1700 | ** ** Return the RID of the primary parent. */ static int manifest_add_checkin_linkages( int rid, /* The RID of the check-in */ Manifest *p, /* Manifest for this check-in */ int nParent, /* Number of parents for this check-in */ | | | 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | ** ** Return the RID of the primary parent. */ static int manifest_add_checkin_linkages( int rid, /* The RID of the check-in */ Manifest *p, /* Manifest for this check-in */ int nParent, /* Number of parents for this check-in */ char * const * azParent /* hashes for each parent */ ){ int i; int parentid = 0; char zBaseId[30]; /* Baseline manifest RID for deltas. "NULL" otherwise */ Stmt q; if( p->zBaseline ){ |
︙ | ︙ | |||
2077 2078 2079 2080 2081 2082 2083 | fossil_trace("-- manifest_crosslink(%d)\n", rid); } if( (p = manifest_cache_find(rid))!=0 ){ blob_reset(pContent); }else if( (p = manifest_parse(pContent, rid, 0))==0 ){ assert( blob_is_reset(pContent) || pContent==0 ); if( (flags & MC_NO_ERRORS)==0 ){ | > | < > | 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 | fossil_trace("-- manifest_crosslink(%d)\n", rid); } if( (p = manifest_cache_find(rid))!=0 ){ blob_reset(pContent); }else if( (p = manifest_parse(pContent, rid, 0))==0 ){ assert( blob_is_reset(pContent) || pContent==0 ); if( (flags & MC_NO_ERRORS)==0 ){ char * zErrUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid); fossil_error(1, "syntax error in manifest [%S]", zErrUuid); fossil_free(zErrUuid); } return 0; } if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){ manifest_destroy(p); assert( blob_is_reset(pContent) ); if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "no manifest"); |
︙ | ︙ | |||
2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 | return 0; } db_begin_transaction(); if( p->type==CFTYPE_MANIFEST ){ if( permitHooks ){ zScript = xfer_commit_code(); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); } if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ char *zCom; parentid = manifest_add_checkin_linkages(rid,p,p->nParent,p->azParent); search_doc_touch('c', rid, 0); db_multi_exec( "REPLACE INTO event(type,mtime,objid,user,comment," | > > > > > > > > > > > | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 | return 0; } db_begin_transaction(); if( p->type==CFTYPE_MANIFEST ){ if( permitHooks ){ zScript = xfer_commit_code(); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); } if( p->nCherrypick && db_table_exists("repository","cherrypick") ){ int i; for(i=0; i<p->nCherrypick; i++){ db_multi_exec( "REPLACE INTO cherrypick(parentid,childid,isExclude)" " SELECT rid, %d, %d FROM blob WHERE uuid=%Q", rid, p->aCherrypick[i].zCPTarget[0]=='-', p->aCherrypick[i].zCPTarget+1 ); } } if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){ char *zCom; parentid = manifest_add_checkin_linkages(rid,p,p->nParent,p->azParent); search_doc_touch('c', rid, 0); db_multi_exec( "REPLACE INTO event(type,mtime,objid,user,comment," |
︙ | ︙ | |||
2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 | if( tid ){ switch( p->aTag[i].zName[0] ){ case '-': type = 0; break; /* Cancel prior occurrences */ case '+': type = 1; break; /* Apply to target only */ case '*': type = 2; break; /* Propagate to descendants */ default: fossil_error(1, "unknown tag type in manifest: %s", p->aTag); return 0; } tag_insert(&p->aTag[i].zName[1], type, p->aTag[i].zValue, rid, p->rDate, tid); } } if( parentid ){ | > | 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 | if( tid ){ switch( p->aTag[i].zName[0] ){ case '-': type = 0; break; /* Cancel prior occurrences */ case '+': type = 1; break; /* Apply to target only */ case '*': type = 2; break; /* Propagate to descendants */ default: fossil_error(1, "unknown tag type in manifest: %s", p->aTag); manifest_destroy(p); return 0; } tag_insert(&p->aTag[i].zName[1], type, p->aTag[i].zValue, rid, p->rDate, tid); } } if( parentid ){ |
︙ | ︙ | |||
2527 2528 2529 2530 2531 2532 2533 | char *zFType; char *zTitle; schema_forum(); froot = p->zThreadRoot ? uuid_to_rid(p->zThreadRoot, 1) : rid; fprev = p->nParent ? uuid_to_rid(p->azParent[0],1) : 0; firt = p->zInReplyTo ? uuid_to_rid(p->zInReplyTo,1) : 0; db_multi_exec( | | | 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 | char *zFType; char *zTitle; schema_forum(); froot = p->zThreadRoot ? uuid_to_rid(p->zThreadRoot, 1) : rid; fprev = p->nParent ? uuid_to_rid(p->azParent[0],1) : 0; firt = p->zInReplyTo ? uuid_to_rid(p->zInReplyTo,1) : 0; db_multi_exec( "REPLACE INTO forumpost(fpid,froot,fprev,firt,fmtime)" "VALUES(%d,%d,nullif(%d,0),nullif(%d,0),%.17g)", p->rid, froot, fprev, firt, p->rDate ); if( firt==0 ){ /* This is the start of a new thread, either the initial entry ** or an edit of the initial entry. */ zTitle = p->zThreadTitle; |
︙ | ︙ |
Changes to src/markdown.c.
︙ | ︙ | |||
65 66 67 68 69 70 71 | void *opaque); void (*table_row)(struct Blob *ob, struct Blob *cells, int flags, void *opaque); /* span level callbacks - NULL or return 0 prints the span verbatim */ int (*autolink)(struct Blob *ob, struct Blob *link, enum mkd_autolink type, void *opaque); | | < | 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 | void *opaque); void (*table_row)(struct Blob *ob, struct Blob *cells, int flags, void *opaque); /* span level callbacks - NULL or return 0 prints the span verbatim */ int (*autolink)(struct Blob *ob, struct Blob *link, enum mkd_autolink type, void *opaque); int (*codespan)(struct Blob *ob, struct Blob *text, int nSep, void *opaque); int (*double_emphasis)(struct Blob *ob, struct Blob *text, char c, void *opaque); int (*emphasis)(struct Blob *ob, struct Blob *text, char c,void*opaque); int (*image)(struct Blob *ob, struct Blob *link, struct Blob *title, struct Blob *alt, void *opaque); int (*linebreak)(struct Blob *ob, void *opaque); int (*link)(struct Blob *ob, struct Blob *link, struct Blob *title, struct Blob *content, void *opaque); int (*raw_html_tag)(struct Blob *ob, struct Blob *tag, void *opaque); int (*triple_emphasis)(struct Blob *ob, struct Blob *text, char c, void *opaque); /* low level callbacks - NULL copies input directly into the output */ void (*entity)(struct Blob *ob, struct Blob *entity, void *opaque); void (*normal_text)(struct Blob *ob, struct Blob *text, void *opaque); /* renderer data */ const char *emph_chars; /* chars that trigger emphasis rendering */ void *opaque; /* opaque data send to every rendering callback */ }; /********* |
︙ | ︙ | |||
152 153 154 155 156 157 158 | /* render -- structure containing one particular render */ struct render { struct mkd_renderer make; struct Blob refs; char_trigger active_char[256]; | | > | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /* render -- structure containing one particular render */ struct render { struct mkd_renderer make; struct Blob refs; char_trigger active_char[256]; int iDepth; /* Depth of recursion */ int nBlobCache; /* Number of entries in aBlobCache */ struct Blob *aBlobCache[20]; /* Cache of Blobs available for reuse */ }; /* html_tag -- structure for quick HTML tag search (inspired from discount) */ struct html_tag { const char *text; int size; |
︙ | ︙ | |||
236 237 238 239 240 241 242 | beg = i; while( i<size && !(data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; } blob_append(id, data+beg, i-beg); /* add a single space and skip all consecutive whitespace */ | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | beg = i; while( i<size && !(data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; } blob_append(id, data+beg, i-beg); /* add a single space and skip all consecutive whitespace */ if( i<size ) blob_append_char(id, ' '); while( i<size && (data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; } } /* turn upper-case ASCII into their lower-case counterparts */ id_data = blob_buffer(id); for(i=0; i<blob_size(id); i++){ if( id_data[i]>='A' && id_data[i]<='Z' ) id_data[i] += 'a' - 'A'; |
︙ | ︙ | |||
298 299 300 301 302 303 304 | return bsearch(&key, block_tags, count(block_tags), sizeof block_tags[0], cmp_html_tag); } | > > > | > | > | | | | < | > > | | > > | > > > | 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 | return bsearch(&key, block_tags, count(block_tags), sizeof block_tags[0], cmp_html_tag); } /* return true if recursion has gone too deep */ static int too_deep(struct render *rndr){ return rndr->iDepth>200; } /* get a new working buffer from the cache or create one. return NULL ** if failIfDeep is true and the depth of recursion has gone too deep. */ static struct Blob *new_work_buffer(struct render *rndr){ struct Blob *ret; rndr->iDepth++; if( rndr->nBlobCache ){ ret = rndr->aBlobCache[--rndr->nBlobCache]; }else{ ret = fossil_malloc(sizeof(*ret)); } *ret = empty_blob; return ret; } /* release the given working buffer back to the cache */ static void release_work_buffer(struct render *rndr, struct Blob *buf){ if( !buf ) return; rndr->iDepth--; blob_reset(buf); if( rndr->nBlobCache < sizeof(rndr->aBlobCache)/sizeof(rndr->aBlobCache[0]) ){ rndr->aBlobCache[rndr->nBlobCache++] = buf; }else{ fossil_free(buf); } } /**************************** * INLINE PARSING FUNCTIONS * ****************************/ |
︙ | ︙ | |||
419 420 421 422 423 424 425 426 427 428 429 430 431 432 | char *data, size_t size ){ size_t i = 0, end = 0; char_trigger action = 0; struct Blob work = BLOB_INITIALIZER; while( i<size ){ /* copying inactive chars into the output */ while( end<size && (action = rndr->active_char[(unsigned char)data[end]])==0 ){ end++; } | > > > > | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | char *data, size_t size ){ size_t i = 0, end = 0; char_trigger action = 0; struct Blob work = BLOB_INITIALIZER; if( too_deep(rndr) ){ blob_append(ob, data, size); return; } while( i<size ){ /* copying inactive chars into the output */ while( end<size && (action = rndr->active_char[(unsigned char)data[end]])==0 ){ end++; } |
︙ | ︙ | |||
551 552 553 554 555 556 557 558 559 | i++; continue; } if( data[i]==c && data[i-1]!=' ' && data[i-1]!='\t' && data[i-1]!='\n' ){ work = new_work_buffer(rndr); | > < | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | i++; continue; } if( data[i]==c && data[i-1]!=' ' && data[i-1]!='\t' && data[i-1]!='\n' && !too_deep(rndr) ){ work = new_work_buffer(rndr); parse_inline(work, rndr, data, i); r = rndr->make.emphasis(ob, work, c, rndr->make.opaque); release_work_buffer(rndr, work); return r ? i+1 : 0; } } return 0; |
︙ | ︙ | |||
589 590 591 592 593 594 595 596 597 | if( i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' && data[i-1]!='\t' && data[i-1]!='\n' ){ work = new_work_buffer(rndr); | > < | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | if( i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' && data[i-1]!='\t' && data[i-1]!='\n' && !too_deep(rndr) ){ work = new_work_buffer(rndr); parse_inline(work, rndr, data, i); r = rndr->make.double_emphasis(ob, work, c, rndr->make.opaque); release_work_buffer(rndr, work); return r ? i+2 : 0; } i++; } |
︙ | ︙ | |||
629 630 631 632 633 634 635 636 637 638 | continue; } if( i+2<size && data[i+1]==c && data[i+2] == c && rndr->make.triple_emphasis ){ /* triple symbol found */ struct Blob *work = new_work_buffer(rndr); | > < | 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | continue; } if( i+2<size && data[i+1]==c && data[i+2] == c && rndr->make.triple_emphasis && !too_deep(rndr) ){ /* triple symbol found */ struct Blob *work = new_work_buffer(rndr); parse_inline(work, rndr, data, i); r = rndr->make.triple_emphasis(ob, work, c, rndr->make.opaque); release_work_buffer(rndr, work); return r ? i+3 : 0; }else if( i+1<size && data[i+1]==c ){ /* double symbol found, handing over to emph1 */ len = parse_emph1(ob, rndr, data-2, size+2, c); |
︙ | ︙ | |||
723 724 725 726 727 728 729 730 731 | struct Blob *ob, struct render *rndr, char *data, size_t offset, size_t size ){ size_t end, nb = 0, i, f_begin, f_end; /* counting the number of backticks in the delimiter */ | > | | | | | 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 | struct Blob *ob, struct render *rndr, char *data, size_t offset, size_t size ){ size_t end, nb = 0, i, f_begin, f_end; char delim = data[0]; /* counting the number of backticks in the delimiter */ while( nb<size && data[nb]==delim ){ nb++; } /* finding the next delimiter */ i = 0; for(end=nb; end<size && i<nb; end++){ if( data[end]==delim ) i++; else i = 0; } if( i<nb && end>=size ) return 0; /* no matching delimiter */ /* trimming outside whitespaces */ f_begin = nb; while( f_begin<end && (data[f_begin]==' ' || data[f_begin]=='\t') ){ f_begin++; } f_end = end-nb; while( f_end>nb && (data[f_end-1]==' ' || data[f_end-1]=='\t') ){ f_end--; } /* real code span */ if( f_begin<f_end ){ struct Blob work = BLOB_INITIALIZER; blob_init(&work, data+f_begin, f_end-f_begin); if( !rndr->make.codespan(ob, &work, nb, rndr->make.opaque) ) end = 0; }else{ if( !rndr->make.codespan(ob, 0, nb, rndr->make.opaque) ) end = 0; } return end; } /* char_escape -- '\\' backslash escape */ static size_t char_escape( |
︙ | ︙ | |||
984 985 986 987 988 989 990 | i++; /* skip any amount of whitespace or newline */ /* (this is much more laxist than original markdown syntax) */ while( i<size && (data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; } /* allocate temporary buffers to store content, link and title */ | | | | < | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | i++; /* skip any amount of whitespace or newline */ /* (this is much more laxist than original markdown syntax) */ while( i<size && (data[i]==' ' || data[i]=='\t' || data[i]=='\n') ){ i++; } /* allocate temporary buffers to store content, link and title */ title = new_work_buffer(rndr); content = new_work_buffer(rndr); link = new_work_buffer(rndr); ret = 0; /* error if we don't get to the callback */ /* inline style link */ if( i<size && data[i]=='(' ){ size_t span_end = i; while( span_end<size && !(data[span_end]==')' && (span_end==i || data[span_end-1]!='\\')) |
︙ | ︙ | |||
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 | static size_t prefix_code(char *data, size_t size){ if( size>0 && data[0]=='\t' ) return 1; if( size>3 && data[0]==' ' && data[1]==' ' && data[2]==' ' && data[3]==' ' ){ return 4; } return 0; } /* prefix_oli -- returns ordered list item prefix */ static size_t prefix_oli(char *data, size_t size){ size_t i = 0; if( i<size && data[i]==' ') i++; if( i<size && data[i]==' ') i++; if( i<size && data[i]==' ') i++; if( i>=size || data[i]<'0' || data[i]>'9' ) return 0; while( i<size && data[i]>='0' && data[i]<='9' ){ i++; } if( i+1>=size | > > > > > > > > > > > > | | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | static size_t prefix_code(char *data, size_t size){ if( size>0 && data[0]=='\t' ) return 1; if( size>3 && data[0]==' ' && data[1]==' ' && data[2]==' ' && data[3]==' ' ){ return 4; } return 0; } /* Return the number of characters in the delimiter of a fenced code ** block. */ static size_t prefix_fencedcode(char *data, size_t size){ char c = data[0]; int nb; if( c!='`' && c!='~' ) return 0; for(nb=1; nb<size-3 && data[nb]==c; nb++){} if( nb<3 ) return 0; if( nb>=size-nb ) return 0; return nb; } /* prefix_oli -- returns ordered list item prefix */ static size_t prefix_oli(char *data, size_t size){ size_t i = 0; if( i<size && data[i]==' ') i++; if( i<size && data[i]==' ') i++; if( i<size && data[i]==' ') i++; if( i>=size || data[i]<'0' || data[i]>'9' ) return 0; while( i<size && data[i]>='0' && data[i]<='9' ){ i++; } if( i+1>=size || (data[i]!='.' && data[i]!=')') || (data[i+1]!=' ' && data[i+1]!='\t') ){ return 0; } i = i+2; while( i<size && (data[i]==' ' || data[i]=='\t') ){ i++; } return i; |
︙ | ︙ | |||
1280 1281 1282 1283 1284 1285 1286 | } work_size += end-beg; } beg = end; } if( rndr->make.blockquote ){ | < | | | < > > > | > > < | < < < | < | < < < | < | | < < < < < > > > | > > | | < | 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 | } work_size += end-beg; } beg = end; } if( rndr->make.blockquote ){ if( !too_deep(rndr) ){ parse_block(out, rndr, work_data, work_size); }else{ blob_append(out, work_data, work_size); } rndr->make.blockquote(ob, out, rndr->make.opaque); } release_work_buffer(rndr, out); return end; } /* parse_paragraph -- handles parsing of a regular paragraph */ static size_t parse_paragraph( struct Blob *ob, struct render *rndr, char *data, size_t size ){ size_t i = 0, end = 0; int level = 0; char *work_data = data; size_t work_size = 0; while( i<size ){ char *zEnd = memchr(data+i, '\n', size-i-1); end = zEnd==0 ? size : (int)(zEnd - (data-1)); /* The above is the same as: ** for(end=i+1; end<size && data[end-1]!='\n'; end++); ** "end" is left with a value such that data[end] is one byte ** past the first '\n' or one byte past the end of the string */ if( is_empty(data+i, size-i) || (level = is_headerline(data+i, size-i))!= 0 ){ break; } if( (i && data[i]=='#') || is_hrule(data+i, size-i) ){ end = i; break; } i = end; } work_size = i; while( work_size && data[work_size-1]=='\n' ){ work_size--; } if( !level ){ if( rndr->make.paragraph ){ struct Blob *tmp = new_work_buffer(rndr); parse_inline(tmp, rndr, work_data, work_size); rndr->make.paragraph(ob, tmp, rndr->make.opaque); release_work_buffer(rndr, tmp); } }else{ if( work_size ){ size_t beg; i = work_size; work_size -= 1; while( work_size && data[work_size]!='\n' ){ work_size--; } beg = work_size+1; while( work_size && data[work_size-1]=='\n'){ work_size--; } if( work_size ){ struct Blob *tmp = new_work_buffer(rndr); parse_inline(tmp, rndr, work_data, work_size); if( rndr->make.paragraph ){ rndr->make.paragraph(ob, tmp, rndr->make.opaque); } release_work_buffer(rndr, tmp); work_data += beg; work_size = i - beg; }else{ work_size = i; } } if( rndr->make.header ){ struct Blob *span = new_work_buffer(rndr); parse_inline(span, rndr, work_data, work_size); rndr->make.header(ob, span, level, rndr->make.opaque); release_work_buffer(rndr, span); } } return end; } /* parse_blockcode -- handles parsing of a block-level code fragment */ static size_t parse_blockcode( struct Blob *ob, struct render *rndr, char *data, size_t size ){ size_t beg, end, pre; struct Blob *work = new_work_buffer(rndr); beg = 0; while( beg<size ){ char *zEnd = memchr(data+beg, '\n', size-beg-1); end = zEnd==0 ? size : (int)(zEnd - (data-1)); /* The above is the same as: ** for(end=beg+1; end<size && data[end-1]!='\n'; end++); ** "end" is left with a value such that data[end] is one byte ** past the first \n or past then end of the string. */ pre = prefix_code(data+beg, end-beg); if( pre ){ beg += pre; /* skipping prefix */ }else if( !is_empty(data+beg, end-beg) ){ /* non-empty non-prefixed line breaks the pre */ break; } if( beg<end ){ /* verbatim copy to the working buffer, escaping entities */ if( is_empty(data + beg, end - beg) ){ blob_append_char(work, '\n'); }else{ blob_append(work, data+beg, end-beg); } } beg = end; } end = blob_size(work); while( end>0 && blob_buffer(work)[end-1]=='\n' ){ end--; } work->nUsed = end; blob_append_char(work, '\n'); if( work!=ob ){ if( rndr->make.blockcode ){ rndr->make.blockcode(ob, work, rndr->make.opaque); } release_work_buffer(rndr, work); } return beg; } /* parse_listitem -- parsing of a single list item */ /* assuming initial prefix is already removed */ static size_t parse_listitem( struct Blob *ob, struct render *rndr, char *data, size_t size, int *flags ){ struct Blob *work = 0, *inter = 0; size_t beg = 0, end, pre, sublist = 0, orgpre = 0, i; int in_empty = 0, has_inside_empty = 0; /* keeping track of the first indentation prefix */ if( size>1 && data[0]==' ' ){ orgpre = 1; |
︙ | ︙ | |||
1457 1458 1459 1460 1461 1462 1463 | /* skipping to the beginning of the following line */ end = beg; while( end<size && data[end-1]!='\n' ){ end++; } /* getting working buffers */ work = new_work_buffer(rndr); inter = new_work_buffer(rndr); | < | 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 | /* skipping to the beginning of the following line */ end = beg; while( end<size && data[end-1]!='\n' ){ end++; } /* getting working buffers */ work = new_work_buffer(rndr); inter = new_work_buffer(rndr); /* putting the first line into the working buffer */ blob_append(work, data+beg, end-beg); beg = end; /* process the following lines */ while( beg<size ){ |
︙ | ︙ | |||
1507 1508 1509 1510 1511 1512 1513 | if( !sublist ) sublist = blob_size(work); /* joining only indented stuff after empty lines */ }else if( in_empty && i<4 && data[beg]!='\t' ){ *flags |= MKD_LI_END; break; }else if( in_empty ){ | | | < | 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 | if( !sublist ) sublist = blob_size(work); /* joining only indented stuff after empty lines */ }else if( in_empty && i<4 && data[beg]!='\t' ){ *flags |= MKD_LI_END; break; }else if( in_empty ){ blob_append_char(work, '\n'); has_inside_empty = 1; } in_empty = 0; /* adding the line without prefix into the working buffer */ blob_append(work, data+beg+i, end-beg-i); beg = end; } /* non-recursive fallback when working buffer stack is full */ if( !inter ){ if( rndr->make.listitem ){ rndr->make.listitem(ob, work, *flags, rndr->make.opaque); } release_work_buffer(rndr, work); return beg; } /* render of li contents */ if( has_inside_empty ) *flags |= MKD_LI_BLOCK; if( *flags & MKD_LI_BLOCK ){ /* intermediate render of block li */ |
︙ | ︙ | |||
1558 1559 1560 1561 1562 1563 1564 | } /* render of li itself */ if( rndr->make.listitem ){ rndr->make.listitem(ob, inter, *flags, rndr->make.opaque); } release_work_buffer(rndr, inter); | | < < < | < | 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 | } /* render of li itself */ if( rndr->make.listitem ){ rndr->make.listitem(ob, inter, *flags, rndr->make.opaque); } release_work_buffer(rndr, inter); release_work_buffer(rndr, work); return beg; } /* parse_list -- parsing ordered or unordered list block */ static size_t parse_list( struct Blob *ob, struct render *rndr, char *data, size_t size, int flags ){ struct Blob *work = new_work_buffer(rndr); size_t i = 0, j; while( i<size ){ j = parse_listitem(work, rndr, data+i, size-i, &flags); i += j; if( !j || (flags & MKD_LI_END) ) break; } if( rndr->make.list ) rndr->make.list(ob, work, flags, rndr->make.opaque); release_work_buffer(rndr, work); return i; } /* parse_atxheader -- parsing of atx-style headers */ static size_t parse_atxheader( struct Blob *ob, |
︙ | ︙ | |||
1615 1616 1617 1618 1619 1620 1621 | if( end<=i ) return parse_paragraph(ob, rndr, data, size); while( end && data[end-1]=='#' ){ end--; } while( end && (data[end-1]==' ' || data[end-1]=='\t') ){ end--; } if( end<=i ) return parse_paragraph(ob, rndr, data, size); span_size = end-span_beg; if( rndr->make.header ){ | < < < | < < < | | 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 | if( end<=i ) return parse_paragraph(ob, rndr, data, size); while( end && data[end-1]=='#' ){ end--; } while( end && (data[end-1]==' ' || data[end-1]=='\t') ){ end--; } if( end<=i ) return parse_paragraph(ob, rndr, data, size); span_size = end-span_beg; if( rndr->make.header ){ struct Blob *span = new_work_buffer(rndr); parse_inline(span, rndr, data+span_beg, span_size); rndr->make.header(ob, span, level, rndr->make.opaque); release_work_buffer(rndr, span); } return skip; } /* htmlblock_end -- checking end of HTML block : </tag>[ \t]*\n[ \t*]\n */ |
︙ | ︙ | |||
1784 1785 1786 1787 1788 1789 1790 | static void parse_table_cell( struct Blob *ob, /* output blob */ struct render *rndr, /* renderer description */ char *data, /* input text */ size_t size, /* input text size */ int flags /* table flags */ ){ | < < < | < < < | | 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 | static void parse_table_cell( struct Blob *ob, /* output blob */ struct render *rndr, /* renderer description */ char *data, /* input text */ size_t size, /* input text size */ int flags /* table flags */ ){ struct Blob *span = new_work_buffer(rndr); parse_inline(span, rndr, data, size); rndr->make.table_cell(ob, span, flags, rndr->make.opaque); release_work_buffer(rndr, span); } /* parse_table_row -- parse an input line into a table row */ static size_t parse_table_row( struct Blob *ob, /* output blob for rendering */ |
︙ | ︙ | |||
1854 1855 1856 1857 1858 1859 1860 | /* (because it is only the optional end separator) */ if( total && end<=beg ) continue; /* fallback on default alignment if not explicit */ if( align==0 && aligns && col<align_size ) align = aligns[col]; /* render cells */ | > | > < | < < < < < < < | | 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | /* (because it is only the optional end separator) */ if( total && end<=beg ) continue; /* fallback on default alignment if not explicit */ if( align==0 && aligns && col<align_size ) align = aligns[col]; /* render cells */ if( cells && end>beg ){ parse_table_cell(cells, rndr, data+beg, end-beg, align|flags); } col++; } /* render the whole row and clean up */ rndr->make.table_row(ob, cells, flags, rndr->make.opaque); release_work_buffer(rndr, cells); return total ? total : size; } /* parse_table -- parsing of a whole table */ static size_t parse_table( struct Blob *ob, struct render *rndr, char *data, size_t size ){ size_t i = 0, head_end, col; size_t align_size = 0; int *aligns = 0; struct Blob *head = 0; struct Blob *rows = new_work_buffer(rndr); /* skip the first (presumably header) line */ while( i<size && data[i]!='\n' ){ i++; } head_end = i; /* fallback on end of input */ if( i>=size ){ parse_table_row(rows, rndr, data, size, 0, 0, 0); rndr->make.table(ob, 0, rows, rndr->make.opaque); release_work_buffer(rndr, rows); return i; } /* attempt to parse a table rule, i.e. blanks, dash, colons and sep */ i++; col = 0; while( i<size |
︙ | ︙ | |||
1919 1920 1921 1922 1923 1924 1925 | } if( i<size && data[i]=='\n' ){ align_size++; /* render the header row */ head = new_work_buffer(rndr); | < | < | 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 | } if( i<size && data[i]=='\n' ){ align_size++; /* render the header row */ head = new_work_buffer(rndr); parse_table_row(head, rndr, data, head_end, 0, 0, MKD_CELL_HEAD); /* parse alignments if provided */ if( col && (aligns=fossil_malloc(align_size * sizeof *aligns))!=0 ){ for(i=0; i<align_size; i++) aligns[i] = 0; col = 0; i = head_end+1; |
︙ | ︙ | |||
1964 1965 1966 1967 1968 1969 1970 | i += parse_table_row(rows, rndr, data+i, size-i, aligns, align_size, 0); } /* render the full table */ rndr->make.table(ob, head, rows, rndr->make.opaque); /* cleanup */ | | | | 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 | i += parse_table_row(rows, rndr, data+i, size-i, aligns, align_size, 0); } /* render the full table */ rndr->make.table(ob, head, rows, rndr->make.opaque); /* cleanup */ release_work_buffer(rndr, head); release_work_buffer(rndr, rows); fossil_free(aligns); return i; } /* parse_block -- parsing of one block, returning next char to parse */ static void parse_block( |
︙ | ︙ | |||
2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | beg += parse_blockcode(ob, rndr, txt_data, end); }else if( prefix_uli(txt_data, end) ){ beg += parse_list(ob, rndr, txt_data, end, 0); }else if( prefix_oli(txt_data, end) ){ beg += parse_list(ob, rndr, txt_data, end, MKD_LIST_ORDERED); }else if( has_table && is_tableline(txt_data, end) ){ beg += parse_table(ob, rndr, txt_data, end); }else{ beg += parse_paragraph(ob, rndr, txt_data, end); } } } | > > > > | 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 | beg += parse_blockcode(ob, rndr, txt_data, end); }else if( prefix_uli(txt_data, end) ){ beg += parse_list(ob, rndr, txt_data, end, 0); }else if( prefix_oli(txt_data, end) ){ beg += parse_list(ob, rndr, txt_data, end, MKD_LIST_ORDERED); }else if( has_table && is_tableline(txt_data, end) ){ beg += parse_table(ob, rndr, txt_data, end); }else if( prefix_fencedcode(txt_data, end) && (i = char_codespan(ob, rndr, txt_data, 0, end))!=0 ){ beg += i; }else{ beg += parse_paragraph(ob, rndr, txt_data, end); } } } |
︙ | ︙ | |||
2159 2160 2161 2162 2163 2164 2165 | /* markdown -- parses the input buffer and renders it into the output buffer */ void markdown( struct Blob *ob, /* output blob for rendered text */ struct Blob *ib, /* input blob in markdown */ const struct mkd_renderer *rndrer /* renderer descriptor (callbacks) */ ){ struct link_ref *lr; | < > | | < < | | 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 | /* markdown -- parses the input buffer and renders it into the output buffer */ void markdown( struct Blob *ob, /* output blob for rendered text */ struct Blob *ib, /* input blob in markdown */ const struct mkd_renderer *rndrer /* renderer descriptor (callbacks) */ ){ struct link_ref *lr; size_t i, beg, end = 0; struct render rndr; char *ib_data; Blob text = BLOB_INITIALIZER; /* filling the render structure */ if( !rndrer ) return; rndr.make = *rndrer; rndr.nBlobCache = 0; rndr.iDepth = 0; rndr.refs = empty_blob; for(i=0; i<256; i++) rndr.active_char[i] = 0; if( (rndr.make.emphasis || rndr.make.double_emphasis || rndr.make.triple_emphasis) && rndr.make.emph_chars ){ for(i=0; rndr.make.emph_chars[i]; i++){ |
︙ | ︙ | |||
2207 2208 2209 2210 2211 2212 2213 | /* adding the line body if present */ if( end>beg ) blob_append(&text, ib_data + beg, end - beg); while( end<blob_size(ib) && (ib_data[end]=='\n' || ib_data[end]=='\r') ){ /* add one \n per newline */ if( ib_data[end]=='\n' || (end+1<blob_size(ib) && ib_data[end+1]!='\n') ){ | | | 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 | /* adding the line body if present */ if( end>beg ) blob_append(&text, ib_data + beg, end - beg); while( end<blob_size(ib) && (ib_data[end]=='\n' || ib_data[end]=='\r') ){ /* add one \n per newline */ if( ib_data[end]=='\n' || (end+1<blob_size(ib) && ib_data[end+1]!='\n') ){ blob_append_char(&text, '\n'); } end += 1; } beg = end; } } |
︙ | ︙ | |||
2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 | /* second pass: actual rendering */ if( rndr.make.prolog ) rndr.make.prolog(ob, rndr.make.opaque); parse_block(ob, &rndr, blob_buffer(&text), blob_size(&text)); if( rndr.make.epilog ) rndr.make.epilog(ob, rndr.make.opaque); /* clean-up */ blob_reset(&text); lr = (struct link_ref *)blob_buffer(&rndr.refs); end = blob_size(&rndr.refs)/sizeof(struct link_ref); for(i=0; i<end; i++){ blob_reset(&lr[i].id); blob_reset(&lr[i].link); blob_reset(&lr[i].title); } blob_reset(&rndr.refs); | > | | | > | 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 | /* second pass: actual rendering */ if( rndr.make.prolog ) rndr.make.prolog(ob, rndr.make.opaque); parse_block(ob, &rndr, blob_buffer(&text), blob_size(&text)); if( rndr.make.epilog ) rndr.make.epilog(ob, rndr.make.opaque); /* clean-up */ assert( rndr.iDepth==0 ); blob_reset(&text); lr = (struct link_ref *)blob_buffer(&rndr.refs); end = blob_size(&rndr.refs)/sizeof(struct link_ref); for(i=0; i<end; i++){ blob_reset(&lr[i].id); blob_reset(&lr[i].link); blob_reset(&lr[i].title); } blob_reset(&rndr.refs); for(i=0; i<rndr.nBlobCache; i++){ fossil_free(rndr.aBlobCache[i]); } } |
Changes to src/markdown.md.
︙ | ︙ | |||
23 24 25 26 27 28 29 30 | > 1. **\[display text\]\(URL\)** > 2. **\[display text\]\(URL "Title"\)** > 3. **\[display text\]\(URL 'Title'\)** > 4. **\<URL\>** > 5. **\[display text\]\[label\]** > 6. **\[display text\]\[\]** | > > | | | | < > > > > > > > > > > > > > > > > > | > > > > > > > > > | > > | 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 | > 1. **\[display text\]\(URL\)** > 2. **\[display text\]\(URL "Title"\)** > 3. **\[display text\]\(URL 'Title'\)** > 4. **\<URL\>** > 5. **\[display text\]\[label\]** > 6. **\[display text\]\[\]** > 7. **\[display text\]** > 8. **\[\]\(URL\)** > With link formats 5, 6, and 7 ("reference links"), the URL is supplied > elsewhere in the document, as shown below. Link formats 6 and 7 reuse > the display text as the label. Labels are case-insensitive. The title > may be split onto the next line with optional indenting. > * **\[label\]: URL** > * **\[label\]: URL "Title"** > * **\[label\]: URL 'Title'** > * **\[label\]: URL (Title)** > If **URL** begins with "http:", "https:', "ftp:' or "mailto:", > it may optionally be written **\<URL\>** (format 4). > Other **URL** formats include: > <ul> > <li> A relative pathname. > <li> A pathname starting with "/" in which case the Fossil server > URL prefix is prepended > <li> A wiki page name, or a wiki page name preceded by "wiki:" > <li> An artifact or ticket hash or hash prefix > <li> A date and time stamp: "YYYY-MM-DD HH:MM:SS" or a subset that > includes at least the day of the month.</ul> > In format 8, then the URL becomes the display text. This is useful for > hyperlinks that refer to wiki pages and check-in and ticket hashes. ## Fonts ## > * _\*italic\*_ > * *\_italic\_* > * __\*\*bold\*\*__ > * **\_\_bold\_\_** > * ___\*\*\*italic+bold\*\*\*___ > * ***\_\_\_italic+bold\_\_\_*** > * \``code`\` > The **\`code\`** construct disables HTML markup, so one can write, for > example, **\`\<html\>\`** to yield **`<html>`**. ## Lists ## > * bullet item + bullet item - bullet item 1. numbered item 2) numbered item > A two-level list is created by placing additional whitespace before the > **\***/**+**/**-**/**1.** of the secondary items. > * top-level item * secondary item ## Block Quotes ## > Begin each line of a paragraph with **>** to block quote that paragraph. > > > This paragraph is indented > > > > Double-indented paragraph ## Literal/Verbatim Text - Code Blocks ## > For inline text, you can either use \``backticks`\` or the HTML > `<code>` tag. > > For blocks of text or code: > > 1. Indent the text using a tab character or at least four spaces. > 2. Precede the block with an HTML `<pre>` tag and follow it with `</pre>`. > 3. Surround the block by \`\`\` (three or more) or \~\~\~ either at the > left margin or indented no more than three spaces. > With the standard skins, verbatim text is rendered in a fixed-width font, > but that is purely a presentation matter, controlled by the skin’s CSS. ## Tables ## > | Header 1 | Header 2 | Header 3 | ---------------------------------------------- | Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | |
︙ | ︙ |
Changes to src/markdown_html.c.
︙ | ︙ | |||
30 31 32 33 34 35 36 | struct Blob *output_body); #endif /* INTERFACE */ /* INTER_BLOCK -- skip a line between block level elements */ #define INTER_BLOCK(ob) \ | | | | > > > | > | 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 | struct Blob *output_body); #endif /* INTERFACE */ /* INTER_BLOCK -- skip a line between block level elements */ #define INTER_BLOCK(ob) \ do { if( blob_size(ob)>0 ) blob_append_char(ob, '\n'); } while (0) /* BLOB_APPEND_LITERAL -- append a string literal to a blob */ #define BLOB_APPEND_LITERAL(blob, literal) \ blob_append((blob), "" literal, (sizeof literal)-1) /* * The empty string in the second argument leads to a syntax error * when the macro is not used with a string literal. Unfortunately * the error is not overly explicit. */ /* BLOB_APPEND_BLOB -- append blob contents to another */ #define BLOB_APPEND_BLOB(dest, src) \ blob_append((dest), blob_buffer(src), blob_size(src)) /* HTML escapes ** ** html_escape() converts < to <, > to >, and & to &. ** html_quote() goes further and converts " into " and ' in '. */ static void html_quote(struct Blob *ob, const char *data, size_t size){ size_t beg = 0, i = 0; while( i<size ){ beg = i; while( i<size && data[i]!='<' && data[i]!='>' && data[i]!='"' && data[i]!='&' && data[i]!='\'' ){ i++; } blob_append(ob, data+beg, i-beg); while( i<size ){ if( data[i]=='<' ){ BLOB_APPEND_LITERAL(ob, "<"); |
︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | BLOB_APPEND_LITERAL(ob, "'"); }else{ break; } i++; } } } /* HTML block tags */ /* Size of the prolog: "<div class='markdown'>\n" */ #define PROLOG_SIZE 23 | > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | BLOB_APPEND_LITERAL(ob, "'"); }else{ break; } i++; } } } static void html_escape(struct Blob *ob, const char *data, size_t size){ size_t beg = 0, i = 0; while( i<size ){ beg = i; while( i<size && data[i]!='<' && data[i]!='>' && data[i]!='&' ){ i++; } blob_append(ob, data+beg, i-beg); while( i<size ){ if( data[i]=='<' ){ BLOB_APPEND_LITERAL(ob, "<"); }else if( data[i]=='>' ){ BLOB_APPEND_LITERAL(ob, ">"); }else if( data[i]=='&' ){ BLOB_APPEND_LITERAL(ob, "&"); }else{ break; } i++; } } } /* HTML block tags */ /* Size of the prolog: "<div class='markdown'>\n" */ #define PROLOG_SIZE 23 |
︙ | ︙ | |||
281 282 283 284 285 286 287 | struct Blob *link, enum mkd_autolink type, void *opaque ){ if( !link || blob_size(link)<=0 ) return 0; BLOB_APPEND_LITERAL(ob, "<a href=\""); if( type==MKDA_IMPLICIT_EMAIL ) BLOB_APPEND_LITERAL(ob, "mailto:"); | | > > > > > > > > > | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | 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 | struct Blob *link, enum mkd_autolink type, void *opaque ){ if( !link || blob_size(link)<=0 ) return 0; BLOB_APPEND_LITERAL(ob, "<a href=\""); if( type==MKDA_IMPLICIT_EMAIL ) BLOB_APPEND_LITERAL(ob, "mailto:"); html_quote(ob, blob_buffer(link), blob_size(link)); BLOB_APPEND_LITERAL(ob, "\">"); if( type==MKDA_EXPLICIT_EMAIL && blob_size(link)>7 ){ /* remove "mailto:" from displayed text */ html_escape(ob, blob_buffer(link)+7, blob_size(link)-7); }else{ html_escape(ob, blob_buffer(link), blob_size(link)); } BLOB_APPEND_LITERAL(ob, "</a>"); return 1; } /* Invoked for `...` blocks where there are nSep grave accents in a ** row that serve as the delimiter. According to CommonMark: ** ** * https://spec.commonmark.org/0.29/#fenced-code-blocks ** * https://spec.commonmark.org/0.29/#code-spans ** ** If nSep is 1 or 2, then this is a code-span which is inline. ** If nSep is 3 or more, then this is a fenced code block */ static int html_code_span( struct Blob *ob, /* Write the output here */ struct Blob *text, /* The stuff in between the code span marks */ int nSep, /* Number of grave accents marks as delimiters */ void *opaque ){ if( text==0 ){ /* no-op */ }else if( nSep<=2 ){ /* One or two graves: an in-line code span */ BLOB_APPEND_LITERAL(ob, "<code>"); html_escape(ob, blob_buffer(text), blob_size(text)); BLOB_APPEND_LITERAL(ob, "</code>"); }else{ /* Three or more graves: a fenced code block */ int n = blob_size(text); const char *z = blob_buffer(text); int i; for(i=0; i<n && z[i]!='\n'; i++){} if( i>=n ){ blob_appendf(ob, "<pre><code>%#h</code></pre>", n, z); }else{ int k, j; i++; for(k=0; k<i && fossil_isspace(z[k]); k++){} if( k==i ){ blob_appendf(ob, "<pre><code>%#h</code></pre>", n-i, z+i); }else{ for(j=k+1; j<i && !fossil_isspace(z[j]); j++){} blob_appendf(ob, "<pre><code class='language-%#h'>%#h</code></pre>", j-k, z+k, n-i, z+i); } } } return 1; } static int html_double_emphasis( struct Blob *ob, struct Blob *text, |
︙ | ︙ | |||
334 335 336 337 338 339 340 | struct Blob *ob, struct Blob *link, struct Blob *title, struct Blob *alt, void *opaque ){ BLOB_APPEND_LITERAL(ob, "<img src=\""); | | | | > > | | > > > > > > | < < < | | < | < | > | | 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 | struct Blob *ob, struct Blob *link, struct Blob *title, struct Blob *alt, void *opaque ){ BLOB_APPEND_LITERAL(ob, "<img src=\""); html_quote(ob, blob_buffer(link), blob_size(link)); BLOB_APPEND_LITERAL(ob, "\" alt=\""); html_quote(ob, blob_buffer(alt), blob_size(alt)); if( title && blob_size(title)>0 ){ BLOB_APPEND_LITERAL(ob, "\" title=\""); html_quote(ob, blob_buffer(title), blob_size(title)); } BLOB_APPEND_LITERAL(ob, "\" />"); return 1; } static int html_line_break(struct Blob *ob, void *opaque){ BLOB_APPEND_LITERAL(ob, "<br />\n"); return 1; } static int html_link( struct Blob *ob, struct Blob *link, struct Blob *title, struct Blob *content, void *opaque ){ char *zLink = blob_buffer(link); char *zTitle = title!=0 && blob_size(title)>0 ? blob_str(title) : 0; char zClose[20]; if( zLink==0 || zLink[0]==0 ){ zClose[0] = 0; }else{ static const int flags = WIKI_NOBADLINKS | WIKI_MARKDOWNLINKS ; wiki_resolve_hyperlink(ob, flags, zLink, zClose, sizeof(zClose), 0, zTitle); } if( blob_size(content)==0 ){ if( link ) BLOB_APPEND_BLOB(ob, link); }else{ BLOB_APPEND_BLOB(ob, content); } blob_append(ob, zClose, -1); return 1; } static int html_triple_emphasis( struct Blob *ob, struct Blob *text, char c, |
︙ | ︙ | |||
437 438 439 440 441 442 443 | html_triple_emphasis, /* low level elements */ 0, /* entities are copied verbatim */ html_normal_text, /* misc. parameters */ | < | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | html_triple_emphasis, /* low level elements */ 0, /* entities are copied verbatim */ html_normal_text, /* misc. parameters */ "*_", /* emphasis characters */ 0 /* opaque data */ }; html_renderer.opaque = output_title; if( output_title ) blob_reset(output_title); blob_reset(output_body); markdown(output_body, input_markdown, &html_renderer); } |
Changes to src/merge.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 | } fossil_print("%-*s [%S] by %s on %s\n%*s", indent-1, zLabel, db_column_text(&q, 3), db_column_text(&q, 1), db_column_text(&q, 0), indent, ""); | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | } fossil_print("%-*s [%S] by %s on %s\n%*s", indent-1, zLabel, db_column_text(&q, 3), db_column_text(&q, 1), db_column_text(&q, 0), indent, ""); comment_print(zCom, db_column_text(&q,2), indent, -1, get_comment_format()); fossil_free(zCom); } db_finalize(&q); } /* Pick the most recent leaf that is (1) not equal to vid and (2) |
︙ | ︙ | |||
162 163 164 165 166 167 168 169 170 171 172 173 174 175 | ); } free(zN); free(zV); } free(aChng); } /* ** COMMAND: merge ** ** Usage: %fossil merge ?OPTIONS? ?VERSION? ** ** The argument VERSION is a version that should be merged into the | > > > > > > > > > > | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | ); } free(zN); free(zV); } free(aChng); } /* Make an entry in the vmerge table for the given id, and rid. */ static void vmerge_insert(int id, int rid){ db_multi_exec( "INSERT OR IGNORE INTO vmerge(id,merge,mhash)" "VALUES(%d,%d,(SELECT uuid FROM blob WHERE rid=%d))", id, rid, rid ); } /* ** COMMAND: merge ** ** Usage: %fossil merge ?OPTIONS? ?VERSION? ** ** The argument VERSION is a version that should be merged into the |
︙ | ︙ | |||
183 184 185 186 187 188 189 | ** If the VERSION argument is omitted, then Fossil attempts to find ** a recent fork on the current branch to merge. ** ** Only file content is merged. The result continues to use the ** file and directory names from the current checkout even if those ** names might have been changed in the branch being merged in. ** | | > > > > > > > > > | 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 | ** If the VERSION argument is omitted, then Fossil attempts to find ** a recent fork on the current branch to merge. ** ** Only file content is merged. The result continues to use the ** file and directory names from the current checkout even if those ** names might have been changed in the branch being merged in. ** ** Options: ** ** --backout Do a reverse cherrypick merge against VERSION. ** In other words, back out the changes that were ** added by VERSION. ** ** --baseline BASELINE Use BASELINE as the "pivot" of the merge instead ** of the nearest common ancestor. This allows ** a sequence of changes in a branch to be merged ** without having to merge the entire branch. ** ** --binary GLOBPATTERN Treat files that match GLOBPATTERN as binary ** and do not try to merge parallel changes. This ** option overrides the "binary-glob" setting. ** ** --case-sensitive BOOL Override the case-sensitive setting. If false, ** files whose names differ only in case are taken ** to be the same file. ** ** --cherrypick Do a cherrypick merge VERSION into the current ** checkout. A cherrypick merge pulls in the changes ** of the single check-in VERSION, rather than all ** changes back to the nearest common ancestor. ** ** -f|--force Force the merge even if it would be a no-op. ** ** --force-missing Force the merge even if there is missing content. ** ** --integrate Merged branch will be closed when committing. ** |
︙ | ︙ | |||
309 310 311 312 313 314 315 | " WHERE event.objid=%d AND blob.rid=%d", mid, mid ); if( db_step(&q)==SQLITE_ROW ){ char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"", db_column_text(&q, 0), db_column_text(&q, 1), db_column_text(&q, 3), db_column_text(&q, 2)); | | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | " WHERE event.objid=%d AND blob.rid=%d", mid, mid ); if( db_step(&q)==SQLITE_ROW ){ char *zCom = mprintf("Merging fork [%S] at %s by %s: \"%s\"", db_column_text(&q, 0), db_column_text(&q, 1), db_column_text(&q, 3), db_column_text(&q, 2)); comment_print(zCom, db_column_text(&q,2), 0, -1, get_comment_format()); fossil_free(zCom); } db_finalize(&q); }else{ usage("?OPTIONS? ?VERSION?"); return; } |
︙ | ︙ | |||
592 593 594 595 596 597 598 | const char *zName = db_column_text(&q, 2); int islinkm = db_column_int(&q, 3); /* Copy content from idm over into idv. Overwrite idv. */ fossil_print("UPDATE %s\n", zName); if( !dryRunFlag ){ undo_save(zName); db_multi_exec( | | > > | | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | const char *zName = db_column_text(&q, 2); int islinkm = db_column_int(&q, 3); /* Copy content from idm over into idv. Overwrite idv. */ fossil_print("UPDATE %s\n", zName); if( !dryRunFlag ){ undo_save(zName); db_multi_exec( "UPDATE vfile SET mtime=0, mrid=%d, chnged=%d, islink=%d," " mhash=CASE WHEN rid<>%d" " THEN (SELECT uuid FROM blob WHERE blob.rid=%d) END" " WHERE id=%d", ridm, integrateFlag?4:2, islinkm, ridm, ridm, idv ); vfile_to_disk(0, idv, 0, 0); } } db_finalize(&q); /* |
︙ | ︙ | |||
662 663 664 665 666 667 668 | fossil_print("***** Cannot merge binary file %s\n", zName); nConflict++; } blob_reset(&p); blob_reset(&m); blob_reset(&r); } | < | | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | fossil_print("***** Cannot merge binary file %s\n", zName); nConflict++; } blob_reset(&p); blob_reset(&m); blob_reset(&r); } vmerge_insert(idv, ridm); } db_finalize(&q); /* ** Drop files that are in P and V but not in M */ db_prepare(&q, |
︙ | ︙ | |||
739 740 741 742 743 744 745 | zFullOldPath = db_text(0,"SELECT tmpfn FROM tmprn WHERE fn=%Q", zOldName); if( !zFullOldPath ){ zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); } zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); if( file_size(zFullNewPath, RepoFILE)>=0 ){ Blob tmpPath; | | | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | zFullOldPath = db_text(0,"SELECT tmpfn FROM tmprn WHERE fn=%Q", zOldName); if( !zFullOldPath ){ zFullOldPath = mprintf("%s%s", g.zLocalRoot, zOldName); } zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName); if( file_size(zFullNewPath, RepoFILE)>=0 ){ Blob tmpPath; file_tempname(&tmpPath, "", 0); db_multi_exec("INSERT INTO tmprn(fn,tmpfn) VALUES(%Q,%Q)", zNewName, blob_str(&tmpPath)); if( file_islink(zFullNewPath) ){ symlink_copy(zFullNewPath, blob_str(&tmpPath)); }else{ file_copy(zFullNewPath, blob_str(&tmpPath)); } |
︙ | ︙ | |||
784 785 786 787 788 789 790 | " WHERE idp=0 AND idv=0 AND idm>0" ); while( db_step(&q)==SQLITE_ROW ){ int idm = db_column_int(&q, 0); const char *zName; char *zFullName; db_multi_exec( | | > | > > > | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | " WHERE idp=0 AND idv=0 AND idm>0" ); while( db_step(&q)==SQLITE_ROW ){ int idm = db_column_int(&q, 0); const char *zName; char *zFullName; db_multi_exec( "REPLACE INTO vfile(vid,chnged,deleted,rid,mrid," "isexe,islink,pathname,mhash)" " SELECT %d,%d,0,rid,mrid,isexe,islink,pathname," "CASE WHEN rid<>mrid" " THEN (SELECT uuid FROM blob WHERE blob.rid=vfile.mrid) END " "FROM vfile WHERE id=%d", vid, integrateFlag?5:3, idm ); zName = db_column_text(&q, 1); zFullName = mprintf("%s%s", g.zLocalRoot, zName); if( file_isfile_or_link(zFullName) && !db_exists("SELECT 1 FROM fv WHERE fn=%Q", zName) ){ fossil_print("ADDED %s (overwrites an unmanaged file)\n", zName); |
︙ | ︙ | |||
824 825 826 827 828 829 830 | } /* ** Clean up the mid and pid VFILE entries. Then commit the changes. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( pickFlag ){ | | | | | | 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 | } /* ** Clean up the mid and pid VFILE entries. Then commit the changes. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( pickFlag ){ vmerge_insert(-1, mid); /* For a cherry-pick merge, make the default check-in comment the same ** as the check-in comment on the check-in that is being merged in. */ db_multi_exec( "REPLACE INTO vvar(name,value)" " SELECT 'ci-comment', coalesce(ecomment,comment) FROM event" " WHERE type='ci' AND objid=%d", mid ); }else if( backoutFlag ){ vmerge_insert(-2, pid); }else if( integrateFlag ){ vmerge_insert(-4, mid); }else{ vmerge_insert(0, mid); } if( !dryRunFlag ) undo_finish(); db_end_transaction(dryRunFlag); } |
Changes to src/miniz.c.
︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | *pDest_len = stream.total_out; return mz_inflateEnd(&stream); } const char *mz_error(int err) { | | | 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 | *pDest_len = stream.total_out; return mz_inflateEnd(&stream); } const char *mz_error(int err) { static const struct { int m_err; const char *m_pDesc; } s_error_descs[] = { { MZ_OK, "" }, { MZ_STREAM_END, "stream end" }, { MZ_NEED_DICT, "need dictionary" }, { MZ_ERRNO, "file error" }, { MZ_STREAM_ERROR, "stream error" }, { MZ_DATA_ERROR, "data error" }, { MZ_MEM_ERROR, "out of memory" }, { MZ_BUF_ERROR, "buf error" }, { MZ_VERSION_ERROR, "version error" }, { MZ_PARAM_ERROR, "parameter error" } }; mz_uint i; for (i = 0; i < sizeof(s_error_descs) / sizeof(s_error_descs[0]); ++i) if (s_error_descs[i].m_err == err) return s_error_descs[i].m_pDesc; return NULL; } |
︙ | ︙ |
Changes to src/mkbuiltin.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | ** arrays in the resulting executable. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> | < | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ** arrays in the resulting executable. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> /* ** Read the entire content of the file named zFilename into memory obtained ** from malloc() and return a pointer to that memory. Write the size of the ** file into *pnByte. */ static unsigned char *read_file(const char *zFilename, int *pnByte){ FILE *in; |
︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | exit(1); } got = fread(z, 1, nByte, in); fclose(in); z[got] = 0; return z; } /* ** There is an instance of the following for each file translated. */ typedef struct Resource Resource; struct Resource { char *zName; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | exit(1); } got = fread(z, 1, nByte, in); fclose(in); z[got] = 0; return z; } /* ** Try to compress a javascript file by removing unnecessary whitespace. ** ** Warning: This compression routine does not necessarily work for any ** arbitrary Javascript source file. But it should work ok for the ** well-behaved source files in this project. */ static void compressJavascript(unsigned char *z, int *pn){ int n = *pn; int i, j, k; for(i=j=0; i<n; i++){ unsigned char c = z[i]; if( c=='/' ){ if( z[i+1]=='*' ){ while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; } for(k=i+3; k<n && (z[k]!='/' || z[k-1]!='*'); k++){} i = k; continue; }else if( z[i+1]=='/' ){ while( j>0 && (z[j-1]==' ' || z[j-1]=='\t') ){ j--; } for(k=i+2; k<n && z[k]!='\n'; k++){} i = k-1; continue; } } if( c=='\n' ){ while( j>0 && isspace(z[j-1]) ) j--; z[j++] = '\n'; while( i+1<n && isspace(z[i+1]) ) i++; continue; } z[j++] = c; } z[j] = 0; *pn = j; } /* ** There is an instance of the following for each file translated. */ typedef struct Resource Resource; struct Resource { char *zName; |
︙ | ︙ | |||
240 241 242 243 244 245 246 247 248 249 250 251 252 253 | ResourceList resList; Resource *aRes; int nRes; unsigned char *pData; int nErr = 0; int nSkip; int nPrefix = 0; if( argc==1 ){ fprintf(stderr, "usage\t:%s " "[--prefix path] [--reslist file] [resource-file1 ...]\n", argv[0] ); return 1; | > | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | ResourceList resList; Resource *aRes; int nRes; unsigned char *pData; int nErr = 0; int nSkip; int nPrefix = 0; int nName; if( argc==1 ){ fprintf(stderr, "usage\t:%s " "[--prefix path] [--reslist file] [resource-file1 ...]\n", argv[0] ); return 1; |
︙ | ︙ | |||
309 310 311 312 313 314 315 316 317 318 319 320 321 322 | /* Skip initial lines beginning with # */ nSkip = 0; while( pData[nSkip]=='#' ){ while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; } if( pData[nSkip]=='\n' ) nSkip++; } aRes[i].nByte = sz - nSkip; aRes[i].idx = i; printf("/* Content of file %s */\n", aRes[i].zName); printf("static const unsigned char bidata%d[%d] = {\n ", i, sz+1-nSkip); for(j=nSkip, n=0; j<=sz; j++){ | > > > > > > > > > > | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | /* Skip initial lines beginning with # */ nSkip = 0; while( pData[nSkip]=='#' ){ while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; } if( pData[nSkip]=='\n' ) nSkip++; } /* Compress javascript source files */ nName = (int)strlen(aRes[i].zName); if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0) || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0) ){ int x = sz-nSkip; compressJavascript(pData+nSkip, &x); sz = x + nSkip; } aRes[i].nByte = sz - nSkip; aRes[i].idx = i; printf("/* Content of file %s */\n", aRes[i].zName); printf("static const unsigned char bidata%d[%d] = {\n ", i, sz+1-nSkip); for(j=nSkip, n=0; j<=sz; j++){ |
︙ | ︙ |
Changes to src/mkindex.c.
︙ | ︙ | |||
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #define CMDFLAG_TEST 0x0004 /* Commands for testing only */ #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */ #define CMDFLAG_COMMAND 0x0010 /* A command */ #define CMDFLAG_SETTING 0x0020 /* A setting */ #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */ #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */ #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ /**************************************************************************/ /* ** Each entry looks like this: */ typedef struct Entry { int eType; /* CMDFLAG_* values */ | > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #define CMDFLAG_TEST 0x0004 /* Commands for testing only */ #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */ #define CMDFLAG_COMMAND 0x0010 /* A command */ #define CMDFLAG_SETTING 0x0020 /* A setting */ #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */ #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */ #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */ #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */ /**************************************************************************/ /* ** Each entry looks like this: */ typedef struct Entry { int eType; /* CMDFLAG_* values */ |
︙ | ︙ | |||
234 235 236 237 238 239 240 241 242 243 244 245 246 247 | aEntry[nUsed].eType |= CMDFLAG_1ST_TIER; }else if( j==8 && strncmp(&zLine[i], "2nd-tier", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_TEST); aEntry[nUsed].eType |= CMDFLAG_2ND_TIER; }else if( j==4 && strncmp(&zLine[i], "test", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_2ND_TIER); aEntry[nUsed].eType |= CMDFLAG_TEST; }else if( j==7 && strncmp(&zLine[i], "boolean", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_BLOCKTEXT); aEntry[nUsed].iWidth = 0; aEntry[nUsed].eType |= CMDFLAG_BOOLEAN; }else if( j==10 && strncmp(&zLine[i], "block-text", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_BOOLEAN); aEntry[nUsed].eType |= CMDFLAG_BLOCKTEXT; | > > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | aEntry[nUsed].eType |= CMDFLAG_1ST_TIER; }else if( j==8 && strncmp(&zLine[i], "2nd-tier", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_TEST); aEntry[nUsed].eType |= CMDFLAG_2ND_TIER; }else if( j==4 && strncmp(&zLine[i], "test", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_1ST_TIER|CMDFLAG_2ND_TIER); aEntry[nUsed].eType |= CMDFLAG_TEST; }else if( j==11 && strncmp(&zLine[i], "raw-content", j)==0 ){ aEntry[nUsed].eType |= CMDFLAG_RAWCONTENT; }else if( j==7 && strncmp(&zLine[i], "boolean", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_BLOCKTEXT); aEntry[nUsed].iWidth = 0; aEntry[nUsed].eType |= CMDFLAG_BOOLEAN; }else if( j==10 && strncmp(&zLine[i], "block-text", j)==0 ){ aEntry[nUsed].eType &= ~(CMDFLAG_BOOLEAN); aEntry[nUsed].eType |= CMDFLAG_BLOCKTEXT; |
︙ | ︙ | |||
508 509 510 511 512 513 514 515 516 517 518 519 520 521 | } fclose(in); nUsed = nFixed; } int main(int argc, char **argv){ int i; for(i=1; i<argc; i++){ zFile = argv[i]; process_file(); } build_table(); return nErr; } | > | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | } fclose(in); nUsed = nFixed; } int main(int argc, char **argv){ int i; memset(aEntry, 0, sizeof(Entry) * N_ENTRY); for(i=1; i<argc; i++){ zFile = argv[i]; process_file(); } build_table(); return nErr; } |
Changes to src/moderate.c.
︙ | ︙ | |||
182 183 184 185 186 187 188 | if( moderation_table_exists() ){ blob_init(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN (SELECT objid FROM modreq)" " ORDER BY event.mtime DESC" ); db_prepare(&q, "%s", blob_sql_text(&sql)); | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | if( moderation_table_exists() ){ blob_init(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND event.objid IN (SELECT objid FROM modreq)" " ORDER BY event.mtime DESC" ); db_prepare(&q, "%s", blob_sql_text(&sql)); www_print_timeline(&q, 0, 0, 0, 0, 0, 0, 0); db_finalize(&q); } style_footer(); } /* ** Disapproves any entries in the modreq table which belong to any ** user whose name is no longer found in the user table. This is only ** intended to be called after user deletion via /setup_uedit. ** ** To figure out whether a name exists it cross-references ** coalesce(event.euser, event.user) with user.login, limiting the ** selection to event entries where objid matches an entry in the ** modreq table. ** ** This is a no-op if called without g.perm.Admin permissions or if ** moderation_table_exists() returns false. */ void moderation_disapprove_for_missing_users(){ Stmt q; if( !g.perm.Admin || !moderation_table_exists() ){ return; } db_begin_transaction(); db_prepare(&q, "SELECT objid FROM event WHERE objid IN " "(SELECT objid FROM modreq) " "AND coalesce(euser,user) NOT IN " "(SELECT login FROM user)" ); while( db_step(&q)==SQLITE_ROW ){ int const objid = db_column_int(&q, 0); moderation_disapprove(objid); } db_finalize(&q); db_end_transaction(0); } |
Changes to src/name.c.
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 | if( !fossil_isdigit(z[5]) ) return 0; if( !fossil_isdigit(z[6]) ) return 0; if( z[7]!='-') return 0; if( !fossil_isdigit(z[8]) ) return 0; if( !fossil_isdigit(z[9]) ) return 0; return 1; } /* ** Return the RID that is the "root" of the branch that contains | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > | > | < < < < | | | | > > > > > | | 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 | if( !fossil_isdigit(z[5]) ) return 0; if( !fossil_isdigit(z[6]) ) return 0; if( z[7]!='-') return 0; if( !fossil_isdigit(z[8]) ) return 0; if( !fossil_isdigit(z[9]) ) return 0; return 1; } /* ** Check to see if the string might be a compact date/time that omits ** the punctuation. Example: "20190327084549" instead of ** "2019-03-27 08:45:49". If the string is of the appropriate form, ** then return an alternative string (in static space) that is the same ** string with punctuation inserted. ** ** If the bVerifyNotAHash flag is true, then a check is made to see if ** the string is a hash prefix and NULL is returned if it is. If the ** bVerifyNotAHash flag is false, then the result is determined by syntax ** of the input string only, without reference to the artifact table. */ char *fossil_expand_datetime(const char *zIn, int bVerifyNotAHash){ static char zEDate[20]; static const char aPunct[] = { 0, 0, '-', '-', ' ', ':', ':' }; int n = (int)strlen(zIn); int i, j; /* Only three forms allowed: ** (1) YYYYMMDD ** (2) YYYYMMDDHHMM ** (3) YYYYMMDDHHMMSS */ if( n!=8 && n!=12 && n!=14 ) return 0; /* Every character must be a digit */ for(i=0; fossil_isdigit(zIn[i]); i++){} if( i!=n ) return 0; /* Expand the date */ for(i=j=0; zIn[i]; i++){ if( i>=4 && (i%2)==0 ){ zEDate[j++] = aPunct[i/2]; } zEDate[j++] = zIn[i]; } zEDate[j] = 0; /* Check for reasonable date values. ** Offset references: ** YYYY-MM-DD HH:MM:SS ** 0123456789 12345678 */ i = atoi(zEDate); if( i<1970 || i>2100 ) return 0; i = atoi(zEDate+5); if( i<1 || i>12 ) return 0; i = atoi(zEDate+8); if( i<1 || i>31 ) return 0; if( n>8 ){ i = atoi(zEDate+11); if( i>24 ) return 0; i = atoi(zEDate+14); if( i>60 ) return 0; if( n==14 && atoi(zEDate+17)>60 ) return 0; } /* The string is not also a hash prefix */ if( bVerifyNotAHash ){ if( db_exists("SELECT 1 FROM blob WHERE uuid GLOB '%q*'",zIn) ) return 0; } /* It looks like this may be a date. Return it with punctuation added. */ return zEDate; } /* ** Return the RID that is the "root" of the branch that contains ** check-in "rid". Details depending on eType: ** ** eType==0 The check-in of the parent branch off of which ** the branch containing RID originally diverged. ** ** eType==1 The first check-in of the branch that contains RID. ** ** eType==2 The youngest ancestor of RID that is on the branch ** from which the branch containing RID diverged. */ int start_of_branch(int rid, int eType){ Stmt q; int rc; int ans = rid; char *zBr = branch_of_rid(rid); db_prepare(&q, "SELECT pid, EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0" " AND value=%Q AND rid=plink.pid)" " FROM plink" " WHERE cid=:cid AND isprim", TAG_BRANCH, zBr ); fossil_free(zBr); do{ db_reset(&q); db_bind_int(&q, ":cid", ans); rc = db_step(&q); if( rc!=SQLITE_ROW ) break; if( eType==1 && db_column_int(&q,1)==0 ) break; ans = db_column_int(&q, 0); }while( db_column_int(&q, 1)==1 && ans>0 ); db_finalize(&q); if( eType==2 && ans>0 ){ zBr = branch_of_rid(ans); ans = compute_youngest_ancestor_in_branch(rid, zBr); fossil_free(zBr); } return ans; } /* ** Convert a symbolic name into a RID. Acceptable forms: ** ** * artifact hash (optionally enclosed in [...]) ** * 4-character or larger prefix of a artifact |
︙ | ︙ | |||
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 | ** Return the RID of the matching artifact. Or return 0 if the name does not ** match any known object. Or return -1 if the name is ambiguous. ** ** The zType parameter specifies the type of artifact: ci, t, w, e, g, f. ** If zType is NULL or "" or "*" then any type of artifact will serve. ** If zType is "br" then find the first check-in of the named branch ** rather than the last. ** zType is "ci" in most use cases since we are usually searching for ** a check-in. ** ** Note that the input zTag for types "t" and "e" is the artifact hash of ** the ticket-change or technote-change artifact, not the randomly generated ** hexadecimal identifier assigned to tickets and events. Those identifiers ** live in a separate namespace. */ int symbolic_name_to_rid(const char *zTag, const char *zType){ int vid; int rid = 0; int nTag; int i; int startOfBranch = 0; const char *zXTag; /* zTag with optional [...] removed */ int nXTag; /* Size of zXTag */ if( zType==0 || zType[0]==0 ){ zType = "*"; }else if( zType[0]=='b' ){ zType = "ci"; startOfBranch = 1; } | > > > | 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 | ** Return the RID of the matching artifact. Or return 0 if the name does not ** match any known object. Or return -1 if the name is ambiguous. ** ** The zType parameter specifies the type of artifact: ci, t, w, e, g, f. ** If zType is NULL or "" or "*" then any type of artifact will serve. ** If zType is "br" then find the first check-in of the named branch ** rather than the last. ** ** zType is "ci" in most use cases since we are usually searching for ** a check-in. ** ** Note that the input zTag for types "t" and "e" is the artifact hash of ** the ticket-change or technote-change artifact, not the randomly generated ** hexadecimal identifier assigned to tickets and events. Those identifiers ** live in a separate namespace. */ int symbolic_name_to_rid(const char *zTag, const char *zType){ int vid; int rid = 0; int nTag; int i; int startOfBranch = 0; const char *zXTag; /* zTag with optional [...] removed */ int nXTag; /* Size of zXTag */ const char *zDate; /* Expanded date-time string */ const char *zTagPrefix = "sym"; if( zType==0 || zType[0]==0 ){ zType = "*"; }else if( zType[0]=='b' ){ zType = "ci"; startOfBranch = 1; } |
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 | " ORDER BY isprim DESC, mtime DESC", vid); } if( rid ) return rid; } /* Date and times */ if( memcmp(zTag, "date:", 5)==0 ){ rid = db_int(0, "SELECT objid FROM event" " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" " ORDER BY mtime DESC LIMIT 1", | > > | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | " ORDER BY isprim DESC, mtime DESC", vid); } if( rid ) return rid; } /* Date and times */ if( memcmp(zTag, "date:", 5)==0 ){ zDate = fossil_expand_datetime(&zTag[5],0); if( zDate==0 ) zDate = &zTag[5]; rid = db_int(0, "SELECT objid FROM event" " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" " ORDER BY mtime DESC LIMIT 1", zDate, zType); return rid; } if( fossil_isdate(zTag) ){ rid = db_int(0, "SELECT objid FROM event" " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" " ORDER BY mtime DESC LIMIT 1", |
︙ | ︙ | |||
198 199 200 201 202 203 204 | " AND event.type GLOB '%q'", &zTag[4], zType ); if( startOfBranch ) rid = start_of_branch(rid,1); return rid; } | | | > > > > > | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | " AND event.type GLOB '%q'", &zTag[4], zType ); if( startOfBranch ) rid = start_of_branch(rid,1); return rid; } /* root:BR -> The origin of the branch named BR */ if( strncmp(zTag, "root:", 5)==0 ){ rid = symbolic_name_to_rid(zTag+5, zType); return start_of_branch(rid, 0); } /* rootx:BR -> Most recent merge-in for the branch name BR */ if( strncmp(zTag, "merge-in:", 9)==0 ){ rid = symbolic_name_to_rid(zTag+9, zType); return start_of_branch(rid, 2); } /* symbolic-name ":" date-time */ nTag = strlen(zTag); for(i=0; i<nTag-10 && zTag[i]!=':'; i++){} if( zTag[i]==':' && fossil_isdate(&zTag[i+1]) ){ char *zDate = mprintf("%s", &zTag[i+1]); |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 | rid = db_column_int(&q, 0); if( db_step(&q)==SQLITE_ROW ) rid = -1; } db_finalize(&q); if( rid ) return rid; } /* Symbolic name */ rid = db_int(0, "SELECT event.objid, max(event.mtime)" " FROM tag, tagxref, event" | > > > | | > > > > > > > > > > > > > | 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 | rid = db_column_int(&q, 0); if( db_step(&q)==SQLITE_ROW ) rid = -1; } db_finalize(&q); if( rid ) return rid; } if( zType[0]=='w' ){ zTagPrefix = "wiki"; } /* Symbolic name */ rid = db_int(0, "SELECT event.objid, max(event.mtime)" " FROM tag, tagxref, event" " WHERE tag.tagname='%q-%q' " " AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 " " AND event.objid=tagxref.rid " " AND event.type GLOB '%q'", zTagPrefix, zTag, zType ); if( rid>0 ){ if( startOfBranch ) rid = start_of_branch(rid,1); return rid; } /* Pure numeric date/time */ zDate = fossil_expand_datetime(zTag, 0); if( zDate ){ rid = db_int(0, "SELECT objid FROM event" " WHERE mtime<=julianday(%Q,fromLocal()) AND type GLOB '%q'" " ORDER BY mtime DESC LIMIT 1", zDate, zType); if( rid) return rid; } /* Undocumented: numeric tags get translated directly into the RID */ if( memcmp(zTag, "rid:", 4)==0 ){ zTag += 4; for(i=0; fossil_isdigit(zTag[i]); i++){} if( zTag[i]==0 ){ if( strcmp(zType,"*")==0 ){ |
︙ | ︙ | |||
381 382 383 384 385 386 387 | } return c; } /* ** COMMAND: test-name-to-id ** | > > | > > > > > > > > | | | | | | | | | > | 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 | } return c; } /* ** COMMAND: test-name-to-id ** ** Usage: %fossil test-name-to-id [--count N] NAME ** ** Convert a NAME to a full artifact ID. Repeat the conversion N ** times (for timing purposes) if the --count option is given. */ void test_name_to_id(void){ int i; int n = 0; Blob name; db_must_be_within_tree(); for(i=2; i<g.argc; i++){ if( strcmp(g.argv[i],"--count")==0 && i+1<g.argc ){ i++; n = atoi(g.argv[i]); continue; } do{ blob_init(&name, g.argv[i], -1); fossil_print("%s -> ", g.argv[i]); if( name_to_uuid(&name, 1, "*") ){ fossil_print("ERROR: %s\n", g.zErrMsg); fossil_error_reset(); }else{ fossil_print("%s\n", blob_buffer(&name)); } blob_reset(&name); }while( n-- > 0 ); } } /* ** Convert a name to a rid. If the name can be any of the various forms ** accepted: ** |
︙ | ︙ | |||
610 611 612 613 614 615 616 | case 't': zType = "Ticket-change"; break; case 'g': zType = "Tag-change"; break; default: zType = "Unknown"; break; } fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), db_column_text(&q, 1)); fossil_print("comment: "); | | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | case 't': zType = "Ticket-change"; break; case 'g': zType = "Tag-change"; break; default: zType = "Unknown"; break; } fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), db_column_text(&q, 1)); fossil_print("comment: "); comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format()); } db_finalize(&q); /* Check to see if this object is used as a file in a check-in */ db_prepare(&q, "SELECT filename.name, blob.uuid, datetime(event.mtime,toLocal())," " coalesce(euser,user), coalesce(ecomment,comment)" |
︙ | ︙ | |||
632 633 634 635 636 637 638 | while( db_step(&q)==SQLITE_ROW ){ fossil_print("file: %s\n", db_column_text(&q,0)); fossil_print(" part of [%S] by %s on %s\n", db_column_text(&q, 1), db_column_text(&q, 3), db_column_text(&q, 2)); fossil_print(" "); | | | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | while( db_step(&q)==SQLITE_ROW ){ fossil_print("file: %s\n", db_column_text(&q,0)); fossil_print(" part of [%S] by %s on %s\n", db_column_text(&q, 1), db_column_text(&q, 3), db_column_text(&q, 2)); fossil_print(" "); comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format()); } db_finalize(&q); /* Check to see if this object is used as an attachment */ db_prepare(&q, "SELECT attachment.filename," " attachment.comment," |
︙ | ︙ | |||
667 668 669 670 671 672 673 | }else{ fossil_print(" via %s\n", db_column_text(&q,7)); } fossil_print(" by user %s on %s\n", db_column_text(&q,2), db_column_text(&q,3)); fossil_print(" "); | | | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | }else{ fossil_print(" via %s\n", db_column_text(&q,7)); } fossil_print(" by user %s on %s\n", db_column_text(&q,2), db_column_text(&q,3)); fossil_print(" "); comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format()); } db_finalize(&q); } /* ** COMMAND: whatis* ** |
︙ | ︙ |
Changes to src/path.c.
︙ | ︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 | PathNode *path_midpoint(void){ PathNode *p; int i; if( path.nStep<2 ) return 0; for(p=path.pEnd, i=0; p && i<path.nStep/2; p=p->pFrom, i++){} return p; } /* ** Compute the shortest path between two check-ins and then transfer ** that path into the "ancestor" table. This is a utility used by ** both /annotate and /finfo. See also: compute_direct_ancestors(). */ void path_shortest_stored_in_ancestor_table( | > > > > > > > > > > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | PathNode *path_midpoint(void){ PathNode *p; int i; if( path.nStep<2 ) return 0; for(p=path.pEnd, i=0; p && i<path.nStep/2; p=p->pFrom, i++){} return p; } /* ** Return an estimate of the number of comparisons remaining in order ** to bisect path. This is based on the log2() of path.nStep. */ int path_search_depth(void){ int i, j; for(i=0, j=1; j<path.nStep; i++, j+=j){} return i; } /* ** Compute the shortest path between two check-ins and then transfer ** that path into the "ancestor" table. This is a utility used by ** both /annotate and /finfo. See also: compute_direct_ancestors(). */ void path_shortest_stored_in_ancestor_table( |
︙ | ︙ |
Changes to src/popen.c.
︙ | ︙ | |||
119 120 121 122 123 124 125 | ** *ppIn is stdout from the child process. (The caller ** reads from *ppIn in order to receive input from the child.) ** Note that *ppIn is an unbuffered file descriptor, not a FILE. ** The process ID of the child is written into *pChildPid. ** ** Return the number of errors. */ | | > > > > > > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | ** *ppIn is stdout from the child process. (The caller ** reads from *ppIn in order to receive input from the child.) ** Note that *ppIn is an unbuffered file descriptor, not a FILE. ** The process ID of the child is written into *pChildPid. ** ** Return the number of errors. */ int popen2( const char *zCmd, /* Command to run in the child process */ int *pfdIn, /* Read from child using this file descriptor */ FILE **ppOut, /* Write to child using this file descriptor */ int *pChildPid, /* PID of the child process */ int bDirect /* 0: run zCmd as a shell cmd. 1: run directly */ ){ #ifdef _WIN32 HANDLE hStdinRd, hStdinWr, hStdoutRd, hStdoutWr, hStderr; SECURITY_ATTRIBUTES saAttr; DWORD childPid = 0; int fd; saAttr.nLength = sizeof(saAttr); |
︙ | ︙ | |||
187 188 189 190 191 192 193 | close(pout[0]); close(pout[1]); close(1); fd = dup(pin[1]); if( fd!=1 ) nErr++; close(pin[0]); close(pin[1]); | > > > | > | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | close(pout[0]); close(pout[1]); close(1); fd = dup(pin[1]); if( fd!=1 ) nErr++; close(pin[0]); close(pin[1]); if( bDirect ){ execl(zCmd, zCmd, (char*)0); }else{ execl("/bin/sh", "/bin/sh", "-c", zCmd, (char*)0); } return 1; }else{ /* This is the parent process */ close(pin[1]); *pfdIn = pin[0]; close(pout[0]); *ppOut = fdopen(pout[1], "w"); |
︙ | ︙ |
Changes to src/printf.c.
︙ | ︙ | |||
46 47 48 49 50 51 52 | #endif /* ** Return the number of artifact hash digits to display. The number is for ** human output if the bForUrl is false and is destined for a URL if ** bForUrl is false. */ | | | | 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 | #endif /* ** Return the number of artifact hash digits to display. The number is for ** human output if the bForUrl is false and is destined for a URL if ** bForUrl is false. */ int hash_digits(int bForUrl){ static int nDigitHuman = 0; static int nDigitUrl = 0; if( nDigitHuman==0 ){ nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS); if( nDigitHuman < 6 ) nDigitHuman = 6; if( nDigitHuman > 40 ) nDigitHuman = 40; nDigitUrl = nDigitHuman + 6; if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL; if( nDigitUrl > 40 ) nDigitUrl = 40; } return bForUrl ? nDigitUrl : nDigitHuman; } /* ** Return the number of characters in a %S output. */ int length_of_S_display(void){ return hash_digits(0); } /* ** Conversion types fall into various categories as defined by the ** following enumeration. */ #define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */ |
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #define etHTTPIZE 18 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 19 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 20 /* The fossil header encoding format. */ #define etPATH 21 /* Path type */ #define etWIKISTR 22 /* Timeline comment text rendered from a char*: %W */ #define etSTRINGID 23 /* String with length limit for a UUID prefix: %S */ #define etROOT 24 /* String value of g.zTop: %R */ /* ** An "etByte" is an 8-bit unsigned value. */ typedef unsigned char etByte; | > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #define etHTTPIZE 18 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 19 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 20 /* The fossil header encoding format. */ #define etPATH 21 /* Path type */ #define etWIKISTR 22 /* Timeline comment text rendered from a char*: %W */ #define etSTRINGID 23 /* String with length limit for a UUID prefix: %S */ #define etROOT 24 /* String value of g.zTop: %R */ #define etJSONSTR 25 /* String encoded as a JSON string literal: %j */ /* ** An "etByte" is an 8-bit unsigned value. */ typedef unsigned char etByte; |
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | { 'h', 0, 4, etHTMLIZE, 0, 0 }, { 'R', 0, 0, etROOT, 0, 0 }, { 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */ { 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */ { 'w', 0, 4, etSQLESCAPE3, 0, 0 }, { 'F', 0, 4, etFOSSILIZE, 0, 0 }, { 'S', 0, 4, etSTRINGID, 0, 0 }, { 'c', 0, 0, etCHARX, 0, 0 }, { 'o', 8, 0, etRADIX, 0, 2 }, { 'u', 10, 0, etRADIX, 0, 0 }, { 'x', 16, 0, etRADIX, 16, 1 }, { 'X', 16, 0, etRADIX, 0, 4 }, { 'f', 0, 1, etFLOAT, 0, 0 }, { 'e', 0, 1, etEXP, 30, 0 }, | > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | { 'h', 0, 4, etHTMLIZE, 0, 0 }, { 'R', 0, 0, etROOT, 0, 0 }, { 't', 0, 4, etHTTPIZE, 0, 0 }, /* "/" -> "%2F" */ { 'T', 0, 4, etURLIZE, 0, 0 }, /* "/" unchanged */ { 'w', 0, 4, etSQLESCAPE3, 0, 0 }, { 'F', 0, 4, etFOSSILIZE, 0, 0 }, { 'S', 0, 4, etSTRINGID, 0, 0 }, { 'j', 0, 0, etJSONSTR, 0, 0 }, { 'c', 0, 0, etCHARX, 0, 0 }, { 'o', 8, 0, etRADIX, 0, 2 }, { 'u', 10, 0, etRADIX, 0, 0 }, { 'x', 16, 0, etRADIX, 16, 1 }, { 'X', 16, 0, etRADIX, 0, 4 }, { 'f', 0, 1, etFLOAT, 0, 0 }, { 'e', 0, 1, etEXP, 30, 0 }, |
︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 236 237 238 239 | if( altForm2 || db_get_boolean("timeline-block-markup", 0) ){ wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS; }else{ wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS; } if( db_get_boolean("timeline-plaintext", 0) ){ wikiFlags |= WIKI_LINKSONLY; } } return wikiFlags; } | > > > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | if( altForm2 || db_get_boolean("timeline-block-markup", 0) ){ wikiFlags = WIKI_INLINE | WIKI_NOBADLINKS; }else{ wikiFlags = WIKI_INLINE | WIKI_NOBLOCK | WIKI_NOBADLINKS; } if( db_get_boolean("timeline-plaintext", 0) ){ wikiFlags |= WIKI_LINKSONLY; } if( db_get_boolean("timeline-hard-newlines", 0) ){ wikiFlags |= WIKI_NEWLINE; } } return wikiFlags; } |
︙ | ︙ | |||
672 673 674 675 676 677 678 | int limit = flag_alternateform ? va_arg(ap,int) : -1; bufpt = va_arg(ap,char*); if( bufpt==0 ){ bufpt = ""; }else if( xtype==etDYNSTRING ){ zExtra = bufpt; }else if( xtype==etSTRINGID ){ | | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | int limit = flag_alternateform ? va_arg(ap,int) : -1; bufpt = va_arg(ap,char*); if( bufpt==0 ){ bufpt = ""; }else if( xtype==etDYNSTRING ){ zExtra = bufpt; }else if( xtype==etSTRINGID ){ precision = hash_digits(flag_altform2); } length = StrNLen32(bufpt, limit); if( precision>=0 && precision<length ) length = precision; break; } case etBLOB: { int limit = flag_alternateform ? va_arg(ap, int) : -1; |
︙ | ︙ | |||
774 775 776 777 778 779 780 781 782 783 784 785 786 787 | break; } case etFOSSILIZE: { int limit = flag_alternateform ? va_arg(ap,int) : -1; char *zMem = va_arg(ap,char*); if( zMem==0 ) zMem = ""; zExtra = bufpt = fossilize(zMem, limit); length = strlen(bufpt); if( precision>=0 && precision<length ) length = precision; break; } case etWIKISTR: { int limit = flag_alternateform ? va_arg(ap,int) : -1; char *zWiki = va_arg(ap, char*); | > > > > > > > > > > > > > > | 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 | break; } case etFOSSILIZE: { int limit = flag_alternateform ? va_arg(ap,int) : -1; char *zMem = va_arg(ap,char*); if( zMem==0 ) zMem = ""; zExtra = bufpt = fossilize(zMem, limit); length = strlen(bufpt); if( precision>=0 && precision<length ) length = precision; break; } case etJSONSTR: { int limit = flag_alternateform ? va_arg(ap,int) : -1; char *zMem = va_arg(ap,char*); if( limit!=0 ){ /* Ignore the limit flag, if set, for JSON string ** output. This block exists to squelch the associated ** "unused variable" compiler warning. */ } if( zMem==0 ) zMem = ""; zExtra = bufpt = encode_json_string_literal(zMem); length = strlen(bufpt); if( precision>=0 && precision<length ) length = precision; break; } case etWIKISTR: { int limit = flag_alternateform ? va_arg(ap,int) : -1; char *zWiki = va_arg(ap, char*); |
︙ | ︙ | |||
960 961 962 963 964 965 966 967 968 969 970 971 972 973 | Blob b = empty_blob; vxprintf(&b, zFormat, ap); fossil_puts(blob_str(&b), 0); blob_reset(&b); } va_end(ap); } /* ** Print a trace message on standard error. */ void fossil_trace(const char *zFormat, ...){ va_list ap; Blob b; | > > > > > > > > > > | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | Blob b = empty_blob; vxprintf(&b, zFormat, ap); fossil_puts(blob_str(&b), 0); blob_reset(&b); } va_end(ap); } void fossil_vprint(const char *zFormat, va_list ap){ if( g.cgiOutput ){ cgi_vprintf(zFormat, ap); }else{ Blob b = empty_blob; vxprintf(&b, zFormat, ap); fossil_puts(blob_str(&b), 0); blob_reset(&b); } } /* ** Print a trace message on standard error. */ void fossil_trace(const char *zFormat, ...){ va_list ap; Blob b; |
︙ | ︙ | |||
1000 1001 1002 1003 1004 1005 1006 | }else{ out = fossil_fopen(g.zErrlog, "a"); if( out==0 ) return; } now = time(0); pNow = gmtime(&now); fprintf(out, "------------- %04d-%02d-%02d %02d:%02d:%02d UTC ------------\n", | | | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | }else{ out = fossil_fopen(g.zErrlog, "a"); if( out==0 ) return; } now = time(0); pNow = gmtime(&now); fprintf(out, "------------- %04d-%02d-%02d %02d:%02d:%02d UTC ------------\n", pNow->tm_year+1900, pNow->tm_mon+1, pNow->tm_mday, pNow->tm_hour, pNow->tm_min, pNow->tm_sec); va_start(ap, zFormat); vfprintf(out, zFormat, ap); fprintf(out, "\n"); va_end(ap); for(i=0; i<count(azEnv); i++){ char *p; |
︙ | ︙ |
Changes to src/rebuild.c.
︙ | ︙ | |||
174 175 176 177 178 179 180 | ); } /* ** Variables used to store state information about an on-going "rebuild" ** or "deconstruct". */ | | | | | > > > > > > > > > > | 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 | ); } /* ** Variables used to store state information about an on-going "rebuild" ** or "deconstruct". */ static int totalSize; /* Total number of artifacts to process */ static int processCnt; /* Number processed so far */ static int ttyOutput; /* Do progress output */ static Bag bagDone = Bag_INIT; /* Bag of records rebuilt */ static char *zFNameFormat; /* Format string for filenames on deconstruct */ static int cchFNamePrefix; /* Length of directory prefix in zFNameFormat */ static const char *zDestDir;/* Destination directory on deconstruct */ static int prefixLength; /* Length of directory prefix for deconstruct */ static int fKeepRid1; /* Flag to preserve RID=1 on de- and reconstruct */ /* ** Draw the percent-complete message. ** The input is actually the permill complete. */ static void percent_complete(int permill){ static int lastOutput = -1; if( permill>lastOutput ){ fossil_print(" %d.%d%% complete...\r", permill/10, permill%10); fflush(stdout); lastOutput = permill; } } /* ** Frees rebuild-level cached state. Intended only to be called by the ** app-level atexit() handler. */ void rebuild_clear_cache(){ bag_clear(&bagDone); } /* ** Called after each artifact is processed */ static void rebuild_step_done(int rid){ /* assert( bag_find(&bagDone, rid)==0 ); */ bag_insert(&bagDone, rid); |
︙ | ︙ | |||
272 273 274 275 276 277 278 279 280 281 282 283 284 285 | manifest_crosslink(rid, pUse, MC_NONE); }else{ /* We are doing "fossil deconstruct" */ char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); char *zFile = mprintf(zFNameFormat /*works-like:"%s:%s"*/, zUuid, zUuid+prefixLength); blob_write_to_file(pUse,zFile); free(zFile); free(zUuid); blob_reset(pUse); } assert( blob_is_reset(pUse) ); rebuild_step_done(rid); | > > > > > > > > > > > | 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 | manifest_crosslink(rid, pUse, MC_NONE); }else{ /* We are doing "fossil deconstruct" */ char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); char *zFile = mprintf(zFNameFormat /*works-like:"%s:%s"*/, zUuid, zUuid+prefixLength); blob_write_to_file(pUse,zFile); if( rid==1 && fKeepRid1!=0 ){ char *zFnDotRid1 = mprintf("%s/.rid1", zDestDir); char *zFnRid1 = zFile + cchFNamePrefix + 1; /* Skip directory slash */ Blob bFileContents = empty_blob; blob_appendf(&bFileContents, "# The file holding the artifact with RID=1\n" "%s\n", zFnRid1); blob_write_to_file(&bFileContents, zFnDotRid1); blob_reset(&bFileContents); free(zFnDotRid1); } free(zFile); free(zUuid); blob_reset(pUse); } assert( blob_is_reset(pUse) ); rebuild_step_done(rid); |
︙ | ︙ | |||
350 351 352 353 354 355 356 | */ int rebuild_db(int randomize, int doOut, int doClustering){ Stmt s, q; int errCnt = 0; int incrSize; Blob sql; | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | */ int rebuild_db(int randomize, int doOut, int doClustering){ Stmt s, q; int errCnt = 0; int incrSize; Blob sql; bag_clear(&bagDone); ttyOutput = doOut; processCnt = 0; if (ttyOutput && !g.fQuiet) { percent_complete(0); } alert_triggers_disable(); rebuild_update_schema(); |
︙ | ︙ | |||
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | void recon_read_dir(char *zPath){ DIR *d; struct dirent *pEntry; Blob aContent; /* content of the just read artifact */ static int nFileRead = 0; void *zUnicodePath; char *zUtf8Name; zUnicodePath = fossil_utf8_to_path(zPath, 1); d = opendir(zUnicodePath); if( d ){ while( (pEntry=readdir(d))!=0 ){ Blob path; char *zSubpath; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | void recon_read_dir(char *zPath){ DIR *d; struct dirent *pEntry; Blob aContent; /* content of the just read artifact */ static int nFileRead = 0; void *zUnicodePath; char *zUtf8Name; static int recursionLevel = 0; /* Bookkeeping about the recursion level */ static char *zFnRid1 = 0; /* The file holding the artifact with RID=1 */ static int cchPathInitial = 0; /* The length of zPath on first recursion */ recursionLevel++; if( recursionLevel==1 ){ cchPathInitial = strlen(zPath); if( fKeepRid1!=0 ){ char *zFnDotRid1 = mprintf("%s/.rid1", zPath); Blob bFileContents; if( blob_read_from_file(&bFileContents, zFnDotRid1, ExtFILE)!=-1 ){ Blob line, value; while( blob_line(&bFileContents, &line)>0 ){ if( blob_token(&line, &value)==0 ) continue; /* Empty line */ if( blob_buffer(&value)[0]=='#' ) continue; /* Comment */ blob_trim(&value); zFnRid1 = mprintf("%s/%s", zPath, blob_str(&value)); break; } blob_reset(&bFileContents); if( zFnRid1 ){ if( blob_read_from_file(&aContent, zFnRid1, ExtFILE)==-1 ){ fossil_fatal("some unknown error occurred while reading \"%s\"", zFnRid1); }else{ recon_set_hash_policy(0, zFnRid1); content_put(&aContent); recon_restore_hash_policy(); blob_reset(&aContent); fossil_print("\r%d", ++nFileRead); fflush(stdout); } }else{ fossil_fatal("an error occurred while reading or parsing \"%s\"", zFnDotRid1); } } free(zFnDotRid1); } } zUnicodePath = fossil_utf8_to_path(zPath, 1); d = opendir(zUnicodePath); if( d ){ while( (pEntry=readdir(d))!=0 ){ Blob path; char *zSubpath; |
︙ | ︙ | |||
951 952 953 954 955 956 957 | if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) ? (file_isdir(zSubpath, ExtFILE)==1) : (pEntry->d_type==DT_DIR) ) #else if( file_isdir(zSubpath, ExtFILE)==1 ) #endif { recon_read_dir(zSubpath); | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | 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 | if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) ? (file_isdir(zSubpath, ExtFILE)==1) : (pEntry->d_type==DT_DIR) ) #else if( file_isdir(zSubpath, ExtFILE)==1 ) #endif { recon_read_dir(zSubpath); }else if( fossil_strcmp(zSubpath, zFnRid1)!=0 ){ blob_init(&path, 0, 0); blob_appendf(&path, "%s", zSubpath); if( blob_read_from_file(&aContent, blob_str(&path), ExtFILE)==-1 ){ fossil_fatal("some unknown error occurred while reading \"%s\"", blob_str(&path)); } recon_set_hash_policy(cchPathInitial, blob_str(&path)); content_put(&aContent); recon_restore_hash_policy(); blob_reset(&path); blob_reset(&aContent); fossil_print("\r%d", ++nFileRead); fflush(stdout); } free(zSubpath); } closedir(d); }else { fossil_fatal("encountered error %d while trying to open \"%s\".", errno, g.argv[3]); } fossil_path_free(zUnicodePath); if( recursionLevel==1 && zFnRid1!=0 ) free(zFnRid1); recursionLevel--; } /* ** Helper functions called from recon_read_dir() to set and restore the correct ** hash policy for an artifact read from disk, inferred from the length of the ** path name. */ static int saved_eHashPolicy = -1; void recon_set_hash_policy( const int cchPathPrefix, /* Directory prefix length for zUuidAsFilePath */ const char *zUuidAsFilePath /* Relative, well-formed, from recon_read_dir() */ ){ int cchUuidAsFilePath; const char *zHashPart; int cchHashPart = 0; int new_eHashPolicy = -1; assert( HNAME_COUNT==2 ); /* Review function if new hashes are implemented. */ if( zUuidAsFilePath==0 ) return; cchUuidAsFilePath = strlen(zUuidAsFilePath); if( cchUuidAsFilePath==0 ) return; if( cchPathPrefix>=cchUuidAsFilePath ) return; for( zHashPart = zUuidAsFilePath + cchPathPrefix; *zHashPart; zHashPart++ ){ if( *zHashPart!='/' ) cchHashPart++; } if( cchHashPart>=HNAME_LEN_K256 ){ new_eHashPolicy = HPOLICY_SHA3; }else if( cchHashPart>=HNAME_LEN_SHA1 ){ new_eHashPolicy = HPOLICY_SHA1; } if( new_eHashPolicy!=-1 ){ saved_eHashPolicy = g.eHashPolicy; g.eHashPolicy = new_eHashPolicy; } } void recon_restore_hash_policy(){ if( saved_eHashPolicy!=-1 ){ g.eHashPolicy = saved_eHashPolicy; saved_eHashPolicy = -1; } } #if 0 /* ** COMMAND: test-hash-from-path* ** ** Usage: %fossil test-hash-from-path ?OPTIONS? DESTINATION UUID ** ** Generate a sample path name from DESTINATION and UUID, as the `deconstruct' ** command would do. Then try to guess the hash policy from the path name, as ** the `reconstruct' command would do. ** ** No files or directories will be created. ** ** Options: ** -L|--prefixlength N Set the length of the names of the DESTINATION ** subdirectories to N. */ void test_hash_from_path_cmd(void) { char *zDest; char *zUuid; char *zFile; const char *zHashPolicy = "unknown"; const char *zPrefixOpt = find_option("prefixlength","L",1); int iPrefixLength; if( !zPrefixOpt ){ iPrefixLength = 2; }else{ iPrefixLength = atoi(zPrefixOpt); if( iPrefixLength<0 || iPrefixLength>9 ){ fossil_fatal("N(%s) is not a valid prefix length!",zPrefixOpt); } } if( g.argc!=4 ){ usage ("?OPTIONS? DESTINATION UUID"); } zDest = g.argv[2]; zUuid = g.argv[3]; if( iPrefixLength ){ zFNameFormat = mprintf("%s/%%.%ds/%%s",zDest,iPrefixLength); }else{ zFNameFormat = mprintf("%s/%%s",zDest); } cchFNamePrefix = strlen(zDest); zFile = mprintf(zFNameFormat /*works-like:"%s:%s"*/, zUuid, zUuid+iPrefixLength); recon_set_hash_policy(cchFNamePrefix,zFile); if( saved_eHashPolicy!=-1 ){ zHashPolicy = hpolicy_name(); } recon_restore_hash_policy(); fossil_print( "\nPath Name: %s" "\nHash Policy: %s\n", zFile,zHashPolicy); free(zFile); free(zFNameFormat); zFNameFormat = 0; cchFNamePrefix = 0; } #endif /* ** COMMAND: reconstruct* ** ** Usage: %fossil reconstruct ?OPTIONS? FILENAME DIRECTORY ** ** This command studies the artifacts (files) in DIRECTORY and ** reconstructs the fossil record from them. It places the new ** fossil repository in FILENAME. Subdirectories are read, files ** with leading '.' in the filename are ignored. ** ** Options: ** -K|--keep-rid1 Read the filename of the artifact with ** RID=1 from the file .rid in DIRECTORY. ** ** See also: deconstruct, rebuild */ void reconstruct_cmd(void) { char *zPassword; fKeepRid1 = find_option("keep-rid1","K",0)!=0; if( g.argc!=4 ){ usage("FILENAME DIRECTORY"); } if( file_isdir(g.argv[3], ExtFILE)!=1 ){ fossil_print("\"%s\" is not a directory\n\n", g.argv[3]); usage("FILENAME DIRECTORY"); } |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | ** writes all artifacts to the file system. The DESTINATION directory ** will be populated with subdirectories AA and files AA/BBBBBBBBB.., where ** AABBBBBBBBB.. is the 40+ character artifact ID, AA the first 2 characters. ** If -L|--prefixlength is given, the length (default 2) of the directory ** prefix can be set to 0,1,..,9 characters. ** ** Options: | | > > | | < > | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | ** writes all artifacts to the file system. The DESTINATION directory ** will be populated with subdirectories AA and files AA/BBBBBBBBB.., where ** AABBBBBBBBB.. is the 40+ character artifact ID, AA the first 2 characters. ** If -L|--prefixlength is given, the length (default 2) of the directory ** prefix can be set to 0,1,..,9 characters. ** ** Options: ** -R|--repository REPOSITORY Deconstruct given REPOSITORY. ** -K|--keep-rid1 Save the filename of the artifact with RID=1 to ** the file .rid1 in the DESTINATION directory. ** -L|--prefixlength N Set the length of the names of the DESTINATION ** subdirectories to N. ** --private Include private artifacts. ** ** See also: rebuild, reconstruct */ void deconstruct_cmd(void){ const char *zPrefixOpt; Stmt s; int privateFlag; fKeepRid1 = find_option("keep-rid1","K",0)!=0; /* get and check prefix length argument and build format string */ zPrefixOpt=find_option("prefixlength","L",1); if( !zPrefixOpt ){ prefixLength = 2; }else{ if( zPrefixOpt[0]>='0' && zPrefixOpt[0]<='9' && !zPrefixOpt[1] ){ prefixLength = (int)(*zPrefixOpt-'0'); |
︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | */ #endif if( prefixLength ){ zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); }else{ zFNameFormat = mprintf("%s/%%s",zDestDir); } bag_init(&bagDone); ttyOutput = 1; processCnt = 0; if (!g.fQuiet) { fossil_print("0 (0%%)...\r"); fflush(stdout); | > | 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 | */ #endif if( prefixLength ){ zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); }else{ zFNameFormat = mprintf("%s/%%s",zDestDir); } cchFNamePrefix = strlen(zDestDir); bag_init(&bagDone); ttyOutput = 1; processCnt = 0; if (!g.fQuiet) { fossil_print("0 (0%%)...\r"); fflush(stdout); |
︙ | ︙ |
Changes to src/regexp.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file was adapted from the ext/misc/regexp.c file in SQLite3. That ** file is in the public domain. ** ** See ../www/grep.md for details of the algorithm and RE dialect. */ #include "config.h" #include "regexp.h" /* The end-of-input character */ #define RE_EOF 0 /* End of input */ |
︙ | ︙ | |||
120 121 122 123 124 125 126 | }; #endif /* Add a state to the given state set if it is not already there */ static void re_add_state(ReStateSet *pSet, int newState){ unsigned i; for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return; | | | | | 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 | }; #endif /* Add a state to the given state set if it is not already there */ static void re_add_state(ReStateSet *pSet, int newState){ unsigned i; for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return; pSet->aState[pSet->nState++] = (ReStateNumber)newState; } /* Extract the next unicode character from *pzIn and return it. Advance ** *pzIn to the first byte past the end of the character returned. To ** be clear: this routine converts utf8 to unicode. This routine is ** optimized for the common case where the next character is a single byte. */ static unsigned re_next_char(ReInput *p){ unsigned c; if( p->i>=p->mx ) return 0; c = p->z[p->i++]; if( c>=0x80 ){ if( (c&0xe0)==0xc0 && p->i<p->mx && (p->z[p->i]&0xc0)==0x80 ){ c = (c&0x1f)<<6 | (p->z[p->i++]&0x3f); if( c<0x80 ) c = 0xfffd; }else if( (c&0xf0)==0xe0 && p->i+1<p->mx && (p->z[p->i]&0xc0)==0x80 && (p->z[p->i+1]&0xc0)==0x80 ){ c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f); p->i += 2; if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd; }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80 && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){ c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6) | (p->z[p->i+2]&0x3f); p->i += 3; if( c<=0xffff || c>0x10ffff ) c = 0xfffd; }else{ c = 0xfffd; } } return c; } static unsigned re_next_char_nocase(ReInput *p){ unsigned c = re_next_char(p); return unicode_fold(c,2); } /* Return true if c is a perl "word" character: [A-Za-z0-9_] */ static int re_word_char(int c){ return unicode_isalnum(c) || c=='_'; } |
︙ | ︙ | |||
189 190 191 192 193 194 195 | int c = RE_EOF+1; int cPrev = 0; int rc = 0; ReInput in; in.z = zIn; in.i = 0; | | | | 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 | int c = RE_EOF+1; int cPrev = 0; int rc = 0; ReInput in; in.z = zIn; in.i = 0; in.mx = nIn>=0 ? nIn : (int)strlen((char const*)zIn); /* Look for the initial prefix match, if there is one. */ if( pRe->nInit ){ unsigned char x = pRe->zInit[0]; while( in.i+pRe->nInit<=in.mx && (zIn[in.i]!=x || strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0) ){ in.i++; } if( in.i+pRe->nInit>in.mx ) return 0; } if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){ pToFree = 0; aStateSet[0].aState = aSpace; }else{ pToFree = fossil_malloc( sizeof(ReStateNumber)*2*pRe->nState ); if( pToFree==0 ) return -1; aStateSet[0].aState = pToFree; } |
︙ | ︙ | |||
340 341 342 343 344 345 346 | int i; if( p->nAlloc<=p->nState && re_resize(p, p->nAlloc*2) ) return 0; for(i=p->nState; i>iBefore; i--){ p->aOp[i] = p->aOp[i-1]; p->aArg[i] = p->aArg[i-1]; } p->nState++; | | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | int i; if( p->nAlloc<=p->nState && re_resize(p, p->nAlloc*2) ) return 0; for(i=p->nState; i>iBefore; i--){ p->aOp[i] = p->aOp[i-1]; p->aArg[i] = p->aArg[i-1]; } p->nState++; p->aOp[iBefore] = (char)op; p->aArg[iBefore] = arg; return iBefore; } /* Append a new opcode and argument to the end of the RE under construction. */ static int re_append(ReCompiled *p, int op, int arg){ |
︙ | ︙ | |||
629 630 631 632 633 634 635 | if( zIn[0]=='^' ){ zIn++; }else{ re_append(pRe, RE_OP_ANYSTAR, 0); } pRe->sIn.z = (unsigned char*)zIn; pRe->sIn.i = 0; | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | if( zIn[0]=='^' ){ zIn++; }else{ re_append(pRe, RE_OP_ANYSTAR, 0); } pRe->sIn.z = (unsigned char*)zIn; pRe->sIn.i = 0; pRe->sIn.mx = (int)strlen(zIn); zErr = re_subcompile_re(pRe); if( zErr ){ re_free(pRe); return zErr; } if( rePeek(pRe)=='$' && pRe->sIn.i+1>=pRe->sIn.mx ){ re_append(pRe, RE_OP_MATCH, RE_EOF); |
︙ | ︙ | |||
659 660 661 662 663 664 665 | ** regex engine over the string. Do not worry able trying to match ** unicode characters beyond plane 0 - those are very rare and this is ** just an optimization. */ if( pRe->aOp[0]==RE_OP_ANYSTAR ){ for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){ unsigned x = pRe->aArg[i]; if( x<=127 ){ | | | | | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | ** regex engine over the string. Do not worry able trying to match ** unicode characters beyond plane 0 - those are very rare and this is ** just an optimization. */ if( pRe->aOp[0]==RE_OP_ANYSTAR ){ for(j=0, i=1; j<sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){ unsigned x = pRe->aArg[i]; if( x<=127 ){ pRe->zInit[j++] = (unsigned char)x; }else if( x<=0xfff ){ pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6)); pRe->zInit[j++] = 0x80 | (x&0x3f); }else if( x<=0xffff ){ pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12)); pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f); pRe->zInit[j++] = 0x80 | (x&0x3f); }else{ break; } } if( j>0 && pRe->zInit[j-1]==0 ) j--; |
︙ | ︙ | |||
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | int argc, sqlite3_value **argv ){ ReCompiled *pRe; /* Compiled regular expression */ const char *zPattern; /* The regular expression */ const unsigned char *zStr;/* String being searched */ const char *zErr; /* Compile error message */ pRe = sqlite3_get_auxdata(context, 0); if( pRe==0 ){ zPattern = (const char*)sqlite3_value_text(argv[0]); if( zPattern==0 ) return; zErr = re_compile(&pRe, zPattern, 0); if( zErr ){ sqlite3_result_error(context, zErr, -1); return; } if( pRe==0 ){ sqlite3_result_error_nomem(context); return; } | > > | > > > | < < < < < < < | 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 | int argc, sqlite3_value **argv ){ ReCompiled *pRe; /* Compiled regular expression */ const char *zPattern; /* The regular expression */ const unsigned char *zStr;/* String being searched */ const char *zErr; /* Compile error message */ int setAux = 0; /* True to invoke sqlite3_set_auxdata() */ pRe = sqlite3_get_auxdata(context, 0); if( pRe==0 ){ zPattern = (const char*)sqlite3_value_text(argv[0]); if( zPattern==0 ) return; zErr = re_compile(&pRe, zPattern, 0); if( zErr ){ re_free(pRe); sqlite3_result_error(context, zErr, -1); return; } if( pRe==0 ){ sqlite3_result_error_nomem(context); return; } setAux = 1; } zStr = (const unsigned char*)sqlite3_value_text(argv[1]); if( zStr!=0 ){ sqlite3_result_int(context, re_match(pRe, zStr, -1)); } if( setAux ){ sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free); } } /* ** Invoke this routine to register the regexp() function with the ** SQLite database connection. */ int re_add_sql_func(sqlite3 *db){ return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, 0, re_sql_func, 0, 0); } /* |
︙ | ︙ | |||
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | } } /* ** Flags for grep_buffer() */ #define GREP_EXISTS 0x001 /* If any match, print only the name and stop */ /* ** Run a "grep" over a text file */ static int grep_buffer( ReCompiled *pRe, const char *zName, const char *z, u32 flags ){ int i, j, n, ln, cnt; for(i=j=ln=cnt=0; z[i]; i=j+1){ for(j=i; z[j] && z[j]!='\n'; j++){} n = j - i; | > < | > > | > > > | 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 | } } /* ** Flags for grep_buffer() */ #define GREP_EXISTS 0x001 /* If any match, print only the name and stop */ #define GREP_QUIET 0x002 /* Return code only */ /* ** Run a "grep" over a text file */ static int grep_buffer( ReCompiled *pRe, const char *zName, const char *z, u32 flags ){ int i, j, n, ln, cnt; for(i=j=ln=cnt=0; z[i]; i=j+1){ for(j=i; z[j] && z[j]!='\n'; j++){} n = j - i; ln++; if( re_match(pRe, (const unsigned char*)(z+i), j-i) ){ cnt++; if( flags & GREP_EXISTS ){ if( (flags & GREP_QUIET)==0 && zName ) fossil_print("%s\n", zName); break; } if( (flags & GREP_QUIET)==0 ){ if( cnt==1 && zName ){ fossil_print("== %s\n", zName); } fossil_print("%d:%.*s\n", ln, n, z+i); } } } return cnt; } /* ** COMMAND: test-grep |
︙ | ︙ | |||
823 824 825 826 827 828 829 | } re_free(pRe); } /* ** COMMAND: grep ** | | > | > > > > > > > > | | > > > > > | > > > > > > > > > | > > > > > > > > > > > | | > > > > | | | | < | > > > > > > > > > > > > | | > > > | > | | | > | | | < | | > > > > > > > > > | > | > > > > > > > > > > > > > > | > > > > > > | 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 | } re_free(pRe); } /* ** COMMAND: grep ** ** Usage: %fossil grep [OPTIONS] PATTERN FILENAME ... ** ** Attempt to match the given POSIX extended regular expression PATTERN ** historic versions of FILENAME. The search begins with the most recent ** version of the file and moves backwards in time. Multiple FILENAMEs can ** be specified, in which case all named files are searched in reverse ** chronological order. ** ** For details of the supported regular expression dialect, see ** https://fossil-scm.org/fossil/doc/trunk/www/grep.md ** ** Options: ** ** -c|--count Suppress normal output; instead print a count ** of the number of matching files ** -i|--ignore-case Ignore case ** -l|--files-with-matches List only hash for each match ** --once Stop searching after the first match ** -s|--no-messages Suppress error messages about nonexistant ** or unreadable files ** -v|--invert-match Invert the sense of matching. Show only ** files that have no matches. Implies -l ** --verbose Show each file as it is analyzed */ void re_grep_cmd(void){ u32 flags = 0; int bVerbose = 0; ReCompiled *pRe; const char *zErr; int ignoreCase = 0; Blob fullName; int ii; int nMatch = 0; int bNoMsg; int cntFlag; int bOnce; int bInvert; int nSearch = 0; Stmt q; if( find_option("ignore-case","i",0)!=0 ) ignoreCase = 1; if( find_option("files-with-matches","l",0)!=0 ) flags |= GREP_EXISTS; if( find_option("verbose",0,0)!=0 ) bVerbose = 1; if( find_option("quiet","q",0) ) flags |= GREP_QUIET|GREP_EXISTS; bNoMsg = find_option("no-messages","s",0)!=0; bOnce = find_option("once",0,0)!=0; bInvert = find_option("invert-match","v",0)!=0; if( bInvert ){ flags |= GREP_QUIET|GREP_EXISTS; } cntFlag = find_option("count","c",0)!=0; if( cntFlag ){ flags |= GREP_QUIET|GREP_EXISTS; } db_find_and_open_repository(0, 0); verify_all_options(); if( g.argc<4 ){ usage("REGEXP FILENAME ..."); } zErr = re_compile(&pRe, g.argv[2], ignoreCase); if( zErr ) fossil_fatal("%s", zErr); add_content_sql_commands(g.db); db_multi_exec("CREATE TEMP TABLE arglist(iname,fname,fnid);"); for(ii=3; ii<g.argc; ii++){ const char *zTarget = g.argv[ii]; if( file_tree_name(zTarget, &fullName, 0, 1) ){ int fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", blob_str(&fullName)); if( !fnid ){ if( bNoMsg ) continue; if( file_size(zTarget, ExtFILE)<0 ){ fossil_fatal("no such file: %s", zTarget); } fossil_fatal("not a managed file: %s", zTarget); }else{ db_multi_exec( "INSERT INTO arglist(iname,fname,fnid) VALUES(%Q,%Q,%d)", zTarget, blob_str(&fullName), fnid); } } blob_reset(&fullName); } db_prepare(&q, " SELECT" " A.uuid," /* file hash */ " A.rid," /* file rid */ " B.uuid," /* check-in hash */ " datetime(min(event.mtime))," /* check-in time */ " arglist.iname" /* file name */ " FROM arglist, mlink, blob A, blob B, event" " WHERE mlink.mid=event.objid" " AND mlink.fid=A.rid" " AND mlink.mid=B.rid" " AND mlink.fnid=arglist.fnid" " GROUP BY A.uuid" " ORDER BY min(event.mtime) DESC;" ); while( db_step(&q)==SQLITE_ROW ){ const char *zFileHash = db_column_text(&q,0); int rid = db_column_int(&q,1); const char *zCkinHash = db_column_text(&q,2); const char *zDate = db_column_text(&q,3); const char *zFN = db_column_text(&q,4); char *zLabel; Blob cx; content_get(rid, &cx); zLabel = mprintf("%.16s %s %S checkin %S", zDate, zFN,zFileHash,zCkinHash); if( bVerbose ) fossil_print("Scanning: %s\n", zLabel); nSearch++; nMatch += grep_buffer(pRe, zLabel, blob_str(&cx), flags); blob_reset(&cx); if( bInvert && cntFlag==0 ){ if( nMatch==0 ){ fossil_print("== %s\n", zLabel); if( bOnce ) nMatch = 1; }else{ nMatch = 0; } } fossil_free(zLabel); if( nMatch ){ if( (flags & GREP_QUIET)!=0 ) break; if( bOnce ) break; } } db_finalize(&q); re_free(pRe); if( cntFlag ){ if( bInvert ){ fossil_print("%d\n", nSearch-nMatch); }else{ fossil_print("%d\n", nMatch); } } } |
Added src/repolist.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* ** Copyright (c) 2018 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This module contains code to implement the repository list page when ** "fossil server" or "fossil ui" is serving a directory full of repositories. */ #include "config.h" #include "repolist.h" #if INTERFACE /* ** Return value from the remote_repo_info() command. zRepoName is the ** input. All other fields are outputs. */ struct RepoInfo { char *zRepoName; /* Name of the repository file */ int isValid; /* True if zRepoName is a valid Fossil repository */ int isRepolistSkin; /* 1 or 2 if this repository wants to be the skin ** for the repository list. 2 means do use this ** repository but do not display it in the list. */ char *zProjName; /* Project Name. Memory from fossil_malloc() */ double rMTime; /* Last update. Julian day number */ }; #endif /* ** Discover information about the repository given by ** pRepo->zRepoName. The discovered information is stored in other ** fields of the RepoInfo object. */ static void remote_repo_info(RepoInfo *pRepo){ sqlite3 *db; sqlite3_stmt *pStmt; int rc; pRepo->isRepolistSkin = 0; pRepo->isValid = 0; pRepo->zProjName = 0; pRepo->rMTime = 0.0; g.dbIgnoreErrors++; rc = sqlite3_open_v2(pRepo->zRepoName, &db, SQLITE_OPEN_READWRITE, 0); if( rc ) goto finish_repo_list; rc = sqlite3_prepare_v2(db, "SELECT value FROM config" " WHERE name='repolist-skin'", -1, &pStmt, 0); if( rc ) goto finish_repo_list; if( sqlite3_step(pStmt)==SQLITE_ROW ){ pRepo->isRepolistSkin = sqlite3_column_int(pStmt,0); } sqlite3_finalize(pStmt); if( rc ) goto finish_repo_list; rc = sqlite3_prepare_v2(db, "SELECT value FROM config" " WHERE name='project-name'", -1, &pStmt, 0); if( rc ) goto finish_repo_list; if( sqlite3_step(pStmt)==SQLITE_ROW ){ pRepo->zProjName = fossil_strdup((char*)sqlite3_column_text(pStmt,0)); } sqlite3_finalize(pStmt); rc = sqlite3_prepare_v2(db, "SELECT max(mtime) FROM event", -1, &pStmt, 0); if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ pRepo->rMTime = sqlite3_column_double(pStmt,0); } pRepo->isValid = 1; sqlite3_finalize(pStmt); finish_repo_list: g.dbIgnoreErrors--; sqlite3_close(db); } /* ** Generate a web-page that lists all repositories located under the ** g.zRepositoryName directory and return non-zero. ** ** For the special case when g.zRepositoryName is a non-chroot-jail "/", ** compose the list using the "repo:" entries in the global_config ** table of the configuration database. These entries comprise all ** of the repositories known to the "all" command. The special case ** processing is disallowed for chroot jails because g.zRepositoryName ** is always "/" inside a chroot jail and so it cannot be used as a flag ** to signal the special processing in that case. The special case ** processing is intended for the "fossil all ui" command which never ** runs in a chroot jail anyhow. ** ** Or, if no repositories can be located beneath g.zRepositoryName, ** return 0. */ int repo_list_page(void){ Blob base; /* document root for all repositories */ int n = 0; /* Number of repositories found */ int allRepo; /* True if running "fossil ui all". ** False if a directory scan of base for repos */ Blob html; /* Html for the body of the repository list */ char *zSkinRepo = 0; /* Name of the repository database used for skins */ char *zSkinUrl = 0; /* URL for the skin database */ assert( g.db==0 ); blob_init(&html, 0, 0); if( fossil_strcmp(g.zRepositoryName,"/")==0 && !g.fJail ){ /* For the special case of the "repository directory" being "/", ** show all of the repositories named in the ~/.fossil database. ** ** On unix systems, then entries are of the form "repo:/home/..." ** and on Windows systems they are like on unix, starting with a "/" ** or they can begin with a drive letter: "repo:C:/Users/...". In either ** case, we want returned path to omit any initial "/". */ db_open_config(1, 0); db_multi_exec( "CREATE TEMP VIEW sfile AS" " SELECT ltrim(substr(name,6),'/') AS 'pathname' FROM global_config" " WHERE name GLOB 'repo:*'" ); allRepo = 1; }else{ /* The default case: All repositories under the g.zRepositoryName ** directory. */ blob_init(&base, g.zRepositoryName, -1); sqlite3_open(":memory:", &g.db); db_multi_exec("CREATE TABLE sfile(pathname TEXT);"); db_multi_exec("CREATE TABLE vfile(pathname);"); vfile_scan(&base, blob_size(&base), 0, 0, 0, ExtFILE); db_multi_exec("DELETE FROM sfile WHERE pathname NOT GLOB '*[^/].fossil'"); allRepo = 0; } n = db_int(0, "SELECT count(*) FROM sfile"); if( n==0 ){ sqlite3_close(g.db); return 0; }else{ Stmt q; double rNow; blob_append_sql(&html, "<table border='0' class='sortable' data-init-sort='1'" " data-column-types='txtxk'><thead>\n" "<tr><th>Filename<th width='20'>" "<th>Project Name<th width='20'>" "<th>Last Modified</tr>\n" "</thead><tbody>\n"); db_prepare(&q, "SELECT pathname" " FROM sfile ORDER BY pathname COLLATE nocase;"); rNow = db_double(0, "SELECT julianday('now')"); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); int nName = (int)strlen(zName); char *zUrl; char *zAge; char *zFull; RepoInfo x; int iAge; if( nName<7 ) continue; zUrl = sqlite3_mprintf("%.*s", nName-7, zName); if( zName[0]=='/' #ifdef _WIN32 || sqlite3_strglob("[a-zA-Z]:/*", zName)==0 #endif ){ zFull = mprintf("%s", zName); }else if ( allRepo ){ zFull = mprintf("/%s", zName); }else{ zFull = mprintf("%s/%s", g.zRepositoryName, zName); } x.zRepoName = zFull; remote_repo_info(&x); if( x.isRepolistSkin ){ if( zSkinRepo==0 ){ zSkinRepo = mprintf("%s", x.zRepoName); zSkinUrl = mprintf("%s", zUrl); } } fossil_free(zFull); if( !x.isValid ){ continue; } if( x.isRepolistSkin==2 && !allRepo ){ /* Repositories with repolist-skin==2 are omitted from directory ** scan lists, but included in "fossil all ui" lists */ continue; } iAge = (rNow - x.rMTime)*86400; if( iAge<0 ) x.rMTime = rNow; zAge = human_readable_age(rNow - x.rMTime); blob_append_sql(&html, "<tr><td valign='top'>"); if( sqlite3_strglob("*.fossil", zName)!=0 ){ /* The "fossil server DIRECTORY" and "fossil ui DIRECTORY" commands ** do not work for repositories whose names do not end in ".fossil". ** So do not hyperlink those cases. */ blob_append_sql(&html,"%h",zName); } else if( sqlite3_strglob("*/.*", zName)==0 ){ /* Do not show hyperlinks for hidden repos */ blob_append_sql(&html, "%h (hidden)", zName); } else if( allRepo && sqlite3_strglob("[a-zA-Z]:/?*", zName)!=0 ){ blob_append_sql(&html, "<a href='%R/%T/home' target='_blank'>/%h</a>\n", zUrl, zName); }else{ blob_append_sql(&html, "<a href='%R/%T/home' target='_blank'>%h</a>\n", zUrl, zName); } if( x.zProjName ){ blob_append_sql(&html, "<td></td><td>%h</td>\n", x.zProjName); fossil_free(x.zProjName); }else{ blob_append_sql(&html, "<td></td><td></td>\n"); } blob_append_sql(&html, "<td></td><td data-sortkey='%08x'>%h</tr>\n", iAge, zAge); fossil_free(zAge); sqlite3_free(zUrl); } db_finalize(&q); blob_append_sql(&html,"</tbody></table>\n"); } if( zSkinRepo ){ char *zNewBase = mprintf("%s/%s", g.zBaseURL, zSkinUrl); g.zBaseURL = 0; set_base_url(zNewBase); db_open_repository(zSkinRepo); fossil_free(zSkinRepo); fossil_free(zSkinUrl); } if( g.repositoryOpen ){ /* This case runs if remote_repository_info() found a repository ** that has the "repolist_skin" property set to non-zero and left ** that repository open in g.db. Use the skin of that repository ** for display. */ login_check_credentials(); style_header("Repository List"); @ %s(blob_str(&html)) style_table_sorter(); style_footer(); }else{ /* If no repositories were found that had the "repolist_skin" ** property set, then use a default skin */ @ <html> @ <head> @ <base href="%s(g.zBaseURL)/" /> @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> @ <title>Repository List</title> @ </head> @ <body> @ <h1 align="center">Fossil Repositories</h1> @ %s(blob_str(&html)) @ <script>%s(builtin_text("sorttable.js"))</script> @ </body> @ </html> } blob_reset(&html); cgi_reply(); return n; } /* ** COMMAND: test-list-page ** ** Usage: %fossil test-list-page DIRECTORY ** ** Show all repositories underneath DIRECTORY. Or if DIRECTORY is "/" ** show all repositories in the ~/.fossil file. */ void test_list_page(void){ if( g.argc<3 ){ g.zRepositoryName = "/"; }else{ g.zRepositoryName = g.argv[2]; } g.httpOut = stdout; repo_list_page(); } |
Changes to src/report.c.
︙ | ︙ | |||
193 194 195 196 197 198 199 200 201 202 203 204 205 206 | "plink", "event", "tag", "tagxref", "unversioned", }; int i; if( fossil_strncmp(zArg1, "fx_", 3)==0 ){ break; } for(i=0; i<count(azAllowed); i++){ if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break; } if( i>=count(azAllowed) ){ | > > > > > > > | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | "plink", "event", "tag", "tagxref", "unversioned", }; int i; if( zArg1==0 ){ /* Some legacy versions of SQLite will sometimes send spurious ** READ authorizations that have no table name. These can be ** ignored. */ rc = SQLITE_IGNORE; break; } if( fossil_strncmp(zArg1, "fx_", 3)==0 ){ break; } for(i=0; i<count(azAllowed); i++){ if( fossil_stricmp(zArg1, azAllowed[i])==0 ) break; } if( i>=count(azAllowed) ){ |
︙ | ︙ |
Changes to src/schema.c.
1 2 3 4 5 6 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ |
︙ | ︙ | |||
350 351 352 353 354 355 356 | @ -- used to reduce push operations to a single HTTP request in the @ -- common case when one repository only talks to a single server. @ -- @ CREATE TABLE unsent( @ rid INTEGER PRIMARY KEY -- Record ID of the phantom @ ); @ | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | @ -- used to reduce push operations to a single HTTP request in the @ -- common case when one repository only talks to a single server. @ -- @ CREATE TABLE unsent( @ rid INTEGER PRIMARY KEY -- Record ID of the phantom @ ); @ @ -- Each artifact can have one or more tags. A tag @ -- is defined by a row in the next table. @ -- @ -- Wiki pages are tagged with "wiki-NAME" where NAME is the name of @ -- the wiki page. Tickets changes are tagged with "ticket-UUID" where @ -- UUID is the indentifier of the ticket. Tags used to assign symbolic @ -- names to baselines are branches are of the form "sym-NAME" where @ -- NAME is the symbolic name. |
︙ | ︙ | |||
375 376 377 378 379 380 381 | @ INSERT INTO tag VALUES(6, 'private'); -- TAG_PRIVATE @ INSERT INTO tag VALUES(7, 'cluster'); -- TAG_CLUSTER @ INSERT INTO tag VALUES(8, 'branch'); -- TAG_BRANCH @ INSERT INTO tag VALUES(9, 'closed'); -- TAG_CLOSED @ INSERT INTO tag VALUES(10,'parent'); -- TAG_PARENT @ INSERT INTO tag VALUES(11,'note'); -- TAG_NOTE @ | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | @ INSERT INTO tag VALUES(6, 'private'); -- TAG_PRIVATE @ INSERT INTO tag VALUES(7, 'cluster'); -- TAG_CLUSTER @ INSERT INTO tag VALUES(8, 'branch'); -- TAG_BRANCH @ INSERT INTO tag VALUES(9, 'closed'); -- TAG_CLOSED @ INSERT INTO tag VALUES(10,'parent'); -- TAG_PARENT @ INSERT INTO tag VALUES(11,'note'); -- TAG_NOTE @ @ -- Assignments of tags to artifacts. Note that we allow tags to @ -- have values assigned to them. So we are not really dealing with @ -- tags here. These are really properties. But we are going to @ -- keep calling them tags because in many cases the value is ignored. @ -- @ CREATE TABLE tagxref( @ tagid INTEGER REFERENCES tag, -- The tag that added or removed @ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate |
︙ | ︙ | |||
400 401 402 403 404 405 406 | @ -- when a check-in comment refers to a ticket) an entry is made in @ -- the following table for that hyperlink. This table is used to @ -- facilitate the display of "back links". @ -- @ CREATE TABLE backlink( @ target TEXT, -- Where the hyperlink points to @ srctype INT, -- 0: check-in 1: ticket 2: wiki | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | @ -- when a check-in comment refers to a ticket) an entry is made in @ -- the following table for that hyperlink. This table is used to @ -- facilitate the display of "back links". @ -- @ CREATE TABLE backlink( @ target TEXT, -- Where the hyperlink points to @ srctype INT, -- 0: check-in 1: ticket 2: wiki @ srcid INT, -- EVENT.OBJID for the source document @ mtime TIMESTAMP, -- time that the hyperlink was added. Julian day. @ UNIQUE(target, srctype, srcid) @ ); @ CREATE INDEX backlink_src ON backlink(srcid, srctype); @ @ -- Each attachment is an entry in the following table. Only @ -- the most recent attachment (identified by the D card) is saved. |
︙ | ︙ | |||
457 458 459 460 461 462 463 464 465 466 467 468 469 470 | @ -- Add as many fields as required below this line @ login TEXT, @ username TEXT, @ mimetype TEXT, @ icomment TEXT @ ); @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); ; /* ** Predefined tagid values */ #if INTERFACE # define TAG_BGCOLOR 1 /* Set the background color for display */ | > > > > > > > > > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | @ -- Add as many fields as required below this line @ login TEXT, @ username TEXT, @ mimetype TEXT, @ icomment TEXT @ ); @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); @ @ -- For tracking cherrypick merges @ CREATE TABLE cherrypick( @ parentid INT, @ childid INT, @ isExclude BOOLEAN DEFAULT false, @ PRIMARY KEY(parentid, childid) @ ) WITHOUT ROWID; @ CREATE INDEX cherrypick_cid ON cherrypick(childid); ; /* ** Predefined tagid values */ #if INTERFACE # define TAG_BGCOLOR 1 /* Set the background color for display */ |
︙ | ︙ | |||
479 480 481 482 483 484 485 | # define TAG_PARENT 10 /* Change to parentage on a check-in */ # define TAG_NOTE 11 /* Extra text appended to a check-in comment */ #endif /* ** The schema for the local FOSSIL database file found at the root ** of every check-out. This database contains the complete state of | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | # define TAG_PARENT 10 /* Change to parentage on a check-in */ # define TAG_NOTE 11 /* Extra text appended to a check-in comment */ #endif /* ** The schema for the local FOSSIL database file found at the root ** of every check-out. This database contains the complete state of ** the checkout. See also the addendum in zLocalSchemaVmerge[]. */ const char zLocalSchema[] = @ -- The VVAR table holds miscellanous information about the local database @ -- in the form of name-value pairs. This is similar to the VAR table @ -- table in the repository except that this table holds information that @ -- is specific to the local checkout. @ -- |
︙ | ︙ | |||
504 505 506 507 508 509 510 | @ @ -- Each entry in the vfile table represents a single file in the @ -- current checkout. @ -- @ -- The file.rid field is 0 for files or folders that have been @ -- added but not yet committed. @ -- | | | > | | | < < < | > > > > > > > > > > > > | > | > > > | > > > > > | > | 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 | @ @ -- Each entry in the vfile table represents a single file in the @ -- current checkout. @ -- @ -- The file.rid field is 0 for files or folders that have been @ -- added but not yet committed. @ -- @ -- Vfile.chnged meaning: @ -- 0 File is unmodified @ -- 1 Manually edited and/or modified as part of a merge command @ -- 2 Replaced by a merge command @ -- 3 Added by a merge command @ -- 4,5 Same as 2,3 except merge using --integrate @ -- @ CREATE TABLE vfile( @ id INTEGER PRIMARY KEY, -- ID of the checked out file @ vid INTEGER REFERENCES blob, -- The checkin this file is part of. @ chnged INT DEFAULT 0, -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng 5:i-add @ deleted BOOLEAN DEFAULT 0, -- True if deleted @ isexe BOOLEAN, -- True if file should be executable @ islink BOOLEAN, -- True if file should be symlink @ rid INTEGER, -- Originally from this repository record @ mrid INTEGER, -- Based on this record due to a merge @ mtime INTEGER, -- Mtime of file on disk. sec since 1970 @ pathname TEXT, -- Full pathname relative to root @ origname TEXT, -- Original pathname. NULL if unchanged @ mhash TEXT, -- Hash of mrid iff mrid!=rid @ UNIQUE(pathname,vid) @ ); @ @ -- Identifier for this file type. @ -- The integer is the same as 'FSLC'. @ PRAGMA application_id=252006674; ; /* Additional local database initialization following the schema ** enhancement of 2019-01-19, in which the mhash column was added ** to vmerge and vfile. */ const char zLocalSchemaVmerge[] = @ -- This table holds a record of uncommitted merges in the local @ -- file tree. If a VFILE entry with id has merged with another @ -- record, there is an entry in this table with (id,merge) where @ -- merge is the RECORD table entry that the file merged against. @ -- An id of 0 or <-3 here means the version record itself. When @ -- id==(-1) that is a cherrypick merge, id==(-2) that is a @ -- backout merge and id==(-4) is a integrate merge. @ -- @ @ CREATE TABLE vmerge( @ id INTEGER REFERENCES vfile, -- VFILE entry that has been merged @ merge INTEGER, -- Merged with this record @ mhash TEXT -- SHA1/SHA3 hash for merge object @ ); @ CREATE UNIQUE INDEX vmergex1 ON vmerge(id,mhash); @ @ -- The following trigger will prevent older versions of Fossil that @ -- do not know about the new vmerge.mhash column from updating the @ -- vmerge table. This must be done with a trigger, since legacy Fossil @ -- uses INSERT OR IGNORE to update vmerge, and the OR IGNORE will cause @ -- a NOT NULL constraint to be silently ignored. @ @ CREATE TRIGGER vmerge_ck1 AFTER INSERT ON vmerge @ WHEN new.mhash IS NULL BEGIN @ SELECT raise(FAIL, @ 'trying to update a newer checkout with an older version of Fossil'); @ END; @ ; /* ** The following table holds information about forum posts. It ** is created on-demand whenever the manifest parser encounters ** a forum-post artifact. */ |
︙ | ︙ |
Changes to src/search.c.
︙ | ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | if( zClass ){ @ <div class='searchForm searchForm%s(zClass)'> }else{ @ <div class='searchForm'> } @ <input type="text" name="s" size="40" value="%h(zPattern)"%s(zDisable1)> if( (mFlags & 0x01)!=0 && (srchFlags & (srchFlags-1))!=0 ){ | | | 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | if( zClass ){ @ <div class='searchForm searchForm%s(zClass)'> }else{ @ <div class='searchForm'> } @ <input type="text" name="s" size="40" value="%h(zPattern)"%s(zDisable1)> if( (mFlags & 0x01)!=0 && (srchFlags & (srchFlags-1))!=0 ){ static const struct { const char *z; const char *zNm; unsigned m; } aY[] = { { "all", "All", SRCH_ALL }, { "c", "Check-ins", SRCH_CKIN }, { "d", "Docs", SRCH_DOC }, { "t", "Tickets", SRCH_TKT }, { "w", "Wiki", SRCH_WIKI }, { "e", "Tech Notes", SRCH_TECHNOTE }, { "f", "Forum", SRCH_FORUM }, |
︙ | ︙ | |||
1840 1841 1842 1843 1844 1845 1846 | static const struct { int iCmd; const char *z; } aCmd[] = { { 1, "reindex" }, { 2, "index" }, { 3, "disable" }, { 4, "enable" }, { 5, "stemmer" }, }; | | | 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 | static const struct { int iCmd; const char *z; } aCmd[] = { { 1, "reindex" }, { 2, "index" }, { 3, "disable" }, { 4, "enable" }, { 5, "stemmer" }, }; static const struct { const char *zSetting; const char *zName; const char *zSw; } aSetng[] = { { "search-ci", "check-in search:", "c" }, { "search-doc", "document search:", "d" }, { "search-tkt", "ticket search:", "t" }, { "search-wiki", "wiki search:", "w" }, { "search-technote", "tech note search:", "e" }, { "search-forum", "forum search:", "f" }, }; |
︙ | ︙ |
Changes to src/security_audit.c.
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 | while( zTest[0] ){ if( strchr(zCap, zTest[0]) ) return 1; zTest++; } return 0; } /* ** WEBPAGE: secaudit0 ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | | | > | | | > > | 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 | while( zTest[0] ){ if( strchr(zCap, zTest[0]) ) return 1; zTest++; } return 0; } /* ** Extract the content-security-policy from the reply header. Parse it ** up into separate fields, and return a pointer to a null-terminated ** array of pointers to strings, one entry for each field. Or return ** a NULL pointer if no CSP could be located in the header. ** ** Memory to hold the returned array and of the strings is obtained from ** a single memory allocation, which the caller should free to avoid a ** memory leak. */ static char **parse_content_security_policy(void){ char **azCSP = 0; int nCSP = 0; const char *zHeader; const char *zAll; char *zCopy; int nAll = 0; int ii, jj, n, nx = 0; int nSemi; zHeader = cgi_header(); if( zHeader==0 ) return 0; for(ii=0; zHeader[ii]; ii+=n){ n = html_token_length(zHeader+ii); if( zHeader[ii]=='<' && fossil_strnicmp(html_attribute(zHeader+ii,"http-equiv",&nx), "Content-Security-Policy",23)==0 && nx==23 && (zAll = html_attribute(zHeader+ii,"content",&nAll))!=0 ){ for(jj=nSemi=0; jj<nAll; jj++){ if( zAll[jj]==';' ) nSemi++; } azCSP = fossil_malloc( nAll+1 + (nSemi+2)*sizeof(char*) ); zCopy = (char*)&azCSP[nSemi+2]; memcpy(zCopy,zAll,nAll); zCopy[nAll] = 0; while( fossil_isspace(zCopy[0]) || zCopy[0]==';' ){ zCopy++; } azCSP[0] = zCopy; nCSP = 1; for(jj=0; zCopy[jj]; jj++){ if( zCopy[jj]==';' ){ int k; for(k=jj-1; k>0 && fossil_isspace(zCopy[k]); k--){ zCopy[k] = 0; } zCopy[jj] = 0; while( jj+1<nAll && (fossil_isspace(zCopy[jj+1]) || zCopy[jj+1]==';') ){ jj++; } assert( nCSP<nSemi+1 ); azCSP[nCSP++] = zCopy+jj; } } assert( nCSP<=nSemi+2 ); azCSP[nCSP] = 0; return azCSP; } } return 0; } /* ** WEBPAGE: secaudit0 ** ** Run a security audit of the current Fossil setup, looking ** for configuration problems that might allow unauthorized ** access to the repository. ** ** This page requires administrator access. It is usually ** accessed using the Admin/Security-Audit menu option ** from any of the default skins. */ void secaudit0_page(void){ const char *zAnonCap; /* Capabilities of user "anonymous" and "nobody" */ const char *zPubPages; /* GLOB pattern for public pages */ const char *zSelfCap; /* Capabilities of self-registered users */ char *z; int n; char **azCSP; /* Parsed content security policy */ login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Security Audit"); @ <ol> /* Step 1: Determine if the repository is public or private. "Public" ** means that any anonymous user on the internet can access all content. ** "Private" repos require (non-anonymous) login to access all content, ** though some content may be accessible anonymously. */ zAnonCap = db_text("", "SELECT fullcap(NULL)"); zPubPages = db_get("public-pages",0); if( db_get_boolean("self-register",0) ){ CapabilityString *pCap; pCap = capability_add(0, db_get("default-perms",0)); capability_expand(pCap); zSelfCap = capability_string(pCap); capability_free(pCap); }else{ zSelfCap = fossil_strdup(""); } if( hasAnyCap(zAnonCap,"as") ){ @ <li><p>This repository is <big><b>Wildly INSECURE</b></big> because @ it grants administrator privileges to anonymous users. You @ should <a href="takeitprivate">take this repository private</a> @ immediately! Or, at least remove the Setup and Admin privileges @ for users "anonymous" and "login" on the @ <a href="setup_ulist">User Configuration</a> page. }else if( hasAnyCap(zSelfCap,"as") ){ @ <li><p>This repository is <big><b>Wildly INSECURE</b></big> because @ it grants administrator privileges to self-registered users. You @ should <a href="takeitprivate">take this repository private</a> @ and/or disable self-registration @ immediately! Or, at least remove the Setup and Admin privileges @ from the default permissions for new users. }else if( hasAnyCap(zAnonCap,"y") ){ @ <li><p>This repository is <big><b>INSECURE</b></big> because @ it allows anonymous users to push unversioned files. @ <p>Fix this by <a href="takeitprivate">taking the repository private</a> @ or by removing the "y" permission from users "anonymous" and @ "nobody" on the <a href="setup_ulist">User Configuration</a> page. }else if( hasAnyCap(zSelfCap,"y") ){ @ <li><p>This repository is <big><b>INSECURE</b></big> because @ it allows self-registered users to push unversioned files. @ <p>Fix this by <a href="takeitprivate">taking the repository private</a> @ or by removing the "y" permission from the default permissions or @ by disabling self-registration. }else if( hasAnyCap(zAnonCap,"goz") ){ @ <li><p>This repository is <big><b>PUBLIC</b></big>. All @ checked-in content can be accessed by anonymous users. @ <a href="takeitprivate">Take it private</a>.<p> }else if( hasAnyCap(zSelfCap,"goz") ){ @ <li><p>This repository is <big><b>PUBLIC</b></big> because all @ checked-in content can be accessed by self-registered users. @ This repostory would be private if you disabled self-registration.</p> }else if( !hasAnyCap(zAnonCap, "jrwy234567") && !hasAnyCap(zSelfCap, "jrwy234567") && (zPubPages==0 || zPubPages[0]==0) ){ @ <li><p>This repository is <big><b>Completely PRIVATE</b></big>. @ A valid login and password is required to access any content. }else{ @ <li><p>This repository is <big><b>Mostly PRIVATE</b></big>. @ A valid login and password is usually required, however some @ content can be accessed either anonymously or by self-registered @ users: @ <ul> if( hasAnyCap(zAnonCap,"j") || hasAnyCap(zSelfCap,"j") ){ @ <li> Wiki pages } if( hasAnyCap(zAnonCap,"r") || hasAnyCap(zSelfCap,"r") ){ @ <li> Tickets } if( hasAnyCap(zAnonCap,"234567") || hasAnyCap(zSelfCap,"234567") ){ @ <li> Forum posts } if( zPubPages && zPubPages[0] ){ Glob *pGlob = glob_create(zPubPages); int i; @ <li> URLs that match any of these GLOB patterns: @ <ul> for(i=0; i<pGlob->nPattern; i++){ @ <li> %h(pGlob->azPattern[i]) } @ </ul> } @ </ul> if( zPubPages && zPubPages[0] ){ @ <p>Change GLOB patterns exceptions using the "Public pages" setting @ on the <a href="setup_access">Access Settings</a> page.</p> } } /* Make sure the HTTPS is required for login, at least, so that the ** password does not go across the Internet in the clear. */ if( db_get_int("redirect-to-https",0)==0 ){ @ <li><p><b>WARNING:</b> @ Sensitive material such as login passwords can be sent over an @ unencrypted connection. @ <p>Fix this by changing the "Redirect to HTTPS" setting on the @ <a href="setup_access">Access Control</a> page. If you were using @ the old "Redirect to HTTPS on Login Page" setting, switch to the @ new setting: it has a more secure implementation. } /* Anonymous users should not be able to harvest email addresses ** from tickets. */ if( hasAnyCap(zAnonCap, "e") ){ @ <li><p><b>WARNING:</b> |
︙ | ︙ | |||
254 255 256 257 258 259 260 | @ <li><p> @ Users with administrator privilege are: %s(z) fossil_free(z); if( n>3 ){ @ <li><p><b>WARNING:</b> @ Administrator privilege is granted to @ <a href='setup_ulist?with=as'>%d(n) users</a>. | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | @ <li><p> @ Users with administrator privilege are: %s(z) fossil_free(z); if( n>3 ){ @ <li><p><b>WARNING:</b> @ Administrator privilege is granted to @ <a href='setup_ulist?with=as'>%d(n) users</a>. @ Ideally, administrator privilege ('s' or 'a') should only @ be granted to one or two users. } } /* The push-unversioned privilege should only be provided to ** specific individuals, not to entire classes of people. ** And no too many people should have this privilege. |
︙ | ︙ | |||
341 342 343 344 345 346 347 | @ <li><p> @ Unable to get the system load average. This can prevent Fossil @ from throttling expensive operations during peak demand. @ <p>If running in a chroot jail on Linux, verify that the /proc @ filesystem is mounted within the jail, so that the load average @ can be obtained from the /proc/loadavg file. }else { | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | @ <li><p> @ Unable to get the system load average. This can prevent Fossil @ from throttling expensive operations during peak demand. @ <p>If running in a chroot jail on Linux, verify that the /proc @ filesystem is mounted within the jail, so that the load average @ can be obtained from the /proc/loadavg file. }else { double r = atof(db_get("max-loadavg", 0)); if( r<=0.0 ){ @ <li><p> @ Load average limiting is turned off. This can cause the server @ to bog down if many requests for expensive services (such as @ large diffs or tarballs) arrive at about the same time. @ <p>To fix this, set the "Server Load Average Limit" on the @ <a href="setup_access">Access Control</a> page to approximately |
︙ | ︙ | |||
363 364 365 366 367 368 369 | } } #endif if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){ @ <li><p> @ The server error log is disabled. | | | | | | | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | 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 | } } #endif if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){ @ <li><p> @ The server error log is disabled. @ To set up an error log, if( fossil_strcmp(g.zCmdName, "cgi")==0 ){ @ make an entry like "errorlog: <i>FILENAME</i>" in the @ CGI script at %h(P("SCRIPT_FILENAME")). }else{ @ add the "--errorlog <i>FILENAME</i>" option to the @ "%h(g.argv[0]) %h(g.zCmdName)" command that launched this server. } }else{ FILE *pTest = fossil_fopen(g.zErrlog,"a"); if( pTest==0 ){ @ <li><p> @ <b>Error:</b> @ There is an error log at "%h(g.zErrlog)" but that file is not @ writable and so no logging will occur. }else{ fclose(pTest); @ <li><p> @ The error log at "<a href='%R/errorlog'>%h(g.zErrlog)</a>" is @ %,lld(file_size(g.zErrlog, ExtFILE)) bytes in size. } } if( g.zExtRoot ){ int nFile; int nCgi; ext_files(); nFile = db_int(0, "SELECT count(*) FROM sfile"); nCgi = nFile==0 ? 0 : db_int(0,"SELECT count(*) FROM sfile WHERE isexe"); @ <li><p> CGI Extensions are enabled with a document root @ at <a href='%R/extfilelist'>%h(g.zExtRoot)</a> holding @ %d(nCgi) CGIs and %d(nFile-nCgi) static content and data files. } @ <li><p> User capability summary: capability_summary(); azCSP = parse_content_security_policy(); if( azCSP==0 ){ @ <li><p> WARNING: No Content Security Policy (CSP) is specified in the @ header. Though not required, a strong CSP is recommended. Fossil will @ automatically insert an appropriate CSP if you let it generate the @ HTML <tt><head></tt> element by omitting <tt><body></tt> @ from the header configuration in your customized skin. @ }else{ int ii; @ <li><p> Content Security Policy: @ <ol type="a"> for(ii=0; azCSP[ii]; ii++){ @ <li>%h(azCSP[ii]) } @ </ol> } fossil_free(azCSP); if( alert_enabled() ){ @ <li><p> Email alert configuration summary: @ <table class="label-value"> stats_for_email(); @ </table> }else{ @ <li><p> Email alerts are disabled } @ </ol> style_footer(); } /* ** WEBPAGE: takeitprivate ** ** Disable anonymous access to this website */ void takeitprivate_page(void){ login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } if( P("cancel") ){ /* User pressed the cancel button. Go back */ cgi_redirect("secaudit0"); } if( P("apply") ){ db_multi_exec( "UPDATE user SET cap=''" " WHERE login IN ('nobody','anonymous');" "DELETE FROM config WHERE name='public-pages';" ); db_set("self-register","0",0); cgi_redirect("secaudit0"); } style_header("Make This Website Private"); @ <p>Click the "Make It Private" button below to disable all @ anonymous access to this repository. A valid login and password @ will be required to access this repository after clicking that @ button.</p> |
︙ | ︙ | |||
456 457 458 459 460 461 462 | ** this page. */ void errorlog_page(void){ i64 szFile; FILE *in; char z[10000]; login_check_credentials(); | | | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | ** this page. */ void errorlog_page(void){ i64 szFile; FILE *in; char z[10000]; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Server Error Log"); style_submenu_element("Test", "%R/test-warning"); style_submenu_element("Refresh", "%R/errorlog"); if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){ |
︙ | ︙ |
Changes to src/setup.c.
︙ | ︙ | |||
57 58 59 60 61 62 63 | } /* ** WEBPAGE: setup ** | | > > > | > | 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 | } /* ** WEBPAGE: setup ** ** Main menu for the administrative pages. Requires Admin or Setup ** privileges. Links to sub-pages only usable by Setup users are ** shown only to Setup users. */ void setup_page(void){ int setup_user = 0; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); } setup_user = g.perm.Setup; style_header("Server Administration"); /* Make sure the header contains <base href="...">. Issue a warning ** if it does not. */ if( !cgi_header_contains("<base href=") ){ @ <p class="generalError"><b>Configuration Error:</b> Please add |
︙ | ︙ | |||
93 94 95 96 97 98 99 | @ by SQLite will be poorly seeded.</p> } #endif @ <table border="0" cellspacing="3"> setup_menu_entry("Users", "setup_ulist", "Grant privileges to individual users."); | > | | | | > > | | > > | | | | | > > > > | | | | | | > > | | > > | | | | > | 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 | @ by SQLite will be poorly seeded.</p> } #endif @ <table border="0" cellspacing="3"> setup_menu_entry("Users", "setup_ulist", "Grant privileges to individual users."); if( setup_user ){ setup_menu_entry("Access", "setup_access", "Control access settings."); setup_menu_entry("Configuration", "setup_config", "Configure the WWW components of the repository"); } setup_menu_entry("Security-Audit", "secaudit0", "Analyze the current configuration for security problems"); if( setup_user ){ setup_menu_entry("Settings", "setup_settings", "Web interface to the \"fossil settings\" command"); } setup_menu_entry("Timeline", "setup_timeline", "Timeline display preferences"); if( setup_user ){ setup_menu_entry("Login-Group", "setup_login_group", "Manage single sign-on between this repository and others" " on the same server"); setup_menu_entry("Tickets", "tktsetup", "Configure the trouble-ticketing system for this repository"); setup_menu_entry("Wiki", "setup_wiki", "Configure the wiki for this repository"); } setup_menu_entry("Search","srchsetup", "Configure the built-in search engine"); setup_menu_entry("URL Aliases", "waliassetup", "Configure URL aliases"); if( setup_user ){ setup_menu_entry("Notification", "setup_notification", "Automatic notifications of changes via outbound email"); setup_menu_entry("Email-Server", "setup_smtp", "Activate and configure the built-in email server"); setup_menu_entry("Transfers", "xfersetup", "Configure the transfer system for this repository"); } setup_menu_entry("Skins", "setup_skin", "Select and/or modify the web interface \"skins\""); setup_menu_entry("Moderation", "setup_modreq", "Enable/Disable requiring moderator approval of Wiki and/or Ticket" " changes and attachments."); setup_menu_entry("Ad-Unit", "setup_adunit", "Edit HTML text for an ad unit inserted after the menu bar"); setup_menu_entry("URLs & Checkouts", "urllist", "Show URLs used to access this repo and known check-outs"); if( setup_user ){ setup_menu_entry("Web-Cache", "cachestat", "View the status of the expensive-page cache"); } setup_menu_entry("Logo", "setup_logo", "Change the logo and background images for the server"); setup_menu_entry("Shunned", "shun", "Show artifacts that are shunned by this repository"); setup_menu_entry("Artifact Receipts Log", "rcvfromlist", "A record of received artifacts and their sources"); setup_menu_entry("User Log", "access_log", "A record of login attempts"); setup_menu_entry("Administrative Log", "admin_log", "View the admin_log entries"); setup_menu_entry("Error Log", "errorlog", "View the Fossil server error log"); setup_menu_entry("Unversioned Files", "uvlist?byage=1", "Show all unversioned files held"); setup_menu_entry("Stats", "stat", "Repository Status Reports"); setup_menu_entry("Sitemap", "sitemap", "Links to miscellaneous pages"); if( setup_user ){ setup_menu_entry("SQL", "admin_sql", "Enter raw SQL commands"); setup_menu_entry("TH1", "admin_th1", "Enter raw TH1 commands"); } @ </table> style_footer(); } /* ** Generate a checkbox for an attribute. |
︙ | ︙ | |||
264 265 266 267 268 269 270 | */ void multiple_choice_attribute( const char *zLabel, /* The text label on the menu */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQP, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int nChoice, /* Number of choices */ | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | */ void multiple_choice_attribute( const char *zLabel, /* The text label on the menu */ const char *zVar, /* The corresponding row in the VAR table */ const char *zQP, /* The query parameter */ const char *zDflt, /* Default value if VAR table entry does not exist */ int nChoice, /* Number of choices */ const char *const *azChoice /* Choices in pairs (VAR value, Display) */ ){ const char *z = db_get(zVar, zDflt); const char *zQ = P(zQP); int i; if( zQ && fossil_strcmp(zQ,z)!=0){ const int nZQ = (int)strlen(zQ); login_verify_csrf_secret(); |
︙ | ︙ | |||
289 290 291 292 293 294 295 | @ </select> <b>%h(zLabel)</b> } /* ** WEBPAGE: setup_access ** | | > > > > > | | > | > > | | < | > | 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 | @ </select> <b>%h(zLabel)</b> } /* ** WEBPAGE: setup_access ** ** The access-control settings page. Requires Setup privileges. */ void setup_access(void){ static const char *const azRedirectOpts[] = { "0", "Off", "1", "Login Page Only", "2", "All Pages" }; login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); return; } style_header("Access Control Settings"); db_begin_transaction(); @ <form action="%s(g.zTop)/setup_access" method="post"><div> login_insert_csrf_secret(); @ <input type="submit" name="submit" value="Apply Changes" /></p> @ <hr /> multiple_choice_attribute("Redirect to HTTPS", "redirect-to-https", "redirhttps", "0", count(azRedirectOpts)/2, azRedirectOpts); @ <p>Force the use of HTTPS by redirecting to HTTPS when an @ unencrypted request is received. This feature can be enabled @ for the Login page only, or for all pages. @ <p>Further details: When enabled, this option causes the $secureurl TH1 @ variable is set to an "https:" variant of $baseurl. Otherwise, @ $secureurl is just an alias for $baseurl. @ (Property: "redirect-to-https". "0" for off, "1" for Login page only, @ "2" otherwise.) @ <hr /> onoff_attribute("Require password for local access", "localauth", "localauth", 0, 0); @ <p>When enabled, the password sign-in is always required for @ web access. When disabled, unrestricted web access from 127.0.0.1 @ is allowed for the <a href="%R/help/ui">fossil ui</a> command or @ from the <a href="%R/help/server">fossil server</a>, |
︙ | ︙ | |||
530 531 532 533 534 535 536 | login_needed(0); return; } file_canonical_name(g.zRepositoryName, &fullName, 0); zSelfRepo = fossil_strdup(blob_str(&fullName)); blob_reset(&fullName); if( P("join")!=0 ){ | | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | login_needed(0); return; } file_canonical_name(g.zRepositoryName, &fullName, 0); zSelfRepo = fossil_strdup(blob_str(&fullName)); blob_reset(&fullName); if( P("join")!=0 ){ login_group_join(zRepo, 1, zLogin, zPw, zNewName, &zErrMsg); }else if( P("leave") ){ login_group_leave(&zErrMsg); } style_header("Login Group Configuration"); if( zErrMsg ){ @ <p class="generalError">%s(zErrMsg)</p> } |
︙ | ︙ | |||
645 646 647 648 649 650 651 | "0", "HH:MM", "1", "HH:MM:SS", "2", "YYYY-MM-DD HH:MM", "3", "YYMMDD HH:MM", "4", "(off)" }; login_check_credentials(); | | | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | "0", "HH:MM", "1", "HH:MM:SS", "2", "YYYY-MM-DD HH:MM", "3", "YYMMDD HH:MM", "4", "(off)" }; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Timeline Display Preferences"); db_begin_transaction(); @ <form action="%s(g.zTop)/setup_timeline" method="post"><div> |
︙ | ︙ | |||
672 673 674 675 676 677 678 | "timeline-plaintext", "tpt", 0, 0); @ <p>In timeline displays, check-in comments are displayed literally, @ without any wiki or HTML interpretation. Use CSS to change @ display formatting features such as fonts and line-wrapping behavior. @ (Property: "timeline-plaintext")</p> @ <hr /> | | > | > > > > > > > | 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 | "timeline-plaintext", "tpt", 0, 0); @ <p>In timeline displays, check-in comments are displayed literally, @ without any wiki or HTML interpretation. Use CSS to change @ display formatting features such as fonts and line-wrapping behavior. @ (Property: "timeline-plaintext")</p> @ <hr /> onoff_attribute("Truncate comment at first blank line (Git-style)", "timeline-truncate-at-blank", "ttb", 0, 0); @ <p>In timeline displays, check-in comments are displayed only through @ the first blank line. This is the traditional way to display comments @ in Git repositories (Property: "timeline-truncate-at-blank")</p> @ <hr /> onoff_attribute("Break comments at newline characters", "timeline-hard-newlines", "thnl", 0, 0); @ <p>In timeline displays, newline characters in check-in comments force @ a line break on the display. @ (Property: "timeline-hard-newlines")</p> @ <hr /> onoff_attribute("Use Universal Coordinated Time (UTC)", "timeline-utc", "utc", 1, 0); @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or @ Zulu) instead of in local time. On this server, local time is currently tmDiff = db_double(0.0, "SELECT julianday('now')"); |
︙ | ︙ | |||
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | @ <hr /> entry_attribute("Max timeline comment length", 6, "timeline-max-comment", "tmc", "0", 0); @ <p>The maximum length of a comment to be displayed in a timeline. @ "0" there is no length limit. @ (Property: "timeline-max-comment")</p> @ <hr /> @ <p><input type="submit" name="submit" value="Apply Changes" /></p> @ </div></form> db_end_transaction(0); style_footer(); } /* ** WEBPAGE: setup_settings ** ** Change or view miscellaneous settings. Part of the | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | @ <hr /> entry_attribute("Max timeline comment length", 6, "timeline-max-comment", "tmc", "0", 0); @ <p>The maximum length of a comment to be displayed in a timeline. @ "0" there is no length limit. @ (Property: "timeline-max-comment")</p> @ <hr /> entry_attribute("Tooltip dwell time (milliseconds)", 6, "timeline-dwelltime", "tdt", "100", 0); @ <br> entry_attribute("Tooltip close time (milliseconds)", 6, "timeline-closetime", "tct", "250", 0); @ <p>The <strong>dwell time</strong> defines how long the mouse pointer @ should be stationary above an object of the graph before a tooltip @ appears.<br> @ The <strong>close time</strong> defines how long the mouse pointer @ can be away from an object before a tooltip is closed.</p> @ <p>Set <strong>dwell time</strong> to "0" to disable tooltips.<br> @ Set <strong>close time</strong> to "0" to keep tooltips visible until @ the mouse is clicked elsewhere.<p> @ <p>(Properties: "timeline-dwelltime", "timeline-closetime")</p> @ <hr /> onoff_attribute("Timestamp hyperlinks to /info", "timeline-tslink-info", "ttlti", 0, 0); @ <p>The hyperlink on the timestamp associated with each timeline entry, @ on the far left-hand side of the screen, normally targets another @ /timeline page that shows the entry in context. However, if this @ option is turned on, that hyperlink targets the /info page showing @ the details of the entry. @ <p>The /timeline link is the default since it is often useful to @ see an entry in context, and because that link is not otherwise @ accessible on the timeline. The /info link is also accessible by @ double-clicking the timeline node or by clicking on the hash that @ follows "check-in:" in the supplimental information section on the @ right of the entry. @ <p>(Properties: "timeline-tslink-info") @ <hr /> @ <p><input type="submit" name="submit" value="Apply Changes" /></p> @ </div></form> db_end_transaction(0); style_footer(); } /* ** WEBPAGE: setup_settings ** ** Change or view miscellaneous settings. Part of the ** /setup pages requiring Setup privileges. */ void setup_settings(void){ int nSetting; int i; Setting const *pSet; const Setting *aSetting = setting_info(&nSetting); |
︙ | ︙ | |||
772 773 774 775 776 777 778 | @ <br /> } } } @ <br /><input type="submit" name="submit" value="Apply Changes" /> @ </td><td style="width:50px;"></td><td valign="top"> for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){ | | | | 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 | @ <br /> } } } @ <br /><input type="submit" name="submit" value="Apply Changes" /> @ </td><td style="width:50px;"></td><td valign="top"> for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){ if( pSet->width>0 && !pSet->forceTextArea ){ int hasVersionableValue = pSet->versionable && (db_get_versioned(pSet->name, NULL)!=0); entry_attribute("", /*pSet->width*/ 25, pSet->name, pSet->var!=0 ? pSet->var : pSet->name, (char*)pSet->def, hasVersionableValue); @ <a href='%R/help?cmd=%s(pSet->name)'>%h(pSet->name)</a> if( pSet->versionable ){ @ (v)<br /> } else { @ <br /> } } } @ </td><td style="width:50px;"></td><td valign="top"> for(i=0, pSet=aSetting; i<nSetting; i++, pSet++){ if( pSet->width>0 && pSet->forceTextArea ){ int hasVersionableValue = db_get_versioned(pSet->name, NULL)!=0; @ <a href='%R/help?cmd=%s(pSet->name)'>%s(pSet->name)</a> if( pSet->versionable ){ @ (v)<br /> } else { @ <br /> } |
︙ | ︙ | |||
811 812 813 814 815 816 817 | db_end_transaction(0); style_footer(); } /* ** WEBPAGE: setup_config ** | | | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | db_end_transaction(0); style_footer(); } /* ** WEBPAGE: setup_config ** ** The "Admin/Configuration" page. Requires Setup privilege. */ void setup_config(void){ login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); return; } |
︙ | ︙ | |||
848 849 850 851 852 853 854 | @ ZIP archive. For best results, keep this prefix brief and avoid special @ characters such as "/" and "\". @ If no tarball prefix is specified, then the full Project Name above is used. @ (Property: "short-project-name") @ </p> @ <hr /> entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0); | | < < < < < < < | 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | @ ZIP archive. For best results, keep this prefix brief and avoid special @ characters such as "/" and "\". @ If no tarball prefix is specified, then the full Project Name above is used. @ (Property: "short-project-name") @ </p> @ <hr /> entry_attribute("Download Tag", 20, "download-tag", "dlt", "trunk", 0); @ <p>The <a href='%R/download'>/download</a> page is designed to provide @ a convenient place for newbies @ to download a ZIP archive or a tarball of the project. By default, @ the latest trunk check-in is downloaded. Change this tag to something @ else (ex: release) to alter the behavior of the /download page. @ (Property: "download-tag") @ </p> @ <hr /> entry_attribute("Index Page", 60, "index-page", "idxpg", "/home", 0); @ <p>Enter the pathname of the page to display when the "Home" menu @ option is selected and when no pathname is @ specified in the URL. For example, if you visit the url:</p> @ @ <blockquote><p>%h(g.zBaseURL)</p></blockquote> @ |
︙ | ︙ | |||
886 887 888 889 890 891 892 | @ <p>Note: To avoid a redirect loop or other problems, this entry must @ begin with "/" and it must specify a valid page. For example, @ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the @ leading "/".</p> @ <p>(Property: "index-page") @ <hr> @ <p>Extra links to appear on the <a href="%R/sitemap">/sitemap</a> page. | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | @ <p>Note: To avoid a redirect loop or other problems, this entry must @ begin with "/" and it must specify a valid page. For example, @ "<b>/home</b>" will work but "<b>home</b>" will not, since it omits the @ leading "/".</p> @ <p>(Property: "index-page") @ <hr> @ <p>Extra links to appear on the <a href="%R/sitemap">/sitemap</a> page. @ Often these are filled in with links like @ "/doc/trunk/doc/<i>filename</i>.md" so that they refer to @ embedded documentation, or like "/wiki/<i>pagename</i>" to refer @ to wiki pages. @ Leave blank to omit. @ <p> entry_attribute("Documentation Index", 40, "sitemap-docidx", "smdocidx", "", 0); @ (Property: sitemap-docidx)<br> entry_attribute("Download", 40, "sitemap-download", "smdownload", "", 0); @ (Property: sitemap-download)<br> entry_attribute("License", 40, "sitemap-license", "smlicense", "", 0); @ (Property: sitemap-license)<br> entry_attribute("Contact", 40, "sitemap-contact", "smcontact", "", 0); @ (Property: sitemap-contact) @ <hr /> @ <p><input type="submit" name="submit" value="Apply Changes" /></p> @ </div></form> db_end_transaction(0); style_footer(); } /* ** WEBPAGE: setup_wiki ** ** The "Admin/Wiki" page. Requires Setup privilege. */ void setup_wiki(void){ login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); return; } style_header("Wiki Configuration"); db_begin_transaction(); @ <form action="%s(g.zTop)/setup_wiki" method="post"><div> login_insert_csrf_secret(); @ <input type="submit" name="submit" value="Apply Changes" /></p> @ <hr /> onoff_attribute("Associate Wiki Pages With Branches, Tags, or Checkins", "wiki-about", "wiki-about", 1, 0); @ <p> @ Associate wiki pages with branches, tags, or checkins, based on @ the wiki page name. Wiki pages that begin with "branch/", "checkin/" @ or "tag/" and which continue with the name of an existing branch, checkin @ or tag are treated specially when this feature is enabled. @ <ul> @ <li> <b>branch/</b><i>branch-name</i> @ <li> <b>checkin/</b><i>full-checkin-hash</i> @ <li> <b>tag/</b><i>tag-name</i> @ </ul> @ (Property: "wiki-about")</p> @ <hr /> onoff_attribute("Enable WYSIWYG Wiki Editing", "wysiwyg-wiki", "wysiwyg-wiki", 0, 0); @ <p>Enable what-you-see-is-what-you-get (WYSIWYG) editing of wiki pages. @ The WYSIWYG editor generates HTML instead of markup, which makes @ subsequent manual editing more difficult. @ (Property: "wysiwyg-wiki")</p> @ <hr /> onoff_attribute("Use HTML as wiki markup language", "wiki-use-html", "wiki-use-html", 0, 0); @ <p>Use HTML as the wiki markup language. Wiki links will still be parsed @ but all other wiki formatting will be ignored. This option is helpful @ if you have chosen to use a rich HTML editor for wiki markup such as @ TinyMCE.</p> |
︙ | ︙ | |||
933 934 935 936 937 938 939 | /* ** WEBPAGE: setup_modreq ** ** Admin page for setting up moderation of tickets and wiki. */ void setup_modreq(void){ login_check_credentials(); | | | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | /* ** WEBPAGE: setup_modreq ** ** Admin page for setting up moderation of tickets and wiki. */ void setup_modreq(void){ login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Moderator For Wiki And Tickets"); db_begin_transaction(); @ <form action="%R/setup_modreq" method="post"><div> |
︙ | ︙ | |||
981 982 983 984 985 986 987 | ** WEBPAGE: setup_adunit ** ** Administrative page for configuring and controlling ad units ** and how they are displayed. */ void setup_adunit(void){ login_check_credentials(); | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | ** WEBPAGE: setup_adunit ** ** Administrative page for configuring and controlling ad units ** and how they are displayed. */ void setup_adunit(void){ login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } db_begin_transaction(); if( P("clear")!=0 && cgi_csrf_safe(1) ){ db_multi_exec("DELETE FROM config WHERE name GLOB 'adunit*'"); cgi_replace_parameter("adunit",""); |
︙ | ︙ | |||
1071 1072 1073 1074 1075 1076 1077 | if( szLogoImg>0 ){ zLogoMime = PD("logoim:mimetype","image/gif"); } if( szBgImg>0 ){ zBgMime = PD("bgim:mimetype","image/gif"); } login_check_credentials(); | | | 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | if( szLogoImg>0 ){ zLogoMime = PD("logoim:mimetype","image/gif"); } if( szBgImg>0 ){ zBgMime = PD("bgim:mimetype","image/gif"); } login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } db_begin_transaction(); if( !cgi_csrf_safe(1) ){ /* Allow no state changes if not safe from CSRF */ }else if( P("setlogo")!=0 && zLogoMime && zLogoMime[0] && szLogoImg>0 ){ |
︙ | ︙ | |||
1212 1213 1214 1215 1216 1217 1218 | } /* ** WEBPAGE: admin_sql ** ** Run raw SQL commands against the database file using the web interface. | | | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | } /* ** WEBPAGE: admin_sql ** ** Run raw SQL commands against the database file using the web interface. ** Requires Setup privileges. */ void sql_page(void){ const char *zQ; int go = P("go")!=0; login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); |
︙ | ︙ | |||
1403 1404 1405 1406 1407 1408 1409 | void page_admin_log(){ Stmt stLog; int limit; /* How many entries to show */ int ofst; /* Offset to the first entry */ int fLogEnabled; int counter = 0; login_check_credentials(); | | | 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 | void page_admin_log(){ Stmt stLog; int limit; /* How many entries to show */ int ofst; /* Offset to the first entry */ int fLogEnabled; int counter = 0; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Admin Log"); create_admin_log_table(); limit = atoi(PD("n","200")); ofst = atoi(PD("x","0")); |
︙ | ︙ | |||
1463 1464 1465 1466 1467 1468 1469 | /* ** WEBPAGE: srchsetup ** ** Configure the search engine. Requires Admin privilege. */ void page_srchsetup(){ login_check_credentials(); | | | 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 | /* ** WEBPAGE: srchsetup ** ** Configure the search engine. Requires Admin privilege. */ void page_srchsetup(){ login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("Search Configuration"); @ <form action="%s(g.zTop)/srchsetup" method="post"><div> login_insert_csrf_secret(); @ <div style="text-align:center;font-weight:bold;"> |
︙ | ︙ | |||
1587 1588 1589 1590 1591 1592 1593 | ** Configure the URL aliases */ void page_waliassetup(){ Stmt q; int cnt = 0; Blob namelist; login_check_credentials(); | | | 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 | ** Configure the URL aliases */ void page_waliassetup(){ Stmt q; int cnt = 0; Blob namelist; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_header("URL Alias Configuration"); if( P("submit")!=0 ){ Blob token; Blob sql; |
︙ | ︙ |
Changes to src/setupuser.c.
︙ | ︙ | |||
40 41 42 43 44 45 46 | login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } | < | | | | > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } style_submenu_element("Add", "setup_uedit"); style_submenu_element("Log", "access_log"); style_submenu_element("Help", "setup_ulist_notes"); style_header("User List"); if( zWith==0 || zWith[0]==0 ){ @ <table border=1 cellpadding=2 cellspacing=0 class='userTable'> @ <thead><tr> @ <th>Category @ <th>Capabilities (<a href='%R/setup_ucap_list'>key</a>) @ <th>Info <th>Last Change</tr></thead> @ <tbody> db_prepare(&s, |
︙ | ︙ | |||
85 86 87 88 89 90 91 92 | @ <td>%h(zDate) }else{ @ <td> } @ </tr> } db_finalize(&s); }else{ | > > > | > | < | > > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | @ <td>%h(zDate) }else{ @ <td> } @ </tr> } db_finalize(&s); @ </tbody></table> @ <div class='section'>Users</div> }else{ style_submenu_element("All Users", "setup_ulist"); if( zWith[1]==0 ){ @ <div class='section'>Users with capability "%h(zWith)"</div> }else{ @ <div class='section'>Users with any capability in "%h(zWith)"</div> } } @ <table border=1 cellpadding=2 cellspacing=0 class='userTable sortable' \ @ data-column-types='ktxTTK' data-init-sort='2'> @ <thead><tr> @ <th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead> @ <tbody> db_multi_exec( "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL)" |
︙ | ︙ | |||
290 291 292 293 294 295 296 297 298 299 300 301 302 303 | /* Check for requests to delete the user */ if( P("delete") && cgi_csrf_safe(1) ){ int n; if( P("verifydelete") ){ /* Verified delete user request */ db_multi_exec("DELETE FROM user WHERE uid=%d", uid); cgi_redirect(cgi_referer("setup_ulist")); return; } n = db_int(0, "SELECT count(*) FROM event" " WHERE user=%Q AND objid NOT IN private", P("login")); if( n==0 ){ | > > > | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | /* Check for requests to delete the user */ if( P("delete") && cgi_csrf_safe(1) ){ int n; if( P("verifydelete") ){ /* Verified delete user request */ db_multi_exec("DELETE FROM user WHERE uid=%d", uid); moderation_disapprove_for_missing_users(); admin_log("Deleted user [%s] (uid %d).", PD("login","???")/*safe-for-%s*/, uid); cgi_redirect(cgi_referer("setup_ulist")); return; } n = db_int(0, "SELECT count(*) FROM event" " WHERE user=%Q AND objid NOT IN private", P("login")); if( n==0 ){ |
︙ | ︙ | |||
327 328 329 330 331 332 333 | /* We have all the information we need to make the change to the user */ char c; char zCap[70], zNm[4]; zNm[0] = 'a'; zNm[2] = 0; for(i=0, c='a'; c<='z'; c++){ zNm[1] = c; | | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | /* We have all the information we need to make the change to the user */ char c; char zCap[70], zNm[4]; zNm[0] = 'a'; zNm[2] = 0; for(i=0, c='a'; c<='z'; c++){ zNm[1] = c; a[c&0x7f] = ((c!='s' && c!='y') || g.perm.Setup) && P(zNm)!=0; if( a[c&0x7f] ) zCap[i++] = c; } for(c='0'; c<='9'; c++){ zNm[1] = c; a[c&0x7f] = P(zNm)!=0; if( a[c&0x7f] ) zCap[i++] = c; } |
︙ | ︙ |
Changes to src/sha1.c.
︙ | ︙ | |||
99 100 101 102 103 104 105 | /* * blk0() and blk() perform the initial expand. * I got the idea of expanding during the round function from SSLeay * * blk0le() for little-endian and blk0be() for big-endian. */ | < < < < < < < < < < < < < < < < < < < | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /* * blk0() and blk() perform the initial expand. * I got the idea of expanding during the round function from SSLeay * * blk0le() for little-endian and blk0be() for big-endian. */ #define SHA_ROT(x,l,r) ((x) << (l) | (x) >> (r)) #define rol(x,k) SHA_ROT(x,k,32-(k)) #define ror(x,k) SHA_ROT(x,32-(k),k) #define blk0le(i) (block[i] = (ror(block[i],8)&0xFF00FF00) \ |(rol(block[i],8)&0x00FF00FF)) #define blk0be(i) block[i] #define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \ ^block[(i+2)&15]^block[i&15],1)) /* |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 164 165 | # define isatty(h) _isatty(h) # ifndef access # define access(f,m) _access((f),(m)) # endif # ifndef unlink # define unlink _unlink # endif # undef popen # define popen _popen # undef pclose # define pclose _pclose #else /* Make sure isatty() has a prototype. */ extern int isatty(int); | > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | # define isatty(h) _isatty(h) # ifndef access # define access(f,m) _access((f),(m)) # endif # ifndef unlink # define unlink _unlink # endif # ifndef strdup # define strdup _strdup # endif # undef popen # define popen _popen # undef pclose # define pclose _pclose #else /* Make sure isatty() has a prototype. */ extern int isatty(int); |
︙ | ︙ | |||
976 977 978 979 980 981 982 983 984 985 986 987 988 989 | #include "windows.h" /* ** We need several support functions from the SQLite core. */ /* ** We need several things from the ANSI and MSVCRT headers. */ #include <stdio.h> #include <stdlib.h> | > | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 | #include "windows.h" /* ** We need several support functions from the SQLite core. */ /* #include "sqlite3.h" */ /* ** We need several things from the ANSI and MSVCRT headers. */ #include <stdio.h> #include <stdlib.h> |
︙ | ︙ | |||
1313 1314 1315 1316 1317 1318 1319 | ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** | | > | 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This SQLite extension implements functions that compute SHA3 hashes. ** Two SQL functions are implemented: ** ** sha3(X,SIZE) ** sha3_query(Y,SIZE) ** ** The sha3(X) function computes the SHA3 hash of the input X, or NULL if ** X is NULL. ** ** The sha3_query(Y) function evalutes all queries in the SQL statements of Y ** and returns a hash of their results. ** ** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm ** is used. If SIZE is included it must be one of the integers 224, 256, ** 384, or 512, to determine SHA3 hash variant that is computed. */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <assert.h> #include <string.h> #include <stdarg.h> /* typedef sqlite3_uint64 u64; */ /****************************************************************************** |
︙ | ︙ | |||
2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 | ** directory, NULL. ** ** If a non-NULL value is specified for the optional $dir parameter and ** $path is a relative path, then $path is interpreted relative to $dir. ** And the paths returned in the "name" column of the table are also ** relative to directory $dir. */ SQLITE_EXTENSION_INIT1 #include <stdio.h> #include <string.h> #include <assert.h> #include <sys/types.h> #include <sys/stat.h> | > | 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 | ** directory, NULL. ** ** If a non-NULL value is specified for the optional $dir parameter and ** $path is a relative path, then $path is interpreted relative to $dir. ** And the paths returned in the "name" column of the table are also ** relative to directory $dir. */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <stdio.h> #include <string.h> #include <assert.h> #include <sys/types.h> #include <sys/stat.h> |
︙ | ︙ | |||
2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 | # define mkdir(path,mode) _mkdir(path) # define lstat(path,buf) stat(path,buf) #endif #include <time.h> #include <errno.h> #define FSDIR_SCHEMA "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)" /* ** Set the result stored by context ctx to a blob containing the | > > > > > > > > > > > | > > > > > > > | > > | > > > > > > > > > > | | > > > > > | > | 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 | # define mkdir(path,mode) _mkdir(path) # define lstat(path,buf) stat(path,buf) #endif #include <time.h> #include <errno.h> /* ** Structure of the fsdir() table-valued function */ /* 0 1 2 3 4 5 */ #define FSDIR_SCHEMA "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)" #define FSDIR_COLUMN_NAME 0 /* Name of the file */ #define FSDIR_COLUMN_MODE 1 /* Access mode */ #define FSDIR_COLUMN_MTIME 2 /* Last modification time */ #define FSDIR_COLUMN_DATA 3 /* File content */ #define FSDIR_COLUMN_PATH 4 /* Path to top of search */ #define FSDIR_COLUMN_DIR 5 /* Path is relative to this directory */ /* ** Set the result stored by context ctx to a blob containing the ** contents of file zName. Or, leave the result unchanged (NULL) ** if the file does not exist or is unreadable. ** ** If the file exceeds the SQLite blob size limit, through an ** SQLITE_TOOBIG error. ** ** Throw an SQLITE_IOERR if there are difficulties pulling the file ** off of disk. */ static void readFileContents(sqlite3_context *ctx, const char *zName){ FILE *in; sqlite3_int64 nIn; void *pBuf; sqlite3 *db; int mxBlob; in = fopen(zName, "rb"); if( in==0 ){ /* File does not exist or is unreadable. Leave the result set to NULL. */ return; } fseek(in, 0, SEEK_END); nIn = ftell(in); rewind(in); db = sqlite3_context_db_handle(ctx); mxBlob = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1); if( nIn>mxBlob ){ sqlite3_result_error_code(ctx, SQLITE_TOOBIG); fclose(in); return; } pBuf = sqlite3_malloc64( nIn ? nIn : 1 ); if( pBuf==0 ){ sqlite3_result_error_nomem(ctx); fclose(in); return; } if( nIn==(sqlite3_int64)fread(pBuf, 1, (size_t)nIn, in) ){ sqlite3_result_blob64(ctx, pBuf, nIn, sqlite3_free); }else{ sqlite3_result_error_code(ctx, SQLITE_IOERR); sqlite3_free(pBuf); } fclose(in); } /* ** Implementation of the "readfile(X)" SQL function. The entire content |
︙ | ︙ | |||
2275 2276 2277 2278 2279 2280 2281 | #endif } /* ** Argument zFile is the name of a file that will be created and/or written ** by SQL function writefile(). This function ensures that the directory ** zFile will be written to exists, creating it if required. The permissions | | > | < | | 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 | #endif } /* ** Argument zFile is the name of a file that will be created and/or written ** by SQL function writefile(). This function ensures that the directory ** zFile will be written to exists, creating it if required. The permissions ** for any path components created by this function are set in accordance ** with the current umask. ** ** If an OOM condition is encountered, SQLITE_NOMEM is returned. Otherwise, ** SQLITE_OK is returned if the directory is successfully created, or ** SQLITE_ERROR otherwise. */ static int makeDirectory( const char *zFile ){ char *zCopy = sqlite3_mprintf("%s", zFile); int rc = SQLITE_OK; if( zCopy==0 ){ rc = SQLITE_NOMEM; }else{ int nCopy = (int)strlen(zCopy); int i = 1; while( rc==SQLITE_OK ){ struct stat sStat; int rc2; for(; zCopy[i]!='/' && i<nCopy; i++); if( i==nCopy ) break; zCopy[i] = '\0'; rc2 = fileStat(zCopy, &sStat); if( rc2!=0 ){ if( mkdir(zCopy, 0777) ) rc = SQLITE_ERROR; }else{ if( !S_ISDIR(sStat.st_mode) ) rc = SQLITE_ERROR; } zCopy[i] = '/'; i++; } |
︙ | ︙ | |||
2462 2463 2464 2465 2466 2467 2468 | } if( argc==4 ){ mtime = sqlite3_value_int64(argv[3]); } res = writeFile(context, zFile, argv[1], mode, mtime); if( res==1 && errno==ENOENT ){ | | | 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 | } if( argc==4 ){ mtime = sqlite3_value_int64(argv[3]); } res = writeFile(context, zFile, argv[1], mode, mtime); if( res==1 && errno==ENOENT ){ if( makeDirectory(zFile)==SQLITE_OK ){ res = writeFile(context, zFile, argv[1], mode, mtime); } } if( argc>2 && res!=0 ){ if( S_ISLNK(mode) ){ ctxErrorMsg(context, "failed to create symlink: %s", zFile); |
︙ | ︙ | |||
2653 2654 2655 2656 2657 2658 2659 | pCur->iRowid++; if( S_ISDIR(m) ){ /* Descend into this directory */ int iNew = pCur->iLvl + 1; FsdirLevel *pLvl; if( iNew>=pCur->nLvl ){ int nNew = iNew+1; | | | | 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 | pCur->iRowid++; if( S_ISDIR(m) ){ /* Descend into this directory */ int iNew = pCur->iLvl + 1; FsdirLevel *pLvl; if( iNew>=pCur->nLvl ){ int nNew = iNew+1; sqlite3_int64 nByte = nNew*sizeof(FsdirLevel); FsdirLevel *aNew = (FsdirLevel*)sqlite3_realloc64(pCur->aLvl, nByte); if( aNew==0 ) return SQLITE_NOMEM; memset(&aNew[pCur->nLvl], 0, sizeof(FsdirLevel)*(nNew-pCur->nLvl)); pCur->aLvl = aNew; pCur->nLvl = nNew; } pCur->iLvl = iNew; pLvl = &pCur->aLvl[iNew]; |
︙ | ︙ | |||
2713 2714 2715 2716 2717 2718 2719 | static int fsdirColumn( sqlite3_vtab_cursor *cur, /* The cursor */ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ int i /* Which column to return */ ){ fsdir_cursor *pCur = (fsdir_cursor*)cur; switch( i ){ | | | | | | | > > > > > > | 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 | static int fsdirColumn( sqlite3_vtab_cursor *cur, /* The cursor */ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ int i /* Which column to return */ ){ fsdir_cursor *pCur = (fsdir_cursor*)cur; switch( i ){ case FSDIR_COLUMN_NAME: { sqlite3_result_text(ctx, &pCur->zPath[pCur->nBase], -1, SQLITE_TRANSIENT); break; } case FSDIR_COLUMN_MODE: sqlite3_result_int64(ctx, pCur->sStat.st_mode); break; case FSDIR_COLUMN_MTIME: sqlite3_result_int64(ctx, pCur->sStat.st_mtime); break; case FSDIR_COLUMN_DATA: { mode_t m = pCur->sStat.st_mode; if( S_ISDIR(m) ){ sqlite3_result_null(ctx); #if !defined(_WIN32) && !defined(WIN32) }else if( S_ISLNK(m) ){ char aStatic[64]; char *aBuf = aStatic; sqlite3_int64 nBuf = 64; int n; while( 1 ){ n = readlink(pCur->zPath, aBuf, nBuf); if( n<nBuf ) break; if( aBuf!=aStatic ) sqlite3_free(aBuf); nBuf = nBuf*2; aBuf = sqlite3_malloc64(nBuf); if( aBuf==0 ){ sqlite3_result_error_nomem(ctx); return SQLITE_NOMEM; } } sqlite3_result_text(ctx, aBuf, n, SQLITE_TRANSIENT); if( aBuf!=aStatic ) sqlite3_free(aBuf); #endif }else{ readFileContents(ctx, pCur->zPath); } } case FSDIR_COLUMN_PATH: default: { /* The FSDIR_COLUMN_PATH and FSDIR_COLUMN_DIR are input parameters. ** always return their values as NULL */ break; } } return SQLITE_OK; } /* ** Return the rowid for the current row. In this implementation, the |
︙ | ︙ | |||
2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 | static int fsdirEof(sqlite3_vtab_cursor *cur){ fsdir_cursor *pCur = (fsdir_cursor*)cur; return (pCur->zPath==0); } /* ** xFilter callback. */ static int fsdirFilter( sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ const char *zDir = 0; | > > > | 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | static int fsdirEof(sqlite3_vtab_cursor *cur){ fsdir_cursor *pCur = (fsdir_cursor*)cur; return (pCur->zPath==0); } /* ** xFilter callback. ** ** idxNum==1 PATH parameter only ** idxNum==2 Both PATH and DIR supplied */ static int fsdirFilter( sqlite3_vtab_cursor *cur, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ const char *zDir = 0; |
︙ | ︙ | |||
2834 2835 2836 2837 2838 2839 2840 | ** that uses the generate_series virtual table. This routine needs to create ** a query plan for each invocation and compute an estimated cost for that ** plan. ** ** In this implementation idxNum is used to represent the ** query plan. idxStr is unused. ** | | | | < < | | > > < > > | > > > > > > > > | > > > > | > | > > > > > > > | > > | | | | | | | 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 | ** that uses the generate_series virtual table. This routine needs to create ** a query plan for each invocation and compute an estimated cost for that ** plan. ** ** In this implementation idxNum is used to represent the ** query plan. idxStr is unused. ** ** The query plan is represented by values of idxNum: ** ** (1) The path value is supplied by argv[0] ** (2) Path is in argv[0] and dir is in argv[1] */ static int fsdirBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ int i; /* Loop over constraints */ int idxPath = -1; /* Index in pIdxInfo->aConstraint of PATH= */ int idxDir = -1; /* Index in pIdxInfo->aConstraint of DIR= */ int seenPath = 0; /* True if an unusable PATH= constraint is seen */ int seenDir = 0; /* True if an unusable DIR= constraint is seen */ const struct sqlite3_index_constraint *pConstraint; (void)tab; pConstraint = pIdxInfo->aConstraint; for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){ if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; switch( pConstraint->iColumn ){ case FSDIR_COLUMN_PATH: { if( pConstraint->usable ){ idxPath = i; seenPath = 0; }else if( idxPath<0 ){ seenPath = 1; } break; } case FSDIR_COLUMN_DIR: { if( pConstraint->usable ){ idxDir = i; seenDir = 0; }else if( idxDir<0 ){ seenDir = 1; } break; } } } if( seenPath || seenDir ){ /* If input parameters are unusable, disallow this plan */ return SQLITE_CONSTRAINT; } if( idxPath<0 ){ pIdxInfo->idxNum = 0; /* The pIdxInfo->estimatedCost should have been initialized to a huge ** number. Leave it unchanged. */ pIdxInfo->estimatedRows = 0x7fffffff; }else{ pIdxInfo->aConstraintUsage[idxPath].omit = 1; pIdxInfo->aConstraintUsage[idxPath].argvIndex = 1; if( idxDir>=0 ){ pIdxInfo->aConstraintUsage[idxDir].omit = 1; pIdxInfo->aConstraintUsage[idxDir].argvIndex = 2; pIdxInfo->idxNum = 2; pIdxInfo->estimatedCost = 10.0; }else{ pIdxInfo->idxNum = 1; pIdxInfo->estimatedCost = 100.0; } } |
︙ | ︙ | |||
2906 2907 2908 2909 2910 2911 2912 | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ | | > | 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; int rc = sqlite3_create_module(db, "fsdir", &fsdirModule, 0); return rc; } #else /* SQLITE_OMIT_VIRTUALTABLE */ # define fsdirRegister(x) SQLITE_OK |
︙ | ︙ | |||
2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 | ** the DISTINCT and ORDER BY are recommended. ** ** This virtual table operates at the speed of human typing, and so there ** is no attempt to make it fast. Even a slow implementation will be much ** faster than any human can type. ** */ SQLITE_EXTENSION_INIT1 #include <assert.h> #include <string.h> #include <ctype.h> #ifndef SQLITE_OMIT_VIRTUALTABLE | > | 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 | ** the DISTINCT and ORDER BY are recommended. ** ** This virtual table operates at the speed of human typing, and so there ** is no attempt to make it fast. Even a slow implementation will be much ** faster than any human can type. ** */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <assert.h> #include <string.h> #include <ctype.h> #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ | ︙ | |||
3414 3415 3416 3417 3418 3419 3420 | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ | | > | 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 | 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0 /* xShadowName */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ int sqlite3CompletionVtabInit(sqlite3 *db){ int rc = SQLITE_OK; #ifndef SQLITE_OMIT_VIRTUALTABLE |
︙ | ︙ | |||
3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 | ** to read or write past the 1GB mark. This restriction might be lifted in ** future versions. For now, if you need a large database, then keep the ** database in a separate file. ** ** If the file being opened is not an appended database, then this shim is ** a pass-through into the default underlying VFS. **/ SQLITE_EXTENSION_INIT1 #include <string.h> #include <assert.h> /* The append mark at the end of the database is: ** ** Start-Of-SQLite3-NNNNNNNN | > | 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 | ** to read or write past the 1GB mark. This restriction might be lifted in ** future versions. For now, if you need a large database, then keep the ** database in a separate file. ** ** If the file being opened is not an appended database, then this shim is ** a pass-through into the default underlying VFS. **/ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <string.h> #include <assert.h> /* The append mark at the end of the database is: ** ** Start-Of-SQLite3-NNNNNNNN |
︙ | ︙ | |||
4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 | } #endif if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY; return rc; } /************************* End ../ext/misc/appendvfs.c ********************/ #ifdef SQLITE_HAVE_ZLIB /************************* Begin ../ext/misc/zipfile.c ******************/ /* ** 2017-12-26 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 | } #endif if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY; return rc; } /************************* End ../ext/misc/appendvfs.c ********************/ /************************* Begin ../ext/misc/memtrace.c ******************/ /* ** 2019-01-21 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file implements an extension that uses the SQLITE_CONFIG_MALLOC ** mechanism to add a tracing layer on top of SQLite. If this extension ** is registered prior to sqlite3_initialize(), it will cause all memory ** allocation activities to be logged on standard output, or to some other ** FILE specified by the initializer. ** ** This file needs to be compiled into the application that uses it. ** ** This extension is used to implement the --memtrace option of the ** command-line shell. */ #include <assert.h> #include <string.h> #include <stdio.h> /* The original memory allocation routines */ static sqlite3_mem_methods memtraceBase; static FILE *memtraceOut; /* Methods that trace memory allocations */ static void *memtraceMalloc(int n){ if( memtraceOut ){ fprintf(memtraceOut, "MEMTRACE: allocate %d bytes\n", memtraceBase.xRoundup(n)); } return memtraceBase.xMalloc(n); } static void memtraceFree(void *p){ if( p==0 ) return; if( memtraceOut ){ fprintf(memtraceOut, "MEMTRACE: free %d bytes\n", memtraceBase.xSize(p)); } memtraceBase.xFree(p); } static void *memtraceRealloc(void *p, int n){ if( p==0 ) return memtraceMalloc(n); if( n==0 ){ memtraceFree(p); return 0; } if( memtraceOut ){ fprintf(memtraceOut, "MEMTRACE: resize %d -> %d bytes\n", memtraceBase.xSize(p), memtraceBase.xRoundup(n)); } return memtraceBase.xRealloc(p, n); } static int memtraceSize(void *p){ return memtraceBase.xSize(p); } static int memtraceRoundup(int n){ return memtraceBase.xRoundup(n); } static int memtraceInit(void *p){ return memtraceBase.xInit(p); } static void memtraceShutdown(void *p){ memtraceBase.xShutdown(p); } /* The substitute memory allocator */ static sqlite3_mem_methods ersaztMethods = { memtraceMalloc, memtraceFree, memtraceRealloc, memtraceSize, memtraceRoundup, memtraceInit, memtraceShutdown, 0 }; /* Begin tracing memory allocations to out. */ int sqlite3MemTraceActivate(FILE *out){ int rc = SQLITE_OK; if( memtraceBase.xMalloc==0 ){ rc = sqlite3_config(SQLITE_CONFIG_GETMALLOC, &memtraceBase); if( rc==SQLITE_OK ){ rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &ersaztMethods); } } memtraceOut = out; return rc; } /* Deactivate memory tracing */ int sqlite3MemTraceDeactivate(void){ int rc = SQLITE_OK; if( memtraceBase.xMalloc!=0 ){ rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &memtraceBase); if( rc==SQLITE_OK ){ memset(&memtraceBase, 0, sizeof(memtraceBase)); } } memtraceOut = 0; return rc; } /************************* End ../ext/misc/memtrace.c ********************/ #ifdef SQLITE_HAVE_ZLIB /************************* Begin ../ext/misc/zipfile.c ******************/ /* ** 2017-12-26 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: |
︙ | ︙ | |||
4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 | ** Current limitations: ** ** * No support for encryption ** * No support for ZIP archives spanning multiple files ** * No support for zip64 extensions ** * Only the "inflate/deflate" (zlib) compression method is supported */ SQLITE_EXTENSION_INIT1 #include <stdio.h> #include <string.h> #include <assert.h> #include <zlib.h> | > | 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 | ** Current limitations: ** ** * No support for encryption ** * No support for ZIP archives spanning multiple files ** * No support for zip64 extensions ** * Only the "inflate/deflate" (zlib) compression method is supported */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <stdio.h> #include <string.h> #include <assert.h> #include <zlib.h> |
︙ | ︙ | |||
4373 4374 4375 4376 4377 4378 4379 | if( argc>3 ){ zFile = argv[3]; nFile = (int)strlen(zFile)+1; } rc = sqlite3_declare_vtab(db, ZIPFILE_SCHEMA); if( rc==SQLITE_OK ){ | | | 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 | if( argc>3 ){ zFile = argv[3]; nFile = (int)strlen(zFile)+1; } rc = sqlite3_declare_vtab(db, ZIPFILE_SCHEMA); if( rc==SQLITE_OK ){ pNew = (ZipfileTab*)sqlite3_malloc64((sqlite3_int64)nByte+nFile); if( pNew==0 ) return SQLITE_NOMEM; memset(pNew, 0, nByte+nFile); pNew->db = db; pNew->aBuffer = (u8*)&pNew[1]; if( zFile ){ pNew->zFile = (char*)&pNew->aBuffer[ZIPFILE_BUFFER_SIZE]; memcpy(pNew->zFile, zFile, nFile); |
︙ | ︙ | |||
4821 4822 4823 4824 4825 4826 4827 | aRead = pTab->aBuffer; rc = zipfileReadData(pFile, aRead, ZIPFILE_CDS_FIXED_SZ, iOff, pzErr); }else{ aRead = (u8*)&aBlob[iOff]; } if( rc==SQLITE_OK ){ | | | | 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 | aRead = pTab->aBuffer; rc = zipfileReadData(pFile, aRead, ZIPFILE_CDS_FIXED_SZ, iOff, pzErr); }else{ aRead = (u8*)&aBlob[iOff]; } if( rc==SQLITE_OK ){ sqlite3_int64 nAlloc; ZipfileEntry *pNew; int nFile = zipfileGetU16(&aRead[ZIPFILE_CDS_NFILE_OFF]); int nExtra = zipfileGetU16(&aRead[ZIPFILE_CDS_NFILE_OFF+2]); nExtra += zipfileGetU16(&aRead[ZIPFILE_CDS_NFILE_OFF+4]); nAlloc = sizeof(ZipfileEntry) + nExtra; if( aBlob ){ nAlloc += zipfileGetU32(&aRead[ZIPFILE_CDS_SZCOMPRESSED_OFF]); } pNew = (ZipfileEntry*)sqlite3_malloc64(nAlloc); if( pNew==0 ){ rc = SQLITE_NOMEM; }else{ memset(pNew, 0, sizeof(ZipfileEntry)); rc = zipfileReadCDS(aRead, &pNew->cds); if( rc!=SQLITE_OK ){ *pzErr = sqlite3_mprintf("failed to read CDS at offset %lld", iOff); |
︙ | ︙ | |||
4996 4997 4998 4999 5000 5001 5002 | ** case. */ static int zipfileDeflate( const u8 *aIn, int nIn, /* Input */ u8 **ppOut, int *pnOut, /* Output */ char **pzErr /* OUT: Error message */ ){ | > | > | > > > > > | < < < < < < < | 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 | ** case. */ static int zipfileDeflate( const u8 *aIn, int nIn, /* Input */ u8 **ppOut, int *pnOut, /* Output */ char **pzErr /* OUT: Error message */ ){ int rc = SQLITE_OK; sqlite3_int64 nAlloc; z_stream str; u8 *aOut; memset(&str, 0, sizeof(str)); str.next_in = (Bytef*)aIn; str.avail_in = nIn; deflateInit2(&str, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); nAlloc = deflateBound(&str, nIn); aOut = (u8*)sqlite3_malloc64(nAlloc); if( aOut==0 ){ rc = SQLITE_NOMEM; }else{ int res; str.next_out = aOut; str.avail_out = nAlloc; res = deflate(&str, Z_FINISH); if( res==Z_STREAM_END ){ *ppOut = aOut; *pnOut = (int)str.total_out; }else{ sqlite3_free(aOut); *pzErr = sqlite3_mprintf("zipfile: deflate() error"); rc = SQLITE_ERROR; |
︙ | ︙ | |||
5073 5074 5075 5076 5077 5078 5079 | int szFinal = pCDS->szUncompressed; if( szFinal>0 ){ u8 *aBuf; u8 *aFree = 0; if( pCsr->pCurrent->aData ){ aBuf = pCsr->pCurrent->aData; }else{ | | | 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 | int szFinal = pCDS->szUncompressed; if( szFinal>0 ){ u8 *aBuf; u8 *aFree = 0; if( pCsr->pCurrent->aData ){ aBuf = pCsr->pCurrent->aData; }else{ aBuf = aFree = sqlite3_malloc64(sz); if( aBuf==0 ){ rc = SQLITE_NOMEM; }else{ FILE *pFile = pCsr->pFile; if( pFile==0 ){ pFile = ((ZipfileTab*)(pCsr->base.pVtab))->pWriteFd; } |
︙ | ︙ | |||
5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 | ** xBestIndex callback. */ static int zipfileBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ int i; for(i=0; i<pIdxInfo->nConstraint; i++){ const struct sqlite3_index_constraint *pCons = &pIdxInfo->aConstraint[i]; | > > > | > | < < > | | | | | | < | < | 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 | ** xBestIndex callback. */ static int zipfileBestIndex( sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo ){ int i; int idx = -1; int unusable = 0; for(i=0; i<pIdxInfo->nConstraint; i++){ const struct sqlite3_index_constraint *pCons = &pIdxInfo->aConstraint[i]; if( pCons->iColumn!=ZIPFILE_F_COLUMN_IDX ) continue; if( pCons->usable==0 ){ unusable = 1; }else if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ ){ idx = i; } } if( idx>=0 ){ pIdxInfo->aConstraintUsage[idx].argvIndex = 1; pIdxInfo->aConstraintUsage[idx].omit = 1; pIdxInfo->estimatedCost = 1000.0; pIdxInfo->idxNum = 1; }else if( unusable ){ return SQLITE_CONSTRAINT; } return SQLITE_OK; } static ZipfileEntry *zipfileNewEntry(const char *zPath){ ZipfileEntry *pNew; pNew = sqlite3_malloc(sizeof(ZipfileEntry)); if( pNew ){ |
︙ | ︙ | |||
5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 | if( rc==SQLITE_OK ){ rc = zipfileGetMode(apVal[3], bIsDir, &mode, &pTab->base.zErrMsg); } if( rc==SQLITE_OK ){ zPath = (const char*)sqlite3_value_text(apVal[2]); nPath = (int)strlen(zPath); mTime = zipfileGetTime(apVal[4]); } if( rc==SQLITE_OK && bIsDir ){ /* For a directory, check that the last character in the path is a ** '/'. This appears to be required for compatibility with info-zip ** (the unzip command on unix). It does not create directories ** otherwise. */ if( zPath[nPath-1]!='/' ){ zFree = sqlite3_mprintf("%s/", zPath); if( zFree==0 ){ rc = SQLITE_NOMEM; } zPath = (const char*)zFree; | > | | 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 | if( rc==SQLITE_OK ){ rc = zipfileGetMode(apVal[3], bIsDir, &mode, &pTab->base.zErrMsg); } if( rc==SQLITE_OK ){ zPath = (const char*)sqlite3_value_text(apVal[2]); if( zPath==0 ) zPath = ""; nPath = (int)strlen(zPath); mTime = zipfileGetTime(apVal[4]); } if( rc==SQLITE_OK && bIsDir ){ /* For a directory, check that the last character in the path is a ** '/'. This appears to be required for compatibility with info-zip ** (the unzip command on unix). It does not create directories ** otherwise. */ if( zPath[nPath-1]!='/' ){ zFree = sqlite3_mprintf("%s/", zPath); if( zFree==0 ){ rc = SQLITE_NOMEM; } zPath = (const char*)zFree; nPath = (int)strlen(zPath); } } /* Check that we're not inserting a duplicate entry -OR- updating an ** entry with a path, thereby making it into a duplicate. */ if( (pOld==0 || bUpdate) && rc==SQLITE_OK ){ ZipfileEntry *p; |
︙ | ︙ | |||
5911 5912 5913 5914 5915 5916 5917 | ZipfileBuffer body; ZipfileBuffer cds; }; static int zipfileBufferGrow(ZipfileBuffer *pBuf, int nByte){ if( pBuf->n+nByte>pBuf->nAlloc ){ u8 *aNew; | | | | | 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 | ZipfileBuffer body; ZipfileBuffer cds; }; static int zipfileBufferGrow(ZipfileBuffer *pBuf, int nByte){ if( pBuf->n+nByte>pBuf->nAlloc ){ u8 *aNew; sqlite3_int64 nNew = pBuf->n ? pBuf->n*2 : 512; int nReq = pBuf->n + nByte; while( nNew<nReq ) nNew = nNew*2; aNew = sqlite3_realloc64(pBuf->a, nNew); if( aNew==0 ) return SQLITE_NOMEM; pBuf->a = aNew; pBuf->nAlloc = (int)nNew; } return SQLITE_OK; } /* ** xStep() callback for the zipfile() aggregate. This can be called in ** any of the following ways: |
︙ | ︙ | |||
6038 6039 6040 6041 6042 6043 6044 | /* Decode the "mtime" argument. */ e.mUnixTime = zipfileGetTime(pMtime); /* If this is a directory entry, ensure that there is exactly one '/' ** at the end of the path. Or, if this is not a directory and the path ** ends in '/' it is an error. */ if( bIsDir==0 ){ | | | < > | 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 | /* Decode the "mtime" argument. */ e.mUnixTime = zipfileGetTime(pMtime); /* If this is a directory entry, ensure that there is exactly one '/' ** at the end of the path. Or, if this is not a directory and the path ** ends in '/' it is an error. */ if( bIsDir==0 ){ if( nName>0 && zName[nName-1]=='/' ){ zErr = sqlite3_mprintf("non-directory name must not end with /"); rc = SQLITE_ERROR; goto zipfile_step_out; } }else{ if( nName==0 || zName[nName-1]!='/' ){ zName = zFree = sqlite3_mprintf("%s/", zName); if( zName==0 ){ rc = SQLITE_NOMEM; goto zipfile_step_out; } nName = (int)strlen(zName); }else{ while( nName>1 && zName[nName-2]=='/' ) nName--; } } /* Assemble the ZipfileEntry object for the new zip archive entry */ e.cds.iVersionMadeBy = ZIPFILE_NEWENTRY_MADEBY; |
︙ | ︙ | |||
6109 6110 6111 6112 6113 6114 6115 | /* ** xFinalize() callback for zipfile aggregate function. */ void zipfileFinal(sqlite3_context *pCtx){ ZipfileCtx *p; ZipfileEOCD eocd; | | | | | 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 | /* ** xFinalize() callback for zipfile aggregate function. */ void zipfileFinal(sqlite3_context *pCtx){ ZipfileCtx *p; ZipfileEOCD eocd; sqlite3_int64 nZip; u8 *aZip; p = (ZipfileCtx*)sqlite3_aggregate_context(pCtx, sizeof(ZipfileCtx)); if( p==0 ) return; if( p->nEntry>0 ){ memset(&eocd, 0, sizeof(eocd)); eocd.nEntry = (u16)p->nEntry; eocd.nEntryTotal = (u16)p->nEntry; eocd.nSize = p->cds.n; eocd.iOffset = p->body.n; nZip = p->body.n + p->cds.n + ZIPFILE_EOCD_FIXED_SZ; aZip = (u8*)sqlite3_malloc64(nZip); if( aZip==0 ){ sqlite3_result_error_nomem(pCtx); }else{ memcpy(aZip, p->body.a, p->body.n); memcpy(&aZip[p->body.n], p->cds.a, p->cds.n); zipfileSerializeEOCD(&eocd, &aZip[p->body.n + p->cds.n]); sqlite3_result_blob(pCtx, aZip, (int)nZip, zipfileFree); } } sqlite3_free(p->body.a); sqlite3_free(p->cds.a); } |
︙ | ︙ | |||
6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 | ** ****************************************************************************** ** ** Utility functions sqlar_compress() and sqlar_uncompress(). Useful ** for working with sqlar archives and used by the shell tool's built-in ** sqlar support. */ SQLITE_EXTENSION_INIT1 #include <zlib.h> /* ** Implementation of the "sqlar_compress(X)" SQL function. ** ** If the type of X is SQLITE_BLOB, and compressing that blob using | > | 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 | ** ****************************************************************************** ** ** Utility functions sqlar_compress() and sqlar_uncompress(). Useful ** for working with sqlar archives and used by the shell tool's built-in ** sqlar support. */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <zlib.h> /* ** Implementation of the "sqlar_compress(X)" SQL function. ** ** If the type of X is SQLITE_BLOB, and compressing that blob using |
︙ | ︙ | |||
6329 6330 6331 6332 6333 6334 6335 | ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* */ | | | > | 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 | ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* */ #if !defined(SQLITEEXPERT_H) #define SQLITEEXPERT_H 1 /* #include "sqlite3.h" */ typedef struct sqlite3expert sqlite3expert; /* ** Create a new sqlite3expert object. ** ** If successful, a pointer to the new object is returned and (*pzErr) set |
︙ | ︙ | |||
6483 6484 6485 6486 6487 6488 6489 | /* ** Free an (sqlite3expert*) handle and all associated resources. There ** should be one call to this function for each successful call to ** sqlite3-expert_new(). */ void sqlite3_expert_destroy(sqlite3expert*); | | > | 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 | /* ** Free an (sqlite3expert*) handle and all associated resources. There ** should be one call to this function for each successful call to ** sqlite3-expert_new(). */ void sqlite3_expert_destroy(sqlite3expert*); #endif /* !defined(SQLITEEXPERT_H) */ /************************* End ../ext/expert/sqlite3expert.h ********************/ /************************* Begin ../ext/expert/sqlite3expert.c ******************/ /* ** 2017 April 09 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* */ /* #include "sqlite3expert.h" */ #include <assert.h> #include <string.h> #include <stdio.h> #ifndef SQLITE_OMIT_VIRTUALTABLE /* typedef sqlite3_int64 i64; */ |
︙ | ︙ | |||
7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 | 0, /* xCommit - commit transaction */ 0, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ 0, /* xRename - rename the table */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ }; return sqlite3_create_module(p->dbv, "expert", &expertModule, (void*)p); } /* ** End of virtual table implementation. *************************************************************************/ | > | 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 | 0, /* xCommit - commit transaction */ 0, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ 0, /* xRename - rename the table */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ }; return sqlite3_create_module(p->dbv, "expert", &expertModule, (void*)p); } /* ** End of virtual table implementation. *************************************************************************/ |
︙ | ︙ | |||
8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 | sqlite3_free(p); } } #endif /* ifndef SQLITE_OMIT_VIRTUAL_TABLE */ /************************* End ../ext/expert/sqlite3expert.c ********************/ #if defined(SQLITE_ENABLE_SESSION) /* ** State information for a single open session */ typedef struct OpenSession OpenSession; struct OpenSession { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 | sqlite3_free(p); } } #endif /* ifndef SQLITE_OMIT_VIRTUAL_TABLE */ /************************* End ../ext/expert/sqlite3expert.c ********************/ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) /************************* Begin ../ext/misc/dbdata.c ******************/ /* ** 2019-04-17 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains an implementation of two eponymous virtual tables, ** "sqlite_dbdata" and "sqlite_dbptr". Both modules require that the ** "sqlite_dbpage" eponymous virtual table be available. ** ** SQLITE_DBDATA: ** sqlite_dbdata is used to extract data directly from a database b-tree ** page and its associated overflow pages, bypassing the b-tree layer. ** The table schema is equivalent to: ** ** CREATE TABLE sqlite_dbdata( ** pgno INTEGER, ** cell INTEGER, ** field INTEGER, ** value ANY, ** schema TEXT HIDDEN ** ); ** ** IMPORTANT: THE VIRTUAL TABLE SCHEMA ABOVE IS SUBJECT TO CHANGE. IN THE ** FUTURE NEW NON-HIDDEN COLUMNS MAY BE ADDED BETWEEN "value" AND ** "schema". ** ** Each page of the database is inspected. If it cannot be interpreted as ** a b-tree page, or if it is a b-tree page containing 0 entries, the ** sqlite_dbdata table contains no rows for that page. Otherwise, the ** table contains one row for each field in the record associated with ** each cell on the page. For intkey b-trees, the key value is stored in ** field -1. ** ** For example, for the database: ** ** CREATE TABLE t1(a, b); -- root page is page 2 ** INSERT INTO t1(rowid, a, b) VALUES(5, 'v', 'five'); ** INSERT INTO t1(rowid, a, b) VALUES(10, 'x', 'ten'); ** ** the sqlite_dbdata table contains, as well as from entries related to ** page 1, content equivalent to: ** ** INSERT INTO sqlite_dbdata(pgno, cell, field, value) VALUES ** (2, 0, -1, 5 ), ** (2, 0, 0, 'v' ), ** (2, 0, 1, 'five'), ** (2, 1, -1, 10 ), ** (2, 1, 0, 'x' ), ** (2, 1, 1, 'ten' ); ** ** If database corruption is encountered, this module does not report an ** error. Instead, it attempts to extract as much data as possible and ** ignores the corruption. ** ** SQLITE_DBPTR: ** The sqlite_dbptr table has the following schema: ** ** CREATE TABLE sqlite_dbptr( ** pgno INTEGER, ** child INTEGER, ** schema TEXT HIDDEN ** ); ** ** It contains one entry for each b-tree pointer between a parent and ** child page in the database. */ #if !defined(SQLITEINT_H) /* #include "sqlite3ext.h" */ /* typedef unsigned char u8; */ #endif SQLITE_EXTENSION_INIT1 #include <string.h> #include <assert.h> #define DBDATA_PADDING_BYTES 100 typedef struct DbdataTable DbdataTable; typedef struct DbdataCursor DbdataCursor; /* Cursor object */ struct DbdataCursor { sqlite3_vtab_cursor base; /* Base class. Must be first */ sqlite3_stmt *pStmt; /* For fetching database pages */ int iPgno; /* Current page number */ u8 *aPage; /* Buffer containing page */ int nPage; /* Size of aPage[] in bytes */ int nCell; /* Number of cells on aPage[] */ int iCell; /* Current cell number */ int bOnePage; /* True to stop after one page */ int szDb; sqlite3_int64 iRowid; /* Only for the sqlite_dbdata table */ u8 *pRec; /* Buffer containing current record */ int nRec; /* Size of pRec[] in bytes */ int nHdr; /* Size of header in bytes */ int iField; /* Current field number */ u8 *pHdrPtr; u8 *pPtr; sqlite3_int64 iIntkey; /* Integer key value */ }; /* Table object */ struct DbdataTable { sqlite3_vtab base; /* Base class. Must be first */ sqlite3 *db; /* The database connection */ sqlite3_stmt *pStmt; /* For fetching database pages */ int bPtr; /* True for sqlite3_dbptr table */ }; /* Column and schema definitions for sqlite_dbdata */ #define DBDATA_COLUMN_PGNO 0 #define DBDATA_COLUMN_CELL 1 #define DBDATA_COLUMN_FIELD 2 #define DBDATA_COLUMN_VALUE 3 #define DBDATA_COLUMN_SCHEMA 4 #define DBDATA_SCHEMA \ "CREATE TABLE x(" \ " pgno INTEGER," \ " cell INTEGER," \ " field INTEGER," \ " value ANY," \ " schema TEXT HIDDEN" \ ")" /* Column and schema definitions for sqlite_dbptr */ #define DBPTR_COLUMN_PGNO 0 #define DBPTR_COLUMN_CHILD 1 #define DBPTR_COLUMN_SCHEMA 2 #define DBPTR_SCHEMA \ "CREATE TABLE x(" \ " pgno INTEGER," \ " child INTEGER," \ " schema TEXT HIDDEN" \ ")" /* ** Connect to an sqlite_dbdata (pAux==0) or sqlite_dbptr (pAux!=0) virtual ** table. */ static int dbdataConnect( sqlite3 *db, void *pAux, int argc, const char *const*argv, sqlite3_vtab **ppVtab, char **pzErr ){ DbdataTable *pTab = 0; int rc = sqlite3_declare_vtab(db, pAux ? DBPTR_SCHEMA : DBDATA_SCHEMA); if( rc==SQLITE_OK ){ pTab = (DbdataTable*)sqlite3_malloc64(sizeof(DbdataTable)); if( pTab==0 ){ rc = SQLITE_NOMEM; }else{ memset(pTab, 0, sizeof(DbdataTable)); pTab->db = db; pTab->bPtr = (pAux!=0); } } *ppVtab = (sqlite3_vtab*)pTab; return rc; } /* ** Disconnect from or destroy a sqlite_dbdata or sqlite_dbptr virtual table. */ static int dbdataDisconnect(sqlite3_vtab *pVtab){ DbdataTable *pTab = (DbdataTable*)pVtab; if( pTab ){ sqlite3_finalize(pTab->pStmt); sqlite3_free(pVtab); } return SQLITE_OK; } /* ** This function interprets two types of constraints: ** ** schema=? ** pgno=? ** ** If neither are present, idxNum is set to 0. If schema=? is present, ** the 0x01 bit in idxNum is set. If pgno=? is present, the 0x02 bit ** in idxNum is set. ** ** If both parameters are present, schema is in position 0 and pgno in ** position 1. */ static int dbdataBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdx){ DbdataTable *pTab = (DbdataTable*)tab; int i; int iSchema = -1; int iPgno = -1; int colSchema = (pTab->bPtr ? DBPTR_COLUMN_SCHEMA : DBDATA_COLUMN_SCHEMA); for(i=0; i<pIdx->nConstraint; i++){ struct sqlite3_index_constraint *p = &pIdx->aConstraint[i]; if( p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ if( p->iColumn==colSchema ){ if( p->usable==0 ) return SQLITE_CONSTRAINT; iSchema = i; } if( p->iColumn==DBDATA_COLUMN_PGNO && p->usable ){ iPgno = i; } } } if( iSchema>=0 ){ pIdx->aConstraintUsage[iSchema].argvIndex = 1; pIdx->aConstraintUsage[iSchema].omit = 1; } if( iPgno>=0 ){ pIdx->aConstraintUsage[iPgno].argvIndex = 1 + (iSchema>=0); pIdx->aConstraintUsage[iPgno].omit = 1; pIdx->estimatedCost = 100; pIdx->estimatedRows = 50; if( pTab->bPtr==0 && pIdx->nOrderBy && pIdx->aOrderBy[0].desc==0 ){ int iCol = pIdx->aOrderBy[0].iColumn; if( pIdx->nOrderBy==1 ){ pIdx->orderByConsumed = (iCol==0 || iCol==1); }else if( pIdx->nOrderBy==2 && pIdx->aOrderBy[1].desc==0 && iCol==0 ){ pIdx->orderByConsumed = (pIdx->aOrderBy[1].iColumn==1); } } }else{ pIdx->estimatedCost = 100000000; pIdx->estimatedRows = 1000000000; } pIdx->idxNum = (iSchema>=0 ? 0x01 : 0x00) | (iPgno>=0 ? 0x02 : 0x00); return SQLITE_OK; } /* ** Open a new sqlite_dbdata or sqlite_dbptr cursor. */ static int dbdataOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ DbdataCursor *pCsr; pCsr = (DbdataCursor*)sqlite3_malloc64(sizeof(DbdataCursor)); if( pCsr==0 ){ return SQLITE_NOMEM; }else{ memset(pCsr, 0, sizeof(DbdataCursor)); pCsr->base.pVtab = pVTab; } *ppCursor = (sqlite3_vtab_cursor *)pCsr; return SQLITE_OK; } /* ** Restore a cursor object to the state it was in when first allocated ** by dbdataOpen(). */ static void dbdataResetCursor(DbdataCursor *pCsr){ DbdataTable *pTab = (DbdataTable*)(pCsr->base.pVtab); if( pTab->pStmt==0 ){ pTab->pStmt = pCsr->pStmt; }else{ sqlite3_finalize(pCsr->pStmt); } pCsr->pStmt = 0; pCsr->iPgno = 1; pCsr->iCell = 0; pCsr->iField = 0; pCsr->bOnePage = 0; sqlite3_free(pCsr->aPage); sqlite3_free(pCsr->pRec); pCsr->pRec = 0; pCsr->aPage = 0; } /* ** Close an sqlite_dbdata or sqlite_dbptr cursor. */ static int dbdataClose(sqlite3_vtab_cursor *pCursor){ DbdataCursor *pCsr = (DbdataCursor*)pCursor; dbdataResetCursor(pCsr); sqlite3_free(pCsr); return SQLITE_OK; } /* ** Utility methods to decode 16 and 32-bit big-endian unsigned integers. */ static unsigned int get_uint16(unsigned char *a){ return (a[0]<<8)|a[1]; } static unsigned int get_uint32(unsigned char *a){ return ((unsigned int)a[0]<<24) | ((unsigned int)a[1]<<16) | ((unsigned int)a[2]<<8) | ((unsigned int)a[3]); } /* ** Load page pgno from the database via the sqlite_dbpage virtual table. ** If successful, set (*ppPage) to point to a buffer containing the page ** data, (*pnPage) to the size of that buffer in bytes and return ** SQLITE_OK. In this case it is the responsibility of the caller to ** eventually free the buffer using sqlite3_free(). ** ** Or, if an error occurs, set both (*ppPage) and (*pnPage) to 0 and ** return an SQLite error code. */ static int dbdataLoadPage( DbdataCursor *pCsr, /* Cursor object */ unsigned int pgno, /* Page number of page to load */ u8 **ppPage, /* OUT: pointer to page buffer */ int *pnPage /* OUT: Size of (*ppPage) in bytes */ ){ int rc2; int rc = SQLITE_OK; sqlite3_stmt *pStmt = pCsr->pStmt; *ppPage = 0; *pnPage = 0; sqlite3_bind_int64(pStmt, 2, pgno); if( SQLITE_ROW==sqlite3_step(pStmt) ){ int nCopy = sqlite3_column_bytes(pStmt, 0); if( nCopy>0 ){ u8 *pPage; pPage = (u8*)sqlite3_malloc64(nCopy + DBDATA_PADDING_BYTES); if( pPage==0 ){ rc = SQLITE_NOMEM; }else{ const u8 *pCopy = sqlite3_column_blob(pStmt, 0); memcpy(pPage, pCopy, nCopy); memset(&pPage[nCopy], 0, DBDATA_PADDING_BYTES); } *ppPage = pPage; *pnPage = nCopy; } } rc2 = sqlite3_reset(pStmt); if( rc==SQLITE_OK ) rc = rc2; return rc; } /* ** Read a varint. Put the value in *pVal and return the number of bytes. */ static int dbdataGetVarint(const u8 *z, sqlite3_int64 *pVal){ sqlite3_int64 v = 0; int i; for(i=0; i<8; i++){ v = (v<<7) + (z[i]&0x7f); if( (z[i]&0x80)==0 ){ *pVal = v; return i+1; } } v = (v<<8) + (z[i]&0xff); *pVal = v; return 9; } /* ** Return the number of bytes of space used by an SQLite value of type ** eType. */ static int dbdataValueBytes(int eType){ switch( eType ){ case 0: case 8: case 9: case 10: case 11: return 0; case 1: return 1; case 2: return 2; case 3: return 3; case 4: return 4; case 5: return 6; case 6: case 7: return 8; default: if( eType>0 ){ return ((eType-12) / 2); } return 0; } } /* ** Load a value of type eType from buffer pData and use it to set the ** result of context object pCtx. */ static void dbdataValue( sqlite3_context *pCtx, int eType, u8 *pData, int nData ){ if( eType>=0 && dbdataValueBytes(eType)<=nData ){ switch( eType ){ case 0: case 10: case 11: sqlite3_result_null(pCtx); break; case 8: sqlite3_result_int(pCtx, 0); break; case 9: sqlite3_result_int(pCtx, 1); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: { sqlite3_uint64 v = (signed char)pData[0]; pData++; switch( eType ){ case 7: case 6: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; case 5: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; case 4: v = (v<<8) + pData[0]; pData++; case 3: v = (v<<8) + pData[0]; pData++; case 2: v = (v<<8) + pData[0]; pData++; } if( eType==7 ){ double r; memcpy(&r, &v, sizeof(r)); sqlite3_result_double(pCtx, r); }else{ sqlite3_result_int64(pCtx, (sqlite3_int64)v); } break; } default: { int n = ((eType-12) / 2); if( eType % 2 ){ sqlite3_result_text(pCtx, (const char*)pData, n, SQLITE_TRANSIENT); }else{ sqlite3_result_blob(pCtx, pData, n, SQLITE_TRANSIENT); } } } } } /* ** Move an sqlite_dbdata or sqlite_dbptr cursor to the next entry. */ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ DbdataCursor *pCsr = (DbdataCursor*)pCursor; DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; pCsr->iRowid++; while( 1 ){ int rc; int iOff = (pCsr->iPgno==1 ? 100 : 0); int bNextPage = 0; if( pCsr->aPage==0 ){ while( 1 ){ if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK; rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage); if( rc!=SQLITE_OK ) return rc; if( pCsr->aPage ) break; pCsr->iPgno++; } pCsr->iCell = pTab->bPtr ? -2 : 0; pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]); } if( pTab->bPtr ){ if( pCsr->aPage[iOff]!=0x02 && pCsr->aPage[iOff]!=0x05 ){ pCsr->iCell = pCsr->nCell; } pCsr->iCell++; if( pCsr->iCell>=pCsr->nCell ){ sqlite3_free(pCsr->aPage); pCsr->aPage = 0; if( pCsr->bOnePage ) return SQLITE_OK; pCsr->iPgno++; }else{ return SQLITE_OK; } }else{ /* If there is no record loaded, load it now. */ if( pCsr->pRec==0 ){ int bHasRowid = 0; int nPointer = 0; sqlite3_int64 nPayload = 0; sqlite3_int64 nHdr = 0; int iHdr; int U, X; int nLocal; switch( pCsr->aPage[iOff] ){ case 0x02: nPointer = 4; break; case 0x0a: break; case 0x0d: bHasRowid = 1; break; default: /* This is not a b-tree page with records on it. Continue. */ pCsr->iCell = pCsr->nCell; break; } if( pCsr->iCell>=pCsr->nCell ){ bNextPage = 1; }else{ iOff += 8 + nPointer + pCsr->iCell*2; if( iOff>pCsr->nPage ){ bNextPage = 1; }else{ iOff = get_uint16(&pCsr->aPage[iOff]); } /* For an interior node cell, skip past the child-page number */ iOff += nPointer; /* Load the "byte of payload including overflow" field */ if( bNextPage || iOff>pCsr->nPage ){ bNextPage = 1; }else{ iOff += dbdataGetVarint(&pCsr->aPage[iOff], &nPayload); } /* If this is a leaf intkey cell, load the rowid */ if( bHasRowid && !bNextPage && iOff<pCsr->nPage ){ iOff += dbdataGetVarint(&pCsr->aPage[iOff], &pCsr->iIntkey); } /* Figure out how much data to read from the local page */ U = pCsr->nPage; if( bHasRowid ){ X = U-35; }else{ X = ((U-12)*64/255)-23; } if( nPayload<=X ){ nLocal = nPayload; }else{ int M, K; M = ((U-12)*32/255)-23; K = M+((nPayload-M)%(U-4)); if( K<=X ){ nLocal = K; }else{ nLocal = M; } } if( bNextPage || nLocal+iOff>pCsr->nPage ){ bNextPage = 1; }else{ /* Allocate space for payload. And a bit more to catch small buffer ** overruns caused by attempting to read a varint or similar from ** near the end of a corrupt record. */ pCsr->pRec = (u8*)sqlite3_malloc64(nPayload+DBDATA_PADDING_BYTES); if( pCsr->pRec==0 ) return SQLITE_NOMEM; memset(pCsr->pRec, 0, nPayload+DBDATA_PADDING_BYTES); pCsr->nRec = nPayload; /* Load the nLocal bytes of payload */ memcpy(pCsr->pRec, &pCsr->aPage[iOff], nLocal); iOff += nLocal; /* Load content from overflow pages */ if( nPayload>nLocal ){ sqlite3_int64 nRem = nPayload - nLocal; unsigned int pgnoOvfl = get_uint32(&pCsr->aPage[iOff]); while( nRem>0 ){ u8 *aOvfl = 0; int nOvfl = 0; int nCopy; rc = dbdataLoadPage(pCsr, pgnoOvfl, &aOvfl, &nOvfl); assert( rc!=SQLITE_OK || aOvfl==0 || nOvfl==pCsr->nPage ); if( rc!=SQLITE_OK ) return rc; if( aOvfl==0 ) break; nCopy = U-4; if( nCopy>nRem ) nCopy = nRem; memcpy(&pCsr->pRec[nPayload-nRem], &aOvfl[4], nCopy); nRem -= nCopy; pgnoOvfl = get_uint32(aOvfl); sqlite3_free(aOvfl); } } iHdr = dbdataGetVarint(pCsr->pRec, &nHdr); pCsr->nHdr = nHdr; pCsr->pHdrPtr = &pCsr->pRec[iHdr]; pCsr->pPtr = &pCsr->pRec[pCsr->nHdr]; pCsr->iField = (bHasRowid ? -1 : 0); } } }else{ pCsr->iField++; if( pCsr->iField>0 ){ sqlite3_int64 iType; if( pCsr->pHdrPtr>&pCsr->pRec[pCsr->nRec] ){ bNextPage = 1; }else{ pCsr->pHdrPtr += dbdataGetVarint(pCsr->pHdrPtr, &iType); pCsr->pPtr += dbdataValueBytes(iType); } } } if( bNextPage ){ sqlite3_free(pCsr->aPage); sqlite3_free(pCsr->pRec); pCsr->aPage = 0; pCsr->pRec = 0; if( pCsr->bOnePage ) return SQLITE_OK; pCsr->iPgno++; }else{ if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->pRec[pCsr->nHdr] ){ return SQLITE_OK; } /* Advance to the next cell. The next iteration of the loop will load ** the record and so on. */ sqlite3_free(pCsr->pRec); pCsr->pRec = 0; pCsr->iCell++; } } } assert( !"can't get here" ); return SQLITE_OK; } /* ** Return true if the cursor is at EOF. */ static int dbdataEof(sqlite3_vtab_cursor *pCursor){ DbdataCursor *pCsr = (DbdataCursor*)pCursor; return pCsr->aPage==0; } /* ** Determine the size in pages of database zSchema (where zSchema is ** "main", "temp" or the name of an attached database) and set ** pCsr->szDb accordingly. If successful, return SQLITE_OK. Otherwise, ** an SQLite error code. */ static int dbdataDbsize(DbdataCursor *pCsr, const char *zSchema){ DbdataTable *pTab = (DbdataTable*)pCsr->base.pVtab; char *zSql = 0; int rc, rc2; sqlite3_stmt *pStmt = 0; zSql = sqlite3_mprintf("PRAGMA %Q.page_count", zSchema); if( zSql==0 ) return SQLITE_NOMEM; rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ pCsr->szDb = sqlite3_column_int(pStmt, 0); } rc2 = sqlite3_finalize(pStmt); if( rc==SQLITE_OK ) rc = rc2; return rc; } /* ** xFilter method for sqlite_dbdata and sqlite_dbptr. */ static int dbdataFilter( sqlite3_vtab_cursor *pCursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv ){ DbdataCursor *pCsr = (DbdataCursor*)pCursor; DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; int rc = SQLITE_OK; const char *zSchema = "main"; dbdataResetCursor(pCsr); assert( pCsr->iPgno==1 ); if( idxNum & 0x01 ){ zSchema = (const char*)sqlite3_value_text(argv[0]); } if( idxNum & 0x02 ){ pCsr->iPgno = sqlite3_value_int(argv[(idxNum & 0x01)]); pCsr->bOnePage = 1; }else{ pCsr->nPage = dbdataDbsize(pCsr, zSchema); rc = dbdataDbsize(pCsr, zSchema); } if( rc==SQLITE_OK ){ if( pTab->pStmt ){ pCsr->pStmt = pTab->pStmt; pTab->pStmt = 0; }else{ rc = sqlite3_prepare_v2(pTab->db, "SELECT data FROM sqlite_dbpage(?) WHERE pgno=?", -1, &pCsr->pStmt, 0 ); } } if( rc==SQLITE_OK ){ rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT); }else{ pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db)); } if( rc==SQLITE_OK ){ rc = dbdataNext(pCursor); } return rc; } /* ** Return a column for the sqlite_dbdata or sqlite_dbptr table. */ static int dbdataColumn( sqlite3_vtab_cursor *pCursor, sqlite3_context *ctx, int i ){ DbdataCursor *pCsr = (DbdataCursor*)pCursor; DbdataTable *pTab = (DbdataTable*)pCursor->pVtab; if( pTab->bPtr ){ switch( i ){ case DBPTR_COLUMN_PGNO: sqlite3_result_int64(ctx, pCsr->iPgno); break; case DBPTR_COLUMN_CHILD: { int iOff = pCsr->iPgno==1 ? 100 : 0; if( pCsr->iCell<0 ){ iOff += 8; }else{ iOff += 12 + pCsr->iCell*2; if( iOff>pCsr->nPage ) return SQLITE_OK; iOff = get_uint16(&pCsr->aPage[iOff]); } if( iOff<=pCsr->nPage ){ sqlite3_result_int64(ctx, get_uint32(&pCsr->aPage[iOff])); } break; } } }else{ switch( i ){ case DBDATA_COLUMN_PGNO: sqlite3_result_int64(ctx, pCsr->iPgno); break; case DBDATA_COLUMN_CELL: sqlite3_result_int(ctx, pCsr->iCell); break; case DBDATA_COLUMN_FIELD: sqlite3_result_int(ctx, pCsr->iField); break; case DBDATA_COLUMN_VALUE: { if( pCsr->iField<0 ){ sqlite3_result_int64(ctx, pCsr->iIntkey); }else{ sqlite3_int64 iType; dbdataGetVarint(pCsr->pHdrPtr, &iType); dbdataValue( ctx, iType, pCsr->pPtr, &pCsr->pRec[pCsr->nRec] - pCsr->pPtr ); } break; } } } return SQLITE_OK; } /* ** Return the rowid for an sqlite_dbdata or sqlite_dptr table. */ static int dbdataRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ DbdataCursor *pCsr = (DbdataCursor*)pCursor; *pRowid = pCsr->iRowid; return SQLITE_OK; } /* ** Invoke this routine to register the "sqlite_dbdata" virtual table module */ static int sqlite3DbdataRegister(sqlite3 *db){ static sqlite3_module dbdata_module = { 0, /* iVersion */ 0, /* xCreate */ dbdataConnect, /* xConnect */ dbdataBestIndex, /* xBestIndex */ dbdataDisconnect, /* xDisconnect */ 0, /* xDestroy */ dbdataOpen, /* xOpen - open a cursor */ dbdataClose, /* xClose - close a cursor */ dbdataFilter, /* xFilter - configure scan constraints */ dbdataNext, /* xNext - advance a cursor */ dbdataEof, /* xEof - check for end of scan */ dbdataColumn, /* xColumn - read data */ dbdataRowid, /* xRowid - read data */ 0, /* xUpdate */ 0, /* xBegin */ 0, /* xSync */ 0, /* xCommit */ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0 /* xShadowName */ }; int rc = sqlite3_create_module(db, "sqlite_dbdata", &dbdata_module, 0); if( rc==SQLITE_OK ){ rc = sqlite3_create_module(db, "sqlite_dbptr", &dbdata_module, (void*)1); } return rc; } #ifdef _WIN32 #endif int sqlite3_dbdata_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi); return sqlite3DbdataRegister(db); } /************************* End ../ext/misc/dbdata.c ********************/ #endif #if defined(SQLITE_ENABLE_SESSION) /* ** State information for a single open session */ typedef struct OpenSession OpenSession; struct OpenSession { |
︙ | ︙ | |||
8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 | */ typedef struct ShellState ShellState; struct ShellState { sqlite3 *db; /* The database */ u8 autoExplain; /* Automatically turn on .explain mode */ u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */ u8 autoEQPtest; /* autoEQP is in test mode */ u8 statsOn; /* True to display memory stats before each finalize */ u8 scanstatsOn; /* True to display scan stats before each finalize */ u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */ u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */ u8 nEqpLevel; /* Depth of the EQP output graph */ unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */ int outCount; /* Revert to stdout when reaching zero */ int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ FILE *traceOut; /* Output for sqlite3_trace() */ int nErr; /* Number of errors seen */ int mode; /* An output mode setting */ int modePrior; /* Saved mode */ int cMode; /* temporary output mode for the current query */ int normalMode; /* Output mode before ".explain on" */ int writableSchema; /* True if PRAGMA writable_schema=ON */ int showHeader; /* True to show column names in List or Column mode */ int nCheck; /* Number of ".check" commands run */ unsigned shellFlgs; /* Various flags */ char *zDestTable; /* Name of destination table when MODE_Insert */ char *zTempFile; /* Temporary file that might need deleting */ char zTestcase[30]; /* Name of current test case */ char colSeparator[20]; /* Column separator character for several modes */ char rowSeparator[20]; /* Row separator character for MODE_Ascii */ char colSepPrior[20]; /* Saved column separator */ char rowSepPrior[20]; /* Saved row separator */ | > > > > > > > > > | 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 | */ typedef struct ShellState ShellState; struct ShellState { sqlite3 *db; /* The database */ u8 autoExplain; /* Automatically turn on .explain mode */ u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */ u8 autoEQPtest; /* autoEQP is in test mode */ u8 autoEQPtrace; /* autoEQP is in trace mode */ u8 statsOn; /* True to display memory stats before each finalize */ u8 scanstatsOn; /* True to display scan stats before each finalize */ u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */ u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */ u8 nEqpLevel; /* Depth of the EQP output graph */ u8 eTraceType; /* SHELL_TRACE_* value for type of trace */ unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */ int outCount; /* Revert to stdout when reaching zero */ int cnt; /* Number of records displayed so far */ int lineno; /* Line number of last line read from in */ int openFlags; /* Additional flags to open. (SQLITE_OPEN_NOFOLLOW) */ FILE *in; /* Read commands from this stream */ FILE *out; /* Write results here */ FILE *traceOut; /* Output for sqlite3_trace() */ int nErr; /* Number of errors seen */ int mode; /* An output mode setting */ int modePrior; /* Saved mode */ int cMode; /* temporary output mode for the current query */ int normalMode; /* Output mode before ".explain on" */ int writableSchema; /* True if PRAGMA writable_schema=ON */ int showHeader; /* True to show column names in List or Column mode */ int nCheck; /* Number of ".check" commands run */ unsigned nProgress; /* Number of progress callbacks encountered */ unsigned mxProgress; /* Maximum progress callbacks before failing */ unsigned flgProgress; /* Flags for the progress callback */ unsigned shellFlgs; /* Various flags */ sqlite3_int64 szMax; /* --maxsize argument to .open */ char *zDestTable; /* Name of destination table when MODE_Insert */ char *zTempFile; /* Temporary file that might need deleting */ char zTestcase[30]; /* Name of current test case */ char colSeparator[20]; /* Column separator character for several modes */ char rowSeparator[20]; /* Row separator character for MODE_Ascii */ char colSepPrior[20]; /* Saved column separator */ char rowSepPrior[20]; /* Saved row separator */ |
︙ | ︙ | |||
8556 8557 8558 8559 8560 8561 8562 | #define AUTOEQP_off 0 /* Automatic EXPLAIN QUERY PLAN is off */ #define AUTOEQP_on 1 /* Automatic EQP is on */ #define AUTOEQP_trigger 2 /* On and also show plans for triggers */ #define AUTOEQP_full 3 /* Show full EXPLAIN */ /* Allowed values for ShellState.openMode */ | | | | | | > > > > > > > > > > > > > > > | 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 | #define AUTOEQP_off 0 /* Automatic EXPLAIN QUERY PLAN is off */ #define AUTOEQP_on 1 /* Automatic EQP is on */ #define AUTOEQP_trigger 2 /* On and also show plans for triggers */ #define AUTOEQP_full 3 /* Show full EXPLAIN */ /* Allowed values for ShellState.openMode */ #define SHELL_OPEN_UNSPEC 0 /* No open-mode specified */ #define SHELL_OPEN_NORMAL 1 /* Normal database file */ #define SHELL_OPEN_APPENDVFS 2 /* Use appendvfs */ #define SHELL_OPEN_ZIPFILE 3 /* Use the zipfile virtual table */ #define SHELL_OPEN_READONLY 4 /* Open a normal database read-only */ #define SHELL_OPEN_DESERIALIZE 5 /* Open using sqlite3_deserialize() */ #define SHELL_OPEN_HEXDB 6 /* Use "dbtotxt" output as data source */ /* Allowed values for ShellState.eTraceType */ #define SHELL_TRACE_PLAIN 0 /* Show input SQL text */ #define SHELL_TRACE_EXPANDED 1 /* Show expanded SQL text */ #define SHELL_TRACE_NORMALIZED 2 /* Show normalized SQL text */ /* Bits in the ShellState.flgProgress variable */ #define SHELL_PROGRESS_QUIET 0x01 /* Omit announcing every progress callback */ #define SHELL_PROGRESS_RESET 0x02 /* Reset the count when the progres ** callback limit is reached, and for each ** top-level SQL statement */ #define SHELL_PROGRESS_ONCE 0x04 /* Cancel the --limit after firing once */ /* ** These are the allowed shellFlgs values */ #define SHFLG_Pagecache 0x00000001 /* The --pagecache option is used */ #define SHFLG_Lookaside 0x00000002 /* Lookaside memory is used */ #define SHFLG_Backslash 0x00000004 /* The --backslash option is used */ |
︙ | ︙ | |||
8722 8723 8724 8725 8726 8727 8728 | f = fopen(zTempFile, bBin ? "wb" : "w"); if( f==0 ){ sqlite3_result_error(context, "edit() cannot open temp file", -1); goto edit_func_end; } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ | | | | 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 | f = fopen(zTempFile, bBin ? "wb" : "w"); if( f==0 ){ sqlite3_result_error(context, "edit() cannot open temp file", -1); goto edit_func_end; } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ x = fwrite(sqlite3_value_blob(argv[0]), 1, (size_t)sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f); } fclose(f); f = 0; if( x!=sz ){ sqlite3_result_error(context, "edit() could not write the whole file", -1); goto edit_func_end; } |
︙ | ︙ | |||
8755 8756 8757 8758 8759 8760 8761 | sqlite3_result_error(context, "edit() cannot reopen temp file after edit", -1); goto edit_func_end; } fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); | | | | | 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 | sqlite3_result_error(context, "edit() cannot reopen temp file after edit", -1); goto edit_func_end; } fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); p = sqlite3_malloc64( sz+1 ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } x = fread(p, 1, (size_t)sz, f); fclose(f); f = 0; if( x!=sz ){ sqlite3_result_error(context, "could not read back the whole file", -1); goto edit_func_end; } if( bBin ){ sqlite3_result_blob64(context, p, sz, sqlite3_free); }else{ sqlite3_int64 i, j; if( hasCRNL ){ /* If the original contains \r\n then do no conversions back to \n */ j = sz; }else{ /* If the file did not originally contain \r\n then convert any new ** \r\n back into \n */ for(i=j=0; i<sz; i++){ |
︙ | ︙ | |||
9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 | /* ** Print a schema statement. Part of MODE_Semi and MODE_Pretty output. ** ** This routine converts some CREATE TABLE statements for shadow tables ** in FTS3/4/5 into CREATE TABLE IF NOT EXISTS statements. */ static void printSchemaLine(FILE *out, const char *z, const char *zTail){ if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){ utf8_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail); }else{ utf8_printf(out, "%s%s", z, zTail); } } static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){ | > > | 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 | /* ** Print a schema statement. Part of MODE_Semi and MODE_Pretty output. ** ** This routine converts some CREATE TABLE statements for shadow tables ** in FTS3/4/5 into CREATE TABLE IF NOT EXISTS statements. */ static void printSchemaLine(FILE *out, const char *z, const char *zTail){ if( z==0 ) return; if( zTail==0 ) return; if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){ utf8_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail); }else{ utf8_printf(out, "%s%s", z, zTail); } } static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){ |
︙ | ︙ | |||
9230 9231 9232 9233 9234 9235 9236 | static void eqp_render_level(ShellState *p, int iEqpId){ EQPGraphRow *pRow, *pNext; int n = strlen30(p->sGraph.zPrefix); char *z; for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; | | > | 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 | static void eqp_render_level(ShellState *p, int iEqpId){ EQPGraphRow *pRow, *pNext; int n = strlen30(p->sGraph.zPrefix); char *z; for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); if( n<(int)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); p->sGraph.zPrefix[n] = 0; } } } |
︙ | ︙ | |||
9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 | } p->sGraph.zPrefix[0] = 0; eqp_render_level(p, 0); eqp_reset(p); } } /* ** This is the callback routine that the shell ** invokes for each row of a query result. */ static int shell_callback( void *pArg, int nArg, /* Number of result columns */ | > > > > > > > > > > > > > > > > > > > > | 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 | } p->sGraph.zPrefix[0] = 0; eqp_render_level(p, 0); eqp_reset(p); } } #ifndef SQLITE_OMIT_PROGRESS_CALLBACK /* ** Progress handler callback. */ static int progress_handler(void *pClientData) { ShellState *p = (ShellState*)pClientData; p->nProgress++; if( p->nProgress>=p->mxProgress && p->mxProgress>0 ){ raw_printf(p->out, "Progress limit reached (%u)\n", p->nProgress); if( p->flgProgress & SHELL_PROGRESS_RESET ) p->nProgress = 0; if( p->flgProgress & SHELL_PROGRESS_ONCE ) p->mxProgress = 0; return 1; } if( (p->flgProgress & SHELL_PROGRESS_QUIET)==0 ){ raw_printf(p->out, "Progress %u\n", p->nProgress); } return 0; } #endif /* SQLITE_OMIT_PROGRESS_CALLBACK */ /* ** This is the callback routine that the shell ** invokes for each row of a query result. */ static int shell_callback( void *pArg, int nArg, /* Number of result columns */ |
︙ | ︙ | |||
9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 | } case MODE_Explain: case MODE_Column: { static const int aExplainWidths[] = {4, 13, 4, 4, 4, 13, 2, 13}; const int *colWidth; int showHdr; char *rowSep; if( p->cMode==MODE_Column ){ colWidth = p->colWidth; showHdr = p->showHeader; rowSep = p->rowSeparator; }else{ colWidth = aExplainWidths; showHdr = 1; rowSep = SEP_Row; } if( p->cnt++==0 ){ for(i=0; i<nArg; i++){ int w, n; | > > > | | 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 | } case MODE_Explain: case MODE_Column: { static const int aExplainWidths[] = {4, 13, 4, 4, 4, 13, 2, 13}; const int *colWidth; int showHdr; char *rowSep; int nWidth; if( p->cMode==MODE_Column ){ colWidth = p->colWidth; nWidth = ArraySize(p->colWidth); showHdr = p->showHeader; rowSep = p->rowSeparator; }else{ colWidth = aExplainWidths; nWidth = ArraySize(aExplainWidths); showHdr = 1; rowSep = SEP_Row; } if( p->cnt++==0 ){ for(i=0; i<nArg; i++){ int w, n; if( i<nWidth ){ w = colWidth[i]; }else{ w = 0; } if( w==0 ){ w = strlenChar(azCol[i] ? azCol[i] : ""); if( w<10 ) w = 10; |
︙ | ︙ | |||
9401 9402 9403 9404 9405 9406 9407 | j--; } z[j++] = c; } while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ | | | 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 | j--; } z[j++] = c; } while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */ if( c==cEnd ){ cEnd = 0; }else if( c=='"' || c=='\'' || c=='`' ){ cEnd = c; }else if( c=='[' ){ cEnd = ']'; }else if( c=='-' && z[i+1]=='-' ){ |
︙ | ︙ | |||
9980 9981 9982 9983 9984 9985 9986 | raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset); raw_printf(pArg->out, "Sort Operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset); raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); | | | 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 | raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset); raw_printf(pArg->out, "Sort Operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset); raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); raw_printf(pArg->out, "Number of times run: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_MEMUSED, bReset); raw_printf(pArg->out, "Memory used by prepared stmt: %d\n", iCur); } |
︙ | ︙ | |||
10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 | #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE) sqlite3SelectTrace = savedSelectTrace; #endif #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE) sqlite3WhereTrace = savedWhereTrace; #endif } /* ** Run a prepared statement */ static void exec_prepared_stmt( ShellState *pArg, /* Pointer to ShellState */ sqlite3_stmt *pStmt /* Statment to run */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 | #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE) sqlite3SelectTrace = savedSelectTrace; #endif #if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE) sqlite3WhereTrace = savedWhereTrace; #endif } /* Create the TEMP table used to store parameter bindings */ static void bind_table_init(ShellState *p){ int wrSchema = 0; sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); sqlite3_exec(p->db, "CREATE TABLE IF NOT EXISTS temp.sqlite_parameters(\n" " key TEXT PRIMARY KEY,\n" " value ANY\n" ") WITHOUT ROWID;", 0, 0, 0); sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); } /* ** Bind parameters on a prepared statement. ** ** Parameter bindings are taken from a TEMP table of the form: ** ** CREATE TEMP TABLE sqlite_parameters(key TEXT PRIMARY KEY, value) ** WITHOUT ROWID; ** ** No bindings occur if this table does not exist. The special character '$' ** is included in the table name to help prevent collisions with actual tables. ** The table must be in the TEMP schema. */ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){ int nVar; int i; int rc; sqlite3_stmt *pQ = 0; nVar = sqlite3_bind_parameter_count(pStmt); if( nVar==0 ) return; /* Nothing to do */ if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters", "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){ return; /* Parameter table does not exist */ } rc = sqlite3_prepare_v2(pArg->db, "SELECT value FROM temp.sqlite_parameters" " WHERE key=?1", -1, &pQ, 0); if( rc || pQ==0 ) return; for(i=1; i<=nVar; i++){ char zNum[30]; const char *zVar = sqlite3_bind_parameter_name(pStmt, i); if( zVar==0 ){ sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i); zVar = zNum; } sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC); if( sqlite3_step(pQ)==SQLITE_ROW ){ sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0)); }else{ sqlite3_bind_null(pStmt, i); } sqlite3_reset(pQ); } sqlite3_finalize(pQ); } /* ** Run a prepared statement */ static void exec_prepared_stmt( ShellState *pArg, /* Pointer to ShellState */ sqlite3_stmt *pStmt /* Statment to run */ |
︙ | ︙ | |||
10449 10450 10451 10452 10453 10454 10455 | /* echo the sql statement if echo on */ if( pArg && ShellHasFlag(pArg, SHFLG_Echo) ){ utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); } /* Show the EXPLAIN QUERY PLAN if .eqp is on */ | | | 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 | /* echo the sql statement if echo on */ if( pArg && ShellHasFlag(pArg, SHFLG_Echo) ){ utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); } /* Show the EXPLAIN QUERY PLAN if .eqp is on */ if( pArg && pArg->autoEQP && sqlite3_stmt_isexplain(pStmt)==0 ){ sqlite3_stmt *pExplain; char *zEQP; int triggerEQP = 0; disable_debug_trace_modes(); sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, -1, &triggerEQP); if( pArg->autoEQP>=AUTOEQP_trigger ){ sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0); |
︙ | ︙ | |||
10498 10499 10500 10501 10502 10503 10504 | } restore_debug_trace_modes(); } if( pArg ){ pArg->cMode = pArg->mode; if( pArg->autoExplain ){ | | < < | < > | 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 | } restore_debug_trace_modes(); } if( pArg ){ pArg->cMode = pArg->mode; if( pArg->autoExplain ){ if( sqlite3_stmt_isexplain(pStmt)==1 ){ pArg->cMode = MODE_Explain; } if( sqlite3_stmt_isexplain(pStmt)==2 ){ pArg->cMode = MODE_EQP; } } /* If the shell is currently in ".explain" mode, gather the extra ** data required to add indents to the output.*/ if( pArg->cMode==MODE_Explain ){ explain_data_prepare(pArg, pStmt); } } bind_prepared_stmt(pArg, pStmt); exec_prepared_stmt(pArg, pStmt); explain_data_delete(pArg); eqp_render(pArg); /* print usage stats if stats on */ if( pArg && pArg->statsOn ){ display_stats(db, pArg, 0); |
︙ | ︙ | |||
10832 10833 10834 10835 10836 10837 10838 | sqlite3_free(zErr); free(zQ2); } return rc; } /* | | > > > > > > | | > > > > > > > > > > > > > > > > > > | | | > | | | | | | | | | | < > > > | | | > > > > > > | | | < < | > > | | | | | | | | | | | > | | | | > | | | | | | | | | | | | > > | | | | > > > > > > > > | > | > > > > > > > > | > > > > > > > | | | > > > > > > > > | | | | > | | > > > | < | > > > > > > > > > > > > | > > > > > > > | > > > > > < < < < < | | > | < | | > | > > > > > > > > > > > > > > > > > > | | | | | > | > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > | < > > | < < > | < < > > > > > > | < < < < < < < < < < > > > > > > > > > > > > > | | | | | | 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 | sqlite3_free(zErr); free(zQ2); } return rc; } /* ** Text of help messages. ** ** The help text for each individual command begins with a line that starts ** with ".". Subsequent lines are supplimental information. ** ** There must be two or more spaces between the end of the command and the ** start of the description of what that command does. */ static const char *(azHelp[]) = { #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE) ".archive ... Manage SQL archives", " Each command must have exactly one of the following options:", " -c, --create Create a new archive", " -u, --update Add or update files with changed mtime", " -i, --insert Like -u but always add even if unchanged", " -t, --list List contents of archive", " -x, --extract Extract files from archive", " Optional arguments:", " -v, --verbose Print each filename as it is processed", " -f FILE, --file FILE Use archive FILE (default is current db)", " -a FILE, --append FILE Open FILE using the apndvfs VFS", " -C DIR, --directory DIR Read/extract files from directory DIR", " -n, --dryrun Show the SQL that would have occurred", " Examples:", " .ar -cf ARCHIVE foo bar # Create ARCHIVE from files foo and bar", " .ar -tf ARCHIVE # List members of ARCHIVE", " .ar -xvf ARCHIVE # Verbosely extract files from ARCHIVE", " See also:", " http://sqlite.org/cli.html#sqlar_archive_support", #endif #ifndef SQLITE_OMIT_AUTHORIZATION ".auth ON|OFF Show authorizer callbacks", #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", " --append Use the appendvfs", " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", ".binary on|off Turn binary output on or off. Default OFF", ".cd DIRECTORY Change the working directory to DIRECTORY", ".changes on|off Show number of rows changed by SQL", ".check GLOB Fail if output since .testcase does not match", ".clone NEWDB Clone data into NEWDB from the existing database", ".databases List names and files of attached databases", ".dbconfig ?op? ?val? List or change sqlite3_db_config() options", ".dbinfo ?DB? Show status information about the database", ".dump ?TABLE? ... Render all database content as SQL", " Options:", " --preserve-rowids Include ROWID values in the output", " --newlines Allow unescaped newline characters in output", " TABLE is a LIKE pattern for the tables to dump", ".echo on|off Turn command echo on or off", ".eqp on|off|full|... Enable or disable automatic EXPLAIN QUERY PLAN", " Other Modes:", #ifdef SQLITE_DEBUG " test Show raw EXPLAIN QUERY PLAN output", " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"", #endif " trigger Like \"full\" but also show trigger bytecode", ".excel Display the output of next command in spreadsheet", ".exit ?CODE? Exit this program with return-code CODE", ".expert EXPERIMENTAL. Suggest indexes for queries", ".explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto", ".filectrl CMD ... Run various sqlite3_file_control() operations", " Run \".filectrl\" with no arguments for details", ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", ".headers on|off Turn display of headers on or off", ".help ?-all? ?PATTERN? Show help text for PATTERN", ".import FILE TABLE Import data from FILE into TABLE", #ifndef SQLITE_OMIT_TEST_CONTROL ".imposter INDEX TABLE Create imposter table TABLE on index INDEX", #endif ".indexes ?TABLE? Show names of indexes", " If TABLE is specified, only show indexes for", " tables matching TABLE using the LIKE operator.", #ifdef SQLITE_ENABLE_IOTRACE ".iotrace FILE Enable I/O diagnostic logging to FILE", #endif ".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT", ".lint OPTIONS Report potential schema issues.", " Options:", " fkey-indexes Find missing foreign key indexes", #ifndef SQLITE_OMIT_LOAD_EXTENSION ".load FILE ?ENTRY? Load an extension library", #endif ".log FILE|off Turn logging on or off. FILE can be stderr/stdout", ".mode MODE ?TABLE? Set output mode", " MODE is one of:", " ascii Columns/rows delimited by 0x1F and 0x1E", " csv Comma-separated values", " column Left-aligned columns. (See .width)", " html HTML <table> code", " insert SQL insert statements for TABLE", " line One value per line", " list Values delimited by \"|\"", " quote Escape answers as for SQL", " tabs Tab-separated values", " tcl TCL list elements", ".nullvalue STRING Use STRING in place of NULL values", ".once (-e|-x|FILE) Output for the next SQL command only to FILE", " If FILE begins with '|' then open as a pipe", " Other options:", " -e Invoke system text editor", " -x Open in a spreadsheet", ".open ?OPTIONS? ?FILE? Close existing database and reopen FILE", " Options:", " --append Use appendvfs to append database to the end of FILE", #ifdef SQLITE_ENABLE_DESERIALIZE " --deserialize Load into memory useing sqlite3_deserialize()", " --hexdb Load the output of \"dbtotxt\" as an in-memory db", " --maxsize N Maximum size for --hexdb or --deserialized database", #endif " --new Initialize FILE to an empty database", " --nofollow Do not follow symbolic links", " --readonly Open FILE readonly", " --zip FILE is a ZIP archive", ".output ?FILE? Send output to FILE or stdout if FILE is omitted", " If FILE begins with '|' then open it as a pipe.", ".parameter CMD ... Manage SQL parameter bindings", " clear Erase all bindings", " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", " PARAMETER should start with one of: $ : @ ?", " unset PARAMETER Remove PARAMETER from the binding table", ".print STRING... Print literal STRING", #ifndef SQLITE_OMIT_PROGRESS_CALLBACK ".progress N Invoke progress handler after every N opcodes", " --limit N Interrupt after N progress callbacks", " --once Do no more than one progress interrupt", " --quiet|-q No output except at interrupts", " --reset Reset the count for each input and interrupt", #endif ".prompt MAIN CONTINUE Replace the standard prompts", ".quit Exit this program", ".read FILE Read input from FILE", #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ".recover Recover as much data as possible from corrupt db.", " --freelist-corrupt Assume the freelist is corrupt", " --recovery-db NAME Store recovery metadata in database file NAME", " --lost-and-found TABLE Alternative name for the lost-and-found table", " --no-rowids Do not attempt to recover rowid values", " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", ".save FILE Write in-memory database into FILE", ".scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off", ".schema ?PATTERN? Show the CREATE statements matching PATTERN", " Options:", " --indent Try to pretty-print the schema", ".selftest ?OPTIONS? Run tests defined in the SELFTEST table", " Options:", " --init Create a new SELFTEST table", " -v Verbose output", ".separator COL ?ROW? Change the column and row separators", #if defined(SQLITE_ENABLE_SESSION) ".session ?NAME? CMD ... Create or control sessions", " Subcommands:", " attach TABLE Attach TABLE", " changeset FILE Write a changeset into FILE", " close Close one session", " enable ?BOOLEAN? Set or query the enable bit", " filter GLOB... Reject tables matching GLOBs", " indirect ?BOOLEAN? Mark or query the indirect status", " isempty Query whether the session is empty", " list List currently open session names", " open DB NAME Open a new session on DB", " patchset FILE Write a patchset into FILE", " If ?NAME? is omitted, the first defined session is used.", #endif ".sha3sum ... Compute a SHA3 hash of database content", " Options:", " --schema Also hash the sqlite_master table", " --sha3-224 Use the sha3-224 algorithm", " --sha3-256 Use the sha3-256 algorithm (default)", " --sha3-384 Use the sha3-384 algorithm", " --sha3-512 Use the sha3-512 algorithm", " Any other argument is a LIKE pattern for tables to hash", #ifndef SQLITE_NOHAVE_SYSTEM ".shell CMD ARGS... Run CMD ARGS... in a system shell", #endif ".show Show the current values for various settings", ".stats ?on|off? Show stats or turn stats on or off", #ifndef SQLITE_NOHAVE_SYSTEM ".system CMD ARGS... Run CMD ARGS... in a system shell", #endif ".tables ?TABLE? List names of tables matching LIKE pattern TABLE", ".testcase NAME Begin redirecting output to 'testcase-out.txt'", ".testctrl CMD ... Run various sqlite3_test_control() operations", " Run \".testctrl\" with no arguments for details", ".timeout MS Try opening locked tables for MS milliseconds", ".timer on|off Turn SQL timer on or off", #ifndef SQLITE_OMIT_TRACE ".trace ?OPTIONS? Output each SQL statement as it is run", " FILE Send output to FILE", " stdout Send output to stdout", " stderr Send output to stderr", " off Disable tracing", " --expanded Expand query parameters", #ifdef SQLITE_ENABLE_NORMALIZE " --normalized Normal the SQL statements", #endif " --plain Show SQL as it is input", " --stmt Trace statement execution (SQLITE_TRACE_STMT)", " --profile Profile statements (SQLITE_TRACE_PROFILE)", " --row Trace each row (SQLITE_TRACE_ROW)", " --close Trace connection close (SQLITE_TRACE_CLOSE)", #endif /* SQLITE_OMIT_TRACE */ #ifdef SQLITE_DEBUG ".unmodule NAME ... Unregister virtual table modules", " --allexcept Unregister everything except those named", #endif ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", ".width NUM1 NUM2 ... Set column widths for \"column\" mode", " Negative values right-justify", }; /* ** Output help text. ** ** zPattern describes the set of commands for which help text is provided. ** If zPattern is NULL, then show all commands, but only give a one-line ** description of each. ** ** Return the number of matches. */ static int showHelp(FILE *out, const char *zPattern){ int i = 0; int j = 0; int n = 0; char *zPat; if( zPattern==0 || zPattern[0]=='0' || strcmp(zPattern,"-a")==0 || strcmp(zPattern,"-all")==0 ){ /* Show all commands, but only one line per command */ if( zPattern==0 ) zPattern = ""; for(i=0; i<ArraySize(azHelp); i++){ if( azHelp[i][0]=='.' || zPattern[0] ){ utf8_printf(out, "%s\n", azHelp[i]); n++; } } }else{ /* Look for commands that for which zPattern is an exact prefix */ zPat = sqlite3_mprintf(".%s*", zPattern); for(i=0; i<ArraySize(azHelp); i++){ if( sqlite3_strglob(zPat, azHelp[i])==0 ){ utf8_printf(out, "%s\n", azHelp[i]); j = i+1; n++; } } sqlite3_free(zPat); if( n ){ if( n==1 ){ /* when zPattern is a prefix of exactly one command, then include the ** details of that command, which should begin at offset j */ while( j<ArraySize(azHelp)-1 && azHelp[j][0]!='.' ){ utf8_printf(out, "%s\n", azHelp[j]); j++; } } return n; } /* Look for commands that contain zPattern anywhere. Show the complete ** text of all commands that match. */ zPat = sqlite3_mprintf("%%%s%%", zPattern); for(i=0; i<ArraySize(azHelp); i++){ if( azHelp[i][0]=='.' ) j = i; if( sqlite3_strlike(zPat, azHelp[i], 0)==0 ){ utf8_printf(out, "%s\n", azHelp[j]); while( j<ArraySize(azHelp)-1 && azHelp[j+1][0]!='.' ){ j++; utf8_printf(out, "%s\n", azHelp[j]); } i = j; n++; } } sqlite3_free(zPat); } return n; } /* Forward reference */ static int process_input(ShellState *p); /* ** Read the content of file zName into memory obtained from sqlite3_malloc64() ** and return a pointer to the buffer. The caller is responsible for freeing ** the memory. ** ** If parameter pnByte is not NULL, (*pnByte) is set to the number of bytes |
︙ | ︙ | |||
10992 10993 10994 10995 10996 10997 10998 | size_t nRead; char *pBuf; if( in==0 ) return 0; fseek(in, 0, SEEK_END); nIn = ftell(in); rewind(in); pBuf = sqlite3_malloc64( nIn+1 ); | | | 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 | size_t nRead; char *pBuf; if( in==0 ) return 0; fseek(in, 0, SEEK_END); nIn = ftell(in); rewind(in); pBuf = sqlite3_malloc64( nIn+1 ); if( pBuf==0 ){ fclose(in); return 0; } nRead = fread(pBuf, nIn, 1, in); fclose(in); if( nRead!=1 ){ sqlite3_free(pBuf); return 0; } pBuf[nIn] = 0; |
︙ | ︙ | |||
11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 | if( f==0 ){ if( dfltZip && sqlite3_strlike("%.zip",zName,0)==0 ){ return SHELL_OPEN_ZIPFILE; }else{ return SHELL_OPEN_NORMAL; } } fseek(f, -25, SEEK_END); n = fread(zBuf, 25, 1, f); if( n==1 && memcmp(zBuf, "Start-Of-SQLite3-", 17)==0 ){ rc = SHELL_OPEN_APPENDVFS; }else{ fseek(f, -22, SEEK_END); n = fread(zBuf, 22, 1, f); if( n==1 && zBuf[0]==0x50 && zBuf[1]==0x4b && zBuf[2]==0x05 && zBuf[3]==0x06 ){ rc = SHELL_OPEN_ZIPFILE; }else if( n==0 && dfltZip && sqlite3_strlike("%.zip",zName,0)==0 ){ rc = SHELL_OPEN_ZIPFILE; } } fclose(f); return rc; } /* Flags for open_db(). ** ** The default behavior of open_db() is to exit(1) if the database fails to ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error ** but still returns without calling exit. ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 | if( f==0 ){ if( dfltZip && sqlite3_strlike("%.zip",zName,0)==0 ){ return SHELL_OPEN_ZIPFILE; }else{ return SHELL_OPEN_NORMAL; } } n = fread(zBuf, 16, 1, f); if( n==1 && memcmp(zBuf, "SQLite format 3", 16)==0 ){ fclose(f); return SHELL_OPEN_NORMAL; } fseek(f, -25, SEEK_END); n = fread(zBuf, 25, 1, f); if( n==1 && memcmp(zBuf, "Start-Of-SQLite3-", 17)==0 ){ rc = SHELL_OPEN_APPENDVFS; }else{ fseek(f, -22, SEEK_END); n = fread(zBuf, 22, 1, f); if( n==1 && zBuf[0]==0x50 && zBuf[1]==0x4b && zBuf[2]==0x05 && zBuf[3]==0x06 ){ rc = SHELL_OPEN_ZIPFILE; }else if( n==0 && dfltZip && sqlite3_strlike("%.zip",zName,0)==0 ){ rc = SHELL_OPEN_ZIPFILE; } } fclose(f); return rc; } #ifdef SQLITE_ENABLE_DESERIALIZE /* ** Reconstruct an in-memory database using the output from the "dbtotxt" ** program. Read content from the file in p->zDbFilename. If p->zDbFilename ** is 0, then read from standard input. */ static unsigned char *readHexDb(ShellState *p, int *pnData){ unsigned char *a = 0; int nLine; int n = 0; int pgsz = 0; int iOffset = 0; int j, k; int rc; FILE *in; unsigned int x[16]; char zLine[1000]; if( p->zDbFilename ){ in = fopen(p->zDbFilename, "r"); if( in==0 ){ utf8_printf(stderr, "cannot open \"%s\" for reading\n", p->zDbFilename); return 0; } nLine = 0; }else{ in = p->in; nLine = p->lineno; if( in==0 ) in = stdin; } *pnData = 0; nLine++; if( fgets(zLine, sizeof(zLine), in)==0 ) goto readHexDb_error; rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz); if( rc!=2 ) goto readHexDb_error; if( n<0 ) goto readHexDb_error; if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error; n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */ a = sqlite3_malloc( n ? n : 1 ); if( a==0 ){ utf8_printf(stderr, "Out of memory!\n"); goto readHexDb_error; } memset(a, 0, n); if( pgsz<512 || pgsz>65536 || (pgsz & (pgsz-1))!=0 ){ utf8_printf(stderr, "invalid pagesize\n"); goto readHexDb_error; } for(nLine++; fgets(zLine, sizeof(zLine), in)!=0; nLine++){ rc = sscanf(zLine, "| page %d offset %d", &j, &k); if( rc==2 ){ iOffset = k; continue; } if( strncmp(zLine, "| end ", 6)==0 ){ break; } rc = sscanf(zLine,"| %d: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x", &j, &x[0], &x[1], &x[2], &x[3], &x[4], &x[5], &x[6], &x[7], &x[8], &x[9], &x[10], &x[11], &x[12], &x[13], &x[14], &x[15]); if( rc==17 ){ k = iOffset+j; if( k+16<=n ){ int ii; for(ii=0; ii<16; ii++) a[k+ii] = x[ii]&0xff; } } } *pnData = n; if( in!=p->in ){ fclose(in); }else{ p->lineno = nLine; } return a; readHexDb_error: if( in!=p->in ){ fclose(in); }else{ while( fgets(zLine, sizeof(zLine), p->in)!=0 ){ nLine++; if(strncmp(zLine, "| end ", 6)==0 ) break; } p->lineno = nLine; } sqlite3_free(a); utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine); return 0; } #endif /* SQLITE_ENABLE_DESERIALIZE */ /* ** Scalar function "shell_int32". The first argument to this function ** must be a blob. The second a non-negative integer. This function ** reads and returns a 32-bit big-endian integer from byte ** offset (4*<arg2>) of the blob. */ static void shellInt32( sqlite3_context *context, int argc, sqlite3_value **argv ){ const unsigned char *pBlob; int nBlob; int iInt; UNUSED_PARAMETER(argc); nBlob = sqlite3_value_bytes(argv[0]); pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]); iInt = sqlite3_value_int(argv[1]); if( iInt>=0 && (iInt+1)*4<=nBlob ){ const unsigned char *a = &pBlob[iInt*4]; sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24) + ((sqlite3_int64)a[1]<<16) + ((sqlite3_int64)a[2]<< 8) + ((sqlite3_int64)a[3]<< 0); sqlite3_result_int64(context, iVal); } } /* ** Scalar function "shell_idquote(X)" returns string X quoted as an identifier, ** using "..." with internal double-quote characters doubled. */ static void shellIdQuote( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zName = (const char*)sqlite3_value_text(argv[0]); UNUSED_PARAMETER(argc); if( zName ){ char *z = sqlite3_mprintf("\"%w\"", zName); sqlite3_result_text(context, z, -1, sqlite3_free); } } /* ** Scalar function "shell_escape_crnl" used by the .recover command. ** The argument passed to this function is the output of built-in ** function quote(). If the first character of the input is "'", ** indicating that the value passed to quote() was a text value, ** then this function searches the input for "\n" and "\r" characters ** and adds a wrapper similar to the following: ** ** replace(replace(<input>, '\n', char(10), '\r', char(13)); ** ** Or, if the first character of the input is not "'", then a copy ** of the input is returned. */ static void shellEscapeCrnl( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zText = (const char*)sqlite3_value_text(argv[0]); UNUSED_PARAMETER(argc); if( zText[0]=='\'' ){ int nText = sqlite3_value_bytes(argv[0]); int i; char zBuf1[20]; char zBuf2[20]; const char *zNL = 0; const char *zCR = 0; int nCR = 0; int nNL = 0; for(i=0; zText[i]; i++){ if( zNL==0 && zText[i]=='\n' ){ zNL = unused_string(zText, "\\n", "\\012", zBuf1); nNL = (int)strlen(zNL); } if( zCR==0 && zText[i]=='\r' ){ zCR = unused_string(zText, "\\r", "\\015", zBuf2); nCR = (int)strlen(zCR); } } if( zNL || zCR ){ int iOut = 0; i64 nMax = (nNL > nCR) ? nNL : nCR; i64 nAlloc = nMax * nText + (nMax+64)*2; char *zOut = (char*)sqlite3_malloc64(nAlloc); if( zOut==0 ){ sqlite3_result_error_nomem(context); return; } if( zNL && zCR ){ memcpy(&zOut[iOut], "replace(replace(", 16); iOut += 16; }else{ memcpy(&zOut[iOut], "replace(", 8); iOut += 8; } for(i=0; zText[i]; i++){ if( zText[i]=='\n' ){ memcpy(&zOut[iOut], zNL, nNL); iOut += nNL; }else if( zText[i]=='\r' ){ memcpy(&zOut[iOut], zCR, nCR); iOut += nCR; }else{ zOut[iOut] = zText[i]; iOut++; } } if( zNL ){ memcpy(&zOut[iOut], ",'", 2); iOut += 2; memcpy(&zOut[iOut], zNL, nNL); iOut += nNL; memcpy(&zOut[iOut], "', char(10))", 12); iOut += 12; } if( zCR ){ memcpy(&zOut[iOut], ",'", 2); iOut += 2; memcpy(&zOut[iOut], zCR, nCR); iOut += nCR; memcpy(&zOut[iOut], "', char(13))", 12); iOut += 12; } sqlite3_result_text(context, zOut, iOut, SQLITE_TRANSIENT); sqlite3_free(zOut); return; } } sqlite3_result_value(context, argv[0]); } /* Flags for open_db(). ** ** The default behavior of open_db() is to exit(1) if the database fails to ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error ** but still returns without calling exit. ** |
︙ | ︙ | |||
11120 11121 11122 11123 11124 11125 11126 | p->openMode = (u8)deduceDatabaseType(p->zDbFilename, (openFlags & OPEN_DB_ZIPFILE)!=0); } } switch( p->openMode ){ case SHELL_OPEN_APPENDVFS: { sqlite3_open_v2(p->zDbFilename, &p->db, | | > > > > > | > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 | p->openMode = (u8)deduceDatabaseType(p->zDbFilename, (openFlags & OPEN_DB_ZIPFILE)!=0); } } switch( p->openMode ){ case SHELL_OPEN_APPENDVFS: { sqlite3_open_v2(p->zDbFilename, &p->db, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|p->openFlags, "apndvfs"); break; } case SHELL_OPEN_HEXDB: case SHELL_OPEN_DESERIALIZE: { sqlite3_open(0, &p->db); break; } case SHELL_OPEN_ZIPFILE: { sqlite3_open(":memory:", &p->db); break; } case SHELL_OPEN_READONLY: { sqlite3_open_v2(p->zDbFilename, &p->db, SQLITE_OPEN_READONLY|p->openFlags, 0); break; } case SHELL_OPEN_UNSPEC: case SHELL_OPEN_NORMAL: { sqlite3_open_v2(p->zDbFilename, &p->db, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|p->openFlags, 0); break; } } globalDb = p->db; if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){ utf8_printf(stderr,"Error: unable to open database \"%s\": %s\n", p->zDbFilename, sqlite3_errmsg(p->db)); if( openFlags & OPEN_DB_KEEPALIVE ){ sqlite3_open(":memory:", &p->db); return; } exit(1); } #ifndef SQLITE_OMIT_LOAD_EXTENSION sqlite3_enable_load_extension(p->db, 1); #endif sqlite3_fileio_init(p->db, 0, 0); sqlite3_shathree_init(p->db, 0, 0); sqlite3_completion_init(p->db, 0, 0); #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) sqlite3_dbdata_init(p->db, 0, 0); #endif #ifdef SQLITE_HAVE_ZLIB sqlite3_zipfile_init(p->db, 0, 0); sqlite3_sqlar_init(p->db, 0, 0); #endif sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0, shellAddSchemaName, 0, 0); sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0, shellModuleSchema, 0, 0); sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p, shellPutsFunc, 0, 0); sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0, shellEscapeCrnl, 0, 0); sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0, shellInt32, 0, 0); sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0, shellIdQuote, 0, 0); #ifndef SQLITE_NOHAVE_SYSTEM sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0, editFunc, 0, 0); sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0, editFunc, 0, 0); #endif if( p->openMode==SHELL_OPEN_ZIPFILE ){ char *zSql = sqlite3_mprintf( "CREATE VIRTUAL TABLE zip USING zipfile(%Q);", p->zDbFilename); sqlite3_exec(p->db, zSql, 0, 0, 0); sqlite3_free(zSql); } #ifdef SQLITE_ENABLE_DESERIALIZE else if( p->openMode==SHELL_OPEN_DESERIALIZE || p->openMode==SHELL_OPEN_HEXDB ){ int rc; int nData = 0; unsigned char *aData; if( p->openMode==SHELL_OPEN_DESERIALIZE ){ aData = (unsigned char*)readFile(p->zDbFilename, &nData); }else{ aData = readHexDb(p, &nData); if( aData==0 ){ return; } } rc = sqlite3_deserialize(p->db, "main", aData, nData, nData, SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE); if( rc ){ utf8_printf(stderr, "Error: sqlite3_deserialize() returns %d\n", rc); } if( p->szMax>0 ){ sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax); } } #endif } } /* ** Attempt to close the databaes connection. Report errors. */ void close_db(sqlite3 *db){ |
︙ | ︙ | |||
11373 11374 11375 11376 11377 11378 11379 | if( f==0 ){ utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); } } return f; } | | | | | | | | | > | > > > > > | > > > > > > > > > > > > > > > > > > > > | | > > > | > > > > > > > | 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 | if( f==0 ){ utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); } } return f; } #ifndef SQLITE_OMIT_TRACE /* ** A routine for handling output from sqlite3_trace(). */ static int sql_trace_callback( unsigned mType, /* The trace type */ void *pArg, /* The ShellState pointer */ void *pP, /* Usually a pointer to sqlite_stmt */ void *pX /* Auxiliary output */ ){ ShellState *p = (ShellState*)pArg; sqlite3_stmt *pStmt; const char *zSql; int nSql; if( p->traceOut==0 ) return 0; if( mType==SQLITE_TRACE_CLOSE ){ utf8_printf(p->traceOut, "-- closing database connection\n"); return 0; } if( mType!=SQLITE_TRACE_ROW && ((const char*)pX)[0]=='-' ){ zSql = (const char*)pX; }else{ pStmt = (sqlite3_stmt*)pP; switch( p->eTraceType ){ case SHELL_TRACE_EXPANDED: { zSql = sqlite3_expanded_sql(pStmt); break; } #ifdef SQLITE_ENABLE_NORMALIZE case SHELL_TRACE_NORMALIZED: { zSql = sqlite3_normalized_sql(pStmt); break; } #endif default: { zSql = sqlite3_sql(pStmt); break; } } } if( zSql==0 ) return 0; nSql = strlen30(zSql); while( nSql>0 && zSql[nSql-1]==';' ){ nSql--; } switch( mType ){ case SQLITE_TRACE_ROW: case SQLITE_TRACE_STMT: { utf8_printf(p->traceOut, "%.*s;\n", nSql, zSql); break; } case SQLITE_TRACE_PROFILE: { sqlite3_int64 nNanosec = *(sqlite3_int64*)pX; utf8_printf(p->traceOut, "%.*s; -- %lld ns\n", nSql, zSql, nNanosec); break; } } return 0; } #endif /* ** A no-op routine that runs with the ".breakpoint" doc-command. This is |
︙ | ︙ | |||
11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 | zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile); if( system(zCmd) ){ utf8_printf(stderr, "Failed: [%s]\n", zCmd); } sqlite3_free(zCmd); outputModePop(p); p->doXdgOpen = 0; } #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */ } p->outfile[0] = 0; p->out = stdout; } | > | 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 | zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile); if( system(zCmd) ){ utf8_printf(stderr, "Failed: [%s]\n", zCmd); } sqlite3_free(zCmd); outputModePop(p); p->doXdgOpen = 0; sqlite3_sleep(100); } #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */ } p->outfile[0] = 0; p->out = stdout; } |
︙ | ︙ | |||
11864 11865 11866 11867 11868 11869 11870 | { "number of triggers:", "SELECT count(*) FROM %s WHERE type='trigger'" }, { "number of views:", "SELECT count(*) FROM %s WHERE type='view'" }, { "schema size:", "SELECT total(length(sql)) FROM %s" }, }; | | > | | > > > > > > > > > > | 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 | { "number of triggers:", "SELECT count(*) FROM %s WHERE type='trigger'" }, { "number of views:", "SELECT count(*) FROM %s WHERE type='view'" }, { "schema size:", "SELECT total(length(sql)) FROM %s" }, }; int i, rc; unsigned iDataVersion; char *zSchemaTab; char *zDb = nArg>=2 ? azArg[1] : "main"; sqlite3_stmt *pStmt = 0; unsigned char aHdr[100]; open_db(p, 0); if( p->db==0 ) return 1; rc = sqlite3_prepare_v2(p->db, "SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1", -1, &pStmt, 0); if( rc ){ if( !sqlite3_compileoption_used("ENABLE_DBPAGE_VTAB") ){ utf8_printf(stderr, "the \".dbinfo\" command requires the " "-DSQLITE_ENABLE_DBPAGE_VTAB compile-time options\n"); }else{ utf8_printf(stderr, "error: %s\n", sqlite3_errmsg(p->db)); } sqlite3_finalize(pStmt); return 1; } sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC); if( sqlite3_step(pStmt)==SQLITE_ROW && sqlite3_column_bytes(pStmt,0)>100 ){ memcpy(aHdr, sqlite3_column_blob(pStmt,0), 100); sqlite3_finalize(pStmt); }else{ |
︙ | ︙ | |||
12341 12342 12343 12344 12345 12346 12347 | usage: raw_printf(stderr, "Usage %s sub-command ?switches...?\n", azArg[0]); raw_printf(stderr, "Where sub-commands are:\n"); raw_printf(stderr, " fkey-indexes\n"); return SQLITE_ERROR; } | | < < < > > > > > > > | > > > > > > > | > > > > > > | > > > > > > | 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 | usage: raw_printf(stderr, "Usage %s sub-command ?switches...?\n", azArg[0]); raw_printf(stderr, "Where sub-commands are:\n"); raw_printf(stderr, " fkey-indexes\n"); return SQLITE_ERROR; } #if !defined SQLITE_OMIT_VIRTUALTABLE static void shellPrepare( sqlite3 *db, int *pRc, const char *zSql, sqlite3_stmt **ppStmt ){ *ppStmt = 0; if( *pRc==SQLITE_OK ){ int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); if( rc!=SQLITE_OK ){ raw_printf(stderr, "sql error: %s (%d)\n", sqlite3_errmsg(db), sqlite3_errcode(db) ); *pRc = rc; } } } /* ** Create a prepared statement using printf-style arguments for the SQL. ** ** This routine is could be marked "static". But it is not always used, ** depending on compile-time options. By omitting the "static", we avoid ** nuisance compiler warnings about "defined but not used". */ void shellPreparePrintf( sqlite3 *db, int *pRc, sqlite3_stmt **ppStmt, const char *zFmt, ... ){ *ppStmt = 0; if( *pRc==SQLITE_OK ){ va_list ap; char *z; va_start(ap, zFmt); z = sqlite3_vmprintf(zFmt, ap); va_end(ap); if( z==0 ){ *pRc = SQLITE_NOMEM; }else{ shellPrepare(db, pRc, z, ppStmt); sqlite3_free(z); } } } /* Finalize the prepared statement created using shellPreparePrintf(). ** ** This routine is could be marked "static". But it is not always used, ** depending on compile-time options. By omitting the "static", we avoid ** nuisance compiler warnings about "defined but not used". */ void shellFinalize( int *pRc, sqlite3_stmt *pStmt ){ if( pStmt ){ sqlite3 *db = sqlite3_db_handle(pStmt); int rc = sqlite3_finalize(pStmt); if( *pRc==SQLITE_OK ){ if( rc!=SQLITE_OK ){ raw_printf(stderr, "SQL error: %s\n", sqlite3_errmsg(db)); } *pRc = rc; } } } /* Reset the prepared statement created using shellPreparePrintf(). ** ** This routine is could be marked "static". But it is not always used, ** depending on compile-time options. By omitting the "static", we avoid ** nuisance compiler warnings about "defined but not used". */ void shellReset( int *pRc, sqlite3_stmt *pStmt ){ int rc = sqlite3_reset(pStmt); if( *pRc==SQLITE_OK ){ if( rc!=SQLITE_OK ){ sqlite3 *db = sqlite3_db_handle(pStmt); raw_printf(stderr, "SQL error: %s\n", sqlite3_errmsg(db)); } *pRc = rc; } } #endif /* !defined SQLITE_OMIT_VIRTUALTABLE */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) /****************************************************************************** ** The ".archive" or ".ar" command. */ /* ** Structure representing a single ".ar" command. */ typedef struct ArCommand ArCommand; struct ArCommand { u8 eCmd; /* An AR_CMD_* value */ u8 bVerbose; /* True if --verbose */ |
︙ | ︙ | |||
12438 12439 12440 12441 12442 12443 12444 | sqlite3 *db; /* Database containing the archive */ }; /* ** Print a usage message for the .ar command to stderr and return SQLITE_ERROR. */ static int arUsage(FILE *f){ | < < < | < < < < < < < < < < < < < < < < < < < < < < | 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 | sqlite3 *db; /* Database containing the archive */ }; /* ** Print a usage message for the .ar command to stderr and return SQLITE_ERROR. */ static int arUsage(FILE *f){ showHelp(f,"archive"); return SQLITE_ERROR; } /* ** Print an error message for the .ar command to stderr and return ** SQLITE_ERROR. */ |
︙ | ︙ | |||
12491 12492 12493 12494 12495 12496 12497 | return SQLITE_ERROR; } /* ** Values for ArCommand.eCmd. */ #define AR_CMD_CREATE 1 | | | | > | | | | | | > | 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 | return SQLITE_ERROR; } /* ** Values for ArCommand.eCmd. */ #define AR_CMD_CREATE 1 #define AR_CMD_UPDATE 2 #define AR_CMD_INSERT 3 #define AR_CMD_EXTRACT 4 #define AR_CMD_LIST 5 #define AR_CMD_HELP 6 /* ** Other (non-command) switches. */ #define AR_SWITCH_VERBOSE 7 #define AR_SWITCH_FILE 8 #define AR_SWITCH_DIRECTORY 9 #define AR_SWITCH_APPEND 10 #define AR_SWITCH_DRYRUN 11 static int arProcessSwitch(ArCommand *pAr, int eSwitch, const char *zArg){ switch( eSwitch ){ case AR_CMD_CREATE: case AR_CMD_EXTRACT: case AR_CMD_LIST: case AR_CMD_UPDATE: case AR_CMD_INSERT: case AR_CMD_HELP: if( pAr->eCmd ){ return arErrorMsg(pAr, "multiple command options"); } pAr->eCmd = eSwitch; break; |
︙ | ︙ | |||
12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 | const char *zLong; char cShort; u8 eSwitch; u8 bArg; } aSwitch[] = { { "create", 'c', AR_CMD_CREATE, 0 }, { "extract", 'x', AR_CMD_EXTRACT, 0 }, { "list", 't', AR_CMD_LIST, 0 }, { "update", 'u', AR_CMD_UPDATE, 0 }, { "help", 'h', AR_CMD_HELP, 0 }, { "verbose", 'v', AR_SWITCH_VERBOSE, 0 }, { "file", 'f', AR_SWITCH_FILE, 1 }, { "append", 'a', AR_SWITCH_APPEND, 1 }, { "directory", 'C', AR_SWITCH_DIRECTORY, 1 }, { "dryrun", 'n', AR_SWITCH_DRYRUN, 0 }, }; int nSwitch = sizeof(aSwitch) / sizeof(struct ArSwitch); struct ArSwitch *pEnd = &aSwitch[nSwitch]; if( nArg<=1 ){ return arUsage(stderr); }else{ char *z = azArg[1]; if( z[0]!='-' ){ /* Traditional style [tar] invocation */ int i; int iArg = 2; | > > | 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 | const char *zLong; char cShort; u8 eSwitch; u8 bArg; } aSwitch[] = { { "create", 'c', AR_CMD_CREATE, 0 }, { "extract", 'x', AR_CMD_EXTRACT, 0 }, { "insert", 'i', AR_CMD_INSERT, 0 }, { "list", 't', AR_CMD_LIST, 0 }, { "update", 'u', AR_CMD_UPDATE, 0 }, { "help", 'h', AR_CMD_HELP, 0 }, { "verbose", 'v', AR_SWITCH_VERBOSE, 0 }, { "file", 'f', AR_SWITCH_FILE, 1 }, { "append", 'a', AR_SWITCH_APPEND, 1 }, { "directory", 'C', AR_SWITCH_DIRECTORY, 1 }, { "dryrun", 'n', AR_SWITCH_DRYRUN, 0 }, }; int nSwitch = sizeof(aSwitch) / sizeof(struct ArSwitch); struct ArSwitch *pEnd = &aSwitch[nSwitch]; if( nArg<=1 ){ utf8_printf(stderr, "Wrong number of arguments. Usage:\n"); return arUsage(stderr); }else{ char *z = azArg[1]; if( z[0]!='-' ){ /* Traditional style [tar] invocation */ int i; int iArg = 2; |
︙ | ︙ | |||
12630 12631 12632 12633 12634 12635 12636 | } if( pOpt->bArg ){ if( i<(n-1) ){ zArg = &z[i+1]; i = n; }else{ if( iArg>=(nArg-1) ){ | | > | 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 | } if( pOpt->bArg ){ if( i<(n-1) ){ zArg = &z[i+1]; i = n; }else{ if( iArg>=(nArg-1) ){ return arErrorMsg(pAr, "option requires an argument: %c", z[i]); } zArg = azArg[++iArg]; } } if( arProcessSwitch(pAr, pOpt->eSwitch, zArg) ) return SQLITE_ERROR; } }else if( z[2]=='\0' ){ |
︙ | ︙ | |||
12891 12892 12893 12894 12895 12896 12897 | } } return rc; } /* | | > > > > > | > > | > | 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 | } } return rc; } /* ** Implementation of .ar "create", "insert", and "update" commands. ** ** create -> Create a new SQL archive ** insert -> Insert or reinsert all files listed ** update -> Insert files that have changed or that were not ** previously in the archive ** ** Create the "sqlar" table in the database if it does not already exist. ** Then add each file in the azFile[] array to the archive. Directories ** are added recursively. If argument bVerbose is non-zero, a message is ** printed on stdout for each file archived. ** ** The create command is the same as update, except that it drops ** any existing "sqlar" table before beginning. The "insert" command ** always overwrites every file named on the command-line, where as ** "update" only overwrites if the size or mtime or mode has changed. */ static int arCreateOrUpdateCommand( ArCommand *pAr, /* Command arguments and options */ int bUpdate, /* true for a --create. */ int bOnlyIfChanged /* Only update if file has changed */ ){ const char *zCreate = "CREATE TABLE IF NOT EXISTS sqlar(\n" " name TEXT PRIMARY KEY, -- name of the file\n" " mode INT, -- access permissions\n" " mtime INT, -- last modification time\n" " sz INT, -- original file size\n" |
︙ | ︙ | |||
12925 12926 12927 12928 12929 12930 12931 | " mode,\n" " mtime,\n" " CASE substr(lsmode(mode),1,1)\n" " WHEN '-' THEN length(data)\n" " WHEN 'd' THEN 0\n" " ELSE -1 END,\n" " sqlar_compress(data)\n" | | | > | | > | 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 | " mode,\n" " mtime,\n" " CASE substr(lsmode(mode),1,1)\n" " WHEN '-' THEN length(data)\n" " WHEN 'd' THEN 0\n" " ELSE -1 END,\n" " sqlar_compress(data)\n" " FROM fsdir(%Q,%Q) AS disk\n" " WHERE lsmode(mode) NOT LIKE '?%%'%s;" , "REPLACE INTO %s(name,mode,mtime,data)\n" " SELECT\n" " %s,\n" " mode,\n" " mtime,\n" " data\n" " FROM fsdir(%Q,%Q) AS disk\n" " WHERE lsmode(mode) NOT LIKE '?%%'%s;" }; int i; /* For iterating through azFile[] */ int rc; /* Return code */ const char *zTab = 0; /* SQL table into which to insert */ char *zSql; char zTemp[50]; char *zExists = 0; arExecSql(pAr, "PRAGMA page_size=512"); rc = arExecSql(pAr, "SAVEPOINT ar;"); if( rc!=SQLITE_OK ) return rc; zTemp[0] = 0; if( pAr->bZip ){ /* Initialize the zipfile virtual table, if necessary */ |
︙ | ︙ | |||
12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 | zTab = "sqlar"; if( bUpdate==0 ){ rc = arExecSql(pAr, zDrop); if( rc!=SQLITE_OK ) goto end_ar_transaction; } rc = arExecSql(pAr, zCreate); } for(i=0; i<pAr->nArg && rc==SQLITE_OK; i++){ char *zSql2 = sqlite3_mprintf(zInsertFmt[pAr->bZip], zTab, pAr->bVerbose ? "shell_putsnl(name)" : "name", | > > > > > > > > > > > | | > | | | | | 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 | zTab = "sqlar"; if( bUpdate==0 ){ rc = arExecSql(pAr, zDrop); if( rc!=SQLITE_OK ) goto end_ar_transaction; } rc = arExecSql(pAr, zCreate); } if( bOnlyIfChanged ){ zExists = sqlite3_mprintf( " AND NOT EXISTS(" "SELECT 1 FROM %s AS mem" " WHERE mem.name=disk.name" " AND mem.mtime=disk.mtime" " AND mem.mode=disk.mode)", zTab); }else{ zExists = sqlite3_mprintf(""); } if( zExists==0 ) rc = SQLITE_NOMEM; for(i=0; i<pAr->nArg && rc==SQLITE_OK; i++){ char *zSql2 = sqlite3_mprintf(zInsertFmt[pAr->bZip], zTab, pAr->bVerbose ? "shell_putsnl(name)" : "name", pAr->azArg[i], pAr->zDir, zExists); rc = arExecSql(pAr, zSql2); sqlite3_free(zSql2); } end_ar_transaction: if( rc!=SQLITE_OK ){ sqlite3_exec(pAr->db, "ROLLBACK TO ar; RELEASE ar;", 0, 0, 0); }else{ rc = arExecSql(pAr, "RELEASE ar;"); if( pAr->bZip && pAr->zFile ){ zSql = sqlite3_mprintf("DROP TABLE %s", zTemp); arExecSql(pAr, zSql); sqlite3_free(zSql); } } sqlite3_free(zExists); return rc; } /* ** Implementation of ".ar" dot command. */ static int arDotCommand( ShellState *pState, /* Current shell tool state */ int fromCmdLine, /* True if -A command-line option, not .ar cmd */ char **azArg, /* Array of arguments passed to dot command */ int nArg /* Number of entries in azArg[] */ ){ ArCommand cmd; int rc; memset(&cmd, 0, sizeof(cmd)); cmd.fromCmdLine = fromCmdLine; rc = arParseCommand(azArg, nArg, &cmd); if( rc==SQLITE_OK ){ |
︙ | ︙ | |||
13027 13028 13029 13030 13031 13032 13033 | cmd.zSrcTable = sqlite3_mprintf("zipfile(%Q)", cmd.zFile); } } cmd.bZip = 1; }else if( cmd.zFile ){ int flags; if( cmd.bAppend ) eDbType = SHELL_OPEN_APPENDVFS; | | > | 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 | cmd.zSrcTable = sqlite3_mprintf("zipfile(%Q)", cmd.zFile); } } cmd.bZip = 1; }else if( cmd.zFile ){ int flags; if( cmd.bAppend ) eDbType = SHELL_OPEN_APPENDVFS; if( cmd.eCmd==AR_CMD_CREATE || cmd.eCmd==AR_CMD_INSERT || cmd.eCmd==AR_CMD_UPDATE ){ flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE; }else{ flags = SQLITE_OPEN_READONLY; } cmd.db = 0; if( cmd.bDryRun ){ utf8_printf(pState->out, "-- open database '%s'%s\n", cmd.zFile, |
︙ | ︙ | |||
13064 13065 13066 13067 13068 13069 13070 | goto end_ar_command; } cmd.zSrcTable = sqlite3_mprintf("sqlar"); } switch( cmd.eCmd ){ case AR_CMD_CREATE: | | > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 | goto end_ar_command; } cmd.zSrcTable = sqlite3_mprintf("sqlar"); } switch( cmd.eCmd ){ case AR_CMD_CREATE: rc = arCreateOrUpdateCommand(&cmd, 0, 0); break; case AR_CMD_EXTRACT: rc = arExtractCommand(&cmd); break; case AR_CMD_LIST: rc = arListCommand(&cmd); break; case AR_CMD_HELP: arUsage(pState->out); break; case AR_CMD_INSERT: rc = arCreateOrUpdateCommand(&cmd, 1, 0); break; default: assert( cmd.eCmd==AR_CMD_UPDATE ); rc = arCreateOrUpdateCommand(&cmd, 1, 1); break; } } end_ar_command: if( cmd.db!=pState->db ){ close_db(cmd.db); } sqlite3_free(cmd.zSrcTable); return rc; } /* End of the ".archive" or ".ar" command logic *******************************************************************************/ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) /* ** If (*pRc) is not SQLITE_OK when this function is called, it is a no-op. ** Otherwise, the SQL statement or statements in zSql are executed using ** database connection db and the error code written to *pRc before ** this function returns. */ static void shellExec(sqlite3 *db, int *pRc, const char *zSql){ int rc = *pRc; if( rc==SQLITE_OK ){ char *zErr = 0; rc = sqlite3_exec(db, zSql, 0, 0, &zErr); if( rc!=SQLITE_OK ){ raw_printf(stderr, "SQL error: %s\n", zErr); } *pRc = rc; } } /* ** Like shellExec(), except that zFmt is a printf() style format string. */ static void shellExecPrintf(sqlite3 *db, int *pRc, const char *zFmt, ...){ char *z = 0; if( *pRc==SQLITE_OK ){ va_list ap; va_start(ap, zFmt); z = sqlite3_vmprintf(zFmt, ap); va_end(ap); if( z==0 ){ *pRc = SQLITE_NOMEM; }else{ shellExec(db, pRc, z); } sqlite3_free(z); } } /* ** If *pRc is not SQLITE_OK when this function is called, it is a no-op. ** Otherwise, an attempt is made to allocate, zero and return a pointer ** to a buffer nByte bytes in size. If an OOM error occurs, *pRc is set ** to SQLITE_NOMEM and NULL returned. */ static void *shellMalloc(int *pRc, sqlite3_int64 nByte){ void *pRet = 0; if( *pRc==SQLITE_OK ){ pRet = sqlite3_malloc64(nByte); if( pRet==0 ){ *pRc = SQLITE_NOMEM; }else{ memset(pRet, 0, nByte); } } return pRet; } /* ** If *pRc is not SQLITE_OK when this function is called, it is a no-op. ** Otherwise, zFmt is treated as a printf() style string. The result of ** formatting it along with any trailing arguments is written into a ** buffer obtained from sqlite3_malloc(), and pointer to which is returned. ** It is the responsibility of the caller to eventually free this buffer ** using a call to sqlite3_free(). ** ** If an OOM error occurs, (*pRc) is set to SQLITE_NOMEM and a NULL ** pointer returned. */ static char *shellMPrintf(int *pRc, const char *zFmt, ...){ char *z = 0; if( *pRc==SQLITE_OK ){ va_list ap; va_start(ap, zFmt); z = sqlite3_vmprintf(zFmt, ap); va_end(ap); if( z==0 ){ *pRc = SQLITE_NOMEM; } } return z; } /* ** When running the ".recover" command, each output table, and the special ** orphaned row table if it is required, is represented by an instance ** of the following struct. */ typedef struct RecoverTable RecoverTable; struct RecoverTable { char *zQuoted; /* Quoted version of table name */ int nCol; /* Number of columns in table */ char **azlCol; /* Array of column lists */ int iPk; /* Index of IPK column */ }; /* ** Free a RecoverTable object allocated by recoverFindTable() or ** recoverOrphanTable(). */ static void recoverFreeTable(RecoverTable *pTab){ if( pTab ){ sqlite3_free(pTab->zQuoted); if( pTab->azlCol ){ int i; for(i=0; i<=pTab->nCol; i++){ sqlite3_free(pTab->azlCol[i]); } sqlite3_free(pTab->azlCol); } sqlite3_free(pTab); } } /* ** This function is a no-op if (*pRc) is not SQLITE_OK when it is called. ** Otherwise, it allocates and returns a RecoverTable object based on the ** final four arguments passed to this function. It is the responsibility ** of the caller to eventually free the returned object using ** recoverFreeTable(). */ static RecoverTable *recoverNewTable( int *pRc, /* IN/OUT: Error code */ const char *zName, /* Name of table */ const char *zSql, /* CREATE TABLE statement */ int bIntkey, int nCol ){ sqlite3 *dbtmp = 0; /* sqlite3 handle for testing CREATE TABLE */ int rc = *pRc; RecoverTable *pTab = 0; pTab = (RecoverTable*)shellMalloc(&rc, sizeof(RecoverTable)); if( rc==SQLITE_OK ){ int nSqlCol = 0; int bSqlIntkey = 0; sqlite3_stmt *pStmt = 0; rc = sqlite3_open("", &dbtmp); if( rc==SQLITE_OK ){ sqlite3_create_function(dbtmp, "shell_idquote", 1, SQLITE_UTF8, 0, shellIdQuote, 0, 0); } if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, "PRAGMA writable_schema = on", 0, 0, 0); } if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, zSql, 0, 0, 0); if( rc==SQLITE_ERROR ){ rc = SQLITE_OK; goto finished; } } shellPreparePrintf(dbtmp, &rc, &pStmt, "SELECT count(*) FROM pragma_table_info(%Q)", zName ); if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ nSqlCol = sqlite3_column_int(pStmt, 0); } shellFinalize(&rc, pStmt); if( rc!=SQLITE_OK || nSqlCol<nCol ){ goto finished; } shellPreparePrintf(dbtmp, &rc, &pStmt, "SELECT (" " SELECT substr(data,1,1)==X'0D' FROM sqlite_dbpage WHERE pgno=rootpage" ") FROM sqlite_master WHERE name = %Q", zName ); if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ bSqlIntkey = sqlite3_column_int(pStmt, 0); } shellFinalize(&rc, pStmt); if( bIntkey==bSqlIntkey ){ int i; const char *zPk = "_rowid_"; sqlite3_stmt *pPkFinder = 0; /* If this is an intkey table and there is an INTEGER PRIMARY KEY, ** set zPk to the name of the PK column, and pTab->iPk to the index ** of the column, where columns are 0-numbered from left to right. ** Or, if this is a WITHOUT ROWID table or if there is no IPK column, ** leave zPk as "_rowid_" and pTab->iPk at -2. */ pTab->iPk = -2; if( bIntkey ){ shellPreparePrintf(dbtmp, &rc, &pPkFinder, "SELECT cid, name FROM pragma_table_info(%Q) " " WHERE pk=1 AND type='integer' COLLATE nocase" " AND NOT EXISTS (SELECT cid FROM pragma_table_info(%Q) WHERE pk=2)" , zName, zName ); if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPkFinder) ){ pTab->iPk = sqlite3_column_int(pPkFinder, 0); zPk = (const char*)sqlite3_column_text(pPkFinder, 1); } } pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName); pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1)); pTab->nCol = nSqlCol; if( bIntkey ){ pTab->azlCol[0] = shellMPrintf(&rc, "\"%w\"", zPk); }else{ pTab->azlCol[0] = shellMPrintf(&rc, ""); } i = 1; shellPreparePrintf(dbtmp, &rc, &pStmt, "SELECT %Q || group_concat(shell_idquote(name), ', ') " " FILTER (WHERE cid!=%d) OVER (ORDER BY %s cid) " "FROM pragma_table_info(%Q)", bIntkey ? ", " : "", pTab->iPk, bIntkey ? "" : "(CASE WHEN pk=0 THEN 1000000 ELSE pk END), ", zName ); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ const char *zText = (const char*)sqlite3_column_text(pStmt, 0); pTab->azlCol[i] = shellMPrintf(&rc, "%s%s", pTab->azlCol[0], zText); i++; } shellFinalize(&rc, pStmt); shellFinalize(&rc, pPkFinder); } } finished: sqlite3_close(dbtmp); *pRc = rc; if( rc!=SQLITE_OK || (pTab && pTab->zQuoted==0) ){ recoverFreeTable(pTab); pTab = 0; } return pTab; } /* ** This function is called to search the schema recovered from the ** sqlite_master table of the (possibly) corrupt database as part ** of a ".recover" command. Specifically, for a table with root page ** iRoot and at least nCol columns. Additionally, if bIntkey is 0, the ** table must be a WITHOUT ROWID table, or if non-zero, not one of ** those. ** ** If a table is found, a (RecoverTable*) object is returned. Or, if ** no such table is found, but bIntkey is false and iRoot is the ** root page of an index in the recovered schema, then (*pbNoop) is ** set to true and NULL returned. Or, if there is no such table or ** index, NULL is returned and (*pbNoop) set to 0, indicating that ** the caller should write data to the orphans table. */ static RecoverTable *recoverFindTable( ShellState *pState, /* Shell state object */ int *pRc, /* IN/OUT: Error code */ int iRoot, /* Root page of table */ int bIntkey, /* True for an intkey table */ int nCol, /* Number of columns in table */ int *pbNoop /* OUT: True if iRoot is root of index */ ){ sqlite3_stmt *pStmt = 0; RecoverTable *pRet = 0; int bNoop = 0; const char *zSql = 0; const char *zName = 0; /* Search the recovered schema for an object with root page iRoot. */ shellPreparePrintf(pState->db, pRc, &pStmt, "SELECT type, name, sql FROM recovery.schema WHERE rootpage=%d", iRoot ); while( *pRc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ const char *zType = (const char*)sqlite3_column_text(pStmt, 0); if( bIntkey==0 && sqlite3_stricmp(zType, "index")==0 ){ bNoop = 1; break; } if( sqlite3_stricmp(zType, "table")==0 ){ zName = (const char*)sqlite3_column_text(pStmt, 1); zSql = (const char*)sqlite3_column_text(pStmt, 2); pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol); break; } } shellFinalize(pRc, pStmt); *pbNoop = bNoop; return pRet; } /* ** Return a RecoverTable object representing the orphans table. */ static RecoverTable *recoverOrphanTable( ShellState *pState, /* Shell state object */ int *pRc, /* IN/OUT: Error code */ const char *zLostAndFound, /* Base name for orphans table */ int nCol /* Number of user data columns */ ){ RecoverTable *pTab = 0; if( nCol>=0 && *pRc==SQLITE_OK ){ int i; /* This block determines the name of the orphan table. The prefered ** name is zLostAndFound. But if that clashes with another name ** in the recovered schema, try zLostAndFound_0, zLostAndFound_1 ** and so on until a non-clashing name is found. */ int iTab = 0; char *zTab = shellMPrintf(pRc, "%s", zLostAndFound); sqlite3_stmt *pTest = 0; shellPrepare(pState->db, pRc, "SELECT 1 FROM recovery.schema WHERE name=?", &pTest ); if( pTest ) sqlite3_bind_text(pTest, 1, zTab, -1, SQLITE_TRANSIENT); while( *pRc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pTest) ){ shellReset(pRc, pTest); sqlite3_free(zTab); zTab = shellMPrintf(pRc, "%s_%d", zLostAndFound, iTab++); sqlite3_bind_text(pTest, 1, zTab, -1, SQLITE_TRANSIENT); } shellFinalize(pRc, pTest); pTab = (RecoverTable*)shellMalloc(pRc, sizeof(RecoverTable)); if( pTab ){ pTab->zQuoted = shellMPrintf(pRc, "\"%w\"", zTab); pTab->nCol = nCol; pTab->iPk = -2; if( nCol>0 ){ pTab->azlCol = (char**)shellMalloc(pRc, sizeof(char*) * (nCol+1)); if( pTab->azlCol ){ pTab->azlCol[nCol] = shellMPrintf(pRc, ""); for(i=nCol-1; i>=0; i--){ pTab->azlCol[i] = shellMPrintf(pRc, "%s, NULL", pTab->azlCol[i+1]); } } } if( *pRc!=SQLITE_OK ){ recoverFreeTable(pTab); pTab = 0; }else{ raw_printf(pState->out, "CREATE TABLE %s(rootpgno INTEGER, " "pgno INTEGER, nfield INTEGER, id INTEGER", pTab->zQuoted ); for(i=0; i<nCol; i++){ raw_printf(pState->out, ", c%d", i); } raw_printf(pState->out, ");\n"); } } sqlite3_free(zTab); } return pTab; } /* ** This function is called to recover data from the database. A script ** to construct a new database containing all recovered data is output ** on stream pState->out. */ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){ int rc = SQLITE_OK; sqlite3_stmt *pLoop = 0; /* Loop through all root pages */ sqlite3_stmt *pPages = 0; /* Loop through all pages in a group */ sqlite3_stmt *pCells = 0; /* Loop through all cells in a page */ const char *zRecoveryDb = ""; /* Name of "recovery" database */ const char *zLostAndFound = "lost_and_found"; int i; int nOrphan = -1; RecoverTable *pOrphan = 0; int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ int bRowids = 1; /* 0 if --no-rowids */ for(i=1; i<nArg; i++){ char *z = azArg[i]; int n; if( z[0]=='-' && z[1]=='-' ) z++; n = strlen30(z); if( n<=17 && memcmp("-freelist-corrupt", z, n)==0 ){ bFreelist = 0; }else if( n<=12 && memcmp("-recovery-db", z, n)==0 && i<(nArg-1) ){ i++; zRecoveryDb = azArg[i]; }else if( n<=15 && memcmp("-lost-and-found", z, n)==0 && i<(nArg-1) ){ i++; zLostAndFound = azArg[i]; }else if( n<=10 && memcmp("-no-rowids", z, n)==0 ){ bRowids = 0; } else{ utf8_printf(stderr, "unexpected option: %s\n", azArg[i]); showHelp(pState->out, azArg[0]); return 1; } } shellExecPrintf(pState->db, &rc, /* Attach an in-memory database named 'recovery'. Create an indexed ** cache of the sqlite_dbptr virtual table. */ "PRAGMA writable_schema = on;" "ATTACH %Q AS recovery;" "DROP TABLE IF EXISTS recovery.dbptr;" "DROP TABLE IF EXISTS recovery.freelist;" "DROP TABLE IF EXISTS recovery.map;" "DROP TABLE IF EXISTS recovery.schema;" "CREATE TABLE recovery.freelist(pgno INTEGER PRIMARY KEY);", zRecoveryDb ); if( bFreelist ){ shellExec(pState->db, &rc, "WITH trunk(pgno) AS (" " SELECT shell_int32(" " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 8) AS x " " WHERE x>0" " UNION" " SELECT shell_int32(" " (SELECT data FROM sqlite_dbpage WHERE pgno=trunk.pgno), 0) AS x " " FROM trunk WHERE x>0" ")," "freelist(data, n, freepgno) AS (" " SELECT data, min(16384, shell_int32(data, 1)-1), t.pgno " " FROM trunk t, sqlite_dbpage s WHERE s.pgno=t.pgno" " UNION ALL" " SELECT data, n-1, shell_int32(data, 2+n) " " FROM freelist WHERE n>=0" ")" "REPLACE INTO recovery.freelist SELECT freepgno FROM freelist;" ); } /* If this is an auto-vacuum database, add all pointer-map pages to ** the freelist table. Do this regardless of whether or not ** --freelist-corrupt was specified. */ shellExec(pState->db, &rc, "WITH ptrmap(pgno) AS (" " SELECT 2 WHERE shell_int32(" " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 13" " )" " UNION ALL " " SELECT pgno+1+(SELECT page_size FROM pragma_page_size)/5 AS pp " " FROM ptrmap WHERE pp<=(SELECT page_count FROM pragma_page_count)" ")" "REPLACE INTO recovery.freelist SELECT pgno FROM ptrmap" ); shellExec(pState->db, &rc, "CREATE TABLE recovery.dbptr(" " pgno, child, PRIMARY KEY(child, pgno)" ") WITHOUT ROWID;" "INSERT OR IGNORE INTO recovery.dbptr(pgno, child) " " SELECT * FROM sqlite_dbptr" " WHERE pgno NOT IN freelist AND child NOT IN freelist;" /* Delete any pointer to page 1. This ensures that page 1 is considered ** a root page, regardless of how corrupt the db is. */ "DELETE FROM recovery.dbptr WHERE child = 1;" /* Delete all pointers to any pages that have more than one pointer ** to them. Such pages will be treated as root pages when recovering ** data. */ "DELETE FROM recovery.dbptr WHERE child IN (" " SELECT child FROM recovery.dbptr GROUP BY child HAVING count(*)>1" ");" /* Create the "map" table that will (eventually) contain instructions ** for dealing with each page in the db that contains one or more ** records. */ "CREATE TABLE recovery.map(" "pgno INTEGER PRIMARY KEY, maxlen INT, intkey, root INT" ");" /* Populate table [map]. If there are circular loops of pages in the ** database, the following adds all pages in such a loop to the map ** as individual root pages. This could be handled better. */ "WITH pages(i, maxlen) AS (" " SELECT page_count, (" " SELECT max(field+1) FROM sqlite_dbdata WHERE pgno=page_count" " ) FROM pragma_page_count WHERE page_count>0" " UNION ALL" " SELECT i-1, (" " SELECT max(field+1) FROM sqlite_dbdata WHERE pgno=i-1" " ) FROM pages WHERE i>=2" ")" "INSERT INTO recovery.map(pgno, maxlen, intkey, root) " " SELECT i, maxlen, NULL, (" " WITH p(orig, pgno, parent) AS (" " SELECT 0, i, (SELECT pgno FROM recovery.dbptr WHERE child=i)" " UNION " " SELECT i, p.parent, " " (SELECT pgno FROM recovery.dbptr WHERE child=p.parent) FROM p" " )" " SELECT pgno FROM p WHERE (parent IS NULL OR pgno = orig)" ") " "FROM pages WHERE maxlen IS NOT NULL AND i NOT IN freelist;" "UPDATE recovery.map AS o SET intkey = (" " SELECT substr(data, 1, 1)==X'0D' FROM sqlite_dbpage WHERE pgno=o.pgno" ");" /* Extract data from page 1 and any linked pages into table ** recovery.schema. With the same schema as an sqlite_master table. */ "CREATE TABLE recovery.schema(type, name, tbl_name, rootpage, sql);" "INSERT INTO recovery.schema SELECT " " max(CASE WHEN field=0 THEN value ELSE NULL END)," " max(CASE WHEN field=1 THEN value ELSE NULL END)," " max(CASE WHEN field=2 THEN value ELSE NULL END)," " max(CASE WHEN field=3 THEN value ELSE NULL END)," " max(CASE WHEN field=4 THEN value ELSE NULL END)" "FROM sqlite_dbdata WHERE pgno IN (" " SELECT pgno FROM recovery.map WHERE root=1" ")" "GROUP BY pgno, cell;" "CREATE INDEX recovery.schema_rootpage ON schema(rootpage);" ); /* Open a transaction, then print out all non-virtual, non-"sqlite_%" ** CREATE TABLE statements that extracted from the existing schema. */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; /* ".recover" might output content in an order which causes immediate ** foreign key constraints to be violated. So disable foreign-key ** constraint enforcement to prevent problems when running the output ** script. */ raw_printf(pState->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(pState->out, "BEGIN;\n"); raw_printf(pState->out, "PRAGMA writable_schema = on;\n"); shellPrepare(pState->db, &rc, "SELECT sql FROM recovery.schema " "WHERE type='table' AND sql LIKE 'create table%'", &pStmt ); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ const char *zCreateTable = (const char*)sqlite3_column_text(pStmt, 0); raw_printf(pState->out, "CREATE TABLE IF NOT EXISTS %s;\n", &zCreateTable[12] ); } shellFinalize(&rc, pStmt); } /* Figure out if an orphan table will be required. And if so, how many ** user columns it should contain */ shellPrepare(pState->db, &rc, "SELECT coalesce(max(maxlen), -2) FROM recovery.map WHERE root>1" , &pLoop ); if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pLoop) ){ nOrphan = sqlite3_column_int(pLoop, 0); } shellFinalize(&rc, pLoop); pLoop = 0; shellPrepare(pState->db, &rc, "SELECT pgno FROM recovery.map WHERE root=?", &pPages ); shellPrepare(pState->db, &rc, "SELECT max(field), group_concat(shell_escape_crnl(quote" "(case when (? AND field<0) then NULL else value end)" "), ', ')" ", min(field) " "FROM sqlite_dbdata WHERE pgno = ? AND field != ?" "GROUP BY cell", &pCells ); /* Loop through each root page. */ shellPrepare(pState->db, &rc, "SELECT root, intkey, max(maxlen) FROM recovery.map" " WHERE root>1 GROUP BY root, intkey ORDER BY root=(" " SELECT rootpage FROM recovery.schema WHERE name='sqlite_sequence'" ")", &pLoop ); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pLoop) ){ int iRoot = sqlite3_column_int(pLoop, 0); int bIntkey = sqlite3_column_int(pLoop, 1); int nCol = sqlite3_column_int(pLoop, 2); int bNoop = 0; RecoverTable *pTab; assert( bIntkey==0 || bIntkey==1 ); pTab = recoverFindTable(pState, &rc, iRoot, bIntkey, nCol, &bNoop); if( bNoop || rc ) continue; if( pTab==0 ){ if( pOrphan==0 ){ pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); } pTab = pOrphan; if( pTab==0 ) break; } if( 0==sqlite3_stricmp(pTab->zQuoted, "\"sqlite_sequence\"") ){ raw_printf(pState->out, "DELETE FROM sqlite_sequence;\n"); } sqlite3_bind_int(pPages, 1, iRoot); if( bRowids==0 && pTab->iPk<0 ){ sqlite3_bind_int(pCells, 1, 1); }else{ sqlite3_bind_int(pCells, 1, 0); } sqlite3_bind_int(pCells, 3, pTab->iPk); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPages) ){ int iPgno = sqlite3_column_int(pPages, 0); sqlite3_bind_int(pCells, 2, iPgno); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pCells) ){ int nField = sqlite3_column_int(pCells, 0); int iMin = sqlite3_column_int(pCells, 2); const char *zVal = (const char*)sqlite3_column_text(pCells, 1); RecoverTable *pTab2 = pTab; if( pTab!=pOrphan && (iMin<0)!=bIntkey ){ if( pOrphan==0 ){ pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); } pTab2 = pOrphan; if( pTab2==0 ) break; } nField = nField+1; if( pTab2==pOrphan ){ raw_printf(pState->out, "INSERT INTO %s VALUES(%d, %d, %d, %s%s%s);\n", pTab2->zQuoted, iRoot, iPgno, nField, iMin<0 ? "" : "NULL, ", zVal, pTab2->azlCol[nField] ); }else{ raw_printf(pState->out, "INSERT INTO %s(%s) VALUES( %s );\n", pTab2->zQuoted, pTab2->azlCol[nField], zVal ); } } shellReset(&rc, pCells); } shellReset(&rc, pPages); if( pTab!=pOrphan ) recoverFreeTable(pTab); } shellFinalize(&rc, pLoop); shellFinalize(&rc, pPages); shellFinalize(&rc, pCells); recoverFreeTable(pOrphan); /* The rest of the schema */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; shellPrepare(pState->db, &rc, "SELECT sql, name FROM recovery.schema " "WHERE sql NOT LIKE 'create table%'", &pStmt ); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ const char *zSql = (const char*)sqlite3_column_text(pStmt, 0); if( sqlite3_strnicmp(zSql, "create virt", 11)==0 ){ const char *zName = (const char*)sqlite3_column_text(pStmt, 1); char *zPrint = shellMPrintf(&rc, "INSERT INTO sqlite_master VALUES('table', %Q, %Q, 0, %Q)", zName, zName, zSql ); raw_printf(pState->out, "%s;\n", zPrint); sqlite3_free(zPrint); }else{ raw_printf(pState->out, "%s;\n", zSql); } } shellFinalize(&rc, pStmt); } if( rc==SQLITE_OK ){ raw_printf(pState->out, "PRAGMA writable_schema = off;\n"); raw_printf(pState->out, "COMMIT;\n"); } sqlite3_exec(pState->db, "DETACH recovery", 0, 0, 0); return rc; } #endif /* !(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) */ /* ** If an input line begins with "." then invoke this routine to ** process that line. ** ** Return 1 on error, 2 to exit, and 0 otherwise. */ static int do_meta_command(char *zLine, ShellState *p){ int h = 1; int nArg = 0; int n, c; int rc = 0; char *azArg[52]; #ifndef SQLITE_OMIT_VIRTUALTABLE if( p->expert.pExpert ){ expertFinish(p, 1, 0); } #endif /* Parse the input line into tokens. */ while( zLine[h] && nArg<ArraySize(azArg)-1 ){ while( IsSpace(zLine[h]) ){ h++; } if( zLine[h]==0 ) break; if( zLine[h]=='\'' || zLine[h]=='"' ){ int delim = zLine[h++]; azArg[nArg++] = &zLine[h]; while( zLine[h] && zLine[h]!=delim ){ if( zLine[h]=='\\' && delim=='"' && zLine[h+1]!=0 ) h++; h++; } if( zLine[h]==delim ){ zLine[h++] = 0; } if( delim=='"' ) resolve_backslashes(azArg[nArg-1]); }else{ azArg[nArg++] = &zLine[h]; while( zLine[h] && !IsSpace(zLine[h]) ){ h++; } if( zLine[h] ) zLine[h++] = 0; resolve_backslashes(azArg[nArg-1]); } } azArg[nArg] = 0; /* Process the input line. */ if( nArg==0 ) return 0; /* no tokens, no error */ n = strlen30(azArg[0]); c = azArg[0][0]; clearTempFile(p); |
︙ | ︙ | |||
13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 | || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0) ){ const char *zDestFile = 0; const char *zDb = 0; sqlite3 *pDest; sqlite3_backup *pBackup; int j; const char *zVfs = 0; for(j=1; j<nArg; j++){ const char *z = azArg[j]; if( z[0]=='-' ){ if( z[1]=='-' ) z++; if( strcmp(z, "-append")==0 ){ zVfs = "apndvfs"; }else { utf8_printf(stderr, "unknown option: %s\n", azArg[j]); return 1; } }else if( zDestFile==0 ){ zDestFile = azArg[j]; }else if( zDb==0 ){ zDb = zDestFile; zDestFile = azArg[j]; }else{ | > > > > | > > > > | 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 | || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0) ){ const char *zDestFile = 0; const char *zDb = 0; sqlite3 *pDest; sqlite3_backup *pBackup; int j; int bAsync = 0; const char *zVfs = 0; for(j=1; j<nArg; j++){ const char *z = azArg[j]; if( z[0]=='-' ){ if( z[1]=='-' ) z++; if( strcmp(z, "-append")==0 ){ zVfs = "apndvfs"; }else if( strcmp(z, "-async")==0 ){ bAsync = 1; }else { utf8_printf(stderr, "unknown option: %s\n", azArg[j]); return 1; } }else if( zDestFile==0 ){ zDestFile = azArg[j]; }else if( zDb==0 ){ zDb = zDestFile; zDestFile = azArg[j]; }else{ raw_printf(stderr, "Usage: .backup ?DB? ?OPTIONS? FILENAME\n"); return 1; } } if( zDestFile==0 ){ raw_printf(stderr, "missing FILENAME argument on .backup\n"); return 1; } if( zDb==0 ) zDb = "main"; rc = sqlite3_open_v2(zDestFile, &pDest, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, zVfs); if( rc!=SQLITE_OK ){ utf8_printf(stderr, "Error: cannot open \"%s\"\n", zDestFile); close_db(pDest); return 1; } if( bAsync ){ sqlite3_exec(pDest, "PRAGMA synchronous=OFF; PRAGMA journal_mode=OFF;", 0, 0, 0); } open_db(p, 0); pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb); if( pBackup==0 ){ utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest)); close_db(pDest); return 1; } |
︙ | ︙ | |||
13341 13342 13343 13344 13345 13346 13347 | utf8_printf(stderr,"Error: %s\n", zErrMsg); sqlite3_free(zErrMsg); rc = 1; } }else if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){ | | > > > | | > | | | | | | > > > > > > | 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 | utf8_printf(stderr,"Error: %s\n", zErrMsg); sqlite3_free(zErrMsg); rc = 1; } }else if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){ static const struct DbConfigChoices { const char *zName; int op; } aDbConfig[] = { { "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY }, { "enable_trigger", SQLITE_DBCONFIG_ENABLE_TRIGGER }, { "enable_view", SQLITE_DBCONFIG_ENABLE_VIEW }, { "fts3_tokenizer", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER }, { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION }, { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE }, { "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG }, { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP }, { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE }, { "defensive", SQLITE_DBCONFIG_DEFENSIVE }, { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA }, { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE }, { "dqs_dml", SQLITE_DBCONFIG_DQS_DML }, { "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL }, { "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT }, }; int ii, v; open_db(p, 0); for(ii=0; ii<ArraySize(aDbConfig); ii++){ if( nArg>1 && strcmp(azArg[1], aDbConfig[ii].zName)!=0 ) continue; if( nArg>=3 ){ sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0); |
︙ | ︙ | |||
13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 | } }else if( c=='d' && n>=3 && strncmp(azArg[0], "dbinfo", n)==0 ){ rc = shell_dbinfo_command(p, nArg, azArg); }else if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){ const char *zLike = 0; int i; int savedShowHeader = p->showHeader; int savedShellFlags = p->shellFlgs; ShellClearFlag(p, SHFLG_PreserveRowid|SHFLG_Newlines|SHFLG_Echo); for(i=1; i<nArg; i++){ | > > > > > > > | 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 | } }else if( c=='d' && n>=3 && strncmp(azArg[0], "dbinfo", n)==0 ){ rc = shell_dbinfo_command(p, nArg, azArg); }else #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) if( c=='r' && strncmp(azArg[0], "recover", n)==0 ){ open_db(p, 0); rc = recoverDatabaseCmd(p, nArg, azArg); }else #endif /* !(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) */ if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){ const char *zLike = 0; int i; int savedShowHeader = p->showHeader; int savedShellFlags = p->shellFlgs; ShellClearFlag(p, SHFLG_PreserveRowid|SHFLG_Newlines|SHFLG_Echo); for(i=1; i<nArg; i++){ |
︙ | ︙ | |||
13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 | "?--newlines? ?LIKE-PATTERN?\n"); rc = 1; goto meta_command_exit; }else{ zLike = azArg[i]; } } open_db(p, 0); /* When playing back a "dump", the content might appear in an order ** which causes immediate foreign key constraints to be violated. ** So disable foreign-key constraint enforcement to prevent problems. */ raw_printf(p->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(p->out, "BEGIN TRANSACTION;\n"); p->writableSchema = 0; p->showHeader = 0; | > > | 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 | "?--newlines? ?LIKE-PATTERN?\n"); rc = 1; goto meta_command_exit; }else{ zLike = azArg[i]; } } open_db(p, 0); /* When playing back a "dump", the content might appear in an order ** which causes immediate foreign key constraints to be violated. ** So disable foreign-key constraint enforcement to prevent problems. */ raw_printf(p->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(p->out, "BEGIN TRANSACTION;\n"); p->writableSchema = 0; p->showHeader = 0; |
︙ | ︙ | |||
13457 13458 13459 13460 13461 13462 13463 | } if( p->writableSchema ){ raw_printf(p->out, "PRAGMA writable_schema=OFF;\n"); p->writableSchema = 0; } sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0); | | > > > > > > > > > > > > | | 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 | } if( p->writableSchema ){ raw_printf(p->out, "PRAGMA writable_schema=OFF;\n"); p->writableSchema = 0; } sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0); raw_printf(p->out, p->nErr?"ROLLBACK; -- due to errors\n":"COMMIT;\n"); p->showHeader = savedShowHeader; p->shellFlgs = savedShellFlags; }else if( c=='e' && strncmp(azArg[0], "echo", n)==0 ){ if( nArg==2 ){ setOrClearFlag(p, SHFLG_Echo, azArg[1]); }else{ raw_printf(stderr, "Usage: .echo on|off\n"); rc = 1; } }else if( c=='e' && strncmp(azArg[0], "eqp", n)==0 ){ if( nArg==2 ){ p->autoEQPtest = 0; if( p->autoEQPtrace ){ if( p->db ) sqlite3_exec(p->db, "PRAGMA vdbe_trace=OFF;", 0, 0, 0); p->autoEQPtrace = 0; } if( strcmp(azArg[1],"full")==0 ){ p->autoEQP = AUTOEQP_full; }else if( strcmp(azArg[1],"trigger")==0 ){ p->autoEQP = AUTOEQP_trigger; #ifdef SQLITE_DEBUG }else if( strcmp(azArg[1],"test")==0 ){ p->autoEQP = AUTOEQP_on; p->autoEQPtest = 1; }else if( strcmp(azArg[1],"trace")==0 ){ p->autoEQP = AUTOEQP_full; p->autoEQPtrace = 1; open_db(p, 0); sqlite3_exec(p->db, "SELECT name FROM sqlite_master LIMIT 1", 0, 0, 0); sqlite3_exec(p->db, "PRAGMA vdbe_trace=ON;", 0, 0, 0); #endif }else{ p->autoEQP = (u8)booleanValue(azArg[1]); } }else{ raw_printf(stderr, "Usage: .eqp off|on|trace|trigger|full\n"); rc = 1; } }else if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); rc = 2; |
︙ | ︙ | |||
13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 | #ifndef SQLITE_OMIT_VIRTUALTABLE if( c=='e' && strncmp(azArg[0], "expert", n)==0 ){ open_db(p, 0); expertDotCommand(p, azArg, nArg); }else #endif if( c=='f' && strncmp(azArg[0], "fullschema", n)==0 ){ ShellState data; char *zErrMsg = 0; int doStats = 0; memcpy(&data, p, sizeof(data)); data.showHeader = 0; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 | #ifndef SQLITE_OMIT_VIRTUALTABLE if( c=='e' && strncmp(azArg[0], "expert", n)==0 ){ open_db(p, 0); expertDotCommand(p, azArg, nArg); }else #endif if( c=='f' && strncmp(azArg[0], "filectrl", n)==0 ){ static const struct { const char *zCtrlName; /* Name of a test-control option */ int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { { "size_limit", SQLITE_FCNTL_SIZE_LIMIT, "[LIMIT]" }, { "chunk_size", SQLITE_FCNTL_CHUNK_SIZE, "SIZE" }, /* { "win32_av_retry", SQLITE_FCNTL_WIN32_AV_RETRY, "COUNT DELAY" },*/ { "persist_wal", SQLITE_FCNTL_PERSIST_WAL, "[BOOLEAN]" }, { "psow", SQLITE_FCNTL_POWERSAFE_OVERWRITE, "[BOOLEAN]" }, /* { "pragma", SQLITE_FCNTL_PRAGMA, "NAME ARG" },*/ { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" }, { "has_moved", SQLITE_FCNTL_HAS_MOVED, "" }, { "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" }, }; int filectrl = -1; int iCtrl = -1; sqlite3_int64 iRes = 0; /* Integer result to display if rc2==1 */ int isOk = 0; /* 0: usage 1: %lld 2: no-result */ int n2, i; const char *zCmd = 0; open_db(p, 0); zCmd = nArg>=2 ? azArg[1] : "help"; /* The argument can optionally begin with "-" or "--" */ if( zCmd[0]=='-' && zCmd[1] ){ zCmd++; if( zCmd[0]=='-' && zCmd[1] ) zCmd++; } /* --help lists all file-controls */ if( strcmp(zCmd,"help")==0 ){ utf8_printf(p->out, "Available file-controls:\n"); for(i=0; i<ArraySize(aCtrl); i++){ utf8_printf(p->out, " .filectrl %s %s\n", aCtrl[i].zCtrlName, aCtrl[i].zUsage); } rc = 1; goto meta_command_exit; } /* convert filectrl text option to value. allow any unique prefix ** of the option name, or a numerical value. */ n2 = strlen30(zCmd); for(i=0; i<ArraySize(aCtrl); i++){ if( strncmp(zCmd, aCtrl[i].zCtrlName, n2)==0 ){ if( filectrl<0 ){ filectrl = aCtrl[i].ctrlCode; iCtrl = i; }else{ utf8_printf(stderr, "Error: ambiguous file-control: \"%s\"\n" "Use \".filectrl --help\" for help\n", zCmd); rc = 1; goto meta_command_exit; } } } if( filectrl<0 ){ utf8_printf(stderr,"Error: unknown file-control: %s\n" "Use \".filectrl --help\" for help\n", zCmd); }else{ switch(filectrl){ case SQLITE_FCNTL_SIZE_LIMIT: { if( nArg!=2 && nArg!=3 ) break; iRes = nArg==3 ? integerValue(azArg[2]) : -1; sqlite3_file_control(p->db, 0, SQLITE_FCNTL_SIZE_LIMIT, &iRes); isOk = 1; break; } case SQLITE_FCNTL_LOCK_TIMEOUT: case SQLITE_FCNTL_CHUNK_SIZE: { int x; if( nArg!=3 ) break; x = (int)integerValue(azArg[2]); sqlite3_file_control(p->db, 0, filectrl, &x); isOk = 2; break; } case SQLITE_FCNTL_PERSIST_WAL: case SQLITE_FCNTL_POWERSAFE_OVERWRITE: { int x; if( nArg!=2 && nArg!=3 ) break; x = nArg==3 ? booleanValue(azArg[2]) : -1; sqlite3_file_control(p->db, 0, filectrl, &x); iRes = x; isOk = 1; break; } case SQLITE_FCNTL_HAS_MOVED: { int x; if( nArg!=2 ) break; sqlite3_file_control(p->db, 0, filectrl, &x); iRes = x; isOk = 1; break; } case SQLITE_FCNTL_TEMPFILENAME: { char *z = 0; if( nArg!=2 ) break; sqlite3_file_control(p->db, 0, filectrl, &z); if( z ){ utf8_printf(p->out, "%s\n", z); sqlite3_free(z); } isOk = 2; break; } } } if( isOk==0 && iCtrl>=0 ){ utf8_printf(p->out, "Usage: .filectrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ char zBuf[100]; sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", iRes); raw_printf(p->out, "%s\n", zBuf); } }else if( c=='f' && strncmp(azArg[0], "fullschema", n)==0 ){ ShellState data; char *zErrMsg = 0; int doStats = 0; memcpy(&data, p, sizeof(data)); data.showHeader = 0; |
︙ | ︙ | |||
13570 13571 13572 13573 13574 13575 13576 | }else{ raw_printf(p->out, "ANALYZE sqlite_master;\n"); sqlite3_exec(p->db, "SELECT 'ANALYZE sqlite_master'", callback, &data, &zErrMsg); data.cMode = data.mode = MODE_Insert; data.zDestTable = "sqlite_stat1"; shell_exec(&data, "SELECT * FROM sqlite_stat1", &zErrMsg); | < < > > > | > > > > | 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 | }else{ raw_printf(p->out, "ANALYZE sqlite_master;\n"); sqlite3_exec(p->db, "SELECT 'ANALYZE sqlite_master'", callback, &data, &zErrMsg); data.cMode = data.mode = MODE_Insert; data.zDestTable = "sqlite_stat1"; shell_exec(&data, "SELECT * FROM sqlite_stat1", &zErrMsg); data.zDestTable = "sqlite_stat4"; shell_exec(&data, "SELECT * FROM sqlite_stat4", &zErrMsg); raw_printf(p->out, "ANALYZE sqlite_master;\n"); } }else if( c=='h' && strncmp(azArg[0], "headers", n)==0 ){ if( nArg==2 ){ p->showHeader = booleanValue(azArg[1]); }else{ raw_printf(stderr, "Usage: .headers on|off\n"); rc = 1; } }else if( c=='h' && strncmp(azArg[0], "help", n)==0 ){ if( nArg>=2 ){ n = showHelp(p->out, azArg[1]); if( n==0 ){ utf8_printf(p->out, "Nothing matches '%s'\n", azArg[1]); } }else{ showHelp(p->out, 0); } }else if( c=='i' && strncmp(azArg[0], "import", n)==0 ){ char *zTable; /* Insert data into this table */ char *zFile; /* Name of file to extra content from */ sqlite3_stmt *pStmt = NULL; /* A statement */ int nCol; /* Number of columns in the table */ |
︙ | ︙ | |||
13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 | #ifndef SQLITE_UNTESTABLE if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){ char *zSql; char *zCollist = 0; sqlite3_stmt *pStmt; int tnum = 0; int i; if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){ utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n" " .imposter off\n"); rc = 1; goto meta_command_exit; } open_db(p, 0); if( nArg==2 ){ sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1); goto meta_command_exit; } | > > > > > > > > > | > | > > > > > > > < < < < < > > > > > > > > > > | | | > | 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 | #ifndef SQLITE_UNTESTABLE if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){ char *zSql; char *zCollist = 0; sqlite3_stmt *pStmt; int tnum = 0; int isWO = 0; /* True if making an imposter of a WITHOUT ROWID table */ int lenPK = 0; /* Length of the PRIMARY KEY string for isWO tables */ int i; if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){ utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n" " .imposter off\n"); /* Also allowed, but not documented: ** ** .imposter TABLE IMPOSTER ** ** where TABLE is a WITHOUT ROWID table. In that case, the ** imposter is another WITHOUT ROWID table with the columns in ** storage order. */ rc = 1; goto meta_command_exit; } open_db(p, 0); if( nArg==2 ){ sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1); goto meta_command_exit; } zSql = sqlite3_mprintf( "SELECT rootpage, 0 FROM sqlite_master" " WHERE name='%q' AND type='index'" "UNION ALL " "SELECT rootpage, 1 FROM sqlite_master" " WHERE name='%q' AND type='table'" " AND sql LIKE '%%without%%rowid%%'", azArg[1], azArg[1] ); sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( sqlite3_step(pStmt)==SQLITE_ROW ){ tnum = sqlite3_column_int(pStmt, 0); isWO = sqlite3_column_int(pStmt, 1); } sqlite3_finalize(pStmt); zSql = sqlite3_mprintf("PRAGMA index_xinfo='%q'", azArg[1]); rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); i = 0; while( sqlite3_step(pStmt)==SQLITE_ROW ){ char zLabel[20]; const char *zCol = (const char*)sqlite3_column_text(pStmt,2); i++; if( zCol==0 ){ if( sqlite3_column_int(pStmt,1)==-1 ){ zCol = "_ROWID_"; }else{ sqlite3_snprintf(sizeof(zLabel),zLabel,"expr%d",i); zCol = zLabel; } } if( isWO && lenPK==0 && sqlite3_column_int(pStmt,5)==0 && zCollist ){ lenPK = (int)strlen(zCollist); } if( zCollist==0 ){ zCollist = sqlite3_mprintf("\"%w\"", zCol); }else{ zCollist = sqlite3_mprintf("%z,\"%w\"", zCollist, zCol); } } sqlite3_finalize(pStmt); if( i==0 || tnum==0 ){ utf8_printf(stderr, "no such index: \"%s\"\n", azArg[1]); rc = 1; sqlite3_free(zCollist); goto meta_command_exit; } if( lenPK==0 ) lenPK = 100000; zSql = sqlite3_mprintf( "CREATE TABLE \"%w\"(%s,PRIMARY KEY(%.*s))WITHOUT ROWID", azArg[2], zCollist, lenPK, zCollist); sqlite3_free(zCollist); rc = sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 1, tnum); if( rc==SQLITE_OK ){ rc = sqlite3_exec(p->db, zSql, 0, 0, 0); sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 0); if( rc ){ utf8_printf(stderr, "Error in [%s]: %s\n", zSql, sqlite3_errmsg(p->db)); }else{ utf8_printf(stdout, "%s;\n", zSql); raw_printf(stdout, "WARNING: writing to an imposter table will corrupt the \"%s\" %s!\n", azArg[1], isWO ? "table" : "index" ); } }else{ raw_printf(stderr, "SQLITE_TESTCTRL_IMPOSTER returns %d\n", rc); rc = 1; } sqlite3_free(zSql); |
︙ | ︙ | |||
14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 | session_close_all(p); close_db(p->db); p->db = 0; p->zDbFilename = 0; sqlite3_free(p->zFreeOnClose); p->zFreeOnClose = 0; p->openMode = SHELL_OPEN_UNSPEC; /* Check for command-line arguments */ for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){ const char *z = azArg[iName]; if( optionMatch(z,"new") ){ newFlag = 1; #ifdef SQLITE_HAVE_ZLIB }else if( optionMatch(z, "zip") ){ p->openMode = SHELL_OPEN_ZIPFILE; #endif }else if( optionMatch(z, "append") ){ p->openMode = SHELL_OPEN_APPENDVFS; }else if( optionMatch(z, "readonly") ){ p->openMode = SHELL_OPEN_READONLY; }else if( z[0]=='-' ){ utf8_printf(stderr, "unknown option: %s\n", z); rc = 1; goto meta_command_exit; } } /* If a filename is specified, try to open it first */ zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0; | > > > > > > > > > > > > | | 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 | session_close_all(p); close_db(p->db); p->db = 0; p->zDbFilename = 0; sqlite3_free(p->zFreeOnClose); p->zFreeOnClose = 0; p->openMode = SHELL_OPEN_UNSPEC; p->openFlags = 0; p->szMax = 0; /* Check for command-line arguments */ for(iName=1; iName<nArg && azArg[iName][0]=='-'; iName++){ const char *z = azArg[iName]; if( optionMatch(z,"new") ){ newFlag = 1; #ifdef SQLITE_HAVE_ZLIB }else if( optionMatch(z, "zip") ){ p->openMode = SHELL_OPEN_ZIPFILE; #endif }else if( optionMatch(z, "append") ){ p->openMode = SHELL_OPEN_APPENDVFS; }else if( optionMatch(z, "readonly") ){ p->openMode = SHELL_OPEN_READONLY; }else if( optionMatch(z, "nofollow") ){ p->openFlags |= SQLITE_OPEN_NOFOLLOW; #ifdef SQLITE_ENABLE_DESERIALIZE }else if( optionMatch(z, "deserialize") ){ p->openMode = SHELL_OPEN_DESERIALIZE; }else if( optionMatch(z, "hexdb") ){ p->openMode = SHELL_OPEN_HEXDB; }else if( optionMatch(z, "maxsize") && iName+1<nArg ){ p->szMax = integerValue(azArg[++iName]); #endif /* SQLITE_ENABLE_DESERIALIZE */ }else if( z[0]=='-' ){ utf8_printf(stderr, "unknown option: %s\n", z); rc = 1; goto meta_command_exit; } } /* If a filename is specified, try to open it first */ zNewFilename = nArg>iName ? sqlite3_mprintf("%s", azArg[iName]) : 0; if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){ if( newFlag ) shellDeleteFile(zNewFilename); p->zDbFilename = zNewFilename; open_db(p, OPEN_DB_KEEPALIVE); if( p->db==0 ){ utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename); sqlite3_free(zNewFilename); }else{ |
︙ | ︙ | |||
14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 | p->out = stdout; rc = 1; } else { sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); } } }else if( c=='p' && n>=3 && strncmp(azArg[0], "print", n)==0 ){ int i; for(i=1; i<nArg; i++){ if( i>1 ) raw_printf(p->out, " "); utf8_printf(p->out, "%s", azArg[i]); } raw_printf(p->out, "\n"); }else if( c=='p' && strncmp(azArg[0], "prompt", n)==0 ){ if( nArg >= 2) { strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1); } if( nArg >= 3) { strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1); } }else if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){ rc = 2; }else if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 ){ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | > > | 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 | p->out = stdout; rc = 1; } else { sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); } } }else if( c=='p' && n>=3 && strncmp(azArg[0], "parameter", n)==0 ){ open_db(p,0); if( nArg<=1 ) goto parameter_syntax_error; /* .parameter clear ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && strcmp(azArg[1],"clear")==0 ){ sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", 0, 0, 0); }else /* .parameter list ** List all bind parameters. */ if( nArg==2 && strcmp(azArg[1],"list")==0 ){ sqlite3_stmt *pStmt = 0; int rx; int len = 0; rx = sqlite3_prepare_v2(p->db, "SELECT max(length(key)) " "FROM temp.sqlite_parameters;", -1, &pStmt, 0); if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ len = sqlite3_column_int(pStmt, 0); if( len>40 ) len = 40; } sqlite3_finalize(pStmt); pStmt = 0; if( len ){ rx = sqlite3_prepare_v2(p->db, "SELECT key, quote(value) " "FROM temp.sqlite_parameters;", -1, &pStmt, 0); while( sqlite3_step(pStmt)==SQLITE_ROW ){ utf8_printf(p->out, "%-*s %s\n", len, sqlite3_column_text(pStmt,0), sqlite3_column_text(pStmt,1)); } sqlite3_finalize(pStmt); } }else /* .parameter init ** Make sure the TEMP table used to hold bind parameters exists. ** Create it if necessary. */ if( nArg==2 && strcmp(azArg[1],"init")==0 ){ bind_table_init(p); }else /* .parameter set NAME VALUE ** Set or reset a bind parameter. NAME should be the full parameter ** name exactly as it appears in the query. (ex: $abc, @def). The ** VALUE can be in either SQL literal notation, or if not it will be ** understood to be a text string. */ if( nArg==4 && strcmp(azArg[1],"set")==0 ){ int rx; char *zSql; sqlite3_stmt *pStmt; const char *zKey = azArg[2]; const char *zValue = azArg[3]; bind_table_init(p); zSql = sqlite3_mprintf( "REPLACE INTO temp.sqlite_parameters(key,value)" "VALUES(%Q,%s);", zKey, zValue); if( zSql==0 ) shell_out_of_memory(); pStmt = 0; rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rx!=SQLITE_OK ){ sqlite3_finalize(pStmt); pStmt = 0; zSql = sqlite3_mprintf( "REPLACE INTO temp.sqlite_parameters(key,value)" "VALUES(%Q,%Q);", zKey, zValue); if( zSql==0 ) shell_out_of_memory(); rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rx!=SQLITE_OK ){ utf8_printf(p->out, "Error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); pStmt = 0; rc = 1; } } sqlite3_step(pStmt); sqlite3_finalize(pStmt); }else /* .parameter unset NAME ** Remove the NAME binding from the parameter binding table, if it ** exists. */ if( nArg==3 && strcmp(azArg[1],"unset")==0 ){ char *zSql = sqlite3_mprintf( "DELETE FROM temp.sqlite_parameters WHERE key=%Q", azArg[2]); if( zSql==0 ) shell_out_of_memory(); sqlite3_exec(p->db, zSql, 0, 0, 0); sqlite3_free(zSql); }else /* If no command name matches, show a syntax error */ parameter_syntax_error: showHelp(p->out, "parameter"); }else if( c=='p' && n>=3 && strncmp(azArg[0], "print", n)==0 ){ int i; for(i=1; i<nArg; i++){ if( i>1 ) raw_printf(p->out, " "); utf8_printf(p->out, "%s", azArg[i]); } raw_printf(p->out, "\n"); }else #ifndef SQLITE_OMIT_PROGRESS_CALLBACK if( c=='p' && n>=3 && strncmp(azArg[0], "progress", n)==0 ){ int i; int nn = 0; p->flgProgress = 0; p->mxProgress = 0; p->nProgress = 0; for(i=1; i<nArg; i++){ const char *z = azArg[i]; if( z[0]=='-' ){ z++; if( z[0]=='-' ) z++; if( strcmp(z,"quiet")==0 || strcmp(z,"q")==0 ){ p->flgProgress |= SHELL_PROGRESS_QUIET; continue; } if( strcmp(z,"reset")==0 ){ p->flgProgress |= SHELL_PROGRESS_RESET; continue; } if( strcmp(z,"once")==0 ){ p->flgProgress |= SHELL_PROGRESS_ONCE; continue; } if( strcmp(z,"limit")==0 ){ if( i+1>=nArg ){ utf8_printf(stderr, "Error: missing argument on --limit\n"); rc = 1; goto meta_command_exit; }else{ p->mxProgress = (int)integerValue(azArg[++i]); } continue; } utf8_printf(stderr, "Error: unknown option: \"%s\"\n", azArg[i]); rc = 1; goto meta_command_exit; }else{ nn = (int)integerValue(z); } } open_db(p, 0); sqlite3_progress_handler(p->db, nn, progress_handler, p); }else #endif /* SQLITE_OMIT_PROGRESS_CALLBACK */ if( c=='p' && strncmp(azArg[0], "prompt", n)==0 ){ if( nArg >= 2) { strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1); } if( nArg >= 3) { strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1); } }else if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){ rc = 2; }else if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 ){ FILE *inSaved = p->in; int savedLineno = p->lineno; if( nArg!=2 ){ raw_printf(stderr, "Usage: .read FILE\n"); rc = 1; goto meta_command_exit; } p->in = fopen(azArg[1], "rb"); if( p->in==0 ){ utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]); rc = 1; }else{ rc = process_input(p); fclose(p->in); } p->in = inSaved; p->lineno = savedLineno; }else if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 ){ const char *zSrcFile; const char *zDb; sqlite3 *pSrc; sqlite3_backup *pBackup; |
︙ | ︙ | |||
14335 14336 14337 14338 14339 14340 14341 | const char *zDb = (const char*)sqlite3_column_text(pStmt, 0); char zScNum[30]; sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema); appendText(&sSelect, zDiv, 0); zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ | | | | | > | 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 | const char *zDb = (const char*)sqlite3_column_text(pStmt, 0); char zScNum[30]; sqlite3_snprintf(sizeof(zScNum), zScNum, "%d", ++iSchema); appendText(&sSelect, zDiv, 0); zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ appendText(&sSelect, zDb, '\''); }else{ appendText(&sSelect, "NULL", 0); } appendText(&sSelect, ",name) AS sql, type, tbl_name, name, rowid,", 0); appendText(&sSelect, zScNum, 0); appendText(&sSelect, " AS snum, ", 0); appendText(&sSelect, zDb, '\''); appendText(&sSelect, " AS sname FROM ", 0); appendText(&sSelect, zDb, quoteChar(zDb)); appendText(&sSelect, ".sqlite_master", 0); } sqlite3_finalize(pStmt); #ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS if( zName ){ appendText(&sSelect, " UNION ALL SELECT shell_module_schema(name)," " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", 0); } #endif appendText(&sSelect, ") WHERE ", 0); if( zName ){ char *zQarg = sqlite3_mprintf("%Q", zName); int bGlob = strchr(zName, '*') != 0 || strchr(zName, '?') != 0 || strchr(zName, '[') != 0; |
︙ | ︙ | |||
14451 14452 14453 14454 14455 14456 14457 | */ if( strcmp(azCmd[0],"changeset")==0 || strcmp(azCmd[0],"patchset")==0 ){ FILE *out = 0; if( nCmd!=2 ) goto session_syntax_error; if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ | | > | 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 | */ if( strcmp(azCmd[0],"changeset")==0 || strcmp(azCmd[0],"patchset")==0 ){ FILE *out = 0; if( nCmd!=2 ) goto session_syntax_error; if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", azCmd[1]); }else{ int szChng; void *pChng; if( azCmd[0][0]=='c' ){ rc = sqlite3session_changeset(pSession->p, &szChng, &pChng); }else{ rc = sqlite3session_patchset(pSession->p, &szChng, &pChng); |
︙ | ︙ | |||
14592 14593 14594 14595 14596 14597 14598 | pSession->nFilter = 0; sqlite3session_table_filter(pSession->p, session_filter, pSession); p->nSession++; pSession->zName = sqlite3_mprintf("%s", zName); }else /* If no command name matches, show a syntax error */ session_syntax_error: | | | 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 | pSession->nFilter = 0; sqlite3session_table_filter(pSession->p, session_filter, pSession); p->nSession++; pSession->zName = sqlite3_mprintf("%s", zName); }else /* If no command name matches, show a syntax error */ session_syntax_error: showHelp(p->out, "session"); }else #endif #ifdef SQLITE_DEBUG /* Undocumented commands for internal testing. Subject to change ** without notice. */ if( c=='s' && n>=10 && strncmp(azArg[0], "selftest-", 9)==0 ){ |
︙ | ︙ | |||
14772 14773 14774 14775 14776 14777 14778 | }else if( strcmp(z,"debug")==0 ){ bDebug = 1; }else { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); | | < | 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 | }else if( strcmp(z,"debug")==0 ){ bDebug = 1; }else { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } }else if( zLike ){ raw_printf(stderr, "Usage: .sha3sum ?OPTIONS? ?LIKE-PATTERN?\n"); rc = 1; goto meta_command_exit; |
︙ | ︙ | |||
14819 14820 14821 14822 14823 14824 14825 | " ORDER BY name;", 0); }else if( strcmp(zTab, "sqlite_sequence")==0 ){ appendText(&sQuery,"SELECT name,seq FROM sqlite_sequence" " ORDER BY name;", 0); }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); | | < | 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 | " ORDER BY name;", 0); }else if( strcmp(zTab, "sqlite_sequence")==0 ){ appendText(&sQuery,"SELECT name,seq FROM sqlite_sequence" " ORDER BY name;", 0); }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); }else if( strcmp(zTab, "sqlite_stat4")==0 ){ appendText(&sQuery, "SELECT * FROM ", 0); appendText(&sQuery, zTab, 0); appendText(&sQuery, " ORDER BY tbl, idx, rowid;\n", 0); } appendText(&sSql, zSep, 0); appendText(&sSql, sQuery.z, '\''); sQuery.n = 0; |
︙ | ︙ | |||
15052 15053 15054 15055 15056 15057 15058 | #ifndef SQLITE_UNTESTABLE if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){ static const struct { const char *zCtrlName; /* Name of a test-control option */ int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { | | | | | | > | | > | | | | | < | | > | | 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 | #ifndef SQLITE_UNTESTABLE if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){ static const struct { const char *zCtrlName; /* Name of a test-control option */ int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" }, /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/ { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, #ifdef YYCOVERAGE { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, #endif { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" }, { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE"}, }; int testctrl = -1; int iCtrl = -1; int rc2 = 0; /* 0: usage. 1: %d 2: %x 3: no-output */ int isOk = 0; int i, n2; const char *zCmd = 0; |
︙ | ︙ | |||
15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 | case SQLITE_TESTCTRL_PENDING_BYTE: if( nArg==3 ){ unsigned int opt = (unsigned int)integerValue(azArg[2]); rc2 = sqlite3_test_control(testctrl, opt); isOk = 3; } break; /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: if( nArg==3 ){ int opt = booleanValue(azArg[2]); rc2 = sqlite3_test_control(testctrl, opt); isOk = 1; } break; | > > > > > > > > > > > > > > > > > > > > > > | 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 | case SQLITE_TESTCTRL_PENDING_BYTE: if( nArg==3 ){ unsigned int opt = (unsigned int)integerValue(azArg[2]); rc2 = sqlite3_test_control(testctrl, opt); isOk = 3; } break; /* sqlite3_test_control(int, int, sqlite3*) */ case SQLITE_TESTCTRL_PRNG_SEED: if( nArg==3 || nArg==4 ){ int ii = (int)integerValue(azArg[2]); sqlite3 *db; if( ii==0 && strcmp(azArg[2],"random")==0 ){ sqlite3_randomness(sizeof(ii),&ii); printf("-- random seed: %d\n", ii); } if( nArg==3 ){ db = 0; }else{ db = p->db; /* Make sure the schema has been loaded */ sqlite3_table_column_metadata(db, 0, "x", 0, 0, 0, 0, 0, 0); } rc2 = sqlite3_test_control(testctrl, ii, db); isOk = 3; } break; /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS: if( nArg==3 ){ int opt = booleanValue(azArg[2]); rc2 = sqlite3_test_control(testctrl, opt); isOk = 1; } break; |
︙ | ︙ | |||
15190 15191 15192 15193 15194 15195 15196 | sqlite3_test_control(testctrl, p->out); isOk = 3; } #endif } } if( isOk==0 && iCtrl>=0 ){ | | | 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 | sqlite3_test_control(testctrl, p->out); isOk = 3; } #endif } } if( isOk==0 && iCtrl>=0 ){ utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ raw_printf(p->out, "%d\n", rc2); }else if( isOk==2 ){ raw_printf(p->out, "0x%08x\n", rc2); } }else |
︙ | ︙ | |||
15218 15219 15220 15221 15222 15223 15224 15225 15226 | } }else{ raw_printf(stderr, "Usage: .timer on|off\n"); rc = 1; } }else if( c=='t' && strncmp(azArg[0], "trace", n)==0 ){ open_db(p, 0); | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > | | | | > | | < > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > | > | 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 | } }else{ raw_printf(stderr, "Usage: .timer on|off\n"); rc = 1; } }else #ifndef SQLITE_OMIT_TRACE if( c=='t' && strncmp(azArg[0], "trace", n)==0 ){ int mType = 0; int jj; open_db(p, 0); for(jj=1; jj<nArg; jj++){ const char *z = azArg[jj]; if( z[0]=='-' ){ if( optionMatch(z, "expanded") ){ p->eTraceType = SHELL_TRACE_EXPANDED; } #ifdef SQLITE_ENABLE_NORMALIZE else if( optionMatch(z, "normalized") ){ p->eTraceType = SHELL_TRACE_NORMALIZED; } #endif else if( optionMatch(z, "plain") ){ p->eTraceType = SHELL_TRACE_PLAIN; } else if( optionMatch(z, "profile") ){ mType |= SQLITE_TRACE_PROFILE; } else if( optionMatch(z, "row") ){ mType |= SQLITE_TRACE_ROW; } else if( optionMatch(z, "stmt") ){ mType |= SQLITE_TRACE_STMT; } else if( optionMatch(z, "close") ){ mType |= SQLITE_TRACE_CLOSE; } else { raw_printf(stderr, "Unknown option \"%s\" on \".trace\"\n", z); rc = 1; goto meta_command_exit; } }else{ output_file_close(p->traceOut); p->traceOut = output_file_open(azArg[1], 0); } } if( p->traceOut==0 ){ sqlite3_trace_v2(p->db, 0, 0, 0); }else{ if( mType==0 ) mType = SQLITE_TRACE_STMT; sqlite3_trace_v2(p->db, mType, sql_trace_callback, p); } }else #endif /* !defined(SQLITE_OMIT_TRACE) */ #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE) if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){ int ii; int lenOpt; char *zOpt; if( nArg<2 ){ raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); rc = 1; goto meta_command_exit; } open_db(p, 0); zOpt = azArg[1]; if( zOpt[0]=='-' && zOpt[1]=='-' && zOpt[2]!=0 ) zOpt++; lenOpt = (int)strlen(zOpt); if( lenOpt>=3 && strncmp(zOpt, "-allexcept",lenOpt)==0 ){ assert( azArg[nArg]==0 ); sqlite3_drop_modules(p->db, nArg>2 ? (const char**)(azArg+2) : 0); }else{ for(ii=1; ii<nArg; ii++){ sqlite3_create_module(p->db, azArg[ii], 0, 0); } } }else #endif #if SQLITE_USER_AUTHENTICATION if( c=='u' && strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ raw_printf(stderr, "Usage: .user SUBCOMMAND ...\n"); rc = 1; goto meta_command_exit; } open_db(p, 0); if( strcmp(azArg[1],"login")==0 ){ if( nArg!=4 ){ raw_printf(stderr, "Usage: .user login USER PASSWORD\n"); rc = 1; goto meta_command_exit; } rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); if( rc ){ utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); rc = 1; } }else if( strcmp(azArg[1],"add")==0 ){ if( nArg!=5 ){ raw_printf(stderr, "Usage: .user add USER PASSWORD ISADMIN\n"); |
︙ | ︙ | |||
15447 15448 15449 15450 15451 15452 15453 | /* ** We need a default sqlite3_complete() implementation to use in case ** the shell is compiled with SQLITE_OMIT_COMPLETE. The default assumes ** any arbitrary text is a complete SQL statement. This is not very ** user-friendly, but it does seem to work. */ #ifdef SQLITE_OMIT_COMPLETE | | | 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 | /* ** We need a default sqlite3_complete() implementation to use in case ** the shell is compiled with SQLITE_OMIT_COMPLETE. The default assumes ** any arbitrary text is a complete SQL statement. This is not very ** user-friendly, but it does seem to work. */ #ifdef SQLITE_OMIT_COMPLETE #define sqlite3_complete(x) 1 #endif /* ** Return true if zSql is a complete SQL statement. Return false if it ** ends in the middle of a string literal or C-style comment. */ static int line_is_complete(char *zSql, int nSql){ |
︙ | ︙ | |||
15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 | */ static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startline){ int rc; char *zErrMsg = 0; open_db(p, 0); if( ShellHasFlag(p,SHFLG_Backslash) ) resolve_backslashes(zSql); BEGIN_TIMER; rc = shell_exec(p, zSql, &zErrMsg); END_TIMER; if( rc || zErrMsg ){ char zPrefix[100]; if( in!=0 || !stdin_is_interactive ){ sqlite3_snprintf(sizeof(zPrefix), zPrefix, | > | 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 | */ static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startline){ int rc; char *zErrMsg = 0; open_db(p, 0); if( ShellHasFlag(p,SHFLG_Backslash) ) resolve_backslashes(zSql); if( p->flgProgress & SHELL_PROGRESS_RESET ) p->nProgress = 0; BEGIN_TIMER; rc = shell_exec(p, zSql, &zErrMsg); END_TIMER; if( rc || zErrMsg ){ char zPrefix[100]; if( in!=0 || !stdin_is_interactive ){ sqlite3_snprintf(sizeof(zPrefix), zPrefix, |
︙ | ︙ | |||
15509 15510 15511 15512 15513 15514 15515 | ** is interactive - the user is typing it it. Otherwise, input ** is coming from a file or device. A prompt is issued and history ** is saved only if input is interactive. An interrupt signal will ** cause this routine to exit immediately, unless input is interactive. ** ** Return the number of errors. */ | | < > | | | | | | 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 | ** is interactive - the user is typing it it. Otherwise, input ** is coming from a file or device. A prompt is issued and history ** is saved only if input is interactive. An interrupt signal will ** cause this routine to exit immediately, unless input is interactive. ** ** Return the number of errors. */ static int process_input(ShellState *p){ char *zLine = 0; /* A single input line */ char *zSql = 0; /* Accumulated SQL text */ int nLine; /* Length of current line */ int nSql = 0; /* Bytes of zSql[] used */ int nAlloc = 0; /* Allocated zSql[] space */ int nSqlPrior = 0; /* Bytes of zSql[] used by prior line */ int rc; /* Error code */ int errCnt = 0; /* Number of errors seen */ int startline = 0; /* Line number for start of current input */ p->lineno = 0; while( errCnt==0 || !bail_on_error || (p->in==0 && stdin_is_interactive) ){ fflush(p->out); zLine = one_input_line(p->in, zLine, nSql>0); if( zLine==0 ){ /* End of input */ if( p->in==0 && stdin_is_interactive ) printf("\n"); break; } if( seenInterrupt ){ if( p->in!=0 ) break; seenInterrupt = 0; } p->lineno++; if( nSql==0 && _all_whitespace(zLine) ){ if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine); continue; } if( zLine && (zLine[0]=='.' || zLine[0]=='#') && nSql==0 ){ if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine); if( zLine[0]=='.' ){ |
︙ | ︙ | |||
15565 15566 15567 15568 15569 15570 15571 | } nSqlPrior = nSql; if( nSql==0 ){ int i; for(i=0; zLine[i] && IsSpace(zLine[i]); i++){} assert( nAlloc>0 && zSql!=0 ); memcpy(zSql, zLine+i, nLine+1-i); | | | | | 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 | } nSqlPrior = nSql; if( nSql==0 ){ int i; for(i=0; zLine[i] && IsSpace(zLine[i]); i++){} assert( nAlloc>0 && zSql!=0 ); memcpy(zSql, zLine+i, nLine+1-i); startline = p->lineno; nSql = nLine-i; }else{ zSql[nSql++] = '\n'; memcpy(zSql+nSql, zLine, nLine+1); nSql += nLine; } if( nSql && line_contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior) && sqlite3_complete(zSql) ){ errCnt += runOneSqlLine(p, zSql, p->in, startline); nSql = 0; if( p->outCount ){ output_reset(p); p->outCount = 0; }else{ clearTempFile(p); } }else if( nSql && _all_whitespace(zSql) ){ if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zSql); nSql = 0; } } if( nSql && !_all_whitespace(zSql) ){ errCnt += runOneSqlLine(p, zSql, p->in, startline); } free(zSql); free(zLine); return errCnt>0; } /* |
︙ | ︙ | |||
15677 15678 15679 15680 15681 15682 15683 | static void process_sqliterc( ShellState *p, /* Configuration data */ const char *sqliterc_override /* Name of config file. NULL to use default */ ){ char *home_dir = NULL; const char *sqliterc = sqliterc_override; char *zBuf = 0; | | > | | | | > > > > > > > > > > | 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 | static void process_sqliterc( ShellState *p, /* Configuration data */ const char *sqliterc_override /* Name of config file. NULL to use default */ ){ char *home_dir = NULL; const char *sqliterc = sqliterc_override; char *zBuf = 0; FILE *inSaved = p->in; int savedLineno = p->lineno; if (sqliterc == NULL) { home_dir = find_home_dir(0); if( home_dir==0 ){ raw_printf(stderr, "-- warning: cannot find home directory;" " cannot read ~/.sqliterc\n"); return; } zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir); sqliterc = zBuf; } p->in = fopen(sqliterc,"rb"); if( p->in ){ if( stdin_is_interactive ){ utf8_printf(stderr,"-- Loading resources from %s\n",sqliterc); } process_input(p); fclose(p->in); } p->in = inSaved; p->lineno = savedLineno; sqlite3_free(zBuf); } /* ** Show available command line options */ static const char zOptions[] = #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE) " -A ARGS... run \".archive ARGS\" and exit\n" #endif " -append append the database to the end of the file\n" " -ascii set output mode to 'ascii'\n" " -bail stop after hitting an error\n" " -batch force batch I/O\n" " -column set output mode to 'column'\n" " -cmd COMMAND run \"COMMAND\" before reading stdin\n" " -csv set output mode to 'csv'\n" #if defined(SQLITE_ENABLE_DESERIALIZE) " -deserialize open the database using sqlite3_deserialize()\n" #endif " -echo print commands before execution\n" " -init FILENAME read/process named file\n" " -[no]header turn headers on or off\n" #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5) " -heap SIZE Size of heap for memsys3 or memsys5\n" #endif " -help show this message\n" " -html set output mode to HTML\n" " -interactive force interactive I/O\n" " -line set output mode to 'line'\n" " -list set output mode to 'list'\n" " -lookaside SIZE N use N entries of SZ bytes for lookaside memory\n" #if defined(SQLITE_ENABLE_DESERIALIZE) " -maxsize N maximum size for a --deserialize database\n" #endif " -memtrace trace all memory allocations and deallocations\n" " -mmap N default mmap size set to N\n" #ifdef SQLITE_ENABLE_MULTIPLEX " -multiplex enable the multiplexor VFS\n" #endif " -newline SEP set output row separator. Default: '\\n'\n" " -nofollow refuse to open symbolic links to database files\n" " -nullvalue TEXT set text string for NULL values. Default ''\n" " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n" " -quote set output mode to 'quote'\n" " -readonly open the database read-only\n" " -separator SEP set output column separator. Default: '|'\n" #ifdef SQLITE_ENABLE_SORTER_REFERENCES " -sorterref SIZE sorter references threshold size\n" |
︙ | ︙ | |||
16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 | zVfs = cmdline_option_value(argc, argv, ++i); #ifdef SQLITE_HAVE_ZLIB }else if( strcmp(z,"-zip")==0 ){ data.openMode = SHELL_OPEN_ZIPFILE; #endif }else if( strcmp(z,"-append")==0 ){ data.openMode = SHELL_OPEN_APPENDVFS; }else if( strcmp(z,"-readonly")==0 ){ data.openMode = SHELL_OPEN_READONLY; #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) }else if( strncmp(z, "-A",2)==0 ){ /* All remaining command-line arguments are passed to the ".archive" ** command, so ignore them */ break; #endif } } verify_uninitialized(); #ifdef SQLITE_SHELL_INIT_PROC { | > > > > > > > > > > | 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 | zVfs = cmdline_option_value(argc, argv, ++i); #ifdef SQLITE_HAVE_ZLIB }else if( strcmp(z,"-zip")==0 ){ data.openMode = SHELL_OPEN_ZIPFILE; #endif }else if( strcmp(z,"-append")==0 ){ data.openMode = SHELL_OPEN_APPENDVFS; #ifdef SQLITE_ENABLE_DESERIALIZE }else if( strcmp(z,"-deserialize")==0 ){ data.openMode = SHELL_OPEN_DESERIALIZE; }else if( strcmp(z,"-maxsize")==0 && i+1<argc ){ data.szMax = integerValue(argv[++i]); #endif }else if( strcmp(z,"-readonly")==0 ){ data.openMode = SHELL_OPEN_READONLY; }else if( strcmp(z,"-nofollow")==0 ){ data.openFlags = SQLITE_OPEN_NOFOLLOW; #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) }else if( strncmp(z, "-A",2)==0 ){ /* All remaining command-line arguments are passed to the ".archive" ** command, so ignore them */ break; #endif }else if( strcmp(z, "-memtrace")==0 ){ sqlite3MemTraceActivate(stderr); } } verify_uninitialized(); #ifdef SQLITE_SHELL_INIT_PROC { |
︙ | ︙ | |||
16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 | memcpy(data.colSeparator,",",2); #ifdef SQLITE_HAVE_ZLIB }else if( strcmp(z,"-zip")==0 ){ data.openMode = SHELL_OPEN_ZIPFILE; #endif }else if( strcmp(z,"-append")==0 ){ data.openMode = SHELL_OPEN_APPENDVFS; }else if( strcmp(z,"-readonly")==0 ){ data.openMode = SHELL_OPEN_READONLY; }else if( strcmp(z,"-ascii")==0 ){ data.mode = MODE_Ascii; sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, SEP_Unit); sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, SEP_Record); }else if( strcmp(z,"-separator")==0 ){ | > > > > > > > > | 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 | memcpy(data.colSeparator,",",2); #ifdef SQLITE_HAVE_ZLIB }else if( strcmp(z,"-zip")==0 ){ data.openMode = SHELL_OPEN_ZIPFILE; #endif }else if( strcmp(z,"-append")==0 ){ data.openMode = SHELL_OPEN_APPENDVFS; #ifdef SQLITE_ENABLE_DESERIALIZE }else if( strcmp(z,"-deserialize")==0 ){ data.openMode = SHELL_OPEN_DESERIALIZE; }else if( strcmp(z,"-maxsize")==0 && i+1<argc ){ data.szMax = integerValue(argv[++i]); #endif }else if( strcmp(z,"-readonly")==0 ){ data.openMode = SHELL_OPEN_READONLY; }else if( strcmp(z,"-nofollow")==0 ){ data.openFlags |= SQLITE_OPEN_NOFOLLOW; }else if( strcmp(z,"-ascii")==0 ){ data.mode = MODE_Ascii; sqlite3_snprintf(sizeof(data.colSeparator), data.colSeparator, SEP_Unit); sqlite3_snprintf(sizeof(data.rowSeparator), data.rowSeparator, SEP_Record); }else if( strcmp(z,"-separator")==0 ){ |
︙ | ︙ | |||
16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 | }else if( strcmp(z,"-heap")==0 ){ i++; }else if( strcmp(z,"-pagecache")==0 ){ i+=2; }else if( strcmp(z,"-lookaside")==0 ){ i+=2; }else if( strcmp(z,"-mmap")==0 ){ i++; #ifdef SQLITE_ENABLE_SORTER_REFERENCES }else if( strcmp(z,"-sorterref")==0 ){ i++; #endif }else if( strcmp(z,"-vfs")==0 ){ i++; | > > | 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 | }else if( strcmp(z,"-heap")==0 ){ i++; }else if( strcmp(z,"-pagecache")==0 ){ i+=2; }else if( strcmp(z,"-lookaside")==0 ){ i+=2; }else if( strcmp(z,"-mmap")==0 ){ i++; }else if( strcmp(z,"-memtrace")==0 ){ i++; #ifdef SQLITE_ENABLE_SORTER_REFERENCES }else if( strcmp(z,"-sorterref")==0 ){ i++; #endif }else if( strcmp(z,"-vfs")==0 ){ i++; |
︙ | ︙ | |||
16272 16273 16274 16275 16276 16277 16278 | } free(azCmd); }else{ /* Run commands received from standard input */ if( stdin_is_interactive ){ char *zHome; | | > > > | < > | > | | 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 | } free(azCmd); }else{ /* Run commands received from standard input */ if( stdin_is_interactive ){ char *zHome; char *zHistory; int nHistory; printf( "SQLite version %s %.19s\n" /*extra-version-info*/ "Enter \".help\" for usage hints.\n", sqlite3_libversion(), sqlite3_sourceid() ); if( warnInmemoryDb ){ printf("Connected to a "); printBold("transient in-memory database"); printf(".\nUse \".open FILENAME\" to reopen on a " "persistent database.\n"); } zHistory = getenv("SQLITE_HISTORY"); if( zHistory ){ zHistory = strdup(zHistory); }else if( (zHome = find_home_dir(0))!=0 ){ nHistory = strlen30(zHome) + 20; if( (zHistory = malloc(nHistory))!=0 ){ sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome); } } if( zHistory ){ shell_read_history(zHistory); } #if HAVE_READLINE || HAVE_EDITLINE rl_attempted_completion_function = readline_completion; #elif HAVE_LINENOISE linenoiseSetCompletionCallback(linenoise_completion); #endif data.in = 0; rc = process_input(&data); if( zHistory ){ shell_stifle_history(2000); shell_write_history(zHistory); free(zHistory); } }else{ data.in = stdin; rc = process_input(&data); } } set_table_name(&data, 0); if( data.db ){ session_close_all(&data); close_db(data.db); } |
︙ | ︙ |
Changes to src/shun.c.
︙ | ︙ | |||
172 173 174 175 176 177 178 | @ <a name="addshun"></a> @ <p>To shun artifacts, enter their artifact hashes (the 40- or @ 64-character lowercase hexadecimal hash of the artifact content) in the @ following box and press the "Shun" button. This will cause the artifacts @ to be removed from the repository and will prevent the artifacts from being @ readded to the repository by subsequent sync operation.</p> @ | | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | @ <a name="addshun"></a> @ <p>To shun artifacts, enter their artifact hashes (the 40- or @ 64-character lowercase hexadecimal hash of the artifact content) in the @ following box and press the "Shun" button. This will cause the artifacts @ to be removed from the repository and will prevent the artifacts from being @ readded to the repository by subsequent sync operation.</p> @ @ <p>Note that you must enter full artifact hashes, not abbreviations @ or symbolic tags.</p> @ @ <p>Warning: Shunning should only be used to remove inappropriate content @ from the repository. Inappropriate content includes such things as @ spam added to Wiki, files that violate copyright or patent agreements, @ or artifacts that by design or accident interfere with the processing @ of the repository. Do not shun artifacts merely to remove them from @ sight - set the "hidden" tag on such artifacts instead.</p> |
︙ | ︙ | |||
379 380 381 382 383 384 385 | while( db_step(&q)==SQLITE_ROW ){ int rcvid = db_column_int(&q, 0); const char *zUser = db_column_text(&q, 1); const char *zDate = db_column_text(&q, 2); const char *zIpAddr = db_column_text(&q, 3); int usesSha1 = db_column_int(&q, 5)!=0; int usesSha3 = db_column_int(&q, 6)!=0; | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | while( db_step(&q)==SQLITE_ROW ){ int rcvid = db_column_int(&q, 0); const char *zUser = db_column_text(&q, 1); const char *zDate = db_column_text(&q, 2); const char *zIpAddr = db_column_text(&q, 3); int usesSha1 = db_column_int(&q, 5)!=0; int usesSha3 = db_column_int(&q, 6)!=0; static const char *const zHashType[] = { "", "sha1", "sha3", "both" }; const char *zHash = zHashType[usesSha1+usesSha3*2]; if( cnt==perScreen && !showAll ){ style_submenu_element("Older", "rcvfromlist?ofst=%d", ofst+perScreen); }else{ cnt++; @ <tr> if( db_column_int(&q,4) ){ |
︙ | ︙ |
Changes to src/sitemap.c.
︙ | ︙ | |||
41 42 43 44 45 46 47 | { "Documentation", "sitemap-docidx" }, { "Download", "sitemap-download" }, { "License", "sitemap-license" }, { "Contact", "sitemap-contact" }, }; login_check_credentials(); | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | { "Documentation", "sitemap-docidx" }, { "Download", "sitemap-download" }, { "License", "sitemap-license" }, { "Contact", "sitemap-contact" }, }; login_check_credentials(); if( P("popup")!=0 && cgi_csrf_safe(0) ){ /* If this is a POST from the same origin with the popup=1 parameter, ** then disable anti-robot defenses */ isPopup = 1; g.perm.Hyperlink = 1; g.javascriptHyperlink = 0; } srchFlags = search_restrict(SRCH_ALL); |
︙ | ︙ | |||
191 192 193 194 195 196 197 | @ <li>%z(href("%R/bloblist"))List of Artifacts</a></li> @ <li>%z(href("%R/timewarps"))List of "Timewarp" Check-ins</a></li> @ </ul> @ </li> } @ <li>Help @ <ul> | > > > > | | > > | > | 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 | @ <li>%z(href("%R/bloblist"))List of Artifacts</a></li> @ <li>%z(href("%R/timewarps"))List of "Timewarp" Check-ins</a></li> @ </ul> @ </li> } @ <li>Help @ <ul> if( g.perm.Admin || g.perm.Write || g.perm.WrForum || g.perm.WrTForum || g.perm.NewWiki || g.perm.ApndWiki || g.perm.WrWiki || g.perm.ModWiki || g.perm.NewTkt || g.perm.ApndTkt || g.perm.WrTkt || g.perm.ModTkt ){ @ <li>%z(href("%R/wiki_rules"))Wiki Formatting Rules</a></li> @ <li>%z(href("%R/md_rules"))Markdown Formatting Rules</a></li> } @ <li>%z(href("%R/help"))List of All Commands and Web Pages</a></li> @ <li>%z(href("%R/test-all-help"))All "help" text on a single page</a></li> if( g.perm.Admin || g.perm.Write || g.perm.WrUnver ){ @ <li>%z(href("%R/mimetype_list"))Filename suffix to MIME type map</a></li> } @ </ul></li> if( g.perm.Admin ){ @ <li>%z(href("%R/setup"))Administration Pages</a> @ <ul> @ <li>%z(href("%R/modreq"))Pending Moderation Requests</a></li> @ <li>%z(href("%R/admin_log"))Admin log</a></li> @ <li>%z(href("%R/cachestat"))Status of the web-page cache</a></li> |
︙ | ︙ |
Changes to src/skins.c.
︙ | ︙ | |||
55 56 57 58 59 60 61 | { "Khaki, No Logo", "khaki", 0 }, { "Ardoise", "ardoise", 0 }, }; /* ** A skin consists of five "files" named here: */ | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | { "Khaki, No Logo", "khaki", 0 }, { "Ardoise", "ardoise", 0 }, }; /* ** A skin consists of five "files" named here: */ static const char *const azSkinFile[] = { "css", "header", "footer", "details", "js" }; /* ** Alternative skins can be specified in the CGI script or by options ** on the "http", "ui", and "server" commands. The alternative skin ** name must be one of the aBuiltinSkin[].zLabel names. If there is |
︙ | ︙ | |||
457 458 459 460 461 462 463 | const char *zCurrent = 0; /* Current skin */ int i; /* Loop counter */ Stmt q; int seenCurrent = 0; int once; login_check_credentials(); | | | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | const char *zCurrent = 0; /* Current skin */ int i; /* Loop counter */ Stmt q; int seenCurrent = 0; int once; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } db_begin_transaction(); zCurrent = getSkin(0); for(i=0; i<count(aBuiltinSkin); i++){ aBuiltinSkin[i].zSQL = getSkin(aBuiltinSkin[i].zLabel); |
︙ | ︙ | |||
496 497 498 499 500 501 502 | db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); } } if( skinRename() || skinSave(zCurrent) ){ db_end_transaction(0); return; } | | | | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | db_multi_exec("DELETE FROM config WHERE name GLOB '%q-*'", zDraft); } } if( skinRename() || skinSave(zCurrent) ){ db_end_transaction(0); return; } /* The user pressed one of the "Install" buttons. */ if( P("load") && (z = P("sn"))!=0 && z[0] ){ int seen = 0; /* Check to see if the current skin is already saved. If it is, there ** is no need to create a backup */ zCurrent = getSkin(0); for(i=0; i<count(aBuiltinSkin); i++){ if( fossil_strcmp(aBuiltinSkin[i].zSQL, zCurrent)==0 ){ seen = 1; break; |
︙ | ︙ | |||
537 538 539 540 541 542 543 | if( !seen ){ zName = skinVarName(z,0); zCurrent = db_get(zName, 0); db_multi_exec("%s", zCurrent/*safe-for-%s*/); } } } | | | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | if( !seen ){ zName = skinVarName(z,0); zCurrent = db_get(zName, 0); db_multi_exec("%s", zCurrent/*safe-for-%s*/); } } } style_header("Skins"); if( zErr ){ @ <p style="color:red">%h(zErr)</p> } @ <table border="0"> @ <tr><td colspan=4><h2>Built-in Skins:</h2></td></th> for(i=0; i<count(aBuiltinSkin); i++){ |
︙ | ︙ | |||
674 675 676 677 678 679 680 | static const char *skin_file_content(const char *zLabel, const char *zFile){ const char *zResult; if( fossil_strcmp(zLabel, "current")==0 ){ zResult = db_get(zFile, ""); }else if( sqlite3_strglob("draft[1-9]", zLabel)==0 ){ zResult = db_get_mprintf("", "%s-%s", zLabel, zFile); }else{ | | > | > | | 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 | static const char *skin_file_content(const char *zLabel, const char *zFile){ const char *zResult; if( fossil_strcmp(zLabel, "current")==0 ){ zResult = db_get(zFile, ""); }else if( sqlite3_strglob("draft[1-9]", zLabel)==0 ){ zResult = db_get_mprintf("", "%s-%s", zLabel, zFile); }else{ int i; for(i=0; i<2; i++){ char *zKey = mprintf("skins/%s/%s.txt", zLabel, zFile); zResult = builtin_text(zKey); fossil_free(zKey); if( zResult!=0 ) break; zLabel = "default"; } } return zResult; } /* ** WEBPAGE: setup_skinedit ** ** Edit aspects of a skin determined by the w= query parameter. ** Requires Admin or Setup privileges. ** ** w=NUM -- 0=CSS, 1=footer, 2=header, 3=details, 4=js ** sk=NUM -- the draft skin number */ void setup_skinedit(void){ static const struct sSkinAddr { const char *zFile; |
︙ | ︙ | |||
726 727 728 729 730 731 732 | login_check_credentials(); /* Figure out which skin we are editing */ iSkin = atoi(PD("sk","1")); if( iSkin<1 || iSkin>9 ) iSkin = 1; /* Check that the user is authorized to edit this skin. */ | | | 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | login_check_credentials(); /* Figure out which skin we are editing */ iSkin = atoi(PD("sk","1")); if( iSkin<1 || iSkin>9 ) iSkin = 1; /* Check that the user is authorized to edit this skin. */ if( !g.perm.Admin ){ char *zAllowedEditors = ""; Glob *pAllowedEditors; int isMatch = 0; if( login_is_individual() ){ zAllowedEditors = db_get_mprintf("", "draft%d-users", iSkin); } if( zAllowedEditors[0] ){ |
︙ | ︙ | |||
877 878 879 880 881 882 883 | void setup_skin(void){ int i; /* Loop counter */ int iSkin; /* Which draft skin is being edited */ int isSetup; /* True for an administrator */ int isEditor; /* Others authorized to make edits */ char *zAllowedEditors; /* Who may edit the draft skin */ char *zBase; /* Base URL for draft under test */ | | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | void setup_skin(void){ int i; /* Loop counter */ int iSkin; /* Which draft skin is being edited */ int isSetup; /* True for an administrator */ int isEditor; /* Others authorized to make edits */ char *zAllowedEditors; /* Who may edit the draft skin */ char *zBase; /* Base URL for draft under test */ static const char *const azTestPages[] = { "home", "timeline", "dir?ci=tip", "dir?ci=tip&type=tree", "brlist", "info/trunk", }; |
︙ | ︙ | |||
899 900 901 902 903 904 905 | */ login_check_credentials(); if( !login_is_individual() ){ login_needed(0); return; } zAllowedEditors = db_get_mprintf("", "draft%d-users", iSkin); | | | 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 | */ login_check_credentials(); if( !login_is_individual() ){ login_needed(0); return; } zAllowedEditors = db_get_mprintf("", "draft%d-users", iSkin); if( g.perm.Admin ){ isSetup = isEditor = 1; }else{ Glob *pAllowedEditors; isSetup = isEditor = 0; if( zAllowedEditors[0] ){ pAllowedEditors = glob_create(zAllowedEditors); isEditor = glob_match(pAllowedEditors, g.zLogin); |
︙ | ︙ | |||
1053 1054 1055 1056 1057 1058 1059 | @ <p>Repeat <a href='#step4'>step 4</a> and @ <a href='#step5'>step 5</a> as many times as necessary to create @ a production-ready skin. @ @ <a name='step7'></a> @ <h1>Step 7: Publish</h1> @ | | | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 | @ <p>Repeat <a href='#step4'>step 4</a> and @ <a href='#step5'>step 5</a> as many times as necessary to create @ a production-ready skin. @ @ <a name='step7'></a> @ <h1>Step 7: Publish</h1> @ if( !g.perm.Admin ){ @ <p>Only administrators are allowed to publish draft skins. Contact @ an administrator to get this "draft%d(iSkin)" skin published.</p> }else{ @ <p>When the draft%d(iSkin) skin is ready for production use, @ make it the default scan by clicking the acknowledgements and @ pressing the button below:</p> @ |
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 | @ <p>You will probably need to press Reload on your browser after @ publishing the new skin.</p> } @ @ <a name='step8'></a> @ <h1>Step 8: Cleanup and Undo Actions</h1> @ | | | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | @ <p>You will probably need to press Reload on your browser after @ publishing the new skin.</p> } @ @ <a name='step8'></a> @ <h1>Step 8: Cleanup and Undo Actions</h1> @ if( !g.perm.Admin ){ @ <p>Administrators can optionally save or restore legacy skins, and/or @ undo a prior publish. }else{ @ <p>Visit the <a href='%R/setup_skin_admin'>Skin Admin</a> page @ for cleanup and recovery actions. } style_load_one_js_file("skin.js"); style_footer(); } |
Changes to src/smtp.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 | ** ** Implementation of SMTP (Simple Mail Transport Protocol) according ** to RFC 5321. */ #include "config.h" #include "smtp.h" #include <assert.h> | > | > > > > | | > > > > > > > | 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 | ** ** Implementation of SMTP (Simple Mail Transport Protocol) according ** to RFC 5321. */ #include "config.h" #include "smtp.h" #include <assert.h> #if (HAVE_DN_EXPAND || HAVE___NS_NAME_UNCOMPRESS || HAVE_NS_NAME_UNCOMPRESS) && \ (HAVE_NS_PARSERR || HAVE___NS_PARSERR) && !defined(FOSSIL_OMIT_DNS) # include <sys/types.h> # include <netinet/in.h> # if defined(HAVE_BIND_RESOLV_H) # include <bind/resolv.h> # include <bind/arpa/nameser_compat.h> # else # include <arpa/nameser.h> # include <resolv.h> # endif # if defined(HAVENS_NAME_UNCOMPRESS) && !defined(dn_expand) # define dn_expand ns_name_uncompress # endif # if defined(HAVE__NS_NAME_UNCOMPRESS) && !defined(dn_expand) # define dn_expand __ns_name_uncompress # endif # define FOSSIL_UNIX_STYLE_DNS 1 #endif #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__) # include <windows.h> # include <windns.h> # define FOSSIL_WINDOWS_STYLE_DNS 1 #endif |
︙ | ︙ | |||
75 76 77 78 79 80 81 | if( priority<iBestPriority ){ pBest = p; iBestPriority = priority; } } } if( pBest ){ | < | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | if( priority<iBestPriority ){ pBest = p; iBestPriority = priority; } } } if( pBest ){ dn_expand(aDns, aDns+nDns, pBest+2, zHostname, sizeof(zHostname)); return fossil_strdup(zHostname); } return 0; #elif defined(FOSSIL_WINDOWS_STYLE_DNS) DNS_STATUS status; /* Return status */ PDNS_RECORDA pDnsRecord, p; /* Pointer to DNS_RECORD structure */ int iBestPriority = 9999999; /* Best priority */ |
︙ | ︙ | |||
103 104 105 106 107 108 109 | if( p->Data.MX.wPreference<iBestPriority ){ iBestPriority = p->Data.MX.wPreference; pBest = p->Data.MX.pNameExchange; } p = p->pNext; } if( pBest ){ | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | if( p->Data.MX.wPreference<iBestPriority ){ iBestPriority = p->Data.MX.wPreference; pBest = p->Data.MX.pNameExchange; } p = p->pNext; } if( pBest ){ pBest = fossil_strdup(pBest); } DnsRecordListFree(pDnsRecord, DnsFreeRecordListDeep); return pBest; #else return 0; #endif /* defined(FOSSIL_WINDOWS_STYLE_DNS) */ } |
︙ | ︙ | |||
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 | ** ** Use SMTP to send the email message contained in the file named EMAIL ** to the list of users TO. FROM is the sender of the email. ** ** Options: ** ** --direct Go directly to the TO domain. Bypass MX lookup ** --port N Use TCP port N instead of 25 ** --trace Show the SMTP conversation on the console */ void test_smtp_send(void){ SmtpSession *p; const char *zFrom; int nTo; const char *zToDomain; const char *zFromDomain; const char **azTo; int smtpPort = 25; const char *zPort; Blob body; u32 smtpFlags = SMTP_PORT; if( find_option("trace",0,0)!=0 ) smtpFlags |= SMTP_TRACE_STDOUT; if( find_option("direct",0,0)!=0 ) smtpFlags |= SMTP_DIRECT; zPort = find_option("port",0,1); if( zPort ) smtpPort = atoi(zPort); verify_all_options(); if( g.argc<5 ) usage("EMAIL FROM TO ..."); blob_read_from_file(&body, g.argv[2], ExtFILE); zFrom = g.argv[3]; nTo = g.argc-4; azTo = (const char**)g.argv+4; zFromDomain = domainOfAddr(zFrom); | > > > > > > > | > | 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 | ** ** Use SMTP to send the email message contained in the file named EMAIL ** to the list of users TO. FROM is the sender of the email. ** ** Options: ** ** --direct Go directly to the TO domain. Bypass MX lookup ** --relayhost R Use R as relay host directly for delivery. ** --port N Use TCP port N instead of 25 ** --trace Show the SMTP conversation on the console */ void test_smtp_send(void){ SmtpSession *p; const char *zFrom; int nTo; const char *zToDomain; const char *zFromDomain; const char *zRelay; const char **azTo; int smtpPort = 25; const char *zPort; Blob body; u32 smtpFlags = SMTP_PORT; if( find_option("trace",0,0)!=0 ) smtpFlags |= SMTP_TRACE_STDOUT; if( find_option("direct",0,0)!=0 ) smtpFlags |= SMTP_DIRECT; zPort = find_option("port",0,1); if( zPort ) smtpPort = atoi(zPort); zRelay = find_option("relayhost",0,1); verify_all_options(); if( g.argc<5 ) usage("EMAIL FROM TO ..."); blob_read_from_file(&body, g.argv[2], ExtFILE); zFrom = g.argv[3]; nTo = g.argc-4; azTo = (const char**)g.argv+4; zFromDomain = domainOfAddr(zFrom); if( zRelay!=0 && zRelay[0]!= 0) { smtpFlags |= SMTP_DIRECT; zToDomain = zRelay; }else{ zToDomain = domainOfAddr(azTo[0]); } p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort); if( p->zErr ){ fossil_fatal("%s", p->zErr); } fossil_print("Connection to \"%s\"\n", p->zHostname); smtp_client_startup(p); smtp_send_msg(p, zFrom, nTo, azTo, blob_str(&body)); |
︙ | ︙ | |||
633 634 635 636 637 638 639 | /***************************************************************************** ** Server implementation *****************************************************************************/ /* ** Schema used by the email processing system. */ | | | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | /***************************************************************************** ** Server implementation *****************************************************************************/ /* ** Schema used by the email processing system. */ static const char zEmailSchema[] = @ -- bulk storage is in this table. This table can store either @ -- the body of email messages or transcripts of an smtp session. @ CREATE TABLE IF NOT EXISTS repository.emailblob( @ emailid INTEGER PRIMARY KEY AUTOINCREMENT, -- numeric idea for the entry @ enref INT, -- Number of references to this blob @ ets INT, -- Corresponding transcript, or NULL @ etime INT, -- insertion time, secs since 1970 |
︙ | ︙ | |||
890 891 892 893 894 895 896 | @ <td> @ <td><input type="submit" name="edit" value="Apply"> @ <input type="submit" name="cancel" value="Cancel"> @ </tr> @ </table> @ <hr> @ <h1>Instructions</h1> | | | | 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 | @ <td> @ <td><input type="submit" name="edit" value="Apply"> @ <input type="submit" name="cancel" value="Cancel"> @ </tr> @ </table> @ <hr> @ <h1>Instructions</h1> @ @ <p>The "Routing" field consists of zero or more lines where each @ line is an "action" followed by an "argument". Available actions: @ <ul> @ <li><p><b>forward</b> <i>email-address</i> @ <p>Forward the message to <i>email-address</i>. @ <li><p><b>mbox</b> <i>login-name</i> @ <p>Store the message in the local mailbox for the user @ with USER.LOGIN=<i>login-name</i>. @ </ul> @ @ <p>To delete a route → erase all text from the "Routing" field then @ press the "Apply" button. style_footer(); } #if LOCAL_INTERFACE /* |
︙ | ︙ | |||
938 939 940 941 942 943 944 | #define SMTPSRV_STDERR 0x002 /* Transcription written to stderr */ #define SMTPSRV_DRYRUN 0x004 /* Do not record anything in database */ #endif /* LOCAL_INTERFACE */ /* ** Clear the SmtpServer object. Deallocate resources. | | | 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | #define SMTPSRV_STDERR 0x002 /* Transcription written to stderr */ #define SMTPSRV_DRYRUN 0x004 /* Do not record anything in database */ #endif /* LOCAL_INTERFACE */ /* ** Clear the SmtpServer object. Deallocate resources. ** How much to clear depends on eHowMuch */ static void smtp_server_clear(SmtpServer *p, int eHowMuch){ int i; if( eHowMuch>=SMTPSRV_CLEAR_MSG ){ fossil_free(p->zFrom); p->zFrom = 0; for(i=0; i<p->nTo; i++) fossil_free(p->aTo[i].z); |
︙ | ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | SmtpServer *p, /* The current inbound email */ const char *zAddr, /* Who to forward this to */ int okRemote /* True if ok to foward to another domain */ ){ char *zPolicy; Blob policy, line, token, tail; | | | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | SmtpServer *p, /* The current inbound email */ const char *zAddr, /* Who to forward this to */ int okRemote /* True if ok to foward to another domain */ ){ char *zPolicy; Blob policy, line, token, tail; zPolicy = db_text(0, "SELECT epolicy FROM emailroute WHERE eaddr=%Q", zAddr); if( zPolicy==0 ){ if( okRemote ){ int i; for(i=0; zAddr[i] && zAddr[i]!='@'; i++){} if( zAddr[i]=='@' && zAddr[i+1]!=0 ){ db_multi_exec( |
︙ | ︙ | |||
1191 1192 1193 1194 1195 1196 1197 | p->aTo[i].okRemote = 1; smtp_server_send_one_user(p, p->aTo[i].z, okRemote); } /* Fix up the emailblob.enref field of the email message body */ if( p->nRef ){ db_multi_exec( | | | 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | p->aTo[i].okRemote = 1; smtp_server_send_one_user(p, p->aTo[i].z, okRemote); } /* Fix up the emailblob.enref field of the email message body */ if( p->nRef ){ db_multi_exec( "UPDATE emailblob SET enref=%d WHERE emailid=%lld", p->nRef, p->idMsg ); }else{ db_multi_exec( "DELETE FROM emailblob WHERE emailid=%lld", p->idMsg ); p->nEts = nEtsStart; |
︙ | ︙ | |||
1273 1274 1275 1276 1277 1278 1279 | "UPDATE emailblob SET enref=(SELECT n FROM refcnt WHERE id=emailid)" ); if( doClean ){ smtp_cleanup(); } } blob_init(&sql, 0, 0); | | | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | "UPDATE emailblob SET enref=(SELECT n FROM refcnt WHERE id=emailid)" ); if( doClean ){ smtp_cleanup(); } } blob_init(&sql, 0, 0); blob_append_sql(&sql, "SELECT a.emailid, a.enref, b.n" " FROM emailblob AS a JOIN refcnt AS b ON a.emailid=b.id" ); if( !fullReport ){ blob_append_sql(&sql, " WHERE a.enref!=b.n"); } db_prepare_blob(&q, &sql); |
︙ | ︙ | |||
1297 1298 1299 1300 1301 1302 1303 | if( nErr ){ fossil_print("Number of incorrect emailblob.enref values: %d\n",nErr); } } /* | | | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | if( nErr ){ fossil_print("Number of incorrect emailblob.enref values: %d\n",nErr); } } /* ** COMMAND: smtpd* ** ** Usage: %fossil smtpd [OPTIONS] REPOSITORY ** ** Begin a SMTP conversation with a client using stdin/stdout. The ** received email is stored in REPOSITORY. ** ** Options: |
︙ | ︙ | |||
1444 1445 1446 1447 1448 1449 1450 | ** found in the user table's info field, in angle brackets. */ static int pop3_login(const char *zUser, char *zPass){ return login_search_uid(&zUser, zPass) != 0; } /* | | | 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 | ** found in the user table's info field, in angle brackets. */ static int pop3_login(const char *zUser, char *zPass){ return login_search_uid(&zUser, zPass) != 0; } /* ** COMMAND: pop3d* ** ** Usage: %fossil pop3d [OPTIONS] REPOSITORY ** ** Begin a POP3 conversation with a client using stdin/stdout using ** the mailboxes stored in REPOSITORY. ** ** If launched as root, the process first enters a chroot jail using |
︙ | ︙ | |||
1501 1502 1503 1504 1505 1506 1507 | " WHERE estate<2 AND ebid IN (SELECT ebid FROM pop3 WHERE isDel);" ); } pop3_print(pLog, "+OK"); break; } if( strcmp(zCmd,"capa")==0 ){ | | | 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 | " WHERE estate<2 AND ebid IN (SELECT ebid FROM pop3 WHERE isDel);" ); } pop3_print(pLog, "+OK"); break; } if( strcmp(zCmd,"capa")==0 ){ static const char *const azCap[] = { "TOP", "USER", "UIDL", }; int i; pop3_print(pLog, "+OK"); for(i=0; i<sizeof(azCap)/sizeof(azCap[0]); i++){ pop3_print(pLog, azCap[i]); } |
︙ | ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | "INSERT INTO pop3(id,emailid,ebid,isDel,esz)" " SELECT NULL, emailid, ebid, 0, esz FROM emailblob, emailbox" " WHERE emailid=emsgid AND euser=%Q AND estate<=1" " ORDER BY edate;", zUser ); goto cmd_ok; | | | 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | "INSERT INTO pop3(id,emailid,ebid,isDel,esz)" " SELECT NULL, emailid, ebid, 0, esz FROM emailblob, emailbox" " WHERE emailid=emsgid AND euser=%Q AND estate<=1" " ORDER BY edate;", zUser ); goto cmd_ok; } } /* Fossil cannot process APOP since the users clear-text password is ** unknown. */ goto cmd_error; }else{ if( strcmp(zCmd,"stat")==0 ){ db_prepare(&q, "SELECT count(*), sum(esz) FROM pop3 WHERE NOT isDel"); |
︙ | ︙ |
Changes to src/sqlcmd.c.
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | pOut[0] = nIn>>24 & 0xff; pOut[1] = nIn>>16 & 0xff; pOut[2] = nIn>>8 & 0xff; pOut[3] = nIn & 0xff; rc = compress(&pOut[4], &nOut, pIn, nIn); if( rc==Z_OK ){ sqlite3_result_blob(context, pOut, nOut+4, sqlite3_free); }else{ sqlite3_free(pOut); sqlite3_result_error(context, "input cannot be zlib compressed", -1); } } /* | > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | pOut[0] = nIn>>24 & 0xff; pOut[1] = nIn>>16 & 0xff; pOut[2] = nIn>>8 & 0xff; pOut[3] = nIn & 0xff; rc = compress(&pOut[4], &nOut, pIn, nIn); if( rc==Z_OK ){ sqlite3_result_blob(context, pOut, nOut+4, sqlite3_free); }else if( rc==Z_MEM_ERROR ){ sqlite3_free(pOut); sqlite3_result_error_nomem(context); }else{ sqlite3_free(pOut); sqlite3_result_error(context, "input cannot be zlib compressed", -1); } } /* |
︙ | ︙ | |||
111 112 113 114 115 116 117 118 119 120 121 122 123 124 | pIn = sqlite3_value_blob(argv[0]); nIn = sqlite3_value_bytes(argv[0]); nOut = (pIn[0]<<24) + (pIn[1]<<16) + (pIn[2]<<8) + pIn[3]; pOut = sqlite3_malloc( nOut+1 ); rc = uncompress(pOut, &nOut, &pIn[4], nIn-4); if( rc==Z_OK ){ sqlite3_result_blob(context, pOut, nOut, sqlite3_free); }else{ sqlite3_free(pOut); sqlite3_result_error(context, "input is not zlib compressed", -1); } } /* | > > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | pIn = sqlite3_value_blob(argv[0]); nIn = sqlite3_value_bytes(argv[0]); nOut = (pIn[0]<<24) + (pIn[1]<<16) + (pIn[2]<<8) + pIn[3]; pOut = sqlite3_malloc( nOut+1 ); rc = uncompress(pOut, &nOut, &pIn[4], nIn-4); if( rc==Z_OK ){ sqlite3_result_blob(context, pOut, nOut, sqlite3_free); }else if( rc==Z_MEM_ERROR ){ sqlite3_free(pOut); sqlite3_result_error_nomem(context); }else{ sqlite3_free(pOut); sqlite3_result_error(context, "input is not zlib compressed", -1); } } /* |
︙ | ︙ | |||
146 147 148 149 150 151 152 153 154 155 156 157 158 159 | const void *notUsed ){ add_content_sql_commands(db); db_add_aux_functions(db); re_add_sql_func(db); search_sql_setup(db); foci_register(db); g.repositoryOpen = 1; g.db = db; sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "repository"); db_maybe_set_encryption_key(db, g.zRepositoryName); if( g.zLocalDbName ){ char *zSql = sqlite3_mprintf("ATTACH %Q AS 'localdb' KEY ''", g.zLocalDbName); | > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | const void *notUsed ){ add_content_sql_commands(db); db_add_aux_functions(db); re_add_sql_func(db); search_sql_setup(db); foci_register(db); deltafunc_init(db); g.repositoryOpen = 1; g.db = db; sqlite3_db_config(db, SQLITE_DBCONFIG_MAINDBNAME, "repository"); db_maybe_set_encryption_key(db, g.zRepositoryName); if( g.zLocalDbName ){ char *zSql = sqlite3_mprintf("ATTACH %Q AS 'localdb' KEY ''", g.zLocalDbName); |
︙ | ︙ | |||
253 254 255 256 257 258 259 | ** ** WARNING: Careless use of this command can corrupt a Fossil repository ** in ways that are unrecoverable. Be sure you know what you are doing before ** running any SQL commands that modify the repository database. ** ** The following extensions to the usual SQLite commands are provided: ** | | | > > > > > > > > | | | | > > > > > > > > | < | | | | 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 | ** ** WARNING: Careless use of this command can corrupt a Fossil repository ** in ways that are unrecoverable. Be sure you know what you are doing before ** running any SQL commands that modify the repository database. ** ** The following extensions to the usual SQLite commands are provided: ** ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID) ** found in check-in X (another BLOB.RID value). ** ** compress(X) Compress text X. ** ** content(X) Return the content of artifact X. X can be an ** artifact hash or hash prefix or a tag. Artifacts ** are stored compressed and deltaed. This function ** does all necessary decompression and undeltaing. ** ** decompress(X) Decompress text X. Undoes the work of ** compress(X). ** ** delta_apply(X,D) Apply delta D to source blob X and return ** the result. ** ** delta_create(X,Y) Create and return a delta that will convert ** X into Y. ** ** delta_output_size(D) Return the number of bytes of output to expect ** when applying delta D ** ** delta_parse(D) A table-valued function that deconstructs ** delta D and returns rows for each element of ** that delta. ** ** files_of_checkin(X) A table-valued function that returns info on ** all files contained in check-in X. Example: ** SELECT * FROM files_of_checkin('trunk'); ** ** now() Return the number of seconds since 1970. ** ** REGEXP The REGEXP operator works, unlike in ** standard SQLite. ** ** symbolic_name_to_rid(X) Return the BLOB.RID corresponding to symbolic ** name X. */ void cmd_sqlite3(void){ int noRepository; char *zConfigDb; extern int sqlite3_shell(int, char**); #ifdef FOSSIL_ENABLE_TH1_HOOKS g.fNoThHook = 1; #endif noRepository = find_option("no-repository", 0, 0)!=0; if( !noRepository ){ db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); } db_open_config(1,0); zConfigDb = fossil_strdup(g.zConfigDbName); fossil_close(1, noRepository); sqlite3_shutdown(); #ifndef _WIN32 linenoiseSetMultiLine(1); #endif atexit(sqlcmd_atexit); g.zConfigDbName = zConfigDb; g.argv[1] = "-quote"; sqlite3_shell(g.argc, g.argv); sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit); fossil_close(0, noRepository); } |
Added src/sqlcompattest.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | /* ** Copyright (c) 2019 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file is NOT part of the Fossil executable ** ** This file contains a test program used by ../configure with the ** the --disable-internal-sqlite option to determine whether or ** not the system SQLite library is sufficient to support Fossil. ** ** It is preferred to statically link Fossil with the sqlite3.c source ** file that is part of the source tree and not use any SQLite shared ** library that is included with the system. But some packagers do not ** like to do this. Hence, we provide the option to link Fossil against ** the system SQLite shared library. But Fossil is very particular about ** the version and build options for SQLite. Unless a recent version of ** SQLite is available, and unless that SQLite is built using some ** non-default features, the system library won't meet the needs of ** Fossil. This program attempts to determine if the system library ** SQLite is sufficient for Fossil. ** ** Compile this program, linking it against the system SQLite library, ** and run it. If it returns with a zero exit code, then all is well. ** But if it returns a non-zero exit code, then the system SQLite library ** lacks some capability that Fossil uses. A message on stdout describes ** the missing feature. */ #include "sqlite3.h" #include <stdio.h> int main(int argc, char **argv){ int i; static const char *zRequiredOpts[] = { "ENABLE_FTS4", /* Required for repository search */ "ENABLE_JSON1", /* Required for the check-in locking protocol */ "ENABLE_DBSTAT_VTAB", /* Required by /repo-tabsize page */ }; /* Check minimum SQLite version number */ if( sqlite3_libversion_number()<3028000 ){ printf("found SQLite version %s but need 3.28.0 or later\n", sqlite3_libversion()); return 1; } for(i=0; i<sizeof(zRequiredOpts)/sizeof(zRequiredOpts[0]); i++){ if( !sqlite3_compileoption_used(zRequiredOpts[i]) ){ printf("system SQLite library omits required build option -DSQLITE_%s\n", zRequiredOpts[i]); return 1; } } /* Success! */ return 0; } |
Changes to src/sqlite3.c.
more than 10,000 changes
Changes to src/sqlite3.h.
︙ | ︙ | |||
119 120 121 122 123 124 125 | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.31.0" #define SQLITE_VERSION_NUMBER 3031000 #define SQLITE_SOURCE_ID "2019-12-26 01:10:17 f482a4cdfa768941e22c399de8ec29a55e729529eeae86d3832077ad1bef22f3" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | ** ** See also: SQL functions [sqlite_compileoption_used()] and ** [sqlite_compileoption_get()] and the [compile_options pragma]. */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS SQLITE_API int sqlite3_compileoption_used(const char *zOptName); SQLITE_API const char *sqlite3_compileoption_get(int N); #endif /* ** CAPI3REF: Test To See If The Library Is Threadsafe ** ** ^The sqlite3_threadsafe() function returns zero if and only if ** SQLite was compiled with mutexing code omitted due to the | > > > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | ** ** See also: SQL functions [sqlite_compileoption_used()] and ** [sqlite_compileoption_get()] and the [compile_options pragma]. */ #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS SQLITE_API int sqlite3_compileoption_used(const char *zOptName); SQLITE_API const char *sqlite3_compileoption_get(int N); #else # define sqlite3_compileoption_used(X) 0 # define sqlite3_compileoption_get(X) ((void*)0) #endif /* ** CAPI3REF: Test To See If The Library Is Threadsafe ** ** ^The sqlite3_threadsafe() function returns zero if and only if ** SQLite was compiled with mutexing code omitted due to the |
︙ | ︙ | |||
509 510 511 512 513 514 515 516 517 518 519 520 521 522 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) #define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */ #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) #define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8)) #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) #define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8)) | > | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) #define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */ #define SQLITE_CANTOPEN_SYMLINK (SQLITE_CANTOPEN | (6<<8)) #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) #define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8)) #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) #define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) #define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8)) |
︙ | ︙ | |||
533 534 535 536 537 538 539 540 541 542 543 544 545 546 | #define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) /* ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the ** 3rd parameter to the [sqlite3_open_v2()] interface and ** in the 4th parameter to the [sqlite3_vfs.xOpen] method. | > | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | #define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* ** CAPI3REF: Flags For File Open Operations ** ** These bit values are intended for use in the ** 3rd parameter to the [sqlite3_open_v2()] interface and ** in the 4th parameter to the [sqlite3_vfs.xOpen] method. |
︙ | ︙ | |||
561 562 563 564 565 566 567 568 569 570 571 572 573 574 | #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ #define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ /* Reserved: 0x00F00000 */ /* ** CAPI3REF: Device Characteristics ** ** The xDeviceCharacteristics method of the [sqlite3_io_methods] | > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | #define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ #define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ #define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ /* Reserved: 0x00F00000 */ /* ** CAPI3REF: Device Characteristics ** ** The xDeviceCharacteristics method of the [sqlite3_io_methods] |
︙ | ︙ | |||
819 820 821 822 823 824 825 826 827 828 829 830 831 832 | ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS ** layer a hint of how large the database file will grow to be during the ** current transaction. This hint is not guaranteed to be accurate but it ** is often close. The underlying VFS might choose to preallocate database ** file space based on this hint in order to help writes to the database ** file run faster. ** ** <li>[[SQLITE_FCNTL_CHUNK_SIZE]] ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** extends and truncates the database file in chunks of a size specified ** by the user. The fourth argument to [sqlite3_file_control()] should ** point to an integer (type int) containing the new chunk-size to use ** for the nominated database. Allocating database file space in large ** chunks (say 1MB at a time), may reduce file-system fragmentation and | > > > > > > > > > | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | ** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS ** layer a hint of how large the database file will grow to be during the ** current transaction. This hint is not guaranteed to be accurate but it ** is often close. The underlying VFS might choose to preallocate database ** file space based on this hint in order to help writes to the database ** file run faster. ** ** <li>[[SQLITE_FCNTL_SIZE_LIMIT]] ** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that ** implements [sqlite3_deserialize()] to set an upper bound on the size ** of the in-memory database. The argument is a pointer to a [sqlite3_int64]. ** If the integer pointed to is negative, then it is filled in with the ** current limit. Otherwise the limit is set to the larger of the value ** of the integer pointed to and the current database size. The integer ** pointed to is set to the new limit. ** ** <li>[[SQLITE_FCNTL_CHUNK_SIZE]] ** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS ** extends and truncates the database file in chunks of a size specified ** by the user. The fourth argument to [sqlite3_file_control()] should ** point to an integer (type int) containing the new chunk-size to use ** for the nominated database. Allocating database file space in large ** chunks (say 1MB at a time), may reduce file-system fragmentation and |
︙ | ︙ | |||
963 964 965 966 967 968 969 | ** file control occurs at the beginning of pragma statement analysis and so ** it is able to override built-in [PRAGMA] statements. ** ** <li>[[SQLITE_FCNTL_BUSYHANDLER]] ** ^The [SQLITE_FCNTL_BUSYHANDLER] ** file-control may be invoked by SQLite on the database file handle ** shortly after it is opened in order to provide a custom VFS with access | | | | | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | ** file control occurs at the beginning of pragma statement analysis and so ** it is able to override built-in [PRAGMA] statements. ** ** <li>[[SQLITE_FCNTL_BUSYHANDLER]] ** ^The [SQLITE_FCNTL_BUSYHANDLER] ** file-control may be invoked by SQLite on the database file handle ** shortly after it is opened in order to provide a custom VFS with access ** to the connection's busy-handler callback. The argument is of type (void**) ** - an array of two (void *) values. The first (void *) actually points ** to a function of type (int (*)(void *)). In order to invoke the connection's ** busy-handler, this function should be invoked with the second (void *) in ** the array as the only argument. If it returns non-zero, then the operation ** should be retried. If it returns zero, the custom VFS should abandon the ** current operation. ** ** <li>[[SQLITE_FCNTL_TEMPFILENAME]] ** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control ** to have SQLite generate a ** temporary filename using the same algorithm that is followed to generate ** temporary filenames for TEMP tables and other internal uses. The ** argument should be a char** which will be filled with the filename ** written into memory obtained from [sqlite3_malloc()]. The caller should ** invoke [sqlite3_free()] on the result to avoid a memory leak. ** |
︙ | ︙ | |||
1085 1086 1087 1088 1089 1090 1091 | ** connection or through transactions committed by separate database ** connections possibly in other processes. The [sqlite3_total_changes()] ** interface can be used to find if any database on the connection has changed, ** but that interface responds to changes on TEMP as well as MAIN and does ** not provide a mechanism to detect changes to MAIN only. Also, the ** [sqlite3_total_changes()] interface responds to internal changes only and ** omits changes made by other database connections. The | | | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | ** connection or through transactions committed by separate database ** connections possibly in other processes. The [sqlite3_total_changes()] ** interface can be used to find if any database on the connection has changed, ** but that interface responds to changes on TEMP as well as MAIN and does ** not provide a mechanism to detect changes to MAIN only. Also, the ** [sqlite3_total_changes()] interface responds to internal changes only and ** omits changes made by other database connections. The ** [PRAGMA data_version] command provides a mechanism to detect changes to ** a single attached database that occur due to other database connections, ** but omits changes implemented by the database connection on which it is ** called. This file control is the only mechanism to detect changes that ** happen either internally or externally and that are associated with ** a particular attached database. ** </ul> */ |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | #define SQLITE_FCNTL_WIN32_GET_HANDLE 29 #define SQLITE_FCNTL_PDB 30 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 #define SQLITE_FCNTL_LOCK_TIMEOUT 34 #define SQLITE_FCNTL_DATA_VERSION 35 /* deprecated names */ #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO | > | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 | #define SQLITE_FCNTL_WIN32_GET_HANDLE 29 #define SQLITE_FCNTL_PDB 30 #define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31 #define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32 #define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33 #define SQLITE_FCNTL_LOCK_TIMEOUT 34 #define SQLITE_FCNTL_DATA_VERSION 35 #define SQLITE_FCNTL_SIZE_LIMIT 36 /* deprecated names */ #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE #define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO |
︙ | ︙ | |||
1172 1173 1174 1175 1176 1177 1178 | ** the end. Each time such an extension occurs, the iVersion field ** is incremented. The iVersion value started out as 1 in ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields ** may be appended to the sqlite3_vfs object and the iVersion value ** may increase again in future versions of SQLite. | | | | | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | ** the end. Each time such an extension occurs, the iVersion field ** is incremented. The iVersion value started out as 1 in ** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2 ** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased ** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields ** may be appended to the sqlite3_vfs object and the iVersion value ** may increase again in future versions of SQLite. ** Note that due to an oversight, the structure ** of the sqlite3_vfs object changed in the transition from ** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0] ** and yet the iVersion field was not increased. ** ** The szOsFile field is the size of the subclassed [sqlite3_file] ** structure used by this VFS. mxPathname is the maximum length of ** a pathname in this VFS. ** ** Registered sqlite3_vfs objects are kept on a linked list formed by ** the pNext pointer. The [sqlite3_vfs_register()] |
︙ | ︙ | |||
1266 1267 1268 1269 1270 1271 1272 | ** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the ** SQLITE_OPEN_CREATE, is used to indicate that file should always ** be created, and that it is an error if it already exists. ** It is <i>not</i> used to indicate the file should be opened ** for exclusive access. ** ** ^At least szOsFile bytes of memory are allocated by SQLite | | | > > | > > > > | 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | ** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the ** SQLITE_OPEN_CREATE, is used to indicate that file should always ** be created, and that it is an error if it already exists. ** It is <i>not</i> used to indicate the file should be opened ** for exclusive access. ** ** ^At least szOsFile bytes of memory are allocated by SQLite ** to hold the [sqlite3_file] structure passed as the third ** argument to xOpen. The xOpen method does not have to ** allocate the structure; it should just fill it in. Note that ** the xOpen method must set the sqlite3_file.pMethods to either ** a valid [sqlite3_io_methods] object or to NULL. xOpen must do ** this even if the open fails. SQLite expects that the sqlite3_file.pMethods ** element will be valid after xOpen returns regardless of the success ** or failure of the xOpen call. ** ** [[sqlite3_vfs.xAccess]] ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] ** to test whether a file is at least readable. The SQLITE_ACCESS_READ ** flag is never actually used and is not implemented in the built-in ** VFSes of SQLite. The file is named by the second argument and can be a ** directory. The xAccess method returns [SQLITE_OK] on success or some ** non-zero error code if there is an I/O error or if the name of ** the file given in the second argument is illegal. If SQLITE_OK ** is returned, then non-zero or zero is written into *pResOut to indicate ** whether or not the file is accessible. ** ** ^SQLite will always allocate at least mxPathname+1 bytes for the ** output buffer xFullPathname. The exact size of the output buffer ** is also passed as a parameter to both methods. If the output buffer ** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is ** handled as a fatal error by SQLite, vfs implementations should endeavor ** to prevent this by setting mxPathname to a sufficiently large value. |
︙ | ︙ | |||
1597 1598 1599 1600 1601 1602 1603 | ** allocators round up memory allocations at least to the next multiple ** of 8. Some allocators round up to a larger multiple or to a power of 2. ** Every memory allocation request coming in through [sqlite3_malloc()] ** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. For example, | | | 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 | ** allocators round up memory allocations at least to the next multiple ** of 8. Some allocators round up to a larger multiple or to a power of 2. ** Every memory allocation request coming in through [sqlite3_malloc()] ** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. For example, ** it might allocate any required mutexes or initialize internal data ** structures. The xShutdown method is invoked (indirectly) by ** [sqlite3_shutdown()] and should deallocate any resources acquired ** by xInit. The pAppData pointer is used as the only parameter to ** xInit and xShutdown. ** ** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes ** the xInit method, so the xInit method need not be threadsafe. The |
︙ | ︙ | |||
1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 | ** ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, ** interpreted as a boolean, which enables or disables the collection of ** memory allocation statistics. ^(When memory allocation statistics are ** disabled, the following SQLite interfaces become non-operational: ** <ul> ** <li> [sqlite3_memory_used()] ** <li> [sqlite3_memory_highwater()] ** <li> [sqlite3_soft_heap_limit64()] ** <li> [sqlite3_status64()] ** </ul>)^ ** ^Memory allocation statistics are enabled by default unless SQLite is ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory ** allocation statistics are disabled by default. ** </dd> ** ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> ** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used. ** </dd> ** ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool ** that SQLite can use for the database page cache with the default page ** cache implementation. | > | | 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 | ** ** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt> ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, ** interpreted as a boolean, which enables or disables the collection of ** memory allocation statistics. ^(When memory allocation statistics are ** disabled, the following SQLite interfaces become non-operational: ** <ul> ** <li> [sqlite3_hard_heap_limit64()] ** <li> [sqlite3_memory_used()] ** <li> [sqlite3_memory_highwater()] ** <li> [sqlite3_soft_heap_limit64()] ** <li> [sqlite3_status64()] ** </ul>)^ ** ^Memory allocation statistics are enabled by default unless SQLite is ** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory ** allocation statistics are disabled by default. ** </dd> ** ** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt> ** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used. ** </dd> ** ** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt> ** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool ** that SQLite can use for the database page cache with the default page ** cache implementation. ** This configuration option is a no-op if an application-defined page ** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]. ** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to ** 8-byte aligned memory (pMem), the size of each page cache line (sz), ** and the number of cache lines (N). ** The sz argument should be the size of the largest database page ** (a power of two between 512 and 65536) plus some extra bytes for each ** page header. ^The number of extra bytes needed by the page header |
︙ | ︙ | |||
1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 | ** than the configured sorter-reference size threshold - then a reference ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a ** negative value for this option restores the default behaviour. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** </dl> */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ | > > > > > > > > > > > | 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 | ** than the configured sorter-reference size threshold - then a reference ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a ** negative value for this option restores the default behaviour. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** ** [[SQLITE_CONFIG_MEMDB_MAXSIZE]] ** <dt>SQLITE_CONFIG_MEMDB_MAXSIZE ** <dd>The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter ** [sqlite3_int64] parameter which is the default maximum size for an in-memory ** database created using [sqlite3_deserialize()]. This default maximum ** size can be adjusted up or down for individual databases using the ** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this ** configuration setting is never used, then the default maximum is determined ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that ** compile-time option is not set, then the default maximum is 1073741824. ** </dl> */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
︙ | ︙ | |||
1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications ** should check the return code from [sqlite3_db_config()] to make sure that ** the call worked. ^The [sqlite3_db_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** ** <dl> ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt> ** <dd> ^This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. ** ^The first argument (the third parameter to [sqlite3_db_config()] is a ** pointer to a memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the | > > | 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 | #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** ** New configuration options may be added in future releases of SQLite. ** Existing configuration options might be discontinued. Applications ** should check the return code from [sqlite3_db_config()] to make sure that ** the call worked. ^The [sqlite3_db_config()] interface will return a ** non-zero [error code] if a discontinued or unsupported configuration option ** is invoked. ** ** <dl> ** [[SQLITE_DBCONFIG_LOOKASIDE]] ** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt> ** <dd> ^This option takes three additional arguments that determine the ** [lookaside memory allocator] configuration for the [database connection]. ** ^The first argument (the third parameter to [sqlite3_db_config()] is a ** pointer to a memory buffer to use for lookaside memory. ** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb ** may be NULL in which case SQLite will allocate the |
︙ | ︙ | |||
2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 | ** connection is not currently using lookaside memory, or in other words ** when the "current value" returned by ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns ** [SQLITE_BUSY].)^</dd> ** ** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt> ** <dd> ^This option is used to enable or disable the enforcement of ** [foreign key constraints]. There should be two additional arguments. ** The first argument is an integer which is 0 to disable FK enforcement, ** positive to enable FK enforcement or negative to leave FK enforcement ** unchanged. The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether FK enforcement is off or on ** following this call. The second parameter may be a NULL pointer, in ** which case the FK enforcement setting is not reported back. </dd> ** ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt> ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers]. ** There should be two additional arguments. ** The first argument is an integer which is 0 to disable triggers, ** positive to enable triggers or negative to leave the setting unchanged. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether triggers are disabled or enabled ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. </dd> ** ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> | > > > > > > > > > > > > > > | | > | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 | ** connection is not currently using lookaside memory, or in other words ** when the "current value" returned by ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. ** Any attempt to change the lookaside memory configuration when lookaside ** memory is in use leaves the configuration unchanged and returns ** [SQLITE_BUSY].)^</dd> ** ** [[SQLITE_DBCONFIG_ENABLE_FKEY]] ** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt> ** <dd> ^This option is used to enable or disable the enforcement of ** [foreign key constraints]. There should be two additional arguments. ** The first argument is an integer which is 0 to disable FK enforcement, ** positive to enable FK enforcement or negative to leave FK enforcement ** unchanged. The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether FK enforcement is off or on ** following this call. The second parameter may be a NULL pointer, in ** which case the FK enforcement setting is not reported back. </dd> ** ** [[SQLITE_DBCONFIG_ENABLE_TRIGGER]] ** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt> ** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers]. ** There should be two additional arguments. ** The first argument is an integer which is 0 to disable triggers, ** positive to enable triggers or negative to leave the setting unchanged. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether triggers are disabled or enabled ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. </dd> ** ** [[SQLITE_DBCONFIG_ENABLE_VIEW]] ** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt> ** <dd> ^This option is used to enable or disable [CREATE VIEW | views]. ** There should be two additional arguments. ** The first argument is an integer which is 0 to disable views, ** positive to enable views or negative to leave the setting unchanged. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether views are disabled or enabled ** following this call. The second parameter may be a NULL pointer, in ** which case the view setting is not reported back. </dd> ** ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] ** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt> ** <dd> ^This option is used to enable or disable the ** [fts3_tokenizer()] function which is part of the ** [FTS3] full-text search engine extension. ** There should be two additional arguments. ** The first argument is an integer which is 0 to disable fts3_tokenizer() or ** positive to enable fts3_tokenizer() or negative to leave the setting ** unchanged. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled ** following this call. The second parameter may be a NULL pointer, in ** which case the new setting is not reported back. </dd> ** ** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]] ** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt> ** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()] ** interface independently of the [load_extension()] SQL function. ** The [sqlite3_enable_load_extension()] API enables or disables both the ** C-API [sqlite3_load_extension()] and the SQL function [load_extension()]. ** There should be two additional arguments. ** When the first argument to this interface is 1, then only the C-API is ** enabled and the SQL function remains disabled. If the first argument to ** this interface is 0, then both the C-API and the SQL function are disabled. ** If the first argument is -1, then no changes are made to state of either the ** C-API or the SQL function. ** The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface ** is disabled or enabled following this call. The second parameter may ** be a NULL pointer, in which case the new setting is not reported back. ** </dd> ** ** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt> ** <dd> ^This option is used to change the name of the "main" database ** schema. ^The sole argument is a pointer to a constant UTF8 string ** which will become the new schema name in place of "main". ^SQLite ** does not make a copy of the new main schema name string, so the application ** must ensure that the argument passed into this DBCONFIG option is unchanged ** until after the database connection closes. ** </dd> ** ** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]] ** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt> ** <dd> Usually, when a database in wal mode is closed or detached from a ** database handle, SQLite checks if this will mean that there are now no ** connections at all to the database. If so, it performs a checkpoint ** operation before closing the connection. This option may be used to ** override this behaviour. The first parameter passed to this operation ** is an integer - positive to disable checkpoints-on-close, or zero (the ** default) to enable them, and negative to leave the setting unchanged. ** The second parameter is a pointer to an integer ** into which is written 0 or 1 to indicate whether checkpoints-on-close ** have been disabled - 0 if they are not disabled, 1 if they are. ** </dd> ** ** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> ** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates ** the [query planner stability guarantee] (QPSG). When the QPSG is active, ** a single SQL query statement will always use the same algorithm regardless ** of values of [bound parameters].)^ The QPSG disables some query optimizations ** that look at the values of bound parameters, which can make some queries ** slower. But the QPSG has the advantage of more predictable behavior. With ** the QPSG active, SQLite will always use the same query plan in the field as ** was used during testing in the lab. ** The first argument to this setting is an integer which is 0 to disable ** the QPSG, positive to enable QPSG, or negative to leave the setting ** unchanged. The second parameter is a pointer to an integer into which ** is written 0 or 1 to indicate whether the QPSG is disabled or enabled ** following this call. ** </dd> ** ** [[SQLITE_DBCONFIG_TRIGGER_EQP]] <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt> ** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not ** include output for any operations performed by trigger programs. This ** option is used to set or clear (the default) a flag that governs this ** behavior. The first parameter passed to this operation is an integer - ** positive to enable output for trigger programs, or zero to disable it, ** or negative to leave the setting unchanged. ** The second parameter is a pointer to an integer into which is written ** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if ** it is not disabled, 1 if it is. ** </dd> ** ** [[SQLITE_DBCONFIG_RESET_DATABASE]] <dt>SQLITE_DBCONFIG_RESET_DATABASE</dt> ** <dd> Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run ** [VACUUM] in order to reset a database back to an empty database ** with no schema and no content. The following process works even for ** a badly corrupted database file: ** <ol> ** <li> If the database connection is newly opened, make sure it has read the ** database schema by preparing then discarding some query against the ** database, or calling sqlite3_table_column_metadata(), ignoring any ** errors. This step is only necessary if the application desires to keep ** the database in WAL mode after the reset if it was in WAL mode before ** the reset. ** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); ** <li> [sqlite3_exec](db, "[VACUUM]", 0, 0, 0); ** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); ** </ol> ** Because resetting a database is destructive and irreversible, the ** process requires the use of this obscure API and multiple steps to help ** ensure that it does not happen by accident. ** ** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt> ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the ** "defensive" flag for a database connection. When the defensive ** flag is enabled, language features that allow ordinary SQL to ** deliberately corrupt the database file are disabled. The disabled ** features include but are not limited to the following: ** <ul> ** <li> The [PRAGMA writable_schema=ON] statement. ** <li> The [PRAGMA journal_mode=OFF] statement. ** <li> Writes to the [sqlite_dbpage] virtual table. ** <li> Direct writes to [shadow tables]. ** </ul> ** </dd> ** ** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> ** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the ** "writable_schema" flag. This has the same effect and is logically equivalent ** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF]. ** The first argument to this setting is an integer which is 0 to disable ** the writable_schema, positive to enable writable_schema, or negative to ** leave the setting unchanged. The second parameter is a pointer to an ** integer into which is written 0 or 1 to indicate whether the writable_schema ** is enabled or disabled following this call. ** </dd> ** ** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]] ** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt> ** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates ** the legacy behavior of the [ALTER TABLE RENAME] command such it ** behaves as it did prior to [version 3.24.0] (2018-06-04). See the ** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for ** additional information. This feature can also be turned on and off ** using the [PRAGMA legacy_alter_table] statement. ** </dd> ** ** [[SQLITE_DBCONFIG_DQS_DML]] ** <dt>SQLITE_DBCONFIG_DQS_DML</td> ** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates ** the legacy [double-quoted string literal] misfeature for DML statements ** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The ** default value of this setting is determined by the [-DSQLITE_DQS] ** compile-time option. ** </dd> ** ** [[SQLITE_DBCONFIG_DQS_DDL]] ** <dt>SQLITE_DBCONFIG_DQS_DDL</td> ** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates ** the legacy [double-quoted string literal] misfeature for DDL statements, ** such as CREATE TABLE and CREATE INDEX. The ** default value of this setting is determined by the [-DSQLITE_DQS] ** compile-time option. ** </dd> ** ** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]] ** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td> ** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates ** the legacy file format flag. When activated, this flag causes all newly ** created database file to have a schema format version number (the 4-byte ** integer found at offset 44 into the database header) of 1. This in turn ** means that the resulting database file will be readable and writable by ** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting, ** newly created databases are generally not understandable by SQLite versions ** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there ** is now scarcely any need to generated database files that are compatible ** all the way back to version 3.0.0, and so this setting is of little ** practical use, but is provided so that SQLite can continue to claim the ** ability to generate new database files that are compatible with version ** 3.0.0. ** <p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on, ** the [VACUUM] command will fail with an obscure error when attempting to ** process a table with generated columns and a descending index. This is ** not considered a bug since SQLite versions 3.3.0 and earlier do not support ** either generated columns or decending indexes. ** </dd> ** </dl> */ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ #define SQLITE_DBCONFIG_MAX 1016 /* Largest DBCONFIG */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes ** METHOD: sqlite3 ** ** ^The sqlite3_extended_result_codes() routine enables or disables the ** [extended result codes] feature of SQLite. ^The extended result |
︙ | ︙ | |||
2324 2325 2326 2327 2328 2329 2330 | ** does not affect the value returned by sqlite3_total_changes(). ** ** ^Changes made as part of [foreign key actions] are included in the ** count, but those made as part of REPLACE constraint resolution are ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers ** are not counted. ** | | | 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 | ** does not affect the value returned by sqlite3_total_changes(). ** ** ^Changes made as part of [foreign key actions] are included in the ** count, but those made as part of REPLACE constraint resolution are ** not. ^Changes to a view that are intercepted by INSTEAD OF triggers ** are not counted. ** ** The [sqlite3_total_changes(D)] interface only reports the number ** of rows that changed due to SQL statement run against database ** connection D. Any changes by other database connections are ignored. ** To detect changes against a database file from other database ** connections use the [PRAGMA data_version] command or the ** [SQLITE_FCNTL_DATA_VERSION] [file control]. ** ** If a separate thread makes changes on the same database connection |
︙ | ︙ | |||
2373 2374 2375 2376 2377 2378 2379 | ** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE ** that is inside an explicit transaction, then the entire transaction ** will be rolled back automatically. ** ** ^The sqlite3_interrupt(D) call is in effect until all currently running ** SQL statements on [database connection] D complete. ^Any new SQL statements ** that are started after the sqlite3_interrupt() call and before the | | | 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 | ** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE ** that is inside an explicit transaction, then the entire transaction ** will be rolled back automatically. ** ** ^The sqlite3_interrupt(D) call is in effect until all currently running ** SQL statements on [database connection] D complete. ^Any new SQL statements ** that are started after the sqlite3_interrupt() call and before the ** running statement count reaches zero are interrupted as if they had been ** running prior to the sqlite3_interrupt() call. ^New SQL statements ** that are started after the running statement count reaches zero are ** not effected by the sqlite3_interrupt(). ** ^A call to sqlite3_interrupt(D) that occurs when there are no running ** SQL statements is a no-op and has no effect on SQL statements ** that are started after the sqlite3_interrupt() call returns. */ |
︙ | ︙ | |||
2541 2542 2543 2544 2545 2546 2547 | ** Name | Age ** ----------------------- ** Alice | 43 ** Bob | 28 ** Cindy | 21 ** </pre></blockquote> ** | | | | 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 | ** Name | Age ** ----------------------- ** Alice | 43 ** Bob | 28 ** Cindy | 21 ** </pre></blockquote> ** ** There are two columns (M==2) and three rows (N==3). Thus the ** result table has 8 entries. Suppose the result table is stored ** in an array named azResult. Then azResult holds this content: ** ** <blockquote><pre> ** azResult[0] = "Name"; ** azResult[1] = "Age"; ** azResult[2] = "Alice"; ** azResult[3] = "43"; ** azResult[4] = "Bob"; |
︙ | ︙ | |||
2697 2698 2699 2700 2701 2702 2703 | ** ** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(), ** sqlite3_malloc64(), and sqlite3_realloc64() ** is always aligned to at least an 8 byte boundary, or to a ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time ** option is used. ** | < < < < < < < < < < < < < | 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 | ** ** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(), ** sqlite3_malloc64(), and sqlite3_realloc64() ** is always aligned to at least an 8 byte boundary, or to a ** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time ** option is used. ** ** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] ** must be either NULL or else pointers obtained from a prior ** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have ** not yet been released. ** ** The application must not read or write any part of ** a block of memory after it has been released using |
︙ | ︙ | |||
2758 2759 2760 2761 2762 2763 2764 | /* ** CAPI3REF: Pseudo-Random Number Generator ** ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to ** select random [ROWID | ROWIDs] when inserting new records into a table that ** already uses the largest possible [ROWID]. The PRNG is also used for | | | 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 | /* ** CAPI3REF: Pseudo-Random Number Generator ** ** SQLite contains a high-quality pseudo-random number generator (PRNG) used to ** select random [ROWID | ROWIDs] when inserting new records into a table that ** already uses the largest possible [ROWID]. The PRNG is also used for ** the built-in random() and randomblob() SQL functions. This interface allows ** applications to access the same PRNG for other purposes. ** ** ^A call to this routine stores N bytes of randomness into buffer P. ** ^The P parameter can be a NULL pointer. ** ** ^If this routine has not been previously called or if the previous ** call had N less than one or a NULL pointer for P, then the PRNG is |
︙ | ︙ | |||
2968 2969 2970 2971 2972 2973 2974 | ** ^The callback function registered by sqlite3_profile() is invoked ** as each SQL statement finishes. ^The profile callback contains ** the original statement text and an estimate of wall-clock time ** of how long that statement took to run. ^The profile callback ** time is in units of nanoseconds, however the current implementation ** is only capable of millisecond resolution so the six least significant ** digits in the time are meaningless. Future versions of SQLite | | | | | 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 | ** ^The callback function registered by sqlite3_profile() is invoked ** as each SQL statement finishes. ^The profile callback contains ** the original statement text and an estimate of wall-clock time ** of how long that statement took to run. ^The profile callback ** time is in units of nanoseconds, however the current implementation ** is only capable of millisecond resolution so the six least significant ** digits in the time are meaningless. Future versions of SQLite ** might provide greater resolution on the profiler callback. Invoking ** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the ** profile callback. */ SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); /* |
︙ | ︙ | |||
3359 3360 3361 3362 3363 3364 3365 | ** ** If F is the database filename pointer passed into the xOpen() method of ** a VFS implementation when the flags parameter to xOpen() has one or ** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and ** P is the name of the query parameter, then ** sqlite3_uri_parameter(F,P) returns the value of the P ** parameter if it exists or a NULL pointer if P does not appear as a | | | > > | 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 | ** ** If F is the database filename pointer passed into the xOpen() method of ** a VFS implementation when the flags parameter to xOpen() has one or ** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and ** P is the name of the query parameter, then ** sqlite3_uri_parameter(F,P) returns the value of the P ** parameter if it exists or a NULL pointer if P does not appear as a ** query parameter on F. If P is a query parameter of F and it ** has no explicit value, then sqlite3_uri_parameter(F,P) returns ** a pointer to an empty string. ** ** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean ** parameter and returns true (1) or false (0) according to the value ** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the ** value of query parameter P is one of "yes", "true", or "on" in any ** case or if the value begins with a non-zero number. The ** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of ** query parameter P is one of "no", "false", or "off" in any case or ** if the value begins with a numeric zero. If P is not a query ** parameter on F or if the value of P does not match any of the ** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). ** ** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a ** 64-bit signed integer and returns that integer, or D if P does not ** exist. If the value of P is something other than an integer, then ** zero is returned. ** ** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and ** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and ** is not a database file pathname pointer that SQLite passed into the xOpen ** VFS method, then the behavior of this routine is undefined and probably ** undesirable. ** ** See the [URI filename] documentation for additional information. */ SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); /* |
︙ | ︙ | |||
3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 | ** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()] ** and [sqlite3_prepare16_v3()] assume that the prepared statement will ** be used just once or at most a few times and then destroyed using ** [sqlite3_finalize()] relatively soon. The current implementation acts ** on this hint by avoiding the use of [lookaside memory] so as not to ** deplete the limited store of lookaside memory. Future versions of ** SQLite may act on this hint differently. ** </dl> */ #define SQLITE_PREPARE_PERSISTENT 0x01 /* ** CAPI3REF: Compiling An SQL Statement ** KEYWORDS: {SQL statement compiler} ** METHOD: sqlite3 ** CONSTRUCTOR: sqlite3_stmt ** | > > > > > > > > > > > > > > > | 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 | ** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()] ** and [sqlite3_prepare16_v3()] assume that the prepared statement will ** be used just once or at most a few times and then destroyed using ** [sqlite3_finalize()] relatively soon. The current implementation acts ** on this hint by avoiding the use of [lookaside memory] so as not to ** deplete the limited store of lookaside memory. Future versions of ** SQLite may act on this hint differently. ** ** [[SQLITE_PREPARE_NORMALIZE]] <dt>SQLITE_PREPARE_NORMALIZE</dt> ** <dd>The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used ** to be required for any prepared statement that wanted to use the ** [sqlite3_normalized_sql()] interface. However, the ** [sqlite3_normalized_sql()] interface is now available to all ** prepared statements, regardless of whether or not they use this ** flag. ** ** [[SQLITE_PREPARE_NO_VTAB]] <dt>SQLITE_PREPARE_NO_VTAB</dt> ** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler ** to return an error (error code SQLITE_ERROR) if the statement uses ** any virtual tables. ** </dl> */ #define SQLITE_PREPARE_PERSISTENT 0x01 #define SQLITE_PREPARE_NORMALIZE 0x02 #define SQLITE_PREPARE_NO_VTAB 0x04 /* ** CAPI3REF: Compiling An SQL Statement ** KEYWORDS: {SQL statement compiler} ** METHOD: sqlite3 ** CONSTRUCTOR: sqlite3_stmt ** |
︙ | ︙ | |||
3691 3692 3693 3694 3695 3696 3697 | ** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code ** and the application would have to make a second call to [sqlite3_reset()] ** in order to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. ** </li> ** ** <li> | | | | | | 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 | ** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code ** and the application would have to make a second call to [sqlite3_reset()] ** in order to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. ** </li> ** ** <li> ** ^If the specific value bound to a [parameter | host parameter] in the ** WHERE clause might influence the choice of query plan for a statement, ** then the statement will be automatically recompiled, as if there had been ** a schema change, on the first [sqlite3_step()] call following any change ** to the [sqlite3_bind_text | bindings] of that [parameter]. ** ^The specific value of a WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column ** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. ** </li> ** </ol> ** ** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having ** the extra prepFlags parameter, which is a bit array consisting of zero or ** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The ** sqlite3_prepare_v2() interface works exactly the same as |
︙ | ︙ | |||
3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 | ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 ** SQL text used to create [prepared statement] P if P was ** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], ** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 ** string containing the SQL text of prepared statement P with ** [bound parameters] expanded. ** ** ^(For example, if a prepared statement is created using the SQL ** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 ** and parameter :xyz is unbound, then sqlite3_sql() will return ** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() ** will return "SELECT 2345,NULL".)^ ** ** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory ** is available to hold the result, or if the result would exceed the ** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. ** ** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of ** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time ** option causes sqlite3_expanded_sql() to always return NULL. ** | > > > > > | | > > | 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 | ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 ** SQL text used to create [prepared statement] P if P was ** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], ** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 ** string containing the SQL text of prepared statement P with ** [bound parameters] expanded. ** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 ** string containing the normalized SQL text of prepared statement P. The ** semantics used to normalize a SQL statement are unspecified and subject ** to change. At a minimum, literal values will be replaced with suitable ** placeholders. ** ** ^(For example, if a prepared statement is created using the SQL ** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 ** and parameter :xyz is unbound, then sqlite3_sql() will return ** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() ** will return "SELECT 2345,NULL".)^ ** ** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory ** is available to hold the result, or if the result would exceed the ** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. ** ** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of ** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time ** option causes sqlite3_expanded_sql() to always return NULL. ** ** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P) ** are managed by SQLite and are automatically freed when the prepared ** statement is finalized. ** ^The string returned by sqlite3_expanded_sql(P), on the other hand, ** is obtained from [sqlite3_malloc()] and must be free by the application ** by passing it to [sqlite3_free()]. */ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If An SQL Statement Writes The Database ** METHOD: sqlite3_stmt ** ** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if ** and only if the [prepared statement] X makes no direct changes to |
︙ | ︙ | |||
3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 | ** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so ** sqlite3_stmt_readonly() returns false for those commands. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If A Prepared Statement Has Been Reset ** METHOD: sqlite3_stmt ** ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the ** [prepared statement] S has been stepped at least once using ** [sqlite3_step(S)] but has neither run to completion (returned | > > > > > > > > > > > > | 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 | ** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so ** sqlite3_stmt_readonly() returns false for those commands. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); /* ** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement ** METHOD: sqlite3_stmt ** ** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the ** prepared statement S is an EXPLAIN statement, or 2 if the ** statement S is an EXPLAIN QUERY PLAN. ** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is ** an ordinary statement or a NULL pointer. */ SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt); /* ** CAPI3REF: Determine If A Prepared Statement Has Been Reset ** METHOD: sqlite3_stmt ** ** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the ** [prepared statement] S has been stepped at least once using ** [sqlite3_step(S)] but has neither run to completion (returned |
︙ | ︙ | |||
3964 3965 3966 3967 3968 3969 3970 | ** the value of the fourth parameter then the resulting string value will ** contain embedded NULs. The result of expressions involving strings ** with embedded NULs is undefined. ** ** ^The fifth argument to the BLOB and string binding interfaces ** is a destructor used to dispose of the BLOB or ** string after SQLite has finished with it. ^The destructor is called | | > > | 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 | ** the value of the fourth parameter then the resulting string value will ** contain embedded NULs. The result of expressions involving strings ** with embedded NULs is undefined. ** ** ^The fifth argument to the BLOB and string binding interfaces ** is a destructor used to dispose of the BLOB or ** string after SQLite has finished with it. ^The destructor is called ** to dispose of the BLOB or string even if the call to the bind API fails, ** except the destructor is not called if the third parameter is a NULL ** pointer or the fourth parameter is negative. ** ^If the fifth argument is ** the special value [SQLITE_STATIC], then SQLite assumes that the ** information is in static, unmanaged space and does not need to be freed. ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then ** SQLite makes its own private copy of the data immediately, before ** the sqlite3_bind_*() routine returns. ** |
︙ | ︙ | |||
4184 4185 4186 4187 4188 4189 4190 | ** ^The first argument to these interfaces is a [prepared statement]. ** ^These functions return information about the Nth result column returned by ** the statement, where N is the second function argument. ** ^The left-most column is column 0 for these routines. ** ** ^If the Nth column returned by the statement is an expression or ** subquery and is not a column value, then all of these functions return | | < < < < | 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 | ** ^The first argument to these interfaces is a [prepared statement]. ** ^These functions return information about the Nth result column returned by ** the statement, where N is the second function argument. ** ^The left-most column is column 0 for these routines. ** ** ^If the Nth column returned by the statement is an expression or ** subquery and is not a column value, then all of these functions return ** NULL. ^These routines might also return NULL if a memory allocation error ** occurs. ^Otherwise, they return the name of the attached database, table, ** or column that query result column was extracted from. ** ** ^As with all other SQLite APIs, those whose names end with "16" return ** UTF-16 encoded strings and the other functions return UTF-8. ** ** ^These APIs are only available if the library was compiled with the ** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. ** ** If two or more threads call one or more ** [sqlite3_column_database_name | column metadata interfaces] ** for the same [prepared statement] and result column ** at the same time then the results are undefined. */ SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); |
︙ | ︙ | |||
4334 4335 4336 4337 4338 4339 4340 | /* ** CAPI3REF: Number of columns in a result set ** METHOD: sqlite3_stmt ** ** ^The sqlite3_data_count(P) interface returns the number of columns in the ** current row of the result set of [prepared statement] P. ** ^If prepared statement P does not have results ready to return | | | 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 | /* ** CAPI3REF: Number of columns in a result set ** METHOD: sqlite3_stmt ** ** ^The sqlite3_data_count(P) interface returns the number of columns in the ** current row of the result set of [prepared statement] P. ** ^If prepared statement P does not have results ready to return ** (via calls to the [sqlite3_column_int | sqlite3_column()] family of ** interfaces) then sqlite3_data_count(P) returns 0. ** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. ** ^The sqlite3_data_count(P) routine returns 0 if the previous call to ** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) ** will return non-zero if previous call to [sqlite3_step](P) returned ** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] ** where it always returns zero since each step of that multi-step |
︙ | ︙ | |||
4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 | ** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] ** to signal that the function will always return the same result given ** the same inputs within a single SQL statement. Most SQL functions are ** deterministic. The built-in [random()] SQL function is an example of a ** function that is not deterministic. The SQLite query planner is able to ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** ** ^The sixth, seventh and eighth parameters passed to the three ** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are ** pointers to C-language functions that implement the SQL function or | > > > > > > | 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 | ** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] ** to signal that the function will always return the same result given ** the same inputs within a single SQL statement. Most SQL functions are ** deterministic. The built-in [random()] SQL function is an example of a ** function that is not deterministic. The SQLite query planner is able to ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** ** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] ** flag, which if present prevents the function from being invoked from ** within VIEWs or TRIGGERs. For security reasons, the [SQLITE_DIRECTONLY] ** flag is recommended for any application-defined SQL function that has ** side-effects. ** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** ** ^The sixth, seventh and eighth parameters passed to the three ** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are ** pointers to C-language functions that implement the SQL function or |
︙ | ︙ | |||
4829 4830 4831 4832 4833 4834 4835 4836 | /* ** CAPI3REF: Function Flags ** ** These constants may be ORed together with the ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. */ | > > > > > > > > > > > > > > > > > > > > > > > | > > | 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 | /* ** CAPI3REF: Function Flags ** ** These constants may be ORed together with the ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. ** ** The SQLITE_DETERMINISTIC flag means that the new function always gives ** the same output when the input parameters are the same. The abs() function ** is deterministic, for example, but randomblob() is not. Functions must ** be deterministic in order to be used in certain contexts such as ** [CHECK constraints] or [generated columns]. SQLite might also optimize ** deterministic functions by factoring them out of inner loops. ** ** The SQLITE_DIRECTONLY flag means that the function may only be invoked ** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is ** a security feature which is recommended for all ** [application-defined SQL functions] that have side-effects. This flag ** prevents an attacker from adding triggers and views to a schema then ** tricking a high-privilege application into causing unintended side-effects ** while performing ordinary queries. ** ** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call ** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. ** Specifying this flag makes no difference for scalar or aggregate user ** functions. However, if it is not specified for a user-defined window ** function, then any sub-types belonging to arguments passed to the window ** function may be discarded before the window function is called (i.e. ** sqlite3_value_subtype() will always return 0). */ #define SQLITE_DETERMINISTIC 0x000000800 #define SQLITE_DIRECTONLY 0x000080000 #define SQLITE_SUBTYPE 0x000100000 /* ** CAPI3REF: Deprecated Functions ** DEPRECATED ** ** These functions are [deprecated]. In order to maintain ** backwards compatibility with older code, these functions continue |
︙ | ︙ | |||
4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 | ** <tr><td><b>sqlite3_value_type</b><td>→<td>Default ** datatype of the value ** <tr><td><b>sqlite3_value_numeric_type </b> ** <td>→ <td>Best numeric datatype of the value ** <tr><td><b>sqlite3_value_nochange </b> ** <td>→ <td>True if the column is unchanged in an UPDATE ** against a virtual table. ** </table></blockquote> ** ** <b>Details:</b> ** ** These routines extract type, size, and content information from ** [protected sqlite3_value] objects. Protected sqlite3_value objects | > > | | | 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 | ** <tr><td><b>sqlite3_value_type</b><td>→<td>Default ** datatype of the value ** <tr><td><b>sqlite3_value_numeric_type </b> ** <td>→ <td>Best numeric datatype of the value ** <tr><td><b>sqlite3_value_nochange </b> ** <td>→ <td>True if the column is unchanged in an UPDATE ** against a virtual table. ** <tr><td><b>sqlite3_value_frombind </b> ** <td>→ <td>True if value originated from a [bound parameter] ** </table></blockquote> ** ** <b>Details:</b> ** ** These routines extract type, size, and content information from ** [protected sqlite3_value] objects. Protected sqlite3_value objects ** are used to pass parameter information into the functions that ** implement [application-defined SQL functions] and [virtual tables]. ** ** These routines work only with [protected sqlite3_value] objects. ** Any attempt to use these routines on an [unprotected sqlite3_value] ** is not threadsafe. ** ** ^These routines work just like the corresponding [column access functions] ** except that these routines take a single [protected sqlite3_value] object |
︙ | ︙ | |||
4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 | ** the value for that column returned without setting a result (probably ** because it queried [sqlite3_vtab_nochange()] and found that the column ** was unchanging). ^Within an [xUpdate] method, any value for which ** sqlite3_value_nochange(X) is true will in all other respects appear ** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other ** than within an [xUpdate] method call for an UPDATE statement, then ** the return value is arbitrary and meaningless. ** ** Please pay particular attention to the fact that the pointer returned ** from [sqlite3_value_blob()], [sqlite3_value_text()], or ** [sqlite3_value_text16()] can be invalidated by a subsequent call to ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], ** or [sqlite3_value_text16()]. ** | > > > > > | 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 | ** the value for that column returned without setting a result (probably ** because it queried [sqlite3_vtab_nochange()] and found that the column ** was unchanging). ^Within an [xUpdate] method, any value for which ** sqlite3_value_nochange(X) is true will in all other respects appear ** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other ** than within an [xUpdate] method call for an UPDATE statement, then ** the return value is arbitrary and meaningless. ** ** ^The sqlite3_value_frombind(X) interface returns non-zero if the ** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()] ** interfaces. ^If X comes from an SQL literal value, or a table column, ** or an expression, then sqlite3_value_frombind(X) returns zero. ** ** Please pay particular attention to the fact that the pointer returned ** from [sqlite3_value_blob()], [sqlite3_value_text()], or ** [sqlite3_value_text16()] can be invalidated by a subsequent call to ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], ** or [sqlite3_value_text16()]. ** |
︙ | ︙ | |||
4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 | SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); SQLITE_API int sqlite3_value_bytes(sqlite3_value*); SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); SQLITE_API int sqlite3_value_type(sqlite3_value*); SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); SQLITE_API int sqlite3_value_nochange(sqlite3_value*); /* ** CAPI3REF: Finding The Subtype Of SQL Values ** METHOD: sqlite3_value ** ** The sqlite3_value_subtype(V) function returns the subtype for ** an [application-defined SQL function] argument V. The subtype | > | 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 | SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); SQLITE_API int sqlite3_value_bytes(sqlite3_value*); SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); SQLITE_API int sqlite3_value_type(sqlite3_value*); SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); SQLITE_API int sqlite3_value_nochange(sqlite3_value*); SQLITE_API int sqlite3_value_frombind(sqlite3_value*); /* ** CAPI3REF: Finding The Subtype Of SQL Values ** METHOD: sqlite3_value ** ** The sqlite3_value_subtype(V) function returns the subtype for ** an [application-defined SQL function] argument V. The subtype |
︙ | ︙ | |||
5025 5026 5027 5028 5029 5030 5031 | ** CAPI3REF: Obtain Aggregate Function Context ** METHOD: sqlite3_context ** ** Implementations of aggregate SQL functions use this ** routine to allocate memory for storing their state. ** ** ^The first time the sqlite3_aggregate_context(C,N) routine is called | | | | | 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 | ** CAPI3REF: Obtain Aggregate Function Context ** METHOD: sqlite3_context ** ** Implementations of aggregate SQL functions use this ** routine to allocate memory for storing their state. ** ** ^The first time the sqlite3_aggregate_context(C,N) routine is called ** for a particular aggregate function, SQLite allocates ** N bytes of memory, zeroes out that memory, and returns a pointer ** to the new memory. ^On second and subsequent calls to ** sqlite3_aggregate_context() for the same aggregate function instance, ** the same buffer is returned. Sqlite3_aggregate_context() is normally ** called once for each invocation of the xStep callback and then one ** last time when the xFinal callback is invoked. ^(When no rows match ** an aggregate query, the xStep() callback of the aggregate function ** implementation is never called and xFinal() is called exactly once. ** In those cases, sqlite3_aggregate_context() might be called for the ** first time from within xFinal().)^ ** ** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer ** when first called if N is less than or equal to zero or if a memory ** allocate error occurs. ** ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is ** determined by the N parameter on first successful call. Changing the ** value of N in any subsequents call to sqlite3_aggregate_context() within ** the same aggregate function instance will not resize the memory ** allocation.)^ Within the xFinal callback, it is customary to set ** N=0 in calls to sqlite3_aggregate_context(C,N) so that no ** pointless memory allocations occur. ** ** ^SQLite automatically frees the memory allocated by ** sqlite3_aggregate_context() when the aggregate query concludes. |
︙ | ︙ | |||
5391 5392 5393 5394 5395 5396 5397 | ** <li> If A==B then B==A. ** <li> If A==B and B==C then A==C. ** <li> If A<B THEN B>A. ** <li> If A<B and B<C then A<C. ** </ol> ** ** If a collating function fails any of the above constraints and that | | | 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 | ** <li> If A==B then B==A. ** <li> If A==B and B==C then A==C. ** <li> If A<B THEN B>A. ** <li> If A<B and B<C then A<C. ** </ol> ** ** If a collating function fails any of the above constraints and that ** collating function is registered and used, then the behavior of SQLite ** is undefined. ** ** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() ** with the addition that the xDestroy callback is invoked on pArg when ** the collating function is deleted. ** ^Collating functions are deleted when they are overridden by later ** calls to the collation creation functions or when the |
︙ | ︙ | |||
5718 5719 5720 5721 5722 5723 5724 | */ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); /* ** CAPI3REF: Return The Filename For A Database Connection ** METHOD: sqlite3 ** | | | | | > > > > | 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 | */ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); /* ** CAPI3REF: Return The Filename For A Database Connection ** METHOD: sqlite3 ** ** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename ** associated with database N of connection D. ** ^If there is no attached database N on the database ** connection D, or if database N is a temporary or in-memory database, then ** this function will return either a NULL pointer or an empty string. ** ** ^The string value returned by this routine is owned and managed by ** the database connection. ^The value will be valid until the database N ** is [DETACH]-ed or until the database connection closes. ** ** ^The filename returned by this function is the output of the ** xFullPathname method of the [VFS]. ^In other words, the filename ** will be an absolute pathname, even if the filename used ** to open the database originally was a URI or relative pathname. */ SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); |
︙ | ︙ | |||
5877 5878 5879 5880 5881 5882 5883 | ** ^Cache sharing is enabled and disabled for an entire process. ** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). ** In prior versions of SQLite, ** sharing was enabled or disabled for each thread separately. ** ** ^(The cache sharing mode set by this interface effects all subsequent ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. | | | | | > > > > | 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 | ** ^Cache sharing is enabled and disabled for an entire process. ** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]). ** In prior versions of SQLite, ** sharing was enabled or disabled for each thread separately. ** ** ^(The cache sharing mode set by this interface effects all subsequent ** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. ** Existing database connections continue to use the sharing mode ** that was in effect at the time they were opened.)^ ** ** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled ** successfully. An [error code] is returned otherwise.)^ ** ** ^Shared cache is disabled by default. It is recommended that it stay ** that way. In other words, do not use this routine. This interface ** continues to be provided for historical compatibility, but its use is ** discouraged. Any use of shared cache is discouraged. If shared cache ** must be used, it is recommended that shared cache only be enabled for ** individual database connections using the [sqlite3_open_v2()] interface ** with the [SQLITE_OPEN_SHAREDCACHE] flag. ** ** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 ** and will always return SQLITE_MISUSE. On those systems, ** shared cache mode should be enabled per-database connection via ** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE]. ** ** This interface is threadsafe on processors where writing a |
︙ | ︙ | |||
5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 | ** ** See also: [sqlite3_release_memory()] */ SQLITE_API int sqlite3_db_release_memory(sqlite3*); /* ** CAPI3REF: Impose A Limit On Heap Size ** ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the ** soft limit on the amount of heap memory that may be allocated by SQLite. ** ^SQLite strives to keep heap memory utilization below the soft heap ** limit by reducing the number of pages held in the page cache ** as heap memory usages approaches the limit. ** ^The soft heap limit is "soft" because even though SQLite strives to stay ** below the limit, it will exceed the limit rather than generate ** an [SQLITE_NOMEM] error. In other words, the soft heap limit ** is advisory only. ** | > > > > > > > > > > | | | | | > > > > > | > > > > > > > > > | | < < < < < < < < < < < | > | 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 | ** ** See also: [sqlite3_release_memory()] */ SQLITE_API int sqlite3_db_release_memory(sqlite3*); /* ** CAPI3REF: Impose A Limit On Heap Size ** ** These interfaces impose limits on the amount of heap memory that will be ** by all database connections within a single process. ** ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the ** soft limit on the amount of heap memory that may be allocated by SQLite. ** ^SQLite strives to keep heap memory utilization below the soft heap ** limit by reducing the number of pages held in the page cache ** as heap memory usages approaches the limit. ** ^The soft heap limit is "soft" because even though SQLite strives to stay ** below the limit, it will exceed the limit rather than generate ** an [SQLITE_NOMEM] error. In other words, the soft heap limit ** is advisory only. ** ** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of ** N bytes on the amount of memory that will be allocated. ^The ** sqlite3_hard_heap_limit64(N) interface is similar to ** sqlite3_soft_heap_limit64(N) except that memory allocations will fail ** when the hard heap limit is reached. ** ** ^The return value from both sqlite3_soft_heap_limit64() and ** sqlite3_hard_heap_limit64() is the size of ** the heap limit prior to the call, or negative in the case of an ** error. ^If the argument N is negative ** then no change is made to the heap limit. Hence, the current ** size of heap limits can be determined by invoking ** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1). ** ** ^Setting the heap limits to zero disables the heap limiter mechanism. ** ** ^The soft heap limit may not be greater than the hard heap limit. ** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N) ** is invoked with a value of N that is greater than the hard heap limit, ** the the soft heap limit is set to the value of the hard heap limit. ** ^The soft heap limit is automatically enabled whenever the hard heap ** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and ** the soft heap limit is outside the range of 1..N, then the soft heap ** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the ** hard heap limit is enabled makes the soft heap limit equal to the ** hard heap limit. ** ** The memory allocation limits can also be adjusted using ** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit]. ** ** ^(The heap limits are not enforced in the current implementation ** if one or more of following conditions are true: ** ** <ul> ** <li> The limit value is set to zero. ** <li> Memory accounting is disabled using a combination of the ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. ** <li> An alternative page cache implementation is specified using ** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). ** <li> The page cache allocates from its own memory pool supplied ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than ** from the heap. ** </ul>)^ ** ** The circumstances under which SQLite will enforce the heap limits may ** changes in future releases of SQLite. */ SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N); /* ** CAPI3REF: Deprecated Soft Heap Limit Interface ** DEPRECATED ** ** This is a deprecated version of the [sqlite3_soft_heap_limit64()] ** interface. This routine is provided for historical compatibility |
︙ | ︙ | |||
6004 6005 6006 6007 6008 6009 6010 | ** ** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns ** information about column C of table T in database D ** on [database connection] X.)^ ^The sqlite3_table_column_metadata() ** interface returns SQLITE_OK and fills in the non-NULL pointers in ** the final five arguments with appropriate values if the specified ** column exists. ^The sqlite3_table_column_metadata() interface returns | | | 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 | ** ** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns ** information about column C of table T in database D ** on [database connection] X.)^ ^The sqlite3_table_column_metadata() ** interface returns SQLITE_OK and fills in the non-NULL pointers in ** the final five arguments with appropriate values if the specified ** column exists. ^The sqlite3_table_column_metadata() interface returns ** SQLITE_ERROR if the specified column does not exist. ** ^If the column-name parameter to sqlite3_table_column_metadata() is a ** NULL pointer, then this routine simply checks for the existence of the ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it ** does not. If the table name parameter T in a call to ** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is ** undefined behavior. ** |
︙ | ︙ | |||
6146 6147 6148 6149 6150 6151 6152 | ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. ** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) ** to enable or disable only the C-API.)^ ** ** <b>Security warning:</b> It is recommended that extension loading | | | 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 | ** ** ^This interface enables or disables both the C-API ** [sqlite3_load_extension()] and the SQL function [load_extension()]. ** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..) ** to enable or disable only the C-API.)^ ** ** <b>Security warning:</b> It is recommended that extension loading ** be enabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method ** rather than this interface, so the [load_extension()] SQL function ** remains disabled. This will prevent SQL injections from giving attackers ** access to extension loading capabilities. */ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); /* |
︙ | ︙ | |||
6233 6234 6235 6236 6237 6238 6239 | typedef struct sqlite3_module sqlite3_module; /* ** CAPI3REF: Virtual Table Object ** KEYWORDS: sqlite3_module {virtual table module} ** ** This structure, sometimes called a "virtual table module", | | | 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 | typedef struct sqlite3_module sqlite3_module; /* ** CAPI3REF: Virtual Table Object ** KEYWORDS: sqlite3_module {virtual table module} ** ** This structure, sometimes called a "virtual table module", ** defines the implementation of a [virtual table]. ** This structure consists mostly of methods for the module. ** ** ^A virtual table module is created by filling in a persistent ** instance of this structure and passing a pointer to that instance ** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. ** ^The registration remains valid until it is replaced by a different ** module or until the [database connection] closes. The content |
︙ | ︙ | |||
6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 | void **ppArg); int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); /* The methods above are in version 1 of the sqlite_module object. Those ** below are for version 2 and greater. */ int (*xSavepoint)(sqlite3_vtab *pVTab, int); int (*xRelease)(sqlite3_vtab *pVTab, int); int (*xRollbackTo)(sqlite3_vtab *pVTab, int); }; /* ** CAPI3REF: Virtual Table Indexing Information ** KEYWORDS: sqlite3_index_info ** ** The sqlite3_index_info structure and its substructures is used as part | > > > | 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 | void **ppArg); int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); /* The methods above are in version 1 of the sqlite_module object. Those ** below are for version 2 and greater. */ int (*xSavepoint)(sqlite3_vtab *pVTab, int); int (*xRelease)(sqlite3_vtab *pVTab, int); int (*xRollbackTo)(sqlite3_vtab *pVTab, int); /* The methods above are in versions 1 and 2 of the sqlite_module object. ** Those below are for version 3 and greater. */ int (*xShadowName)(const char*); }; /* ** CAPI3REF: Virtual Table Indexing Information ** KEYWORDS: sqlite3_index_info ** ** The sqlite3_index_info structure and its substructures is used as part |
︙ | ︙ | |||
6327 6328 6329 6330 6331 6332 6333 | ** non-zero. ** ** The [xBestIndex] method must fill aConstraintUsage[] with information ** about what parameters to pass to xFilter. ^If argvIndex>0 then ** the right-hand side of the corresponding aConstraint[] is evaluated ** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit ** is true, then the constraint is assumed to be fully handled by the | | > > > > > > | 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 | ** non-zero. ** ** The [xBestIndex] method must fill aConstraintUsage[] with information ** about what parameters to pass to xFilter. ^If argvIndex>0 then ** the right-hand side of the corresponding aConstraint[] is evaluated ** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit ** is true, then the constraint is assumed to be fully handled by the ** virtual table and might not be checked again by the byte code.)^ ^(The ** aConstraintUsage[].omit flag is an optimization hint. When the omit flag ** is left in its default setting of false, the constraint will always be ** checked separately in byte code. If the omit flag is change to true, then ** the constraint may or may not be checked in byte code. In other words, ** when the omit flag is true there is no guarantee that the constraint will ** not be checked again using byte code.)^ ** ** ^The idxNum and idxPtr values are recorded and passed into the ** [xFilter] method. ** ^[sqlite3_free()] is used to free idxPtr if and only if ** needToFreeIdxPtr is true. ** ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in |
︙ | ︙ | |||
6367 6368 6369 6370 6371 6372 6373 | ** the xUpdate method are automatically rolled back by SQLite. ** ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). ** If a virtual table extension is ** used with an SQLite version earlier than 3.8.2, the results of attempting ** to read or write the estimatedRows field are undefined (but are likely | | | 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 | ** the xUpdate method are automatically rolled back by SQLite. ** ** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info ** structure for SQLite [version 3.8.2] ([dateof:3.8.2]). ** If a virtual table extension is ** used with an SQLite version earlier than 3.8.2, the results of attempting ** to read or write the estimatedRows field are undefined (but are likely ** to include crashing the application). The estimatedRows field should ** therefore only be used if [sqlite3_libversion_number()] returns a ** value greater than or equal to 3008002. Similarly, the idxFlags field ** was added for [version 3.9.0] ([dateof:3.9.0]). ** It may therefore only be used if ** sqlite3_libversion_number() returns a value greater than or equal to ** 3009000. */ |
︙ | ︙ | |||
6419 6420 6421 6422 6423 6424 6425 | ** these bits. */ #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */ /* ** CAPI3REF: Virtual Table Constraint Operator Codes ** | | | 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 | ** these bits. */ #define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */ /* ** CAPI3REF: Virtual Table Constraint Operator Codes ** ** These macros define the allowed values for the ** [sqlite3_index_info].aConstraint[].op field. Each value represents ** an operator that is part of a constraint term in the wHERE clause of ** a query that uses a [virtual table]. */ #define SQLITE_INDEX_CONSTRAINT_EQ 2 #define SQLITE_INDEX_CONSTRAINT_GT 4 #define SQLITE_INDEX_CONSTRAINT_LE 8 |
︙ | ︙ | |||
6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 | ** is a pointer to a destructor for the pClientData. ^SQLite will ** invoke the destructor function (if it is not NULL) when SQLite ** no longer needs the pClientData pointer. ^The destructor will also ** be invoked if the call to sqlite3_create_module_v2() fails. ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData /* Client data for xCreate/xConnect */ ); SQLITE_API int sqlite3_create_module_v2( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData, /* Client data for xCreate/xConnect */ void(*xDestroy)(void*) /* Module destructor function */ ); /* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** ** Every [virtual table module] implementation uses a subclass ** of this object to describe a particular instance | > > > > > > > > > > > > > > > > > > > > > > > | 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 | ** is a pointer to a destructor for the pClientData. ^SQLite will ** invoke the destructor function (if it is not NULL) when SQLite ** no longer needs the pClientData pointer. ^The destructor will also ** be invoked if the call to sqlite3_create_module_v2() fails. ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. ** ** ^If the third parameter (the pointer to the sqlite3_module object) is ** NULL then no new module is create and any existing modules with the ** same name are dropped. ** ** See also: [sqlite3_drop_modules()] */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData /* Client data for xCreate/xConnect */ ); SQLITE_API int sqlite3_create_module_v2( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *p, /* Methods for the module */ void *pClientData, /* Client data for xCreate/xConnect */ void(*xDestroy)(void*) /* Module destructor function */ ); /* ** CAPI3REF: Remove Unnecessary Virtual Table Implementations ** METHOD: sqlite3 ** ** ^The sqlite3_drop_modules(D,L) interface removes all virtual ** table modules from database connection D except those named on list L. ** The L parameter must be either NULL or a pointer to an array of pointers ** to strings where the array is terminated by a single NULL pointer. ** ^If the L parameter is NULL, then all virtual table modules are removed. ** ** See also: [sqlite3_create_module()] */ SQLITE_API int sqlite3_drop_modules( sqlite3 *db, /* Remove modules from this connection */ const char **azKeep /* Except, do not remove the ones named here */ ); /* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** ** Every [virtual table module] implementation uses a subclass ** of this object to describe a particular instance |
︙ | ︙ | |||
7006 7007 7008 7009 7010 7011 7012 | ** <li> [sqlite3_mutex_held()] </li> ** <li> [sqlite3_mutex_notheld()] </li> ** </ul>)^ ** ** The only difference is that the public sqlite3_XXX functions enumerated ** above silently ignore any invocations that pass a NULL pointer instead ** of a valid mutex handle. The implementations of the methods defined | | | 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 | ** <li> [sqlite3_mutex_held()] </li> ** <li> [sqlite3_mutex_notheld()] </li> ** </ul>)^ ** ** The only difference is that the public sqlite3_XXX functions enumerated ** above silently ignore any invocations that pass a NULL pointer instead ** of a valid mutex handle. The implementations of the methods defined ** by this structure are not required to handle this case. The results ** of passing a NULL pointer instead of a valid mutex handle are undefined ** (i.e. it is acceptable to provide an implementation that segfaults if ** it is passed a NULL pointer). ** ** The xMutexInit() method must be threadsafe. It must be harmless to ** invoke xMutexInit() multiple times within the same process and without ** intervening calls to xMutexEnd(). Second and subsequent calls to |
︙ | ︙ | |||
7188 7189 7190 7191 7192 7193 7194 | ** without notice. These values are for testing purposes only. ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 | | > > > > | | 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 | ** without notice. These values are for testing purposes only. ** Applications should not use any of these parameters or the ** [sqlite3_test_control()] interface. */ #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 #define SQLITE_TESTCTRL_PENDING_BYTE 11 #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */ #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ #define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */ #define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19 #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 #define SQLITE_TESTCTRL_BYTEORDER 22 #define SQLITE_TESTCTRL_ISINIT 23 #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 #define SQLITE_TESTCTRL_PRNG_SEED 28 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 #define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking ** ** These routines provide access to the set of SQL language keywords ** recognized by SQLite. Applications can uses these routines to determine ** whether or not a specific identifier needs to be escaped (for example, |
︙ | ︙ | |||
7475 7476 7477 7478 7479 7480 7481 | ** returned value includes allocations that overflowed because they ** where too large (they were larger than the "sz" parameter to ** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because ** no space was left in the page cache.</dd>)^ ** ** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt> ** <dd>This parameter records the largest memory allocation request | | | 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 | ** returned value includes allocations that overflowed because they ** where too large (they were larger than the "sz" parameter to ** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because ** no space was left in the page cache.</dd>)^ ** ** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt> ** <dd>This parameter records the largest memory allocation request ** handed to the [pagecache memory allocator]. Only the value returned in the ** *pHighwater parameter to [sqlite3_status()] is of interest. ** The value written into the *pCurrent parameter is undefined.</dd>)^ ** ** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt> ** <dd>No longer used.</dd> ** ** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt> |
︙ | ︙ | |||
7551 7552 7553 7554 7555 7556 7557 | ** ** <dl> ** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt> ** <dd>This parameter returns the number of lookaside memory slots currently ** checked out.</dd>)^ ** ** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt> | | | 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 | ** ** <dl> ** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt> ** <dd>This parameter returns the number of lookaside memory slots currently ** checked out.</dd>)^ ** ** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt> ** <dd>This parameter returns the number of malloc attempts that were ** satisfied using lookaside memory. Only the high-water value is meaningful; ** the current value is always zero.)^ ** ** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]] ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt> ** <dd>This parameter returns the number malloc attempts that might have ** been satisfied using lookaside memory but failed due to the amount of |
︙ | ︙ | |||
7633 7634 7635 7636 7637 7638 7639 | ** ** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt> ** <dd>This parameter returns the number of dirty cache entries that have ** been written to disk in the middle of a transaction due to the page ** cache overflowing. Transactions are more efficient if they are written ** to disk all at once. When pages spill mid-transaction, that introduces ** additional overhead. This parameter can be used help identify | | | 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 | ** ** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt> ** <dd>This parameter returns the number of dirty cache entries that have ** been written to disk in the middle of a transaction due to the page ** cache overflowing. Transactions are more efficient if they are written ** to disk all at once. When pages spill mid-transaction, that introduces ** additional overhead. This parameter can be used help identify ** inefficiencies that can be resolved by increasing the cache size. ** </dd> ** ** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt> ** <dd>This parameter returns zero for the current value if and only if ** all foreign key constraints (deferred or immediate) have been ** resolved.)^ ^The highwater mark is always 0. ** </dd> |
︙ | ︙ | |||
7722 7723 7724 7725 7726 7727 7728 | ** to 2147483647. The number of virtual machine operations can be ** used as a proxy for the total work done by the prepared statement. ** If the number of virtual machine operations exceeds 2147483647 ** then the value returned by this statement status code is undefined. ** ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> ** <dd>^This is the number of times that the prepare statement has been | | | 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 | ** to 2147483647. The number of virtual machine operations can be ** used as a proxy for the total work done by the prepared statement. ** If the number of virtual machine operations exceeds 2147483647 ** then the value returned by this statement status code is undefined. ** ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> ** <dd>^This is the number of times that the prepare statement has been ** automatically regenerated due to schema changes or changes to ** [bound parameters] that might affect the query plan. ** ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> ** <dd>^This is the number of times that the prepared statement has ** been run. A single "run" for the purposes of this counter is one ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. ** The counter is incremented on the first [sqlite3_step()] call of each |
︙ | ︙ | |||
7893 7894 7895 7896 7897 7898 7899 | ** Otherwise return NULL. ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return ** NULL if allocating a new page is effectively impossible. ** </table> ** ** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite ** will only use a createFlag of 2 after a prior call with a createFlag of 1 | | | 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 | ** Otherwise return NULL. ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return ** NULL if allocating a new page is effectively impossible. ** </table> ** ** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite ** will only use a createFlag of 2 after a prior call with a createFlag of 1 ** failed.)^ In between the xFetch() calls, SQLite may ** attempt to unpin one or more cache pages by spilling the content of ** pinned pages to disk and synching the operating system disk cache. ** ** [[the xUnpin() page cache method]] ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page ** as its second argument. If the third parameter, discard, is non-zero, ** then the page must be evicted from the cache. |
︙ | ︙ | |||
8211 8212 8213 8214 8215 8216 8217 | ** identity of the database connection (the blocking connection) that ** has locked the required resource is stored internally. ^After an ** application receives an SQLITE_LOCKED error, it may call the ** sqlite3_unlock_notify() method with the blocked connection handle as ** the first argument to register for a callback that will be invoked ** when the blocking connections current transaction is concluded. ^The ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] | | | 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 | ** identity of the database connection (the blocking connection) that ** has locked the required resource is stored internally. ^After an ** application receives an SQLITE_LOCKED error, it may call the ** sqlite3_unlock_notify() method with the blocked connection handle as ** the first argument to register for a callback that will be invoked ** when the blocking connections current transaction is concluded. ^The ** callback is invoked from within the [sqlite3_step] or [sqlite3_close] ** call that concludes the blocking connection's transaction. ** ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, ** there is a chance that the blocking connection will have already ** concluded its transaction by the time sqlite3_unlock_notify() is invoked. ** If this happens, then the specified callback is invoked immediately, ** from within the call to sqlite3_unlock_notify().)^ ** |
︙ | ︙ | |||
8249 8250 8251 8252 8253 8254 8255 | ** When an unlock-notify callback is registered, the application provides a ** single void* pointer that is passed to the callback when it is invoked. ** However, the signature of the callback function allows SQLite to pass ** it an array of void* context pointers. The first argument passed to ** an unlock-notify callback is a pointer to an array of void* pointers, ** and the second is the number of entries in the array. ** | | | 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 | ** When an unlock-notify callback is registered, the application provides a ** single void* pointer that is passed to the callback when it is invoked. ** However, the signature of the callback function allows SQLite to pass ** it an array of void* context pointers. The first argument passed to ** an unlock-notify callback is a pointer to an array of void* pointers, ** and the second is the number of entries in the array. ** ** When a blocking connection's transaction is concluded, there may be ** more than one blocked connection that has registered for an unlock-notify ** callback. ^If two or more such blocked connections have specified the ** same callback function, then instead of invoking the callback function ** multiple times, it is invoked once with the set of void* context pointers ** specified by the blocked connections bundled together into an array. ** This gives the application an opportunity to prioritize any actions ** related to the set of unblocked database connections. |
︙ | ︙ | |||
8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 | ** CAPI3REF: Virtual Table Configuration Options ** ** These macros define the various options to the ** [sqlite3_vtab_config()] interface that [virtual table] implementations ** can use to customize and optimize their behavior. ** ** <dl> ** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT ** <dd>Calls of the form ** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, ** where X is an integer. If X is zero, then the [virtual table] whose ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not ** support constraints. In this configuration (which is the default) if ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire | > | 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 | ** CAPI3REF: Virtual Table Configuration Options ** ** These macros define the various options to the ** [sqlite3_vtab_config()] interface that [virtual table] implementations ** can use to customize and optimize their behavior. ** ** <dl> ** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]] ** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT ** <dd>Calls of the form ** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, ** where X is an integer. If X is zero, then the [virtual table] whose ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not ** support constraints. In this configuration (which is the default) if ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire |
︙ | ︙ | |||
8722 8723 8724 8725 8726 8727 8728 | ** ** When the value returned to V is a string, space to hold that string is ** managed by the prepared statement S and will be automatically freed when ** S is finalized. ** ** <dl> ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt> | | | | | | | | 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 | ** ** When the value returned to V is a string, space to hold that string is ** managed by the prepared statement S and will be automatically freed when ** S is finalized. ** ** <dl> ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt> ** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be ** set to the total number of times that the X-th loop has run.</dd> ** ** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt> ** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be set ** to the total number of rows examined by all iterations of the X-th loop.</dd> ** ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt> ** <dd>^The "double" variable pointed to by the V parameter will be set to the ** query planner's estimate for the average number of rows output from each ** iteration of the X-th loop. If the query planner's estimates was accurate, ** then this value will approximate the quotient NVISIT/NLOOP and the ** product of this value for all prior loops with the same SELECTID will ** be the NLOOP value for the current loop. ** ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt> ** <dd>^The "const char *" variable pointed to by the V parameter will be set ** to a zero-terminated UTF-8 string containing the name of the index or table ** used for the X-th loop. ** ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt> ** <dd>^The "const char *" variable pointed to by the V parameter will be set ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN] ** description for the X-th loop. ** ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt> ** <dd>^The "int" variable pointed to by the V parameter will be set to the ** "select-id" for the X-th loop. The select-id identifies which query or ** subquery the loop is part of. The main query has a select-id of zero. ** The select-id is the same value as is output in the first column ** of an [EXPLAIN QUERY PLAN] query. ** </dl> */ #define SQLITE_SCANSTAT_NLOOP 0 |
︙ | ︙ | |||
9380 9381 9382 9383 9384 9385 9386 | unsigned int *anQueue; /* Number of pending entries in the queue */ int nCoord; /* Number of coordinates */ int iLevel; /* Level of current node or entry */ int mxLevel; /* The largest iLevel value in the tree */ sqlite3_int64 iRowid; /* Rowid for current entry */ sqlite3_rtree_dbl rParentScore; /* Score of parent node */ int eParentWithin; /* Visibility of parent node */ | | | 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 | unsigned int *anQueue; /* Number of pending entries in the queue */ int nCoord; /* Number of coordinates */ int iLevel; /* Level of current node or entry */ int mxLevel; /* The largest iLevel value in the tree */ sqlite3_int64 iRowid; /* Rowid for current entry */ sqlite3_rtree_dbl rParentScore; /* Score of parent node */ int eParentWithin; /* Visibility of parent node */ int eWithin; /* OUT: Visibility */ sqlite3_rtree_dbl rScore; /* OUT: Write the score here */ /* The following fields are only available in 3.8.11 and later */ sqlite3_value **apSqlParam; /* Original SQL values of parameters */ }; /* ** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin. |
︙ | ︙ | |||
9603 9604 9605 9606 9607 9608 9609 | /* ** CAPI3REF: Set a table filter on a Session Object. ** METHOD: sqlite3_session ** ** The second argument (xFilter) is the "filter callback". For changes to rows ** in tables that are not attached to the Session object, the filter is called ** to determine whether changes to the table's rows should be tracked or not. | | | 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 | /* ** CAPI3REF: Set a table filter on a Session Object. ** METHOD: sqlite3_session ** ** The second argument (xFilter) is the "filter callback". For changes to rows ** in tables that are not attached to the Session object, the filter is called ** to determine whether changes to the table's rows should be tracked or not. ** If xFilter returns 0, changes are not tracked. Note that once a table is ** attached, xFilter will not be called again. */ SQLITE_API void sqlite3session_table_filter( sqlite3_session *pSession, /* Session object */ int(*xFilter)( void *pCtx, /* Copy of third arg to _filter_table() */ const char *zTab /* Table name */ |
︙ | ︙ | |||
9777 9778 9779 9780 9781 9782 9783 | ** using [sqlite3session_changeset()], then after applying that changeset to ** database zFrom the contents of the two compatible tables would be ** identical. ** ** It an error if database zFrom does not exist or does not contain the ** required compatible table. ** | | | 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 | ** using [sqlite3session_changeset()], then after applying that changeset to ** database zFrom the contents of the two compatible tables would be ** identical. ** ** It an error if database zFrom does not exist or does not contain the ** required compatible table. ** ** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite ** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg ** may be set to point to a buffer containing an English language error ** message. It is the responsibility of the caller to free this buffer using ** sqlite3_free(). */ SQLITE_API int sqlite3session_diff( sqlite3_session *pSession, |
︙ | ︙ | |||
9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 | ** [sqlite3changeset_invert()] functions, all changes within the changeset ** that apply to a single table are grouped together. This means that when ** an application iterates through a changeset using an iterator created by ** this function, all changes that relate to a single table are visited ** consecutively. There is no chance that the iterator will visit a change ** the applies to table X, then one for table Y, and then later on visit ** another change for table X. */ SQLITE_API int sqlite3changeset_start( sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset /* Pointer to blob containing changeset */ ); /* ** CAPI3REF: Advance A Changeset Iterator ** METHOD: sqlite3_changeset_iter ** | > > > > > > > > > > > > > > > > > > > > > > > > > > | | 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 | ** [sqlite3changeset_invert()] functions, all changes within the changeset ** that apply to a single table are grouped together. This means that when ** an application iterates through a changeset using an iterator created by ** this function, all changes that relate to a single table are visited ** consecutively. There is no chance that the iterator will visit a change ** the applies to table X, then one for table Y, and then later on visit ** another change for table X. ** ** The behavior of sqlite3changeset_start_v2() and its streaming equivalent ** may be modified by passing a combination of ** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter. ** ** Note that the sqlite3changeset_start_v2() API is still <b>experimental</b> ** and therefore subject to change. */ SQLITE_API int sqlite3changeset_start( sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset /* Pointer to blob containing changeset */ ); SQLITE_API int sqlite3changeset_start_v2( sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */ int nChangeset, /* Size of changeset blob in bytes */ void *pChangeset, /* Pointer to blob containing changeset */ int flags /* SESSION_CHANGESETSTART_* flags */ ); /* ** CAPI3REF: Flags for sqlite3changeset_start_v2 ** ** The following flags may passed via the 4th parameter to ** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]: ** ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd> ** Invert the changeset while iterating through it. This is equivalent to ** inverting a changeset using sqlite3changeset_invert() before applying it. ** It is an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETSTART_INVERT 0x0002 /* ** CAPI3REF: Advance A Changeset Iterator ** METHOD: sqlite3_changeset_iter ** ** This function may only be used with iterators created by the function ** [sqlite3changeset_start()]. If it is called on an iterator passed to ** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE ** is returned and the call has no effect. ** ** Immediately after an iterator is created by sqlite3changeset_start(), it ** does not point to any change in the changeset. Assuming the changeset ** is not empty, the first call to this function advances the iterator to |
︙ | ︙ | |||
9925 9926 9927 9928 9929 9930 9931 | ** ** If argument pzTab is not NULL, then *pzTab is set to point to a ** nul-terminated utf-8 encoded string containing the name of the table ** affected by the current change. The buffer remains valid until either ** sqlite3changeset_next() is called on the iterator or until the ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** set to the number of columns in the table affected by the change. If | | | 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 | ** ** If argument pzTab is not NULL, then *pzTab is set to point to a ** nul-terminated utf-8 encoded string containing the name of the table ** affected by the current change. The buffer remains valid until either ** sqlite3changeset_next() is called on the iterator or until the ** conflict-handler function returns. If pnCol is not NULL, then *pnCol is ** set to the number of columns in the table affected by the change. If ** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change ** is an indirect change, or false (0) otherwise. See the documentation for ** [sqlite3session_indirect()] for a description of direct and indirect ** changes. Finally, if pOp is not NULL, then *pOp is set to one of ** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the ** type of change that the iterator currently points to. ** ** If no error occurs, SQLITE_OK is returned. If an error does occur, an |
︙ | ︙ | |||
10304 10305 10306 10307 10308 10309 10310 | ** ** If the new changeset contains changes to a table that is already present ** in the changegroup, then the number of columns and the position of the ** primary key columns for the table must be consistent. If this is not the ** case, this function fails with SQLITE_SCHEMA. If the input changeset ** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is ** returned. Or, if an out-of-memory condition occurs during processing, this | | | | 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 | ** ** If the new changeset contains changes to a table that is already present ** in the changegroup, then the number of columns and the position of the ** primary key columns for the table must be consistent. If this is not the ** case, this function fails with SQLITE_SCHEMA. If the input changeset ** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is ** returned. Or, if an out-of-memory condition occurs during processing, this ** function returns SQLITE_NOMEM. In all cases, if an error occurs the state ** of the final contents of the changegroup is undefined. ** ** If no error occurs, SQLITE_OK is returned. */ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup |
︙ | ︙ | |||
10480 10481 10482 10483 10484 10485 10486 | ** This includes the case where the UPDATE operation is attempted after ** an earlier call to the conflict handler function returned ** [SQLITE_CHANGESET_REPLACE]. ** </dl> ** ** It is safe to execute SQL statements, including those that write to the ** table that the callback related to, from within the xConflict callback. | | | 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 | ** This includes the case where the UPDATE operation is attempted after ** an earlier call to the conflict handler function returned ** [SQLITE_CHANGESET_REPLACE]. ** </dl> ** ** It is safe to execute SQL statements, including those that write to the ** table that the callback related to, from within the xConflict callback. ** This can be used to further customize the application's conflict ** resolution strategy. ** ** All changes made by these functions are enclosed in a savepoint transaction. ** If any other error (aside from a constraint failure when attempting to ** write to the target database) occurs, then the savepoint transaction is ** rolled back, restoring the target database to its original state, and an ** SQLite error code returned. |
︙ | ︙ | |||
10536 10537 10538 10539 10540 10541 10542 | int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ sqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, /* OUT: Rebase data */ | | > > > > > > | 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 | int(*xConflict)( void *pCtx, /* Copy of sixth arg to _apply() */ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */ sqlite3_changeset_iter *p /* Handle describing change and conflict */ ), void *pCtx, /* First argument passed to xConflict */ void **ppRebase, int *pnRebase, /* OUT: Rebase data */ int flags /* SESSION_CHANGESETAPPLY_* flags */ ); /* ** CAPI3REF: Flags for sqlite3changeset_apply_v2 ** ** The following flags may passed via the 9th parameter to ** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]: ** ** <dl> ** <dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd> ** Usually, the sessions module encloses all operations performed by ** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The ** SAVEPOINT is committed if the changeset or patchset is successfully ** applied, or rolled back if an error occurs. Specifying this flag ** causes the sessions module to omit this savepoint. In this case, if the ** caller has an open transaction or savepoint when apply_v2() is called, ** it may revert the partially applied changeset by rolling it back. ** ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd> ** Invert the changeset before applying it. This is equivalent to inverting ** a changeset using sqlite3changeset_invert() before applying it. It is ** an error to specify this flag with a patchset. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 /* ** CAPI3REF: Constants Passed To The Conflict Handler ** ** Values that may be passed as the second argument to a conflict-handler. ** ** <dl> |
︙ | ︙ | |||
10784 10785 10786 10787 10788 10789 10790 | /* ** CAPI3REF: Rebase a changeset ** EXPERIMENTAL ** ** Argument pIn must point to a buffer containing a changeset nIn bytes ** in size. This function allocates and populates a buffer with a copy | | | | 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 | /* ** CAPI3REF: Rebase a changeset ** EXPERIMENTAL ** ** Argument pIn must point to a buffer containing a changeset nIn bytes ** in size. This function allocates and populates a buffer with a copy ** of the changeset rebased according to the configuration of the ** rebaser object passed as the first argument. If successful, (*ppOut) ** is set to point to the new buffer containing the rebased changeset and ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the ** responsibility of the caller to eventually free the new buffer using ** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) ** are set to zero and an SQLite error code returned. */ SQLITE_API int sqlite3rebaser_rebase( sqlite3_rebaser*, |
︙ | ︙ | |||
10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 | int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); SQLITE_API int sqlite3changeset_start_strm( sqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); SQLITE_API int sqlite3session_changeset_strm( sqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); SQLITE_API int sqlite3session_patchset_strm( | > > > > > > | 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 | int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); SQLITE_API int sqlite3changeset_start_strm( sqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn ); SQLITE_API int sqlite3changeset_start_v2_strm( sqlite3_changeset_iter **pp, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int flags ); SQLITE_API int sqlite3session_changeset_strm( sqlite3_session *pSession, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); SQLITE_API int sqlite3session_patchset_strm( |
︙ | ︙ | |||
10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 | sqlite3_rebaser *pRebaser, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); /* ** Make sure we can call this stuff from C++. */ #ifdef __cplusplus } #endif | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 | sqlite3_rebaser *pRebaser, int (*xInput)(void *pIn, void *pData, int *pnData), void *pIn, int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ); /* ** CAPI3REF: Configure global parameters ** ** The sqlite3session_config() interface is used to make global configuration ** changes to the sessions module in order to tune it to the specific needs ** of the application. ** ** The sqlite3session_config() interface is not threadsafe. If it is invoked ** while any other thread is inside any other sessions method then the ** results are undefined. Furthermore, if it is invoked after any sessions ** related objects have been created, the results are also undefined. ** ** The first argument to the sqlite3session_config() function must be one ** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The ** interpretation of the (void*) value passed as the second parameter and ** the effect of calling this function depends on the value of the first ** parameter. ** ** <dl> ** <dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd> ** By default, the sessions module streaming interfaces attempt to input ** and output data in approximately 1 KiB chunks. This operand may be used ** to set and query the value of this configuration setting. The pointer ** passed as the second argument must point to a value of type (int). ** If this value is greater than 0, it is used as the new streaming data ** chunk size for both input and output. Before returning, the (int) value ** pointed to by pArg is set to the final value of the streaming interface ** chunk size. ** </dl> ** ** This function returns SQLITE_OK if successful, or an SQLite error code ** otherwise. */ SQLITE_API int sqlite3session_config(int op, void *pArg); /* ** CAPI3REF: Values for sqlite3session_config(). */ #define SQLITE_SESSION_CONFIG_STRMSIZE 1 /* ** Make sure we can call this stuff from C++. */ #ifdef __cplusplus } #endif |
︙ | ︙ | |||
11108 11109 11110 11111 11112 11113 11114 | ** Query for the details of phrase match iIdx within the current row. ** Phrase matches are numbered starting from zero, so the iIdx argument ** should be greater than or equal to zero and smaller than the value ** output by xInstCount(). ** ** Usually, output parameter *piPhrase is set to the phrase number, *piCol ** to the column in which it occurs and *piOff the token offset of the | < < < < | | | 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 | ** Query for the details of phrase match iIdx within the current row. ** Phrase matches are numbered starting from zero, so the iIdx argument ** should be greater than or equal to zero and smaller than the value ** output by xInstCount(). ** ** Usually, output parameter *piPhrase is set to the phrase number, *piCol ** to the column in which it occurs and *piOff the token offset of the ** first token of the phrase. Returns SQLITE_OK if successful, or an error ** code (i.e. SQLITE_NOMEM) if an error occurs. ** ** This API can be quite slow if used with an FTS5 table created with the ** "detail=none" or "detail=column" option. ** ** xRowid: ** Returns the rowid of the current row. ** |
︙ | ︙ | |||
11151 11152 11153 11154 11155 11156 11157 | ** If the query runs to completion without incident, SQLITE_OK is returned. ** Or, if some error occurs before the query completes or is aborted by ** the callback, an SQLite error code is returned. ** ** ** xSetAuxdata(pFts5, pAux, xDelete) ** | | | | | 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 | ** If the query runs to completion without incident, SQLITE_OK is returned. ** Or, if some error occurs before the query completes or is aborted by ** the callback, an SQLite error code is returned. ** ** ** xSetAuxdata(pFts5, pAux, xDelete) ** ** Save the pointer passed as the second argument as the extension function's ** "auxiliary data". The pointer may then be retrieved by the current or any ** future invocation of the same fts5 extension function made as part of ** the same MATCH query using the xGetAuxdata() API. ** ** Each extension function is allocated a single auxiliary data slot for ** each FTS query (MATCH expression). If the extension function is invoked ** more than once for a single FTS query, then all invocations share a ** single auxiliary data context. ** ** If there is already an auxiliary data pointer when this function is ** invoked, then it is replaced by the new pointer. If an xDelete callback ** was specified along with the original pointer, it is invoked at this ** point. ** ** The xDelete callback, if one is specified, is also invoked on the ** auxiliary data pointer after the FTS5 query has finished. ** ** If an error (e.g. an OOM condition) occurs within this function, ** the auxiliary data is set to NULL and an error code returned. If the ** xDelete parameter was not NULL, it is invoked on the auxiliary data ** pointer before returning. ** ** ** xGetAuxdata(pFts5, bClear) ** |
︙ | ︙ | |||
11393 11394 11395 11396 11397 11398 11399 | ** of "first place" within the document set, but not alternative forms ** such as "1st place". In some applications, it would be better to match ** all instances of "first place" or "1st place" regardless of which form ** the user specified in the MATCH query text. ** ** There are several ways to approach this in FTS5: ** | | | | | | | | | 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 | ** of "first place" within the document set, but not alternative forms ** such as "1st place". In some applications, it would be better to match ** all instances of "first place" or "1st place" regardless of which form ** the user specified in the MATCH query text. ** ** There are several ways to approach this in FTS5: ** ** <ol><li> By mapping all synonyms to a single token. In this case, using ** the above example, this means that the tokenizer returns the ** same token for inputs "first" and "1st". Say that token is in ** fact "first", so that when the user inserts the document "I won ** 1st place" entries are added to the index for tokens "i", "won", ** "first" and "place". If the user then queries for '1st + place', ** the tokenizer substitutes "first" for "1st" and the query works ** as expected. ** ** <li> By querying the index for all synonyms of each query term ** separately. In this case, when tokenizing query text, the ** tokenizer may provide multiple synonyms for a single term ** within the document. FTS5 then queries the index for each ** synonym individually. For example, faced with the query: ** ** <codeblock> ** ... MATCH 'first place'</codeblock> ** ** the tokenizer offers both "1st" and "first" as synonyms for the ** first token in the MATCH query and FTS5 effectively runs a query ** similar to: |
︙ | ︙ | |||
11430 11431 11432 11433 11434 11435 11436 | ** Using this method, when tokenizing document text, the tokenizer ** provides multiple synonyms for each token. So that when a ** document such as "I won first place" is tokenized, entries are ** added to the FTS index for "i", "won", "first", "1st" and ** "place". ** ** This way, even if the tokenizer does not provide synonyms | | | 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 | ** Using this method, when tokenizing document text, the tokenizer ** provides multiple synonyms for each token. So that when a ** document such as "I won first place" is tokenized, entries are ** added to the FTS index for "i", "won", "first", "1st" and ** "place". ** ** This way, even if the tokenizer does not provide synonyms ** when tokenizing query text (it should not - to do so would be ** inefficient), it doesn't matter if the user queries for ** 'first + place' or '1st + place', as there are entries in the ** FTS index corresponding to both forms of the first token. ** </ol> ** ** Whether it is parsing document or query text, any call to xToken that ** specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit |
︙ | ︙ |
Changes to src/stash.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 | #include "config.h" #include "stash.h" #include <assert.h> /* ** SQL code to implement the tables needed by the stash. */ static const char zStashInit[] = @ CREATE TABLE IF NOT EXISTS localdb.stash( @ stashid INTEGER PRIMARY KEY, -- Unique stash identifier | > > > > > > > > > > > > > | > < > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | #include "config.h" #include "stash.h" #include <assert.h> /* ** SQL code to implement the tables needed by the stash. ** ** Historical schema changes: ** ** 2019-01-19: stash.hash and stashfile.hash columns added. The ** corresponding stash.vid and stashfile.rid columns are ** retained for compatibility with older versions of ** fossil but are no longer used. ** ** 2016-10-16: Change the PRIMARY KEY on stashfile from (origname,stashid) ** to (newname,stashid). ** ** 2011-09-01: stashfile.isLink column added ** */ static const char zStashInit[] = @ CREATE TABLE IF NOT EXISTS localdb.stash( @ stashid INTEGER PRIMARY KEY, -- Unique stash identifier @ vid INTEGER, -- Legacy baseline RID value. Do not use. @ hash TEXT, -- The SHA hash for the baseline @ comment TEXT, -- Comment for this stash. Or NULL @ ctime TIMESTAMP -- When the stash was created @ ); @ CREATE TABLE IF NOT EXISTS localdb.stashfile( @ stashid INTEGER REFERENCES stash, -- Stash that contains this file @ isAdded BOOLEAN, -- True if this is an added file @ isRemoved BOOLEAN, -- True if this file is deleted @ isExec BOOLEAN, -- True if file is executable @ isLink BOOLEAN, -- True if file is a symlink @ rid INTEGER, -- Legacy baseline RID value. Do not use @ hash TEXT, -- Hash for baseline or NULL @ origname TEXT, -- Original filename @ newname TEXT, -- New name for file at next check-in @ delta BLOB, -- Delta from baseline or raw content @ PRIMARY KEY(newname, stashid) @ ); @ INSERT OR IGNORE INTO vvar(name, value) VALUES('stash-next', 1); ; /* ** Make sure the stash and stashfile tables exist and have been ** upgraded to their latest format. Create and upgrade the tables ** as necessary. */ static void stash_tables_exist_and_current(void){ if( db_table_has_column("localdb","stashfile","hash") ){ /* The schema is up-to-date. But it could be that an older version ** of Fossil that does no know about the stash.hash and stashfile.hash ** columns has run since the schema was updated, and added entries that ** have NULL hash columns. Check for this case, and fill in any missing ** hash values. */ if( db_int(0, "SELECT hash IS NULL FROM stash" " ORDER BY stashid DESC LIMIT 1") ){ db_multi_exec( "UPDATE stash" " SET hash=(SELECT uuid FROM blob WHERE blob.rid=stash.vid)" " WHERE hash IS NULL;" "UPDATE stashfile" " SET hash=(SELECT uuid FROM blob WHERE blob.rid=stashfile.rid)" " WHERE hash IS NULL AND rid>0;" ); } return; } if( !db_table_exists("localdb","stashfile") || !db_table_exists("localdb","stash") ){ /* Tables do not exist. Create them from scratch. */ db_multi_exec("DROP TABLE IF EXISTS localdb.stash;"); db_multi_exec("DROP TABLE IF EXISTS localdb.stashfile;"); db_multi_exec(zStashInit /*works-like:""*/); return; } /* The tables exists but are not necessarily current. Upgrade them ** to the latest format. ** ** We can assume the 2011-09-01 format that includes the stashfile.isLink ** column. The only upgrades we need to worry about the PRIMARY KEY ** change on 2016-10-16 and the addition of the "hash" columns on ** 2019-01-19. */ db_multi_exec( "ALTER TABLE localdb.stash RENAME TO old_stash;" "ALTER TABLE localdb.stashfile RENAME TO old_stashfile;" ); db_multi_exec(zStashInit /*works-like:""*/); db_multi_exec( "INSERT INTO localdb.stash(stashid,vid,hash,comment,ctime)" " SELECT stashid, vid," " (SELECT uuid FROM blob WHERE blob.rid=old_stash.vid)," " comment, ctime FROM old_stash;" "DROP TABLE old_stash;" ); db_multi_exec( "INSERT INTO localdb.stashfile(stashid,isAdded,isRemoved,isExec," "isLink,rid,hash,origname,newname,delta)" " SELECT stashid, isAdded, isRemoved, isExec, isLink, rid," " (SELECT uuid FROM blob WHERE blob.rid=old_stashfile.rid)," " origname, newname, delta FROM old_stashfile;" "DROP TABLE old_stashfile;" ); } /* ** Update the stash.vid and stashfile.rid values after a RID renumbering ** event. */ void stash_rid_renumbering_event(void){ if( !db_table_has_column("localdb","stash","hash") ){ /* If the stash schema was the older style that lacked hash value, then ** recovery is not possible. Save off the old data, then reset the stash ** to empty. */ if( db_table_exists("localdb","stash") ){ db_multi_exec("ALTER TABLE stash RENAME TO broken_stash;"); fossil_print("Unrecoverable stash content stored in \"broken_stash\"\n"); } if( db_table_exists("localdb","stashfile") ){ db_multi_exec("ALTER TABLE stashfile RENAME TO broken_stashfile;"); fossil_print("Unrecoverable stashfile content stored" " in \"broken_stashfile\"\n"); } }else{ /* Reset stash.vid and stash.rid values based on hashes */ db_multi_exec( "UPDATE stash" " SET vid=(SELECT rid FROM blob WHERE blob.uuid=stash.hash);" "UPDATE stashfile" " SET rid=(SELECT rid FROM blob WHERE blob.uuid=stashfile.hash)" " WHERE hash IS NOT NULL;" ); } } /* ** Add zFName to the stash given by stashid. zFName might be the name of a ** file or a directory. If a directory, add all changed files contained ** within that directory. */ static void stash_add_file_or_dir(int stashid, int vid, const char *zFName){ |
︙ | ︙ | |||
75 76 77 78 79 80 81 | " OR pathname=%Q OR origname=%Q)", zTreename, zTreename, zTreename, zTreename ); } db_prepare(&q, "%s", blob_sql_text(&sql)); blob_reset(&sql); db_prepare(&ins, | | | | > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | " OR pathname=%Q OR origname=%Q)", zTreename, zTreename, zTreename, zTreename ); } db_prepare(&q, "%s", blob_sql_text(&sql)); blob_reset(&sql); db_prepare(&ins, "INSERT INTO stashfile(stashid, isAdded, isRemoved, isExec, isLink, rid, " "hash, origname, newname, delta)" "VALUES(%d,:isadd,:isrm,:isexe,:islink,:rid," "(SELECT uuid FROM blob WHERE rid=:rid),:orig,:new,:content)", stashid ); while( db_step(&q)==SQLITE_ROW ){ int deleted = db_column_int(&q, 0); int rid = db_column_int(&q, 3); const char *zName = db_column_text(&q, 4); const char *zOrig = db_column_text(&q, 5); |
︙ | ︙ | |||
169 170 171 172 173 174 175 | zComment = blob_str(&comment); } stashid = db_lget_int("stash-next", 1); db_lset_int("stash-next", stashid+1); vid = db_lget_int("checkout", 0); vfile_check_signature(vid, 0); db_multi_exec( | | | | | | | 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 | zComment = blob_str(&comment); } stashid = db_lget_int("stash-next", 1); db_lset_int("stash-next", stashid+1); vid = db_lget_int("checkout", 0); vfile_check_signature(vid, 0); db_multi_exec( "INSERT INTO stash(stashid,vid,hash,comment,ctime)" "VALUES(%d,%d,(SELECT uuid FROM blob WHERE rid=%d),%Q,julianday('now'))", stashid, vid, vid, zComment ); if( g.argc>3 ){ int i; for(i=3; i<g.argc; i++){ stash_add_file_or_dir(stashid, vid, g.argv[i]); } }else{ stash_add_file_or_dir(stashid, vid, g.zLocalRoot); } return stashid; } /* ** Apply a stash to the current checkout. */ static void stash_apply(int stashid, int nConflict){ int vid; Stmt q; db_prepare(&q, "SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta" " FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash", stashid ); vid = db_lget_int("checkout",0); db_multi_exec("CREATE TEMP TABLE sfile(pathname TEXT PRIMARY KEY %s)", filename_collation()); while( db_step(&q)==SQLITE_ROW ){ int rid = db_column_int(&q, 0); |
︙ | ︙ | |||
294 295 296 297 298 299 300 | int fIncludeBinary, /* Do diffs against binary files */ u64 diffFlags /* Other diff flags */ ){ Stmt q; Blob empty; blob_zero(&empty); db_prepare(&q, | | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | int fIncludeBinary, /* Do diffs against binary files */ u64 diffFlags /* Other diff flags */ ){ Stmt q; Blob empty; blob_zero(&empty); db_prepare(&q, "SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta" " FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash", stashid ); while( db_step(&q)==SQLITE_ROW ){ int rid = db_column_int(&q, 0); int isRemoved = db_column_int(&q, 1); int isLink = db_column_int(&q, 3); int isBin1, isBin2; |
︙ | ︙ | |||
420 421 422 423 424 425 426 | ** Show the contents of a stash as a diff against its baseline. ** With gshow and gcat, gdiff-command is used instead of internal ** diff logic. ** ** fossil stash pop ** fossil stash apply ?STASHID? ** | | | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | ** Show the contents of a stash as a diff against its baseline. ** With gshow and gcat, gdiff-command is used instead of internal ** diff logic. ** ** fossil stash pop ** fossil stash apply ?STASHID? ** ** Apply STASHID or the most recently created stash to the current ** working checkout. The "pop" command deletes that changeset from ** the stash after applying it but the "apply" command retains the ** changeset. ** ** fossil stash goto ?STASHID? ** ** Update to the baseline checkout for STASHID then apply the |
︙ | ︙ | |||
461 462 463 464 465 466 467 | ** fossil stash diff ?STASHID? ?DIFF-OPTIONS? ** fossil stash gdiff ?STASHID? ?DIFF-OPTIONS? */ void stash_cmd(void){ const char *zCmd; int nCmd; int stashid = 0; | < < < | < < < < < < < < < < < < > > > > > > > | 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 | ** fossil stash diff ?STASHID? ?DIFF-OPTIONS? ** fossil stash gdiff ?STASHID? ?DIFF-OPTIONS? */ void stash_cmd(void){ const char *zCmd; int nCmd; int stashid = 0; undo_capture_command_line(); db_must_be_within_tree(); db_open_config(0, 0); db_begin_transaction(); stash_tables_exist_and_current(); if( g.argc<=2 ){ zCmd = "save"; }else{ zCmd = g.argv[2]; } nCmd = strlen(zCmd); if( memcmp(zCmd, "save", nCmd)==0 ){ if( unsaved_changes(0)==0 ){ fossil_fatal("nothing to stash"); } stashid = stash_create(); undo_disable(); if( g.argc>=2 ){ int nFile = db_int(0, "SELECT count(*) FROM stashfile WHERE stashid=%d", stashid); char **newArgv = fossil_malloc( sizeof(char*)*(nFile+2) ); int i = 2; Stmt q; db_prepare(&q,"SELECT origname FROM stashfile WHERE stashid=%d", stashid); while( db_step(&q)==SQLITE_ROW ){ newArgv[i++] = mprintf("%s%s", g.zLocalRoot, db_column_text(&q, 0)); } db_finalize(&q); newArgv[0] = g.argv[0]; newArgv[1] = 0; g.argv = newArgv; g.argc = nFile+2; if( nFile==0 ) return; } /* Make sure the stash has committed before running the revert, so that ** we have a copy of the changes before deleting them. */ db_commit_transaction(); g.argv[1] = "revert"; revert_cmd(); return; }else if( memcmp(zCmd, "snapshot", nCmd)==0 ){ stash_create(); }else if( memcmp(zCmd, "list", nCmd)==0 || memcmp(zCmd, "ls", nCmd)==0 ){ Stmt q, q2; int n = 0, width; |
︙ | ︙ | |||
532 533 534 535 536 537 538 | width = -1; } if( !verboseFlag ){ verboseFlag = find_option("detail","l",0)!=0; /* deprecated */ } verify_all_options(); db_prepare(&q, | < | | | 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 | width = -1; } if( !verboseFlag ){ verboseFlag = find_option("detail","l",0)!=0; /* deprecated */ } verify_all_options(); db_prepare(&q, "SELECT stashid, hash, comment, datetime(ctime) FROM stash" " ORDER BY ctime" ); if( verboseFlag ){ db_prepare(&q2, "SELECT isAdded, isRemoved, origname, newname" " FROM stashfile WHERE stashid=$id"); } while( db_step(&q)==SQLITE_ROW ){ int stashid = db_column_int(&q, 0); const char *zCom; n++; fossil_print("%5d: [%.14s] on %s\n", stashid, db_column_text(&q, 1), db_column_text(&q, 3) ); zCom = db_column_text(&q, 2); if( zCom && zCom[0] ){ fossil_print(" "); comment_print(zCom, 0, 7, width, get_comment_format()); } if( verboseFlag ){ db_bind_int(&q2, "$id", stashid); while( db_step(&q2)==SQLITE_ROW ){ int isAdded = db_column_int(&q2, 0); int isRemoved = db_column_int(&q2, 1); const char *zOrig = db_column_text(&q2, 2); |
︙ | ︙ | |||
626 627 628 629 630 631 632 | }else if( memcmp(zCmd, "goto", nCmd)==0 ){ int nConflict; int vid; if( g.argc>4 ) usage("apply STASHID"); stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0); undo_begin(); | | > | 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | }else if( memcmp(zCmd, "goto", nCmd)==0 ){ int nConflict; int vid; if( g.argc>4 ) usage("apply STASHID"); stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0); undo_begin(); vid = db_int(0, "SELECT blob.rid FROM stash,blob" " WHERE stashid=%d AND blob.uuid=stash.hash", stashid); nConflict = update_to(vid); stash_apply(stashid, nConflict); db_multi_exec("UPDATE vfile SET mtime=0 WHERE pathname IN " "(SELECT origname FROM stashfile WHERE stashid=%d)", stashid); undo_finish(); }else |
︙ | ︙ |
Changes to src/stat.c.
︙ | ︙ | |||
102 103 104 105 106 107 108 | @ </td></tr> nPend = db_int(0,"SELECT count(*) FROM pending_alert WHERE NOT sentSep"); nDPend = db_int(0,"SELECT count(*) FROM pending_alert" " WHERE NOT sentDigest"); @ <tr><th>Pending Alerts:</th><td> @ %,d(nPend) normal, %,d(nDPend) digest @ </td></tr> | > > > | > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | @ </td></tr> nPend = db_int(0,"SELECT count(*) FROM pending_alert WHERE NOT sentSep"); nDPend = db_int(0,"SELECT count(*) FROM pending_alert" " WHERE NOT sentDigest"); @ <tr><th>Pending Alerts:</th><td> @ %,d(nPend) normal, %,d(nDPend) digest @ </td></tr> if( g.perm.Admin ){ @ <tr><th><a href="%R/subscribers">Subscribers:</a></th><td> }else{ @ <tr><th>Subscribers:</th><td> } nSub = db_int(0, "SELECT count(*) FROM subscriber"); nASub = db_int(0, "SELECT count(*) FROM subscriber WHERE sverified" " AND NOT sdonotcall AND length(ssub)>1"); @ %,d(nASub) active, %,d(nSub) total @ </td></tr> } |
︙ | ︙ | |||
211 212 213 214 215 216 217 | @ %,d(n) @ </td></tr> @ <tr><th>Number Of Wiki Pages:</th><td> n = db_int(0, "SELECT count(*) FROM tag /*scan*/" " WHERE +tagname GLOB 'wiki-*'"); @ %,d(n) @ </td></tr> | < > | > > > > > > > | > > | 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 | @ %,d(n) @ </td></tr> @ <tr><th>Number Of Wiki Pages:</th><td> n = db_int(0, "SELECT count(*) FROM tag /*scan*/" " WHERE +tagname GLOB 'wiki-*'"); @ %,d(n) @ </td></tr> n = db_int(0, "SELECT count(*) FROM tag /*scan*/" " WHERE +tagname GLOB 'tkt-*'"); if( n>0 ){ @ <tr><th>Number Of Tickets:</th><td>%,d(n)</td></tr> } if( db_table_exists("repository","forumpost") ){ n = db_int(0, "SELECT count(*) FROM forumpost/*scan*/"); if( n>0 ){ int nThread = db_int(0, "SELECT count(*) FROM forumpost" " WHERE froot=fpid"); @ <tr><th>Number Of Forum Posts:</th> @ <td>%,d(n) on %d(nThread) threads</td></tr> } } } @ <tr><th>Duration Of Project:</th><td> n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)" " + 0.99"); @ %,d(n) days or approximately %.2f(n/365.2425) years. @ </td></tr> p = db_get("project-code", 0); |
︙ | ︙ | |||
666 667 668 669 670 671 672 673 674 675 676 677 678 679 | ; static const char zSql2[] = @ UPDATE artstat SET atype='file' @ WHERE id IN (SELECT fid FROM mlink) @ AND atype IS NULL; @ UPDATE artstat SET atype='manifest' @ WHERE id IN (SELECT objid FROM event WHERE type='ci') AND atype IS NULL; @ UPDATE artstat SET atype='cluster' @ WHERE atype IS NULL @ AND id IN (SELECT rid FROM tagxref @ WHERE tagid=(SELECT tagid FROM tag @ WHERE tagname='cluster')); @ UPDATE artstat SET atype='ticket' @ WHERE atype IS NULL | > > | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | ; static const char zSql2[] = @ UPDATE artstat SET atype='file' @ WHERE id IN (SELECT fid FROM mlink) @ AND atype IS NULL; @ UPDATE artstat SET atype='manifest' @ WHERE id IN (SELECT objid FROM event WHERE type='ci') AND atype IS NULL; @ UPDATE artstat SET atype='forum' @ WHERE id IN (SELECT objid FROM event WHERE type='f') AND atype IS NULL; @ UPDATE artstat SET atype='cluster' @ WHERE atype IS NULL @ AND id IN (SELECT rid FROM tagxref @ WHERE tagid=(SELECT tagid FROM tag @ WHERE tagname='cluster')); @ UPDATE artstat SET atype='ticket' @ WHERE atype IS NULL |
︙ | ︙ | |||
830 831 832 833 834 835 836 | r = db_double(0.0, "SELECT avg(szCmpr) FROM artstat WHERE NOT isDelta;"); med = db_int(0, "SELECT szCmpr FROM artstat WHERE NOT isDelta ORDER BY szCmpr" " LIMIT 1 OFFSET %d", nFull/2); @ <tr><th>Full-text artifact sizes:</th> @ <td>largest: %,d(mxCmpr), average: %,d((int)r), median: %,d(med)</td> @ </table> | | | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | r = db_double(0.0, "SELECT avg(szCmpr) FROM artstat WHERE NOT isDelta;"); med = db_int(0, "SELECT szCmpr FROM artstat WHERE NOT isDelta ORDER BY szCmpr" " LIMIT 1 OFFSET %d", nFull/2); @ <tr><th>Full-text artifact sizes:</th> @ <td>largest: %,d(mxCmpr), average: %,d((int)r), median: %,d(med)</td> @ </table> @ <h1>Artifact Size Distribution Facts:</h1> @ <ol> @ <li><p>The largest %.2f(n50pct*100.0/nTotal)%% of artifacts largest_n_artifacts(n50pct); @ use 50%% of the total artifact space. @ <li><p>The largest 1%% of artifacts largest_n_artifacts((nTotal+99)/100); @ use %lld(sz1pct*100/sumCmpr)%% of the total artifact space. |
︙ | ︙ |
Changes to src/statrep.c.
︙ | ︙ | |||
48 49 50 51 52 53 54 | ** no 'y' is specified), "*" is assumed (that is also the default for ** invalid/unknown filter values). That 'y' filter is the one used for ** the event list. Note that a filter of "*" or "all" is equivalent to ** querying against the full event table. The view, however, adds an ** abstraction level to simplify the implementation code for the ** various /reports pages. ** | | > > > > > | 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 | ** no 'y' is specified), "*" is assumed (that is also the default for ** invalid/unknown filter values). That 'y' filter is the one used for ** the event list. Note that a filter of "*" or "all" is equivalent to ** querying against the full event table. The view, however, adds an ** abstraction level to simplify the implementation code for the ** various /reports pages. ** ** Returns one of: 'c', 'f', 'w', 'g', 't', 'e', representing the type of ** filter it applies, or '*' if no filter is applied (i.e. if "all" is ** used). */ static int stats_report_init_view(){ const char *zType = PD("type","*"); /* analog to /timeline?y=... */ const char *zRealType = NULL; /* normalized form of zType */ int rc = 0; /* result code */ char *zTimeSpan; /* Time span */ assert( !statsReportType && "Must not be called more than once." ); switch( (zType && *zType) ? *zType : 0 ){ case 'c': case 'C': zRealType = "ci"; rc = *zRealType; break; case 'e': case 'E': zRealType = "e"; rc = *zRealType; break; case 'f': case 'F': zRealType = "f"; rc = *zRealType; break; case 'g': case 'G': zRealType = "g"; rc = *zRealType; break; case 't': case 'T': |
︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 | static const char *stats_report_label_for_type(){ assert( statsReportType && "Must call stats_report_init_view() first." ); switch( statsReportType ){ case 'c': return "check-ins"; case 'e': return "technotes"; case 'w': return "wiki changes"; case 't': return "ticket changes"; case 'g': return "tag changes"; default: | > > | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | static const char *stats_report_label_for_type(){ assert( statsReportType && "Must call stats_report_init_view() first." ); switch( statsReportType ){ case 'c': return "check-ins"; case 'e': return "technotes"; case 'f': return "forum posts"; case 'w': return "wiki changes"; case 't': return "ticket changes"; case 'g': return "tag changes"; default: |
︙ | ︙ | |||
716 717 718 719 720 721 722 | ** Shows activity reports for the repository. ** ** Query Parameters: ** ** view=REPORT_NAME Valid values: bymonth, byyear, byuser ** user=NAME Restricts statistics to the given user ** type=TYPE Restricts the report to a specific event type: | | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | ** Shows activity reports for the repository. ** ** Query Parameters: ** ** view=REPORT_NAME Valid values: bymonth, byyear, byuser ** user=NAME Restricts statistics to the given user ** type=TYPE Restricts the report to a specific event type: ** ci (check-in), f (forum), w (wiki), t (ticket), g (tag) ** Defaulting to all event types. ** ** The view-specific query parameters include: ** ** view=byweek: ** ** y=YYYY The year to report (default is the server's |
︙ | ︙ | |||
748 749 750 751 752 753 754 755 756 757 758 759 760 761 | { "By Week", "byweek", RPT_BYWEEK }, { "By Weekday", "byweekday", RPT_BYWEEKDAY }, { "By Year", "byyear", RPT_BYYEAR }, }; static const char *const azType[] = { "a", "All Changes", "ci", "Check-ins", "g", "Tags", "e", "Tech Notes", "t", "Tickets", "w", "Wiki" }; login_check_credentials(); | > | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | { "By Week", "byweek", RPT_BYWEEK }, { "By Weekday", "byweekday", RPT_BYWEEKDAY }, { "By Year", "byyear", RPT_BYYEAR }, }; static const char *const azType[] = { "a", "All Changes", "ci", "Check-ins", "f", "Forum Posts", "g", "Tags", "e", "Tech Notes", "t", "Tickets", "w", "Wiki" }; login_check_credentials(); |
︙ | ︙ |
Changes to src/style.c.
︙ | ︙ | |||
80 81 82 83 84 85 86 | ** Ad-unit styles. */ static unsigned adUnitFlags = 0; /* ** Flags for various javascript files needed prior to </body> */ | | | | > | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | ** Ad-unit styles. */ static unsigned adUnitFlags = 0; /* ** Flags for various javascript files needed prior to </body> */ static int needHrefJs = 0; /* href.js */ static int needSortJs = 0; /* sorttable.js */ static int needGraphJs = 0; /* graph.js */ static int needCopyBtnJs = 0; /* copybtn.js */ /* ** Extra JS added to the end of the file. */ static Blob blobOnLoad = BLOB_INITIALIZER; /* |
︙ | ︙ | |||
139 140 141 142 143 144 145 | char *xhref(const char *zExtra, const char *zFormat, ...){ char *zUrl; va_list ap; va_start(ap, zFormat); zUrl = vmprintf(zFormat, ap); va_end(ap); if( g.perm.Hyperlink && !g.javascriptHyperlink ){ | > > | > > > > > > | | > | | 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 | char *xhref(const char *zExtra, const char *zFormat, ...){ char *zUrl; va_list ap; va_start(ap, zFormat); zUrl = vmprintf(zFormat, ap); va_end(ap); if( g.perm.Hyperlink && !g.javascriptHyperlink ){ char *zHUrl; if( zExtra ){ zHUrl = mprintf("<a %s href=\"%h\">", zExtra, zUrl); }else{ zHUrl = mprintf("<a href=\"%h\">", zUrl); } fossil_free(zUrl); return zHUrl; } needHrefJs = 1; if( zExtra==0 ){ return mprintf("<a data-href='%z' href='%R/honeypot'>", zUrl); }else{ return mprintf("<a %s data-href='%z' href='%R/honeypot'>", zExtra, zUrl); } } char *chref(const char *zExtra, const char *zFormat, ...){ char *zUrl; va_list ap; va_start(ap, zFormat); zUrl = vmprintf(zFormat, ap); va_end(ap); if( g.perm.Hyperlink && !g.javascriptHyperlink ){ char *zHUrl = mprintf("<a class=\"%s\" href=\"%h\">", zExtra, zUrl); fossil_free(zUrl); return zHUrl; } needHrefJs = 1; return mprintf("<a class='%s' data-href='%z' href='%R/honeypot'>", zExtra, zUrl); } |
︙ | ︙ | |||
363 364 365 366 367 368 369 370 371 372 373 374 375 376 | static void image_url_var(const char *zImageName){ char *zVarPrefix = mprintf("%s_image", zImageName); char *zConfigName = mprintf("%s-image", zImageName); url_var(zVarPrefix, zConfigName, zImageName); free(zVarPrefix); free(zConfigName); } /* ** Return a random nonce that is stored in static space. For a particular ** run, the same nonce is always returned. */ char *style_nonce(void){ static char zNonce[52]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | static void image_url_var(const char *zImageName){ char *zVarPrefix = mprintf("%s_image", zImageName); char *zConfigName = mprintf("%s-image", zImageName); url_var(zVarPrefix, zConfigName, zImageName); free(zVarPrefix); free(zConfigName); } /* ** Output TEXT with a click-to-copy button next to it. Loads the copybtn.js ** Javascript module, and generates HTML elements with the following IDs: ** ** TARGETID: The <span> wrapper around TEXT. ** copy-TARGETID: The <span> for the copy button. ** ** If the FLIPPED argument is non-zero, the copy button is displayed after TEXT. ** ** The COPYLENGTH argument defines the length of the substring of TEXT copied to ** clipboard: ** ** <= 0: No limit (default if the argument is omitted). ** >= 3: Truncate TEXT after COPYLENGTH (single-byte) characters. ** 1: Use the "hash-digits" setting as the limit. ** 2: Use the length appropriate for URLs as the limit (defined at ** compile-time by FOSSIL_HASH_DIGITS_URL, defaults to 16). */ char *style_copy_button( int bOutputCGI, /* Don't return result, but send to cgi_printf(). */ const char *zTargetId, /* The TARGETID argument. */ int bFlipped, /* The FLIPPED argument. */ int cchLength, /* The COPYLENGTH argument. */ const char *zTextFmt, /* Formatting of the TEXT argument (htmlized). */ ... /* Formatting parameters of the TEXT argument. */ ){ va_list ap; char *zText; char *zResult = 0; va_start(ap,zTextFmt); zText = vmprintf(zTextFmt/*works-like:?*/,ap); va_end(ap); if( cchLength==1 ) cchLength = hash_digits(0); else if( cchLength==2 ) cchLength = hash_digits(1); if( !bFlipped ){ const char *zBtnFmt = "<span class=\"nobr\">" "<span " "class=\"copy-button\" " "id=\"copy-%h\" " "data-copytarget=\"%h\" " "data-copylength=\"%d\">" "</span>" "<span id=\"%h\">" "%s" "</span>" "</span>"; if( bOutputCGI ){ cgi_printf( zBtnFmt/*works-like:"%h%h%d%h%s"*/, zTargetId,zTargetId,cchLength,zTargetId,zText); }else{ zResult = mprintf( zBtnFmt/*works-like:"%h%h%d%h%s"*/, zTargetId,zTargetId,cchLength,zTargetId,zText); } }else{ const char *zBtnFmt = "<span class=\"nobr\">" "<span id=\"%h\">" "%s" "</span>" "<span " "class=\"copy-button copy-button-flipped\" " "id=\"copy-%h\" " "data-copytarget=\"%h\" " "data-copylength=\"%d\">" "</span>" "</span>"; if( bOutputCGI ){ cgi_printf( zBtnFmt/*works-like:"%h%s%h%h%d"*/, zTargetId,zText,zTargetId,zTargetId,cchLength); }else{ zResult = mprintf( zBtnFmt/*works-like:"%h%s%h%h%d"*/, zTargetId,zText,zTargetId,zTargetId,cchLength); } } free(zText); style_copybutton_control(); return zResult; } /* ** Return a random nonce that is stored in static space. For a particular ** run, the same nonce is always returned. */ char *style_nonce(void){ static char zNonce[52]; |
︙ | ︙ | |||
387 388 389 390 391 392 393 | ** header template lacks a <body> tag, then all of the following is ** prepended. */ static char zDfltHeader[] = @ <html> @ <head> @ <base href="$baseurl/$current_page" /> | | < < < | < > > > > > > > > > > > > | | | 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 | ** header template lacks a <body> tag, then all of the following is ** prepended. */ static char zDfltHeader[] = @ <html> @ <head> @ <base href="$baseurl/$current_page" /> @ <meta http-equiv="Content-Security-Policy" content="$default_csp" /> @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> @ <title>$<project_name>: $<title></title> @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \ @ href="$home/timeline.rss" /> @ <link rel="stylesheet" href="$stylesheet_url" type="text/css" /> @ </head> @ <body> ; /* ** Initialize all the default TH1 variables */ static void style_init_th1_vars(const char *zTitle){ const char *zNonce = style_nonce(); /* ** Do not overwrite the TH1 variable "default_csp" if it exists, as this ** allows it to be properly overridden via the TH1 setup script (i.e. it ** is evaluated before the header is rendered). */ char *zDfltCsp = sqlite3_mprintf("default-src 'self' data: ; " "script-src 'self' 'nonce-%s' ; " "style-src 'self' 'unsafe-inline'", zNonce); Th_MaybeStore("default_csp", zDfltCsp); sqlite3_free(zDfltCsp); Th_Store("nonce", zNonce); Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); Th_Store("project_description", db_get("project-description","")); if( zTitle ) Th_Store("title", zTitle); Th_Store("baseurl", g.zBaseURL); Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL); Th_Store("home", g.zTop); Th_Store("index_page", db_get("index-page","/home")); if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath); Th_Store("current_page", local_zCurrentPage); Th_Store("csrf_token", g.zCsrfToken); Th_Store("release_version", RELEASE_VERSION); Th_Store("manifest_version", MANIFEST_VERSION); |
︙ | ︙ | |||
522 523 524 525 526 527 528 | ** Indicate that the table-sorting javascript is needed. */ void style_table_sorter(void){ needSortJs = 1; } /* | | > > > > > > > | 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 | ** Indicate that the table-sorting javascript is needed. */ void style_table_sorter(void){ needSortJs = 1; } /* ** Indicate that the timeline graph javascript is needed. */ void style_graph_generator(void){ needGraphJs = 1; } /* ** Indicate that the copy button javascript is needed. */ void style_copybutton_control(void){ needCopyBtnJs = 1; } /* ** Generate code to load a single javascript file */ void style_load_one_js_file(const char *zFile){ @ <script src='%R/builtin/%s(zFile)?id=%S(MANIFEST_UUID)'></script> } |
︙ | ︙ | |||
562 563 564 565 566 567 568 | /* ** Generate code to load all required javascript files. */ static void style_load_all_js_files(void){ int i; if( needHrefJs ){ int nDelay = db_get_int("auto-hyperlink-delay",0); | < < < | > > > > > > > | 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 | /* ** Generate code to load all required javascript files. */ static void style_load_all_js_files(void){ int i; if( needHrefJs ){ int nDelay = db_get_int("auto-hyperlink-delay",0); int bMouseover = db_get_boolean("auto-hyperlink-mouseover",0); @ <script id='href-data' type='application/json'>\ @ {"delay":%d(nDelay),"mouseover":%d(bMouseover)}</script> } @ <script nonce="%h(style_nonce())"> @ function debugMsg(msg){ @ var n = document.getElementById("debugMsg"); @ if(n){n.textContent=msg;} @ } if( needHrefJs ){ cgi_append_content(builtin_text("href.js"),-1); } if( needSortJs ){ cgi_append_content(builtin_text("sorttable.js"),-1); } if( needGraphJs ){ cgi_append_content(builtin_text("graph.js"),-1); } if( needCopyBtnJs ){ cgi_append_content(builtin_text("copybtn.js"),-1); } for(i=0; i<nJsToLoad; i++){ cgi_append_content(builtin_text(azJsToLoad[i]),-1); } if( blob_size(&blobOnLoad)>0 ){ @ window.onload = function(){ cgi_append_content(blob_buffer(&blobOnLoad), blob_size(&blobOnLoad)); cgi_append_content("\n}\n", -1); |
︙ | ︙ | |||
620 621 622 623 624 625 626 627 628 629 630 631 632 633 | */ cgi_destination(CGI_HEADER); if( nSubmenu+nSubmenuCtrl>0 ){ int i; if( nSubmenuCtrl ){ @ <form id='f01' method='GET' action='%R/%s(g.zPath)'> @ <input type='hidden' name='udc' value='1'> } @ <div class="submenu"> if( nSubmenu>0 ){ qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare); for(i=0; i<nSubmenu; i++){ struct Submenu *p = &aSubmenu[i]; if( p->zLink==0 ){ | > | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | */ cgi_destination(CGI_HEADER); if( nSubmenu+nSubmenuCtrl>0 ){ int i; if( nSubmenuCtrl ){ @ <form id='f01' method='GET' action='%R/%s(g.zPath)'> @ <input type='hidden' name='udc' value='1'> cgi_tag_query_parameter("udc"); } @ <div class="submenu"> if( nSubmenu>0 ){ qsort(aSubmenu, nSubmenu, sizeof(aSubmenu[0]), submenuCompare); for(i=0; i<nSubmenu; i++){ struct Submenu *p = &aSubmenu[i]; if( p->zLink==0 ){ |
︙ | ︙ | |||
734 735 736 737 738 739 740 | @ </div> }else{ if( zAd ){ @ <div class="adunit_banner"> cgi_append_content(zAd, -1); @ </div> } | | | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | @ </div> }else{ if( zAd ){ @ <div class="adunit_banner"> cgi_append_content(zAd, -1); @ </div> } @ <div class="content"><span id="debugMsg"></span> } cgi_destination(CGI_BODY); if( sideboxUsed ){ /* Put the footer at the bottom of the page. ** the additional clear/both is needed to extend the content ** part to the end of an optional sidebox. |
︙ | ︙ | |||
912 913 914 915 916 917 918 | } } /* Process through TH1 in order to give an opportunity to substitute ** variables such as $baseurl. */ Th_Store("baseurl", g.zBaseURL); | | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | } } /* Process through TH1 in order to give an opportunity to substitute ** variables such as $baseurl. */ Th_Store("baseurl", g.zBaseURL); Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL); Th_Store("home", g.zTop); image_url_var("logo"); image_url_var("background"); Th_Render(blob_str(&css)); /* Tell CGI that the content returned by this page is considered cacheable */ g.isConst = 1; |
︙ | ︙ | |||
1023 1024 1025 1026 1027 1028 1029 | ** For administators, or if the test_env_enable setting is true, then ** details of the request environment are displayed. Otherwise, just ** the error message is shown. ** ** If zFormat is an empty string, then this is the /test_env page. */ void webpage_error(const char *zFormat, ...){ | < < < < < < < < < < < < < < < < < < | | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | ** For administators, or if the test_env_enable setting is true, then ** details of the request environment are displayed. Otherwise, just ** the error message is shown. ** ** If zFormat is an empty string, then this is the /test_env page. */ void webpage_error(const char *zFormat, ...){ int showAll; char *zErr = 0; int isAuth = 0; char zCap[100]; login_check_credentials(); if( g.perm.Admin || g.perm.Setup || db_get_boolean("test_env_enable",0) ){ isAuth = 1; } cgi_load_environment(); if( zFormat[0] ){ va_list ap; va_start(ap, zFormat); zErr = vmprintf(zFormat, ap); va_end(ap); style_header("Bad Request"); @ <h1>/%h(g.zPath): %h(zErr)</h1> |
︙ | ︙ |
Changes to src/sync.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | */ #include "config.h" #include "sync.h" #include <assert.h> /* ** If the repository is configured for autosyncing, then do an | | | > > > > > > > > > > > > < < < | < < < | | < < > | | 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 | */ #include "config.h" #include "sync.h" #include <assert.h> /* ** If the repository is configured for autosyncing, then do an ** autosync. Bits of the "flags" parameter determine details of behavior: ** ** SYNC_PULL Pull content from the server to the local repo ** SYNC_PUSH Push content from local up to the server ** SYNC_CKIN_LOCK Take a check-in lock on the current checkout. ** SYNC_VERBOSE Extra output ** ** Return the number of errors. ** ** The autosync setting can be a boolean or "pullonly". No autosync ** is attempted if the autosync setting is off, and only auto-pull is ** attempted if autosync is set to "pullonly". The check-in lock is ** not acquired unless autosync is set to "on". ** ** If dont-push setting is true, that is the same as having autosync ** set to pullonly. */ int autosync(int flags){ const char *zAutosync; int rc; int configSync = 0; /* configuration changes transferred */ if( g.fNoSync ){ return 0; } zAutosync = db_get("autosync", 0); if( zAutosync==0 ) zAutosync = "on"; /* defend against misconfig */ if( is_false(zAutosync) ) return 0; if( db_get_boolean("dont-push",0) || fossil_strncmp(zAutosync,"pull",4)==0 ){ flags &= ~SYNC_CKIN_LOCK; if( flags & SYNC_PUSH ) return 0; } url_parse(0, URL_REMEMBER); if( g.url.protocol==0 ) return 0; if( g.url.user!=0 && g.url.passwd==0 ){ g.url.passwd = unobscure(db_get("last-sync-pw", 0)); g.url.flags |= URL_PROMPT_PW; url_prompt_for_password(); |
︙ | ︙ | |||
153 154 155 156 157 158 159 | } if( find_option("verbose","v",0)!=0 ){ *pSyncFlags |= SYNC_VERBOSE; } url_proxy_options(); clone_ssh_find_options(); if( !uvOnly ) db_find_and_open_repository(0, 0); | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | } if( find_option("verbose","v",0)!=0 ){ *pSyncFlags |= SYNC_VERBOSE; } url_proxy_options(); clone_ssh_find_options(); if( !uvOnly ) db_find_and_open_repository(0, 0); db_open_config(0, 1); if( g.argc==2 ){ if( db_get_boolean("auto-shun",1) ) configSync = CONFIGSET_SHUN; }else if( g.argc==3 ){ zUrl = g.argv[2]; } if( ((*pSyncFlags) & (SYNC_PUSH|SYNC_PULL))==(SYNC_PUSH|SYNC_PULL) && db_get_boolean("uv-sync",0) |
︙ | ︙ | |||
193 194 195 196 197 198 199 | } /* ** COMMAND: pull ** ** Usage: %fossil pull ?URL? ?options? ** | | | > | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | } /* ** COMMAND: pull ** ** Usage: %fossil pull ?URL? ?options? ** ** Pull all sharable changes from a remote repository into the local ** repository. Sharable changes include public check-ins, edits to ** wiki pages, tickets, and tech-notes, as well as forum content. Add ** the --private option to pull private branches. Use the ** "configuration pull" command to pull website configuration details. ** ** If URL is not specified, then the URL from the most recent clone, push, ** pull, remote-url, or sync command is used. See "fossil help clone" for ** details on the URL formats. ** ** Options: |
︙ | ︙ | |||
239 240 241 242 243 244 245 | } /* ** COMMAND: push ** ** Usage: %fossil push ?URL? ?options? ** | | | > | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | } /* ** COMMAND: push ** ** Usage: %fossil push ?URL? ?options? ** ** Push all sharable changes from the local repository to a remote ** repository. Sharable changes include public check-ins, edits to ** wiki pages, tickets, and tech-notes, as well as forum content. Use ** --private to also push private branches. Use the "configuration ** push" command to push website configuration details. ** ** If URL is not specified, then the URL from the most recent clone, push, ** pull, remote-url, or sync command is used. See "fossil help clone" for ** details on the URL formats. ** ** Options: ** |
︙ | ︙ |
Changes to src/tag.c.
︙ | ︙ | |||
357 358 359 360 361 362 363 | fossil_print("%s", blob_str(&ctrl)); blob_reset(&ctrl); }else{ nrid = content_put(&ctrl); manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); } assert( blob_is_reset(&ctrl) ); | > | > | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | fossil_print("%s", blob_str(&ctrl)); blob_reset(&ctrl); }else{ nrid = content_put(&ctrl); manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); } assert( blob_is_reset(&ctrl) ); if( g.localOpen ){ manifest_to_disk(rid); } } /* ** COMMAND: tag ** ** Usage: %fossil tag SUBCOMMAND ... ** |
︙ | ︙ | |||
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | ** ** %fossil tag cancel ?--raw? TAGNAME CHECK-IN ** ** Remove the tag TAGNAME from CHECK-IN, and also remove ** the propagation of the tag to any descendants. Use the ** the --dryrun or -n options to see what would have happened. ** ** %fossil tag find ?OPTIONS? TAGNAME ** ** List all objects that use TAGNAME. TYPE can be "ci" for ** check-ins or "e" for events. The limit option limits the number ** of results to the given value. ** ** Options: ** --raw Raw tag name. ** -t|--type TYPE One of "ci", or "e". ** -n|--limit N Limit to N results. ** | > > > > > > > | | > > > > > | 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 | ** ** %fossil tag cancel ?--raw? TAGNAME CHECK-IN ** ** Remove the tag TAGNAME from CHECK-IN, and also remove ** the propagation of the tag to any descendants. Use the ** the --dryrun or -n options to see what would have happened. ** ** Options: ** --raw Raw tag name. ** --date-override DATETIME Set date and time deleted. ** --user-override USER Name USER when deleting the tag. ** --dryrun|-n Display the control artifact, but do ** not insert it into the database. ** ** %fossil tag find ?OPTIONS? TAGNAME ** ** List all objects that use TAGNAME. TYPE can be "ci" for ** check-ins or "e" for events. The limit option limits the number ** of results to the given value. ** ** Options: ** --raw Raw tag name. ** -t|--type TYPE One of "ci", or "e". ** -n|--limit N Limit to N results. ** ** %fossil tag list|ls ?OPTIONS? ?CHECK-IN? ** ** List all tags, or if CHECK-IN is supplied, list ** all tags and their values for CHECK-IN. The tagtype option ** takes one of: propagated, singleton, cancel. ** ** Options: ** --raw List tags raw names of tags ** --tagtype TYPE List only tags of type TYPE ** ** The option --raw allows the manipulation of all types of tags ** used for various internal purposes in fossil. It also shows ** "cancel" tags for the "find" and "list" subcommands. You should ** not use this option to make changes unless you are sure what ** you are doing. ** |
︙ | ︙ | |||
430 431 432 433 434 435 436 | ** fossil update tag:decaf ** ** will assume that "decaf" is a tag/branch name. ** */ void tag_cmd(void){ int n; | < < < < < > > > > > > > | > > > > | 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 | ** fossil update tag:decaf ** ** will assume that "decaf" is a tag/branch name. ** */ void tag_cmd(void){ int n; db_find_and_open_repository(0, 0); if( g.argc<3 ){ goto tag_cmd_usage; } n = strlen(g.argv[2]); if( n==0 ){ goto tag_cmd_usage; } if( strncmp(g.argv[2],"add",n)==0 ){ char *zValue; int dryRun = 0; int fRaw = find_option("raw","",0)!=0; const char *zPrefix = fRaw ? "" : "sym-"; int fPropagate = find_option("propagate","",0)!=0; const char *zDateOvrd = find_option("date-override",0,1); const char *zUserOvrd = find_option("user-override",0,1); if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; if( g.argc!=5 && g.argc!=6 ){ usage("add ?options? TAGNAME CHECK-IN ?VALUE?"); } zValue = g.argc==6 ? g.argv[5] : 0; db_begin_transaction(); tag_add_artifact(zPrefix, g.argv[3], g.argv[4], zValue, 1+fPropagate+dryRun,zDateOvrd,zUserOvrd); db_end_transaction(0); }else if( strncmp(g.argv[2],"branch",n)==0 ){ fossil_fatal("the \"fossil tag branch\" command is discontinued\n" "Use the \"fossil branch new\" command instead."); }else if( strncmp(g.argv[2],"cancel",n)==0 ){ int dryRun = 0; int fRaw = find_option("raw","",0)!=0; const char *zPrefix = fRaw ? "" : "sym-"; const char *zDateOvrd = find_option("date-override",0,1); const char *zUserOvrd = find_option("user-override",0,1); if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; if( g.argc!=5 ){ usage("cancel ?options? TAGNAME CHECK-IN"); } db_begin_transaction(); tag_add_artifact(zPrefix, g.argv[3], g.argv[4], 0, dryRun, zDateOvrd, zUserOvrd); db_end_transaction(0); }else if( strncmp(g.argv[2],"find",n)==0 ){ Stmt q; int fRaw = find_option("raw","",0)!=0; const char *zFindLimit = find_option("limit","n",1); const int nFindLimit = zFindLimit ? atoi(zFindLimit) : -2000; const char *zType = find_option("type","t",1); Blob sql = empty_blob; if( zType==0 || zType[0]==0 ) zType = "*"; if( g.argc!=4 ){ usage("find ?--raw? ?-t|--type TYPE? ?-n|--limit #? TAGNAME"); } if( fRaw ){ |
︙ | ︙ | |||
526 527 528 529 530 531 532 533 534 535 536 537 | db_finalize(&q); } } }else if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ Stmt q; if( g.argc==3 ){ db_prepare(&q, "SELECT tagname FROM tag" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=tag.tagid" | > > > > > > > > > > > > > > > | | > > | | > | | 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 | db_finalize(&q); } } }else if(( strncmp(g.argv[2],"list",n)==0 )||( strncmp(g.argv[2],"ls",n)==0 )){ Stmt q; int fRaw = find_option("raw","",0)!=0; const char *zTagType = find_option("tagtype","t",1); int nTagType = fRaw ? -1 : 0; if( zTagType!=0 ){ int l = strlen(zTagType); if( strncmp(zTagType,"cancel",l)==0 ){ nTagType = 0; }else if( strncmp(zTagType,"singleton",l)==0 ){ nTagType = 1; }else if( strncmp(zTagType,"propagated",l)==0 ){ nTagType = 2; }else{ fossil_fatal("unrecognized tag type"); } } if( g.argc==3 ){ db_prepare(&q, "SELECT tagname FROM tag" " WHERE EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=tag.tagid" " AND tagtype%c%d)" " ORDER BY tagname", zTagType!=0 ? '=' : '>', nTagType ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( fRaw ){ fossil_print("%s\n", zName); }else if( strncmp(zName, "sym-", 4)==0 ){ fossil_print("%s\n", &zName[4]); } } db_finalize(&q); }else if( g.argc==4 ){ int rid = name_to_rid(g.argv[3]); db_prepare(&q, "SELECT tagname, value FROM tagxref, tag" " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" " AND tagtype%c%d" " ORDER BY tagname", rid, zTagType!=0 ? '=' : '>', nTagType ); while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); const char *zValue = db_column_text(&q, 1); if( fRaw==0 ){ if( strncmp(zName, "sym-", 4)!=0 ) continue; zName += 4; } if( zValue && zValue[0] ){ fossil_print("%s=%s\n", zName, zValue); }else{ fossil_print("%s\n", zName); } } db_finalize(&q); }else{ usage("list ?OPTIONS? ?CHECK-IN?"); } }else { goto tag_cmd_usage; } /* Cleanup */ |
︙ | ︙ | |||
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 | ** reparenting operation, simply delete the tag. ** ** --test Make database entries but do not add the tag artifact. ** So the reparent operation will be undone by the next ** "fossil rebuild" command. ** --dryrun | -n Print the tag that would have been created but do not ** actually change the database in any way. */ void reparent_cmd(void){ int bTest = find_option("test","",0)!=0; int rid; int i; Blob value; char *zUuid; int dryRun = 0; if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; db_find_and_open_repository(0, 0); verify_all_options(); if( g.argc<4 ){ usage("[OPTIONS] CHECK-IN PARENT ..."); } rid = name_to_typed_rid(g.argv[2], "ci"); blob_init(&value, 0, 0); for(i=3; i<g.argc; i++){ int pid = name_to_typed_rid(g.argv[i], "ci"); if( i>3 ) blob_append(&value, " ", 1); zUuid = rid_to_uuid(pid); blob_append(&value, zUuid, strlen(zUuid)); fossil_free(zUuid); } if( bTest && !dryRun ){ tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); }else{ zUuid = rid_to_uuid(rid); | > > > > > > | > | 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 | ** reparenting operation, simply delete the tag. ** ** --test Make database entries but do not add the tag artifact. ** So the reparent operation will be undone by the next ** "fossil rebuild" command. ** --dryrun | -n Print the tag that would have been created but do not ** actually change the database in any way. ** --date-override DATETIME Set the change time on the control artifact ** --user-override USER Set the user name on the control artifact */ void reparent_cmd(void){ int bTest = find_option("test","",0)!=0; int rid; int i; Blob value; char *zUuid; int dryRun = 0; const char *zDateOvrd; /* The change time on the control artifact */ const char *zUserOvrd; /* The user name on the control artifact */ if( find_option("dryrun","n",0)!=0 ) dryRun = TAG_ADD_DRYRUN; zDateOvrd = find_option("date-override",0,1); zUserOvrd = find_option("user-override",0,1); db_find_and_open_repository(0, 0); verify_all_options(); if( g.argc<4 ){ usage("[OPTIONS] CHECK-IN PARENT ..."); } rid = name_to_typed_rid(g.argv[2], "ci"); blob_init(&value, 0, 0); for(i=3; i<g.argc; i++){ int pid = name_to_typed_rid(g.argv[i], "ci"); if( i>3 ) blob_append(&value, " ", 1); zUuid = rid_to_uuid(pid); blob_append(&value, zUuid, strlen(zUuid)); fossil_free(zUuid); } if( bTest && !dryRun ){ tag_insert("parent", 1, blob_str(&value), -1, 0.0, rid); }else{ zUuid = rid_to_uuid(rid); tag_add_artifact("","parent",zUuid,blob_str(&value),1|dryRun, zDateOvrd,zUserOvrd); } } /* ** WEBPAGE: taglist ** |
︙ | ︙ | |||
667 668 669 670 671 672 673 | " AND tagname GLOB 'sym-*'" " ORDER BY tagname" ); @ <ul> while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( g.perm.Hyperlink ){ | | > > > > > > > > > > > > > > > | | | | | > > > > > > > | < | > > > > > > | | 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 | " AND tagname GLOB 'sym-*'" " ORDER BY tagname" ); @ <ul> while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); if( g.perm.Hyperlink ){ @ <li>%z(chref("taglink","%R/timeline?t=%T",zName)) @ %h(zName)</a></li> }else{ @ <li><span class="tagDsp">%h(zName)</span></li> } } @ </ul> db_finalize(&q); style_footer(); } /* ** WEBPAGE: /tagtimeline ** ** Render a timeline with all check-ins that contain non-propagating ** symbolic tags. ** ** Query parameters: ** ** ng No graph ** nohidden Hide check-ins with "hidden" tag ** onlyhidden Show only check-ins with "hidden" tag ** brbg Background color by branch name ** ubg Background color by user name */ void tagtimeline_page(void){ Blob sql = empty_blob; Stmt q; int tmFlags; /* Timeline display flags */ int fNoHidden = PB("nohidden")!=0; /* The "nohidden" query parameter */ int fOnlyHidden = PB("onlyhidden")!=0; /* The "onlyhidden" query parameter */ login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } style_header("Tagged Check-ins"); style_submenu_element("List", "taglist"); login_anonymous_available(); timeline_ss_submenu(); cookie_render(); @ <h2>Check-ins with non-propagating tags:</h2> blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, "AND blob.rid IN (SELECT rid FROM tagxref" " WHERE tagtype=1 AND srcid>0" " AND tagid IN (SELECT tagid FROM tag " " WHERE tagname GLOB 'sym-*'))"); if( fNoHidden || fOnlyHidden ){ const char* zUnaryOp = fNoHidden ? "NOT" : ""; blob_append_sql(&sql, " AND %s EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0 AND rid=blob.rid)\n", zUnaryOp/*safe-for-%s*/, TAG_HIDDEN); } db_prepare(&q, "%s ORDER BY event.mtime DESC /*sort*/", blob_sql_text(&sql)); blob_reset(&sql); /* Always specify TIMELINE_DISJOINT, or graph_finish() may fail because of too ** many descenders to (off-screen) parents. */ tmFlags = TIMELINE_XMERGE | TIMELINE_FILLGAPS | TIMELINE_NOSCROLL; if( PB("ng")==0 ) tmFlags |= TIMELINE_GRAPH; if( PB("brbg")!=0 ) tmFlags |= TIMELINE_BRCOLOR; if( PB("ubg")!=0 ) tmFlags |= TIMELINE_UCOLOR; www_print_timeline(&q, tmFlags, 0, 0, 0, 0, 0, 0); db_finalize(&q); @ <br /> style_footer(); } |
Changes to src/tar.c.
︙ | ︙ | |||
806 807 808 809 810 811 812 813 814 815 816 | tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude); cache_write(&tarball, zKey); } glob_free(pInclude); glob_free(pExclude); fossil_free(zName); fossil_free(zRid); blob_reset(&cacheKey); cgi_set_content(&tarball); cgi_set_content_type("application/x-compressed"); } | > | 806 807 808 809 810 811 812 813 814 815 816 817 | tarball_of_checkin(rid, &tarball, zName, pInclude, pExclude); cache_write(&tarball, zKey); } glob_free(pInclude); glob_free(pExclude); fossil_free(zName); fossil_free(zRid); g.zOpenRevision = 0; blob_reset(&cacheKey); cgi_set_content(&tarball); cgi_set_content_type("application/x-compressed"); } |
Changes to src/th.c.
︙ | ︙ | |||
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | int nBuf; int nBufAlloc; }; typedef struct Buffer Buffer; static int thBufferWrite(Th_Interp *interp, Buffer *, const char *, int); static void thBufferInit(Buffer *); static void thBufferFree(Th_Interp *interp, Buffer *); /* ** Append nAdd bytes of content copied from zAdd to the end of buffer ** pBuffer. If there is not enough space currently allocated, resize ** the allocation to make space. */ static int thBufferWrite( | > > > > > > > > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | int nBuf; int nBufAlloc; }; typedef struct Buffer Buffer; static int thBufferWrite(Th_Interp *interp, Buffer *, const char *, int); static void thBufferInit(Buffer *); static void thBufferFree(Th_Interp *interp, Buffer *); /* ** This version of memcpy() allows the first and second argument to ** be NULL as long as the number of bytes to copy is zero. */ static void *th_memcpy(void *dest, const void *src, size_t n){ return n>0 ? memcpy(dest,src,n) : dest; } /* ** Append nAdd bytes of content copied from zAdd to the end of buffer ** pBuffer. If there is not enough space currently allocated, resize ** the allocation to make space. */ static int thBufferWrite( |
︙ | ︙ | |||
225 226 227 228 229 230 231 | if( nReq>pBuffer->nBufAlloc ){ char *zNew; int nNew; nNew = nReq*2; zNew = (char *)Th_Malloc(interp, nNew); | | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | if( nReq>pBuffer->nBufAlloc ){ char *zNew; int nNew; nNew = nReq*2; zNew = (char *)Th_Malloc(interp, nNew); th_memcpy(zNew, pBuffer->zBuf, pBuffer->nBuf); Th_Free(interp, pBuffer->zBuf); pBuffer->nBufAlloc = nNew; pBuffer->zBuf = zNew; } th_memcpy(&pBuffer->zBuf[pBuffer->nBuf], zAdd, nAdd); pBuffer->nBuf += nAdd; pBuffer->zBuf[pBuffer->nBuf] = '\0'; return TH_OK; } #define thBufferWrite(a,b,c,d) thBufferWrite(a,b,(const char *)c,d) |
︙ | ︙ | |||
839 840 841 842 843 844 845 | char **azElem = Th_Malloc(interp, sizeof(char*) * nCount + /* azElem */ sizeof(int) * nCount + /* anElem */ strbuf.nBuf /* space for list element strings */ ); anElem = (int *)&azElem[nCount]; zElem = (char *)&anElem[nCount]; | | | | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | char **azElem = Th_Malloc(interp, sizeof(char*) * nCount + /* azElem */ sizeof(int) * nCount + /* anElem */ strbuf.nBuf /* space for list element strings */ ); anElem = (int *)&azElem[nCount]; zElem = (char *)&anElem[nCount]; th_memcpy(anElem, lenbuf.zBuf, lenbuf.nBuf); th_memcpy(zElem, strbuf.zBuf, strbuf.nBuf); for(i=0; i<nCount;i++){ azElem[i] = zElem; zElem += (anElem[i] + 1); } *pazElem = azElem; *panElem = anElem; } |
︙ | ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | Th_Free(interp, pValue->zData); pValue->zData = 0; } assert(zValue || nValue==0); pValue->zData = Th_Malloc(interp, nValue+1); pValue->zData[nValue] = '\0'; | | | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 | Th_Free(interp, pValue->zData); pValue->zData = 0; } assert(zValue || nValue==0); pValue->zData = Th_Malloc(interp, nValue+1); pValue->zData[nValue] = '\0'; th_memcpy(pValue->zData, zValue, nValue); pValue->nData = nValue; return TH_OK; } /* ** Create a variable link so that accessing variable (zLocal, nLocal) is |
︙ | ︙ | |||
1410 1411 1412 1413 1414 1415 1416 | */ char *th_strdup(Th_Interp *interp, const char *z, int n){ char *zRes; if( n<0 ){ n = th_strlen(z); } zRes = Th_Malloc(interp, n+1); | | | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | */ char *th_strdup(Th_Interp *interp, const char *z, int n){ char *zRes; if( n<0 ){ n = th_strlen(z); } zRes = Th_Malloc(interp, n+1); th_memcpy(zRes, z, n); zRes[n] = '\0'; return zRes; } /* ** Argument zPre must be a nul-terminated string. Set the interpreter ** result to a string containing the contents of zPre, followed by |
︙ | ︙ | |||
1470 1471 1472 1473 1474 1475 1476 | if( n<0 ){ n = th_strlen(z); } if( z && n>0 ){ char *zResult; zResult = Th_Malloc(pInterp, n+1); | | | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | if( n<0 ){ n = th_strlen(z); } if( z && n>0 ){ char *zResult; zResult = Th_Malloc(pInterp, n+1); th_memcpy(zResult, z, n); zResult[n] = '\0'; pInterp->zResult = zResult; pInterp->nResult = n; } return TH_OK; } |
︙ | ︙ | |||
1773 1774 1775 1776 1777 1778 1779 | if( nElem<0 ){ nElem = th_strlen(zElem); } nNew = *pnStr + nElem; zNew = Th_Malloc(interp, nNew); | | | | 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 | if( nElem<0 ){ nElem = th_strlen(zElem); } nNew = *pnStr + nElem; zNew = Th_Malloc(interp, nNew); th_memcpy(zNew, *pzStr, *pnStr); th_memcpy(&zNew[*pnStr], zElem, nElem); Th_Free(interp, *pzStr); *pzStr = zNew; *pnStr = nNew; return TH_OK; } |
︙ | ︙ | |||
2333 2334 2335 2336 2337 2338 2339 | } if( pNew->pOp || pNew->nValue ){ if( pNew->nValue ){ /* A terminal. Copy the string value. */ assert( !pNew->pOp ); pNew->zValue = Th_Malloc(interp, pNew->nValue); | | | | 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 | } if( pNew->pOp || pNew->nValue ){ if( pNew->nValue ){ /* A terminal. Copy the string value. */ assert( !pNew->pOp ); pNew->zValue = Th_Malloc(interp, pNew->nValue); th_memcpy(pNew->zValue, z, pNew->nValue); i += pNew->nValue; } if( (nToken%16)==0 ){ /* Grow the apToken array. */ Expr **apTokenOld = apToken; apToken = Th_Malloc(interp, sizeof(Expr *)*(nToken+16)); th_memcpy(apToken, apTokenOld, sizeof(Expr *)*nToken); } /* Put the new token at the end of the apToken array */ apToken[nToken] = pNew; nToken++; }else{ Th_Free(interp, pNew); |
︙ | ︙ | |||
2511 2512 2513 2514 2515 2516 2517 | pRet = 0; } if( op>0 && !pRet ){ pRet = (Th_HashEntry *)Th_Malloc(interp, sizeof(Th_HashEntry) + nKey); pRet->zKey = (char *)&pRet[1]; pRet->nKey = nKey; | | | 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 | pRet = 0; } if( op>0 && !pRet ){ pRet = (Th_HashEntry *)Th_Malloc(interp, sizeof(Th_HashEntry) + nKey); pRet->zKey = (char *)&pRet[1]; pRet->nKey = nKey; th_memcpy(pRet->zKey, zKey, nKey); pRet->pNext = pHash->a[iKey]; pHash->a[iKey] = pRet; } return pRet; } |
︙ | ︙ |
Changes to src/th_main.c.
︙ | ︙ | |||
265 266 267 268 269 270 271 | ** True if output is enabled. False if disabled. */ static int enableOutput = 1; /* ** TH1 command: enable_output BOOLEAN ** | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | ** True if output is enabled. False if disabled. */ static int enableOutput = 1; /* ** TH1 command: enable_output BOOLEAN ** ** Enable or disable the puts, wiki, combobox and copybtn commands. */ static int enableOutputCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl |
︙ | ︙ | |||
409 410 411 412 413 414 415 416 417 418 419 420 | manifest_destroy(pManifest); return rid; } } Th_SetResult(interp, "file name not found in manifest", -1); return 0; } /* ** TH1 command: puts STRING ** TH1 command: html STRING ** | > > > > > > > > > > > > > > > > > > > > | | 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 | manifest_destroy(pManifest); return rid; } } Th_SetResult(interp, "file name not found in manifest", -1); return 0; } /* ** TH1 command: nonce ** ** Returns the value of the cryptographic nonce for the request being ** processed. */ static int nonceCmd( Th_Interp *interp, void *pConvert, int argc, const char **argv, int *argl ){ if( argc!=1 ){ return Th_WrongNumArgs(interp, "nonce"); } Th_SetResult(interp, style_nonce(), -1); return TH_OK; } /* ** TH1 command: puts STRING ** TH1 command: html STRING ** ** Output STRING escaped for HTML (puts) or unchanged (html). */ static int putsCmd( Th_Interp *interp, void *pConvert, int argc, const char **argv, int *argl |
︙ | ︙ | |||
507 508 509 510 511 512 513 514 515 516 517 518 519 520 | ){ if( argc!=1 ){ return Th_WrongNumArgs(interp, "verifyCsrf"); } login_verify_csrf_secret(); return TH_OK; } /* ** TH1 command: markdown STRING ** ** Renders the input string as markdown. The result is a two-element list. ** The first element is the text-only title string. The second element ** contains the body, rendered as HTML. | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | ){ if( argc!=1 ){ return Th_WrongNumArgs(interp, "verifyCsrf"); } login_verify_csrf_secret(); return TH_OK; } /* ** TH1 command: verifyLogin ** ** Returns non-zero if the specified user name and password represent a ** valid login for the repository. */ static int verifyLoginCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ const char *zUser; const char *zPass; int uid; if( argc!=3 ){ return Th_WrongNumArgs(interp, "verifyLogin userName password"); } zUser = argv[1]; zPass = argv[2]; uid = login_search_uid(&zUser, zPass); Th_SetResultInt(interp, uid!=0); if( uid==0 ) sqlite3_sleep(100); return TH_OK; } /* ** TH1 command: markdown STRING ** ** Renders the input string as markdown. The result is a two-element list. ** The first element is the text-only title string. The second element ** contains the body, rendered as HTML. |
︙ | ︙ | |||
968 969 970 971 972 973 974 975 976 977 978 979 980 981 | free(z); } sendText("</select>", -1, 0); Th_Free(interp, azElem); } return TH_OK; } /* ** TH1 command: linecount STRING MAX MIN ** ** Return one more than the number of \n characters in STRING. But ** never return less than MIN or more than MAX. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | free(z); } sendText("</select>", -1, 0); Th_Free(interp, azElem); } return TH_OK; } /* ** TH1 command: copybtn TARGETID FLIPPED TEXT ?COPYLENGTH? ** ** Output TEXT with a click-to-copy button next to it. Loads the copybtn.js ** Javascript module, and generates HTML elements with the following IDs: ** ** TARGETID: The <span> wrapper around TEXT. ** copy-TARGETID: The <span> for the copy button. ** ** If the FLIPPED argument is non-zero, the copy button is displayed after TEXT. ** ** The optional COPYLENGTH argument defines the length of the substring of TEXT ** copied to clipboard: ** ** <= 0: No limit (default if the argument is omitted). ** >= 3: Truncate TEXT after COPYLENGTH (single-byte) characters. ** 1: Use the "hash-digits" setting as the limit. ** 2: Use the length appropriate for URLs as the limit (defined at ** compile-time by FOSSIL_HASH_DIGITS_URL, defaults to 16). */ static int copybtnCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ if( argc!=4 && argc!=5 ){ return Th_WrongNumArgs(interp, "copybtn TARGETID FLIPPED TEXT ?COPYLENGTH?"); } if( enableOutput ){ int flipped = 0; int copylength = 0; char *zResult; if( Th_ToInt(interp, argv[2], argl[2], &flipped) ) return TH_ERROR; if( argc==5 ){ if( Th_ToInt(interp, argv[4], argl[4], ©length) ) return TH_ERROR; } zResult = style_copy_button( /*bOutputCGI==*/0, /*TARGETID==*/(char*)argv[1], flipped, copylength, "%h", /*TEXT==*/(char*)argv[3]); sendText(zResult, -1, 0); free(zResult); } return TH_OK; } /* ** TH1 command: linecount STRING MAX MIN ** ** Return one more than the number of \n characters in STRING. But ** never return less than MIN or more than MAX. */ |
︙ | ︙ | |||
1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | return TH_ERROR; } }else{ Th_SetResult(interp, "repository unavailable", -1); return TH_ERROR; } } /* ** TH1 command: unversioned content FILENAME ** ** Attempts to locate the specified unversioned file and return its contents. ** An error is generated if the repository is not open or the unversioned file ** cannot be found. | > > > > > > > > > > > > > > > > > > > | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | return TH_ERROR; } }else{ Th_SetResult(interp, "repository unavailable", -1); return TH_ERROR; } } /* ** TH1 command: cgiHeaderLine line ** ** Adds the specified line to the CGI header. */ static int cgiHeaderLineCmd( Th_Interp *interp, void *p, int argc, const char **argv, int *argl ){ if( argc!=2 ){ return Th_WrongNumArgs(interp, "cgiHeaderLine line"); } cgi_append_header(argv[1]); return TH_OK; } /* ** TH1 command: unversioned content FILENAME ** ** Attempts to locate the specified unversioned file and return its contents. ** An error is generated if the repository is not open or the unversioned file ** cannot be found. |
︙ | ︙ | |||
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 | const char *zName; Th_CommandProc xProc; void *pContext; } aCommand[] = { {"anoncap", hascapCmd, (void*)&anonFlag}, {"anycap", anycapCmd, 0}, {"artifact", artifactCmd, 0}, {"checkout", checkoutCmd, 0}, {"combobox", comboboxCmd, 0}, {"date", dateCmd, 0}, {"decorate", wikiCmd, (void*)&aFlags[2]}, {"dir", dirCmd, 0}, {"enable_output", enableOutputCmd, 0}, {"encode64", encode64Cmd, 0}, {"getParameter", getParameterCmd, 0}, {"glob_match", globMatchCmd, 0}, {"globalState", globalStateCmd, 0}, {"httpize", httpizeCmd, 0}, {"hascap", hascapCmd, (void*)&zeroInt}, {"hasfeature", hasfeatureCmd, 0}, {"html", putsCmd, (void*)&aFlags[0]}, {"htmlize", htmlizeCmd, 0}, {"http", httpCmd, 0}, {"insertCsrf", insertCsrfCmd, 0}, {"linecount", linecntCmd, 0}, {"markdown", markdownCmd, 0}, {"puts", putsCmd, (void*)&aFlags[1]}, {"query", queryCmd, 0}, {"randhex", randhexCmd, 0}, {"redirect", redirectCmd, 0}, {"regexp", regexpCmd, 0}, {"reinitialize", reinitializeCmd, 0}, {"render", renderCmd, 0}, {"repository", repositoryCmd, 0}, {"searchable", searchableCmd, 0}, {"setParameter", setParameterCmd, 0}, {"setting", settingCmd, 0}, {"styleFooter", styleFooterCmd, 0}, {"styleHeader", styleHeaderCmd, 0}, {"styleScript", styleScriptCmd, 0}, {"tclReady", tclReadyCmd, 0}, {"trace", traceCmd, 0}, {"stime", stimeCmd, 0}, {"unversioned", unversionedCmd, 0}, {"utime", utimeCmd, 0}, {"verifyCsrf", verifyCsrfCmd, 0}, {"wiki", wikiCmd, (void*)&aFlags[0]}, {0, 0, 0} }; if( g.thTrace ){ Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); } if( needConfig ){ | > > > > | 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 | const char *zName; Th_CommandProc xProc; void *pContext; } aCommand[] = { {"anoncap", hascapCmd, (void*)&anonFlag}, {"anycap", anycapCmd, 0}, {"artifact", artifactCmd, 0}, {"cgiHeaderLine", cgiHeaderLineCmd, 0}, {"checkout", checkoutCmd, 0}, {"combobox", comboboxCmd, 0}, {"copybtn", copybtnCmd, 0}, {"date", dateCmd, 0}, {"decorate", wikiCmd, (void*)&aFlags[2]}, {"dir", dirCmd, 0}, {"enable_output", enableOutputCmd, 0}, {"encode64", encode64Cmd, 0}, {"getParameter", getParameterCmd, 0}, {"glob_match", globMatchCmd, 0}, {"globalState", globalStateCmd, 0}, {"httpize", httpizeCmd, 0}, {"hascap", hascapCmd, (void*)&zeroInt}, {"hasfeature", hasfeatureCmd, 0}, {"html", putsCmd, (void*)&aFlags[0]}, {"htmlize", htmlizeCmd, 0}, {"http", httpCmd, 0}, {"insertCsrf", insertCsrfCmd, 0}, {"linecount", linecntCmd, 0}, {"markdown", markdownCmd, 0}, {"nonce", nonceCmd, 0}, {"puts", putsCmd, (void*)&aFlags[1]}, {"query", queryCmd, 0}, {"randhex", randhexCmd, 0}, {"redirect", redirectCmd, 0}, {"regexp", regexpCmd, 0}, {"reinitialize", reinitializeCmd, 0}, {"render", renderCmd, 0}, {"repository", repositoryCmd, 0}, {"searchable", searchableCmd, 0}, {"setParameter", setParameterCmd, 0}, {"setting", settingCmd, 0}, {"styleFooter", styleFooterCmd, 0}, {"styleHeader", styleHeaderCmd, 0}, {"styleScript", styleScriptCmd, 0}, {"tclReady", tclReadyCmd, 0}, {"trace", traceCmd, 0}, {"stime", stimeCmd, 0}, {"unversioned", unversionedCmd, 0}, {"utime", utimeCmd, 0}, {"verifyCsrf", verifyCsrfCmd, 0}, {"verifyLogin", verifyLoginCmd, 0}, {"wiki", wikiCmd, (void*)&aFlags[0]}, {0, 0, 0} }; if( g.thTrace ){ Th_Trace("th1-init 0x%x => 0x%x<br />\n", g.th1Flags, flags); } if( needConfig ){ |
︙ | ︙ | |||
2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 | Th_Trace("th1-setup {%h} => %h<br />\n", g.th1Setup, Th_ReturnCodeName(rc, 0)); } } g.th1Flags &= ~TH_INIT_MASK; g.th1Flags |= (flags & TH_INIT_MASK); } /* ** Store a string value in a variable in the interpreter. */ void Th_Store(const char *zName, const char *zValue){ Th_FossilInit(TH_INIT_DEFAULT); if( zValue ){ | > > > > > > > > > > > > > > | 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 | Th_Trace("th1-setup {%h} => %h<br />\n", g.th1Setup, Th_ReturnCodeName(rc, 0)); } } g.th1Flags &= ~TH_INIT_MASK; g.th1Flags |= (flags & TH_INIT_MASK); } /* ** Store a string value in a variable in the interpreter if the variable ** does not already exist. */ void Th_MaybeStore(const char *zName, const char *zValue){ Th_FossilInit(TH_INIT_DEFAULT); if( zValue && !Th_ExistsVar(g.interp, zName, -1) ){ if( g.thTrace ){ Th_Trace("maybe_set %h {%h}<br />\n", zName, zValue); } Th_SetVar(g.interp, zName, -1, zValue, strlen(zValue)); } } /* ** Store a string value in a variable in the interpreter. */ void Th_Store(const char *zName, const char *zValue){ Th_FossilInit(TH_INIT_DEFAULT); if( zValue ){ |
︙ | ︙ |
Changes to src/th_tcl.c.
︙ | ︙ | |||
96 97 98 99 100 101 102 | # define _WIN32_WINNT 0x0502 /* SetDllDirectory, Windows XP SP2 */ # endif # include <windows.h> # ifndef TCL_DIRECTORY_SEP # define TCL_DIRECTORY_SEP '\\' # endif # ifndef TCL_LIBRARY_NAME | | | | | | | 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 | # define _WIN32_WINNT 0x0502 /* SetDllDirectory, Windows XP SP2 */ # endif # include <windows.h> # ifndef TCL_DIRECTORY_SEP # define TCL_DIRECTORY_SEP '\\' # endif # ifndef TCL_LIBRARY_NAME # define TCL_LIBRARY_NAME "tcl87.dll\0" # endif # ifndef TCL_MINOR_OFFSET # define TCL_MINOR_OFFSET (4) # endif # ifndef dlopen # define dlopen(a,b) (void *)LoadLibrary((a)) # endif # ifndef dlsym # define dlsym(a,b) GetProcAddress((HANDLE)(a),(b)) # endif # ifndef dlclose # define dlclose(a) FreeLibrary((HANDLE)(a)) # endif # else # include <dlfcn.h> # ifndef TCL_DIRECTORY_SEP # define TCL_DIRECTORY_SEP '/' # endif # if defined(__CYGWIN__) # ifndef TCL_LIBRARY_NAME # define TCL_LIBRARY_NAME "libtcl8.7.dll\0" # endif # ifndef TCL_MINOR_OFFSET # define TCL_MINOR_OFFSET (8) # endif # elif defined(__APPLE__) # ifndef TCL_LIBRARY_NAME # define TCL_LIBRARY_NAME "libtcl8.7.dylib\0" # endif # ifndef TCL_MINOR_OFFSET # define TCL_MINOR_OFFSET (8) # endif # elif defined(__FreeBSD__) # ifndef TCL_LIBRARY_NAME # define TCL_LIBRARY_NAME "libtcl87.so\0" # endif # ifndef TCL_MINOR_OFFSET # define TCL_MINOR_OFFSET (7) # endif # else # ifndef TCL_LIBRARY_NAME # define TCL_LIBRARY_NAME "libtcl8.7.so\0" # endif # ifndef TCL_MINOR_OFFSET # define TCL_MINOR_OFFSET (8) # endif # endif /* defined(__CYGWIN__) */ # endif /* defined(_WIN32) */ # ifndef TCL_FINDEXECUTABLE_NAME |
︙ | ︙ | |||
970 971 972 973 974 975 976 | *pxDeleteInterp = xDeleteInterp; *pxFinalize = xFinalize; return TH_OK; } } while( --aFileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ aFileName[TCL_MINOR_OFFSET] = 'x'; Th_ErrorMessage(interp, | | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | *pxDeleteInterp = xDeleteInterp; *pxFinalize = xFinalize; return TH_OK; } } while( --aFileName[TCL_MINOR_OFFSET]>'3' ); /* Tcl 8.4+ */ aFileName[TCL_MINOR_OFFSET] = 'x'; Th_ErrorMessage(interp, "could not load any supported Tcl 8.x shared library \"", aFileName, -1); return TH_ERROR; #else *phLibrary = 0; *pxFindExecutable = Tcl_FindExecutable; *pxCreateInterp = Tcl_CreateInterp; *pxDeleteInterp = Tcl_DeleteInterp; |
︙ | ︙ | |||
1008 1009 1010 1011 1012 1013 1014 | Tcl_IncrRefCount(objPtr); resultObjPtr = Tcl_SetVar2Ex(pInterp, "argv0", NULL, objPtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG); Tcl_DecrRefCount(objPtr); objPtr = 0; if( !resultObjPtr ){ return TCL_ERROR; } | | | 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | Tcl_IncrRefCount(objPtr); resultObjPtr = Tcl_SetVar2Ex(pInterp, "argv0", NULL, objPtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG); Tcl_DecrRefCount(objPtr); objPtr = 0; if( !resultObjPtr ){ return TCL_ERROR; } objPtr = Tcl_NewWideIntObj(argc - 1); Tcl_IncrRefCount(objPtr); resultObjPtr = Tcl_SetVar2Ex(pInterp, "argc", NULL, objPtr, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG); Tcl_DecrRefCount(objPtr); objPtr = 0; if( !resultObjPtr ){ return TCL_ERROR; } |
︙ | ︙ | |||
1162 1163 1164 1165 1166 1167 1168 | Tcl_DeleteInterp(tclInterp); /* TODO: Redundant? */ tclInterp = 0; return TH_ERROR; } tclContext->interp = tclInterp; if( Tcl_Init(tclInterp)!=TCL_OK ){ Th_ErrorMessage(interp, | | | | | | 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 | Tcl_DeleteInterp(tclInterp); /* TODO: Redundant? */ tclInterp = 0; return TH_ERROR; } tclContext->interp = tclInterp; if( Tcl_Init(tclInterp)!=TCL_OK ){ Th_ErrorMessage(interp, "Tcl initialization error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1); Tcl_DeleteInterp(tclInterp); tclContext->interp = tclInterp = 0; return TH_ERROR; } if( setTclArguments(tclInterp, argc, argv)!=TCL_OK ){ Th_ErrorMessage(interp, "Tcl error setting arguments:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1); Tcl_DeleteInterp(tclInterp); tclContext->interp = tclInterp = 0; return TH_ERROR; } /* ** Determine (and cache) if an objProc can be called directly for a Tcl ** command invoked via the tclInvoke TH1 command. */ tclContext->useObjProc = canUseObjProc(); /* ** Determine (and cache) whether or not we can use TIP #285 (asynchronous ** script cancellation). */ tclContext->useTip285 = canUseTip285(); /* Add the TH1 integration commands to Tcl. */ Tcl_CallWhenDeleted(tclInterp, Th1DeleteProc, interp); Tcl_CreateObjCommand(tclInterp, "th1Eval", Th1EvalObjCmd, interp, NULL); Tcl_CreateObjCommand(tclInterp, "th1Expr", Th1ExprObjCmd, interp, NULL); /* If necessary, evaluate the custom Tcl setup script. */ setup = tclContext->setup; if( setup && Tcl_EvalEx(tclInterp, setup, -1, 0)!=TCL_OK ){ Th_ErrorMessage(interp, "Tcl setup script error:", Tcl_GetString(Tcl_GetObjResult(tclInterp)), -1); Tcl_DeleteInterp(tclInterp); tclContext->interp = tclInterp = 0; return TH_ERROR; } return TH_OK; } |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
76 77 78 79 80 81 82 | ** is centered on that date+time. */ void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ if( zU==0 || zU[0]==0 ) zU = "anonymous"; if( zSuf==0 ) zSuf = ""; if( g.perm.Hyperlink ){ if( zD && zD[0] ){ | | | | | | | | | | | | | | | | | | | | | | | > > > > | 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 | ** is centered on that date+time. */ void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ if( zU==0 || zU[0]==0 ) zU = "anonymous"; if( zSuf==0 ) zSuf = ""; if( g.perm.Hyperlink ){ if( zD && zD[0] ){ @ %z(href("%R/timeline?c=%T&u=%T&y=a",zD,zU))%h(zU)</a>%s(zSuf) }else{ @ %z(href("%R/timeline?u=%T&y=a",zU))%h(zU)</a>%s(zSuf) } }else{ @ %s(zU) } } /* ** Allowed flags for the tmFlags argument to www_print_timeline */ #if INTERFACE #define TIMELINE_ARTID 0x0000001 /* Show artifact IDs on non-check-in lines*/ #define TIMELINE_LEAFONLY 0x0000002 /* Show "Leaf" but not "Merge", "Fork" etc*/ #define TIMELINE_BRIEF 0x0000004 /* Combine adjacent elements of same obj */ #define TIMELINE_GRAPH 0x0000008 /* Compute a graph */ #define TIMELINE_DISJOINT 0x0000010 /* Elements are not contiguous */ #define TIMELINE_FCHANGES 0x0000020 /* Detail file changes */ #define TIMELINE_BRCOLOR 0x0000040 /* Background color by branch name */ #define TIMELINE_UCOLOR 0x0000080 /* Background color by user */ #define TIMELINE_FRENAMES 0x0000100 /* Detail only file name changes */ #define TIMELINE_UNHIDE 0x0000200 /* Unhide check-ins with "hidden" tag */ #define TIMELINE_SHOWRID 0x0000400 /* Show RID values in addition to UUIDs */ #define TIMELINE_BISECT 0x0000800 /* Show supplimental bisect information */ #define TIMELINE_COMPACT 0x0001000 /* Use the "compact" view style */ #define TIMELINE_VERBOSE 0x0002000 /* Use the "detailed" view style */ #define TIMELINE_MODERN 0x0004000 /* Use the "modern" view style */ #define TIMELINE_COLUMNAR 0x0008000 /* Use the "columns" view style */ #define TIMELINE_CLASSIC 0x0010000 /* Use the "classic" view style */ #define TIMELINE_VIEWS 0x001f000 /* Mask for all of the view styles */ #define TIMELINE_NOSCROLL 0x0100000 /* Don't scroll to the selection */ #define TIMELINE_FILEDIFF 0x0200000 /* Show File differences, not ckin diffs */ #define TIMELINE_CHPICK 0x0400000 /* Show cherrypick merges */ #define TIMELINE_FILLGAPS 0x0800000 /* Dotted lines for missing nodes */ #define TIMELINE_XMERGE 0x1000000 /* Omit merges from off-graph nodes */ #define TIMELINE_NOTKT 0x2000000 /* Omit extra ticket classes */ #endif /* ** Hash a string and use the hash to determine a background color. */ char *hash_color(const char *z){ int i; /* Loop counter */ |
︙ | ︙ | |||
233 234 235 236 237 238 239 | ** 6. background color ** 7. type ("ci", "w", "t", "e", "g", "div") ** 8. list of symbolic tags. ** 9. tagid for ticket or wiki or event ** 10. Short comment to user for repeated tickets and wiki */ void www_print_timeline( | | | | | > | > | > > > | 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 | ** 6. background color ** 7. type ("ci", "w", "t", "e", "g", "div") ** 8. list of symbolic tags. ** 9. tagid for ticket or wiki or event ** 10. Short comment to user for repeated tickets and wiki */ void www_print_timeline( Stmt *pQuery, /* Query to implement the timeline */ int tmFlags, /* Flags controlling display behavior */ const char *zThisUser, /* Suppress links to this user */ const char *zThisTag, /* Suppress links to this tag */ const char *zLeftBranch, /* Strive to put this branch on the left margin */ int selectedRid, /* Highlight the line with this RID value or zero */ int secondRid, /* Secondary highlight (or zero) */ void (*xExtra)(int) /* Routine to call on each line of display */ ){ int mxWikiLen; Blob comment; int prevTagid = 0; int suppressCnt = 0; char zPrevDate[20]; GraphContext *pGraph = 0; int prevWasDivider = 0; /* True if previous output row was <hr> */ int fchngQueryInit = 0; /* True if fchngQuery is initialized */ Stmt fchngQuery; /* Query for file changes on check-ins */ static Stmt qbranch; int pendingEndTr = 0; /* True if a </td></tr> is needed */ int vid = 0; /* Current checkout version */ int dateFormat = 0; /* 0: HH:MM (default) */ int bCommentGitStyle = 0; /* Only show comments through first blank line */ const char *zStyle; /* Sub-name for classes for the style */ const char *zDateFmt; int iTableId = timeline_tableid(); int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info ** page rather than the /timeline page */ if( cgi_is_loopback(g.zIpAddr) && db_open_local(0) ){ vid = db_lget_int("checkout", 0); } zPrevDate[0] = 0; mxWikiLen = db_get_int("timeline-max-comment", 0); dateFormat = db_get_int("timeline-date-format", 0); bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0); bTimestampLinksToInfo = db_get_boolean("timeline-tslink-info", 0); if( (tmFlags & TIMELINE_VIEWS)==0 ){ tmFlags |= timeline_ss_cookie(); } if( tmFlags & TIMELINE_COLUMNAR ){ zStyle = "Columnar"; }else if( tmFlags & TIMELINE_COMPACT ){ zStyle = "Compact"; |
︙ | ︙ | |||
288 289 290 291 292 293 294 | if( tmFlags & TIMELINE_GRAPH ){ pGraph = graph_init(); } db_static_prepare(&qbranch, "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", TAG_BRANCH ); | > > > > | | > > | 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 | if( tmFlags & TIMELINE_GRAPH ){ pGraph = graph_init(); } db_static_prepare(&qbranch, "SELECT value FROM tagxref WHERE tagid=%d AND tagtype>0 AND rid=:rid", TAG_BRANCH ); if( (tmFlags & TIMELINE_CHPICK)!=0 && !db_table_exists("repository","cherrypick") ){ tmFlags &= ~TIMELINE_CHPICK; } @ <table id="timelineTable%d(iTableId)" class="timelineTable"> \ @ <!-- tmFlags: 0x%x(tmFlags) --> blob_zero(&comment); while( db_step(pQuery)==SQLITE_ROW ){ int rid = db_column_int(pQuery, 0); const char *zUuid = db_column_text(pQuery, 1); int isLeaf = db_column_int(pQuery, 5); const char *zBgClr = db_column_text(pQuery, 6); const char *zDate = db_column_text(pQuery, 2); const char *zType = db_column_text(pQuery, 7); const char *zUser = db_column_text(pQuery, 4); const char *zTagList = db_column_text(pQuery, 8); int tagid = db_column_int(pQuery, 9); const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; const char *zBr = 0; /* Branch */ int commentColumn = 3; /* Column containing comment text */ int modPending; /* Pending moderation */ char *zDateLink; /* URL for the link on the timestamp */ int drawDetailEllipsis; /* True to show ellipsis in place of detail */ int gidx = 0; /* Graph row identifier */ int isSelectedOrCurrent = 0; /* True if current row is selected */ const char *zExtraClass = ""; char zTime[20]; if( zDate==0 ){ zDate = "YYYY-MM-DD HH:MM:SS"; /* Something wrong with the repo */ } modPending = moderation_pending(rid); if( tagid ){ |
︙ | ︙ | |||
381 382 383 384 385 386 387 388 389 390 391 392 393 394 | }else{ zTime[0] = 0; } pendingEndTr = 1; if( rid==selectedRid ){ @ <tr class="timelineSelected"> isSelectedOrCurrent = 1; }else if( rid==vid ){ @ <tr class="timelineCurrent"> isSelectedOrCurrent = 1; }else { @ <tr> } if( zType[0]=='e' && tagid ){ | > > > > > > > > > > > > > > > > > | | | | | > > > > | > > > | 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 | }else{ zTime[0] = 0; } pendingEndTr = 1; if( rid==selectedRid ){ @ <tr class="timelineSelected"> isSelectedOrCurrent = 1; }else if( rid==secondRid ){ @ <tr class="timelineSelected timelineSecondary"> isSelectedOrCurrent = 1; }else if( rid==vid ){ @ <tr class="timelineCurrent"> isSelectedOrCurrent = 1; }else { @ <tr> } if( zType[0]=='t' && tagid && (tmFlags & TIMELINE_NOTKT)==0 ){ char *zTktid = db_text(0, "SELECT substr(tagname,5) FROM tag" " WHERE tagid=%d", tagid); if( zTktid ){ int isClosed = 0; if( is_ticket(zTktid, &isClosed) && isClosed ){ zExtraClass = " tktTlClosed"; }else{ zExtraClass = " tktTlOpen"; } fossil_free(zTktid); } } if( zType[0]=='e' && tagid ){ if( bTimestampLinksToInfo ){ char *zId; zId = db_text(0, "SELECT substr(tagname, 7) FROM tag WHERE tagid=%d", tagid); zDateLink = href("%R/technote/%s",zId); free(zId); }else{ zDateLink = href("%R/timeline?c=%t",zDate); } }else if( zUuid ){ if( bTimestampLinksToInfo ){ zDateLink = chref("timelineHistLink", "%R/info/%!S", zUuid); }else{ zDateLink = chref("timelineHistLink", "%R/timeline?c=%!S", zUuid); } }else{ zDateLink = mprintf("<a>"); } @ <td class="timelineTime">%z(zDateLink)%s(zTime)</a></td> @ <td class="timelineGraph"> if( tmFlags & TIMELINE_UCOLOR ) zBgClr = zUser ? hash_color(zUser) : 0; if( zType[0]=='c' |
︙ | ︙ | |||
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | }else{ zBgClr = hash_color(zBr); } } } if( zType[0]=='c' && pGraph ){ int nParent = 0; int aParent[GR_MAX_RAIL]; static Stmt qparent; db_static_prepare(&qparent, "SELECT pid FROM plink" " WHERE cid=:rid AND pid NOT IN phantom" " ORDER BY isprim DESC /*sort*/" ); db_bind_int(&qparent, ":rid", rid); while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){ aParent[nParent++] = db_column_int(&qparent, 0); } db_reset(&qparent); | > > > > > > > > > > > > > > | | | | | | 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 | }else{ zBgClr = hash_color(zBr); } } } if( zType[0]=='c' && pGraph ){ int nParent = 0; int nCherrypick = 0; int aParent[GR_MAX_RAIL]; static Stmt qparent; db_static_prepare(&qparent, "SELECT pid FROM plink" " WHERE cid=:rid AND pid NOT IN phantom" " ORDER BY isprim DESC /*sort*/" ); db_bind_int(&qparent, ":rid", rid); while( db_step(&qparent)==SQLITE_ROW && nParent<count(aParent) ){ aParent[nParent++] = db_column_int(&qparent, 0); } db_reset(&qparent); if( (tmFlags & TIMELINE_CHPICK)!=0 && nParent>0 ){ static Stmt qcherrypick; db_static_prepare(&qcherrypick, "SELECT parentid FROM cherrypick" " WHERE childid=:rid AND parentid NOT IN phantom" ); db_bind_int(&qcherrypick, ":rid", rid); while( db_step(&qcherrypick)==SQLITE_ROW && nParent<count(aParent) ){ aParent[nParent++] = db_column_int(&qcherrypick, 0); nCherrypick++; } db_reset(&qcherrypick); } gidx = graph_add_row(pGraph, rid, nParent, nCherrypick, aParent, zBr, zBgClr, zUuid, isLeaf); db_reset(&qbranch); @ <div id="m%d(gidx)" class="tl-nodemark"></div> }else if( zType[0]=='e' && pGraph && zBgClr && zBgClr[0] ){ /* For technotes, make a graph node with nParent==(-1). This will ** not actually draw anything on the graph, but it will set the ** background color of the timeline entry */ gidx = graph_add_row(pGraph, rid, -1, 0, 0, zBr, zBgClr, zUuid, 0); @ <div id="m%d(gidx)" class="tl-nodemark"></div> } @</td> if( !isSelectedOrCurrent ){ @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)" id='mc%d(gidx)'> }else{ @ <td class="timeline%s(zStyle)Cell%s(zExtraClass)"> } if( pGraph && zType[0]!='c' ){ @ • } if( modPending ){ @ <span class="modpending">(Awaiting Moderator Approval)</span> } |
︙ | ︙ | |||
503 504 505 506 507 508 509 | @ (%d(rid)) } } } if( zType[0]!='c' ){ /* Comments for anything other than a check-in are generated by ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */ | > > | > > > > | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | @ (%d(rid)) } } } if( zType[0]!='c' ){ /* Comments for anything other than a check-in are generated by ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */ if( zType[0]=='w' ){ wiki_hyperlink_override(zUuid); wiki_convert(&comment, 0, WIKI_INLINE); wiki_hyperlink_override(0); }else{ wiki_convert(&comment, 0, WIKI_INLINE); } }else{ if( bCommentGitStyle ){ /* Truncate comment at first blank line */ int ii, jj; int n = blob_size(&comment); char *z = blob_str(&comment); for(ii=0; ii<n; ii++){ |
︙ | ︙ | |||
542 543 544 545 546 547 548 | */ if( drawDetailEllipsis ){ @ <span class='timelineEllipsis' id='ellipsis-%d(rid)' \ @ data-id='%d(rid)'>...</span> } if( tmFlags & TIMELINE_COLUMNAR ){ if( !isSelectedOrCurrent ){ | | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | */ if( drawDetailEllipsis ){ @ <span class='timelineEllipsis' id='ellipsis-%d(rid)' \ @ data-id='%d(rid)'>...</span> } if( tmFlags & TIMELINE_COLUMNAR ){ if( !isSelectedOrCurrent ){ @ <td class="timelineDetailCell%s(zExtraClass)" id='md%d(gidx)'> }else{ @ <td class="timelineDetailCell%s(zExtraClass)"> } } if( tmFlags & TIMELINE_COMPACT ){ cgi_printf("<span class='clutter' id='detail-%d'>",rid); } cgi_printf("<span class='timeline%sDetail'>", zStyle); if( (tmFlags & (TIMELINE_CLASSIC|TIMELINE_VERBOSE|TIMELINE_COMPACT))!=0 ){ |
︙ | ︙ | |||
573 574 575 576 577 578 579 | cgi_printf("check-in: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); }else if( zType[0]=='e' && tagid ){ cgi_printf("technote: "); hyperlink_to_event_tagid(tagid<0?-tagid:tagid); }else{ cgi_printf("artifact: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); } | | > | | | 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 | cgi_printf("check-in: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); }else if( zType[0]=='e' && tagid ){ cgi_printf("technote: "); hyperlink_to_event_tagid(tagid<0?-tagid:tagid); }else{ cgi_printf("artifact: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); } }else if( zType[0]=='g' || zType[0]=='w' || zType[0]=='t' || zType[0]=='n' || zType[0]=='f'){ cgi_printf("artifact: %z%S</a> ",href("%R/info/%!S",zUuid),zUuid); } if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){ char *zLink = mprintf("%R/timeline?u=%h&c=%t&y=a", zDispUser, zDate); cgi_printf("user: %z%h</a>", href("%z",zLink), zDispUser); }else{ cgi_printf("user: %h", zDispUser); } /* Generate the "tags: TAGLIST" at the end of the comment, together ** with hyperlinks to the tag list. */ if( zTagList && zTagList[0]==0 ) zTagList = 0; if( zTagList ){ if( g.perm.Hyperlink ){ int i; const char *z = zTagList; Blob links; blob_zero(&links); while( z && z[0] ){ for(i=0; z[i] && (z[i]!=',' || z[i+1]!=' '); i++){} if( zThisTag==0 || memcmp(z, zThisTag, i)!=0 || zThisTag[i]!=0 ){ blob_appendf(&links, "%z%#h</a>%.2s", href("%R/timeline?r=%#t&c=%t",i,z,zDate), i,z, &z[i] ); }else{ blob_appendf(&links, "%#h", i+2, z); } if( z[i]==0 ) break; z += i+2; } |
︙ | ︙ | |||
733 734 735 736 737 738 739 | @ event%s(suppressCnt>1?"s":"") omitted.</span> suppressCnt = 0; } if( pendingEndTr ){ @ </td></tr> } if( pGraph ){ | | | > | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | @ event%s(suppressCnt>1?"s":"") omitted.</span> suppressCnt = 0; } if( pendingEndTr ){ @ </td></tr> } if( pGraph ){ graph_finish(pGraph, zLeftBranch, tmFlags); if( pGraph->nErr ){ graph_free(pGraph); pGraph = 0; }else{ @ <tr class="timelineBottom" id="btm-%d(iTableId)">\ @ <td></td><td></td><td></td></tr> } } @ </table> if( fchngQueryInit ) db_finalize(&fchngQuery); timeline_output_graph_javascript(pGraph, tmFlags, iTableId); } |
︙ | ︙ | |||
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 | int showArrowheads; /* True to draw arrowheads. False to omit. */ int circleNodes; /* True for circle nodes. False for square nodes */ int colorGraph; /* Use colors for graph lines */ int iTopRow; /* Index of the top row of the graph */ int fileDiff; /* True for file diff. False for check-in diff */ int omitDescenders; /* True to omit descenders */ int scrollToSelect; /* True to scroll to the selection */ iRailPitch = atoi(PD("railpitch","0")); showArrowheads = skin_detail_boolean("timeline-arrowheads"); circleNodes = skin_detail_boolean("timeline-circle-nodes"); colorGraph = skin_detail_boolean("timeline-color-graph-lines"); iTopRow = pGraph->pFirst ? pGraph->pFirst->idx : 0; omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0; fileDiff = (tmFlags & TIMELINE_FILEDIFF)!=0; scrollToSelect = (tmFlags & TIMELINE_NOSCROLL)==0; @ <script id='timeline-data-%d(iTableId)' type='application/json'>{ @ "iTableId": %d(iTableId), @ "circleNodes": %d(circleNodes), @ "showArrowheads": %d(showArrowheads), @ "iRailPitch": %d(iRailPitch), @ "colorGraph": %d(colorGraph), @ "nomo": %d(PB("nomo")), @ "iTopRow": %d(iTopRow), @ "omitDescenders": %d(omitDescenders), @ "fileDiff": %d(fileDiff), @ "scrollToSelect": %d(scrollToSelect), @ "nrail": %d(pGraph->mxRail+1), @ "baseUrl": "%R", if( pGraph->nRow==0 ){ @ "rowinfo": null }else{ @ "rowinfo": [ } /* the rowinfo[] array contains all the information needed to generate ** the graph. Each entry contains information for a single row: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node ** is iTopRow and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. | > > > > > > > > > | > | | | | > | > > > | > > > > > | > > | > > > > > | > | > > | > | > > > > > > > | > > | | < | > > > > > | | | > > > > > > | | > > > > > > > > | | | | > > > > > | > | > | 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 | int showArrowheads; /* True to draw arrowheads. False to omit. */ int circleNodes; /* True for circle nodes. False for square nodes */ int colorGraph; /* Use colors for graph lines */ int iTopRow; /* Index of the top row of the graph */ int fileDiff; /* True for file diff. False for check-in diff */ int omitDescenders; /* True to omit descenders */ int scrollToSelect; /* True to scroll to the selection */ int dwellTimeout; /* Milliseconds to wait for tooltips to show */ int closeTimeout; /* Milliseconds to wait for tooltips to close */ u8 *aiMap; /* The rail map */ iRailPitch = atoi(PD("railpitch","0")); showArrowheads = skin_detail_boolean("timeline-arrowheads"); circleNodes = skin_detail_boolean("timeline-circle-nodes"); colorGraph = skin_detail_boolean("timeline-color-graph-lines"); iTopRow = pGraph->pFirst ? pGraph->pFirst->idx : 0; omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0; fileDiff = (tmFlags & TIMELINE_FILEDIFF)!=0; scrollToSelect = (tmFlags & TIMELINE_NOSCROLL)==0; dwellTimeout = atoi(db_get("timeline-dwelltime","100")); closeTimeout = atoi(db_get("timeline-closetime","250")); @ <script id='timeline-data-%d(iTableId)' type='application/json'>{ @ "iTableId": %d(iTableId), @ "circleNodes": %d(circleNodes), @ "showArrowheads": %d(showArrowheads), @ "iRailPitch": %d(iRailPitch), @ "colorGraph": %d(colorGraph), @ "nomo": %d(PB("nomo")), @ "iTopRow": %d(iTopRow), @ "omitDescenders": %d(omitDescenders), @ "fileDiff": %d(fileDiff), @ "scrollToSelect": %d(scrollToSelect), @ "nrail": %d(pGraph->mxRail+1), @ "baseUrl": "%R", @ "dwellTimeout": %d(dwellTimeout), @ "closeTimeout": %d(closeTimeout), @ "hashDigits": %d(hash_digits(1)), @ "bottomRowId": "btm-%d(iTableId)", if( pGraph->nRow==0 ){ @ "rowinfo": null }else{ @ "rowinfo": [ } /* the rowinfo[] array contains all the information needed to generate ** the graph. Each entry contains information for a single row: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node ** is iTopRow and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. ** d: If exists and true then there is a "descender" - an arrow ** coming from the bottom of the page or further down on the page ** straight up to this node. ** mo: "merge-out". If it exists, this is the rail position ** for the upward portion of a merge arrow. The merge arrow goes as ** a solid normal merge line up to the row identified by "mu" and ** then as a dashed cherrypick merge line up further to "cu". ** If this value is omitted if there are no merge children. ** mu: The id of the row which is the top of the merge-out arrow. ** Only exists if "mo" exists. ** cu: Extend the mu merge arrow up to this row as a cherrypick ** merge line, if this value exists. ** u: Draw a thick child-line out of the top of this node and up to ** the node with an id equal to this value. 0 if it is straight to ** the top of the page or just up a little wasy, -1 if there is ** no thick-line riser (if the node is a leaf). ** sb: Draw a dotted child-line out of the top of this node up to the ** node with the id equal to the value. This is like "u" except ** that the line is dotted instead of solid and has no arrow. ** Mnemonic: "Same Branch". ** f: 0x01: a leaf node. ** au: An array of integers that define thick-line risers for branches. ** The integers are in pairs. For each pair, the first integer is ** is the rail on which the riser should run and the second integer ** is the id of the node upto which the riser should run. If there ** are no risers, this array does not exist. ** mi: "merge-in". An array of integer rail positions from which ** merge arrows should be drawn into this node. If the value is ** negative, then the rail position is the absolute value of mi[] ** and a thin merge-arrow descender is drawn to the bottom of ** the screen. This array is omitted if there are no inbound ** merges. ** ci: "cherrypick-in". Like "mi" except for cherrypick merges. ** omitted if there are no cherrypick merges. ** h: The artifact hash of the object being graphed * br: The branch to which the artifact belongs */ aiMap = pGraph->aiRailMap; for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){ int k = 0; cgi_printf("{\"id\":%d,", pRow->idx); cgi_printf("\"bg\":\"%s\",", pRow->zBgClr); cgi_printf("\"r\":%d,", aiMap[pRow->iRail]); if( pRow->bDescender ){ cgi_printf("\"d\":%d,", pRow->bDescender); } if( pRow->mergeOut>=0 ){ cgi_printf("\"mo\":%d,", aiMap[pRow->mergeOut]); if( pRow->mergeUpto==0 ) pRow->mergeUpto = pRow->idx; cgi_printf("\"mu\":%d,", pRow->mergeUpto); if( pRow->cherrypickUpto>0 && pRow->cherrypickUpto<pRow->mergeUpto ){ cgi_printf("\"cu\":%d,", pRow->cherrypickUpto); } } if( pRow->isStepParent ){ cgi_printf("\"sb\":%d,", pRow->aiRiser[pRow->iRail]); }else{ cgi_printf("\"u\":%d,", pRow->aiRiser[pRow->iRail]); } k = 0; if( pRow->isLeaf ) k |= 1; cgi_printf("\"f\":%d,",k); for(i=k=0; i<GR_MAX_RAIL; i++){ if( i==pRow->iRail ) continue; if( pRow->aiRiser[i]>0 ){ if( k==0 ){ cgi_printf("\"au\":"); cSep = '['; } k++; cgi_printf("%c%d,%d", cSep, aiMap[i], pRow->aiRiser[i]); cSep = ','; } } if( k ){ cgi_printf("],"); } if( colorGraph && pRow->zBgClr[0]=='#' ){ cgi_printf("\"fg\":\"%s\",", bg_to_fg(pRow->zBgClr)); } /* mi */ for(i=k=0; i<GR_MAX_RAIL; i++){ if( pRow->mergeIn[i]==1 ){ int mi = aiMap[i]; if( (pRow->mergeDown >> i) & 1 ) mi = -mi; if( k==0 ){ cgi_printf("\"mi\":"); cSep = '['; } k++; cgi_printf("%c%d", cSep, mi); cSep = ','; } } if( k ) cgi_printf("],"); /* ci */ for(i=k=0; i<GR_MAX_RAIL; i++){ if( pRow->mergeIn[i]==2 ){ int mi = aiMap[i]; if( (pRow->cherrypickDown >> i) & 1 ) mi = -mi; if( k==0 ){ cgi_printf("\"ci\":"); cSep = '['; } k++; cgi_printf("%c%d", cSep, mi); cSep = ','; } } if( k ) cgi_printf("],"); cgi_printf("\"br\":\"%j\",", pRow->zBranch ? pRow->zBranch : ""); cgi_printf("\"h\":\"%!S\"}%s", pRow->zUuid, pRow->pNext ? ",\n" : "]\n"); } @ }</script> style_graph_generator(); style_copybutton_control(); /* Dependency: graph.js requires copybtn.js. */ graph_free(pGraph); } } /* ** Create a temporary table suitable for storing timeline data. */ |
︙ | ︙ | |||
959 960 961 962 963 964 965 | return zBase; } /* ** Convert a symbolic name used as an argument to the a=, b=, or c= ** query parameters of timeline into a julianday mtime value. */ | | > > > > > > > > | 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 | return zBase; } /* ** Convert a symbolic name used as an argument to the a=, b=, or c= ** query parameters of timeline into a julianday mtime value. */ double symbolic_name_to_mtime(const char *z, const char **pzDisplay){ double mtime; int rid; const char *zDate; if( z==0 ) return -1.0; if( fossil_isdate(z) ){ mtime = db_double(0.0, "SELECT julianday(%Q,fromLocal())", z); if( mtime>0.0 ) return mtime; } zDate = fossil_expand_datetime(z, 1); if( zDate!=0 && (mtime = db_double(0.0, "SELECT julianday(%Q,fromLocal())", zDate))>0.0 ){ if( pzDisplay ) *pzDisplay = fossil_strdup(zDate); return mtime; } rid = symbolic_name_to_rid(z, "*"); if( rid ){ mtime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); }else{ mtime = db_double(-1.0, "SELECT max(event.mtime) FROM event, tag, tagxref" |
︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | /* ** Add the select/option box to the timeline submenu that is used to ** set the y= parameter that determines which elements to display ** on the timeline. */ static void timeline_y_submenu(int isDisabled){ static int i = 0; | | > > | 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 | /* ** Add the select/option box to the timeline submenu that is used to ** set the y= parameter that determines which elements to display ** on the timeline. */ static void timeline_y_submenu(int isDisabled){ static int i = 0; static const char *az[16]; if( i==0 ){ az[0] = "all"; az[1] = "Any Type"; i = 2; if( g.perm.Read ){ az[i++] = "ci"; az[i++] = "Check-ins"; az[i++] = "g"; az[i++] = "Tags"; } if( g.perm.RdWiki ){ az[i++] = "e"; az[i++] = "Tech Notes"; } if( g.perm.RdTkt ){ az[i++] = "t"; az[i++] = "Tickets"; az[i++] = "n"; az[i++] = "New Tickets"; } if( g.perm.RdWiki ){ az[i++] = "w"; az[i++] = "Wiki"; } if( g.perm.RdForum ){ az[i++] = "f"; |
︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 | int tmFlags; switch( cookie_value("ss","m")[0] ){ case 'c': tmFlags = TIMELINE_COMPACT; break; case 'v': tmFlags = TIMELINE_VERBOSE; break; case 'j': tmFlags = TIMELINE_COLUMNAR; break; case 'x': tmFlags = TIMELINE_CLASSIC; break; default: tmFlags = TIMELINE_MODERN; break; | | | | 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 | int tmFlags; switch( cookie_value("ss","m")[0] ){ case 'c': tmFlags = TIMELINE_COMPACT; break; case 'v': tmFlags = TIMELINE_VERBOSE; break; case 'j': tmFlags = TIMELINE_COLUMNAR; break; case 'x': tmFlags = TIMELINE_CLASSIC; break; default: tmFlags = TIMELINE_MODERN; break; } return tmFlags; } /* ** Add the select/option box to the timeline submenu that is used to ** set the ss= parameter that determines the viewing mode. ** ** Return the TIMELINE_* value appropriate for the view-style. */ int timeline_ss_submenu(void){ static const char *const azViewStyles[] = { "m", "Modern View", "j", "Columnar View", "c", "Compact View", "v", "Verbose View", "x", "Classic View", }; cookie_link_parameter("ss","ss","m"); |
︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | blob_append(&expr, zEnd, -1); return blob_str(&expr); } /* If execution reaches this point, the pattern was empty. Return NULL. */ return 0; } /* ** WEBPAGE: timeline ** ** Query parameters: ** ** a=TIMEORTAG After this event ** b=TIMEORTAG Before this event ** c=TIMEORTAG "Circa" this event ** m=TIMEORTAG Mark this event ** n=COUNT Maximum number of events. "all" for no limit ** p=CHECKIN Parents and ancestors of CHECKIN ** d=CHECKIN Children and descendants of CHECKIN ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN ** t=TAG Show only check-ins with the given TAG ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel ** rel Show related check-ins as well as those matching t=TAG ** mionly Limit rel to show ancestors but not descendants ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP ** u=USER Only show items associated with USER | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > > | 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 | blob_append(&expr, zEnd, -1); return blob_str(&expr); } /* If execution reaches this point, the pattern was empty. Return NULL. */ return 0; } /* ** Similar to fossil_expand_datetime() ** ** Add missing "-" characters into a date/time. Examples: ** ** 20190419 => 2019-04-19 ** 201904 => 2019-04 */ const char *timeline_expand_datetime(const char *zIn){ static char zEDate[20]; static const char aPunct[] = { 0, 0, '-', '-', ' ', ':', ':' }; int n = (int)strlen(zIn); int i, j; /* Only three forms allowed: ** (1) YYYYMMDD ** (2) YYYYMM ** (3) YYYYWW */ if( n!=8 && n!=6 ) return zIn; /* Every character must be a digit */ for(i=0; fossil_isdigit(zIn[i]); i++){} if( i!=n ) return zIn; /* Expand the date */ for(i=j=0; zIn[i]; i++){ if( i>=4 && (i%2)==0 ){ zEDate[j++] = aPunct[i/2]; } zEDate[j++] = zIn[i]; } zEDate[j] = 0; /* It looks like this may be a date. Return it with punctuation added. */ return zEDate; } /* ** WEBPAGE: timeline ** ** Query parameters: ** ** a=TIMEORTAG After this event ** b=TIMEORTAG Before this event ** c=TIMEORTAG "Circa" this event ** cf=FILEHASH "Circa" the first use of the file with FILEHASH ** m=TIMEORTAG Mark this event ** n=COUNT Maximum number of events. "all" for no limit ** p=CHECKIN Parents and ancestors of CHECKIN ** d=CHECKIN Children and descendants of CHECKIN ** dp=CHECKIN The same as d=CHECKIN&p=CHECKIN ** t=TAG Show only check-ins with the given TAG ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel ** rel Show related check-ins as well as those matching t=TAG ** mionly Limit rel to show ancestors but not descendants ** nowiki Do not show wiki associated with branch or tag ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP ** u=USER Only show items associated with USER ** y=TYPE 'ci', 'w', 't', 'n', 'e', 'f', or 'all'. ** ss=VIEWSTYLE c: "Compact" v: "Verbose" m: "Modern" j: "Columnar" ** advm Use the "Advanced" or "Busy" menu design. ** ng No Graph. ** ncp Omit cherrypick merges ** nd Do not highlight the focus check-in ** v Show details of files changed ** f=CHECKIN Show family (immediate parents and children) of CHECKIN ** from=CHECKIN Path from... ** to=CHECKIN ... to this ** shortest ... show only the shortest path ** rel ... also show related checkins ** uf=FILE_HASH Show only check-ins that contain the given file version ** chng=GLOBLIST Show only check-ins that involve changes to a file whose ** name matches one of the comma-separate GLOBLIST ** brbg Background color from branch name ** ubg Background color from user ** namechng Show only check-ins that have filename changes ** forks Show only forks and their children ** cherrypicks Show all cherrypicks ** ym=YYYY-MM Show only events for the given year/month ** yw=YYYY-WW Show only events for the given week of the given year ** yw=YYYY-MM-DD Show events for the week that includes the given day ** ymd=YYYY-MM-DD Show only events on the given day ** days=N Show events over the previous N days ** datefmt=N Override the date format ** bisect Show the check-ins that are in the current bisect |
︙ | ︙ | |||
1429 1430 1431 1432 1433 1434 1435 | const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */ const char *zNDays = P("days"); /* Show events over the previous N days */ int nDays = 0; /* Numeric value for zNDays */ const char *zChng = P("chng"); /* List of GLOBs for files that changed */ int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */ int forkOnly = PB("forks"); /* Show only forks and their children */ | | > > | > > > > | > > > > > > | > > > > > > > > > > > > | > > | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 | const char *zDay = P("ymd"); /* Check-ins for the day YYYY-MM-DD */ const char *zNDays = P("days"); /* Show events over the previous N days */ int nDays = 0; /* Numeric value for zNDays */ const char *zChng = P("chng"); /* List of GLOBs for files that changed */ int useDividers = P("nd")==0; /* Show dividers if "nd" is missing */ int renameOnly = P("namechng")!=0; /* Show only check-ins that rename files */ int forkOnly = PB("forks"); /* Show only forks and their children */ int bisectLocal = PB("bisect"); /* Show the check-ins of the bisect */ const char *zBisect = P("bid"); /* Bisect description */ int cpOnly = PB("cherrypicks"); /* Show all cherrypick checkins */ int tmFlags = 0; /* Timeline flags */ const char *zThisTag = 0; /* Suppress links to this tag */ const char *zThisUser = 0; /* Suppress links to this user */ HQuery url; /* URL for various branch links */ int from_rid = name_to_typed_rid(P("from"),"ci"); /* from= for paths */ int to_rid = name_to_typed_rid(P("to"),"ci"); /* to= for path timelines */ int noMerge = P("shortest")==0; /* Follow merge links if shorter */ int me_rid = name_to_typed_rid(P("me"),"ci"); /* me= for common ancestory */ int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */ int pd_rid; double rBefore, rAfter, rCirca; /* Boundary times */ const char *z; char *zOlderButton = 0; /* URL for Older button at the bottom */ char *zNewerButton = 0; /* URL for Newer button at the top */ int selectedRid = 0; /* Show a highlight on this RID */ int secondaryRid = 0; /* Show secondary highlight */ int disableY = 0; /* Disable type selector on submenu */ int advancedMenu = 0; /* Use the advanced menu design */ char *zPlural; /* Ending for plural forms */ int showCherrypicks = 1; /* True to show cherrypick merges */ /* Set number of rows to display */ cookie_read_parameter("n","n"); z = P("n"); if( z==0 ) z = db_get("timeline-default-length",0); if( z ){ if( fossil_strcmp(z,"all")==0 ){ nEntry = 0; }else{ nEntry = atoi(z); if( nEntry<=0 ){ z = "10"; nEntry = 10; } } }else{ z = "50"; nEntry = 50; } secondaryRid = name_to_typed_rid(P("sel2"),"ci"); selectedRid = name_to_typed_rid(P("sel1"),"ci"); cgi_replace_query_parameter("n",z); cookie_write_parameter("n","n",0); tmFlags |= timeline_ss_submenu(); cookie_link_parameter("advm","advm","0"); advancedMenu = atoi(PD("advm","0")); /* Omit all cherry-pick merge lines if the "ncp" query parameter is ** present or if this repository lacks a "cherrypick" table. */ if( PB("ncp") || !db_table_exists("repository","cherrypick") ){ showCherrypicks = 0; } /* To view the timeline, must have permission to read project data. */ pd_rid = name_to_typed_rid(P("dp"),"ci"); if( pd_rid ){ p_rid = d_rid = pd_rid; } login_check_credentials(); if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum) || (bisectLocal && !g.perm.Setup) ){ login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki); return; } cookie_read_parameter("y","y"); zType = P("y"); if( zType==0 ){ zType = g.perm.Read ? "ci" : "all"; cgi_set_parameter("y", zType); } if( zType[0]=='a' || zType[0]=='c' ){ cookie_write_parameter("y","y",zType); } cookie_render(); url_initialize(&url, "timeline"); cgi_query_parameters_to_url(&url); /* Convert the cf=FILEHASH query parameter into a c=CHECKINHASH value */ if( P("cf")!=0 ){ zCirca = db_text(0, "SELECT (SELECT uuid FROM blob WHERE rid=mlink.mid)" " FROM mlink, event" " WHERE mlink.fid=(SELECT rid FROM blob WHERE uuid LIKE '%q%%')" " AND event.objid=mlink.mid" " ORDER BY event.mtime LIMIT 1", P("cf") ); } /* Convert r=TAG to t=TAG&rel in order to populate the UI style widgets. */ if( zBrName && !related ){ cgi_delete_query_parameter("r"); cgi_set_query_parameter("t", zBrName); cgi_set_query_parameter("rel", "1"); zTagName = zBrName; related = 1; zType = "ci"; } /* Ignore empty tag query strings. */ if( zTagName && !*zTagName ){ zTagName = 0; } /* Finish preliminary processing of tag match queries. */ if( zTagName ){ zType = "ci"; /* Interpet the tag style string. */ if( fossil_stricmp(zMatchStyle, "glob")==0 ){ matchStyle = MS_GLOB; }else if( fossil_stricmp(zMatchStyle, "like")==0 ){ matchStyle = MS_LIKE; }else if( fossil_stricmp(zMatchStyle, "regexp")==0 ){ matchStyle = MS_REGEXP; |
︙ | ︙ | |||
1548 1549 1550 1551 1552 1553 1554 | if( (zTagSql && db_int(0,"SELECT count(*) " "FROM tagxref NATURAL JOIN tag WHERE %s",zTagSql/*safe-for-%s*/)<=nEntry) ){ nEntry = -1; zCirca = 0; } if( zType[0]=='a' ){ | | | > > > > | | > > > | 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | if( (zTagSql && db_int(0,"SELECT count(*) " "FROM tagxref NATURAL JOIN tag WHERE %s",zTagSql/*safe-for-%s*/)<=nEntry) ){ nEntry = -1; zCirca = 0; } if( zType[0]=='a' ){ tmFlags |= TIMELINE_BRIEF | TIMELINE_GRAPH | TIMELINE_CHPICK; }else{ tmFlags |= TIMELINE_GRAPH | TIMELINE_CHPICK; } if( related ){ tmFlags |= TIMELINE_FILLGAPS | TIMELINE_XMERGE; tmFlags &= ~TIMELINE_DISJOINT; } if( PB("ncp") ){ tmFlags &= ~TIMELINE_CHPICK; } if( PB("ng") || zSearch!=0 ){ tmFlags &= ~(TIMELINE_GRAPH|TIMELINE_CHPICK); } if( PB("brbg") ){ tmFlags |= TIMELINE_BRCOLOR; } if( PB("unhide") ){ tmFlags |= TIMELINE_UNHIDE; } |
︙ | ︙ | |||
1604 1605 1606 1607 1608 1609 1610 | " AND pid IN rnfork;", TAG_BRANCH, TAG_BRANCH, TAG_BRANCH, TAG_BRANCH ); tmFlags |= TIMELINE_UNHIDE; zType = "ci"; disableY = 1; } | | > | | > > > > > > > > | | 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 | " AND pid IN rnfork;", TAG_BRANCH, TAG_BRANCH, TAG_BRANCH, TAG_BRANCH ); tmFlags |= TIMELINE_UNHIDE; zType = "ci"; disableY = 1; } if( bisectLocal && fossil_strcmp(g.zIpAddr,"127.0.0.1")==0 && db_open_local(0) ){ int iCurrent = db_lget_int("checkout",0); char *zPerm = bisect_permalink(); bisect_create_bilog_table(iCurrent, 0); tmFlags |= TIMELINE_UNHIDE | TIMELINE_BISECT | TIMELINE_FILLGAPS; zType = "ci"; disableY = 1; style_submenu_element("Permalink", "%R/timeline?bid=%z", zPerm); }else{ bisectLocal = 0; } if( zBisect!=0 && bisect_create_bilog_table(0, zBisect) ){ tmFlags |= TIMELINE_UNHIDE | TIMELINE_BISECT | TIMELINE_FILLGAPS; zType = "ci"; disableY = 1; }else{ zBisect = 0; } style_header("Timeline"); if( advancedMenu ){ style_submenu_element("Help", "%R/help?cmd=/timeline"); } login_anonymous_available(); |
︙ | ︙ | |||
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 | } if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){ /* If from= and to= are present, display all nodes on a path connecting ** the two */ PathNode *p = 0; const char *zFrom = 0; const char *zTo = 0; if( from_rid && to_rid ){ p = path_shortest(from_rid, to_rid, noMerge, 0); zFrom = P("from"); zTo = P("to"); }else{ if( path_common_ancestor(me_rid, you_rid) ){ p = path_first(); } zFrom = P("me"); zTo = P("you"); } | > > > > > > > > | > > | | | > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < > > > > > > > | | | | 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | } if( ((from_rid && to_rid) || (me_rid && you_rid)) && g.perm.Read ){ /* If from= and to= are present, display all nodes on a path connecting ** the two */ PathNode *p = 0; const char *zFrom = 0; const char *zTo = 0; Blob ins; int nNodeOnPath = 0; if( from_rid && to_rid ){ p = path_shortest(from_rid, to_rid, noMerge, 0); zFrom = P("from"); zTo = P("to"); }else{ if( path_common_ancestor(me_rid, you_rid) ){ p = path_first(); } zFrom = P("me"); zTo = P("you"); } blob_init(&ins, 0, 0); db_multi_exec( "CREATE TABLE IF NOT EXISTS temp.pathnode(x INTEGER PRIMARY KEY);" ); if( p ){ blob_init(&ins, 0, 0); blob_append_sql(&ins, "INSERT INTO pathnode(x) VALUES(%d)", p->rid); p = p->u.pTo; nNodeOnPath = 1; while( p ){ blob_append_sql(&ins, ",(%d)", p->rid); p = p->u.pTo; nNodeOnPath++; } } path_reset(); db_multi_exec("%s", blob_str(&ins)/*safe-for-%s*/); blob_reset(&ins); if( related ){ db_multi_exec( "CREATE TABLE IF NOT EXISTS temp.related(x INTEGER PRIMARY KEY);" "INSERT OR IGNORE INTO related(x)" " SELECT pid FROM plink WHERE cid IN pathnode AND NOT isprim;" ); if( P("mionly")==0 ){ db_multi_exec( "INSERT OR IGNORE INTO related(x)" " SELECT cid FROM plink WHERE pid IN pathnode;" ); } if( showCherrypicks ){ db_multi_exec( "INSERT OR IGNORE INTO related(x)" " SELECT parentid FROM cherrypick WHERE childid IN pathnode;" ); if( P("mionly")==0 ){ db_multi_exec( "INSERT OR IGNORE INTO related(x)" " SELECT childid FROM cherrypick WHERE parentid IN pathnode;" ); } } db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related"); } blob_append_sql(&sql, " AND event.objid IN pathnode"); addFileGlobExclusion(zChng, &sql); tmFlags |= TIMELINE_DISJOINT; tmFlags &= ~TIMELINE_CHPICK; db_multi_exec("%s", blob_sql_text(&sql)); if( advancedMenu ){ style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0); } blob_appendf(&desc, "%d check-ins going from ", nNodeOnPath); blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h", zFrom), zFrom); blob_append(&desc, " to ", -1); blob_appendf(&desc, "%z[%h]</a>", href("%R/info/%h",zTo), zTo); if( related ){ int nRelated = db_int(0, "SELECT count(*) FROM timeline") - nNodeOnPath; if( nRelated>0 ){ blob_appendf(&desc, " and %d related check-in%s", nRelated, nRelated>1 ? "s" : ""); } } addFileGlobDescription(zChng, &desc); }else if( (p_rid || d_rid) && g.perm.Read && zTagSql==0 ){ /* If p= or d= is present, ignore all other parameters other than n= */ char *zUuid; int np, nd; tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; if( p_rid && d_rid ){ if( p_rid!=d_rid ) p_rid = d_rid; if( P("n")==0 ) nEntry = 10; } db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)" ); zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", p_rid ? p_rid : d_rid); blob_append_sql(&sql, " AND event.objid IN ok"); nd = 0; if( d_rid ){ compute_descendants(d_rid, nEntry==0 ? 0 : nEntry+1); nd = db_int(0, "SELECT count(*)-1 FROM ok"); if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql)); if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s"); if( useDividers ) selectedRid = d_rid; db_multi_exec("DELETE FROM ok"); } if( p_rid ){ compute_ancestors(p_rid, nEntry==0 ? 0 : nEntry+1, 0); np = db_int(0, "SELECT count(*)-1 FROM ok"); if( np>0 ){ if( nd>0 ) blob_appendf(&desc, " and "); blob_appendf(&desc, "%d ancestors", np); db_multi_exec("%s", blob_sql_text(&sql)); } if( useDividers ) selectedRid = p_rid; |
︙ | ︙ | |||
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 | db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);" "INSERT INTO ok VALUES(%d);" "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;" "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;", f_rid, f_rid, f_rid ); blob_append_sql(&sql, " AND event.objid IN ok"); db_multi_exec("%s", blob_sql_text(&sql)); if( useDividers ) selectedRid = f_rid; blob_appendf(&desc, "Parents and children of check-in "); zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid); blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid); | > > > > > > > > > | > | > > > > > > > > | > | > > | | > | > > | | | | > > > > > > > | | < < < < < < > | | < | < | > | | < > > > > > > > > > > > > > > > | | > | | | | | | | < < > | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 | db_multi_exec( "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY);" "INSERT INTO ok VALUES(%d);" "INSERT OR IGNORE INTO ok SELECT pid FROM plink WHERE cid=%d;" "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;", f_rid, f_rid, f_rid ); if( showCherrypicks ){ db_multi_exec( "INSERT OR IGNORE INTO ok SELECT parentid FROM cherrypick" " WHERE childid=%d;" "INSERT OR IGNORE INTO ok SELECT childid FROM cherrypick" " WHERE parentid=%d;", f_rid, f_rid ); } blob_append_sql(&sql, " AND event.objid IN ok"); db_multi_exec("%s", blob_sql_text(&sql)); if( useDividers ) selectedRid = f_rid; blob_appendf(&desc, "Parents and children of check-in "); zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid); blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%!S", zUuid), zUuid); tmFlags |= TIMELINE_XMERGE; if( advancedMenu ){ style_submenu_checkbox("unhide", "Unhide", 0, 0); style_submenu_checkbox("v", "Files", (zType[0]!='a' && zType[0]!='c'),0); } }else{ /* Otherwise, a timeline based on a span of time */ int n; const char *zEType = "event"; char *zDate; Blob cond; blob_zero(&cond); tmFlags |= TIMELINE_FILLGAPS; if( zChng && *zChng ){ addFileGlobExclusion(zChng, &cond); tmFlags |= TIMELINE_XMERGE; } if( zUses ){ blob_append_sql(&cond, " AND event.objid IN usesfile "); } if( renameOnly ){ blob_append_sql(&cond, " AND event.objid IN rnfile "); } if( forkOnly ){ blob_append_sql(&cond, " AND event.objid IN rnfork "); } if( cpOnly && showCherrypicks ){ db_multi_exec( "CREATE TABLE IF NOT EXISTS cpnodes(rid INTEGER PRIMARY KEY);" "INSERT OR IGNORE INTO cpnodes SELECT childid FROM cherrypick;" "INSERT OR IGNORE INTO cpnodes SELECT parentid FROM cherrypick;" ); blob_append_sql(&cond, " AND event.objid IN cpnodes "); } if( bisectLocal || zBisect!=0 ){ blob_append_sql(&cond, " AND event.objid IN (SELECT rid FROM bilog) "); } if( zYearMonth ){ zYearMonth = timeline_expand_datetime(zYearMonth); blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%m',event.mtime) ", zYearMonth); } else if( zYearWeek ){ char *z; zYearWeek = timeline_expand_datetime(zYearWeek); z = db_text(0, "SELECT strftime('%%Y-%%W',%Q)", zYearWeek); if( z && z[0] ){ zYearWeekStart = db_text(0, "SELECT date(%Q,'-6 days','weekday 1')", zYearWeek); zYearWeek = z; }else{ if( strlen(zYearWeek)==7 ){ zYearWeekStart = db_text(0, "SELECT date('%.4q-01-01','+%d days','weekday 1')", zYearWeek, atoi(zYearWeek+5)*7); }else{ zYearWeekStart = 0; } if( zYearWeekStart==0 || zYearWeekStart[0]==0 ){ zYearWeekStart = db_text(0, "SELECT date('now','-6 days','weekday 1');"); zYearWeek = db_text(0, "SELECT strftime('%%Y-%%W','now','-6 days','weekday 1')"); } } blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%W',event.mtime) ", zYearWeek); nEntry = -1; } else if( zDay ){ zDay = timeline_expand_datetime(zDay); zDay = db_text(0, "SELECT date(%Q)", zDay); if( zDay==0 || zDay[0]==0 ){ zDay = db_text(0, "SELECT date('now')"); } blob_append_sql(&cond, " AND %Q=date(event.mtime) ", zDay); nEntry = -1; } else if( zNDays ){ nDays = atoi(zNDays); if( nDays<1 ) nDays = 1; blob_append_sql(&cond, " AND event.mtime>=julianday('now','-%d days') ", nDays); nEntry = -1; } if( zTagSql ){ db_multi_exec( "CREATE TEMP TABLE selected_nodes(rid INTEGER PRIMARY KEY);" "INSERT OR IGNORE INTO selected_nodes" " SELECT tagxref.rid FROM tagxref NATURAL JOIN tag" " WHERE %s AND tagtype>0", zTagSql/*safe-for-%s*/ ); if( !related ){ blob_append_sql(&cond, " AND blob.rid IN selected_nodes"); }else{ db_multi_exec( "CREATE TEMP TABLE related_nodes(rid INTEGER PRIMARY KEY);" "INSERT INTO related_nodes SELECT rid FROM selected_nodes;" ); blob_append_sql(&cond, " AND blob.rid IN related_nodes"); /* The next two blob_appendf() calls add SQL that causes check-ins that ** are not part of the branch which are parents or children of the ** branch to be included in the report. These related check-ins are ** useful in helping to visualize what has happened on a quiescent ** branch that is infrequently merged with a much more activate branch. */ db_multi_exec( "INSERT OR IGNORE INTO related_nodes" " SELECT pid FROM selected_nodes CROSS JOIN plink" " WHERE selected_nodes.rid=plink.cid;" ); if( P("mionly")==0 ){ db_multi_exec( "INSERT OR IGNORE INTO related_nodes" " SELECT cid FROM selected_nodes CROSS JOIN plink" " WHERE selected_nodes.rid=plink.pid;" ); if( showCherrypicks ){ db_multi_exec( "INSERT OR IGNORE INTO related_nodes" " SELECT childid FROM selected_nodes CROSS JOIN cherrypick" " WHERE selected_nodes.rid=cherrypick.parentid;" ); } } if( showCherrypicks ){ db_multi_exec( "INSERT OR IGNORE INTO related_nodes" " SELECT parentid FROM selected_nodes CROSS JOIN cherrypick" " WHERE selected_nodes.rid=cherrypick.childid;" ); } if( (tmFlags & TIMELINE_UNHIDE)==0 ){ db_multi_exec( "DELETE FROM related_nodes WHERE rid IN " " (SELECT related_nodes.rid FROM related_nodes, tagxref" " WHERE tagid=%d AND tagtype>0 AND tagxref.rid=related_nodes.rid)", TAG_HIDDEN ); } } } if( (zType[0]=='w' && !g.perm.RdWiki) || (zType[0]=='t' && !g.perm.RdTkt) || (zType[0]=='n' && !g.perm.RdTkt) || (zType[0]=='e' && !g.perm.RdWiki) || (zType[0]=='c' && !g.perm.Read) || (zType[0]=='g' && !g.perm.Read) || (zType[0]=='f' && !g.perm.RdForum) ){ zType = "all"; } |
︙ | ︙ | |||
1884 1885 1886 1887 1888 1889 1890 | if( g.perm.RdForum ){ blob_append_sql(&cond, "%c'f'", cSep); cSep = ','; } blob_append_sql(&cond, ")"); } }else{ /* zType!="all" */ | > > > > | > > > | 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 | if( g.perm.RdForum ){ blob_append_sql(&cond, "%c'f'", cSep); cSep = ','; } blob_append_sql(&cond, ")"); } }else{ /* zType!="all" */ if( zType[0]=='n' ){ blob_append_sql(&cond, " AND event.type='t' AND event.comment GLOB 'New ticket*'"); }else{ blob_append_sql(&cond, " AND event.type=%Q", zType); } if( zType[0]=='c' ){ zEType = "check-in"; }else if( zType[0]=='w' ){ zEType = "wiki"; }else if( zType[0]=='t' ){ zEType = "ticket change"; }else if( zType[0]=='n' ){ zEType = "new tickets"; }else if( zType[0]=='e' ){ zEType = "technical note"; }else if( zType[0]=='g' ){ zEType = "tag"; }else if( zType[0]=='f' ){ zEType = "forum post"; } |
︙ | ︙ | |||
1915 1916 1917 1918 1919 1920 1921 | zThisUser = zUser; } if( zSearch ){ blob_append_sql(&cond, " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')", zSearch, zSearch); } | | | | | 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 | zThisUser = zUser; } if( zSearch ){ blob_append_sql(&cond, " AND (event.comment LIKE '%%%q%%' OR event.brief LIKE '%%%q%%')", zSearch, zSearch); } rBefore = symbolic_name_to_mtime(zBefore, &zBefore); rAfter = symbolic_name_to_mtime(zAfter, &zAfter); rCirca = symbolic_name_to_mtime(zCirca, &zCirca); blob_append_sql(&sql, "%s", blob_sql_text(&cond)); if( rAfter>0.0 ){ if( rBefore>0.0 ){ blob_append_sql(&sql, " AND event.mtime>=%.17g AND event.mtime<=%.17g" " ORDER BY event.mtime ASC", rAfter-ONE_SECOND, rBefore+ONE_SECOND); nEntry = -1; |
︙ | ︙ | |||
1968 1969 1970 1971 1972 1973 1974 | db_multi_exec("%s", blob_sql_text(&sql)); n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/"); zPlural = n==1 ? "" : "s"; if( zYearMonth ){ blob_appendf(&desc, "%d %s%s for %h", n, zEType, zPlural, zYearMonth); }else if( zYearWeek ){ | | | | | | > > > > | | | 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | db_multi_exec("%s", blob_sql_text(&sql)); n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/"); zPlural = n==1 ? "" : "s"; if( zYearMonth ){ blob_appendf(&desc, "%d %s%s for %h", n, zEType, zPlural, zYearMonth); }else if( zYearWeek ){ blob_appendf(&desc, "%d %s%s for week %h beginning on %h", n, zEType, zPlural, zYearWeek, zYearWeekStart); }else if( zDay ){ blob_appendf(&desc, "%d %s%s occurring on %h", n, zEType, zPlural, zDay); }else if( zNDays ){ blob_appendf(&desc, "%d %s%s within the past %d day%s", n, zEType, zPlural, nDays, nDays>1 ? "s" : ""); }else if( zBefore==0 && zCirca==0 && n>=nEntry && nEntry>0 ){ blob_appendf(&desc, "%d most recent %s%s", n, zEType, zPlural); }else{ blob_appendf(&desc, "%d %s%s", n, zEType, zPlural); } if( zUses ){ char *zFilenames = names_of_file(zUses); blob_appendf(&desc, " using file %s version %z%S</a>", zFilenames, href("%R/artifact/%!S",zUses), zUses); tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; } if( renameOnly ){ blob_appendf(&desc, " that contain filename changes"); tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; } if( forkOnly ){ blob_appendf(&desc, " associated with forks"); tmFlags |= TIMELINE_DISJOINT; } if( bisectLocal || zBisect!=0 ){ blob_appendf(&desc, " in a bisect"); tmFlags |= TIMELINE_DISJOINT; } if( cpOnly && showCherrypicks ){ blob_appendf(&desc, " that participate in a cherrypick merge"); tmFlags |= TIMELINE_CHPICK|TIMELINE_DISJOINT; } if( zUser ){ blob_appendf(&desc, " by user %h", zUser); tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; } if( zTagSql ){ if( matchStyle==MS_EXACT ){ if( related ){ blob_appendf(&desc, " related to %h", zMatchDesc); }else{ blob_appendf(&desc, " tagged with %h", zMatchDesc); } }else{ if( related ){ blob_appendf(&desc, " related to tags matching %h", zMatchDesc); }else{ blob_appendf(&desc, " with tags matching %h", zMatchDesc); } } tmFlags |= TIMELINE_XMERGE | TIMELINE_FILLGAPS; } addFileGlobDescription(zChng, &desc); if( rAfter>0.0 ){ if( rBefore>0.0 ){ blob_appendf(&desc, " occurring between %h and %h.<br />", zAfter, zBefore); }else{ |
︙ | ︙ | |||
2044 2045 2046 2047 2048 2049 2050 | }; double rDate; zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){ zDate = mprintf("%s", (zAfter ? zAfter : zBefore)); } if( zDate ){ | | | | 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 | }; double rDate; zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){ zDate = mprintf("%s", (zAfter ? zAfter : zBefore)); } if( zDate ){ rDate = symbolic_name_to_mtime(zDate, 0); if( db_int(0, "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob" " WHERE blob.rid=event.objid AND mtime<=%.17g%s)", rDate-ONE_SECOND, blob_sql_text(&cond)) ){ zOlderButton = fossil_strdup(url_render(&url, "b", zDate, "a", 0)); } free(zDate); } zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){ zDate = mprintf("%s", (zBefore ? zBefore : zAfter)); } if( zDate ){ rDate = symbolic_name_to_mtime(zDate, 0); if( db_int(0, "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob" " WHERE blob.rid=event.objid AND mtime>=%.17g%s)", rDate+ONE_SECOND, blob_sql_text(&cond)) ){ zNewerButton = fossil_strdup(url_render(&url, "a", zDate, "b", 0)); } |
︙ | ︙ | |||
2091 2092 2093 2094 2095 2096 2097 | if( PB("showsql") ){ @ <pre>%h(blob_sql_text(&sql))</pre> } if( search_restrict(SRCH_CKIN)!=0 ){ style_submenu_element("Search", "%R/search?y=c"); } if( advancedMenu ){ | | > | > | > > > > > > | > > > > > > > > > > > > > | > | 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 | if( PB("showsql") ){ @ <pre>%h(blob_sql_text(&sql))</pre> } if( search_restrict(SRCH_CKIN)!=0 ){ style_submenu_element("Search", "%R/search?y=c"); } if( advancedMenu ){ style_submenu_element("Basic", "%s", url_render(&url, "advm", "0", "udc", "1")); }else{ style_submenu_element("Advanced", "%s", url_render(&url, "advm", "1", "udc", "1")); } if( PB("showid") ) tmFlags |= TIMELINE_SHOWRID; if( useDividers && zMark && zMark[0] ){ double r = symbolic_name_to_mtime(zMark, 0); if( r>0.0 ) selectedRid = timeline_add_divider(r); } blob_zero(&sql); db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/"); if( fossil_islower(desc.aData[0]) ){ desc.aData[0] = fossil_toupper(desc.aData[0]); } if( zBrName ){ if( !PB("nowiki") && wiki_render_associated("branch", zBrName, WIKIASSOC_ALL) ){ @ <div class="section">%b(&desc)</div> } else{ @ <h2>%b(&desc)</h2> } style_submenu_element("Diff", "%R/vdiff?branch=%T", zBrName); }else if( zTagName && matchStyle==MS_EXACT && zBrName==0 && !PB("nowiki") && wiki_render_associated("tag", zTagName, WIKIASSOC_ALL) ){ @ <div class="section">%b(&desc)</div> } else{ @ <h2>%b(&desc)</h2> } blob_reset(&desc); /* Report any errors. */ if( zError ){ @ <p class="generalError">%h(zError)</p> } if( zNewerButton ){ @ %z(chref("button","%z",zNewerButton))More ↑</a> } www_print_timeline(&q, tmFlags, zThisUser, zThisTag, zBrName, selectedRid, secondaryRid, 0); db_finalize(&q); if( zOlderButton ){ @ %z(chref("button","%z",zOlderButton))More ↓</a> } style_footer(); } |
︙ | ︙ | |||
2215 2216 2217 2218 2219 2220 2221 | } if( content_is_private(rid) ){ sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* "); n += strlen(zPrefix+n); } zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom); /* record another X lines */ | | | 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | } if( content_is_private(rid) ){ sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*UNPUBLISHED* "); n += strlen(zPrefix+n); } zFree = mprintf("[%S] %s%s", zId, zPrefix, zCom); /* record another X lines */ nLine += comment_print(zFree, zCom, 9, width, get_comment_format()); fossil_free(zFree); if(verboseFlag){ if( !fchngQueryInit ){ db_prepare(&fchngQuery, "SELECT (pid<=0) AS isnew," " (fid==0) AS isdel," |
︙ | ︙ | |||
2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 | fossil_print("%s\n", blob_str(&sql)); } db_prepare_blob(&q, &sql); blob_reset(&sql); print_timeline(&q, n, width, verboseFlag); db_finalize(&q); } /* ** COMMAND: test-timewarp-list ** ** Usage: %fossil test-timewarp-list ?-v|---verbose? ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 | fossil_print("%s\n", blob_str(&sql)); } db_prepare_blob(&q, &sql); blob_reset(&sql); print_timeline(&q, n, width, verboseFlag); db_finalize(&q); } /* ** WEBPAGE: thisdayinhistory ** ** Generate a vanity page that shows project activity for the current ** day of the year for various years in the history of the project. ** ** Query parameters: ** ** today=DATE Use DATE as today's date */ void thisdayinhistory_page(void){ static int aYearsAgo[] = { 1, 2, 3, 4, 5, 10, 15, 20, 30, 40, 50, 75, 100 }; const char *zToday; char *zStartOfProject; int i; Stmt q; char *z; login_check_credentials(); if( (!g.perm.Read && !g.perm.RdTkt && !g.perm.RdWiki && !g.perm.RdForum) ){ login_needed(g.anon.Read && g.anon.RdTkt && g.anon.RdWiki); return; } style_header("Today In History"); zToday = (char*)P("today"); if( zToday ){ zToday = timeline_expand_datetime(zToday); if( !fossil_isdate(zToday) ) zToday = 0; } if( zToday==0 ){ zToday = db_text(0, "SELECT date('now',toLocal())"); } @ <h1>This Day In History For %h(zToday)</h1> z = db_text(0, "SELECT date(%Q,'-1 day')", zToday); style_submenu_element("Yesterday", "%R/thisdayinhistory?today=%t", z); z = db_text(0, "SELECT date(%Q,'+1 day')", zToday); style_submenu_element("Tomorrow", "%R/thisdayinhistory?today=%t", z); zStartOfProject = db_text(0, "SELECT datetime(min(mtime),toLocal()) FROM event;" ); timeline_temp_table(); db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/"); for(i=0; i<sizeof(aYearsAgo)/sizeof(aYearsAgo[0]); i++){ int iAgo = aYearsAgo[i]; char *zThis = db_text(0, "SELECT date(%Q,'-%d years')", zToday, iAgo); Blob sql; char *zId; if( strcmp(zThis, zStartOfProject)<0 ) break; blob_init(&sql, 0, 0); blob_append(&sql, "INSERT OR IGNORE INTO timeline ", -1); blob_append(&sql, timeline_query_for_www(), -1); blob_append_sql(&sql, " AND %Q=date(event.mtime,toLocal()) " " AND event.mtime BETWEEN julianday(%Q,'-1 day')" " AND julianday(%Q,'+2 days')", zThis, zThis, zThis ); db_multi_exec("DELETE FROM timeline; %s;", blob_sql_text(&sql)); blob_reset(&sql); if( db_int(0, "SELECT count(*) FROM timeline")==0 ){ continue; } zId = db_text(0, "SELECT timestamp FROM timeline" " ORDER BY sortby DESC LIMIT 1"); @ <h2>%d(iAgo) Year%s(iAgo>1?"s":"") Ago @ <small>%z(href("%R/timeline?c=%t",zId))(more context)</a>\ @ </small></h2> www_print_timeline(&q, TIMELINE_GRAPH, 0, 0, 0, 0, 0, 0); } db_finalize(&q); style_footer(); } /* ** COMMAND: test-timewarp-list ** ** Usage: %fossil test-timewarp-list ?-v|---verbose? ** |
︙ | ︙ |
Changes to src/tkt.c.
︙ | ︙ | |||
362 363 364 365 366 367 368 | return Th_Eval(g.interp, 0, zConfig, -1); } /* ** Recreate the TICKET and TICKETCHNG tables. */ void ticket_create_table(int separateConnection){ | | > | 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 | return Th_Eval(g.interp, 0, zConfig, -1); } /* ** Recreate the TICKET and TICKETCHNG tables. */ void ticket_create_table(int separateConnection){ char *zSql; db_multi_exec( "DROP TABLE IF EXISTS ticket;" "DROP TABLE IF EXISTS ticketchng;" ); zSql = ticket_table_schema(); if( separateConnection ){ if( db_transaction_nesting_depth() ) db_end_transaction(0); db_init_database(g.zRepositoryName, zSql, 0); }else{ db_multi_exec("%s", zSql/*safe-for-%s*/); } fossil_free(zSql); } /* ** Repopulate the TICKET and TICKETCHNG tables from scratch using all ** available ticket artifacts. */ void ticket_rebuild(void){ |
︙ | ︙ | |||
442 443 444 445 446 447 448 | @ mUsed = %d(aField[i].mUsed); } @ </ul></div> } /* ** WEBPAGE: tktview | | > > > > < > > > > > > > > > > > > > | 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 | @ mUsed = %d(aField[i].mUsed); } @ </ul></div> } /* ** WEBPAGE: tktview ** URL: tktview?name=HASH ** ** View a ticket identified by the name= query parameter. ** Other query parameters: ** ** tl Show a timeline of the ticket above the status */ void tktview_page(void){ const char *zScript; char *zFullName; const char *zUuid = PD("name",""); int showTimeline = P("tl")!=0; login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(g.anon.RdTkt); return; } if( g.anon.WrTkt || g.anon.ApndTkt ){ style_submenu_element("Edit", "%s/tktedit?name=%T", g.zTop, PD("name","")); } if( g.perm.Hyperlink ){ style_submenu_element("History", "%s/tkthistory/%T", g.zTop, zUuid); style_submenu_element("Check-ins", "%s/tkttimeline/%T?y=ci", g.zTop, zUuid); } if( g.anon.NewTkt ){ style_submenu_element("New Ticket", "%s/tktnew", g.zTop); } if( g.anon.ApndTkt && g.anon.Attach ){ style_submenu_element("Attach", "%s/attachadd?tkt=%T&from=%s/tktview/%t", g.zTop, zUuid, g.zTop, zUuid); } if( P("plaintext") ){ style_submenu_element("Formatted", "%R/tktview/%s", zUuid); }else{ style_submenu_element("Plaintext", "%R/tktview/%s?plaintext", zUuid); } style_header("View Ticket"); if( showTimeline ){ int tagid = db_int(0,"SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'", zUuid); if( tagid ){ tkt_draw_timeline(tagid, "a"); @ <hr> }else{ showTimeline = 0; } } if( !showTimeline && g.perm.Hyperlink ){ style_submenu_element("Timeline", "%s/info/%T", g.zTop, zUuid); } if( g.thTrace ) Th_Trace("BEGIN_TKTVIEW<br />\n", -1); ticket_init(); initializeVariablesFromCGI(); getAllTicketFields(); initializeVariablesFromDb(); zScript = ticket_viewpage_code(); if( P("showfields")!=0 ) showAllFields(); |
︙ | ︙ | |||
822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | "table containing all required fields"); } } sqlite3_close(db); } return zErr; } /* ** WEBPAGE: tkttimeline ** URL: /tkttimeline?name=TICKETUUID&y=TYPE ** ** Show the change history for a single ticket in timeline format. */ void tkttimeline_page(void){ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < | 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 | "table containing all required fields"); } } sqlite3_close(db); } return zErr; } /* ** Draw a timeline for a ticket with tag.tagid given by the tagid ** parameter. */ void tkt_draw_timeline(int tagid, const char *zType){ Stmt q; char *zFullUuid; char *zSQL; zFullUuid = db_text(0, "SELECT substr(tagname, 5) FROM tag WHERE tagid=%d", tagid); if( zType[0]=='c' ){ zSQL = mprintf( "%s AND event.objid IN " " (SELECT srcid FROM backlink WHERE target GLOB '%.4s*' " "AND '%s' GLOB (target||'*')) " "ORDER BY mtime DESC", timeline_query_for_www(), zFullUuid, zFullUuid ); }else{ zSQL = mprintf( "%s AND event.objid IN " " (SELECT rid FROM tagxref WHERE tagid=%d" " UNION SELECT srcid FROM backlink" " WHERE target GLOB '%.4s*'" " AND '%s' GLOB (target||'*')" " UNION SELECT attachid FROM attachment" " WHERE target=%Q) " "ORDER BY mtime DESC", timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid ); } db_prepare(&q, "%z", zSQL/*safe-for-%s*/); www_print_timeline(&q, TIMELINE_ARTID | TIMELINE_DISJOINT | TIMELINE_GRAPH | TIMELINE_NOTKT, 0, 0, 0, 0, 0, 0); db_finalize(&q); fossil_free(zFullUuid); } /* ** WEBPAGE: tkttimeline ** URL: /tkttimeline?name=TICKETUUID&y=TYPE ** ** Show the change history for a single ticket in timeline format. */ void tkttimeline_page(void){ char *zTitle; const char *zUuid; int tagid; char zGlobPattern[50]; const char *zType; login_check_credentials(); if( !g.perm.Hyperlink || !g.perm.RdTkt ){ login_needed(g.anon.Hyperlink && g.anon.RdTkt); |
︙ | ︙ | |||
869 870 871 872 873 874 875 | canonical16(zGlobPattern, strlen(zGlobPattern)); tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); if( tagid==0 ){ @ No such ticket: %h(zUuid) style_footer(); return; } | < | < < < < < < < < < < < < < < < < < < < < < < < < < | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 | canonical16(zGlobPattern, strlen(zGlobPattern)); tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zUuid); if( tagid==0 ){ @ No such ticket: %h(zUuid) style_footer(); return; } tkt_draw_timeline(tagid, zType); style_footer(); } /* ** WEBPAGE: tkthistory ** URL: /tkthistory?name=TICKETUUID ** |
︙ | ︙ | |||
1295 1296 1297 1298 1299 1300 1301 | z++; }else{ fossil_print(" Change "); } fossil_print("%h: ",z); if( blob_size(&val)>50 || contains_newline(&val)) { fossil_print("\n "); | | | 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | z++; }else{ fossil_print(" Change "); } fossil_print("%h: ",z); if( blob_size(&val)>50 || contains_newline(&val)) { fossil_print("\n "); comment_print(blob_str(&val),0,4,-1,get_comment_format()); }else{ fossil_print("%s\n",blob_str(&val)); } blob_reset(&val); } } manifest_destroy(pTicket); |
︙ | ︙ |
Changes to src/tktsetup.c.
︙ | ︙ | |||
94 95 96 97 98 99 100 | @ mimetype TEXT, @ icomment TEXT @ ); @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); ; /* | | > | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | @ mimetype TEXT, @ icomment TEXT @ ); @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); ; /* ** Return the ticket table definition in heap-allocated ** memory owned by the caller. */ char *ticket_table_schema(void){ return db_get("ticket-table", zDefaultTicketTable); } /* ** Common implementation for the ticket setup editor pages. */ static void tktsetup_generic( |
︙ | ︙ | |||
296 297 298 299 300 301 302 | 0, 30 ); } static const char zDefaultNew[] = @ <th1> | | > > | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | 0, 30 ); } static const char zDefaultNew[] = @ <th1> @ if {![info exists mutype]} {set mutype Markdown} @ if {[info exists submit]} { @ set status Open @ if {$mutype eq "HTML"} { @ set mimetype "text/html" @ } elseif {$mutype eq "Wiki"} { @ set mimetype "text/x-fossil-wiki" @ } elseif {$mutype eq "Markdown"} { @ set mimetype text/x-markdown @ } elseif {$mutype eq {[links only]}} { @ set mimetype "text/x-fossil-plain" @ } else { @ set mimetype "text/plain" @ } @ submit_ticket @ set preview 1 |
︙ | ︙ | |||
359 360 361 362 363 364 365 | @ @ <tr> @ <td colspan="3"> @ Enter a detailed description of the problem. @ For code defects, be sure to provide details on exactly how @ the problem can be reproduced. Provide as much detail as @ possible. Format: | | > > | 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 | @ @ <tr> @ <td colspan="3"> @ Enter a detailed description of the problem. @ For code defects, be sure to provide details on exactly how @ the problem can be reproduced. Provide as much detail as @ possible. Format: @ <th1>combobox mutype {HTML {[links only]} Markdown {Plain Text} Wiki}} 1</th1> @ <br /> @ <th1>set nline [linecount $comment 50 10]</th1> @ <textarea name="icomment" cols="80" rows="$nline" @ wrap="virtual" class="wikiedit">$<icomment></textarea><br /> @ </tr> @ @ <th1>enable_output [info exists preview]</th1> @ <tr><td colspan="3"> @ Description Preview:<br /><hr /> @ <th1> @ if {$mutype eq "Wiki"} { @ wiki $icomment @ } elseif {$mutype eq "Plain Text"} { @ set r [randhex] @ wiki "<verbatim-$r>[string trimright $icomment]\n</verbatim-$r>" @ } elseif {$mutype eq "Markdown"} { @ html [lindex [markdown "$icomment\n"] 1] @ } elseif {$mutype eq {[links only]}} { @ set r [randhex] @ wiki "<verbatim-$r links>[string trimright $icomment]\n</verbatim-$r>" @ } else { @ wiki "<nowiki>$icomment\n</nowiki>" @ } @ </th1> |
︙ | ︙ | |||
444 445 446 447 448 449 450 451 | } static const char zDefaultView[] = @ <table cellpadding="5"> @ <tr><td class="tktDspLabel">Ticket UUID:</td> @ <th1> @ if {[info exists tkt_uuid]} { @ if {[hascap s]} { | > > < | < < > | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | } static const char zDefaultView[] = @ <table cellpadding="5"> @ <tr><td class="tktDspLabel">Ticket UUID:</td> @ <th1> @ if {[info exists tkt_uuid]} { @ html "<td class='tktDspValue' colspan='3'>" @ copybtn hash-tk 0 $tkt_uuid 2 @ if {[hascap s]} { @ html " ($tkt_id)" @ } @ html "</td></tr>\n" @ } else { @ if {[hascap s]} { @ html "<td class='tktDspValue' colspan='3'>Deleted " @ html "(0)</td></tr>\n" @ } else { @ html "<td class='tktDspValue' colspan='3'>Deleted</td></tr>\n" @ } |
︙ | ︙ | |||
539 540 541 542 543 544 545 546 547 548 549 550 551 552 | @ html " added on $xdate:\n" @ if {$alwaysPlaintext || $xmimetype eq "text/plain"} { @ set r [randhex] @ if {$xmimetype ne "text/plain"} {html "([htmlize $xmimetype])\n"} @ wiki "<verbatim-$r>[string trimright $xcomment]</verbatim-$r>\n" @ } elseif {$xmimetype eq "text/x-fossil-wiki"} { @ wiki "<p>\n[string trimright $xcomment]\n</p>\n" @ } elseif {$xmimetype eq "text/html"} { @ wiki "<p><nowiki>\n[string trimright $xcomment]\n</nowiki>\n" @ } else { @ set r [randhex] @ wiki "<verbatim-$r links>[string trimright $xcomment]</verbatim-$r>\n" @ } @ } | > > | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 | @ html " added on $xdate:\n" @ if {$alwaysPlaintext || $xmimetype eq "text/plain"} { @ set r [randhex] @ if {$xmimetype ne "text/plain"} {html "([htmlize $xmimetype])\n"} @ wiki "<verbatim-$r>[string trimright $xcomment]</verbatim-$r>\n" @ } elseif {$xmimetype eq "text/x-fossil-wiki"} { @ wiki "<p>\n[string trimright $xcomment]\n</p>\n" @ } elseif {$xmimetype eq "text/x-markdown"} { @ html [lindex [markdown $xcomment] 1] @ } elseif {$xmimetype eq "text/html"} { @ wiki "<p><nowiki>\n[string trimright $xcomment]\n</nowiki>\n" @ } else { @ set r [randhex] @ wiki "<verbatim-$r links>[string trimright $xcomment]</verbatim-$r>\n" @ } @ } |
︙ | ︙ | |||
581 582 583 584 585 586 587 | 0, 40 ); } static const char zDefaultEdit[] = @ <th1> | | > > | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | 0, 40 ); } static const char zDefaultEdit[] = @ <th1> @ if {![info exists mutype]} {set mutype Markdown} @ if {![info exists icomment]} {set icomment {}} @ if {![info exists username]} {set username $login} @ if {[info exists submit]} { @ if {$mutype eq "Wiki"} { @ set mimetype text/x-fossil-wiki @ } elseif {$mutype eq "Markdown"} { @ set mimetype text/x-markdown @ } elseif {$mutype eq "HTML"} { @ set mimetype text/html @ } elseif {$mutype eq {[links only]}} { @ set mimetype text/x-fossil-plain @ } else { @ set mimetype text/plain @ } |
︙ | ︙ | |||
640 641 642 643 644 645 646 | @ @ <tr><td class="tktDspLabel">Version Found In:</td><td> @ <input type="text" name="foundin" size="50" value="$<foundin>" /> @ </td></tr> @ @ <tr><td colspan="2"> @ Append Remark with format | | > > | 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 | @ @ <tr><td class="tktDspLabel">Version Found In:</td><td> @ <input type="text" name="foundin" size="50" value="$<foundin>" /> @ </td></tr> @ @ <tr><td colspan="2"> @ Append Remark with format @ <th1>combobox mutype {HTML {[links only]} Markdown {Plain Text} Wiki} 1</th1> @ from @ <input type="text" name="username" value="$<username>" size="30" />:<br /> @ <textarea name="icomment" cols="80" rows="15" @ wrap="virtual" class="wikiedit">$<icomment></textarea> @ </td></tr> @ @ <th1>enable_output [info exists preview]</th1> @ <tr><td colspan="2"> @ Description Preview:<br /><hr /> @ <th1> @ if {$mutype eq "Wiki"} { @ wiki $icomment @ } elseif {$mutype eq "Plain Text"} { @ set r [randhex] @ wiki "<verbatim-$r>\n[string trimright $icomment]\n</verbatim-$r>" @ } elseif {$mutype eq "Markdown"} { @ html [lindex [markdown "$icomment\n"] 1] @ } elseif {$mutype eq {[links only]}} { @ set r [randhex] @ wiki "<verbatim-$r links>\n[string trimright $icomment]</verbatim-$r>" @ } else { @ wiki "<nowiki>\n[string trimright $icomment]\n</nowiki>" @ } @ </th1> |
︙ | ︙ | |||
897 898 899 900 901 902 903 | @ <form action="%s(g.zTop)/tktsetup_timeline" method="post"><div> login_insert_csrf_secret(); @ <hr /> entry_attribute("Ticket Title", 40, "ticket-title-expr", "t", "title", 0); @ <p>An SQL expression in a query against the TICKET table that will | | > | > | > | 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 | @ <form action="%s(g.zTop)/tktsetup_timeline" method="post"><div> login_insert_csrf_secret(); @ <hr /> entry_attribute("Ticket Title", 40, "ticket-title-expr", "t", "title", 0); @ <p>An SQL expression in a query against the TICKET table that will @ return the title of the ticket for display purposes. @ (Property: ticket-title-expr)</p> @ <hr /> entry_attribute("Ticket Status", 40, "ticket-status-column", "s", "status", 0); @ <p>The name of the column in the TICKET table that contains the ticket @ status in human-readable form. Case sensitive. @ (Property: ticket-status-column)</p> @ <hr /> entry_attribute("Ticket Closed", 40, "ticket-closed-expr", "c", "status='Closed'", 0); @ <p>An SQL expression that evaluates to true in a TICKET table query if @ the ticket is closed. @ (Property: ticket-closed-expr)</p> @ <hr /> @ <p> @ <input type="submit" name="submit" value="Apply Changes" /> @ <input type="submit" name="setup" value="Cancel" /> @ </p> @ </div></form> db_end_transaction(0); style_footer(); } |
Changes to src/undo.c.
︙ | ︙ | |||
162 163 164 165 166 167 168 | "INSERT OR IGNORE INTO stashfile SELECT * FROM undo_stashfile;" ); } } ncid = db_lget_int("undo_checkout", 0); ucid = db_lget_int("checkout", 0); db_lset_int("undo_checkout", ucid); | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | "INSERT OR IGNORE INTO stashfile SELECT * FROM undo_stashfile;" ); } } ncid = db_lget_int("undo_checkout", 0); ucid = db_lget_int("checkout", 0); db_lset_int("undo_checkout", ucid); db_set_checkout(ncid); } /* ** Reset the undo memory. */ void undo_reset(void){ static const char zSql[] = |
︙ | ︙ | |||
421 422 423 424 425 426 427 | /* ** COMMAND: undo ** COMMAND: redo* ** ** Usage: %fossil undo ?OPTIONS? ?FILENAME...? ** or: %fossil redo ?OPTIONS? ?FILENAME...? ** | | | | | | > > > > > > > | > > > > | 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 | /* ** COMMAND: undo ** COMMAND: redo* ** ** Usage: %fossil undo ?OPTIONS? ?FILENAME...? ** or: %fossil redo ?OPTIONS? ?FILENAME...? ** ** The undo command reverts the changes caused by the previous command ** if the previous command is one of the following: ** ** (1) fossil update (5) fossil stash apply ** (2) fossil merge (6) fossil stash drop ** (3) fossil revert (7) fossil stash goto ** (4) fossil stash pop (8) fossil clean (*see note*) ** ** Note: The "fossil clean" command only saves state for files less than ** 10MiB in size and so if fossil clean deleted files larger than that, ** then "fossil undo" will not recover the larger files. ** ** If FILENAME is specified then restore the content of the named ** file(s) but otherwise leave the update or merge or revert in effect. ** The redo command undoes the effect of the most recent undo. ** ** If the -n|--dry-run option is present, no changes are made and instead ** the undo or redo command explains what actions the undo or redo would ** have done had the -n|--dry-run been omitted. ** ** If the most recent command is not one of those listed as undoable, ** then the undo command might try to restore the state to be what it was ** prior to the last undoable command, or it might be a no-op. If in ** doubt about what the undo command will do, first run it with the -n ** option. ** ** A single level of undo/redo is supported. The undo/redo stack ** is cleared by the commit and checkout commands. Other commands may ** or may not clear the undo stack. ** ** Future versions of Fossil might add new commands to the set of commands ** that are undoable. ** ** Options: ** -n|--dry-run do not make changes but show what would be done ** ** See also: commit, status */ void undo_cmd(void){ |
︙ | ︙ |
Changes to src/unicode.c.
︙ | ︙ | |||
57 58 59 60 61 62 63 | 0x0027E802, 0x0027F402, 0x00280403, 0x0028F001, 0x0028F805, 0x00291C02, 0x00292C03, 0x00294401, 0x0029C002, 0x0029D402, 0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03, 0x002B8802, 0x002BC002, 0x002BE806, 0x002C0403, 0x002CF001, 0x002CF807, 0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802, 0x002DC001, 0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804, 0x002F5C01, 0x002FCC08, 0x00300005, 0x0030F807, 0x00311803, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | > | | | | > | | | | | 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 | 0x0027E802, 0x0027F402, 0x00280403, 0x0028F001, 0x0028F805, 0x00291C02, 0x00292C03, 0x00294401, 0x0029C002, 0x0029D402, 0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03, 0x002B8802, 0x002BC002, 0x002BE806, 0x002C0403, 0x002CF001, 0x002CF807, 0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802, 0x002DC001, 0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804, 0x002F5C01, 0x002FCC08, 0x00300005, 0x0030F807, 0x00311803, 0x00312804, 0x00315402, 0x00318802, 0x0031DC01, 0x0031FC01, 0x00320404, 0x0032F001, 0x0032F807, 0x00331803, 0x00332804, 0x00335402, 0x00338802, 0x00340004, 0x0034EC02, 0x0034F807, 0x00351803, 0x00352804, 0x00353C01, 0x00355C01, 0x00358802, 0x0035E401, 0x00360802, 0x00372801, 0x00373C06, 0x00375801, 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007, 0x0038FC01, 0x00391C09, 0x00396802, 0x003AC401, 0x003AD009, 0x003B2006, 0x003C041F, 0x003CD00C, 0x003DC417, 0x003E340B, 0x003E6424, 0x003EF80F, 0x003F380D, 0x0040AC14, 0x00412806, 0x00415804, 0x00417803, 0x00418803, 0x00419C07, 0x0041C404, 0x0042080C, 0x00423C01, 0x00426806, 0x0043EC01, 0x004D740C, 0x004E400A, 0x00500001, 0x0059B402, 0x005A0001, 0x005A6C02, 0x005BAC03, 0x005C4803, 0x005CC805, 0x005D4802, 0x005DC802, 0x005ED023, 0x005F6004, 0x005F7401, 0x0060000F, 0x00621402, 0x0062A401, 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, 0x00677822, 0x00685C05, 0x00687802, 0x0069540A, 0x0069801D, 0x0069FC01, 0x006A8007, 0x006AA006, 0x006AC00F, 0x006C0005, 0x006CD011, 0x006D6823, 0x006E0003, 0x006E840D, 0x006F980E, 0x006FF004, 0x00709014, 0x0070EC05, 0x0071F802, 0x00730008, 0x00734019, 0x0073B401, 0x0073D001, 0x0073DC03, 0x0077003A, 0x0077EC05, 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, 0x007FB403, 0x007FF402, 0x00800065, 0x0081980A, 0x0081E805, 0x00822805, 0x00828020, 0x00834021, 0x00840002, 0x00840C04, 0x00842002, 0x00845001, 0x00845803, 0x00847806, 0x00849401, 0x00849C01, 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, 0x00852804, 0x00853C01, 0x00862802, 0x00864297, 0x0091000B, 0x0092704E, 0x00940276, 0x009E53E0, 0x00ADD820, 0x00AE6068, 0x00B39406, 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001, 0x00B5FC01, 0x00B7804F, 0x00B8C020, 0x00BA001A, 0x00BA6C59, 0x00BC00D6, 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807, 0x00C0D802, 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01, 0x00C64002, 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E, 0x00C94001, 0x00C98020, 0x00CA2827, 0x00CB0140, 0x01370040, 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10, 0x029A7802, 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402, 0x02A00801, 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804, 0x02A1D004, 0x02A20002, 0x02A2D012, 0x02A33802, 0x02A38012, 0x02A3E003, 0x02A3F001, 0x02A3FC01, 0x02A4980A, 0x02A51C0D, 0x02A57C01, 0x02A60004, 0x02A6CC1B, 0x02A77802, 0x02A79401, 0x02A8A40E, 0x02A90C01, 0x02A93002, 0x02A97004, 0x02A9DC03, 0x02A9EC03, 0x02AAC001, 0x02AAC803, 0x02AADC02, 0x02AAF802, 0x02AB0401, 0x02AB7802, 0x02ABAC07, 0x02ABD402, 0x02AD6C01, 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02, 0x037FFC01, 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802, 0x03F7F002, 0x03F8001A, 0x03F88033, 0x03F95013, 0x03F9A004, 0x03FBFC01, 0x03FC040F, 0x03FC6807, 0x03FCEC06, 0x03FD6C0B, 0x03FF8007, 0x03FFA007, 0x03FFE405, 0x04040003, 0x0404DC09, 0x0405E411, 0x04063003, 0x0406400C, 0x04068001, 0x0407402E, 0x040B8001, 0x040DD805, 0x040E7C01, 0x040F4001, 0x0415BC01, 0x04215C01, 0x0421DC02, 0x04247C01, 0x0424FC01, 0x04280403, 0x04281402, 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009, 0x0429FC01, 0x042B2001, 0x042B9402, 0x042BC007, 0x042CE407, 0x042E6404, 0x04349004, 0x043D180B, 0x043D5405, 0x04400003, 0x0440E016, 0x0441FC04, 0x0442C012, 0x04433401, 0x04440003, 0x04449C0E, 0x04450004, 0x04451402, 0x0445CC03, 0x04460003, 0x0446CC0E, 0x04471409, 0x04476C01, 0x04477403, 0x0448B013, 0x044AA401, 0x044B7C0C, 0x044C0004, 0x044CEC02, 0x044CF807, 0x044D1C02, 0x044D2C03, 0x044D5C01, 0x044D8802, 0x044D9807, 0x044DC005, 0x0450D412, 0x04512C05, 0x04516C01, 0x04517402, 0x0452C014, 0x04531801, 0x0456BC07, 0x0456E020, 0x04577002, 0x0458C014, 0x0459800D, 0x045AAC0D, 0x045C740F, 0x045CF004, 0x0460B010, 0x04674407, 0x04676807, 0x04678801, 0x04679001, 0x0468040A, 0x0468CC07, 0x0468EC0D, 0x0469440B, 0x046A2813, 0x046A7805, 0x0470BC08, 0x0470E008, 0x04710405, 0x0471C002, 0x04724816, 0x0472A40E, 0x0474C406, 0x0474E801, 0x0474F002, 0x0474FC07, 0x04751C01, 0x04762805, 0x04764002, 0x04764C05, 0x047BCC06, 0x047F541D, 0x047FFC01, 0x0491C005, 0x04D0C009, 0x05A9B802, 0x05ABC006, 0x05ACC010, 0x05AD1002, 0x05BA5C04, 0x05BD3C01, 0x05BD4437, 0x05BE3C04, 0x05BF8801, 0x06F27008, 0x074000F6, 0x07440027, 0x0744A4C0, 0x07480046, 0x074C0057, 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401, 0x075CD401, 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401, 0x075F0C01, 0x0760028C, 0x076A6C05, 0x076A840F, 0x07800007, 0x07802011, 0x07806C07, 0x07808C02, 0x07809805, 0x0784C007, 0x07853C01, 0x078BB004, 0x078BFC01, 0x07A34007, 0x07A51007, 0x07A57802, 0x07B2B001, 0x07B2C001, 0x07B4B801, 0x07BBC002, 0x07C0002C, 0x07C0C064, 0x07C2800F, 0x07C2C40F, 0x07C3040F, 0x07C34425, 0x07C4405D, 0x07C5C03D, 0x07C7981D, 0x07C8402C, 0x07C90009, 0x07C94002, 0x07C98006, 0x07CC03D6, 0x07DB800D, 0x07DBC00B, 0x07DC0074, 0x07DE0059, 0x07DF800C, 0x07E0000C, 0x07E04038, 0x07E1400A, 0x07E18028, 0x07E2401E, 0x07E4000C, 0x07E43465, 0x07E5CC04, 0x07E5E829, 0x07E69406, 0x07E6B81D, 0x07E73487, 0x07E9800E, 0x07E9C004, 0x07E9E003, 0x07EA0003, 0x07EA4006, 0x38000401, 0x38008060, 0x380400F0, }; static const unsigned int aAscii[4] = { 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001, }; if( (unsigned int)c<128 ){ return ( (aAscii[c >> 5] & ((unsigned int)1 << (c & 0x001F)))==0 ); |
︙ | ︙ | |||
174 175 176 177 178 179 180 | ** If the argument is a codepoint corresponding to a lowercase letter ** in the ASCII range with a diacritic added, return the codepoint ** of the ASCII letter only. For example, if passed 235 - "LATIN ** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER ** E"). The resuls of passing a codepoint that corresponds to an ** uppercase letter are undefined. */ | | | | | > | | > | | | | > > | < > > > > > > > | > > | < < > | > > | | > > | > > | | | | | 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 | ** If the argument is a codepoint corresponding to a lowercase letter ** in the ASCII range with a diacritic added, return the codepoint ** of the ASCII letter only. For example, if passed 235 - "LATIN ** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER ** E"). The resuls of passing a codepoint that corresponds to an ** uppercase letter are undefined. */ static int unicode_remove_diacritic(int c, int bComplex){ static const unsigned short aDia[] = { 0, 1797, 1848, 1859, 1891, 1928, 1940, 1995, 2024, 2040, 2060, 2110, 2168, 2206, 2264, 2286, 2344, 2383, 2472, 2488, 2516, 2596, 2668, 2732, 2782, 2842, 2894, 2954, 2984, 3000, 3028, 3336, 3456, 3696, 3712, 3728, 3744, 3766, 3832, 3896, 3912, 3928, 3944, 3968, 4008, 4040, 4056, 4106, 4138, 4170, 4202, 4234, 4266, 4296, 4312, 4344, 4408, 4424, 4442, 4472, 4488, 4504, 6148, 6198, 6264, 6280, 6360, 6429, 6505, 6529, 61448, 61468, 61512, 61534, 61592, 61610, 61642, 61672, 61688, 61704, 61726, 61784, 61800, 61816, 61836, 61880, 61896, 61914, 61948, 61998, 62062, 62122, 62154, 62184, 62200, 62218, 62252, 62302, 62364, 62410, 62442, 62478, 62536, 62554, 62584, 62604, 62640, 62648, 62656, 62664, 62730, 62766, 62830, 62890, 62924, 62974, 63032, 63050, 63082, 63118, 63182, 63242, 63274, 63310, 63368, 63390, }; #define HIBIT ((unsigned char)0x80) static const unsigned char aChar[] = { '\0', 'a', 'c', 'e', 'i', 'n', 'o', 'u', 'y', 'y', 'a', 'c', 'd', 'e', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'u', 'w', 'y', 'z', 'o', 'u', 'a', 'i', 'o', 'u', 'u'|HIBIT, 'a'|HIBIT, 'g', 'k', 'o', 'o'|HIBIT, 'j', 'g', 'n', 'a'|HIBIT, 'a', 'e', 'i', 'o', 'r', 'u', 's', 't', 'h', 'a', 'e', 'o'|HIBIT, 'o', 'o'|HIBIT, 'y', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', 'a', 'b', 'c'|HIBIT, 'd', 'd', 'e'|HIBIT, 'e', 'e'|HIBIT, 'f', 'g', 'h', 'h', 'i', 'i'|HIBIT, 'k', 'l', 'l'|HIBIT, 'l', 'm', 'n', 'o'|HIBIT, 'p', 'r', 'r'|HIBIT, 'r', 's', 's'|HIBIT, 't', 'u', 'u'|HIBIT, 'v', 'w', 'w', 'x', 'y', 'z', 'h', 't', 'w', 'y', 'a', 'a'|HIBIT, 'a'|HIBIT, 'a'|HIBIT, 'e', 'e'|HIBIT, 'e'|HIBIT, 'i', 'o', 'o'|HIBIT, 'o'|HIBIT, 'o'|HIBIT, 'u', 'u'|HIBIT, 'u'|HIBIT, 'y', }; unsigned int key = (((unsigned int)c)<<3) | 0x00000007; int iRes = 0; int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1; int iLo = 0; while( iHi>=iLo ){ int iTest = (iHi + iLo) / 2; if( key >= aDia[iTest] ){ iRes = iTest; iLo = iTest+1; }else{ iHi = iTest-1; } } assert( key>=aDia[iRes] ); if( bComplex==0 && (aChar[iRes] & 0x80) ) return c; return (c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : ((int)aChar[iRes] & 0x7F); } /* ** Return true if the argument interpreted as a unicode codepoint ** is a diacritical modifier character. */ int unicode_is_diacritic(int c){ unsigned int mask0 = 0x08029FDF; unsigned int mask1 = 0x000361F8; if( c<768 || c>817 ) return 0; return (c < 768+32) ? (mask0 & ((unsigned int)1 << (c-768))) : (mask1 & ((unsigned int)1 << (c-768-32))); } /* ** Interpret the argument as a unicode codepoint. If the codepoint ** is an upper case character that has a lower case equivalent, ** return the codepoint corresponding to the lower case version. ** Otherwise, return a copy of the argument. ** ** The results are undefined if the value passed to this function ** is less than zero. */ int unicode_fold(int c, int eRemoveDiacritic){ /* Each entry in the following array defines a rule for folding a range ** of codepoints to lower case. The rule applies to a range of nRange ** codepoints starting at codepoint iCode. ** ** If the least significant bit in flags is clear, then the rule applies ** to all nRange codepoints (i.e. all nRange codepoints are upper case and ** need to be folded). Or, if it is set, then the rule only applies to |
︙ | ︙ | |||
268 269 270 271 272 273 274 | static const struct TableEntry { unsigned short iCode; unsigned char flags; unsigned char nRange; } aEntry[] = { {65, 14, 26}, {181, 66, 1}, {192, 14, 23}, {216, 14, 7}, {256, 1, 48}, {306, 1, 6}, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | > | 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 | static const struct TableEntry { unsigned short iCode; unsigned char flags; unsigned char nRange; } aEntry[] = { {65, 14, 26}, {181, 66, 1}, {192, 14, 23}, {216, 14, 7}, {256, 1, 48}, {306, 1, 6}, {313, 1, 16}, {330, 1, 46}, {376, 156, 1}, {377, 1, 6}, {383, 144, 1}, {385, 52, 1}, {386, 1, 4}, {390, 46, 1}, {391, 0, 1}, {393, 44, 2}, {395, 0, 1}, {398, 34, 1}, {399, 40, 1}, {400, 42, 1}, {401, 0, 1}, {403, 44, 1}, {404, 48, 1}, {406, 54, 1}, {407, 50, 1}, {408, 0, 1}, {412, 54, 1}, {413, 56, 1}, {415, 58, 1}, {416, 1, 6}, {422, 62, 1}, {423, 0, 1}, {425, 62, 1}, {428, 0, 1}, {430, 62, 1}, {431, 0, 1}, {433, 60, 2}, {435, 1, 4}, {439, 64, 1}, {440, 0, 1}, {444, 0, 1}, {452, 2, 1}, {453, 0, 1}, {455, 2, 1}, {456, 0, 1}, {458, 2, 1}, {459, 1, 18}, {478, 1, 18}, {497, 2, 1}, {498, 1, 4}, {502, 162, 1}, {503, 174, 1}, {504, 1, 40}, {544, 150, 1}, {546, 1, 18}, {570, 74, 1}, {571, 0, 1}, {573, 148, 1}, {574, 72, 1}, {577, 0, 1}, {579, 146, 1}, {580, 30, 1}, {581, 32, 1}, {582, 1, 10}, {837, 38, 1}, {880, 1, 4}, {886, 0, 1}, {895, 38, 1}, {902, 20, 1}, {904, 18, 3}, {908, 28, 1}, {910, 26, 2}, {913, 14, 17}, {931, 14, 9}, {962, 0, 1}, {975, 4, 1}, {976, 180, 1}, {977, 182, 1}, {981, 186, 1}, {982, 184, 1}, {984, 1, 24}, {1008, 176, 1}, {1009, 178, 1}, {1012, 170, 1}, {1013, 168, 1}, {1015, 0, 1}, {1017, 192, 1}, {1018, 0, 1}, {1021, 150, 3}, {1024, 36, 16}, {1040, 14, 32}, {1120, 1, 34}, {1162, 1, 54}, {1216, 6, 1}, {1217, 1, 14}, {1232, 1, 96}, {1329, 24, 38}, {4256, 70, 38}, {4295, 70, 1}, {4301, 70, 1}, {5112, 190, 6}, {7296, 126, 1}, {7297, 128, 1}, {7298, 130, 1}, {7299, 134, 2}, {7301, 132, 1}, {7302, 136, 1}, {7303, 138, 1}, {7304, 100, 1}, {7312, 142, 43}, {7357, 142, 3}, {7680, 1, 150}, {7835, 172, 1}, {7838, 120, 1}, {7840, 1, 96}, {7944, 190, 8}, {7960, 190, 6}, {7976, 190, 8}, {7992, 190, 8}, {8008, 190, 6}, {8025, 191, 8}, {8040, 190, 8}, {8072, 190, 8}, {8088, 190, 8}, {8104, 190, 8}, {8120, 190, 2}, {8122, 166, 2}, {8124, 188, 1}, {8126, 124, 1}, {8136, 164, 4}, {8140, 188, 1}, {8152, 190, 2}, {8154, 160, 2}, {8168, 190, 2}, {8170, 158, 2}, {8172, 192, 1}, {8184, 152, 2}, {8186, 154, 2}, {8188, 188, 1}, {8486, 122, 1}, {8490, 116, 1}, {8491, 118, 1}, {8498, 12, 1}, {8544, 8, 16}, {8579, 0, 1}, {9398, 10, 26}, {11264, 24, 47}, {11360, 0, 1}, {11362, 112, 1}, {11363, 140, 1}, {11364, 114, 1}, {11367, 1, 6}, {11373, 108, 1}, {11374, 110, 1}, {11375, 104, 1}, {11376, 106, 1}, {11378, 0, 1}, {11381, 0, 1}, {11390, 102, 2}, {11392, 1, 100}, {11499, 1, 4}, {11506, 0, 1}, {42560, 1, 46}, {42624, 1, 28}, {42786, 1, 14}, {42802, 1, 62}, {42873, 1, 4}, {42877, 98, 1}, {42878, 1, 10}, {42891, 0, 1}, {42893, 88, 1}, {42896, 1, 4}, {42902, 1, 20}, {42922, 80, 1}, {42923, 76, 1}, {42924, 78, 1}, {42925, 84, 1}, {42926, 80, 1}, {42928, 92, 1}, {42929, 86, 1}, {42930, 90, 1}, {42931, 68, 1}, {42932, 1, 12}, {42946, 0, 1}, {42948, 178, 1}, {42949, 82, 1}, {42950, 96, 1}, {43888, 94, 80}, {65313, 14, 26}, }; static const unsigned short aiOff[] = { 1, 2, 8, 15, 16, 26, 28, 32, 34, 37, 38, 40, 48, 63, 64, 69, 71, 79, 80, 116, 202, 203, 205, 206, 207, 209, 210, 211, 213, 214, 217, 218, 219, 775, 928, 7264, 10792, 10795, 23217, 23221, 23228, 23229, 23231, 23254, 23256, 23275, 23278, 26672, 30152, 30204, 35267, 54721, 54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, 57921, 58019, 58363, 59314, 59315, 59324, 59325, 59326, 59332, 59356, 61722, 62528, 65268, 65341, 65373, 65406, 65408, 65410, 65415, 65424, 65436, 65439, 65450, 65462, 65472, 65476, 65478, 65480, 65482, 65488, 65506, 65511, 65514, 65521, 65527, 65528, 65529, }; int ret = c; assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 ); if( c<128 ){ |
︙ | ︙ | |||
375 376 377 378 379 380 381 | assert( iRes>=0 && c>=aEntry[iRes].iCode ); p = &aEntry[iRes]; if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; assert( ret>0 ); } | > | > | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | assert( iRes>=0 && c>=aEntry[iRes].iCode ); p = &aEntry[iRes]; if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; assert( ret>0 ); } if( eRemoveDiacritic ){ ret = unicode_remove_diacritic(ret, eRemoveDiacritic==2); } } else if( c>=66560 && c<66600 ){ ret = c + 40; } else if( c>=66736 && c<66772 ){ ret = c + 40; |
︙ | ︙ |
Changes to src/unversioned.c.
︙ | ︙ | |||
289 290 291 292 293 294 295 | const char *zError = 0; const char *zIn; const char *zAs; Blob file; int i; zAs = find_option("as",0,1); | < > | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | const char *zError = 0; const char *zIn; const char *zAs; Blob file; int i; zAs = find_option("as",0,1); verify_all_options(); if( zAs && g.argc!=4 ) usage("add DISKFILE --as UVFILE"); db_begin_transaction(); content_rcvid_init("#!fossil unversioned add"); for(i=3; i<g.argc; i++){ zIn = zAs ? zAs : g.argv[i]; if( zIn[0]==0 ){ zError = "be empty string"; }else if( zIn[0]=='/' ){ |
︙ | ︙ | |||
617 618 619 620 621 622 623 | while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); sqlite3_int64 mtime = db_column_int(&q, 1); const char *zHash = db_column_text(&q, 2); int fullSize = db_column_int(&q, 3); const char *zLogin = db_column_text(&q, 4); if( zLogin==0 ) zLogin = ""; | | | | < | < | | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | while( db_step(&q)==SQLITE_ROW ){ const char *zName = db_column_text(&q, 0); sqlite3_int64 mtime = db_column_int(&q, 1); const char *zHash = db_column_text(&q, 2); int fullSize = db_column_int(&q, 3); const char *zLogin = db_column_text(&q, 4); if( zLogin==0 ) zLogin = ""; blob_appendf(&json, "%s{\"name\":\"%j\",\n", zSep, zName); zSep = ",\n "; blob_appendf(&json, " \"mtime\":%lld,\n", mtime); blob_appendf(&json, " \"hash\":\"%j\",\n", zHash); blob_appendf(&json, " \"size\":%d,\n", fullSize); blob_appendf(&json, " \"user\":\"%j\"}", zLogin); } db_finalize(&q); blob_appendf(&json,"]\n"); cgi_set_content(&json); } |
Changes to src/update.c.
︙ | ︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ** --debug print debug information on stdout ** --latest acceptable in place of VERSION, update to latest version ** --force-missing force update if missing content after sync ** -n|--dry-run If given, display instead of run actions ** -v|--verbose print status information about all files ** -W|--width <num> Width of lines (default is to auto-detect). Must be >20 ** or 0 (= no limit, resulting in a single line per entry). ** ** See also: revert */ void update_cmd(void){ int vid; /* Current version */ int tid=0; /* Target version - version we are changing to */ Stmt q; | > > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ** --debug print debug information on stdout ** --latest acceptable in place of VERSION, update to latest version ** --force-missing force update if missing content after sync ** -n|--dry-run If given, display instead of run actions ** -v|--verbose print status information about all files ** -W|--width <num> Width of lines (default is to auto-detect). Must be >20 ** or 0 (= no limit, resulting in a single line per entry). ** --setmtime Set timestamps of all files to match their SCM-side ** times (the timestamp of the last checkin which modified ** them). ** ** See also: revert */ void update_cmd(void){ int vid; /* Current version */ int tid=0; /* Target version - version we are changing to */ Stmt q; |
︙ | ︙ | |||
158 159 160 161 162 163 164 | db_get_int("autosync-tries", 1), 1) ){ fossil_fatal("update abandoned due to sync failure"); } } /* Create any empty directories now, as well as after the update, ** so changes in settings are reflected now */ | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | db_get_int("autosync-tries", 1), 1) ){ fossil_fatal("update abandoned due to sync failure"); } } /* Create any empty directories now, as well as after the update, ** so changes in settings are reflected now */ if( !dryRunFlag ) ensure_empty_dirs_created(0); if( internalUpdate ){ tid = internalUpdate; }else if( g.argc>=3 ){ if( fossil_strcmp(g.argv[2], "current")==0 ){ /* If VERSION is "current", then use the same algorithm to find the ** target as if VERSION were omitted. */ |
︙ | ︙ | |||
225 226 227 228 229 230 231 232 233 234 235 236 237 238 | } if( tid==0 ){ return; } db_begin_transaction(); vfile_check_signature(vid, CKSIG_ENOTFILE); if( !dryRunFlag && !internalUpdate ) undo_begin(); if( load_vfile_from_rid(tid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to update"); }; /* | > > > > | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | } if( tid==0 ){ return; } db_begin_transaction(); db_multi_exec( "CREATE TEMP TABLE dir_to_delete(name TEXT %s PRIMARY KEY)WITHOUT ROWID", filename_collation() ); vfile_check_signature(vid, CKSIG_ENOTFILE); if( !dryRunFlag && !internalUpdate ) undo_begin(); if( load_vfile_from_rid(tid) && !forceMissingFlag ){ fossil_fatal("missing content, unable to update"); }; /* |
︙ | ︙ | |||
453 454 455 456 457 458 459 | ** file but keep the edited version around. */ fossil_print("CONFLICT %s - edited locally but deleted by update\n", zName); nConflict++; }else{ fossil_print("REMOVE %s\n", zName); if( !dryRunFlag && !internalUpdate ) undo_save(zName); | | > > > > > > > > > > > > | 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 | ** file but keep the edited version around. */ fossil_print("CONFLICT %s - edited locally but deleted by update\n", zName); nConflict++; }else{ fossil_print("REMOVE %s\n", zName); if( !dryRunFlag && !internalUpdate ) undo_save(zName); if( !dryRunFlag ){ char *zDir; file_delete(zFullPath); zDir = file_dirname(zName); while( zDir!=0 ){ char *zNext; db_multi_exec("INSERT OR IGNORE INTO dir_to_delete(name)" "VALUES(%Q)", zDir); zNext = db_changes() ? file_dirname(zDir) : 0; fossil_free(zDir); zDir = zNext; } } } }else if( idt>0 && idv>0 && ridt!=ridv && chnged ){ /* Merge the changes in the current tree into the target version */ Blob r, t, v; int rc; if( nameChng ){ fossil_print("MERGE %s -> %s\n", zName, zNewName); |
︙ | ︙ | |||
527 528 529 530 531 532 533 | } /* Report on conflicts */ if( !dryRunFlag ){ Stmt q; int nMerge = 0; | < | | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | } /* Report on conflicts */ if( !dryRunFlag ){ Stmt q; int nMerge = 0; db_prepare(&q, "SELECT mhash, id FROM vmerge WHERE id<=0"); while( db_step(&q)==SQLITE_ROW ){ const char *zLabel = "merge"; switch( db_column_int(&q, 1) ){ case -1: zLabel = "cherrypick merge"; break; case -2: zLabel = "backout merge"; break; } fossil_warning("uncommitted %s against %S.", |
︙ | ︙ | |||
565 566 567 568 569 570 571 | /* ** Clean up the mid and pid VFILE entries. Then commit the changes. */ if( dryRunFlag ){ db_end_transaction(1); /* With --dry-run, rollback changes */ }else{ | > | > > > > > > > > > | | | 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 | /* ** Clean up the mid and pid VFILE entries. Then commit the changes. */ if( dryRunFlag ){ db_end_transaction(1); /* With --dry-run, rollback changes */ }else{ char *zPwd; ensure_empty_dirs_created(1); sqlite3_create_function(g.db, "rmdir", 1, SQLITE_UTF8, 0, file_rmdir_sql_function, 0, 0); zPwd = file_getcwd(0,0); db_multi_exec( "SELECT rmdir(%Q||name) FROM dir_to_delete" " WHERE (%Q||name)<>%Q ORDER BY name DESC", g.zLocalRoot, g.zLocalRoot, zPwd ); fossil_free(zPwd); if( g.argc<=3 ){ /* All files updated. Shift the current checkout to the target. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid); checkout_set_all_exe(tid); manifest_to_disk(tid); db_set_checkout(tid); }else{ /* A subset of files have been checked out. Keep the current ** checkout unchanged. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); } if( !internalUpdate ) undo_finish(); if( setmtimeFlag ) vfile_check_signature(tid, CKSIG_SETMTIME); db_end_transaction(0); } } /* ** Create empty directories specified by the empty-dirs setting. */ void ensure_empty_dirs_created(int clearDirTable){ char *zEmptyDirs = db_get("empty-dirs", 0); if( zEmptyDirs!=0 ){ int i; Blob dirName; Blob dirsList; zEmptyDirs = fossil_strdup(zEmptyDirs); |
︙ | ︙ | |||
612 613 614 615 616 617 618 | if( file_mkfolder(zPath, RepoFILE, 0, 1)!=0 ) { fossil_warning("couldn't create directory %s as " "required by empty-dirs setting", zDir); } break; } case 1: { /* exists, and is a directory */ | | > > > > > | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | if( file_mkfolder(zPath, RepoFILE, 0, 1)!=0 ) { fossil_warning("couldn't create directory %s as " "required by empty-dirs setting", zDir); } break; } case 1: { /* exists, and is a directory */ /* make sure this directory is not on the delete list */ if( clearDirTable ){ db_multi_exec( "DELETE FROM dir_to_delete WHERE name=%Q", zDir ); } break; } case 2: { /* exists, but isn't a directory */ fossil_warning("file %s found, but a directory is required " "by empty-dirs setting", zDir); } } |
︙ | ︙ | |||
642 643 644 645 646 647 648 | int vid; Manifest *pManifest; /* Determine the check-in manifest artifact ID. Panic on failure. */ if( zRevision ){ vid = name_to_typed_rid(zRevision, "ci"); }else if( !g.localOpen ){ | | | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 | int vid; Manifest *pManifest; /* Determine the check-in manifest artifact ID. Panic on failure. */ if( zRevision ){ vid = name_to_typed_rid(zRevision, "ci"); }else if( !g.localOpen ){ vid = name_to_typed_rid(db_get("main-branch", 0), "ci"); }else{ vid = db_lget_int("checkout", 0); if( !is_a_version(vid) ){ zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); if( zRevision ){ fossil_fatal("checkout artifact is not a check-in: %s", zRevision); }else{ |
︙ | ︙ | |||
863 864 865 866 867 868 869 | blob_write_to_file(&record, zFull); } file_setexe(zFull, rvPerm==PERM_EXE); fossil_print("REVERT %s\n", zFile); mtime = file_mtime(zFull, RepoFILE); db_multi_exec( "UPDATE vfile" | | > | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | blob_write_to_file(&record, zFull); } file_setexe(zFull, rvPerm==PERM_EXE); fossil_print("REVERT %s\n", zFile); mtime = file_mtime(zFull, RepoFILE); db_multi_exec( "UPDATE vfile" " SET mtime=%lld, chnged=%d, deleted=0, isexe=%d, islink=%d," " mrid=rid, mhash=NULL" " WHERE pathname=%Q OR origname=%Q", mtime, rvChnged, rvPerm==PERM_EXE, rvPerm==PERM_LNK, zFile, zFile ); } blob_reset(&record); free(zFull); } |
︙ | ︙ |
Changes to src/url.c.
︙ | ︙ | |||
272 273 274 275 276 277 278 | pUrlData->path = ""; pUrlData->name = mprintf("%b", &cfile); pUrlData->canonical = mprintf("file://%T", pUrlData->name); blob_reset(&cfile); }else if( pUrlData->user!=0 && pUrlData->passwd==0 && (urlFlags & URL_PROMPT_PW) ){ url_prompt_for_password_local(pUrlData); }else if( pUrlData->user!=0 && ( urlFlags & URL_ASK_REMEMBER_PW ) ){ | | | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | pUrlData->path = ""; pUrlData->name = mprintf("%b", &cfile); pUrlData->canonical = mprintf("file://%T", pUrlData->name); blob_reset(&cfile); }else if( pUrlData->user!=0 && pUrlData->passwd==0 && (urlFlags & URL_PROMPT_PW) ){ url_prompt_for_password_local(pUrlData); }else if( pUrlData->user!=0 && ( urlFlags & URL_ASK_REMEMBER_PW ) ){ if( isatty(fileno(stdin)) && ( urlFlags & URL_REMEMBER_PW )==0 ){ if( save_password_prompt(pUrlData->passwd) ){ pUrlData->flags = urlFlags |= URL_REMEMBER_PW; }else{ pUrlData->flags = urlFlags &= ~URL_REMEMBER_PW; } } } |
︙ | ︙ |
Changes to src/user.c.
︙ | ︙ | |||
363 364 365 366 367 368 369 | if( g.argc<3 ){ usage("capabilities|default|list|new|password ..."); } n = strlen(g.argv[2]); if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){ Blob passwd, login, caps, contact; char *zPw; | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | if( g.argc<3 ){ usage("capabilities|default|list|new|password ..."); } n = strlen(g.argv[2]); if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){ Blob passwd, login, caps, contact; char *zPw; blob_init(&caps, db_get("default-perms", 0), -1); if( g.argc>=4 ){ blob_init(&login, g.argv[3], -1); }else{ prompt_user("login: ", &login); } if( db_exists("SELECT 1 FROM user WHERE login=%B", &login) ){ |
︙ | ︙ | |||
496 497 498 499 500 501 502 503 504 505 506 507 508 509 | ** (7) Try the USERNAME environment variable. ** ** (8) Check if the user can be extracted from the remote URL. ** ** The user name is stored in g.zLogin. The uid is in g.userUid. */ void user_select(void){ if( g.userUid ) return; if( g.zLogin ){ if( attempt_user(g.zLogin)==0 ){ fossil_fatal("no such user: %s", g.zLogin); }else{ return; } | > | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | ** (7) Try the USERNAME environment variable. ** ** (8) Check if the user can be extracted from the remote URL. ** ** The user name is stored in g.zLogin. The uid is in g.userUid. */ void user_select(void){ UrlData url; if( g.userUid ) return; if( g.zLogin ){ if( attempt_user(g.zLogin)==0 ){ fossil_fatal("no such user: %s", g.zLogin); }else{ return; } |
︙ | ︙ | |||
517 518 519 520 521 522 523 | if( attempt_user(fossil_getenv("USER")) ) return; if( attempt_user(fossil_getenv("LOGNAME")) ) return; if( attempt_user(fossil_getenv("USERNAME")) ) return; | > | | | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | if( attempt_user(fossil_getenv("USER")) ) return; if( attempt_user(fossil_getenv("LOGNAME")) ) return; if( attempt_user(fossil_getenv("USERNAME")) ) return; memset(&url, 0, sizeof(url)); url_parse_local(0, 0, &url); if( url.user && attempt_user(url.user) ) return; fossil_print( "Cannot figure out who you are! Consider using the --user\n" "command line option, setting your USER environment variable,\n" "or setting a default user with \"fossil user default USER\".\n" ); fossil_fatal("cannot determine user"); |
︙ | ︙ |
Changes to src/util.c.
︙ | ︙ | |||
188 189 190 191 192 193 194 | int fossil_strcmp(const char *zA, const char *zB){ if( zA==0 ){ if( zB==0 ) return 0; return -1; }else if( zB==0 ){ return +1; }else{ | < < < < < | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | int fossil_strcmp(const char *zA, const char *zB){ if( zA==0 ){ if( zB==0 ) return 0; return -1; }else if( zB==0 ){ return +1; }else{ return strcmp(zA,zB); } } int fossil_strncmp(const char *zA, const char *zB, int nByte){ if( zA==0 ){ if( zB==0 ) return 0; return -1; }else if( zB==0 ){ |
︙ | ︙ | |||
523 524 525 526 527 528 529 | void fossil_pledge(const char *promises){ if( pledge(promises, 0) ){ fossil_panic("pledge(\"%s\",NULL) fails with errno=%d", promises, (int)errno); } } #endif /* defined(HAVE_PLEDGE) */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | void fossil_pledge(const char *promises){ if( pledge(promises, 0) ){ fossil_panic("pledge(\"%s\",NULL) fails with errno=%d", promises, (int)errno); } } #endif /* defined(HAVE_PLEDGE) */ /* ** Construct a random password and return it as a string. N is the ** recommended number of characters for the password. ** ** Space to hold the returned string is obtained from fossil_malloc() ** and should be freed by the caller. */ char *fossil_random_password(int N){ char zSrc[60]; int nSrc; int i; char z[60]; /* Source characters for the password. Omit characters like "0", "O", ** "1" and "I" that might be easily confused */ static const char zAlphabet[] = /* 0 1 2 3 4 5 */ /* 123456789 123456789 123456789 123456789 123456789 123456 */ "23456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; if( N<8 ) N = 8; else if( N>sizeof(zAlphabet)-2 ) N = sizeof(zAlphabet)-2; nSrc = sizeof(zAlphabet) - 1; memcpy(zSrc, zAlphabet, nSrc); for(i=0; i<N; i++){ unsigned r; sqlite3_randomness(sizeof(r), &r); r %= nSrc; z[i] = zSrc[r]; zSrc[r] = zSrc[--nSrc]; } z[i] = 0; return fossil_strdup(z); } /* ** COMMAND: test-random-password ** ** Usage: %fossil test-random-password ?N? ** ** Generate a random password string of approximately N characters in length. ** If N is omitted, use 10. Values of N less than 8 are changed to 8 ** and greater than 55 and changed to 55. */ void test_random_password(void){ int N = 10; if( g.argc>=3 ){ N = atoi(g.argv[2]); } fossil_print("%s\n", fossil_random_password(N)); } |
Changes to src/verify.c.
︙ | ︙ | |||
66 67 68 69 70 71 72 | ** This routine is called just prior to each commit operation. ** ** Invoke verify_rid() on every record that has been added or modified ** in the repository, in order to make sure that the repository is sane. */ static int verify_at_commit(void){ int rid; | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ** This routine is called just prior to each commit operation. ** ** Invoke verify_rid() on every record that has been added or modified ** in the repository, in order to make sure that the repository is sane. */ static int verify_at_commit(void){ int rid; content_clear_cache(0); inFinalVerify = 1; rid = bag_first(&toVerify); while( rid>0 ){ verify_rid(rid); rid = bag_next(&toVerify, rid); } bag_clear(&toVerify); |
︙ | ︙ |
Changes to src/vfile.c.
︙ | ︙ | |||
86 87 88 89 90 91 92 | db_begin_transaction(); p = manifest_get(vid, CFTYPE_MANIFEST, 0); if( p==0 ) { db_end_transaction(1); return 0; } db_prepare(&ins, | | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | db_begin_transaction(); p = manifest_get(vid, CFTYPE_MANIFEST, 0); if( p==0 ) { db_end_transaction(1); return 0; } db_prepare(&ins, "INSERT INTO vfile(vid,isexe,islink,rid,mrid,pathname,mhash) " " VALUES(:vid,:isexe,:islink,:id,:id,:name,NULL)"); db_prepare(&ridq, "SELECT rid,size FROM blob WHERE uuid=:uuid"); db_bind_int(&ins, ":vid", vid); manifest_file_rewind(p); nMissing = 0; while( (pFile = manifest_file_next(p,0))!=0 ){ if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue; db_bind_text(&ridq, ":uuid", pFile->zUuid); |
︙ | ︙ | |||
240 241 242 243 244 245 246 | ** if --hash is used, check to see if they have been edited by ** looking at their artifact hashes */ const char *zUuid = db_column_text(&q, 5); int nUuid = db_column_bytes(&q, 5); assert( origSize==currentSize ); if( !hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 1; } | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | ** if --hash is used, check to see if they have been edited by ** looking at their artifact hashes */ const char *zUuid = db_column_text(&q, 5); int nUuid = db_column_bytes(&q, 5); assert( origSize==currentSize ); if( !hname_verify_file_hash(zName, zUuid, nUuid) ) chnged = 1; } if( (cksigFlags & CKSIG_SETMTIME) && (chnged==0 || chnged==2 || chnged==4)){ i64 desiredMtime; if( mtime_of_manifest_file(vid,rid,&desiredMtime)==0 ){ if( currentMtime!=desiredMtime ){ file_set_mtime(zName, desiredMtime); currentMtime = file_mtime(zName, RepoFILE); } } |
︙ | ︙ | |||
357 358 359 360 361 362 363 | blob_reset(&content); db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d", file_mtime(zName, RepoFILE), id); } db_finalize(&q); } | < < < < < < < < < < < < < < < < < < | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | blob_reset(&content); db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d", file_mtime(zName, RepoFILE), id); } db_finalize(&q); } /* ** Check to see if the directory named in zPath is the top of a checkout. ** In other words, check to see if directory pPath contains a file named ** "_FOSSIL_" or ".fslckout". Return true or false. */ int vfile_top_of_checkout(const char *zPath){ char *zFile; |
︙ | ︙ | |||
446 447 448 449 450 451 452 453 454 455 456 457 458 | ** Values for the scanFlags parameter to vfile_scan(). */ #define SCAN_ALL 0x001 /* Includes files that begin with "." */ #define SCAN_TEMP 0x002 /* Only Fossil-generated files like *-baseline */ #define SCAN_NESTED 0x004 /* Scan for empty dirs in nested checkouts */ #define SCAN_MTIME 0x008 /* Populate mtime column */ #define SCAN_SIZE 0x010 /* Populate size column */ #endif /* INTERFACE */ /* ** Load into table SFILE the name of every ordinary file in ** the directory pPath. Omit the first nPrefix characters of ** of pPath when inserting into the SFILE table. | > < > | > | > > | | > > > > > > > > > > | | | | > | | > | | > | 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 | ** Values for the scanFlags parameter to vfile_scan(). */ #define SCAN_ALL 0x001 /* Includes files that begin with "." */ #define SCAN_TEMP 0x002 /* Only Fossil-generated files like *-baseline */ #define SCAN_NESTED 0x004 /* Scan for empty dirs in nested checkouts */ #define SCAN_MTIME 0x008 /* Populate mtime column */ #define SCAN_SIZE 0x010 /* Populate size column */ #define SCAN_ISEXE 0x020 /* Populate isexe column */ #endif /* INTERFACE */ /* ** Load into table SFILE the name of every ordinary file in ** the directory pPath. Omit the first nPrefix characters of ** of pPath when inserting into the SFILE table. ** Subdirectories are scanned recursively. ** ** Omit files named in VFILE if eFType==RepoFILE. Include all files ** if eFType==ExtFILE. ** ** Files whose names begin with "." are omitted unless the SCAN_ALL ** flag is set. ** ** Any files or directories that match the glob patterns pIgnore* ** are excluded from the scan. Name matching occurs after the ** first nPrefix characters are elided from the filename. */ void vfile_scan( Blob *pPath, /* Directory to be scanned */ int nPrefix, /* Number of bytes in directory name */ unsigned scanFlags, /* Zero or more SCAN_xxx flags */ Glob *pIgnore1, /* Do not add files that match this GLOB */ Glob *pIgnore2, /* Omit files matching this GLOB too */ int eFType /* ExtFILE or RepoFILE */ ){ DIR *d; int origSize; struct dirent *pEntry; int skipAll = 0; static Stmt ins; static int depth = 0; void *zNative; origSize = blob_size(pPath); if( pIgnore1 || pIgnore2 ){ blob_appendf(pPath, "/"); if( glob_match(pIgnore1, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; if( glob_match(pIgnore2, &blob_str(pPath)[nPrefix+1]) ) skipAll = 1; blob_resize(pPath, origSize); } if( skipAll ) return; if( depth==0 ){ if( eFType==ExtFILE ){ db_prepare(&ins, "INSERT OR IGNORE INTO sfile(pathname%s%s%s) VALUES(:file%s%s%s)", scanFlags & SCAN_MTIME ? ",mtime" : "", scanFlags & SCAN_SIZE ? ",size" : "", scanFlags & SCAN_ISEXE ? ",isexe" : "", scanFlags & SCAN_MTIME ? ",:mtime" : "", scanFlags & SCAN_SIZE ? ",:size" : "", scanFlags & SCAN_ISEXE ? ",:isexe" : "" ); }else{ db_prepare(&ins, "INSERT OR IGNORE INTO sfile(pathname%s%s%s) SELECT :file%s%s%s" " WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE" " pathname=:file %s)", scanFlags & SCAN_MTIME ? ",mtime" : "", scanFlags & SCAN_SIZE ? ",size" : "", scanFlags & SCAN_ISEXE ? ",isexe" : "", scanFlags & SCAN_MTIME ? ",:mtime" : "", scanFlags & SCAN_SIZE ? ",:size" : "", scanFlags & SCAN_ISEXE ? ",:isexe" : "", filename_collation() ); } } depth++; zNative = fossil_utf8_to_path(blob_str(pPath), 1); d = opendir(zNative); if( d ){ while( (pEntry=readdir(d))!=0 ){ |
︙ | ︙ | |||
520 521 522 523 524 525 526 | blob_appendf(pPath, "/%s", zUtf8); zPath = blob_str(pPath); if( glob_match(pIgnore1, &zPath[nPrefix+1]) || glob_match(pIgnore2, &zPath[nPrefix+1]) ){ /* do nothing */ #ifdef _DIRENT_HAVE_D_TYPE }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | | | | | | > > > | 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 | blob_appendf(pPath, "/%s", zUtf8); zPath = blob_str(pPath); if( glob_match(pIgnore1, &zPath[nPrefix+1]) || glob_match(pIgnore2, &zPath[nPrefix+1]) ){ /* do nothing */ #ifdef _DIRENT_HAVE_D_TYPE }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) ? (file_isdir(zPath, eFType)==1) : (pEntry->d_type==DT_DIR) ){ #else }else if( file_isdir(zPath, eFType)==1 ){ #endif if( !vfile_top_of_checkout(zPath) ){ vfile_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2, eFType); } #ifdef _DIRENT_HAVE_D_TYPE }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) ? (file_isfile_or_link(zPath)) : (pEntry->d_type==DT_REG) ){ #else }else if( file_isfile_or_link(zPath) ){ #endif if( (scanFlags & SCAN_TEMP)==0 || is_temporary_file(zUtf8) ){ db_bind_text(&ins, ":file", &zPath[nPrefix+1]); if( scanFlags & SCAN_MTIME ){ db_bind_int(&ins, ":mtime", file_mtime(zPath, eFType)); } if( scanFlags & SCAN_SIZE ){ db_bind_int(&ins, ":size", file_size(zPath, eFType)); } if( scanFlags & SCAN_ISEXE ){ db_bind_int(&ins, ":isexe", file_isexe(zPath, eFType)); } db_step(&ins); db_reset(&ins); } } fossil_path_free(zUtf8); blob_resize(pPath, origSize); |
︙ | ︙ | |||
580 581 582 583 584 585 586 | ** Returns the total number of files found. */ int vfile_dir_scan( Blob *pPath, /* Base directory to be scanned */ int nPrefix, /* Number of bytes in base directory name */ unsigned scanFlags, /* Zero or more SCAN_xxx flags */ Glob *pIgnore1, /* Do not add directories that match this GLOB */ | | > | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | ** Returns the total number of files found. */ int vfile_dir_scan( Blob *pPath, /* Base directory to be scanned */ int nPrefix, /* Number of bytes in base directory name */ unsigned scanFlags, /* Zero or more SCAN_xxx flags */ Glob *pIgnore1, /* Do not add directories that match this GLOB */ Glob *pIgnore2, /* Omit directories matching this GLOB too */ int eFType /* ExtFILE or RepoFILE */ ){ int result = 0; DIR *d; int origSize; struct dirent *pEntry; int skipAll = 0; static Stmt ins; |
︙ | ︙ | |||
640 641 642 643 644 645 646 | blob_appendf(pPath, "/%s", zUtf8); zPath = blob_str(pPath); if( glob_match(pIgnore1, &zPath[nPrefix+1]) || glob_match(pIgnore2, &zPath[nPrefix+1]) ){ /* do nothing */ #ifdef _DIRENT_HAVE_D_TYPE }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) | | | | | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | blob_appendf(pPath, "/%s", zUtf8); zPath = blob_str(pPath); if( glob_match(pIgnore1, &zPath[nPrefix+1]) || glob_match(pIgnore2, &zPath[nPrefix+1]) ){ /* do nothing */ #ifdef _DIRENT_HAVE_D_TYPE }else if( (pEntry->d_type==DT_UNKNOWN || pEntry->d_type==DT_LNK) ? (file_isdir(zPath, eFType)==1) : (pEntry->d_type==DT_DIR) ){ #else }else if( file_isdir(zPath, eFType)==1 ){ #endif if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ char *zSavePath = mprintf("%s", zPath); int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, pIgnore2, eFType); db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); db_bind_int(&ins, ":count", count); db_step(&ins); db_reset(&ins); fossil_free(zSavePath); result += count; /* found X normal files? */ } |
︙ | ︙ | |||
964 965 966 967 968 969 970 | vfile_aggregate_checksum_repository(vid, &hash); printf("archive: %s\n", blob_str(&hash)); blob_reset(&hash); vfile_aggregate_checksum_manifest(vid, &hash, &hash2); printf("manifest: %s\n", blob_str(&hash)); printf("recorded: %s\n", blob_str(&hash2)); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | vfile_aggregate_checksum_repository(vid, &hash); printf("archive: %s\n", blob_str(&hash)); blob_reset(&hash); vfile_aggregate_checksum_manifest(vid, &hash, &hash2); printf("manifest: %s\n", blob_str(&hash)); printf("recorded: %s\n", blob_str(&hash2)); } /* ** This routine recomputes certain columns of the vfile and vmerge tables ** when the associated repository is swapped out for a clone of the same ** project, and the blob.rid value change. The following columns are ** updated: ** ** vmerge.merge ** vfile.vid ** vfile.rid ** vfile.mrid ** ** Also: ** ** vvar.value WHERE name='checkout' */ void vfile_rid_renumbering_event(int dryRun){ int oldVid; int newVid; char *zUnresolved; oldVid = db_lget_int("checkout", 0); newVid = db_int(0, "SELECT blob.rid FROM blob, vvar" " WHERE blob.uuid=vvar.value" " AND vvar.name='checkout-hash'"); /* The idMap table will make old RID values into new ones */ db_multi_exec( "CREATE TEMP TABLE idMap(oldrid INTEGER PRIMARY KEY, newrid INT);\n" ); /* Add the RID value for the current check-out */ db_multi_exec( "INSERT INTO idMap(oldrid, newrid) VALUES(%d,%d)", oldVid, newVid ); /* Add the RID values for any other check-ins that have been merged into ** the current check-out. */ db_multi_exec( "INSERT OR IGNORE INTO idMap(oldrid, newrid)" " SELECT vmerge.merge, blob.rid FROM vmerge, blob" " WHERE blob.uuid=vmerge.mhash;" ); /* Add RID values for files in the current check-out */ db_multi_exec( "CREATE TEMP TABLE hashoffile(name TEXT PRIMARY KEY, hash TEXT)" "WITHOUT ROWID;" "INSERT INTO hashoffile(name,hash)" " SELECT filename, uuid FROM vvar, files_of_checkin(vvar.value)" " WHERE vvar.name='checkout-hash';" "INSERT OR IGNORE INTO idMap(oldrid, newrid)" " SELECT vfile.rid, blob.rid FROM vfile, hashoffile, blob" " WHERE hashoffile.name=coalesce(vfile.origname,vfile.pathname)" " AND blob.uuid=hashoffile.hash;" ); /* Add RID values for merged-in files */ db_multi_exec( "INSERT OR IGNORE INTO idMap(oldrid, newrid)" " SELECT vfile.mrid, blob.rid FROM vfile, blob" " WHERE blob.uuid=vfile.mhash;" ); if( dryRun ){ Stmt q; db_prepare(&q, "SELECT oldrid, newrid, blob.uuid" " FROM idMap, blob WHERE blob.rid=idMap.newrid"); while( db_step(&q)==SQLITE_ROW ){ fossil_print("%8d -> %8d %.25s\n", db_column_int(&q,0), db_column_int(&q,1), db_column_text(&q,2)); } db_finalize(&q); } /* Verify that all RID values in the VFILE table and VMERGE table have ** been resolved. */ zUnresolved = db_text("", "WITH allrid(x) AS (" " SELECT rid FROM vfile" " UNION SELECT mrid FROM vfile" " UNION SELECT merge FROM vmerge" " UNION SELECT %d" ")" "SELECT group_concat(x,' ') FROM allrid" " WHERE x<>0 AND x NOT IN (SELECT oldrid FROM idMap);", oldVid ); if( zUnresolved[0] ){ fossil_fatal("Unresolved RID values: %s\n", zUnresolved); } /* Make the changes to the VFILE and VMERGE tables */ if( !dryRun ){ db_multi_exec( "UPDATE vfile" " SET rid=(SELECT newrid FROM idMap WHERE oldrid=vfile.rid)" " WHERE vid=%d AND rid>0;", oldVid); db_multi_exec( "UPDATE vfile" " SET mrid=(SELECT newrid FROM idMap WHERE oldrid=vfile.mrid)" " WHERE vid=%d AND mrid>0;", oldVid); db_multi_exec( "UPDATE vfile" " SET vid=%d" " WHERE vid=%d", newVid, oldVid); db_multi_exec( "UPDATE vmerge" " SET merge=(SELECT newrid FROM idMap WHERE oldrid=vmerge.merge);"); db_lset_int("checkout",newVid); } /* Clear out the TEMP tables we constructed */ db_multi_exec( "DROP TABLE idMap;" "DROP TABLE hashoffile;" ); } |
Changes to src/webmail.c.
︙ | ︙ | |||
118 119 120 121 122 123 124 | for(i=0; z[i] && (z[i]!='\n' || z[i+1]==' ' || z[i+1]=='\t'); i++){} if( z[i]=='\n' ) i++; return i; } /* ** Look for a parameter of the form NAME=VALUE in the given email | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | for(i=0; z[i] && (z[i]!='\n' || z[i+1]==' ' || z[i+1]=='\t'); i++){} if( z[i]=='\n' ) i++; return i; } /* ** Look for a parameter of the form NAME=VALUE in the given email ** header line. Return a copy of VALUE in space obtained from ** fossil_malloc(). Or return NULL if there is no such parameter. */ static char *email_hdr_value(const char *z, const char *zName){ int nName = (int)strlen(zName); int i; const char *z2 = strstr(z, zName); if( z2==0 ) return 0; |
︙ | ︙ | |||
356 357 358 359 360 361 362 | } /* ** Add the select/option box to the timeline submenu that shows ** the various email message formats. */ static void webmail_f_submenu(void){ | | | | 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 | } /* ** Add the select/option box to the timeline submenu that shows ** the various email message formats. */ static void webmail_f_submenu(void){ static const char *const az[] = { "0", "Normal", "1", "Decoded", "2", "Raw", }; style_submenu_multichoice("f", sizeof(az)/(2*sizeof(az[0])), az, 0); } /* ** If the first N characters of z[] are the name of a header field ** that should be shown in "Normal" mode, then return 1. */ static int webmail_normal_header(const char *z, int N){ static const char *const az[] = { "To", "Cc", "Bcc", "Date", "From", "Subject", }; int i; for(i=0; i<sizeof(az)/sizeof(az[0]); i++){ if( sqlite3_strnicmp(z, az[i], N)==0 ) return 1; } return 0; |
︙ | ︙ | |||
413 414 415 416 417 418 419 | if( db_step(&q)==SQLITE_ROW ){ Blob msg = db_column_text_as_blob(&q, 0); int eFormat = atoi(PD("f","0")); eState = db_column_int(&q, 1); eTranscript = db_column_int(&q, 2); if( eFormat==2 ){ @ <pre>%h(db_column_text(&q, 0))</pre> | | | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | if( db_step(&q)==SQLITE_ROW ){ Blob msg = db_column_text_as_blob(&q, 0); int eFormat = atoi(PD("f","0")); eState = db_column_int(&q, 1); eTranscript = db_column_int(&q, 2); if( eFormat==2 ){ @ <pre>%h(db_column_text(&q, 0))</pre> }else{ EmailToc *p = emailtoc_from_email(&msg); int i, j; @ <p> for(i=0; i<p->nHdr; i++){ char *z = p->azHdr[i]; email_hdr_unfold(z); for(j=0; z[j] && z[j]!=':'; j++){} |
︙ | ︙ | |||
561 562 563 564 565 566 567 | /* ** Add the select/option box to the timeline submenu that shows ** which messages to include in the index. */ static void webmail_d_submenu(void){ | | | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | /* ** Add the select/option box to the timeline submenu that shows ** which messages to include in the index. */ static void webmail_d_submenu(void){ static const char *const az[] = { "0", "InBox", "1", "Unread", "2", "Trash", "3", "Sent", "4", "Everything", }; style_submenu_multichoice("d", sizeof(az)/(2*sizeof(az[0])), az, 0); |
︙ | ︙ | |||
588 589 590 591 592 593 594 | ** user=USER Show mailbox for USER (admin only). ** user=* Show mailbox for all users (admin only). ** d=N 0: inbox+unread 1: unread-only 2: trash 3: all ** eN Select email entry emailbox.ebid==N ** trash Move selected entries to trash (estate=2) ** read Mark selected entries as read (estate=1) ** unread Mark selected entries as unread (estate=0) | | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | ** user=USER Show mailbox for USER (admin only). ** user=* Show mailbox for all users (admin only). ** d=N 0: inbox+unread 1: unread-only 2: trash 3: all ** eN Select email entry emailbox.ebid==N ** trash Move selected entries to trash (estate=2) ** read Mark selected entries as read (estate=1) ** unread Mark selected entries as unread (estate=0) ** */ void webmail_page(void){ int emailid; Stmt q; Blob sql; int showAll = 0; const char *zUser = 0; |
︙ | ︙ | |||
767 768 769 770 771 772 773 | ** WEBPAGE: emailblob ** ** This page, accessible only to administrators, allows easy viewing of ** the emailblob table - the table that contains the text of email messages ** both inbound and outbound, and transcripts of SMTP sessions. ** ** id=N Show the text of emailblob with emailid==N | | | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | ** WEBPAGE: emailblob ** ** This page, accessible only to administrators, allows easy viewing of ** the emailblob table - the table that contains the text of email messages ** both inbound and outbound, and transcripts of SMTP sessions. ** ** id=N Show the text of emailblob with emailid==N ** */ void webmail_emailblob_page(void){ int id = atoi(PD("id","0")); Stmt q; login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); |
︙ | ︙ |
Changes to src/wiki.c.
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | @ Rules for wiki page names: well_formed_wiki_name_rules(); style_footer(); return 1; } return 0; } /* ** WEBPAGE: home ** WEBPAGE: index ** WEBPAGE: not_found ** ** The /home, /index, and /not_found pages all redirect to the homepage | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | @ Rules for wiki page names: well_formed_wiki_name_rules(); style_footer(); return 1; } return 0; } /* ** Return the tagid associated with a particular wiki page. */ int wiki_tagid(const char *zPageName){ return db_int(0, "SELECT tagid FROM tag WHERE tagname='wiki-%q'",zPageName); } int wiki_tagid2(const char *zPrefix, const char *zPageName){ return db_int(0, "SELECT tagid FROM tag WHERE tagname='wiki-%q/%q'", zPrefix, zPageName); } /* ** Return the RID of the next or previous version of a wiki page. ** Return 0 if rid is the last/first version. */ int wiki_next(int tagid, double mtime){ return db_int(0, "SELECT srcid FROM tagxref" " WHERE tagid=%d AND mtime>%.16g" " ORDER BY mtime ASC LIMIT 1", tagid, mtime); } int wiki_prev(int tagid, double mtime){ return db_int(0, "SELECT srcid FROM tagxref" " WHERE tagid=%d AND mtime<%.16g" " ORDER BY mtime DESC LIMIT 1", tagid, mtime); } /* ** WEBPAGE: home ** WEBPAGE: index ** WEBPAGE: not_found ** ** The /home, /index, and /not_found pages all redirect to the homepage |
︙ | ︙ | |||
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 | style_header("Markdown Formatting Rules"); if( fTxt ){ style_submenu_element("Formatted", "%R/md_rules"); }else{ style_submenu_element("Plain-Text", "%R/md_rules?txt=1"); } blob_init(&x, builtin_text("markdown.md"), -1); wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown"); blob_reset(&x); style_footer(); } /* ** WEBPAGE: wiki_rules ** ** Show a summary of the wiki formatting rules. */ void wiki_rules_page(void){ Blob x; int fTxt = P("txt")!=0; style_header("Wiki Formatting Rules"); if( fTxt ){ style_submenu_element("Formatted", "%R/wiki_rules"); }else{ style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1"); } blob_init(&x, builtin_text("wiki.wiki"), -1); wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki"); blob_reset(&x); style_footer(); } /* ** Returns non-zero if moderation is required for wiki changes and wiki ** attachments. */ int wiki_need_moderation( int localUser /* Are we being called for a local interactive user? */ | > > > > > > > > > > > > > > > > | 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 | style_header("Markdown Formatting Rules"); if( fTxt ){ style_submenu_element("Formatted", "%R/md_rules"); }else{ style_submenu_element("Plain-Text", "%R/md_rules?txt=1"); } blob_init(&x, builtin_text("markdown.md"), -1); blob_materialize(&x); wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-markdown"); blob_reset(&x); style_footer(); } /* ** WEBPAGE: wiki_rules ** ** Show a summary of the wiki formatting rules. */ void wiki_rules_page(void){ Blob x; int fTxt = P("txt")!=0; style_header("Wiki Formatting Rules"); if( fTxt ){ style_submenu_element("Formatted", "%R/wiki_rules"); }else{ style_submenu_element("Plain-Text", "%R/wiki_rules?txt=1"); } blob_init(&x, builtin_text("wiki.wiki"), -1); blob_materialize(&x); wiki_render_by_mimetype(&x, fTxt ? "text/plain" : "text/x-fossil-wiki"); blob_reset(&x); style_footer(); } /* ** WEBPAGE: markup_help ** ** Show links to the md_rules and wiki_rules pages. */ void markup_help_page(void){ style_header("Fossil Markup Styles"); @ <ul> @ <li><p>%z(href("%R/wiki_rules"))Fossil Wiki Formatting Rules</a></p></li> @ <li><p>%z(href("%R/md_rules"))Markdown Formatting Rules</a></p></li> @ </ul> style_footer(); } /* ** Returns non-zero if moderation is required for wiki changes and wiki ** attachments. */ int wiki_need_moderation( int localUser /* Are we being called for a local interactive user? */ |
︙ | ︙ | |||
260 261 262 263 264 265 266 | } if( (ok & W_HELP)!=0 ){ style_submenu_element("Help", "%R/wikihelp"); } if( (ok & W_NEW)!=0 && g.anon.NewWiki ){ style_submenu_element("New", "%R/wikinew"); } | < < < < < < < < < < < < < < < | | | | 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 | } if( (ok & W_HELP)!=0 ){ style_submenu_element("Help", "%R/wikihelp"); } if( (ok & W_NEW)!=0 && g.anon.NewWiki ){ style_submenu_element("New", "%R/wikinew"); } if( (ok & W_SANDBOX)!=0 ){ style_submenu_element("Sandbox", "%R/wiki?name=Sandbox"); } } /* ** WEBPAGE: wikihelp ** A generic landing page for wiki. */ void wiki_helppage(void){ login_check_credentials(); if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } style_header("Wiki Help"); wiki_standard_submenu(W_ALL_BUT(W_HELP)); @ <h2>Wiki Links</h2> @ <ul> @ <li> %z(href("%R/timeline?y=w"))Recent changes</a> to wiki pages.</li> @ <li> Formatting rules for %z(href("%R/wiki_rules"))Fossil Wiki</a> and for @ %z(href("%R/md_rules"))Markdown Wiki</a>.</li> @ <li> Use the %z(href("%R/wiki?name=Sandbox"))Sandbox</a> @ to experiment.</li> if( g.perm.NewWiki ){ @ <li> Create a %z(href("%R/wikinew"))new wiki page</a>.</li> if( g.perm.Write ){ @ <li> Create a %z(href("%R/technoteedit"))new tech-note</a>.</li> } } @ <li> %z(href("%R/wcontent"))List of All Wiki Pages</a> @ available on this server.</li> if( g.perm.ModWiki ){ @ <li> %z(href("%R/modreq"))Tend to pending moderation requests</a></li> } if( search_restrict(SRCH_WIKI)!=0 ){ @ <li> %z(href("%R/wikisrch"))Search</a> for wiki pages containing key @ words</li> } @ </ul> |
︙ | ︙ | |||
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | void wiki_srchpage(void){ login_check_credentials(); style_header("Wiki Search"); wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); search_screen(SRCH_WIKI, 0); style_footer(); } /* ** WEBPAGE: wiki ** URL: /wiki?name=PAGENAME */ void wiki_page(void){ char *zTag; int rid = 0; int isSandbox; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < | | 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 | void wiki_srchpage(void){ login_check_credentials(); style_header("Wiki Search"); wiki_standard_submenu(W_HELP|W_LIST|W_SANDBOX); search_screen(SRCH_WIKI, 0); style_footer(); } /* Return values from wiki_page_type() */ #define WIKITYPE_UNKNOWN (-1) #define WIKITYPE_NORMAL 0 #define WIKITYPE_BRANCH 1 #define WIKITYPE_CHECKIN 2 #define WIKITYPE_TAG 3 /* ** Figure out what type of wiki page we are dealing with. */ static int wiki_page_type(const char *zPageName){ if( db_get_boolean("wiki-about",1)==0 ){ return WIKITYPE_NORMAL; }else if( sqlite3_strglob("checkin/*", zPageName)==0 && db_exists("SELECT 1 FROM blob WHERE uuid=%Q",zPageName+8) ){ return WIKITYPE_CHECKIN; }else if( sqlite3_strglob("branch/*", zPageName)==0 ){ return WIKITYPE_BRANCH; }else if( sqlite3_strglob("tag/*", zPageName)==0 ){ return WIKITYPE_TAG; } return WIKITYPE_NORMAL; } /* ** Add an appropriate style_header() for either the /wiki or /wikiedit page ** for zPageName. */ static int wiki_page_header( int eType, /* Page type. -1 for unknown */ const char *zPageName, /* Name of the page */ const char *zExtra /* Extra prefix text on the page header */ ){ if( eType<0 ) eType = wiki_page_type(zPageName); switch( eType ){ case WIKITYPE_NORMAL: { style_header("%s%s", zExtra, zPageName); break; } case WIKITYPE_CHECKIN: { zPageName += 8; style_header("Notes About Checkin %S", zPageName); style_submenu_element("Checkin Timeline","%R/timeline?f=%s", zPageName); style_submenu_element("Checkin Info","%R/info/%s", zPageName); break; } case WIKITYPE_BRANCH: { zPageName += 7; style_header("Notes About Branch %h", zPageName); style_submenu_element("Branch Timeline","%R/timeline?r=%t", zPageName); break; } case WIKITYPE_TAG: { zPageName += 4; style_header("Notes About Tag %h", zPageName); style_submenu_element("Tag Timeline","%R/timeline?t=%t",zPageName); break; } } return eType; } /* ** Wiki pages with special names "branch/...", "checkin/...", and "tag/..." ** requires perm.Write privilege in addition to perm.WrWiki in order ** to write. This function determines whether the extra perm.Write ** is required and available. Return true if writing to the wiki page ** may proceed, and return false if permission is lacking. */ static int wiki_special_permission(const char *zPageName){ if( strncmp(zPageName,"branch/",7)!=0 && strncmp(zPageName,"checkin/",8)!=0 && strncmp(zPageName,"tag/",4)!=0 ){ return 1; } if( db_get_boolean("wiki-about",1)==0 ){ return 1; } return g.perm.Write; } /* ** WEBPAGE: wiki ** URL: /wiki?name=PAGENAME */ void wiki_page(void){ char *zTag; int rid = 0; int isSandbox; unsigned submenuFlags = W_HELP; Blob wiki; Manifest *pWiki = 0; const char *zPageName; const char *zMimetype = 0; char *zBody = mprintf("%s","<i>Empty Page</i>"); login_check_credentials(); |
︙ | ︙ | |||
383 384 385 386 387 388 389 | if( pWiki ){ zBody = pWiki->zWiki; zMimetype = pWiki->zMimetype; } } zMimetype = wiki_filter_mimetypes(zMimetype); if( !g.isHome ){ | < < < < < | > > | | | < | | < < < < < < | < | > > > | | | > | 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 | if( pWiki ){ zBody = pWiki->zWiki; zMimetype = pWiki->zMimetype; } } zMimetype = wiki_filter_mimetypes(zMimetype); if( !g.isHome ){ if( ((rid && g.perm.WrWiki) || (!rid && g.perm.NewWiki)) && wiki_special_permission(zPageName) ){ if( db_get_boolean("wysiwyg-wiki", 0) ){ style_submenu_element("Edit", "%R/wikiedit?name=%T&wysiwyg=1", zPageName); }else{ style_submenu_element("Edit", "%R/wikiedit?name=%T", zPageName); } }else if( rid && g.perm.ApndWiki ){ style_submenu_element("Edit", "%R/wikiappend?name=%T", zPageName); } if( g.perm.Hyperlink ){ style_submenu_element("History", "%R/whistory?name=%T", zPageName); } } style_set_current_page("%T?name=%T", g.zPath, zPageName); wiki_page_header(WIKITYPE_UNKNOWN, zPageName, ""); wiki_standard_submenu(submenuFlags); if( zBody[0]==0 ){ @ <i>This page has been deleted</i> }else{ blob_init(&wiki, zBody, -1); wiki_render_by_mimetype(&wiki, zMimetype); blob_reset(&wiki); } attachment_list(zPageName, "<hr /><h2>Attachments:</h2><ul>"); manifest_destroy(pWiki); style_footer(); } /* ** Write a wiki artifact into the repository |
︙ | ︙ | |||
489 490 491 492 493 494 495 496 497 498 499 500 501 502 | const char *zPageName; int n; const char *z; char *zBody = (char*)P("w"); const char *zMimetype = wiki_filter_mimetypes(P("mimetype")); int isWysiwyg = P("wysiwyg")!=0; int goodCaptcha = 1; if( P("edit-wysiwyg")!=0 ){ isWysiwyg = 1; zBody = 0; } if( P("edit-markup")!=0 ){ isWysiwyg = 0; zBody = 0; } if( zBody ){ if( isWysiwyg ){ Blob body; blob_zero(&body); | > > | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | const char *zPageName; int n; const char *z; char *zBody = (char*)P("w"); const char *zMimetype = wiki_filter_mimetypes(P("mimetype")); int isWysiwyg = P("wysiwyg")!=0; int goodCaptcha = 1; int eType = WIKITYPE_UNKNOWN; int havePreview = 0; if( P("edit-wysiwyg")!=0 ){ isWysiwyg = 1; zBody = 0; } if( P("edit-markup")!=0 ){ isWysiwyg = 0; zBody = 0; } if( zBody ){ if( isWysiwyg ){ Blob body; blob_zero(&body); |
︙ | ︙ | |||
523 524 525 526 527 528 529 530 531 532 533 534 535 536 | zTag = mprintf("wiki-%s", zPageName); rid = db_int(0, "SELECT rid FROM tagxref" " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" " ORDER BY mtime DESC", zTag ); free(zTag); if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){ login_needed(rid ? g.anon.WrWiki : g.anon.NewWiki); return; } if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){ zBody = pWiki->zWiki; zMimetype = pWiki->zMimetype; | > > > > | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | zTag = mprintf("wiki-%s", zPageName); rid = db_int(0, "SELECT rid FROM tagxref" " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" " ORDER BY mtime DESC", zTag ); free(zTag); if( !wiki_special_permission(zPageName) ){ login_needed(0); return; } if( (rid && !g.perm.WrWiki) || (!rid && !g.perm.NewWiki) ){ login_needed(rid ? g.anon.WrWiki : g.anon.NewWiki); return; } if( zBody==0 && (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))!=0 ){ zBody = pWiki->zWiki; zMimetype = pWiki->zMimetype; |
︙ | ︙ | |||
573 574 575 576 577 578 579 | cgi_redirectf("wiki?name=%T", zPageName); } if( P("cancel")!=0 ){ cgi_redirectf("wiki?name=%T", zPageName); return; } if( zBody==0 ){ | | > > > > > | > > > > > | | | | > > > > > > > > > > > > > > > > > > > > | | | > > > | > > | > > > > | 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 | cgi_redirectf("wiki?name=%T", zPageName); } if( P("cancel")!=0 ){ cgi_redirectf("wiki?name=%T", zPageName); return; } if( zBody==0 ){ zBody = mprintf(""); } style_set_current_page("%T?name=%T", g.zPath, zPageName); eType = wiki_page_header(WIKITYPE_UNKNOWN, zPageName, "Edit: "); if( rid && !isSandbox && g.perm.ApndWiki ){ if( g.perm.Attach ){ style_submenu_element("Attach", "%s/attachadd?page=%T&from=%s/wiki%%3fname=%T", g.zTop, zPageName, g.zTop, zPageName); } } if( !goodCaptcha ){ @ <p class="generalError">Error: Incorrect security code.</p> } blob_zero(&wiki); while( fossil_isspace(zBody[0]) ) zBody++; blob_append(&wiki, zBody, -1); if( P("preview")!=0 ){ havePreview = 1; if( zBody[0] ){ @ Preview:<hr /> wiki_render_by_mimetype(&wiki, zMimetype); @ <hr /> blob_reset(&wiki); } } for(n=2, z=zBody; z[0]; z++){ if( z[0]=='\n' ) n++; } if( n<20 ) n = 20; if( n>30 ) n = 30; if( !isWysiwyg ){ /* Traditional markup-only editing */ char *zPlaceholder = 0; switch( eType ){ case WIKITYPE_NORMAL: { zPlaceholder = mprintf("Enter text for wiki page %s", zPageName); break; } case WIKITYPE_BRANCH: { zPlaceholder = mprintf("Enter notes about branch %s", zPageName+7); break; } case WIKITYPE_CHECKIN: { zPlaceholder = mprintf("Enter notes about check-in %.20s", zPageName+8); break; } case WIKITYPE_TAG: { zPlaceholder = mprintf("Enter notes about tag %s", zPageName+4); break; } } form_begin(0, "%R/wikiedit"); @ <div>%z(href("%R/markup_help"))Markup style</a>: mimetype_option_menu(zMimetype); @ <br /><textarea name="w" class="wikiedit" cols="80" \ @ rows="%d(n)" wrap="virtual" placeholder="%h(zPlaceholder)">\ @ %h(zBody)</textarea> @ <br /> fossil_free(zPlaceholder); if( db_get_boolean("wysiwyg-wiki", 0) ){ @ <input type="submit" name="edit-wysiwyg" value="Wysiwyg Editor" @ onclick='return confirm("Switching to WYSIWYG-mode\nwill erase your markup\nedits. Continue?")' /> } @ <input type="submit" name="preview" value="Preview Your Changes" /> }else{ /* Wysiwyg editing */ Blob html, temp; havePreview = 1; form_begin("", "%R/wikiedit"); @ <div> @ <input type="hidden" name="wysiwyg" value="1" /> blob_zero(&temp); wiki_convert(&wiki, &temp, 0); blob_zero(&html); htmlTidy(blob_str(&temp), &html); blob_reset(&temp); wysiwygEditor("w", blob_str(&html), 60, n); blob_reset(&html); @ <br /> @ <input type="submit" name="edit-markup" value="Markup Editor" @ onclick='return confirm("Switching to markup-mode\nwill erase your WYSIWYG\nedits. Continue?")' /> } login_insert_csrf_secret(); if( havePreview ){ if( isWysiwyg || zBody[0] ){ @ <input type="submit" name="submit" value="Apply These Changes" /> }else{ @ <input type="submit" name="submit" value="Delete This Wiki Page" /> } } @ <input type="hidden" name="name" value="%h(zPageName)" /> @ <input type="submit" name="cancel" value="Cancel" @ onclick='confirm("Abandon your changes?")' /> @ </div> captcha_generate(0); @ </form> manifest_destroy(pWiki); |
︙ | ︙ | |||
669 670 671 672 673 674 675 | style_header("Create A New Wiki Page"); wiki_standard_submenu(W_ALL_BUT(W_NEW)); @ <p>Rules for wiki page names:</p> well_formed_wiki_name_rules(); form_begin(0, "%R/wikinew"); @ <p>Name of new wiki page: @ <input style="width: 35;" type="text" name="name" value="%h(zName)" /><br /> | | | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | style_header("Create A New Wiki Page"); wiki_standard_submenu(W_ALL_BUT(W_NEW)); @ <p>Rules for wiki page names:</p> well_formed_wiki_name_rules(); form_begin(0, "%R/wikinew"); @ <p>Name of new wiki page: @ <input style="width: 35;" type="text" name="name" value="%h(zName)" /><br /> @ %z(href("%R/markup_help"))Markup style</a>: mimetype_option_menu("text/x-fossil-wiki"); @ <br /><input type="submit" value="Create" /> @ </p></form> if( zName[0] ){ @ <p><span class="wikiError"> @ "%h(zName)" is not a valid wiki page name!</span></p> } |
︙ | ︙ | |||
841 842 843 844 845 846 847 | @ <input type="submit" name="submit" value="Append Your Changes" /> @ <input type="submit" name="cancel" value="Cancel" /> captcha_generate(0); @ </form> style_footer(); } | < < < < < < < < < < < < < < < > > > > > > | | | < > > > > | | > > | | > | > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > < | > > > > > > > > > | | > < | > | | < < | < < < < < < | < > < > > > > > > > | > > > > > > > > > > > > > > > > > | | | > > > < > | < | | > | > > > | > > | > > | < > | > > > > > > | < > > > > > > > > | > | > > > > > | > > > > > > > > | | > | > > > > > > | > > > > < > | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | @ <input type="submit" name="submit" value="Append Your Changes" /> @ <input type="submit" name="cancel" value="Cancel" /> captcha_generate(0); @ </form> style_footer(); } /* ** WEBPAGE: whistory ** URL: /whistory?name=PAGENAME ** ** Additional parameters: ** ** showid Show RID values ** ** Show the complete change history for a single wiki page. */ void whistory_page(void){ Stmt q; const char *zPageName; double rNow; int showRid; login_check_credentials(); if( !g.perm.Hyperlink ){ login_needed(g.anon.Hyperlink); return; } zPageName = PD("name",""); style_header("History Of %s", zPageName); showRid = P("showid")!=0; db_prepare(&q, "SELECT" " event.mtime," " blob.uuid," " coalesce(event.euser,event.user)," " event.objid" " FROM event, blob, tag, tagxref" " WHERE event.type='w' AND blob.rid=event.objid" " AND tag.tagname='wiki-%q'" " AND tagxref.tagid=tag.tagid AND tagxref.srcid=event.objid" " ORDER BY event.mtime DESC", zPageName ); @ <h2>History of <a href="%R/wiki?name=%T(zPageName)">%h(zPageName)</a></h2> @ <div class="brlist"> @ <table> @ <thead><tr> @ <th>Age</th> @ <th>Hash</th> @ <th>User</th> if( showRid ){ @ <th>RID</th> } @ <th> </th> @ </tr></thead><tbody> rNow = db_double(0.0, "SELECT julianday('now')"); while( db_step(&q)==SQLITE_ROW ){ double rMtime = db_column_double(&q, 0); const char *zUuid = db_column_text(&q, 1); const char *zUser = db_column_text(&q, 2); int wrid = db_column_int(&q, 3); /* sqlite3_int64 iMtime = (sqlite3_int64)(rMtime*86400.0); */ char *zAge = human_readable_age(rNow - rMtime); @ <tr> /* @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> */ @ <td>%s(zAge)</td> fossil_free(zAge); @ <td>%z(href("%R/info/%s",zUuid))%S(zUuid)</a></td> @ <td>%h(zUser)</td> if( showRid ){ @ <td>%z(href("%R/artifact/%S",zUuid))%d(wrid)</a></td> } @ <td>%z(href("%R/wdiff?id=%S",zUuid))diff</a></td> @ </tr> } @ </tbody></table></div> db_finalize(&q); /* style_table_sorter(); */ style_footer(); } /* ** WEBPAGE: wdiff ** ** Show the changes to a wiki page. ** ** Query parameters: ** ** id=HASH Hash prefix for the child version to be diffed. ** rid=INTEGER RecordID for the child version ** pid=HASH Hash prefix for the parent. ** ** The "id" query parameter is required. "pid" is optional. If "pid" ** is omitted, then the diff is against the first parent of the child. */ void wdiff_page(void){ const char *zId; const char *zPid; Manifest *pW1, *pW2 = 0; int rid1, rid2, nextRid; Blob w1, w2, d; u64 diffFlags; login_check_credentials(); if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } zId = P("id"); if( zId==0 ){ rid1 = atoi(PD("rid","0")); }else{ rid1 = name_to_typed_rid(zId, "w"); } zId = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid1); pW1 = manifest_get(rid1, CFTYPE_WIKI, 0); if( pW1==0 ) fossil_redirect_home(); blob_init(&w1, pW1->zWiki, -1); zPid = P("pid"); if( zPid==0 && pW1->nParent ){ zPid = pW1->azParent[0]; } if( zPid ){ char *zDate; rid2 = name_to_typed_rid(zPid, "w"); pW2 = manifest_get(rid2, CFTYPE_WIKI, 0); blob_init(&w2, pW2->zWiki, -1); @ <h2>Changes to \ @ "%z(href("%R/whistory?name=%s",pW1->zWikiTitle))%h(pW1->zWikiTitle)</a>" \ zDate = db_text(0, "SELECT datetime(%.16g)",pW2->rDate); @ between %z(href("%R/info/%s",zPid))%z(zDate)</a> \ zDate = db_text(0, "SELECT datetime(%.16g)",pW1->rDate); @ and %z(href("%R/info/%s",zId))%z(zDate)</a></h2> style_submenu_element("Previous", "%R/wdiff?id=%S", zPid); }else{ blob_zero(&w2); @ <h2>Initial version of \ @ "%z(href("%R/whistory?name=%s",pW1->zWikiTitle))%h(pW1->zWikiTitle)</a>"\ @ </h2> } nextRid = wiki_next(wiki_tagid(pW1->zWikiTitle),pW1->rDate); if( nextRid ){ style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid); } style_header("Changes To %s", pW1->zWikiTitle); blob_zero(&d); diffFlags = construct_diff_flags(1); text_diff(&w2, &w1, &d, 0, diffFlags | DIFF_HTML | DIFF_LINENO); @ <pre class="udiff"> @ %s(blob_str(&d)) @ <pre> manifest_destroy(pW1); manifest_destroy(pW2); style_footer(); } /* ** A query that returns information about all wiki pages. ** ** wname Name of the wiki page ** wsort Sort names by this label ** wrid rid of the most recent version of the page ** wmtime time most recent version was created ** wcnt Number of versions of this wiki page ** ** The wrid value is zero for deleted wiki pages. */ static const char listAllWikiPages[] = @ SELECT @ substr(tag.tagname, 6) AS wname, @ lower(substr(tag.tagname, 6)) AS sortname, @ tagxref.value+0 AS wrid, @ max(tagxref.mtime) AS wmtime, @ count(*) AS wcnt @ FROM @ tag, @ tagxref @ WHERE @ tag.tagname GLOB 'wiki-*' @ AND tagxref.tagid=tag.tagid @ GROUP BY 1 @ ORDER BY 2; ; /* ** WEBPAGE: wcontent ** ** all=1 Show deleted pages ** showid Show rid values for each page. ** ** List all available wiki pages with date created and last modified. */ void wcontent_page(void){ Stmt q; double rNow; int showAll = P("all")!=0; int showRid = P("showid")!=0; login_check_credentials(); if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } style_header("Available Wiki Pages"); if( showAll ){ style_submenu_element("Active", "%s/wcontent", g.zTop); }else{ style_submenu_element("All", "%s/wcontent?all=1", g.zTop); } wiki_standard_submenu(W_ALL_BUT(W_LIST)); db_prepare(&q, listAllWikiPages/*works-like:""*/); @ <div class="brlist"> @ <table class='sortable' data-column-types='tKN' data-init-sort='1'> @ <thead><tr> @ <th>Name</th> @ <th>Last Change</th> @ <th>Versions</th> if( showRid ){ @ <th>RID</th> } @ </tr></thead><tbody> rNow = db_double(0.0, "SELECT julianday('now')"); while( db_step(&q)==SQLITE_ROW ){ const char *zWName = db_column_text(&q, 0); const char *zSort = db_column_text(&q, 1); int wrid = db_column_int(&q, 2); double rWmtime = db_column_double(&q, 3); sqlite3_int64 iMtime = (sqlite3_int64)(rWmtime*86400.0); char *zAge; int wcnt = db_column_int(&q, 4); char *zWDisplayName; if( sqlite3_strglob("checkin/*", zWName)==0 ){ zWDisplayName = mprintf("%.25s...", zWName); }else{ zWDisplayName = mprintf("%s", zWName); } if( wrid==0 ){ if( !showAll ) continue; @ <tr><td data-sortkey="%h(zSort)">\ @ %z(href("%R/whistory?name=%T",zWName))<s>%h(zWDisplayName)</s></a></td> }else{ @ <tr><td data=sortkey='%h(zSort)">\ @ %z(href("%R/wiki?name=%T",zWName))%h(zWDisplayName)</a></td> } zAge = human_readable_age(rNow - rWmtime); @ <td data-sortkey="%016llx(iMtime)">%s(zAge)</td> fossil_free(zAge); @ <td>%z(href("%R/whistory?name=%T",zWName))%d(wcnt)</a></td> if( showRid ){ @ <td>%d(wrid)</td> } @ </tr> fossil_free(zWDisplayName); } @ </tbody></table></div> db_finalize(&q); style_table_sorter(); style_footer(); } /* ** WEBPAGE: wfind ** ** URL: /wfind?title=TITLE |
︙ | ︙ | |||
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | return; }else if( strncmp(g.argv[2],"commit",n)==0 || strncmp(g.argv[2],"create",n)==0 ){ const char *zPageName; /* page name */ Blob content; /* Input content */ int rid = 0; Manifest *pWiki = 0; /* Parsed wiki page content */ const char *zMimeType = find_option("mimetype", "M", 1); const char *zETime = find_option("technote", "t", 1); const char *zTags = find_option("technote-tags", NULL, 1); const char *zClr = find_option("technote-bgcolor", NULL, 1); if( g.argc!=4 && g.argc!=5 ){ usage("commit|create PAGENAME ?FILE? [--mimetype TEXT-FORMAT]" " [--technote DATETIME] [--technote-tags TAGS]" " [--technote-bgcolor COLOR]"); } zPageName = g.argv[3]; if( g.argc==4 ){ blob_read_from_channel(&content, stdin, -1); }else{ blob_read_from_file(&content, g.argv[4], ExtFILE); } | > < < | | | | | | > | < < | | | > | > > > > | | < | | | 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 | return; }else if( strncmp(g.argv[2],"commit",n)==0 || strncmp(g.argv[2],"create",n)==0 ){ const char *zPageName; /* page name */ Blob content; /* Input content */ int rid = 0; Manifest *pWiki = 0; /* Parsed wiki page content */ const int isCreate = 'r'==g.argv[2][1] /* else "commit" */; const char *zMimeType = find_option("mimetype", "M", 1); const char *zETime = find_option("technote", "t", 1); const char *zTags = find_option("technote-tags", NULL, 1); const char *zClr = find_option("technote-bgcolor", NULL, 1); if( g.argc!=4 && g.argc!=5 ){ usage("commit|create PAGENAME ?FILE? [--mimetype TEXT-FORMAT]" " [--technote DATETIME] [--technote-tags TAGS]" " [--technote-bgcolor COLOR]"); } zPageName = g.argv[3]; if( g.argc==4 ){ blob_read_from_channel(&content, stdin, -1); }else{ blob_read_from_file(&content, g.argv[4], ExtFILE); } if ( !zETime ){ rid = db_int(0, "SELECT x.rid FROM tag t, tagxref x" " WHERE x.tagid=t.tagid AND t.tagname='wiki-%q'" " ORDER BY x.mtime DESC LIMIT 1", zPageName ); if( rid>0 ){ pWiki = manifest_get(rid, CFTYPE_WIKI, 0); } }else{ rid = wiki_technote_to_rid(zETime); if( rid>0 ){ pWiki = manifest_get(rid, CFTYPE_EVENT, 0); } } if( !zMimeType || !*zMimeType ){ /* Try to deduce the mime type based on the prior version. */ if( pWiki!=0 && (pWiki->zMimetype && *pWiki->zMimetype) ){ zMimeType = pWiki->zMimetype; } }else{ zMimeType = wiki_filter_mimetypes(zMimeType); } if( isCreate && rid>0 ){ if ( !zETime ){ fossil_fatal("wiki page %s already exists", zPageName); }else{ /* Creating a tech note with same timestamp is permitted and should create a new tech note */ rid = 0; } }else if( !isCreate && rid == 0 ){ if ( !zETime ){ fossil_fatal("no such wiki page: %s", zPageName); }else{ fossil_fatal("no such tech note: %s", zETime); } } |
︙ | ︙ | |||
1362 1363 1364 1365 1366 1367 1368 | return; wiki_cmd_usage: usage("export|create|commit|list ..."); } /* | > > > > > > > > | > > | > > > > > > > > > > > > > | > > | > > > > > > > > > | > > > > > > > > > > > > > > > | > | | | > > > > > > > > > > | | | > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 | return; wiki_cmd_usage: usage("export|create|commit|list ..."); } /* ** Allowed flags for wiki_render_associated */ #if INTERFACE #define WIKIASSOC_FULL_TITLE 0x00001 /* Full title */ #define WIKIASSOC_MENU_READ 0x00002 /* Add submenu link to read wiki */ #define WIKIASSOC_MENU_WRITE 0x00004 /* Add submenu link to add wiki */ #define WIKIASSOC_ALL 0x00007 /* All of the above */ #endif /* ** Show the default Section label for an associated wiki page. */ static void wiki_section_label( const char *zPrefix, /* "branch", "tag", or "checkin" */ const char *zName, /* Name of the object */ unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ ){ if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){ @ <div class="section">About</div> }else if( zPrefix[0]=='c' ){ /* checkin/... */ @ <div class="section">About checkin %.20h(zName)</div> }else{ @ <div class="section">About %s(zPrefix) %h(zName)</div> } } /* ** Add an "Wiki" button in a submenu that links to the read-wiki page. */ static void wiki_submenu_to_read_wiki( const char *zPrefix, /* "branch", "tag", or "checkin" */ const char *zName, /* Name of the object */ unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ ){ if( g.perm.RdWiki && (mFlags & WIKIASSOC_MENU_READ)!=0 ){ style_submenu_element("Wiki", "%R/wiki?name=%s/%t", zPrefix, zName); } } /* ** Check to see if there exists a wiki page with a name zPrefix/zName. ** If there is, then render a <div class='section'>..</div> and ** return true. ** ** If there is no such wiki page, return false. */ int wiki_render_associated( const char *zPrefix, /* "branch", "tag", or "checkin" */ const char *zName, /* Name of the object */ unsigned int mFlags /* Zero or more WIKIASSOC_* flags */ ){ int rid; Manifest *pWiki; if( !db_get_boolean("wiki-about",1) ) return 0; rid = db_int(0, "SELECT rid FROM tagxref" " WHERE tagid=(SELECT tagid FROM tag WHERE tagname='wiki-%q/%q')" " ORDER BY mtime DESC LIMIT 1", zPrefix, zName ); if( rid==0 ){ if( g.perm.WrWiki && g.perm.Write && (mFlags & WIKIASSOC_MENU_WRITE)!=0 ){ style_submenu_element("Add Wiki", "%R/wikiedit?name=%s/%t", zPrefix, zName); } } pWiki = manifest_get(rid, CFTYPE_WIKI, 0); if( pWiki==0 ) return 0; if( fossil_strcmp(pWiki->zMimetype, "text/x-markdown")==0 ){ Blob tail = BLOB_INITIALIZER; Blob title = BLOB_INITIALIZER; Blob markdown; blob_init(&markdown, pWiki->zWiki, -1); markdown_to_html(&markdown, &title, &tail); if( blob_size(&title) ){ @ <div class="section">%h(blob_str(&title))</div> }else{ wiki_section_label(zPrefix, zName, mFlags); } wiki_submenu_to_read_wiki(zPrefix, zName, mFlags); convert_href_and_output(&tail); blob_reset(&tail); blob_reset(&title); blob_reset(&markdown); }else if( fossil_strcmp(pWiki->zMimetype, "text/plain")==0 ){ wiki_section_label(zPrefix, zName, mFlags); wiki_submenu_to_read_wiki(zPrefix, zName, mFlags); @ <pre> @ %h(pWiki->zWiki) @ </pre> }else{ Blob tail = BLOB_INITIALIZER; Blob title = BLOB_INITIALIZER; Blob wiki; Blob *pBody; blob_init(&wiki, pWiki->zWiki, -1); if( wiki_find_title(&wiki, &title, &tail) ){ @ <div class="section">%h(blob_str(&title))</div> pBody = &tail; }else{ wiki_section_label(zPrefix, zName, mFlags); pBody = &wiki; } wiki_submenu_to_read_wiki(zPrefix, zName, mFlags); @ <div class="wiki"> wiki_convert(pBody, 0, WIKI_BUTTONS); @ </div> blob_reset(&tail); blob_reset(&title); blob_reset(&wiki); } manifest_destroy(pWiki); return 1; } |
Changes to src/wikiformat.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | */ #define WIKI_HTMLONLY 0x001 /* HTML markup only. No wiki */ #define WIKI_INLINE 0x002 /* Do not surround with <p>..</p> */ #define WIKI_NOBLOCK 0x004 /* No block markup of any kind */ #define WIKI_BUTTONS 0x008 /* Allow sub-menu buttons */ #define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */ #define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */ #endif /* ** These are the only markup attributes allowed. */ enum allowed_attr_t { | > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | */ #define WIKI_HTMLONLY 0x001 /* HTML markup only. No wiki */ #define WIKI_INLINE 0x002 /* Do not surround with <p>..</p> */ #define WIKI_NOBLOCK 0x004 /* No block markup of any kind */ #define WIKI_BUTTONS 0x008 /* Allow sub-menu buttons */ #define WIKI_NOBADLINKS 0x010 /* Ignore broken hyperlinks */ #define WIKI_LINKSONLY 0x020 /* No markup. Only decorate links */ #define WIKI_NEWLINE 0x040 /* Honor \n - break lines at each \n */ #define WIKI_MARKDOWNLINKS 0x080 /* Resolve hyperlinks as in markdown */ #endif /* ** These are the only markup attributes allowed. */ enum allowed_attr_t { |
︙ | ︙ | |||
523 524 525 526 527 528 529 | ** \n ** [ ** ** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI. ** The "\n" is only considered interesting if the flags constains ALLOW_WIKI. */ static int textLength(const char *z, int flags){ | < < | | < < | | < < < < | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | ** \n ** [ ** ** The "[" is only considered if flags contain ALLOW_LINKS or ALLOW_WIKI. ** The "\n" is only considered interesting if the flags constains ALLOW_WIKI. */ static int textLength(const char *z, int flags){ const char *zReject; if( flags & ALLOW_WIKI ){ zReject = "<&[\n"; }else if( flags & ALLOW_LINKS ){ zReject = "<&["; }else{ zReject = "<&"; } return strcspn(z, zReject); } /* ** Return true if z[] begins with an HTML character element. */ static int isElement(const char *z){ int i; |
︙ | ︙ | |||
679 680 681 682 683 684 685 | } if( (p->state & ALLOW_WIKI)!=0 ){ if( z[0]=='\n' ){ n = paragraphBreakLength(z); if( n>0 ){ *pTokenType = TOKEN_PARAGRAPH; return n; | | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | } if( (p->state & ALLOW_WIKI)!=0 ){ if( z[0]=='\n' ){ n = paragraphBreakLength(z); if( n>0 ){ *pTokenType = TOKEN_PARAGRAPH; return n; }else{ *pTokenType = TOKEN_NEWLINE; return 1; } } if( (p->state & AT_NEWLINE)!=0 && fossil_isspace(z[0]) ){ n = listItemLength(z, '*'); if( n>0 ){ |
︙ | ︙ | |||
828 829 830 831 832 833 834 | }else{ zValue = &z[i]; while( !fossil_isspace(z[i]) && z[i]!='>' ){ z++; } } if( attrOk ){ p->aAttr[p->nAttr].zValue = zValue; p->aAttr[p->nAttr].cTerm = c = z[i]; | > > > | > | | 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 | }else{ zValue = &z[i]; while( !fossil_isspace(z[i]) && z[i]!='>' ){ z++; } } if( attrOk ){ p->aAttr[p->nAttr].zValue = zValue; p->aAttr[p->nAttr].cTerm = c = z[i]; if( z[i]==0 ){ i--; }else{ z[i] = 0; } } i++; } if( attrOk ){ seen |= aAttribute[iACode].iMask; p->nAttr++; } while( fossil_isspace(z[i]) ){ i++; } if( z[i]==0 || z[i]=='>' || (z[i]=='/' && z[i+1]=='>') ) break; } return seen; } /* ** Render markup on the given blob. */ |
︙ | ︙ | |||
863 864 865 866 867 868 869 | blob_appendf(pOut, "=\"%s%s\"", g.zTop, zVal); }else{ blob_appendf(pOut, "=\"%s\"", zVal); } } } if (p->iType & MUTYPE_SINGLE){ | | | | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 | blob_appendf(pOut, "=\"%s%s\"", g.zTop, zVal); }else{ blob_appendf(pOut, "=\"%s\"", zVal); } } } if (p->iType & MUTYPE_SINGLE){ blob_append_string(pOut, " /"); } blob_append_char(pOut, '>'); } } /* ** When the markup was parsed, some "\000" may have been inserted. ** This routine restores to those "\000" values back to their ** original content. |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | /* ** Begin a new paragraph if that something that is needed. */ static void startAutoParagraph(Renderer *p){ if( p->wantAutoParagraph==0 ) return; if( p->state & WIKI_LINKSONLY ) return; if( p->wikiList==MARKUP_OL || p->wikiList==MARKUP_UL ) return; | | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | /* ** Begin a new paragraph if that something that is needed. */ static void startAutoParagraph(Renderer *p){ if( p->wantAutoParagraph==0 ) return; if( p->state & WIKI_LINKSONLY ) return; if( p->wikiList==MARKUP_OL || p->wikiList==MARKUP_UL ) return; blob_append_string(p->pOut, "<p>"); p->wantAutoParagraph = 0; p->inAutoParagraph = 1; } /* ** End a paragraph if we are in one. */ |
︙ | ︙ | |||
1100 1101 1102 1103 1104 1105 1106 | /* ** zTarget is guaranteed to be a UUID. It might be the UUID of a ticket. ** If it is, store in *pClosed a true or false depending on whether or not ** the ticket is closed and return true. If zTarget ** is not the UUID of a ticket, return false. */ | | < | | | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > < < < < | > | | > > > > > > > | | | | | | | | | | | | | > > > > > > > > > > | | > > | > | > | > | > | > | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | /* ** zTarget is guaranteed to be a UUID. It might be the UUID of a ticket. ** If it is, store in *pClosed a true or false depending on whether or not ** the ticket is closed and return true. If zTarget ** is not the UUID of a ticket, return false. */ int is_ticket( const char *zTarget, /* Ticket UUID */ int *pClosed /* True if the ticket is closed */ ){ static Stmt q; int n; int rc; char zLower[HNAME_MAX+1]; char zUpper[HNAME_MAX+1]; n = strlen(zTarget); memcpy(zLower, zTarget, n+1); canonical16(zLower, n+1); memcpy(zUpper, zLower, n+1); zUpper[n-1]++; if( !db_static_stmt_is_init(&q) ){ char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'"); db_static_prepare(&q, "SELECT %z FROM ticket " " WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr", zClosedExpr /*safe-for-%s*/ ); } db_bind_text(&q, ":lwr", zLower); db_bind_text(&q, ":upr", zUpper); if( db_step(&q)==SQLITE_ROW ){ rc = 1; *pClosed = db_column_int(&q, 0); }else{ rc = 0; } db_reset(&q); return rc; } /* ** Return a pointer to the name part of zTarget (skipping the "wiki:" prefix ** if there is one) if zTarget is a valid wiki page name. Return NULL if ** zTarget names a page that does not exist. */ static const char *validWikiPageName(int mFlags, const char *zTarget){ if( strncmp(zTarget, "wiki:", 5)==0 && wiki_name_is_wellformed((const unsigned char*)zTarget) ){ return zTarget+5; } if( strcmp(zTarget, "Sandbox")==0 ) return zTarget; if( wiki_name_is_wellformed((const unsigned char *)zTarget) && ((mFlags & WIKI_NOBADLINKS)==0 || db_exists("SELECT 1 FROM tag WHERE tagname GLOB 'wiki-%q'" " AND (SELECT value FROM tagxref WHERE tagid=tag.tagid" " ORDER BY mtime DESC LIMIT 1) > 0", zTarget)) ){ return zTarget; } return 0; } static const char *wikiOverrideHash = 0; /* ** Fossil-wiki hyperlinks to wiki pages should be overridden to the ** hash value supplied. If the value is NULL, then override is cancelled ** and all overwrites operate normally. */ void wiki_hyperlink_override(const char *zUuid){ wikiOverrideHash = zUuid; } /* ** If links to wiki page zTarget should be redirected to some historical ** version of that page, then return the hash of the historical version. ** If no override is required, return NULL. */ static const char *wiki_is_overridden(const char *zTarget){ if( wikiOverrideHash==0 ) return 0; /* The override should only happen if the override version is not the ** latest version of the wiki page. */ if( !db_exists( "SELECT 1 FROM tag, blob, tagxref AS xA, tagxref AS xB " " WHERE tag.tagname GLOB 'wiki-%q*'" " AND blob.uuid GLOB '%q'" " AND xA.tagid=tag.tagid AND xA.rid=blob.rid" " AND xB.tagid=tag.tagid AND xB.mtime>xA.mtime", zTarget, wikiOverrideHash ) ){ return 0; } return wikiOverrideHash; } /* ** Resolve a hyperlink. The zTarget argument is the content of the [...] ** in the wiki. Append to the output string whatever text is appropriate ** for opening the hyperlink. Write into zClose[0...nClose-1] text that will ** close the markup. ** ** If this routine determines that no hyperlink should be generated, then ** set zClose[0] to 0. ** ** Actually, this routine might or might not append the hyperlink, depending ** on current rendering rules: specifically does the current user have ** "History" permission. ** ** [http://www.fossil-scm.org/] ** [https://www.fossil-scm.org/] ** [ftp://www.fossil-scm.org/] ** [mailto:fossil-users@lists.fossil-scm.org] ** ** [/path] -> Refers to the root of the Fossil hierarchy, not ** the root of the URI domain ** ** [./relpath] ** [../relpath] ** ** [#fragment] ** ** [0123456789abcdef] ** ** [WikiPageName] ** [wiki:WikiPageName] ** ** [2010-02-27 07:13] */ void wiki_resolve_hyperlink( Blob *pOut, /* Write the HTML output here */ int mFlags, /* Rendering option flags */ const char *zTarget, /* Hyperlink target; text within [...] */ char *zClose, /* Write hyperlink closing text here */ int nClose, /* Bytes available in zClose[] */ const char *zOrig, /* Complete document text */ const char *zTitle /* Title of the link */ ){ const char *zTerm = "</a>"; const char *z; char *zExtra = 0; const char *zExtraNS = 0; if( zTitle ){ zExtra = mprintf(" title='%h'", zTitle); zExtraNS = zExtra+1; } assert( nClose>=20 ); if( strncmp(zTarget, "http:", 5)==0 || strncmp(zTarget, "https:", 6)==0 || strncmp(zTarget, "ftp:", 4)==0 || strncmp(zTarget, "mailto:", 7)==0 ){ blob_appendf(pOut, "<a href=\"%s\"%s>", zTarget, zExtra); }else if( zTarget[0]=='/' ){ blob_appendf(pOut, "<a href=\"%R%h\"%s>", zTarget, zExtra); }else if( zTarget[0]=='.' && (zTarget[1]=='/' || (zTarget[1]=='.' && zTarget[2]=='/')) && (mFlags & WIKI_LINKSONLY)==0 ){ blob_appendf(pOut, "<a href=\"%h\"%s>", zTarget, zExtra); }else if( zTarget[0]=='#' ){ blob_appendf(pOut, "<a href=\"%h\"%s>", zTarget, zExtra); }else if( is_valid_hname(zTarget) ){ int isClosed = 0; if( strlen(zTarget)<=HNAME_MAX && is_ticket(zTarget, &isClosed) ){ /* Special display processing for tickets. Display the hyperlink ** as crossed out if the ticket is closed. */ if( isClosed ){ if( g.perm.Hyperlink ){ blob_appendf(pOut, "%z<span class=\"wikiTagCancelled\">[", xhref(zExtraNS,"%R/info/%s",zTarget) ); zTerm = "]</span></a>"; }else{ blob_appendf(pOut,"<span class=\"wikiTagCancelled\">["); zTerm = "]</span>"; } }else{ if( g.perm.Hyperlink ){ blob_appendf(pOut,"%z[", xhref(zExtraNS,"%R/info/%s", zTarget)); zTerm = "]</a>"; }else{ blob_appendf(pOut, "["); zTerm = "]"; } } }else if( !in_this_repo(zTarget) ){ if( (mFlags & (WIKI_LINKSONLY|WIKI_NOBADLINKS))!=0 ){ zTerm = ""; }else{ blob_appendf(pOut, "<span class=\"brokenlink\">["); zTerm = "]</span>"; } }else if( g.perm.Hyperlink ){ blob_appendf(pOut, "%z[",xhref(zExtraNS, "%R/info/%s", zTarget)); zTerm = "]</a>"; }else{ zTerm = ""; } }else if( (z = validWikiPageName(mFlags, zTarget))!=0 ){ /* The link is to a valid wiki page name */ const char *zOverride = wiki_is_overridden(zTarget); if( zOverride ){ blob_appendf(pOut, "<a href=\"%R/info/%S\"%s>", zOverride, zExtra); }else{ blob_appendf(pOut, "<a href=\"%R/wiki?name=%T\"%s>", z, zExtra); } }else if( strlen(zTarget)>=10 && fossil_isdigit(zTarget[0]) && zTarget[4]=='-' && db_int(0, "SELECT datetime(%Q) NOT NULL", zTarget) ){ /* Dates or date-and-times in ISO8610 resolve to a link to the ** timeline for that date */ blob_appendf(pOut, "<a href=\"%R/timeline?c=%T\"%s>", zTarget, zExtra); }else if( mFlags & WIKI_MARKDOWNLINKS ){ /* If none of the above, and if rendering links for markdown, then ** create a link to the literal text of the target */ blob_appendf(pOut, "<a href=\"%h\"%s>", zTarget, zExtra); }else if( zOrig && zTarget>=&zOrig[2] && zTarget[-1]=='[' && !fossil_isspace(zTarget[-2]) ){ /* If the hyperlink markup is not preceded by whitespace, then it ** is probably a C-language subscript or similar, not really a ** hyperlink. Just ignore it. */ zTerm = ""; }else if( (mFlags & (WIKI_NOBADLINKS|WIKI_LINKSONLY))!=0 ){ /* Also ignore the link if various flags are set */ zTerm = ""; }else{ blob_appendf(pOut, "<span class=\"brokenlink\">[%h]", zTarget); zTerm = "</span>"; } if( zExtra ) fossil_free(zExtra); assert( strlen(zTerm)<nClose ); sqlite3_snprintf(nClose, zClose, "%s", zTerm); } /* ** Check to see if the given parsed markup is the correct ** </verbatim> tag. |
︙ | ︙ | |||
1323 1324 1325 1326 1327 1328 1329 | }else{ n = nextWikiToken(z, p, &tokenType); } p->state &= ~(AT_NEWLINE|AT_PARAGRAPH); switch( tokenType ){ case TOKEN_PARAGRAPH: { if( inlineOnly ){ | | | | > > > | > | | | | | | | | | | | 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | }else{ n = nextWikiToken(z, p, &tokenType); } p->state &= ~(AT_NEWLINE|AT_PARAGRAPH); switch( tokenType ){ case TOKEN_PARAGRAPH: { if( inlineOnly ){ /* blob_append_string(p->pOut, " ¶ "); */ blob_append_string(p->pOut, " "); }else{ if( p->wikiList ){ popStackToTag(p, p->wikiList); p->wikiList = 0; } endAutoParagraph(p); blob_append_string(p->pOut, "\n\n"); p->wantAutoParagraph = 1; } p->state |= AT_PARAGRAPH|AT_NEWLINE; break; } case TOKEN_NEWLINE: { if( p->renderFlags & WIKI_NEWLINE ){ blob_append_string(p->pOut, "<br>\n"); }else{ blob_append_string(p->pOut, "\n"); } p->state |= AT_NEWLINE; break; } case TOKEN_BUL_LI: { if( inlineOnly ){ blob_append_string(p->pOut, " • "); }else{ if( p->wikiList!=MARKUP_UL ){ if( p->wikiList ){ popStackToTag(p, p->wikiList); } endAutoParagraph(p); pushStack(p, MARKUP_UL); blob_append_string(p->pOut, "<ul>"); p->wikiList = MARKUP_UL; } popStackToTag(p, MARKUP_LI); startAutoParagraph(p); pushStack(p, MARKUP_LI); blob_append_string(p->pOut, "<li>"); } break; } case TOKEN_NUM_LI: { if( inlineOnly ){ blob_append_string(p->pOut, " # "); }else{ if( p->wikiList!=MARKUP_OL ){ if( p->wikiList ){ popStackToTag(p, p->wikiList); } endAutoParagraph(p); pushStack(p, MARKUP_OL); blob_append_string(p->pOut, "<ol>"); p->wikiList = MARKUP_OL; } popStackToTag(p, MARKUP_LI); startAutoParagraph(p); pushStack(p, MARKUP_LI); blob_append_string(p->pOut, "<li>"); } break; } case TOKEN_ENUM: { if( inlineOnly ){ blob_appendf(p->pOut, " (%d) ", atoi(z)); }else{ if( p->wikiList!=MARKUP_OL ){ if( p->wikiList ){ popStackToTag(p, p->wikiList); } endAutoParagraph(p); pushStack(p, MARKUP_OL); blob_append_string(p->pOut, "<ol>"); p->wikiList = MARKUP_OL; } popStackToTag(p, MARKUP_LI); startAutoParagraph(p); pushStack(p, MARKUP_LI); blob_appendf(p->pOut, "<li value=\"%d\">", atoi(z)); } break; } case TOKEN_INDENT: { if( !inlineOnly ){ assert( p->wikiList==0 ); pushStack(p, MARKUP_BLOCKQUOTE); blob_append_string(p->pOut, "<blockquote>"); p->wantAutoParagraph = 0; p->wikiList = MARKUP_BLOCKQUOTE; } break; } case TOKEN_CHARACTER: { startAutoParagraph(p); if( z[0]=='<' ){ blob_append_string(p->pOut, "<"); }else if( z[0]=='&' ){ blob_append_string(p->pOut, "&"); } break; } case TOKEN_LINK: { char *zTarget; char *zDisplay = 0; int i, j; |
︙ | ︙ | |||
1447 1448 1449 1450 1451 1452 1453 | } z[i] = 0; if( zDisplay==0 ){ zDisplay = zTarget; }else{ while( fossil_isspace(*zDisplay) ) zDisplay++; } | > | | 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | } z[i] = 0; if( zDisplay==0 ){ zDisplay = zTarget; }else{ while( fossil_isspace(*zDisplay) ) zDisplay++; } wiki_resolve_hyperlink(p->pOut, p->state, zTarget, zClose, sizeof(zClose), zOrig, 0); if( linksOnly || zClose[0]==0 || p->inVerbatim ){ if( cS1 ) z[iS1] = cS1; if( zClose[0]!=']' ){ blob_appendf(p->pOut, "[%h]%s", zTarget, zClose); }else{ blob_appendf(p->pOut, "%h%s", zTarget, zClose); } |
︙ | ︙ | |||
1505 1506 1507 1508 1509 1510 1511 | if( markup.iCode==MARKUP_DIV && markup.endTag && (zId = markupId(&markup))!=0 && (iDiv = findTagWithId(p, MARKUP_DIV, zId))>=0 ){ if( p->inVerbatim ){ p->inVerbatim = 0; p->state = p->preVerbState; | | | | | | 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | if( markup.iCode==MARKUP_DIV && markup.endTag && (zId = markupId(&markup))!=0 && (iDiv = findTagWithId(p, MARKUP_DIV, zId))>=0 ){ if( p->inVerbatim ){ p->inVerbatim = 0; p->state = p->preVerbState; blob_append_string(p->pOut, "</pre>"); } while( p->nStack>iDiv+1 ) popStack(p); if( p->aStack[iDiv].allowWiki ){ p->state |= ALLOW_WIKI; }else{ p->state &= ~ALLOW_WIKI; } assert( p->nStack==iDiv+1 ); p->nStack--; }else /* If within <verbatim id=ID> ignore everything other than ** </verbatim id=ID> and the </dev id=ID2> above. */ if( p->inVerbatim ){ if( endVerbatim(p, &markup) ){ p->inVerbatim = 0; p->state = p->preVerbState; blob_append_string(p->pOut, "</pre>"); }else{ unparseMarkup(&markup); blob_append_string(p->pOut, "<"); n = 1; } }else /* Render invalid markup literally. The markup appears in the ** final output as plain text. */ if( markup.iCode==MARKUP_INVALID ){ unparseMarkup(&markup); startAutoParagraph(p); blob_append_string(p->pOut, "<"); n = 1; }else /* If the markup is not font-change markup ignore it if the ** font-change-only flag is set. */ if( (markup.iType&MUTYPE_FONT)==0 && (p->state & FONT_MARKUP_ONLY)!=0 ){ |
︙ | ︙ | |||
1599 1600 1601 1602 1603 1604 1605 | }else if( markup.aAttr[ii].iACode==ATTR_LINKS && !is_false(markup.aAttr[ii].zValue) ){ p->state |= ALLOW_LINKS; } } if( !vAttrDidAppend ) { endAutoParagraph(p); | | | | | 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 | }else if( markup.aAttr[ii].iACode==ATTR_LINKS && !is_false(markup.aAttr[ii].zValue) ){ p->state |= ALLOW_LINKS; } } if( !vAttrDidAppend ) { endAutoParagraph(p); blob_append_string(p->pOut, "<pre class='verbatim'>"); } p->wantAutoParagraph = 0; }else if( markup.iType==MUTYPE_LI ){ if( backupToType(p, MUTYPE_LIST)==0 ){ endAutoParagraph(p); pushStack(p, MARKUP_UL); blob_append_string(p->pOut, "<ul>"); } pushStack(p, MARKUP_LI); renderMarkup(p->pOut, &markup); }else if( markup.iType==MUTYPE_TR ){ if( backupToType(p, MUTYPE_TABLE) ){ pushStack(p, MARKUP_TR); renderMarkup(p->pOut, &markup); } }else if( markup.iType==MUTYPE_TD ){ if( backupToType(p, MUTYPE_TABLE|MUTYPE_TR) ){ if( stackTopType(p)==MUTYPE_TABLE ){ pushStack(p, MARKUP_TR); blob_append_string(p->pOut, "<tr>"); } pushStack(p, markup.iCode); renderMarkup(p->pOut, &markup); } }else if( markup.iType==MUTYPE_HYPERLINK ){ if( !isButtonHyperlink(p, &markup, z, &n) ){ |
︙ | ︙ | |||
1700 1701 1702 1703 1704 1705 1706 | blob_to_utf8_no_bom(pIn, 0); wiki_render(&renderer, blob_str(pIn)); endAutoParagraph(&renderer); while( renderer.nStack ){ popStack(&renderer); } | | < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 | blob_to_utf8_no_bom(pIn, 0); wiki_render(&renderer, blob_str(pIn)); endAutoParagraph(&renderer); while( renderer.nStack ){ popStack(&renderer); } blob_append_char(renderer.pOut, '\n'); free(renderer.aStack); } /* ** COMMAND: test-wiki-render ** ** Usage: %fossil test-wiki-render FILE [OPTIONS] ** ** Translate the input FILE from Fossil-wiki into HTML and write ** the resulting HTML on standard output. ** ** Options: ** --buttons Set the WIKI_BUTTONS flag ** --htmlonly Set the WIKI_HTMLONLY flag ** --linksonly Set the WIKI_LINKSONLY flag ** --nobadlinks Set the WIKI_NOBADLINKS flag ** --inline Set the WIKI_INLINE flag ** --noblock Set the WIKI_NOBLOCK flag */ void test_wiki_render(void){ Blob in, out; int flags = 0; if( find_option("buttons",0,0)!=0 ) flags |= WIKI_BUTTONS; if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY; if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY; if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS; if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE; if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK; db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); verify_all_options(); if( g.argc!=3 ) usage("FILE"); blob_zero(&out); blob_read_from_file(&in, g.argv[2], ExtFILE); wiki_convert(&in, &out, flags); blob_write_to_file(&out, "-"); } /* ** COMMAND: test-markdown-render ** ** Usage: %fossil test-markdown-render FILE ** ** Render markdown in FILE as HTML on stdout. */ void test_markdown_render(void){ Blob in, out; db_find_and_open_repository(OPEN_OK_NOT_FOUND|OPEN_SUBSTITUTE,0); verify_all_options(); if( g.argc!=3 ) usage("FILE"); blob_zero(&out); blob_read_from_file(&in, g.argv[2], ExtFILE); markdown_to_html(&in, 0, &out); blob_write_to_file(&out, "-"); blob_reset(&in); blob_reset(&out); } /* ** Search for a <title>...</title> at the beginning of a wiki page. ** Return true (nonzero) if a title is found. Return zero if there is ** not title. ** ** If a title is found, initialize the pTitle blob to be the content |
︙ | ︙ | |||
1960 1961 1962 1963 1964 1965 1966 | } z += n; } free(renderer.aStack); } /* | | < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 | } z += n; } free(renderer.aStack); } /* ** Return the length, in bytes, of the HTML token that z is pointing to. */ int html_token_length(const char *z){ int n; char c; if( (c=z[0])=='<' ){ n = htmlTagLength(z); if( n<=0 ) n = 1; }else if( fossil_isspace(c) ){ for(n=1; z[n] && fossil_isspace(z[n]); n++){} }else if( c=='&' ){ n = z[1]=='#' ? 2 : 1; while( fossil_isalnum(z[n]) ) n++; if( z[n]==';' ) n++; }else{ n = 1; for(n=1; 1; n++){ if( (c = z[n]) > '<' ) continue; if( c=='<' || c=='&' || fossil_isspace(c) || c==0 ) break; } } return n; } /* ** z points to someplace in the middle of HTML markup. Return the length ** of the subtoken that starts on z. */ int html_subtoken_length(const char *z){ int n; char c; c = z[0]; if( fossil_isspace(c) ){ for(n=1; z[n] && fossil_isspace(z[n]); n++){} return n; } if( c=='"' || c=='\'' ){ for(n=1; z[n] && z[n]!=c && z[n]!='>'; n++){} if( z[n]==c ) n++; return n; } if( c=='>' ){ return 0; } if( c=='=' ){ return 1; } if( fossil_isalnum(c) || c=='/' ){ for(n=1; (c=z[n])!=0 && (fossil_isalnum(c) || c=='-' || c=='_'); n++){} return n; } return 1; } /* ** z points to an HTML markup token: <TAG ATTR=VALUE ...> ** This routine looks for the VALUE associated with zAttr and returns ** a pointer to the start of that value and sets *pLen to be the length ** in bytes for the value. Or it returns NULL if no such attr exists. */ const char *html_attribute(const char *zMarkup, const char *zAttr, int *pLen){ int i = 1; int n; int nAttr; int iMatchCnt = 0; assert( zMarkup[0]=='<' ); assert( zMarkup[1]!=0 ); n = html_subtoken_length(zMarkup+i); if( n==0 ) return 0; i += n; nAttr = (int)strlen(zAttr); while( 1 ){ const char *zStart = zMarkup+i; n = html_subtoken_length(zStart); if( n==0 ) break; i += n; if( fossil_isspace(zStart[0]) ) continue; if( n==nAttr && fossil_strnicmp(zAttr,zStart,nAttr)==0 ){ iMatchCnt = 1; }else if( n==1 && zStart[0]=='=' && iMatchCnt==1 ){ iMatchCnt = 2; }else if( iMatchCnt==2 ){ if( (zStart[0]=='"' || zStart[0]=='\'') && zStart[n-1]==zStart[0] ){ zStart++; n -= 2; } *pLen = n; return zStart; }else{ iMatchCnt = 0; } } return 0; } /* ** COMMAND: test-html-tokenize ** ** Tokenize an HTML file. Return the offset and length and text of ** each token - one token per line. Omit white-space tokens. */ void test_html_tokenize(void){ Blob in; char *z; int i; int iOfst, n; for(i=2; i<g.argc; i++){ blob_read_from_file(&in, g.argv[i], ExtFILE); z = blob_str(&in); for(iOfst=0; z[iOfst]; iOfst+=n){ n = html_token_length(z+iOfst); if( fossil_isspace(z[iOfst]) ) continue; fossil_print("%d %d %.*s\n", iOfst, n, n, z+iOfst); if( z[iOfst]=='<' && n>1 ){ int j,k; for(j=iOfst+1; (k = html_subtoken_length(z+j))>0; j+=k){ if( fossil_isspace(z[j]) || z[j]=='=' ) continue; fossil_print("# %d %d %.*s\n", j, k, k, z+j); } } } blob_reset(&in); } } /* ** Attempt to reformat messy HTML to be easily readable by humans. ** ** * Try to keep lines less than 80 characters in length ** * Collapse white space into a single space ** * Put a blank line before: |
︙ | ︙ | |||
2008 2009 2010 2011 2012 2013 2014 | void htmlTidy(const char *zIn, Blob *pOut){ int n; int nPre = 0; int iCur = 0; int wantSpace = 0; int omitSpace = 1; while( zIn[0] ){ | | | | | | | | | | | | 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 | void htmlTidy(const char *zIn, Blob *pOut){ int n; int nPre = 0; int iCur = 0; int wantSpace = 0; int omitSpace = 1; while( zIn[0] ){ n = html_token_length(zIn); if( zIn[0]=='<' && n>1 ){ int i, j; int isCloseTag; int eTag; int eType; char zTag[32]; isCloseTag = zIn[1]=='/'; for(i=0, j=1+isCloseTag; i<30 && fossil_isalnum(zIn[j]); i++, j++){ zTag[i] = fossil_tolower(zIn[j]); } zTag[i] = 0; eTag = findTag(zTag); eType = aMarkup[eTag].iType; if( eTag==MARKUP_PRE ){ if( isCloseTag ){ nPre--; blob_append(pOut, zIn, n); zIn += n; if( nPre==0 ){ blob_append_char(pOut, '\n'); iCur = 0; } continue; }else{ if( iCur && nPre==0 ){ blob_append_char(pOut, '\n'); iCur = 0; } nPre++; } }else if( eType & (MUTYPE_BLOCK|MUTYPE_TABLE) ){ if( !isCloseTag && nPre==0 && blob_size(pOut)>0 ){ blob_append(pOut, "\n\n", 1 + (iCur>0)); iCur = 0; } wantSpace = 0; omitSpace = 1; }else if( (eType & (MUTYPE_LIST|MUTYPE_LI|MUTYPE_TR|MUTYPE_TD))!=0 || eTag==MARKUP_HR ){ if( nPre==0 && (!isCloseTag || (eType&MUTYPE_LIST)!=0) && iCur>0 ){ blob_append_char(pOut, '\n'); iCur = 0; } wantSpace = 0; omitSpace = 1; } if( wantSpace && nPre==0 ){ if( iCur+n+1>=80 ){ blob_append_char(pOut, '\n'); iCur = 0; }else{ blob_append_char(pOut, ' '); iCur++; } } blob_append(pOut, zIn, n); iCur += n; wantSpace = 0; if( eTag==MARKUP_BR || eTag==MARKUP_HR ){ blob_append_char(pOut, '\n'); iCur = 0; } }else if( fossil_isspace(zIn[0]) ){ if( nPre ){ blob_append(pOut, zIn, n); }else{ wantSpace = !omitSpace; } }else{ if( wantSpace && nPre==0 ){ if( iCur+n+1>=80 ){ blob_append_char(pOut, '\n'); iCur = 0; }else{ blob_append_char(pOut, ' '); iCur++; } } blob_append(pOut, zIn, n); iCur += n; wantSpace = omitSpace = 0; } zIn += n; } if( iCur ) blob_append_char(pOut, '\n'); } /* ** COMMAND: test-html-tidy ** ** Run the htmlTidy() routine on the content of all files named on ** the command-line and write the results to standard output. |
︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 | int i, j; int inTitle = 0; /* True between <title>...</title> */ int seenText = 0; /* True after first non-whitespace seen */ int nNL = 0; /* Number of \n characters at the end of pOut */ int nWS = 0; /* True if pOut ends with whitespace */ while( fossil_isspace(zIn[0]) ) zIn++; while( zIn[0] ){ | | | | | | 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 | int i, j; int inTitle = 0; /* True between <title>...</title> */ int seenText = 0; /* True after first non-whitespace seen */ int nNL = 0; /* Number of \n characters at the end of pOut */ int nWS = 0; /* True if pOut ends with whitespace */ while( fossil_isspace(zIn[0]) ) zIn++; while( zIn[0] ){ n = html_token_length(zIn); if( zIn[0]=='<' && n>1 ){ int isCloseTag; int eTag; int eType; char zTag[32]; isCloseTag = zIn[1]=='/'; for(i=0, j=1+isCloseTag; i<30 && fossil_isalnum(zIn[j]); i++, j++){ zTag[i] = fossil_tolower(zIn[j]); } zTag[i] = 0; eTag = findTag(zTag); eType = aMarkup[eTag].iType; if( eTag==MARKUP_INVALID && fossil_strnicmp(zIn,"<style",6)==0 ){ zIn += n; while( zIn[0] ){ n = html_token_length(zIn); if( fossil_strnicmp(zIn, "</style",7)==0 ) break; zIn += n; } if( zIn[0]=='<' ) zIn += n; continue; } if( eTag==MARKUP_TITLE ){ inTitle = !isCloseTag; } if( !isCloseTag && seenText && (eType & (MUTYPE_BLOCK|MUTYPE_TABLE))!=0 ){ if( nNL==0 ){ blob_append_char(pOut, '\n'); nNL++; } nWS = 1; } }else if( fossil_isspace(zIn[0]) ){ if( seenText ){ nNL = 0; if( !inTitle ){ /* '\n' -> ' ' within <title> */ for(i=0; i<n; i++) if( zIn[i]=='\n' ) nNL++; } if( !nWS ){ blob_append_char(pOut, nNL ? '\n' : ' '); nWS = 1; } } }else if( zIn[0]=='&' ){ char c = '?'; if( zIn[1]=='#' ){ int x = atoi(&zIn[1]); |
︙ | ︙ | |||
2192 2193 2194 2195 2196 2197 2198 | if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){ c = aEntity[jj].c; break; } } } if( fossil_isspace(c) ){ | | | | | | | 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 | if( aEntity[jj].n==n && strncmp(aEntity[jj].z,zIn,n)==0 ){ c = aEntity[jj].c; break; } } } if( fossil_isspace(c) ){ if( nWS==0 && seenText ) blob_append_char(pOut, c); nWS = 1; nNL = c=='\n'; }else{ if( !seenText && !inTitle ) blob_append_char(pOut, '\n'); seenText = 1; nNL = nWS = 0; blob_append_char(pOut, c); } }else{ if( !seenText && !inTitle ) blob_append_char(pOut, '\n'); seenText = 1; nNL = nWS = 0; blob_append(pOut, zIn, n); } zIn += n; } if( nNL==0 ) blob_append_char(pOut, '\n'); } /* ** COMMAND: test-html-to-text ** ** Usage: %fossil test-html-to-text FILE ... ** |
︙ | ︙ |
Changes to src/winhttp.c.
︙ | ︙ | |||
201 202 203 204 205 206 207 | }; /* ** Accepts connections on DualSocket. */ static void DualSocket_accept(DualSocket* pListen, DualSocket* pClient, DualAddr* pClientAddr){ | | | | | | | 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 | }; /* ** Accepts connections on DualSocket. */ static void DualSocket_accept(DualSocket* pListen, DualSocket* pClient, DualAddr* pClientAddr){ fd_set rs; int rs_count = 0; assert( pListen!=NULL && pClient!=NULL && pClientAddr!= NULL ); DualSocket_init(pClient); DualAddr_init(pClientAddr); FD_ZERO(&rs); if( pListen->s4!=INVALID_SOCKET ){ FD_SET(pListen->s4, &rs); ++rs_count; } if( pListen->s6!=INVALID_SOCKET ){ FD_SET(pListen->s6, &rs); ++rs_count; } if( select(rs_count, &rs, 0, 0, 0 /*blocking*/)==SOCKET_ERROR ){ return; } if( FD_ISSET(pListen->s4, &rs) ){ pClient->s4 = accept(pListen->s4, (struct sockaddr*)&pClientAddr->a4.addr, &pClientAddr->a4.len); } if( FD_ISSET(pListen->s6, &rs) ){ pClient->s6 = accept(pListen->s6, (struct sockaddr*)&pClientAddr->a6.addr, |
︙ | ︙ | |||
533 534 535 536 537 538 539 540 541 542 543 544 545 546 | const char *zSkin; #if USE_SEE const char *zSavedKey = 0; size_t savedKeySize = 0; #endif blob_zero(&options); if( zBaseUrl ){ blob_appendf(&options, " --baseurl %s", zBaseUrl); } if( zNotFound ){ blob_appendf(&options, " --notfound %s", zNotFound); } if( zFileGlob ){ | > > > | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | const char *zSkin; #if USE_SEE const char *zSavedKey = 0; size_t savedKeySize = 0; #endif blob_zero(&options); if( PB("HTTPS") ){ blob_appendf(&options, " --https"); } if( zBaseUrl ){ blob_appendf(&options, " --baseurl %s", zBaseUrl); } if( zNotFound ){ blob_appendf(&options, " --notfound %s", zNotFound); } if( zFileGlob ){ |
︙ | ︙ |
Changes to src/wysiwyg.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 | @ padding: 12px; @ } @ #editMode label { cursor: pointer; } @ </style> @ <input id="wysiwygValue" type="hidden" name="%s(zId)"> @ <div id="editModeDiv">Edit mode: | | | < | < | < | < | | | < | | | | < | < | < | | | | < | < | < | < < | < | < | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | @ padding: 12px; @ } @ #editMode label { cursor: pointer; } @ </style> @ <input id="wysiwygValue" type="hidden" name="%s(zId)"> @ <div id="editModeDiv">Edit mode: @ <select id="editMode" size=1> @ <option value="0">WYSIWYG</option> @ <option value="1">Raw HTML</option> @ </select></div> @ <div id="toolBar1"> @ <select class="format" data-format="formatblock"> @ <option selected>- formatting -</option> @ <option value="h1">Title 1 <h1></option> @ <option value="h2">Title 2 <h2></option> @ <option value="h3">Title 3 <h3></option> @ <option value="h4">Title 4 <h4></option> @ <option value="h5">Title 5 <h5></option> @ <option value="h6">Subtitle <h6></option> @ <option value="p">Paragraph <p></option> @ <option value="pre">Preformatted <pre></option> @ </select> @ <select class="format" data-format="fontname"> @ <option class="heading" selected>- font -</option> @ <option>Arial</option> @ <option>Arial Black</option> @ <option>Courier New</option> @ <option>Times New Roman</option> @ </select> @ <select class="format" data-format="fontsize"> @ <option class="heading" selected>- size -</option> @ <option value="1">Very small</option> @ <option value="2">A bit small</option> @ <option value="3">Normal</option> @ <option value="4">Medium-large</option> @ <option value="5">Big</option> @ <option value="6">Very big</option> @ <option value="7">Maximum</option> @ </select> @ <select class="format" data-format="forecolor"> @ <option class="heading" selected>- color -</option> @ <option value="red">Red</option> @ <option value="blue">Blue</option> @ <option value="green">Green</option> @ <option value="black">Black</option> @ </select> @ </div> @ <div id="toolBar2"> @ <img class="intLink" title="Undo" data-format="undo" @ src="data:image/gif;base64,R0lGODlhFgAWAOMKADljwliE33mOrpGjuYKl8aezxqPD+7 @ /I19DV3NHa7P///////////////////////yH5BAEKAA8ALAAAAAAWABYAAARR8MlJq704680 @ 7TkaYeJJBnES4EeUJvIGapWYAC0CsocQ7SDlWJkAkCA6ToMYWIARGQF3mRQVIEjkkSVLIbSfE @ whdRIH4fh/DZMICe3/C4nBQBADs="> @ <img class="intLink" title="Redo" data-format="redo" @ src="data:image/gif;base64,R0lGODlhFgAWAMIHAB1ChDljwl9vj1iE34Kl8aPD+7/I1/ @ ///yH5BAEKAAcALAAAAAAWABYAAANKeLrc/jDKSesyphi7SiEgsVXZEATDICqBVJjpqWZt9Na @ EDNbQK1wCQsxlYnxMAImhyDoFAElJasRRvAZVRqqQXUy7Cgx4TC6bswkAOw=="> @ <img class="intLink" title="Remove formatting" data-format="removeFormat" @ src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AA @ AABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwA @ AAAd0SU1FB9oECQMCKPI8CIIAAAAIdEVYdENvbW1lbnQA9syWvwAAAuhJREFUOMtjYBgFxAB5 @ 01ZWBvVaL2nHnlmk6mXCJbF69zU+Hz/9fB5O1lx+bg45qhl8/fYr5it3XrP/YWTUvvvk3VeqG @ Xz70TvbJy8+Wv39+2/Hz19/mGwjZzuTYjALuoBv9jImaXHeyD3H7kU8fPj2ICML8z92dlbtMz @ deiG3fco7J08foH1kurkm3E9iw54YvKwuTuom+LPt/BgbWf3//sf37/1/c02cCG1lB8f//f95 @ DZx74MTMzshhoSm6szrQ/a6Ir/Z2RkfEjBxuLYFpDiDi6Af///2ckaHBp7+7wmavP5n76+P2C @ lrLIYl8H9W36auJCbCxM4szMTJac7Kza////R3H1w2cfWAgafPbqs5g7D95++/P1B4+ECK8tA @ wMDw/1H7159+/7r7ZcvPz4fOHbzEwMDwx8GBgaGnNatfHZx8zqrJ+4VJBh5CQEGOySEua/v3n @ 7hXmqI8WUGBgYGL3vVG7fuPK3i5GD9/fja7ZsMDAzMG/Ze52mZeSj4yu1XEq/ff7W5dvfVAS1 @ lsXc4Db7z8C3r8p7Qjf///2dnZGxlqJuyr3rPqQd/Hhyu7oSpYWScylDQsd3kzvnH738wMDzj @ 5GBN1VIWW4c3KDon7VOvm7S3paB9u5qsU5/x5KUnlY+eexQbkLNsErK61+++VnAJcfkyMTIwf @ fj0QwZbJDKjcETs1Y8evyd48toz8y/ffzv//vPP4veffxpX77z6l5JewHPu8MqTDAwMDLzyrj @ b/mZm0JcT5Lj+89+Ybm6zz95oMh7s4XbygN3Sluq4Mj5K8iKMgP4f0////fv77//8nLy+7MCc @ XmyYDAwODS9jM9tcvPypd35pne3ljdjvj26+H2dhYpuENikgfvQeXNmSl3tqepxXsqhXPyc66 @ 6s+fv1fMdKR3TK72zpix8nTc7bdfhfkEeVbC9KhbK/9iYWHiErbu6MWbY/7//8/4//9/pgOnH @ 6jGVazvFDRtq2VgiBIZrUTIBgCk+ivHvuEKwAAAAABJRU5ErkJggg=="> @ <img class="intLink" title="Bold" data-format="bold" @ src="data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB @ YAQAInhI+pa+H9mJy0LhdgtrxzDG5WGFVk6aXqyk6Y9kXvKKNuLbb6zgMFADs=" /> @ <img class="intLink" title="Italic" data-format="italic" @ src="data:image/gif;base64,R0lGODlhFgAWAKEDAAAAAF9vj5WIbf///yH5BAEAAAMALA @ AAAAAWABYAAAIjnI+py+0Po5x0gXvruEKHrF2BB1YiCWgbMFIYpsbyTNd2UwAAOw==" /> @ <img class="intLink" title="Underline" data-format="underline" @ src="data:image/gif;base64,R0lGODlhFgAWAKECAAAAAF9vj////////yH5BAEAAAIALA @ AAAAAWABYAAAIrlI+py+0Po5zUgAsEzvEeL4Ea15EiJJ5PSqJmuwKBEKgxVuXWtun+DwxCCgA @ 7" /> @ <img class="intLink" title="Left align" data-format="justifyleft" @ src="data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB @ YAQAIghI+py+0Po5y02ouz3jL4D4JMGELkGYxo+qzl4nKyXAAAOw==" /> @ <img class="intLink" title="Center align" data-format="justifycenter" @ src="data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB @ YAQAIfhI+py+0Po5y02ouz3jL4D4JOGI7kaZ5Bqn4sycVbAQA7" /> @ <img class="intLink" title="Right align" data-format="justifyright" @ src="data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWAB @ YAQAIghI+py+0Po5y02ouz3jL4D4JQGDLkGYxouqzl43JyVgAAOw==" /> @ <img class="intLink" title="Numbered list" @ data-format="insertorderedlist" @ src="data:image/gif;base64,R0lGODlhFgAWAMIGAAAAADljwliE35GjuaezxtHa7P//// @ ///yH5BAEAAAcALAAAAAAWABYAAAM2eLrc/jDKSespwjoRFvggCBUBoTFBeq6QIAysQnRHaEO @ zyaZ07Lu9lUBnC0UGQU1K52s6n5oEADs=" /> @ <img class="intLink" title="Dotted list" @ data-format="insertunorderedlist" @ src="data:image/gif;base64,R0lGODlhFgAWAMIGAAAAAB1ChF9vj1iE33mOrqezxv//// @ ///yH5BAEAAAcALAAAAAAWABYAAAMyeLrc/jDKSesppNhGRlBAKIZRERBbqm6YtnbfMY7lud6 @ 4UwiuKnigGQliQuWOyKQykgAAOw==" /> @ <img class="intLink" title="Quote" data-format="formatblock" @ src="data:image/gif;base64,R0lGODlhFgAWAIQXAC1NqjFRjkBgmT9nqUJnsk9xrFJ7u2 @ R9qmKBt1iGzHmOrm6Sz4OXw3Odz4Cl2ZSnw6KxyqO306K63bG70bTB0rDI3bvI4P///////// @ //////////////////////////yH5BAEKAB8ALAAAAAAWABYAAAVP4CeOZGmeaKqubEs2Cekk @ ErvEI1zZuOgYFlakECEZFi0GgTGKEBATFmJAVXweVOoKEQgABB9IQDCmrLpjETrQQlhHjINrT @ q/b7/i8fp8PAQA7" /> @ <img class="intLink" title="Delete indentation" data-format="outdent" @ src="data:image/gif;base64,R0lGODlhFgAWAMIHAAAAADljwliE35GjuaezxtDV3NHa7P @ ///yH5BAEAAAcALAAAAAAWABYAAAM2eLrc/jDKCQG9F2i7u8agQgyK1z2EIBil+TWqEMxhMcz @ sYVJ3e4ahk+sFnAgtxSQDqWw6n5cEADs=" /> @ <img class="intLink" title="Add indentation" data-format="indent" @ src="data:image/gif;base64,R0lGODlhFgAWAOMIAAAAADljwl9vj1iE35GjuaezxtDV3N @ Ha7P///////////////////////////////yH5BAEAAAgALAAAAAAWABYAAAQ7EMlJq704650 @ B/x8gemMpgugwHJNZXodKsO5oqUOgo5KhBwWESyMQsCRDHu9VOyk5TM9zSpFSr9gsJwIAOw=="> @ <img class="intLink" title="Hyperlink" data-format="createlink" @ src="data:image/gif;base64,R0lGODlhFgAWAOMKAB1ChDRLY19vj3mOrpGjuaezxrCztb @ /I19Ha7Pv8/f///////////////////////yH5BAEKAA8ALAAAAAAWABYAAARY8MlJq704682 @ 7/2BYIQVhHg9pEgVGIklyDEUBy/RlE4FQF4dCj2AQXAiJQDCWQCAEBwIioEMQBgSAFhDAGghG @ i9XgHAhMNoSZgJkJei33UESv2+/4vD4TAQA7" /> #if 0 /* Cut/Copy/Paste requires special browser permissions for security ** reasons. So omit these buttons */ @ <img class="intLink" title="Cut" data-format="cut" @ src="data:image/gif;base64,R0lGODlhFgAWAIQSAB1ChBFNsRJTySJYwjljwkxwl19vj1 @ dusYODhl6MnHmOrpqbmpGjuaezxrCztcDCxL/I18rL1P///////////////////////////// @ //////////////////////////yH5BAEAAB8ALAAAAAAWABYAAAVu4CeOZGmeaKqubDs6TNnE @ bGNApNG0kbGMi5trwcA9GArXh+FAfBAw5UexUDAQESkRsfhJPwaH4YsEGAAJGisRGAQY7UCC9 @ ZAXBB+74LGCRxIEHwAHdWooDgGJcwpxDisQBQRjIgkDCVlfmZqbmiEAOw==" /> @ <img class="intLink" title="Copy" data-format="copy" @ src="data:image/gif;base64,R0lGODlhFgAWAIQcAB1ChBFNsTRLYyJYwjljwl9vj1iE31 @ iGzF6MnHWX9HOdz5GjuYCl2YKl8ZOt4qezxqK63aK/9KPD+7DI3b/I17LM/MrL1MLY9NHa7OP @ s++bx/Pv8/f///////////////yH5BAEAAB8ALAAAAAAWABYAAAWG4CeOZGmeaKqubOum1SQ/ @ kPVOW749BeVSus2CgrCxHptLBbOQxCSNCCaF1GUqwQbBd0JGJAyGJJiobE+LnCaDcXAaEoxhQ @ ACgNw0FQx9kP+wmaRgYFBQNeAoGihCAJQsCkJAKOhgXEw8BLQYciooHf5o7EA+kC40qBKkAAA @ Grpy+wsbKzIiEAOw==" /> @ <img class="intLink" title="Paste" data-format="paste" @ src="data:image/gif;base64,R0lGODlhFgAWAIQUAD04KTRLY2tXQF9vj414WZWIbXmOrp @ qbmpGjudClFaezxsa0cb/I1+3YitHa7PrkIPHvbuPs+/fvrvv8/f///////////////////// @ //////////////////////////yH5BAEAAB8ALAAAAAAWABYAAAWN4CeOZGmeaKqubGsusPvB @ SyFJjVDs6nJLB0khR4AkBCmfsCGBQAoCwjF5gwquVykSFbwZE+AwIBV0GhFog2EwIDchjwRiQ @ o9E2Fx4XD5R+B0DDAEnBXBhBhN2DgwDAQFjJYVhCQYRfgoIDGiQJAWTCQMRiwwMfgicnVcAAA @ MOaK+bLAOrtLUyt7i5uiUhADs=" /> #endif @ </div> @ <div id="wysiwygBox" @ style="resize:both;overflow:auto;width:95%%;min-height:%d(h)em;" @ contenteditable="true">%s(zContent)</div> @ <script nonce="%h(style_nonce())"> @ var oDoc; @ @ /* Initialize the document editor */ @ function initDoc() { @ initEventHandlers(); @ oDoc = document.getElementById("wysiwygBox"); @ if (!isWysiwyg()) { setDocMode(true); } @ } @ @ function initEventHandlers() { @ document.querySelector('form').onsubmit = wysiwygSubmit; @ document.querySelector('#editMode').onchange = function() { @ setDocMode(this.selectedIndex) @ }; @ var controls = document.querySelectorAll('select.format'); @ for(var i = 0; i < controls.length; i++) { @ controls[i].onchange = handleDropDown; @ } @ controls = document.querySelectorAll('.intLink'); @ for(i = 0; i < controls.length; i++) { @ controls[i].onclick = handleFormatButton; @ } @ @ function handleDropDown() { @ formatDoc(this.dataset.format,this[this.selectedIndex].value); @ this.selectedIndex = 0; @ } @ @ function handleFormatButton() { @ var extra; @ switch (this.dataset.format) { @ case 'createlink': @ var sLnk = prompt('Target URL:',''); @ if(sLnk && sLnk != '') @ { @ extra = sLnk; @ } @ break; @ case 'formatblock': @ extra = 'blockquote'; @ break; @ } @ formatDoc(this.dataset.format, extra); @ } @ } @ @ /* Return true if the document editor is in WYSIWYG mode. Return @ ** false if it is in Markup mode */ @ function isWysiwyg() { @ return document.getElementById("editMode").selectedIndex==0; @ } @ |
︙ | ︙ |
Changes to src/xfer.c.
︙ | ︙ | |||
970 971 972 973 974 975 976 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" " AND blob.rid<=%d" " ORDER BY blob.rid DESC", pXfer->resync ); }else{ db_prepare(&q, | | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" " AND blob.rid<=%d" " ORDER BY blob.rid DESC", pXfer->resync ); }else{ db_prepare(&q, "SELECT uuid FROM unclustered JOIN blob USING(rid) /*scan*/" " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=blob.rid)" " AND NOT EXISTS(SELECT 1 FROM private WHERE rid=blob.rid)" ); } while( db_step(&q)==SQLITE_ROW ){ blob_appendf(pXfer->pOut, "igot %s\n", db_column_text(&q, 0)); |
︙ | ︙ | |||
1118 1119 1120 1121 1122 1123 1124 | /* ** The CGI/HTTP preprocessor always redirects requests with a content-type ** of application/x-fossil or application/x-fossil-debug to this page, ** regardless of what path was specified in the HTTP header. This allows ** clone clients to specify a URL that omits default pathnames, such ** as "http://fossil-scm.org/" instead of "http://fossil-scm.org/index.cgi". ** | | | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | /* ** The CGI/HTTP preprocessor always redirects requests with a content-type ** of application/x-fossil or application/x-fossil-debug to this page, ** regardless of what path was specified in the HTTP header. This allows ** clone clients to specify a URL that omits default pathnames, such ** as "http://fossil-scm.org/" instead of "http://fossil-scm.org/index.cgi". ** ** WEBPAGE: xfer raw-content ** ** This is the transfer handler on the server side. The transfer ** message has been uncompressed and placed in the g.cgiIn blob. ** Process this message and form an appropriate reply. */ void page_xfer(void){ int isPull = 0; |
︙ | ︙ | |||
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 | }else if( g.perm.Read ){ @ pragma uv-pull-only send_unversioned_catalog(&xfer); } } uvCatalogSent = 1; } }else /* Unknown message */ { cgi_reset_content(); @ error bad\scommand:\s%F(blob_str(&xfer.line)) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 | }else if( g.perm.Read ){ @ pragma uv-pull-only send_unversioned_catalog(&xfer); } } uvCatalogSent = 1; } /* pragma ci-lock CHECKIN-HASH CLIENT-ID ** ** The client wants to make non-branch commit against the check-in ** identified by CHECKIN-HASH. The server will remember this and ** subsequent ci-lock request from different clients will generate ** a ci-lock-fail pragma in the reply. */ if( blob_eq(&xfer.aToken[1], "ci-lock") && xfer.nToken==4 && blob_is_hname(&xfer.aToken[2]) ){ Stmt q; sqlite3_int64 iNow = time(0); sqlite3_int64 maxAge = db_get_int("lock-timeout",60); int seenFault = 0; db_prepare(&q, "SELECT json_extract(value,'$.login')," " mtime," " json_extract(value,'$.clientid')," " (SELECT rid FROM blob WHERE uuid=substr(name,9))," " name" " FROM config WHERE name GLOB 'ci-lock-*'" ); while( db_step(&q)==SQLITE_ROW ){ int x = db_column_int(&q,3); const char *zName = db_column_text(&q,4); if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){ /* check-in locks expire after maxAge seconds, or when the ** check-in is no longer a leaf */ db_multi_exec("DELETE FROM config WHERE name=%Q", zName); continue; } if( fossil_strcmp(zName+8, blob_str(&xfer.aToken[2]))==0 ){ const char *zClientId = db_column_text(&q, 2); const char *zLogin = db_column_text(&q,0); sqlite3_int64 mtime = db_column_int64(&q, 1); if( fossil_strcmp(zClientId, blob_str(&xfer.aToken[3]))!=0 ){ @ pragma ci-lock-fail %F(zLogin) %lld(mtime) } seenFault = 1; } } db_finalize(&q); if( !seenFault ){ db_multi_exec( "REPLACE INTO config(name,value,mtime)" "VALUES('ci-lock-%q',json_object('login',%Q,'clientid',%Q),now())", blob_str(&xfer.aToken[2]), g.zLogin, blob_str(&xfer.aToken[3]) ); } } /* pragma ci-unlock CLIENT-ID ** ** Remove any locks previously held by CLIENT-ID. Clients send this ** pragma with their own ID whenever they know that they no longer ** have any commits pending. */ if( blob_eq(&xfer.aToken[1], "ci-unlock") && xfer.nToken==3 && blob_is_hname(&xfer.aToken[2]) ){ db_multi_exec( "DELETE FROM config" " WHERE name GLOB 'ci-lock-*'" " AND json_extract(value,'$.clientid')=%Q", blob_str(&xfer.aToken[2]) ); } }else /* Unknown message */ { cgi_reset_content(); @ error bad\scommand:\s%F(blob_str(&xfer.line)) |
︙ | ︙ | |||
1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ #define SYNC_RESYNC 0x0020 /* --verily */ #define SYNC_UNVERSIONED 0x0040 /* Sync unversioned content */ #define SYNC_UV_REVERT 0x0080 /* Copy server unversioned to client */ #define SYNC_FROMPARENT 0x0100 /* Pull from the parent project */ #define SYNC_UV_TRACE 0x0200 /* Describe UV activities */ #define SYNC_UV_DRYRUN 0x0400 /* Do not actually exchange files */ #endif /* ** Floating-point absolute value */ static double fossil_fabs(double x){ return x>0.0 ? x : -x; | > > | 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 | #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ #define SYNC_RESYNC 0x0020 /* --verily */ #define SYNC_UNVERSIONED 0x0040 /* Sync unversioned content */ #define SYNC_UV_REVERT 0x0080 /* Copy server unversioned to client */ #define SYNC_FROMPARENT 0x0100 /* Pull from the parent project */ #define SYNC_UV_TRACE 0x0200 /* Describe UV activities */ #define SYNC_UV_DRYRUN 0x0400 /* Do not actually exchange files */ #define SYNC_IFABLE 0x0800 /* Inability to sync is not fatal */ #define SYNC_CKIN_LOCK 0x1000 /* Lock the current check-in */ #endif /* ** Floating-point absolute value */ static double fossil_fabs(double x){ return x>0.0 ? x : -x; |
︙ | ︙ | |||
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ double rSkew = 0.0; /* Maximum time skew */ int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */ int uvDoPush = 0; /* Generate uvfile messages to send to server */ int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */ int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */ sqlite3_int64 mtime; /* Modification time on a UV file */ if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 && configRcvMask==0 && configSendMask==0 ) return 0; if( syncFlags & SYNC_FROMPARENT ){ configRcvMask = 0; configSendMask = 0; | > > > > | 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ double rSkew = 0.0; /* Maximum time skew */ int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */ int uvDoPush = 0; /* Generate uvfile messages to send to server */ int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */ int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */ sqlite3_int64 mtime; /* Modification time on a UV file */ int autopushFailed = 0; /* Autopush following commit failed if true */ const char *zCkinLock; /* Name of check-in to lock. NULL for none */ const char *zClientId; /* A unique identifier for this check-out */ unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 && configRcvMask==0 && configSendMask==0 ) return 0; if( syncFlags & SYNC_FROMPARENT ){ configRcvMask = 0; configSendMask = 0; |
︙ | ︙ | |||
1740 1741 1742 1743 1744 1745 1746 | blobarray_zero(xfer.aToken, count(xfer.aToken)); blob_zero(&send); blob_zero(&recv); blob_zero(&xfer.err); blob_zero(&xfer.line); origConfigRcvMask = 0; | < > > > > > > > > > | 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | blobarray_zero(xfer.aToken, count(xfer.aToken)); blob_zero(&send); blob_zero(&recv); blob_zero(&xfer.err); blob_zero(&xfer.line); origConfigRcvMask = 0; /* Send the send-private pragma if we are trying to sync private data */ if( syncFlags & SYNC_PRIVATE ){ blob_append(&send, "pragma send-private\n", -1); } /* Figure out which check-in to lock */ if( syncFlags & SYNC_CKIN_LOCK ){ int vid = db_lget_int("checkout",0); zCkinLock = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); }else{ zCkinLock = 0; } zClientId = g.localOpen ? db_lget("client-id", 0) : 0; /* When syncing unversioned files, create a TEMP table in which to store ** the names of files that need to be sent from client to server. ** ** The initial assumption is that all unversioned files need to be sent ** to the other side. But "uvigot" cards received back from the remote ** side will normally cause many of these entries to be removed since they ** do not really need to be sent. |
︙ | ︙ | |||
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 | } if( blob_size(xfer.pOut)>xfer.mxSend ) break; } db_finalize(&uvq); if( rc==SQLITE_DONE ) uvDoPush = 0; } } /* Append randomness to the end of the message. This makes all ** messages unique so that that the login-card nonce will always ** be unique. */ zRandomness = db_text(0, "SELECT hex(randomblob(20))"); blob_appendf(&send, "# %s\n", zRandomness); free(zRandomness); if( syncFlags & SYNC_VERBOSE ){ fossil_print("waiting for server..."); } fflush(stdout); /* Exchange messages with the server */ | > > > > > > > > > > > > | > > > > > | | 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 | } if( blob_size(xfer.pOut)>xfer.mxSend ) break; } db_finalize(&uvq); if( rc==SQLITE_DONE ) uvDoPush = 0; } } /* Lock the current check-out */ if( zCkinLock ){ if( zClientId==0 ){ zClientId = db_text(0, "SELECT lower(hex(randomblob(20)))"); db_lset("client-id", zClientId); } blob_appendf(&send, "pragma ci-lock %s %s\n", zCkinLock, zClientId); zCkinLock = 0; }else if( zClientId ){ blob_appendf(&send, "pragma ci-unlock %s\n", zClientId); } /* Append randomness to the end of the message. This makes all ** messages unique so that that the login-card nonce will always ** be unique. */ zRandomness = db_text(0, "SELECT hex(randomblob(20))"); blob_appendf(&send, "# %s\n", zRandomness); free(zRandomness); if( syncFlags & SYNC_VERBOSE ){ fossil_print("waiting for server..."); } fflush(stdout); /* Exchange messages with the server */ if( (syncFlags & SYNC_CLONE)!=0 && nCycle==0 ){ /* Do not send a login card on the first round-trip of a clone */ mHttpFlags = 0; }else{ mHttpFlags = HTTP_USE_LOGIN; } if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ nErr++; go = 2; break; } /* Output current stats */ if( syncFlags & SYNC_VERBOSE ){ |
︙ | ︙ | |||
2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 | ** does accept new unversioned content, it sends "uv-push-ok". */ if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){ if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1; }else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){ uvDoPush = 1; } }else /* error MESSAGE ** ** Report an error and abandon the sync session. ** ** Except, when cloning we will sometimes get an error on the ** first message exchange because the project-code is unknown ** and so the login card on the request was invalid. The project-code ** is returned in the reply before the error card, so second and ** subsequent messages should be OK. Nevertheless, we need to ignore ** the error card on the first message of a clone. */ if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ | > > > > > > > > > > > > > > > > > > > > > > > > > > < | | > > > > > < < < < < < < < < < < < < < | | < | 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 | ** does accept new unversioned content, it sends "uv-push-ok". */ if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){ if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1; }else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){ uvDoPush = 1; } /* pragma ci-lock-fail USER-HOLDING-LOCK LOCK-TIME ** ** The server generates this message when a "pragma ci-lock" ** is attempted on a check-in for which there is an existing ** lock. USER-HOLDING-LOCK is the name of the user who originated ** the lock, and LOCK-TIME is the timestamp (seconds since 1970) ** when the lock was taken. */ else if( blob_eq(&xfer.aToken[1], "ci-lock-fail") && xfer.nToken==4 ){ char *zUser = blob_terminate(&xfer.aToken[2]); sqlite3_int64 mtime, iNow; defossilize(zUser); iNow = time(NULL); if( blob_is_int64(&xfer.aToken[3], &mtime) && iNow>mtime ){ iNow = time(NULL); fossil_print("\nParent check-in locked by %s %s ago\n", zUser, human_readable_age((iNow+1-mtime)/86400.0)); }else{ fossil_print("\nParent check-in locked by %s\n", zUser); } g.ckinLockFail = fossil_strdup(zUser); } }else /* error MESSAGE ** ** Report an error and abandon the sync session. ** ** Except, when cloning we will sometimes get an error on the ** first message exchange because the project-code is unknown ** and so the login card on the request was invalid. The project-code ** is returned in the reply before the error card, so second and ** subsequent messages should be OK. Nevertheless, we need to ignore ** the error card on the first message of a clone. ** ** Also ignore "not authorized to write" errors if this is an ** autopush following a commit. */ if( blob_eq(&xfer.aToken[0],"error") && xfer.nToken==2 ){ char *zMsg = blob_terminate(&xfer.aToken[1]); defossilize(zMsg); if( (syncFlags & SYNC_IFABLE)!=0 && sqlite3_strlike("%not authorized to write%",zMsg,0)==0 ){ autopushFailed = 1; nErr++; }else if( (syncFlags & SYNC_CLONE)==0 || nCycle>0 ){ fossil_force_newline(); fossil_print("Error: %s\n", zMsg); blob_appendf(&xfer.err, "server says: %s\n", zMsg); nErr++; break; } }else /* Unknown message */ if( xfer.nToken>0 ){ if( blob_str(&xfer.aToken[0])[0]=='<' ){ |
︙ | ︙ | |||
2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 | transport_close(&g.url); transport_global_shutdown(&g.url); if( nErr && go==2 ){ db_multi_exec("DROP TABLE onremote"); manifest_crosslink_end(MC_PERMIT_HOOKS); content_enable_dephantomize(1); db_end_transaction(0); } if( (syncFlags & SYNC_CLONE)==0 && g.rcvid && fossil_any_has_fork(g.rcvid) ){ fossil_warning("***** WARNING: a fork has occurred *****\n" "use \"fossil leaves -multiple\" for more details."); } return nErr; } | > > > > > > > > > | 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 | transport_close(&g.url); transport_global_shutdown(&g.url); if( nErr && go==2 ){ db_multi_exec("DROP TABLE onremote"); manifest_crosslink_end(MC_PERMIT_HOOKS); content_enable_dephantomize(1); db_end_transaction(0); } if( nErr && autopushFailed ){ fossil_warning( "Warning: The check-in was successful and is saved locally but you\n" " are not authorized to push the changes back to the server\n" " at %s", g.url.canonical ); nErr--; } if( (syncFlags & SYNC_CLONE)==0 && g.rcvid && fossil_any_has_fork(g.rcvid) ){ fossil_warning("***** WARNING: a fork has occurred *****\n" "use \"fossil leaves -multiple\" for more details."); } return nErr; } |
Changes to src/zip.c.
︙ | ︙ | |||
976 977 978 979 980 981 982 983 984 985 986 987 988 989 | zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude); cache_write(&zip, zKey); } glob_free(pInclude); glob_free(pExclude); fossil_free(zName); fossil_free(zRid); blob_reset(&cacheKey); cgi_set_content(&zip); if( eType==ARCHIVE_ZIP ){ cgi_set_content_type("application/zip"); }else{ cgi_set_content_type("application/sqlar"); } | > | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | zip_of_checkin(eType, rid, &zip, zName, pInclude, pExclude); cache_write(&zip, zKey); } glob_free(pInclude); glob_free(pExclude); fossil_free(zName); fossil_free(zRid); g.zOpenRevision = 0; blob_reset(&cacheKey); cgi_set_content(&zip); if( eType==ARCHIVE_ZIP ){ cgi_set_content_type("application/zip"); }else{ cgi_set_content_type("application/sqlar"); } |
︙ | ︙ |
Changes to test/graph-test-1.wiki.
︙ | ︙ | |||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | * <a href="../../../timeline?a=2bc3cfeb&n=5" target="testwindow">Branch risers comes from the bottom of the screen, not from the andygoth-crlf branch.</a> * <a href="../../../timeline?a=b8c7af5b&n=12" target="testwindow">Check-in 2de15c8e has merge arrows from two different trunk check-ins. One of the merge risers also branches to check-in ea7f3297</a> External: * <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd" target="testwindow">Timewarp due to a mis-configured system clock.</a> * <a href="http://core.tcl.tk/tk/finfo?name=tests/id.test" target="testwindow">Show all three separate deletions of "id.test". (Scroll down for the third deletion.) * <a href='http://core.tcl.tk/tk/timeline?y=ci&b=2015-03-07' target='testwindow'>Merge arrows to the left and to the right</a> * <a href='http://core.tcl.tk/tk/timeline?y=ci&b=2015-03-07&railpitch=13' target='testwindow'>Previous, with a scrunched graph</a> * <a href='http://core.tcl.tk/tk/timeline?y=ci&b=2015-03-07&railpitch=11' target='testwindow'>Previous, with a severely scrunched graph</a> | > > > > > > > > > > > > > > > > > > > > > > > | 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 | * <a href="../../../timeline?a=2bc3cfeb&n=5" target="testwindow">Branch risers comes from the bottom of the screen, not from the andygoth-crlf branch.</a> * <a href="../../../timeline?a=b8c7af5b&n=12" target="testwindow">Check-in 2de15c8e has merge arrows from two different trunk check-ins. One of the merge risers also branches to check-in ea7f3297</a> * <a href="../../../timeline?b=ae8709e2&n=25" target="testwindow"> Cherrypick merge arrows</a> * <a href="../../../timeline?r=branch-1.37" target="testwindow">Branch 1.37 with cherry-pick merges from trunk.</a> * <a href="../../../timeline?f=68bd2e7bedb8d05a" target="testwindow"> Single check-in takes both a full merge and a cherrypick merge</a> * <a href="../../../timeline?b=dc81ac70&n=14" target="testwindow"> Mixed merge arrow, partly fully and partly cherrypick</a> * <a href="../../../timeline?b=dc81ac70&n=13" target="testwindow"> Mixed merge arrow to bottom of screen.</a> * <a href="../../../timeline?b=4471e93c&n=12" target="testwindow"> A fork on trunk keeps the longest chain of child nodes directly above the fork and the shorter chain off to the side.</a> * <a href="../../../timeline?r=jan-manifest-tags&n=50" target="testwindow"> The "jan-manifest-tags" branch containing a non-trunk fork</a> * <a href="../../../timeline?r=diff-eolws&n=50" target="testwindow"> The "diff-eolws" branch containing a non-trunk fork</a> * <a href="../../../timeline?n=all&forks" target="testwindow"> All forks</a> * <a href="../../../leaves" target="testwindow">All leaves</a> External: * <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd" target="testwindow">Timewarp due to a mis-configured system clock.</a> * <a href="http://core.tcl.tk/tk/finfo?name=tests/id.test" target="testwindow">Show all three separate deletions of "id.test". (Scroll down for the third deletion.) * <a href='http://core.tcl.tk/tk/timeline?y=ci&b=2015-03-07' target='testwindow'>Merge arrows to the left and to the right</a> * <a href='http://core.tcl.tk/tk/timeline?y=ci&b=2015-03-07&railpitch=13' target='testwindow'>Previous, with a scrunched graph</a> * <a href='http://core.tcl.tk/tk/timeline?y=ci&b=2015-03-07&railpitch=11' target='testwindow'>Previous, with a severely scrunched graph</a> * <a href="https://sqlite.org/src/timeline?r=wal&n=1000" target='testwindow'>The "wal" branch SQLite repository, containing multiple non-trunk forks.</a> |
Changes to test/settings.test.
︙ | ︙ | |||
37 38 39 40 41 42 43 | # letter. It also assumes that any output lines that start with a # lowercase letter contain a setting name starting at that same point. # proc extract_setting_names { data } { set names [list] foreach {dummy name} [regexp \ | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # letter. It also assumes that any output lines that start with a # lowercase letter contain a setting name starting at that same point. # proc extract_setting_names { data } { set names [list] foreach {dummy name} [regexp \ -all -line -inline -- {^([a-z][a-z0-9\-]*) ?.*$} $data] { lappend names $name } return $names } ############################################################################### |
︙ | ︙ |
Changes to test/tester.tcl.
︙ | ︙ | |||
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 | admin-log \ allow-symlinks \ auto-captcha \ auto-hyperlink \ auto-shun \ autosync \ autosync-tries \ binary-glob \ case-sensitive \ clean-glob \ clearsign \ crlf-glob \ crnl-glob \ default-perms \ diff-binary \ diff-command \ dont-push \ dotfiles \ editor \ empty-dirs \ encoding-glob \ exec-rel-paths \ gdiff-command \ gmerge-command \ hash-digits \ http-port \ https-login \ ignore-glob \ keep-glob \ localauth \ main-branch \ manifest \ max-loadavg \ max-upload \ mtime-changes \ pgp-command \ proxy \ relative-paths \ repo-cksum \ self-register \ ssh-command \ ssl-ca-location \ ssl-identity \ th1-setup \ th1-uri-regexp \ uv-sync \ web-browser] fossil test-th-eval "hasfeature legacyMvRm" | > > > > > > > > > > > > | 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 | admin-log \ allow-symlinks \ auto-captcha \ auto-hyperlink \ auto-shun \ autosync \ autosync-tries \ backoffice-disable \ backoffice-logfile \ backoffice-nodelay \ binary-glob \ case-sensitive \ clean-glob \ clearsign \ comment-format \ crlf-glob \ crnl-glob \ default-perms \ diff-binary \ diff-command \ dont-push \ dotfiles \ editor \ email-self \ email-send-command \ email-send-db \ email-send-dir \ email-send-method \ email-send-relayhost \ empty-dirs \ encoding-glob \ exec-rel-paths \ gdiff-command \ gmerge-command \ hash-digits \ http-port \ https-login \ ignore-glob \ keep-glob \ localauth \ main-branch \ manifest \ max-loadavg \ max-upload \ mtime-changes \ pgp-command \ proxy \ relative-paths \ repo-cksum \ repolist-skin \ self-register \ ssh-command \ ssl-ca-location \ ssl-identity \ tclsh \ th1-setup \ th1-uri-regexp \ uv-sync \ web-browser] fossil test-th-eval "hasfeature legacyMvRm" |
︙ | ︙ |
Changes to test/th1.test.
︙ | ︙ | |||
561 562 563 564 565 566 567 | puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout." } elseif ($::dirty_ckout) { puts "Skipping th1-anycap-*-1 perm tests: uncommitted changes in Fossil checkout." } else { set skip_anycap 0 } | > | > > > > < > > | 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 | puts "Skipping th1-anycap-*-1 perm tests: not in Fossil repo checkout." } elseif ($::dirty_ckout) { puts "Skipping th1-anycap-*-1 perm tests: uncommitted changes in Fossil checkout." } else { set skip_anycap 0 } foreach perm [list \ a b c d e f g h i j k l m n o p q r s t u v w x y z \ A D \ 2 3 4 5 6 7 ] { if {$perm eq "u"} continue; # NOTE: Skip "reader" meta-permission. if {$perm eq "v"} continue; # NOTE: Skip "developer" meta-permission. set ::env(TH1_TEST_USER_CAPS) sxy fossil test-th-eval "anycap $perm" test th1-anycap-no-$perm-1 {$RESULT eq {0}} fossil test-th-eval "hascap $perm" test th1-hascap-no-$perm-1 {$RESULT eq {0}} fossil test-th-eval "anoncap $perm" test th1-anoncap-no-$perm-1 {$RESULT eq {0}} if {$skip_anycap} { continue } run_in_checkout { set ::env(TH1_TEST_USER_CAPS) sxy fossil test-th-eval --set-user-caps "anycap $perm" test th1-anycap-yes-$perm-1 {$RESULT eq {1}} set ::env(TH1_TEST_USER_CAPS) 1; # NOTE: Bad permission. fossil test-th-eval --set-user-caps "anycap $perm" test th1-anycap-no-$perm-1 {$RESULT eq {0}} set ::env(TH1_TEST_USER_CAPS) sxy fossil test-th-eval --set-user-caps "hascap $perm" test th1-hascap-yes-$perm-1 {$RESULT eq {1}} set ::env(TH1_TEST_USER_CAPS) 1; # NOTE: Bad permission. fossil test-th-eval --set-user-caps "hascap $perm" test th1-hascap-no-$perm-1 {$RESULT eq {0}} unset ::env(TH1_TEST_USER_CAPS) set ::env(TH1_TEST_ANON_CAPS) sxy fossil test-th-eval --set-anon-caps "anoncap $perm" test th1-anoncap-yes-$perm-1 {$RESULT eq {1}} set ::env(TH1_TEST_ANON_CAPS) 1; # NOTE: Bad permission. fossil test-th-eval --set-anon-caps "anoncap $perm" test th1-anoncap-no-$perm-1 {$RESULT eq {0}} unset ::env(TH1_TEST_ANON_CAPS) |
︙ | ︙ | |||
1027 1028 1029 1030 1031 1032 1033 | # moved from Tcl builds to plain or the reverse. Sorting the # command lists eliminates a dependence on order. # fossil test-th-eval "info commands" set sorted_result [lsort $RESULT] protOut "Sorted: $sorted_result" set base_commands {anoncap anycap array artifact break breakpoint catch\ | | | | | | | | > < | 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 | # moved from Tcl builds to plain or the reverse. Sorting the # command lists eliminates a dependence on order. # fossil test-th-eval "info commands" set sorted_result [lsort $RESULT] protOut "Sorted: $sorted_result" set base_commands {anoncap anycap array artifact break breakpoint catch\ cgiHeaderLine checkout combobox continue date decorate dir enable_output \ encode64 error expr for getParameter glob_match globalState hascap \ hasfeature html htmlize http httpize if info insertCsrf lindex linecount \ list llength lsearch markdown nonce proc puts query randhex redirect\ regexp reinitialize rename render repository return searchable set\ setParameter setting stime string styleFooter styleHeader styleScript\ tclReady trace unset unversioned uplevel upvar utime verifyCsrf\ verifyLogin wiki} set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} if {$th1Tcl} { test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]} } else { test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]} } ############################################################################### fossil test-th-eval "info vars" if {$th1Hooks} { test th1-info-vars-1 {[lsort $RESULT] eq \ |
︙ | ︙ |
Changes to test/wiki.test.
︙ | ︙ | |||
43 44 45 46 47 48 49 | # "text/x-fossil-wiki" (the default mimetype for rendering) # if the N card is omitted in the manifest. # Note: Makes fossil calls, so $CODE and $RESULT will be corrupted proc get_mime_type {name} { global CODE RESULT fossil http << "GET /wiki?name=$name" if {$CODE != 0} { | | | | | | | | | | | | | 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 | # "text/x-fossil-wiki" (the default mimetype for rendering) # if the N card is omitted in the manifest. # Note: Makes fossil calls, so $CODE and $RESULT will be corrupted proc get_mime_type {name} { global CODE RESULT fossil http << "GET /wiki?name=$name" if {$CODE != 0} { return "error: /wiki?name=$name $CODE $RESULT" } fossil whatis --type w $name if {$CODE != 0} { return "error: fossil whatis --type w $name $CODE $RESULT" } set CODE [regexp -line {^artifact:\s*([0-9a-f]+)$} $RESULT match info] if {$CODE == 0} { return "error: whatis returned no info for wiki page $name" } fossil artifact $info if {$CODE != 0} { return "error: fossil artifact $info $CODE $RESULT" } set CODE [regexp -line {^N (.*)$} $RESULT match mimetype] if {$CODE == 0} { return "text/x-fossil-wiki" } return $mimetype } |
︙ | ︙ |
Changes to tools/fossil-autocomplete.bash.
1 2 3 4 5 6 7 | # Command name completion for Fossil. # Mailing-list contribution by Stuart Rackham. function _fossil() { local cur commands cur=${COMP_WORDS[COMP_CWORD]} commands=$(fossil help --all) if [ $COMP_CWORD -eq 1 ] || [ ${COMP_WORDS[1]} = help ]; then | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Command name completion for Fossil. # Mailing-list contribution by Stuart Rackham. function _fossil() { local cur commands cur=${COMP_WORDS[COMP_CWORD]} commands=$(fossil help --all) if [ $COMP_CWORD -eq 1 ] || [ ${COMP_WORDS[1]} = help ]; then # Command name completion for 1st argument or 2nd if help command. COMPREPLY=( $(compgen -W "$commands" $cur) ) else # File name completion for other arguments. COMPREPLY=( $(compgen -f $cur{}) ) fi } complete -o default -F _fossil fossil f |
Added tools/fslsrv.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | #!/bin/bash BASEPORT=12345 FOSSIL=fossil OLDPID=`pgrep -P 1 fossil` PGARGS="-P 1" if [ "$1" = "-f" ] ; then PGARGS= ; shift ; fi if [ -n "$OLDPID" ] then echo "Killing running Fossil server first..." pkill $PGARGS fossil for i in $(seq 30) do if [ -n "$(pgrep $PGARGS fossil)" ] then if [ $i -eq 1 ] then echo -n "Waiting for it to die..." else echo -n . fi sleep '0.1' else break fi echo done killall -9 fossil 2> /dev/null fi if [ -x ./fossil ] then # We're running from a build tree, so use that version instead FOSSIL=./fossil fi function start_one() { bn=$1 port=$(($BASEPORT + $2)) url="$3" if [ -n "$url" ] ; then baseurl="--baseurl $url" ; fi $FOSSIL server --localhost --port $port --scgi $baseurl \ --errorlog ~/log/fossil/$bn-errors.log \ ~/museum/$bn.fossil > ~/log/fossil/$bn-stdout.log & echo Fossil server running for $bn, PID $!, port $port. } start_one example 0 https://example.com/code start_one foo 1 # https://foo.net |
Changes to win/Makefile.PellesCGMake.
︙ | ︙ | |||
81 82 83 84 85 86 87 | UTILS_OBJ=$(UTILS:.exe=.obj) UTILS_SRC=$(foreach uf,$(UTILS),$(SRCDIR)$(uf:.exe=.c)) # define the SQLite files, which need special flags on compile SQLITESRC=sqlite3.c ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf)) SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj)) | | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | UTILS_OBJ=$(UTILS:.exe=.obj) UTILS_SRC=$(foreach uf,$(UTILS),$(SRCDIR)$(uf:.exe=.c)) # define the SQLite files, which need special flags on compile SQLITESRC=sqlite3.c ORIGSQLITESRC=$(foreach sf,$(SQLITESRC),$(SRCDIR)$(sf)) SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj)) SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_WIN32_NO_ANSI # define the SQLite shell files, which need special flags on compile SQLITESHELLSRC=shell.c ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf)) SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj)) SQLITESHELLDEFINES=-DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen # define the th scripting files, which need special flags on compile THSRC=th.c th_lang.c ORIGTHSRC=$(foreach sf,$(THSRC),$(SRCDIR)$(sf)) THOBJ=$(foreach sf,$(THSRC),$(sf:.c=.obj)) # define the zlib files, needed by this compile |
︙ | ︙ |
Changes to win/Makefile.dmc.
︙ | ︙ | |||
22 23 24 25 26 27 28 | SSL = CFLAGS = -o BCC = $(DMDIR)\bin\dmc $(CFLAGS) TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi | | | | | | | 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 | SSL = CFLAGS = -o BCC = $(DMDIR)\bin\dmc $(CFLAGS) TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 dnsapi SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_DQS=0 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen SRC = add_.c alerts_.c allrepo_.c attach_.c backoffice_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c capabilities_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c deltafunc_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c extcgi_.c file_.c finfo_.c foci_.c forum_.c fshell_.c fusefs_.c fuzz_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c repolist_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c setupuser_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c smtp_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c webmail_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c OBJ = $(OBJDIR)\add$O $(OBJDIR)\alerts$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\backoffice$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\capabilities$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\deltafunc$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\extcgi$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\forum$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\fuzz$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\repolist$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\setupuser$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\smtp$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\webmail$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O RC=$(DMDIR)\bin\rcc RCFLAGS=-32 -w1 -I$(SRCDIR) /D__DMC__ APPNAME = $(OBJDIR)\fossil$(E) all: $(APPNAME) $(APPNAME) : translate$E mkindex$E codecheck1$E headers $(OBJ) $(OBJDIR)\link cd $(OBJDIR) codecheck1$E $(SRC) $(DMDIR)\bin\link @link $(OBJDIR)\fossil.res: $B\win\fossil.rc $(RC) $(RCFLAGS) -o$@ $** $(OBJDIR)\link: $B\win\Makefile.dmc $(OBJDIR)\fossil.res +echo add alerts allrepo attach backoffice bag bisect blob branch browse builtin bundle cache capabilities captcha cgi checkin checkout clearsign clone comformat configure content cookies db delta deltacmd deltafunc descendants diff diffcmd dispatch doc encode etag event export extcgi file finfo foci forum fshell fusefs fuzz glob graph gzip hname http http_socket http_ssl http_transport import info json json_artifact json_branch json_config json_diff json_dir json_finfo json_login json_query json_report json_status json_tag json_timeline json_user json_wiki leaf loadctrl login lookslike main manifest markdown markdown_html md5 merge merge3 moderate name path piechart pivot popen pqueue printf publish purge rebuild regexp repolist report rss schema search security_audit setup setupuser sha1 sha1hard sha3 shun sitemap skins smtp sqlcmd stash stat statrep style sync tag tar th_main timeline tkt tktsetup undo unicode unversioned update url user utf8 util verify vfile webmail wiki wikiformat winfile winhttp wysiwyg xfer xfersetup zip shell sqlite3 th th_lang > $@ +echo fossil >> $@ +echo fossil >> $@ +echo $(LIBS) >> $@ +echo. >> $@ +echo fossil >> $@ translate$E: $(SRCDIR)\translate.c |
︙ | ︙ | |||
288 289 290 291 292 293 294 295 296 297 298 299 300 301 | +translate$E $** > $@ $(OBJDIR)\deltacmd$O : deltacmd_.c deltacmd.h $(TCC) -o$@ -c deltacmd_.c deltacmd_.c : $(SRCDIR)\deltacmd.c +translate$E $** > $@ $(OBJDIR)\descendants$O : descendants_.c descendants.h $(TCC) -o$@ -c descendants_.c descendants_.c : $(SRCDIR)\descendants.c +translate$E $** > $@ | > > > > > > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | +translate$E $** > $@ $(OBJDIR)\deltacmd$O : deltacmd_.c deltacmd.h $(TCC) -o$@ -c deltacmd_.c deltacmd_.c : $(SRCDIR)\deltacmd.c +translate$E $** > $@ $(OBJDIR)\deltafunc$O : deltafunc_.c deltafunc.h $(TCC) -o$@ -c deltafunc_.c deltafunc_.c : $(SRCDIR)\deltafunc.c +translate$E $** > $@ $(OBJDIR)\descendants$O : descendants_.c descendants.h $(TCC) -o$@ -c descendants_.c descendants_.c : $(SRCDIR)\descendants.c +translate$E $** > $@ |
︙ | ︙ | |||
342 343 344 345 346 347 348 349 350 351 352 353 354 355 | +translate$E $** > $@ $(OBJDIR)\export$O : export_.c export.h $(TCC) -o$@ -c export_.c export_.c : $(SRCDIR)\export.c +translate$E $** > $@ $(OBJDIR)\file$O : file_.c file.h $(TCC) -o$@ -c file_.c file_.c : $(SRCDIR)\file.c +translate$E $** > $@ | > > > > > > | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | +translate$E $** > $@ $(OBJDIR)\export$O : export_.c export.h $(TCC) -o$@ -c export_.c export_.c : $(SRCDIR)\export.c +translate$E $** > $@ $(OBJDIR)\extcgi$O : extcgi_.c extcgi.h $(TCC) -o$@ -c extcgi_.c extcgi_.c : $(SRCDIR)\extcgi.c +translate$E $** > $@ $(OBJDIR)\file$O : file_.c file.h $(TCC) -o$@ -c file_.c file_.c : $(SRCDIR)\file.c +translate$E $** > $@ |
︙ | ︙ | |||
378 379 380 381 382 383 384 385 386 387 388 389 390 391 | +translate$E $** > $@ $(OBJDIR)\fusefs$O : fusefs_.c fusefs.h $(TCC) -o$@ -c fusefs_.c fusefs_.c : $(SRCDIR)\fusefs.c +translate$E $** > $@ $(OBJDIR)\glob$O : glob_.c glob.h $(TCC) -o$@ -c glob_.c glob_.c : $(SRCDIR)\glob.c +translate$E $** > $@ | > > > > > > | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | +translate$E $** > $@ $(OBJDIR)\fusefs$O : fusefs_.c fusefs.h $(TCC) -o$@ -c fusefs_.c fusefs_.c : $(SRCDIR)\fusefs.c +translate$E $** > $@ $(OBJDIR)\fuzz$O : fuzz_.c fuzz.h $(TCC) -o$@ -c fuzz_.c fuzz_.c : $(SRCDIR)\fuzz.c +translate$E $** > $@ $(OBJDIR)\glob$O : glob_.c glob.h $(TCC) -o$@ -c glob_.c glob_.c : $(SRCDIR)\glob.c +translate$E $** > $@ |
︙ | ︙ | |||
666 667 668 669 670 671 672 673 674 675 676 677 678 679 | +translate$E $** > $@ $(OBJDIR)\regexp$O : regexp_.c regexp.h $(TCC) -o$@ -c regexp_.c regexp_.c : $(SRCDIR)\regexp.c +translate$E $** > $@ $(OBJDIR)\report$O : report_.c report.h $(TCC) -o$@ -c report_.c report_.c : $(SRCDIR)\report.c +translate$E $** > $@ | > > > > > > | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | +translate$E $** > $@ $(OBJDIR)\regexp$O : regexp_.c regexp.h $(TCC) -o$@ -c regexp_.c regexp_.c : $(SRCDIR)\regexp.c +translate$E $** > $@ $(OBJDIR)\repolist$O : repolist_.c repolist.h $(TCC) -o$@ -c repolist_.c repolist_.c : $(SRCDIR)\repolist.c +translate$E $** > $@ $(OBJDIR)\report$O : report_.c report.h $(TCC) -o$@ -c report_.c report_.c : $(SRCDIR)\report.c +translate$E $** > $@ |
︙ | ︙ | |||
938 939 940 941 942 943 944 | $(OBJDIR)\zip$O : zip_.c zip.h $(TCC) -o$@ -c zip_.c zip_.c : $(SRCDIR)\zip.c +translate$E $** > $@ headers: makeheaders$E page_index.h builtin_data.h default_css.h VERSION.h | | | 962 963 964 965 966 967 968 969 970 | $(OBJDIR)\zip$O : zip_.c zip.h $(TCC) -o$@ -c zip_.c zip_.c : $(SRCDIR)\zip.c +translate$E $** > $@ headers: makeheaders$E page_index.h builtin_data.h default_css.h VERSION.h +makeheaders$E add_.c:add.h alerts_.c:alerts.h allrepo_.c:allrepo.h attach_.c:attach.h backoffice_.c:backoffice.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h builtin_.c:builtin.h bundle_.c:bundle.h cache_.c:cache.h capabilities_.c:capabilities.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h cookies_.c:cookies.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h deltafunc_.c:deltafunc.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h dispatch_.c:dispatch.h doc_.c:doc.h encode_.c:encode.h etag_.c:etag.h event_.c:event.h export_.c:export.h extcgi_.c:extcgi.h file_.c:file.h finfo_.c:finfo.h foci_.c:foci.h forum_.c:forum.h fshell_.c:fshell.h fusefs_.c:fusefs.h fuzz_.c:fuzz.h glob_.c:glob.h graph_.c:graph.h gzip_.c:gzip.h hname_.c:hname.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h json_.c:json.h json_artifact_.c:json_artifact.h json_branch_.c:json_branch.h json_config_.c:json_config.h json_diff_.c:json_diff.h json_dir_.c:json_dir.h json_finfo_.c:json_finfo.h json_login_.c:json_login.h json_query_.c:json_query.h json_report_.c:json_report.h json_status_.c:json_status.h json_tag_.c:json_tag.h json_timeline_.c:json_timeline.h json_user_.c:json_user.h json_wiki_.c:json_wiki.h leaf_.c:leaf.h loadctrl_.c:loadctrl.h login_.c:login.h lookslike_.c:lookslike.h main_.c:main.h manifest_.c:manifest.h markdown_.c:markdown.h markdown_html_.c:markdown_html.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h moderate_.c:moderate.h name_.c:name.h path_.c:path.h piechart_.c:piechart.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h publish_.c:publish.h purge_.c:purge.h rebuild_.c:rebuild.h regexp_.c:regexp.h repolist_.c:repolist.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h security_audit_.c:security_audit.h setup_.c:setup.h setupuser_.c:setupuser.h sha1_.c:sha1.h sha1hard_.c:sha1hard.h sha3_.c:sha3.h shun_.c:shun.h sitemap_.c:sitemap.h skins_.c:skins.h smtp_.c:smtp.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h statrep_.c:statrep.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h tar_.c:tar.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h unicode_.c:unicode.h unversioned_.c:unversioned.h update_.c:update.h url_.c:url.h user_.c:user.h utf8_.c:utf8.h util_.c:util.h verify_.c:verify.h vfile_.c:vfile.h webmail_.c:webmail.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winfile_.c:winfile.h winhttp_.c:winhttp.h wysiwyg_.c:wysiwyg.h xfer_.c:xfer.h xfersetup_.c:xfersetup.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h $(SRCDIR)\cson_amalgamation.h @copy /Y nul: headers |
Changes to win/Makefile.mingw.
︙ | ︙ | |||
156 157 158 159 160 161 162 | else SSLCONFIG = mingw64 ZLIBCONFIG = ZLIBTARGETS = endif #### Disable creation of the OpenSSL shared libraries. Also, disable support | | | | | 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 | else SSLCONFIG = mingw64 ZLIBCONFIG = ZLIBTARGETS = endif #### Disable creation of the OpenSSL shared libraries. Also, disable support # for SSLv3 (i.e. thereby forcing the use of TLS). # SSLCONFIG += no-ssl3 no-weak-ssl-ciphers no-shared #### When using zlib, make sure that OpenSSL is configured to use the zlib # that Fossil knows about (i.e. the one within the source tree). # ifndef FOSSIL_ENABLE_MINIZ SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1d OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
︙ | ︙ | |||
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 | $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/content.c \ $(SRCDIR)/cookies.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/dispatch.c \ $(SRCDIR)/doc.c \ $(SRCDIR)/encode.c \ $(SRCDIR)/etag.c \ $(SRCDIR)/event.c \ $(SRCDIR)/export.c \ $(SRCDIR)/file.c \ $(SRCDIR)/finfo.c \ $(SRCDIR)/foci.c \ $(SRCDIR)/forum.c \ $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ | > > > | 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 | $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/content.c \ $(SRCDIR)/cookies.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/deltafunc.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/dispatch.c \ $(SRCDIR)/doc.c \ $(SRCDIR)/encode.c \ $(SRCDIR)/etag.c \ $(SRCDIR)/event.c \ $(SRCDIR)/export.c \ $(SRCDIR)/extcgi.c \ $(SRCDIR)/file.c \ $(SRCDIR)/finfo.c \ $(SRCDIR)/foci.c \ $(SRCDIR)/forum.c \ $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ |
︙ | ︙ | |||
524 525 526 527 528 529 530 531 532 533 534 535 536 537 | $(SRCDIR)/popen.c \ $(SRCDIR)/pqueue.c \ $(SRCDIR)/printf.c \ $(SRCDIR)/publish.c \ $(SRCDIR)/purge.c \ $(SRCDIR)/rebuild.c \ $(SRCDIR)/regexp.c \ $(SRCDIR)/report.c \ $(SRCDIR)/rss.c \ $(SRCDIR)/schema.c \ $(SRCDIR)/search.c \ $(SRCDIR)/security_audit.c \ $(SRCDIR)/setup.c \ $(SRCDIR)/setupuser.c \ | > | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | $(SRCDIR)/popen.c \ $(SRCDIR)/pqueue.c \ $(SRCDIR)/printf.c \ $(SRCDIR)/publish.c \ $(SRCDIR)/purge.c \ $(SRCDIR)/rebuild.c \ $(SRCDIR)/regexp.c \ $(SRCDIR)/repolist.c \ $(SRCDIR)/report.c \ $(SRCDIR)/rss.c \ $(SRCDIR)/schema.c \ $(SRCDIR)/search.c \ $(SRCDIR)/security_audit.c \ $(SRCDIR)/setup.c \ $(SRCDIR)/setupuser.c \ |
︙ | ︙ | |||
628 629 630 631 632 633 634 635 636 637 638 639 640 641 | $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/../skins/xekri/css.txt \ $(SRCDIR)/../skins/xekri/details.txt \ $(SRCDIR)/../skins/xekri/footer.txt \ $(SRCDIR)/../skins/xekri/header.txt \ $(SRCDIR)/ci_edit.js \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/forum.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ $(SRCDIR)/markdown.md \ $(SRCDIR)/menu.js \ | > | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/../skins/xekri/css.txt \ $(SRCDIR)/../skins/xekri/details.txt \ $(SRCDIR)/../skins/xekri/footer.txt \ $(SRCDIR)/../skins/xekri/header.txt \ $(SRCDIR)/ci_edit.js \ $(SRCDIR)/copybtn.js \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/forum.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ $(SRCDIR)/markdown.md \ $(SRCDIR)/menu.js \ |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat_.c \ $(OBJDIR)/configure_.c \ $(OBJDIR)/content_.c \ $(OBJDIR)/cookies_.c \ $(OBJDIR)/db_.c \ $(OBJDIR)/delta_.c \ $(OBJDIR)/deltacmd_.c \ $(OBJDIR)/descendants_.c \ $(OBJDIR)/diff_.c \ $(OBJDIR)/diffcmd_.c \ $(OBJDIR)/dispatch_.c \ $(OBJDIR)/doc_.c \ $(OBJDIR)/encode_.c \ $(OBJDIR)/etag_.c \ $(OBJDIR)/event_.c \ $(OBJDIR)/export_.c \ $(OBJDIR)/file_.c \ $(OBJDIR)/finfo_.c \ $(OBJDIR)/foci_.c \ $(OBJDIR)/forum_.c \ $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ | > > > | 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 | $(OBJDIR)/comformat_.c \ $(OBJDIR)/configure_.c \ $(OBJDIR)/content_.c \ $(OBJDIR)/cookies_.c \ $(OBJDIR)/db_.c \ $(OBJDIR)/delta_.c \ $(OBJDIR)/deltacmd_.c \ $(OBJDIR)/deltafunc_.c \ $(OBJDIR)/descendants_.c \ $(OBJDIR)/diff_.c \ $(OBJDIR)/diffcmd_.c \ $(OBJDIR)/dispatch_.c \ $(OBJDIR)/doc_.c \ $(OBJDIR)/encode_.c \ $(OBJDIR)/etag_.c \ $(OBJDIR)/event_.c \ $(OBJDIR)/export_.c \ $(OBJDIR)/extcgi_.c \ $(OBJDIR)/file_.c \ $(OBJDIR)/finfo_.c \ $(OBJDIR)/foci_.c \ $(OBJDIR)/forum_.c \ $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ |
︙ | ︙ | |||
734 735 736 737 738 739 740 741 742 743 744 745 746 747 | $(OBJDIR)/popen_.c \ $(OBJDIR)/pqueue_.c \ $(OBJDIR)/printf_.c \ $(OBJDIR)/publish_.c \ $(OBJDIR)/purge_.c \ $(OBJDIR)/rebuild_.c \ $(OBJDIR)/regexp_.c \ $(OBJDIR)/report_.c \ $(OBJDIR)/rss_.c \ $(OBJDIR)/schema_.c \ $(OBJDIR)/search_.c \ $(OBJDIR)/security_audit_.c \ $(OBJDIR)/setup_.c \ $(OBJDIR)/setupuser_.c \ | > | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | $(OBJDIR)/popen_.c \ $(OBJDIR)/pqueue_.c \ $(OBJDIR)/printf_.c \ $(OBJDIR)/publish_.c \ $(OBJDIR)/purge_.c \ $(OBJDIR)/rebuild_.c \ $(OBJDIR)/regexp_.c \ $(OBJDIR)/repolist_.c \ $(OBJDIR)/report_.c \ $(OBJDIR)/rss_.c \ $(OBJDIR)/schema_.c \ $(OBJDIR)/search_.c \ $(OBJDIR)/security_audit_.c \ $(OBJDIR)/setup_.c \ $(OBJDIR)/setupuser_.c \ |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat.o \ $(OBJDIR)/configure.o \ $(OBJDIR)/content.o \ $(OBJDIR)/cookies.o \ $(OBJDIR)/db.o \ $(OBJDIR)/delta.o \ $(OBJDIR)/deltacmd.o \ $(OBJDIR)/descendants.o \ $(OBJDIR)/diff.o \ $(OBJDIR)/diffcmd.o \ $(OBJDIR)/dispatch.o \ $(OBJDIR)/doc.o \ $(OBJDIR)/encode.o \ $(OBJDIR)/etag.o \ $(OBJDIR)/event.o \ $(OBJDIR)/export.o \ $(OBJDIR)/file.o \ $(OBJDIR)/finfo.o \ $(OBJDIR)/foci.o \ $(OBJDIR)/forum.o \ $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ | > > > | 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 | $(OBJDIR)/comformat.o \ $(OBJDIR)/configure.o \ $(OBJDIR)/content.o \ $(OBJDIR)/cookies.o \ $(OBJDIR)/db.o \ $(OBJDIR)/delta.o \ $(OBJDIR)/deltacmd.o \ $(OBJDIR)/deltafunc.o \ $(OBJDIR)/descendants.o \ $(OBJDIR)/diff.o \ $(OBJDIR)/diffcmd.o \ $(OBJDIR)/dispatch.o \ $(OBJDIR)/doc.o \ $(OBJDIR)/encode.o \ $(OBJDIR)/etag.o \ $(OBJDIR)/event.o \ $(OBJDIR)/export.o \ $(OBJDIR)/extcgi.o \ $(OBJDIR)/file.o \ $(OBJDIR)/finfo.o \ $(OBJDIR)/foci.o \ $(OBJDIR)/forum.o \ $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ |
︙ | ︙ | |||
871 872 873 874 875 876 877 878 879 880 881 882 883 884 | $(OBJDIR)/popen.o \ $(OBJDIR)/pqueue.o \ $(OBJDIR)/printf.o \ $(OBJDIR)/publish.o \ $(OBJDIR)/purge.o \ $(OBJDIR)/rebuild.o \ $(OBJDIR)/regexp.o \ $(OBJDIR)/report.o \ $(OBJDIR)/rss.o \ $(OBJDIR)/schema.o \ $(OBJDIR)/search.o \ $(OBJDIR)/security_audit.o \ $(OBJDIR)/setup.o \ $(OBJDIR)/setupuser.o \ | > | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | $(OBJDIR)/popen.o \ $(OBJDIR)/pqueue.o \ $(OBJDIR)/printf.o \ $(OBJDIR)/publish.o \ $(OBJDIR)/purge.o \ $(OBJDIR)/rebuild.o \ $(OBJDIR)/regexp.o \ $(OBJDIR)/repolist.o \ $(OBJDIR)/report.o \ $(OBJDIR)/rss.o \ $(OBJDIR)/schema.o \ $(OBJDIR)/search.o \ $(OBJDIR)/security_audit.o \ $(OBJDIR)/setup.o \ $(OBJDIR)/setupuser.o \ |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | BLDTARGETS = else BLDTARGETS = zlib endif openssl: $(BLDTARGETS) cd $(OPENSSLLIBDIR);./Configure --cross-compile-prefix=$(PREFIX) $(SSLCONFIG) $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) build_libs clean-openssl: $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) clean tcl: cd $(TCLSRCDIR)/win;./configure | > | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | BLDTARGETS = else BLDTARGETS = zlib endif openssl: $(BLDTARGETS) cd $(OPENSSLLIBDIR);./Configure --cross-compile-prefix=$(PREFIX) $(SSLCONFIG) sed -i -e 's/^PERL=C:\\.*$$/PERL=perl.exe/i' $(OPENSSLLIBDIR)/Makefile $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) build_libs clean-openssl: $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) clean tcl: cd $(TCLSRCDIR)/win;./configure |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \ $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h \ $(OBJDIR)/content_.c:$(OBJDIR)/content.h \ $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \ $(OBJDIR)/db_.c:$(OBJDIR)/db.h \ $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \ $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \ $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \ $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \ $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \ $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \ $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \ $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \ $(OBJDIR)/etag_.c:$(OBJDIR)/etag.h \ $(OBJDIR)/event_.c:$(OBJDIR)/event.h \ $(OBJDIR)/export_.c:$(OBJDIR)/export.h \ $(OBJDIR)/file_.c:$(OBJDIR)/file.h \ $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \ $(OBJDIR)/forum_.c:$(OBJDIR)/forum.h \ $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ | > > > | 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 | $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \ $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h \ $(OBJDIR)/content_.c:$(OBJDIR)/content.h \ $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \ $(OBJDIR)/db_.c:$(OBJDIR)/db.h \ $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \ $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \ $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \ $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \ $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \ $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \ $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \ $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \ $(OBJDIR)/etag_.c:$(OBJDIR)/etag.h \ $(OBJDIR)/event_.c:$(OBJDIR)/event.h \ $(OBJDIR)/export_.c:$(OBJDIR)/export.h \ $(OBJDIR)/extcgi_.c:$(OBJDIR)/extcgi.h \ $(OBJDIR)/file_.c:$(OBJDIR)/file.h \ $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \ $(OBJDIR)/forum_.c:$(OBJDIR)/forum.h \ $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ |
︙ | ︙ | |||
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \ $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \ $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \ $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \ $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \ $(OBJDIR)/report_.c:$(OBJDIR)/report.h \ $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \ $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \ $(OBJDIR)/search_.c:$(OBJDIR)/search.h \ $(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \ $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \ $(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \ | > | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \ $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \ $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \ $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \ $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \ $(OBJDIR)/repolist_.c:$(OBJDIR)/repolist.h \ $(OBJDIR)/report_.c:$(OBJDIR)/report.h \ $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \ $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \ $(OBJDIR)/search_.c:$(OBJDIR)/search.h \ $(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \ $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \ $(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \ |
︙ | ︙ | |||
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@ $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/descendants.c >$@ $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c | > > > > > > > > | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 | $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@ $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@ $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/descendants.c >$@ $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c |
︙ | ︙ | |||
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 | $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/export.c >$@ $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c $(OBJDIR)/export.h: $(OBJDIR)/headers $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/file.c >$@ $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c | > > > > > > > > | 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/export.c >$@ $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c $(OBJDIR)/export.h: $(OBJDIR)/headers $(OBJDIR)/extcgi_.c: $(SRCDIR)/extcgi.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/extcgi.c >$@ $(OBJDIR)/extcgi.o: $(OBJDIR)/extcgi_.c $(OBJDIR)/extcgi.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/extcgi.o -c $(OBJDIR)/extcgi_.c $(OBJDIR)/extcgi.h: $(OBJDIR)/headers $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/file.c >$@ $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c |
︙ | ︙ | |||
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 | $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/fusefs.c >$@ $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h: $(OBJDIR)/headers $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/glob.c >$@ $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c | > > > > > > > > | 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/fusefs.c >$@ $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h: $(OBJDIR)/headers $(OBJDIR)/fuzz_.c: $(SRCDIR)/fuzz.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/fuzz.c >$@ $(OBJDIR)/fuzz.o: $(OBJDIR)/fuzz_.c $(OBJDIR)/fuzz.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fuzz.o -c $(OBJDIR)/fuzz_.c $(OBJDIR)/fuzz.h: $(OBJDIR)/headers $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/glob.c >$@ $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c |
︙ | ︙ | |||
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 | $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/regexp.c >$@ $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h: $(OBJDIR)/headers $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/report.c >$@ $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c | > > > > > > > > | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/regexp.c >$@ $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h: $(OBJDIR)/headers $(OBJDIR)/repolist_.c: $(SRCDIR)/repolist.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/repolist.c >$@ $(OBJDIR)/repolist.o: $(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/repolist.o -c $(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h: $(OBJDIR)/headers $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/report.c >$@ $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c |
︙ | ︙ | |||
2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c $(OBJDIR)/zip.h: $(OBJDIR)/headers MINGW_OPTIONS = -D_HAVE__MINGW_H SQLITE_OPTIONS = -DNDEBUG=1 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ | > < > < | 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c $(OBJDIR)/zip.h: $(OBJDIR)/headers MINGW_OPTIONS = -D_HAVE__MINGW_H SQLITE_OPTIONS = -DNDEBUG=1 \ -DSQLITE_DQS=0 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_STMTVTAB \ -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ -DSQLITE_WIN32_NO_ANSI \ $(MINGW_OPTIONS) \ -DSQLITE_USE_MALLOC_H \ -DSQLITE_USE_MSIZE SHELL_OPTIONS = -DNDEBUG=1 \ -DSQLITE_DQS=0 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_STMTVTAB \ -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ |
︙ | ︙ |
Changes to win/Makefile.mingw.mistachkin.
︙ | ︙ | |||
156 157 158 159 160 161 162 | else SSLCONFIG = mingw64 ZLIBCONFIG = ZLIBTARGETS = endif #### Disable creation of the OpenSSL shared libraries. Also, disable support | | | | | 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 | else SSLCONFIG = mingw64 ZLIBCONFIG = ZLIBTARGETS = endif #### Disable creation of the OpenSSL shared libraries. Also, disable support # for SSLv3 (i.e. thereby forcing the use of TLS). # SSLCONFIG += no-ssl3 no-weak-ssl-ciphers no-shared #### When using zlib, make sure that OpenSSL is configured to use the zlib # that Fossil knows about (i.e. the one within the source tree). # ifndef FOSSIL_ENABLE_MINIZ SSLCONFIG += --with-zlib-lib=$(PWD)/$(ZLIBDIR) --with-zlib-include=$(PWD)/$(ZLIBDIR) zlib endif #### The directories where the OpenSSL include and library files are located. # The recommended usage here is to use the Sysinternals junction tool # to create a hard link between an "openssl-1.x" sub-directory of the # Fossil source code directory and the target OpenSSL source directory. # OPENSSLDIR = $(SRCDIR)/../compat/openssl-1.1.1d OPENSSLINCDIR = $(OPENSSLDIR)/include OPENSSLLIBDIR = $(OPENSSLDIR) #### Either the directory where the Tcl library is installed or the Tcl # source code directory resides (depending on the value of the macro # FOSSIL_TCL_SOURCE). If this points to the Tcl install directory, # this directory must have "include" and "lib" sub-directories. If |
︙ | ︙ | |||
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 | $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/content.c \ $(SRCDIR)/cookies.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/dispatch.c \ $(SRCDIR)/doc.c \ $(SRCDIR)/encode.c \ $(SRCDIR)/etag.c \ $(SRCDIR)/event.c \ $(SRCDIR)/export.c \ $(SRCDIR)/file.c \ $(SRCDIR)/finfo.c \ $(SRCDIR)/foci.c \ $(SRCDIR)/forum.c \ $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ | > > > | 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 | $(SRCDIR)/comformat.c \ $(SRCDIR)/configure.c \ $(SRCDIR)/content.c \ $(SRCDIR)/cookies.c \ $(SRCDIR)/db.c \ $(SRCDIR)/delta.c \ $(SRCDIR)/deltacmd.c \ $(SRCDIR)/deltafunc.c \ $(SRCDIR)/descendants.c \ $(SRCDIR)/diff.c \ $(SRCDIR)/diffcmd.c \ $(SRCDIR)/dispatch.c \ $(SRCDIR)/doc.c \ $(SRCDIR)/encode.c \ $(SRCDIR)/etag.c \ $(SRCDIR)/event.c \ $(SRCDIR)/export.c \ $(SRCDIR)/extcgi.c \ $(SRCDIR)/file.c \ $(SRCDIR)/finfo.c \ $(SRCDIR)/foci.c \ $(SRCDIR)/forum.c \ $(SRCDIR)/fshell.c \ $(SRCDIR)/fusefs.c \ $(SRCDIR)/fuzz.c \ $(SRCDIR)/glob.c \ $(SRCDIR)/graph.c \ $(SRCDIR)/gzip.c \ $(SRCDIR)/hname.c \ $(SRCDIR)/http.c \ $(SRCDIR)/http_socket.c \ $(SRCDIR)/http_ssl.c \ |
︙ | ︙ | |||
524 525 526 527 528 529 530 531 532 533 534 535 536 537 | $(SRCDIR)/popen.c \ $(SRCDIR)/pqueue.c \ $(SRCDIR)/printf.c \ $(SRCDIR)/publish.c \ $(SRCDIR)/purge.c \ $(SRCDIR)/rebuild.c \ $(SRCDIR)/regexp.c \ $(SRCDIR)/report.c \ $(SRCDIR)/rss.c \ $(SRCDIR)/schema.c \ $(SRCDIR)/search.c \ $(SRCDIR)/security_audit.c \ $(SRCDIR)/setup.c \ $(SRCDIR)/setupuser.c \ | > | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | $(SRCDIR)/popen.c \ $(SRCDIR)/pqueue.c \ $(SRCDIR)/printf.c \ $(SRCDIR)/publish.c \ $(SRCDIR)/purge.c \ $(SRCDIR)/rebuild.c \ $(SRCDIR)/regexp.c \ $(SRCDIR)/repolist.c \ $(SRCDIR)/report.c \ $(SRCDIR)/rss.c \ $(SRCDIR)/schema.c \ $(SRCDIR)/search.c \ $(SRCDIR)/security_audit.c \ $(SRCDIR)/setup.c \ $(SRCDIR)/setupuser.c \ |
︙ | ︙ | |||
628 629 630 631 632 633 634 635 636 637 638 639 640 641 | $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/../skins/xekri/css.txt \ $(SRCDIR)/../skins/xekri/details.txt \ $(SRCDIR)/../skins/xekri/footer.txt \ $(SRCDIR)/../skins/xekri/header.txt \ $(SRCDIR)/ci_edit.js \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/forum.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ $(SRCDIR)/markdown.md \ $(SRCDIR)/menu.js \ | > | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 | $(SRCDIR)/../skins/rounded1/footer.txt \ $(SRCDIR)/../skins/rounded1/header.txt \ $(SRCDIR)/../skins/xekri/css.txt \ $(SRCDIR)/../skins/xekri/details.txt \ $(SRCDIR)/../skins/xekri/footer.txt \ $(SRCDIR)/../skins/xekri/header.txt \ $(SRCDIR)/ci_edit.js \ $(SRCDIR)/copybtn.js \ $(SRCDIR)/diff.tcl \ $(SRCDIR)/forum.js \ $(SRCDIR)/graph.js \ $(SRCDIR)/href.js \ $(SRCDIR)/login.js \ $(SRCDIR)/markdown.md \ $(SRCDIR)/menu.js \ |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat_.c \ $(OBJDIR)/configure_.c \ $(OBJDIR)/content_.c \ $(OBJDIR)/cookies_.c \ $(OBJDIR)/db_.c \ $(OBJDIR)/delta_.c \ $(OBJDIR)/deltacmd_.c \ $(OBJDIR)/descendants_.c \ $(OBJDIR)/diff_.c \ $(OBJDIR)/diffcmd_.c \ $(OBJDIR)/dispatch_.c \ $(OBJDIR)/doc_.c \ $(OBJDIR)/encode_.c \ $(OBJDIR)/etag_.c \ $(OBJDIR)/event_.c \ $(OBJDIR)/export_.c \ $(OBJDIR)/file_.c \ $(OBJDIR)/finfo_.c \ $(OBJDIR)/foci_.c \ $(OBJDIR)/forum_.c \ $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ | > > > | 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 | $(OBJDIR)/comformat_.c \ $(OBJDIR)/configure_.c \ $(OBJDIR)/content_.c \ $(OBJDIR)/cookies_.c \ $(OBJDIR)/db_.c \ $(OBJDIR)/delta_.c \ $(OBJDIR)/deltacmd_.c \ $(OBJDIR)/deltafunc_.c \ $(OBJDIR)/descendants_.c \ $(OBJDIR)/diff_.c \ $(OBJDIR)/diffcmd_.c \ $(OBJDIR)/dispatch_.c \ $(OBJDIR)/doc_.c \ $(OBJDIR)/encode_.c \ $(OBJDIR)/etag_.c \ $(OBJDIR)/event_.c \ $(OBJDIR)/export_.c \ $(OBJDIR)/extcgi_.c \ $(OBJDIR)/file_.c \ $(OBJDIR)/finfo_.c \ $(OBJDIR)/foci_.c \ $(OBJDIR)/forum_.c \ $(OBJDIR)/fshell_.c \ $(OBJDIR)/fusefs_.c \ $(OBJDIR)/fuzz_.c \ $(OBJDIR)/glob_.c \ $(OBJDIR)/graph_.c \ $(OBJDIR)/gzip_.c \ $(OBJDIR)/hname_.c \ $(OBJDIR)/http_.c \ $(OBJDIR)/http_socket_.c \ $(OBJDIR)/http_ssl_.c \ |
︙ | ︙ | |||
734 735 736 737 738 739 740 741 742 743 744 745 746 747 | $(OBJDIR)/popen_.c \ $(OBJDIR)/pqueue_.c \ $(OBJDIR)/printf_.c \ $(OBJDIR)/publish_.c \ $(OBJDIR)/purge_.c \ $(OBJDIR)/rebuild_.c \ $(OBJDIR)/regexp_.c \ $(OBJDIR)/report_.c \ $(OBJDIR)/rss_.c \ $(OBJDIR)/schema_.c \ $(OBJDIR)/search_.c \ $(OBJDIR)/security_audit_.c \ $(OBJDIR)/setup_.c \ $(OBJDIR)/setupuser_.c \ | > | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | $(OBJDIR)/popen_.c \ $(OBJDIR)/pqueue_.c \ $(OBJDIR)/printf_.c \ $(OBJDIR)/publish_.c \ $(OBJDIR)/purge_.c \ $(OBJDIR)/rebuild_.c \ $(OBJDIR)/regexp_.c \ $(OBJDIR)/repolist_.c \ $(OBJDIR)/report_.c \ $(OBJDIR)/rss_.c \ $(OBJDIR)/schema_.c \ $(OBJDIR)/search_.c \ $(OBJDIR)/security_audit_.c \ $(OBJDIR)/setup_.c \ $(OBJDIR)/setupuser_.c \ |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat.o \ $(OBJDIR)/configure.o \ $(OBJDIR)/content.o \ $(OBJDIR)/cookies.o \ $(OBJDIR)/db.o \ $(OBJDIR)/delta.o \ $(OBJDIR)/deltacmd.o \ $(OBJDIR)/descendants.o \ $(OBJDIR)/diff.o \ $(OBJDIR)/diffcmd.o \ $(OBJDIR)/dispatch.o \ $(OBJDIR)/doc.o \ $(OBJDIR)/encode.o \ $(OBJDIR)/etag.o \ $(OBJDIR)/event.o \ $(OBJDIR)/export.o \ $(OBJDIR)/file.o \ $(OBJDIR)/finfo.o \ $(OBJDIR)/foci.o \ $(OBJDIR)/forum.o \ $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ | > > > | 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 | $(OBJDIR)/comformat.o \ $(OBJDIR)/configure.o \ $(OBJDIR)/content.o \ $(OBJDIR)/cookies.o \ $(OBJDIR)/db.o \ $(OBJDIR)/delta.o \ $(OBJDIR)/deltacmd.o \ $(OBJDIR)/deltafunc.o \ $(OBJDIR)/descendants.o \ $(OBJDIR)/diff.o \ $(OBJDIR)/diffcmd.o \ $(OBJDIR)/dispatch.o \ $(OBJDIR)/doc.o \ $(OBJDIR)/encode.o \ $(OBJDIR)/etag.o \ $(OBJDIR)/event.o \ $(OBJDIR)/export.o \ $(OBJDIR)/extcgi.o \ $(OBJDIR)/file.o \ $(OBJDIR)/finfo.o \ $(OBJDIR)/foci.o \ $(OBJDIR)/forum.o \ $(OBJDIR)/fshell.o \ $(OBJDIR)/fusefs.o \ $(OBJDIR)/fuzz.o \ $(OBJDIR)/glob.o \ $(OBJDIR)/graph.o \ $(OBJDIR)/gzip.o \ $(OBJDIR)/hname.o \ $(OBJDIR)/http.o \ $(OBJDIR)/http_socket.o \ $(OBJDIR)/http_ssl.o \ |
︙ | ︙ | |||
871 872 873 874 875 876 877 878 879 880 881 882 883 884 | $(OBJDIR)/popen.o \ $(OBJDIR)/pqueue.o \ $(OBJDIR)/printf.o \ $(OBJDIR)/publish.o \ $(OBJDIR)/purge.o \ $(OBJDIR)/rebuild.o \ $(OBJDIR)/regexp.o \ $(OBJDIR)/report.o \ $(OBJDIR)/rss.o \ $(OBJDIR)/schema.o \ $(OBJDIR)/search.o \ $(OBJDIR)/security_audit.o \ $(OBJDIR)/setup.o \ $(OBJDIR)/setupuser.o \ | > | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | $(OBJDIR)/popen.o \ $(OBJDIR)/pqueue.o \ $(OBJDIR)/printf.o \ $(OBJDIR)/publish.o \ $(OBJDIR)/purge.o \ $(OBJDIR)/rebuild.o \ $(OBJDIR)/regexp.o \ $(OBJDIR)/repolist.o \ $(OBJDIR)/report.o \ $(OBJDIR)/rss.o \ $(OBJDIR)/schema.o \ $(OBJDIR)/search.o \ $(OBJDIR)/security_audit.o \ $(OBJDIR)/setup.o \ $(OBJDIR)/setupuser.o \ |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | BLDTARGETS = else BLDTARGETS = zlib endif openssl: $(BLDTARGETS) cd $(OPENSSLLIBDIR);./Configure --cross-compile-prefix=$(PREFIX) $(SSLCONFIG) $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) build_libs clean-openssl: $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) clean tcl: cd $(TCLSRCDIR)/win;./configure | > | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | BLDTARGETS = else BLDTARGETS = zlib endif openssl: $(BLDTARGETS) cd $(OPENSSLLIBDIR);./Configure --cross-compile-prefix=$(PREFIX) $(SSLCONFIG) sed -i -e 's/^PERL=C:\\.*$$/PERL=perl.exe/i' $(OPENSSLLIBDIR)/Makefile $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) build_libs clean-openssl: $(MAKE) -C $(OPENSSLLIBDIR) PREFIX=$(PREFIX) CC=$(PREFIX)$(TCCEXE) clean tcl: cd $(TCLSRCDIR)/win;./configure |
︙ | ︙ | |||
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 | $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \ $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h \ $(OBJDIR)/content_.c:$(OBJDIR)/content.h \ $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \ $(OBJDIR)/db_.c:$(OBJDIR)/db.h \ $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \ $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \ $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \ $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \ $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \ $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \ $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \ $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \ $(OBJDIR)/etag_.c:$(OBJDIR)/etag.h \ $(OBJDIR)/event_.c:$(OBJDIR)/event.h \ $(OBJDIR)/export_.c:$(OBJDIR)/export.h \ $(OBJDIR)/file_.c:$(OBJDIR)/file.h \ $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \ $(OBJDIR)/forum_.c:$(OBJDIR)/forum.h \ $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ | > > > | 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 | $(OBJDIR)/comformat_.c:$(OBJDIR)/comformat.h \ $(OBJDIR)/configure_.c:$(OBJDIR)/configure.h \ $(OBJDIR)/content_.c:$(OBJDIR)/content.h \ $(OBJDIR)/cookies_.c:$(OBJDIR)/cookies.h \ $(OBJDIR)/db_.c:$(OBJDIR)/db.h \ $(OBJDIR)/delta_.c:$(OBJDIR)/delta.h \ $(OBJDIR)/deltacmd_.c:$(OBJDIR)/deltacmd.h \ $(OBJDIR)/deltafunc_.c:$(OBJDIR)/deltafunc.h \ $(OBJDIR)/descendants_.c:$(OBJDIR)/descendants.h \ $(OBJDIR)/diff_.c:$(OBJDIR)/diff.h \ $(OBJDIR)/diffcmd_.c:$(OBJDIR)/diffcmd.h \ $(OBJDIR)/dispatch_.c:$(OBJDIR)/dispatch.h \ $(OBJDIR)/doc_.c:$(OBJDIR)/doc.h \ $(OBJDIR)/encode_.c:$(OBJDIR)/encode.h \ $(OBJDIR)/etag_.c:$(OBJDIR)/etag.h \ $(OBJDIR)/event_.c:$(OBJDIR)/event.h \ $(OBJDIR)/export_.c:$(OBJDIR)/export.h \ $(OBJDIR)/extcgi_.c:$(OBJDIR)/extcgi.h \ $(OBJDIR)/file_.c:$(OBJDIR)/file.h \ $(OBJDIR)/finfo_.c:$(OBJDIR)/finfo.h \ $(OBJDIR)/foci_.c:$(OBJDIR)/foci.h \ $(OBJDIR)/forum_.c:$(OBJDIR)/forum.h \ $(OBJDIR)/fshell_.c:$(OBJDIR)/fshell.h \ $(OBJDIR)/fusefs_.c:$(OBJDIR)/fusefs.h \ $(OBJDIR)/fuzz_.c:$(OBJDIR)/fuzz.h \ $(OBJDIR)/glob_.c:$(OBJDIR)/glob.h \ $(OBJDIR)/graph_.c:$(OBJDIR)/graph.h \ $(OBJDIR)/gzip_.c:$(OBJDIR)/gzip.h \ $(OBJDIR)/hname_.c:$(OBJDIR)/hname.h \ $(OBJDIR)/http_.c:$(OBJDIR)/http.h \ $(OBJDIR)/http_socket_.c:$(OBJDIR)/http_socket.h \ $(OBJDIR)/http_ssl_.c:$(OBJDIR)/http_ssl.h \ |
︙ | ︙ | |||
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \ $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \ $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \ $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \ $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \ $(OBJDIR)/report_.c:$(OBJDIR)/report.h \ $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \ $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \ $(OBJDIR)/search_.c:$(OBJDIR)/search.h \ $(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \ $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \ $(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \ | > | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | $(OBJDIR)/popen_.c:$(OBJDIR)/popen.h \ $(OBJDIR)/pqueue_.c:$(OBJDIR)/pqueue.h \ $(OBJDIR)/printf_.c:$(OBJDIR)/printf.h \ $(OBJDIR)/publish_.c:$(OBJDIR)/publish.h \ $(OBJDIR)/purge_.c:$(OBJDIR)/purge.h \ $(OBJDIR)/rebuild_.c:$(OBJDIR)/rebuild.h \ $(OBJDIR)/regexp_.c:$(OBJDIR)/regexp.h \ $(OBJDIR)/repolist_.c:$(OBJDIR)/repolist.h \ $(OBJDIR)/report_.c:$(OBJDIR)/report.h \ $(OBJDIR)/rss_.c:$(OBJDIR)/rss.h \ $(OBJDIR)/schema_.c:$(OBJDIR)/schema.h \ $(OBJDIR)/search_.c:$(OBJDIR)/search.h \ $(OBJDIR)/security_audit_.c:$(OBJDIR)/security_audit.h \ $(OBJDIR)/setup_.c:$(OBJDIR)/setup.h \ $(OBJDIR)/setupuser_.c:$(OBJDIR)/setupuser.h \ |
︙ | ︙ | |||
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 | $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@ $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/descendants.c >$@ $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c | > > > > > > > > | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 | $(OBJDIR)/deltacmd_.c: $(SRCDIR)/deltacmd.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/deltacmd.c >$@ $(OBJDIR)/deltacmd.o: $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltacmd.o -c $(OBJDIR)/deltacmd_.c $(OBJDIR)/deltacmd.h: $(OBJDIR)/headers $(OBJDIR)/deltafunc_.c: $(SRCDIR)/deltafunc.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/deltafunc.c >$@ $(OBJDIR)/deltafunc.o: $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/deltafunc.o -c $(OBJDIR)/deltafunc_.c $(OBJDIR)/deltafunc.h: $(OBJDIR)/headers $(OBJDIR)/descendants_.c: $(SRCDIR)/descendants.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/descendants.c >$@ $(OBJDIR)/descendants.o: $(OBJDIR)/descendants_.c $(OBJDIR)/descendants.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/descendants.o -c $(OBJDIR)/descendants_.c |
︙ | ︙ | |||
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 | $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/export.c >$@ $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c $(OBJDIR)/export.h: $(OBJDIR)/headers $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/file.c >$@ $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c | > > > > > > > > | 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | $(OBJDIR)/export_.c: $(SRCDIR)/export.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/export.c >$@ $(OBJDIR)/export.o: $(OBJDIR)/export_.c $(OBJDIR)/export.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/export.o -c $(OBJDIR)/export_.c $(OBJDIR)/export.h: $(OBJDIR)/headers $(OBJDIR)/extcgi_.c: $(SRCDIR)/extcgi.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/extcgi.c >$@ $(OBJDIR)/extcgi.o: $(OBJDIR)/extcgi_.c $(OBJDIR)/extcgi.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/extcgi.o -c $(OBJDIR)/extcgi_.c $(OBJDIR)/extcgi.h: $(OBJDIR)/headers $(OBJDIR)/file_.c: $(SRCDIR)/file.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/file.c >$@ $(OBJDIR)/file.o: $(OBJDIR)/file_.c $(OBJDIR)/file.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/file.o -c $(OBJDIR)/file_.c |
︙ | ︙ | |||
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 | $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/fusefs.c >$@ $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h: $(OBJDIR)/headers $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/glob.c >$@ $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c | > > > > > > > > | 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | $(OBJDIR)/fusefs_.c: $(SRCDIR)/fusefs.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/fusefs.c >$@ $(OBJDIR)/fusefs.o: $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fusefs.o -c $(OBJDIR)/fusefs_.c $(OBJDIR)/fusefs.h: $(OBJDIR)/headers $(OBJDIR)/fuzz_.c: $(SRCDIR)/fuzz.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/fuzz.c >$@ $(OBJDIR)/fuzz.o: $(OBJDIR)/fuzz_.c $(OBJDIR)/fuzz.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/fuzz.o -c $(OBJDIR)/fuzz_.c $(OBJDIR)/fuzz.h: $(OBJDIR)/headers $(OBJDIR)/glob_.c: $(SRCDIR)/glob.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/glob.c >$@ $(OBJDIR)/glob.o: $(OBJDIR)/glob_.c $(OBJDIR)/glob.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/glob.o -c $(OBJDIR)/glob_.c |
︙ | ︙ | |||
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 | $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/regexp.c >$@ $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h: $(OBJDIR)/headers $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/report.c >$@ $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c | > > > > > > > > | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 | $(OBJDIR)/regexp_.c: $(SRCDIR)/regexp.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/regexp.c >$@ $(OBJDIR)/regexp.o: $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/regexp.o -c $(OBJDIR)/regexp_.c $(OBJDIR)/regexp.h: $(OBJDIR)/headers $(OBJDIR)/repolist_.c: $(SRCDIR)/repolist.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/repolist.c >$@ $(OBJDIR)/repolist.o: $(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/repolist.o -c $(OBJDIR)/repolist_.c $(OBJDIR)/repolist.h: $(OBJDIR)/headers $(OBJDIR)/report_.c: $(SRCDIR)/report.c $(TRANSLATE) $(TRANSLATE) $(SRCDIR)/report.c >$@ $(OBJDIR)/report.o: $(OBJDIR)/report_.c $(OBJDIR)/report.h $(SRCDIR)/config.h $(XTCC) -o $(OBJDIR)/report.o -c $(OBJDIR)/report_.c |
︙ | ︙ | |||
2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c $(OBJDIR)/zip.h: $(OBJDIR)/headers MINGW_OPTIONS = -D_HAVE__MINGW_H SQLITE_OPTIONS = -DNDEBUG=1 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ | > < > < | 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | $(XTCC) -o $(OBJDIR)/zip.o -c $(OBJDIR)/zip_.c $(OBJDIR)/zip.h: $(OBJDIR)/headers MINGW_OPTIONS = -D_HAVE__MINGW_H SQLITE_OPTIONS = -DNDEBUG=1 \ -DSQLITE_DQS=0 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_STMTVTAB \ -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ -DSQLITE_WIN32_NO_ANSI \ $(MINGW_OPTIONS) \ -DSQLITE_USE_MALLOC_H \ -DSQLITE_USE_MSIZE SHELL_OPTIONS = -DNDEBUG=1 \ -DSQLITE_DQS=0 \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_OMIT_DECLTYPE \ -DSQLITE_OMIT_DEPRECATED \ -DSQLITE_OMIT_GET_TABLE \ -DSQLITE_OMIT_PROGRESS_CALLBACK \ -DSQLITE_OMIT_SHARED_CACHE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_MAX_EXPR_DEPTH=0 \ -DSQLITE_USE_ALLOCA \ -DSQLITE_ENABLE_LOCKING_STYLE=0 \ -DSQLITE_DEFAULT_FILE_FORMAT=4 \ -DSQLITE_ENABLE_EXPLAIN_COMMENTS \ -DSQLITE_ENABLE_FTS4 \ -DSQLITE_ENABLE_DBSTAT_VTAB \ -DSQLITE_ENABLE_JSON1 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_STMTVTAB \ -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ |
︙ | ︙ |
Changes to win/Makefile.msc.
1 2 3 4 5 6 7 8 9 10 11 12 | # ############################################################################## # WARNING: DO NOT EDIT, AUTOMATICALLY GENERATED FILE (SEE "src/makemake.tcl") ############################################################################## # # # This file is automatically generated. Instead of editing this # file, edit "makemake.tcl" then run "tclsh makemake.tcl" # to regenerate this file. # B = .. SRCDIR = $(B)\src | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # ############################################################################## # WARNING: DO NOT EDIT, AUTOMATICALLY GENERATED FILE (SEE "src/makemake.tcl") ############################################################################## # # # This file is automatically generated. Instead of editing this # file, edit "makemake.tcl" then run "tclsh makemake.tcl" # to regenerate this file. # B = .. SRCDIR = $(B)\src T = msvcbld OBJDIR = $(T) OX = $(OBJDIR) O = .obj E = .exe P = .pdb INSTALLDIR = . !ifdef DESTDIR |
︙ | ︙ | |||
108 109 110 111 112 113 114 | # Enable support for the SQLite Encryption Extension? !ifndef USE_SEE USE_SEE = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 | | | | | | < < | < < < < < < < < < < < < | < < < < < < < < < < < < | < < < < < < < < < < | 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 | # Enable support for the SQLite Encryption Extension? !ifndef USE_SEE USE_SEE = 0 !endif !if $(FOSSIL_ENABLE_SSL)!=0 SSLDIR = $(B)\compat\openssl-1.1.1d SSLINCDIR = $(SSLDIR)\include !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLLIBDIR = $(SSLDIR) !else SSLLIBDIR = $(SSLDIR) !endif SSLLFLAGS = /nologo /opt:ref /debug SSLLIB = libssl.lib libcrypto.lib user32.lib gdi32.lib crypt32.lib !if "$(PLATFORM)"=="amd64" || "$(PLATFORM)"=="x64" !message Using 'x64' platform for OpenSSL... SSLCONFIG = VC-WIN64A no-asm no-ssl3 no-weak-ssl-ciphers !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLCONFIG = $(SSLCONFIG) shared !else SSLCONFIG = $(SSLCONFIG) no-shared !endif !elseif "$(PLATFORM)"=="ia64" !message Using 'ia64' platform for OpenSSL... SSLCONFIG = VC-WIN64I no-asm no-ssl3 no-weak-ssl-ciphers !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLCONFIG = $(SSLCONFIG) shared !else SSLCONFIG = $(SSLCONFIG) no-shared !endif !else !message Assuming 'x86' platform for OpenSSL... SSLCONFIG = VC-WIN32 no-asm no-ssl3 no-weak-ssl-ciphers !if $(FOSSIL_DYNAMIC_BUILD)!=0 SSLCONFIG = $(SSLCONFIG) shared !else SSLCONFIG = $(SSLCONFIG) no-shared !endif !endif !endif !if $(FOSSIL_ENABLE_TCL)!=0 TCLDIR = $(B)\compat\tcl-8.6 TCLSRCDIR = $(TCLDIR) |
︙ | ︙ | |||
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | !if $(USE_SEE)!=0 TCC = $(TCC) /DUSE_SEE=1 RCC = $(RCC) /DUSE_SEE=1 !endif SQLITE_OPTIONS = /DNDEBUG=1 \ /DSQLITE_THREADSAFE=0 \ /DSQLITE_DEFAULT_MEMSTATUS=0 \ /DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ /DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ /DSQLITE_OMIT_DECLTYPE \ /DSQLITE_OMIT_DEPRECATED \ /DSQLITE_OMIT_GET_TABLE \ /DSQLITE_OMIT_PROGRESS_CALLBACK \ /DSQLITE_OMIT_SHARED_CACHE \ /DSQLITE_OMIT_LOAD_EXTENSION \ /DSQLITE_MAX_EXPR_DEPTH=0 \ /DSQLITE_USE_ALLOCA \ /DSQLITE_ENABLE_LOCKING_STYLE=0 \ /DSQLITE_DEFAULT_FILE_FORMAT=4 \ /DSQLITE_ENABLE_EXPLAIN_COMMENTS \ /DSQLITE_ENABLE_FTS4 \ | > < > < | 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 | !if $(USE_SEE)!=0 TCC = $(TCC) /DUSE_SEE=1 RCC = $(RCC) /DUSE_SEE=1 !endif SQLITE_OPTIONS = /DNDEBUG=1 \ /DSQLITE_DQS=0 \ /DSQLITE_THREADSAFE=0 \ /DSQLITE_DEFAULT_MEMSTATUS=0 \ /DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ /DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ /DSQLITE_OMIT_DECLTYPE \ /DSQLITE_OMIT_DEPRECATED \ /DSQLITE_OMIT_GET_TABLE \ /DSQLITE_OMIT_PROGRESS_CALLBACK \ /DSQLITE_OMIT_SHARED_CACHE \ /DSQLITE_OMIT_LOAD_EXTENSION \ /DSQLITE_MAX_EXPR_DEPTH=0 \ /DSQLITE_USE_ALLOCA \ /DSQLITE_ENABLE_LOCKING_STYLE=0 \ /DSQLITE_DEFAULT_FILE_FORMAT=4 \ /DSQLITE_ENABLE_EXPLAIN_COMMENTS \ /DSQLITE_ENABLE_FTS4 \ /DSQLITE_ENABLE_DBSTAT_VTAB \ /DSQLITE_ENABLE_JSON1 \ /DSQLITE_ENABLE_FTS5 \ /DSQLITE_ENABLE_STMTVTAB \ /DSQLITE_HAVE_ZLIB \ /DSQLITE_INTROSPECTION_PRAGMAS \ /DSQLITE_ENABLE_DBPAGE_VTAB \ /DSQLITE_WIN32_NO_ANSI SHELL_OPTIONS = /DNDEBUG=1 \ /DSQLITE_DQS=0 \ /DSQLITE_THREADSAFE=0 \ /DSQLITE_DEFAULT_MEMSTATUS=0 \ /DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \ /DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ /DSQLITE_OMIT_DECLTYPE \ /DSQLITE_OMIT_DEPRECATED \ /DSQLITE_OMIT_GET_TABLE \ /DSQLITE_OMIT_PROGRESS_CALLBACK \ /DSQLITE_OMIT_SHARED_CACHE \ /DSQLITE_OMIT_LOAD_EXTENSION \ /DSQLITE_MAX_EXPR_DEPTH=0 \ /DSQLITE_USE_ALLOCA \ /DSQLITE_ENABLE_LOCKING_STYLE=0 \ /DSQLITE_DEFAULT_FILE_FORMAT=4 \ /DSQLITE_ENABLE_EXPLAIN_COMMENTS \ /DSQLITE_ENABLE_FTS4 \ /DSQLITE_ENABLE_DBSTAT_VTAB \ /DSQLITE_ENABLE_JSON1 \ /DSQLITE_ENABLE_FTS5 \ /DSQLITE_ENABLE_STMTVTAB \ /DSQLITE_HAVE_ZLIB \ /DSQLITE_INTROSPECTION_PRAGMAS \ /DSQLITE_ENABLE_DBPAGE_VTAB \ |
︙ | ︙ | |||
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 | "$(OX)\comformat_.c" \ "$(OX)\configure_.c" \ "$(OX)\content_.c" \ "$(OX)\cookies_.c" \ "$(OX)\db_.c" \ "$(OX)\delta_.c" \ "$(OX)\deltacmd_.c" \ "$(OX)\descendants_.c" \ "$(OX)\diff_.c" \ "$(OX)\diffcmd_.c" \ "$(OX)\dispatch_.c" \ "$(OX)\doc_.c" \ "$(OX)\encode_.c" \ "$(OX)\etag_.c" \ "$(OX)\event_.c" \ "$(OX)\export_.c" \ "$(OX)\file_.c" \ "$(OX)\finfo_.c" \ "$(OX)\foci_.c" \ "$(OX)\forum_.c" \ "$(OX)\fshell_.c" \ "$(OX)\fusefs_.c" \ "$(OX)\glob_.c" \ "$(OX)\graph_.c" \ "$(OX)\gzip_.c" \ "$(OX)\hname_.c" \ "$(OX)\http_.c" \ "$(OX)\http_socket_.c" \ "$(OX)\http_ssl_.c" \ | > > > | 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 | "$(OX)\comformat_.c" \ "$(OX)\configure_.c" \ "$(OX)\content_.c" \ "$(OX)\cookies_.c" \ "$(OX)\db_.c" \ "$(OX)\delta_.c" \ "$(OX)\deltacmd_.c" \ "$(OX)\deltafunc_.c" \ "$(OX)\descendants_.c" \ "$(OX)\diff_.c" \ "$(OX)\diffcmd_.c" \ "$(OX)\dispatch_.c" \ "$(OX)\doc_.c" \ "$(OX)\encode_.c" \ "$(OX)\etag_.c" \ "$(OX)\event_.c" \ "$(OX)\export_.c" \ "$(OX)\extcgi_.c" \ "$(OX)\file_.c" \ "$(OX)\finfo_.c" \ "$(OX)\foci_.c" \ "$(OX)\forum_.c" \ "$(OX)\fshell_.c" \ "$(OX)\fusefs_.c" \ "$(OX)\fuzz_.c" \ "$(OX)\glob_.c" \ "$(OX)\graph_.c" \ "$(OX)\gzip_.c" \ "$(OX)\hname_.c" \ "$(OX)\http_.c" \ "$(OX)\http_socket_.c" \ "$(OX)\http_ssl_.c" \ |
︙ | ︙ | |||
478 479 480 481 482 483 484 485 486 487 488 489 490 491 | "$(OX)\popen_.c" \ "$(OX)\pqueue_.c" \ "$(OX)\printf_.c" \ "$(OX)\publish_.c" \ "$(OX)\purge_.c" \ "$(OX)\rebuild_.c" \ "$(OX)\regexp_.c" \ "$(OX)\report_.c" \ "$(OX)\rss_.c" \ "$(OX)\schema_.c" \ "$(OX)\search_.c" \ "$(OX)\security_audit_.c" \ "$(OX)\setup_.c" \ "$(OX)\setupuser_.c" \ | > | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | "$(OX)\popen_.c" \ "$(OX)\pqueue_.c" \ "$(OX)\printf_.c" \ "$(OX)\publish_.c" \ "$(OX)\purge_.c" \ "$(OX)\rebuild_.c" \ "$(OX)\regexp_.c" \ "$(OX)\repolist_.c" \ "$(OX)\report_.c" \ "$(OX)\rss_.c" \ "$(OX)\schema_.c" \ "$(OX)\search_.c" \ "$(OX)\security_audit_.c" \ "$(OX)\setup_.c" \ "$(OX)\setupuser_.c" \ |
︙ | ︙ | |||
581 582 583 584 585 586 587 588 589 590 591 592 593 594 | "$(SRCDIR)\..\skins\rounded1\footer.txt" \ "$(SRCDIR)\..\skins\rounded1\header.txt" \ "$(SRCDIR)\..\skins\xekri\css.txt" \ "$(SRCDIR)\..\skins\xekri\details.txt" \ "$(SRCDIR)\..\skins\xekri\footer.txt" \ "$(SRCDIR)\..\skins\xekri\header.txt" \ "$(SRCDIR)\ci_edit.js" \ "$(SRCDIR)\diff.tcl" \ "$(SRCDIR)\forum.js" \ "$(SRCDIR)\graph.js" \ "$(SRCDIR)\href.js" \ "$(SRCDIR)\login.js" \ "$(SRCDIR)\markdown.md" \ "$(SRCDIR)\menu.js" \ | > | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | "$(SRCDIR)\..\skins\rounded1\footer.txt" \ "$(SRCDIR)\..\skins\rounded1\header.txt" \ "$(SRCDIR)\..\skins\xekri\css.txt" \ "$(SRCDIR)\..\skins\xekri\details.txt" \ "$(SRCDIR)\..\skins\xekri\footer.txt" \ "$(SRCDIR)\..\skins\xekri\header.txt" \ "$(SRCDIR)\ci_edit.js" \ "$(SRCDIR)\copybtn.js" \ "$(SRCDIR)\diff.tcl" \ "$(SRCDIR)\forum.js" \ "$(SRCDIR)\graph.js" \ "$(SRCDIR)\href.js" \ "$(SRCDIR)\login.js" \ "$(SRCDIR)\markdown.md" \ "$(SRCDIR)\menu.js" \ |
︙ | ︙ | |||
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 | "$(OX)\configure$O" \ "$(OX)\content$O" \ "$(OX)\cookies$O" \ "$(OX)\cson_amalgamation$O" \ "$(OX)\db$O" \ "$(OX)\delta$O" \ "$(OX)\deltacmd$O" \ "$(OX)\descendants$O" \ "$(OX)\diff$O" \ "$(OX)\diffcmd$O" \ "$(OX)\dispatch$O" \ "$(OX)\doc$O" \ "$(OX)\encode$O" \ "$(OX)\etag$O" \ "$(OX)\event$O" \ "$(OX)\export$O" \ "$(OX)\file$O" \ "$(OX)\finfo$O" \ "$(OX)\foci$O" \ "$(OX)\forum$O" \ "$(OX)\fshell$O" \ "$(OX)\fusefs$O" \ "$(OX)\glob$O" \ "$(OX)\graph$O" \ "$(OX)\gzip$O" \ "$(OX)\hname$O" \ "$(OX)\http$O" \ "$(OX)\http_socket$O" \ "$(OX)\http_ssl$O" \ | > > > | 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 | "$(OX)\configure$O" \ "$(OX)\content$O" \ "$(OX)\cookies$O" \ "$(OX)\cson_amalgamation$O" \ "$(OX)\db$O" \ "$(OX)\delta$O" \ "$(OX)\deltacmd$O" \ "$(OX)\deltafunc$O" \ "$(OX)\descendants$O" \ "$(OX)\diff$O" \ "$(OX)\diffcmd$O" \ "$(OX)\dispatch$O" \ "$(OX)\doc$O" \ "$(OX)\encode$O" \ "$(OX)\etag$O" \ "$(OX)\event$O" \ "$(OX)\export$O" \ "$(OX)\extcgi$O" \ "$(OX)\file$O" \ "$(OX)\finfo$O" \ "$(OX)\foci$O" \ "$(OX)\forum$O" \ "$(OX)\fshell$O" \ "$(OX)\fusefs$O" \ "$(OX)\fuzz$O" \ "$(OX)\glob$O" \ "$(OX)\graph$O" \ "$(OX)\gzip$O" \ "$(OX)\hname$O" \ "$(OX)\http$O" \ "$(OX)\http_socket$O" \ "$(OX)\http_ssl$O" \ |
︙ | ︙ | |||
687 688 689 690 691 692 693 694 695 696 697 698 699 700 | "$(OX)\popen$O" \ "$(OX)\pqueue$O" \ "$(OX)\printf$O" \ "$(OX)\publish$O" \ "$(OX)\purge$O" \ "$(OX)\rebuild$O" \ "$(OX)\regexp$O" \ "$(OX)\report$O" \ "$(OX)\rss$O" \ "$(OX)\schema$O" \ "$(OX)\search$O" \ "$(OX)\security_audit$O" \ "$(OX)\setup$O" \ "$(OX)\setupuser$O" \ | > | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | "$(OX)\popen$O" \ "$(OX)\pqueue$O" \ "$(OX)\printf$O" \ "$(OX)\publish$O" \ "$(OX)\purge$O" \ "$(OX)\rebuild$O" \ "$(OX)\regexp$O" \ "$(OX)\repolist$O" \ "$(OX)\report$O" \ "$(OX)\rss$O" \ "$(OX)\schema$O" \ "$(OX)\search$O" \ "$(OX)\security_audit$O" \ "$(OX)\setup$O" \ "$(OX)\setupuser$O" \ |
︙ | ︙ | |||
743 744 745 746 747 748 749 | "$(OX)\zip$O" \ !if $(FOSSIL_ENABLE_MINIZ)!=0 "$(OX)\miniz$O" \ !endif "$(OX)\fossil.res" | > | > | > > | | | 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | "$(OX)\zip$O" \ !if $(FOSSIL_ENABLE_MINIZ)!=0 "$(OX)\miniz$O" \ !endif "$(OX)\fossil.res" !ifndef BASEAPPNAME BASEAPPNAME = fossil !endif APPNAME = $(OX)\$(BASEAPPNAME)$(E) PDBNAME = $(OX)\$(BASEAPPNAME)$(P) APPMANIFEST = $(APPNAME).manifest APPTARGETS = all: "$(OX)" "$(APPNAME)" install: "$(APPNAME)" echo F | xcopy /Y "$(APPNAME)" "$(INSTALLDIR)"\* !if $(DEBUG)!=0 echo F | xcopy /Y "$(PDBNAME)" "$(INSTALLDIR)"\* |
︙ | ︙ | |||
778 779 780 781 782 783 784 | !if $(FOSSIL_ENABLE_SSL)!=0 openssl: @echo Building OpenSSL from "$(SSLDIR)"... !if "$(PERLDIR)" != "" @set "PATH=$(PERLDIR);$(PATH)" !endif @pushd "$(SSLDIR)" && "$(PERL)" Configure $(SSLCONFIG) && popd | < | | | | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | !if $(FOSSIL_ENABLE_SSL)!=0 openssl: @echo Building OpenSSL from "$(SSLDIR)"... !if "$(PERLDIR)" != "" @set "PATH=$(PERLDIR);$(PATH)" !endif @pushd "$(SSLDIR)" && "$(PERL)" Configure $(SSLCONFIG) && popd !if $(FOSSIL_ENABLE_WINXP)!=0 @pushd "$(SSLDIR)" && "$(MAKE)" "CC=cl $(XPCFLAGS)" "LFLAGS=$(XPLDFLAGS)" && popd !else @pushd "$(SSLDIR)" && "$(MAKE)" && popd !endif clean-openssl: @pushd "$(SSLDIR)" && "$(MAKE)" clean && popd !endif !if $(FOSSIL_ENABLE_MINIZ)==0 !if $(FOSSIL_BUILD_ZLIB)!=0 APPTARGETS = $(APPTARGETS) zlib !endif |
︙ | ︙ | |||
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 | echo "$(OX)\configure.obj" >> $@ echo "$(OX)\content.obj" >> $@ echo "$(OX)\cookies.obj" >> $@ echo "$(OX)\cson_amalgamation.obj" >> $@ echo "$(OX)\db.obj" >> $@ echo "$(OX)\delta.obj" >> $@ echo "$(OX)\deltacmd.obj" >> $@ echo "$(OX)\descendants.obj" >> $@ echo "$(OX)\diff.obj" >> $@ echo "$(OX)\diffcmd.obj" >> $@ echo "$(OX)\dispatch.obj" >> $@ echo "$(OX)\doc.obj" >> $@ echo "$(OX)\encode.obj" >> $@ echo "$(OX)\etag.obj" >> $@ echo "$(OX)\event.obj" >> $@ echo "$(OX)\export.obj" >> $@ echo "$(OX)\file.obj" >> $@ echo "$(OX)\finfo.obj" >> $@ echo "$(OX)\foci.obj" >> $@ echo "$(OX)\forum.obj" >> $@ echo "$(OX)\fshell.obj" >> $@ echo "$(OX)\fusefs.obj" >> $@ echo "$(OX)\glob.obj" >> $@ echo "$(OX)\graph.obj" >> $@ echo "$(OX)\gzip.obj" >> $@ echo "$(OX)\hname.obj" >> $@ echo "$(OX)\http.obj" >> $@ echo "$(OX)\http_socket.obj" >> $@ echo "$(OX)\http_ssl.obj" >> $@ | > > > | 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 | echo "$(OX)\configure.obj" >> $@ echo "$(OX)\content.obj" >> $@ echo "$(OX)\cookies.obj" >> $@ echo "$(OX)\cson_amalgamation.obj" >> $@ echo "$(OX)\db.obj" >> $@ echo "$(OX)\delta.obj" >> $@ echo "$(OX)\deltacmd.obj" >> $@ echo "$(OX)\deltafunc.obj" >> $@ echo "$(OX)\descendants.obj" >> $@ echo "$(OX)\diff.obj" >> $@ echo "$(OX)\diffcmd.obj" >> $@ echo "$(OX)\dispatch.obj" >> $@ echo "$(OX)\doc.obj" >> $@ echo "$(OX)\encode.obj" >> $@ echo "$(OX)\etag.obj" >> $@ echo "$(OX)\event.obj" >> $@ echo "$(OX)\export.obj" >> $@ echo "$(OX)\extcgi.obj" >> $@ echo "$(OX)\file.obj" >> $@ echo "$(OX)\finfo.obj" >> $@ echo "$(OX)\foci.obj" >> $@ echo "$(OX)\forum.obj" >> $@ echo "$(OX)\fshell.obj" >> $@ echo "$(OX)\fusefs.obj" >> $@ echo "$(OX)\fuzz.obj" >> $@ echo "$(OX)\glob.obj" >> $@ echo "$(OX)\graph.obj" >> $@ echo "$(OX)\gzip.obj" >> $@ echo "$(OX)\hname.obj" >> $@ echo "$(OX)\http.obj" >> $@ echo "$(OX)\http_socket.obj" >> $@ echo "$(OX)\http_ssl.obj" >> $@ |
︙ | ︙ | |||
900 901 902 903 904 905 906 907 908 909 910 911 912 913 | echo "$(OX)\popen.obj" >> $@ echo "$(OX)\pqueue.obj" >> $@ echo "$(OX)\printf.obj" >> $@ echo "$(OX)\publish.obj" >> $@ echo "$(OX)\purge.obj" >> $@ echo "$(OX)\rebuild.obj" >> $@ echo "$(OX)\regexp.obj" >> $@ echo "$(OX)\report.obj" >> $@ echo "$(OX)\rss.obj" >> $@ echo "$(OX)\schema.obj" >> $@ echo "$(OX)\search.obj" >> $@ echo "$(OX)\security_audit.obj" >> $@ echo "$(OX)\setup.obj" >> $@ echo "$(OX)\setupuser.obj" >> $@ | > | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | echo "$(OX)\popen.obj" >> $@ echo "$(OX)\pqueue.obj" >> $@ echo "$(OX)\printf.obj" >> $@ echo "$(OX)\publish.obj" >> $@ echo "$(OX)\purge.obj" >> $@ echo "$(OX)\rebuild.obj" >> $@ echo "$(OX)\regexp.obj" >> $@ echo "$(OX)\repolist.obj" >> $@ echo "$(OX)\report.obj" >> $@ echo "$(OX)\rss.obj" >> $@ echo "$(OX)\schema.obj" >> $@ echo "$(OX)\search.obj" >> $@ echo "$(OX)\security_audit.obj" >> $@ echo "$(OX)\setup.obj" >> $@ echo "$(OX)\setupuser.obj" >> $@ |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | echo "$(SRCDIR)\../skins/rounded1/footer.txt" >> $@ echo "$(SRCDIR)\../skins/rounded1/header.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@ echo "$(SRCDIR)\ci_edit.js" >> $@ echo "$(SRCDIR)\diff.tcl" >> $@ echo "$(SRCDIR)\forum.js" >> $@ echo "$(SRCDIR)\graph.js" >> $@ echo "$(SRCDIR)\href.js" >> $@ echo "$(SRCDIR)\login.js" >> $@ echo "$(SRCDIR)\markdown.md" >> $@ echo "$(SRCDIR)\menu.js" >> $@ | > | 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | echo "$(SRCDIR)\../skins/rounded1/footer.txt" >> $@ echo "$(SRCDIR)\../skins/rounded1/header.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/css.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/details.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/footer.txt" >> $@ echo "$(SRCDIR)\../skins/xekri/header.txt" >> $@ echo "$(SRCDIR)\ci_edit.js" >> $@ echo "$(SRCDIR)\copybtn.js" >> $@ echo "$(SRCDIR)\diff.tcl" >> $@ echo "$(SRCDIR)\forum.js" >> $@ echo "$(SRCDIR)\graph.js" >> $@ echo "$(SRCDIR)\href.js" >> $@ echo "$(SRCDIR)\login.js" >> $@ echo "$(SRCDIR)\markdown.md" >> $@ echo "$(SRCDIR)\menu.js" >> $@ |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\deltacmd$O" : "$(OX)\deltacmd_.c" "$(OX)\deltacmd.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\deltacmd_.c" "$(OX)\deltacmd_.c" : "$(SRCDIR)\deltacmd.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\descendants$O" : "$(OX)\descendants_.c" "$(OX)\descendants.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\descendants_.c" "$(OX)\descendants_.c" : "$(SRCDIR)\descendants.c" "$(OBJDIR)\translate$E" $** > $@ | > > > > > > | 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\deltacmd$O" : "$(OX)\deltacmd_.c" "$(OX)\deltacmd.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\deltacmd_.c" "$(OX)\deltacmd_.c" : "$(SRCDIR)\deltacmd.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\deltafunc$O" : "$(OX)\deltafunc_.c" "$(OX)\deltafunc.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\deltafunc_.c" "$(OX)\deltafunc_.c" : "$(SRCDIR)\deltafunc.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\descendants$O" : "$(OX)\descendants_.c" "$(OX)\descendants.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\descendants_.c" "$(OX)\descendants_.c" : "$(SRCDIR)\descendants.c" "$(OBJDIR)\translate$E" $** > $@ |
︙ | ︙ | |||
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\export$O" : "$(OX)\export_.c" "$(OX)\export.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\export_.c" "$(OX)\export_.c" : "$(SRCDIR)\export.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\file$O" : "$(OX)\file_.c" "$(OX)\file.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\file_.c" "$(OX)\file_.c" : "$(SRCDIR)\file.c" "$(OBJDIR)\translate$E" $** > $@ | > > > > > > | 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\export$O" : "$(OX)\export_.c" "$(OX)\export.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\export_.c" "$(OX)\export_.c" : "$(SRCDIR)\export.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\extcgi$O" : "$(OX)\extcgi_.c" "$(OX)\extcgi.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\extcgi_.c" "$(OX)\extcgi_.c" : "$(SRCDIR)\extcgi.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\file$O" : "$(OX)\file_.c" "$(OX)\file.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\file_.c" "$(OX)\file_.c" : "$(SRCDIR)\file.c" "$(OBJDIR)\translate$E" $** > $@ |
︙ | ︙ | |||
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\fusefs$O" : "$(OX)\fusefs_.c" "$(OX)\fusefs.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\fusefs_.c" "$(OX)\fusefs_.c" : "$(SRCDIR)\fusefs.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\glob$O" : "$(OX)\glob_.c" "$(OX)\glob.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\glob_.c" "$(OX)\glob_.c" : "$(SRCDIR)\glob.c" "$(OBJDIR)\translate$E" $** > $@ | > > > > > > | 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\fusefs$O" : "$(OX)\fusefs_.c" "$(OX)\fusefs.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\fusefs_.c" "$(OX)\fusefs_.c" : "$(SRCDIR)\fusefs.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\fuzz$O" : "$(OX)\fuzz_.c" "$(OX)\fuzz.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\fuzz_.c" "$(OX)\fuzz_.c" : "$(SRCDIR)\fuzz.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\glob$O" : "$(OX)\glob_.c" "$(OX)\glob.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\glob_.c" "$(OX)\glob_.c" : "$(SRCDIR)\glob.c" "$(OBJDIR)\translate$E" $** > $@ |
︙ | ︙ | |||
1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\regexp$O" : "$(OX)\regexp_.c" "$(OX)\regexp.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\regexp_.c" "$(OX)\regexp_.c" : "$(SRCDIR)\regexp.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\report$O" : "$(OX)\report_.c" "$(OX)\report.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\report_.c" "$(OX)\report_.c" : "$(SRCDIR)\report.c" "$(OBJDIR)\translate$E" $** > $@ | > > > > > > | 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | "$(OBJDIR)\translate$E" $** > $@ "$(OX)\regexp$O" : "$(OX)\regexp_.c" "$(OX)\regexp.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\regexp_.c" "$(OX)\regexp_.c" : "$(SRCDIR)\regexp.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\repolist$O" : "$(OX)\repolist_.c" "$(OX)\repolist.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\repolist_.c" "$(OX)\repolist_.c" : "$(SRCDIR)\repolist.c" "$(OBJDIR)\translate$E" $** > $@ "$(OX)\report$O" : "$(OX)\report_.c" "$(OX)\report.h" $(TCC) /Fo$@ /Fd$(@D)\ -c "$(OX)\report_.c" "$(OX)\report_.c" : "$(SRCDIR)\report.c" "$(OBJDIR)\translate$E" $** > $@ |
︙ | ︙ | |||
1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 | "$(OX)\comformat_.c":"$(OX)\comformat.h" \ "$(OX)\configure_.c":"$(OX)\configure.h" \ "$(OX)\content_.c":"$(OX)\content.h" \ "$(OX)\cookies_.c":"$(OX)\cookies.h" \ "$(OX)\db_.c":"$(OX)\db.h" \ "$(OX)\delta_.c":"$(OX)\delta.h" \ "$(OX)\deltacmd_.c":"$(OX)\deltacmd.h" \ "$(OX)\descendants_.c":"$(OX)\descendants.h" \ "$(OX)\diff_.c":"$(OX)\diff.h" \ "$(OX)\diffcmd_.c":"$(OX)\diffcmd.h" \ "$(OX)\dispatch_.c":"$(OX)\dispatch.h" \ "$(OX)\doc_.c":"$(OX)\doc.h" \ "$(OX)\encode_.c":"$(OX)\encode.h" \ "$(OX)\etag_.c":"$(OX)\etag.h" \ "$(OX)\event_.c":"$(OX)\event.h" \ "$(OX)\export_.c":"$(OX)\export.h" \ "$(OX)\file_.c":"$(OX)\file.h" \ "$(OX)\finfo_.c":"$(OX)\finfo.h" \ "$(OX)\foci_.c":"$(OX)\foci.h" \ "$(OX)\forum_.c":"$(OX)\forum.h" \ "$(OX)\fshell_.c":"$(OX)\fshell.h" \ "$(OX)\fusefs_.c":"$(OX)\fusefs.h" \ "$(OX)\glob_.c":"$(OX)\glob.h" \ "$(OX)\graph_.c":"$(OX)\graph.h" \ "$(OX)\gzip_.c":"$(OX)\gzip.h" \ "$(OX)\hname_.c":"$(OX)\hname.h" \ "$(OX)\http_.c":"$(OX)\http.h" \ "$(OX)\http_socket_.c":"$(OX)\http_socket.h" \ "$(OX)\http_ssl_.c":"$(OX)\http_ssl.h" \ | > > > | 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | "$(OX)\comformat_.c":"$(OX)\comformat.h" \ "$(OX)\configure_.c":"$(OX)\configure.h" \ "$(OX)\content_.c":"$(OX)\content.h" \ "$(OX)\cookies_.c":"$(OX)\cookies.h" \ "$(OX)\db_.c":"$(OX)\db.h" \ "$(OX)\delta_.c":"$(OX)\delta.h" \ "$(OX)\deltacmd_.c":"$(OX)\deltacmd.h" \ "$(OX)\deltafunc_.c":"$(OX)\deltafunc.h" \ "$(OX)\descendants_.c":"$(OX)\descendants.h" \ "$(OX)\diff_.c":"$(OX)\diff.h" \ "$(OX)\diffcmd_.c":"$(OX)\diffcmd.h" \ "$(OX)\dispatch_.c":"$(OX)\dispatch.h" \ "$(OX)\doc_.c":"$(OX)\doc.h" \ "$(OX)\encode_.c":"$(OX)\encode.h" \ "$(OX)\etag_.c":"$(OX)\etag.h" \ "$(OX)\event_.c":"$(OX)\event.h" \ "$(OX)\export_.c":"$(OX)\export.h" \ "$(OX)\extcgi_.c":"$(OX)\extcgi.h" \ "$(OX)\file_.c":"$(OX)\file.h" \ "$(OX)\finfo_.c":"$(OX)\finfo.h" \ "$(OX)\foci_.c":"$(OX)\foci.h" \ "$(OX)\forum_.c":"$(OX)\forum.h" \ "$(OX)\fshell_.c":"$(OX)\fshell.h" \ "$(OX)\fusefs_.c":"$(OX)\fusefs.h" \ "$(OX)\fuzz_.c":"$(OX)\fuzz.h" \ "$(OX)\glob_.c":"$(OX)\glob.h" \ "$(OX)\graph_.c":"$(OX)\graph.h" \ "$(OX)\gzip_.c":"$(OX)\gzip.h" \ "$(OX)\hname_.c":"$(OX)\hname.h" \ "$(OX)\http_.c":"$(OX)\http.h" \ "$(OX)\http_socket_.c":"$(OX)\http_socket.h" \ "$(OX)\http_ssl_.c":"$(OX)\http_ssl.h" \ |
︙ | ︙ | |||
2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 | "$(OX)\popen_.c":"$(OX)\popen.h" \ "$(OX)\pqueue_.c":"$(OX)\pqueue.h" \ "$(OX)\printf_.c":"$(OX)\printf.h" \ "$(OX)\publish_.c":"$(OX)\publish.h" \ "$(OX)\purge_.c":"$(OX)\purge.h" \ "$(OX)\rebuild_.c":"$(OX)\rebuild.h" \ "$(OX)\regexp_.c":"$(OX)\regexp.h" \ "$(OX)\report_.c":"$(OX)\report.h" \ "$(OX)\rss_.c":"$(OX)\rss.h" \ "$(OX)\schema_.c":"$(OX)\schema.h" \ "$(OX)\search_.c":"$(OX)\search.h" \ "$(OX)\security_audit_.c":"$(OX)\security_audit.h" \ "$(OX)\setup_.c":"$(OX)\setup.h" \ "$(OX)\setupuser_.c":"$(OX)\setupuser.h" \ | > | 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 | "$(OX)\popen_.c":"$(OX)\popen.h" \ "$(OX)\pqueue_.c":"$(OX)\pqueue.h" \ "$(OX)\printf_.c":"$(OX)\printf.h" \ "$(OX)\publish_.c":"$(OX)\publish.h" \ "$(OX)\purge_.c":"$(OX)\purge.h" \ "$(OX)\rebuild_.c":"$(OX)\rebuild.h" \ "$(OX)\regexp_.c":"$(OX)\regexp.h" \ "$(OX)\repolist_.c":"$(OX)\repolist.h" \ "$(OX)\report_.c":"$(OX)\report.h" \ "$(OX)\rss_.c":"$(OX)\rss.h" \ "$(OX)\schema_.c":"$(OX)\schema.h" \ "$(OX)\search_.c":"$(OX)\search.h" \ "$(OX)\security_audit_.c":"$(OX)\security_audit.h" \ "$(OX)\setup_.c":"$(OX)\setup.h" \ "$(OX)\setupuser_.c":"$(OX)\setupuser.h" \ |
︙ | ︙ |
Changes to win/buildmsvc.bat.
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | REM NOTE: After this point, the environment should already be setup for REM building with MSVC. REM :skip_setupVisualStudio %_VECHO% VcInstallDir = '%VCINSTALLDIR%' REM REM NOTE: If requested, setup the build environment to refer to the Windows REM SDK v7.1A, which is required if the binaries are being built with REM Visual Studio 201x and need to work on Windows XP. REM IF DEFINED USE_V110SDK71A ( %_AECHO% Forcing use of the Windows SDK v7.1A... | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | REM NOTE: After this point, the environment should already be setup for REM building with MSVC. REM :skip_setupVisualStudio %_VECHO% VcInstallDir = '%VCINSTALLDIR%' REM REM NOTE: Attempt to create the build output directory, if necessary. REM SET OBJDIR=msvcbld IF NOT DEFINED BUILDDIR ( IF DEFINED BUILDSUFFIX ( SET BUILDDIR=%ROOT%\%OBJDIR%%BUILDSUFFIX% ) ) IF NOT DEFINED BUILDDIR GOTO skip_createBuildDir SET OBJDIR=. %_VECHO% BuildSuffix = '%BUILDSUFFIX%' %_VECHO% BuildDir = '%BUILDDIR%' IF NOT EXIST "%BUILDDIR%" ( %__ECHO% MKDIR "%BUILDDIR%" IF ERRORLEVEL 1 ( ECHO Could not make directory "%BUILDDIR%". GOTO errors ) ) REM REM NOTE: Attempt to change to the created build output directory so that REM the generated files will be placed there. REM %__ECHO2% PUSHD "%BUILDDIR%" IF ERRORLEVEL 1 ( ECHO Could not change to directory "%BUILDDIR%". GOTO errors ) :skip_createBuildDir REM REM NOTE: If requested, setup the build environment to refer to the Windows REM SDK v7.1A, which is required if the binaries are being built with REM Visual Studio 201x and need to work on Windows XP. REM IF DEFINED USE_V110SDK71A ( %_AECHO% Forcing use of the Windows SDK v7.1A... |
︙ | ︙ | |||
199 200 201 202 203 204 205 | REM REM NOTE: Attempt to execute NMAKE for the Fossil MSVC makefile, passing REM anything extra from our command line along (e.g. extra options). REM Also, pass the base directory of the Fossil source tree as this REM allows an out-of-source-tree build. REM | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | REM REM NOTE: Attempt to execute NMAKE for the Fossil MSVC makefile, passing REM anything extra from our command line along (e.g. extra options). REM Also, pass the base directory of the Fossil source tree as this REM allows an out-of-source-tree build. REM %__ECHO% nmake /f "%TOOLS%\Makefile.msc" B="%ROOT%" T="%OBJDIR%" %NMAKE_ARGS% %* IF ERRORLEVEL 1 ( GOTO errors ) REM REM NOTE: Attempt to restore the previously saved directory. |
︙ | ︙ |
Changes to www/aboutcgi.wiki.
1 2 3 4 5 6 | <title>How CGI Works In Fossil</title> <h2>Introduction</h2><blockquote> <p>CGI or "Common Gateway Interface" is a venerable yet reliable technique for generating dynamic web content. This article gives a quick background on how CGI works and describes how Fossil can act as a CGI service. <p>This is a "how it works" guide. If you just want to set up Fossil | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <title>How CGI Works In Fossil</title> <h2>Introduction</h2><blockquote> <p>CGI or "Common Gateway Interface" is a venerable yet reliable technique for generating dynamic web content. This article gives a quick background on how CGI works and describes how Fossil can act as a CGI service. <p>This is a "how it works" guide. If you just want to set up Fossil as a CGI server, see the [./server/ | Fossil Server Setup] page. </blockquote> <h2>A Quick Review Of CGI</h2><blockquote> <p> An HTTP request is a block of text that is sent by a client application (usually a web browser) and arrives at the web server over a network connection. The HTTP request contains a URL that describes the information being requested. The URL in the HTTP request is typically the same URL |
︙ | ︙ | |||
178 179 180 181 182 183 184 185 186 187 188 189 190 191 | at "/home/www/resps/subdir.fossil" but there is no such repository. So then it looks at "/home/www/repos/subdir/three.fossil" and finds a repository. The PATH_INFO is shortened by removing "subdir/three/" leaving it at just "timeline". <li> Fossil looks at the rest of PATH_INFO to see that the webpage requested is "timeline". </ol> </blockquote> <h2>Additional Observations</h2> <blockquote><ol type="I"> <li><p> Fossil does not distinguish between the various HTTP methods (GET, PUT, DELETE, etc). Fossil figures out what it needs to do purely from the webpage term of the URI. | > > > > > > > > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | at "/home/www/resps/subdir.fossil" but there is no such repository. So then it looks at "/home/www/repos/subdir/three.fossil" and finds a repository. The PATH_INFO is shortened by removing "subdir/three/" leaving it at just "timeline". <li> Fossil looks at the rest of PATH_INFO to see that the webpage requested is "timeline". </ol> </blockquote> <h2>Additional CGI Script Options</h2> <blockquote> <p> The CGI script can have additional options used to fine-tune Fossil's behavior. See the [./cgi.wiki|CGI script documentation] for details. </p> </blockquote> <h2>Additional Observations</h2> <blockquote><ol type="I"> <li><p> Fossil does not distinguish between the various HTTP methods (GET, PUT, DELETE, etc). Fossil figures out what it needs to do purely from the webpage term of the URI. |
︙ | ︙ | |||
206 207 208 209 210 211 212 213 214 | separate child Fossil process to handle each request. In other words, CGI is used internally to implement "fossil ui/server". <p> SCGI is processed using the same built-in web server, just modified to parse SCGI requests instead of HTTP requests. Each SCGI request is converted into CGI, then Fossil creates a separate child Fossil process to handle each CGI request. </ol> </blockquote> | > > > > | 214 215 216 217 218 219 220 221 222 223 224 225 226 | separate child Fossil process to handle each request. In other words, CGI is used internally to implement "fossil ui/server". <p> SCGI is processed using the same built-in web server, just modified to parse SCGI requests instead of HTTP requests. Each SCGI request is converted into CGI, then Fossil creates a separate child Fossil process to handle each CGI request. <li><p> Fossil is itself often launched using CGI. But Fossil can also then turn around and launch [./serverext.wiki|sub-CGI scripts to implement extensions]. </ol> </blockquote> |
Changes to www/aboutdownload.wiki.
1 2 3 4 5 6 7 8 9 | <title>How The Fossil Download Page Works</title> <h1 align="center">How The Download Page Works</h1> <h2>1.0 Overview</h2> The [/uv/download.html|Download] page for the Fossil self-hosting repository is implemented using [./unvers.wiki|unversioned files]. The "download.html" screen itself, and the various build products are all stored as unversioned content. The download.html page | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <title>How The Fossil Download Page Works</title> <h1 align="center">How The Download Page Works</h1> <h2>1.0 Overview</h2> The [/uv/download.html|Download] page for the Fossil self-hosting repository is implemented using [./unvers.wiki|unversioned files]. The "download.html" screen itself, and the various build products are all stored as unversioned content. The download.html page uses XMLHttpRequest() to retrieve the [/help?cmd=/juvlist|/juvlist] webpage for a list of all unversioned files. Javascript in the [/uv/download.js?mimetype=text/plain|download.js] file (which is sourced by "download.html") then figures out which unversioned files are build products and paints appropriate icons on the displayed download page. When a new version is generated, the developers use the |
︙ | ︙ | |||
49 50 51 52 53 54 55 | how <div class='fossil-doc'> this works. With each new release, the "releases" variable in the javascript on the [/uv/download.js?mimetype=text/plain|download.js] page is edited (using "[/help?cmd=uv|fossil uv edit download.js]") to add details of the release. | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | how <div class='fossil-doc'> this works. With each new release, the "releases" variable in the javascript on the [/uv/download.js?mimetype=text/plain|download.js] page is edited (using "[/help?cmd=uv|fossil uv edit download.js]") to add details of the release. When the JavaScript in the "download.js" file runs, it requests a listing of all unversioned content using the /juvlist URL. ([/juvlist|sample /juvlist output]). The content of the download page is constructed by matching unversioned files against regular expressions in the "releases" variable. Build products need to be constructed on different machines. The precompiled binary for Linux is compiled on Linux, the precompiled binary for Windows |
︙ | ︙ |
Changes to www/alerts.md.
︙ | ︙ | |||
10 11 12 13 14 15 16 | * [Wiki](./wikitheory.wiki) page changes * New and edited [forum](./forum.wiki) posts * Announcements Subscribers can elect to receive emails as soon as these events happen, or they can receive a daily digest of the events instead. | | | | | 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 | * [Wiki](./wikitheory.wiki) page changes * New and edited [forum](./forum.wiki) posts * Announcements Subscribers can elect to receive emails as soon as these events happen, or they can receive a daily digest of the events instead. Email alerts are sent by a [Fossil server](./server/), which must be [set up](#quick) by the Fossil administrator to send email. Email alerts do not currently work if you are only using Fossil from the command line. A bit of terminology: Fossil uses the terms "email alerts" and "notifications" interchangeably. We stick to the former term in this document except when referring to parts of the Fossil UI still using the latter term. ## Setup Prerequisites Much of this document describes how to set up Fossil's email alert system. To follow this guide, you will need a Fossil UI browser window open to the [Admin → Notification](/setup_notification) Fossil UI screen on the Fossil server that will be sending these email alerts, logged in as a user with [**Admin** capability](./caps/ref.html#a). It is not possible to work on a clone of the server's repository and push the configuration changes up to that repo as an Admin user, [on purpose](#backup). **Important:** Do not confuse that screen with Admin → Email-Server, which sets up a different subsystem within Fossil. That feature is related to this document's topic, but it is currently incomplete, so we do not cover it at this time. |
︙ | ︙ | |||
62 63 64 65 66 67 68 | `chroot` feature to wall Fossil off from the rest of the machine, it's fairly simple to set up email alerts. (Otherwise, skip [ahead](#advanced) to the sections on advanced email service setup.) This is our "quick setup" option even though setting up an SMTP mail | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | `chroot` feature to wall Fossil off from the rest of the machine, it's fairly simple to set up email alerts. (Otherwise, skip [ahead](#advanced) to the sections on advanced email service setup.) This is our "quick setup" option even though setting up an SMTP mail server is not trivial, because there are many other reasons to have such a server set up already: internal project email service, `cron` notifications, server status monitoring notifications... With that out of the way, the Fossil-specific steps are easy: 1. Go to [Admin → Notification](/setup_notification) and fill out all of the **Required** fields: |
︙ | ︙ | |||
158 159 160 161 162 163 164 | If you are seeing the following complaint from Fossil: <blockquote> Use a different login with greater privilege than FOO to access /subscribe </blockquote> | | > | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | If you are seeing the following complaint from Fossil: <blockquote> Use a different login with greater privilege than FOO to access /subscribe </blockquote> ...then the repository's administrator forgot to give the [**EmailAlert** capability][cap7] to that user or to a user category that the user is a member of. After a subscriber signs up for alerts for the first time, a single verification email is sent to that subscriber's given email address. The new subscriber must click a link in that email in order to activate the subscription. |
︙ | ︙ | |||
187 188 189 190 191 192 193 194 195 196 197 198 | Those with Fossil repository logins can adjust their email alert settings by visiting the `/alerts` page on the repository. With the default skin, you can get there by clicking the "Logout" link in the upper right corner of any Fossil UI page then clicking the "Email Alerts" link. That link is also available via the Sitemap (`/sitemap`) and via the default skin's hamburger menu (☰). <a id="unsub" name="unsubscribe"></a> ### Unsubscribing To unsubscribe from alerts, visit the `/alerts` page on the repository, | > > | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | Those with Fossil repository logins can adjust their email alert settings by visiting the `/alerts` page on the repository. With the default skin, you can get there by clicking the "Logout" link in the upper right corner of any Fossil UI page then clicking the "Email Alerts" link. That link is also available via the Sitemap (`/sitemap`) and via the default skin's hamburger menu (☰). [cap7]: ./caps/ref.html#7 <a id="unsub" name="unsubscribe"></a> ### Unsubscribing To unsubscribe from alerts, visit the `/alerts` page on the repository, click the "Unsubscribe" button, then check the "Unsubscribe" checkbox to verify your action and press the "Unsubscribe" button a second time. This interlock is intended to prevent accidental unsubscription. <a id="test"></a> ### Test Email Service |
︙ | ︙ | |||
221 222 223 224 225 226 227 | That command assumes that your project contains a "readme" file, but of course it does, because you have followed the [Programming Style Guide Checklist][cl], right? Right. [cl]: https://sendgrid.com/blog/programming-style-guide-checklist/ | | | | | < | | > > > > | 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 | That command assumes that your project contains a "readme" file, but of course it does, because you have followed the [Programming Style Guide Checklist][cl], right? Right. [cl]: https://sendgrid.com/blog/programming-style-guide-checklist/ <a id="cap7" name="ucap"></a> ### User Capabilities Once email alerts are working, you may need to [adjust the default user capabilities](./caps/) to give "[Email Alerts][cap7]" capability to any [user category](./caps/#ucat) or [individual user](./caps/#ucap) that needs to use the subscription setup pages, `/subscribe` and `/alerts`. [**Admin**][capa] and [**Setup**][caps] users always have this capability. To allow any passer-by on the Internet to subscribe, give the "Email Alerts" capability to the "nobody" user category. To require that a person solve a simple CAPTCHA first, give that capability to the "anonymous" user category instead. [capa]: ./caps/ref.html#a [caps]: ./caps/ref.html#s <a id="first" name="frist"></a> ### First Post I suggest taking the time to compose a suitable introductory message especially for your project's forum, one which a new user would find |
︙ | ︙ | |||
472 473 474 475 476 477 478 | <a id="uvs"></a> ## Users vs Subscribers Fossil makes a distinction between "users" and "subscribers". A user is someone with a username and password: that is, someone who can log into | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | <a id="uvs"></a> ## Users vs Subscribers Fossil makes a distinction between "users" and "subscribers". A user is someone with a username and password: that is, someone who can log into the Fossil repository. A subscriber is someone who receives email alerts. Users can also be subscribers and subscribers can be users, but that does not have to be the case. It is possible to be a user without being a subscriber and to be a subscriber without being a user. In the repository database file, users are tracked with the `user` table and subscribers are tracked via the `subscriber` table. |
︙ | ︙ | |||
566 567 568 569 570 571 572 | * The [`/subscribers`](/help?cmd=/subscribers) page <a id="design"></a> ## Design of Email Alerts This section describes the low-level design of the email alert system in | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | * The [`/subscribers`](/help?cmd=/subscribers) page <a id="design"></a> ## Design of Email Alerts This section describes the low-level design of the email alert system in Fossil. This expands on the high-level administration focused material above with minimal repetition. This section assumes expert-level systems knowledge. If the material above sufficed for your purposes, feel free to skip this section, which runs to the end of this document. |
︙ | ︙ |
Changes to www/antibot.wiki.
︙ | ︙ | |||
8 9 10 11 12 13 14 | Fossil, it can present a crippling bandwidth and CPU load. The website presented by a Fossil server is intended to be used interactively by humans, not walked by spiders. This article describes the techniques used by Fossil to try to welcome human users while keeping out spiders. | | | | < | > | | | < | > < | | < < | | | | | | | | | | | | | | | | | | | | | | | | 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 | Fossil, it can present a crippling bandwidth and CPU load. The website presented by a Fossil server is intended to be used interactively by humans, not walked by spiders. This article describes the techniques used by Fossil to try to welcome human users while keeping out spiders. <h2>The Hyperlink User Capability</h2> Every Fossil web session has a "user". For random passers-by on the internet (and for spiders) that user is "nobody". The "anonymous" user is also available for humans who do not wish to identify themselves. The difference is that "anonymous" requires a login (using a password supplied via a CAPTCHA) whereas "nobody" does not require a login. The site administrator can also create logins with passwords for specific individuals. Users without the <b>[./caps/ref.html#h | Hyperlink]</b> capability do not see most Fossil-generated hyperlinks. This is a simple defense against spiders, since [./caps/#ucat | the "nobody" user category] does not have this capability by default. Users must log in (perhaps as "anonymous") before they can see any of the hyperlinks. A spider that cannot log into your Fossil repository will be unable to walk its historical check-ins, create diffs between versions, pull zip archives, etc. by visiting links, because they aren't there. A text message appears at the top of each page in this situation to invite humans to log in as anonymous in order to activate hyperlinks. Because this required login step is annoying to some, Fossil provides other techniques for blocking spiders which are less cumbersome to humans. <h2>Automatic Hyperlinks Based on UserAgent</h2> Fossil has the ability to selectively enable hyperlinks for users that lack the <b>Hyperlink</b> capability based on their UserAgent string in the HTTP request header and on the browsers ability to run Javascript. The UserAgent string is a text identifier that is included in the header of most HTTP requests that identifies the specific maker and version of the browser (or spider) that generated the request. Typical UserAgent strings look like this: <ul> <li> Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0 <li> Mozilla/4.0 (compatible; MSIE 8.0; Windows_NT 5.1; Trident/4.0) <li> Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) <li> Wget/1.12 (openbsd4.9) </ul> The first two UserAgent strings above identify Firefox 19 and Internet Explorer 8.0, both running on Windows NT. The third example is the spider used by Google to index the internet. The fourth example is the "wget" utility running on OpenBSD. Thus the first two UserAgent strings above identify the requester as human whereas the second two identify the requester as a spider. Note that the UserAgent string is completely under the control of the requester and so a malicious spider can forge a UserAgent string that makes it look like a human. But most spiders truly seem to desire to "play nicely" on the internet and are quite open about the fact that they are a spider. And so the UserAgent string provides a good first-guess about whether or not a request originates from a human or a spider. In Fossil, under the Admin/Access menu, there is a setting entitled "<b>Enable hyperlinks for "nobody" based on User-Agent and Javascript</b>". If this setting is enabled, and if the UserAgent string looks like a human and not a spider, then Fossil will enable hyperlinks even if the <b>Hyperlink</b> capability is omitted from the user permissions. This setting gives humans easy access to the hyperlinks while preventing spiders from walking the millions of pages on a typical Fossil site. But the hyperlinks are not enabled directly with the setting above. Instead, the HTML code that is generated contains anchor tags ("<a>") without "href=" attributes. Then, JavaScript code is added to the end of the page that goes back and fills in the "href=" attributes of the anchor tags with the hyperlink targets, thus enabling the hyperlinks. This extra step of using JavaScript to enable the hyperlink targets is a security measure against spiders that forge a human-looking UserAgent string. Most spiders do not bother to run JavaScript and so to the spider the empty anchor tag will be useless. But all modern web browsers implement JavaScript, so hyperlinks will show up normally for human users. <h2>Further Defenses</h2> Recently (as of this writing, in the spring of 2013) the Fossil server on the SQLite website ([http://www.sqlite.org/src/]) has been hit repeatedly by Chinese spiders that use forged UserAgent strings to make them look like normal web browsers and which interpret JavaScript. We do not believe these attacks to be nefarious since SQLite is public domain and the attackers could obtain all information they ever wanted to know about SQLite simply by cloning the repository. Instead, we believe these "attacks" are coming from "script kiddies". But regardless of whether or not malice is involved, these attacks do present an unnecessary load on the server which reduces the responsiveness of the SQLite website for well-behaved and socially responsible users. For this reason, additional defenses against spiders have been put in place. On the Admin/Access page of Fossil, just below the "<b>Enable hyperlinks for "nobody" based on User-Agent and Javascript</b>" setting, there are now two additional sub-settings that can be optionally enabled to control hyperlinks. The first sub-setting waits to run the JavaScript that sets the "href=" attributes on anchor tags until after at least one "mouseover" event has been detected on the <body> element of the page. The thinking here is that spiders will not be simulating mouse motion and so no mouseover events will ever occur and hence the hyperlinks will never become enabled for spiders. The second new sub-setting is a delay (in milliseconds) before setting the "href=" attributes on anchor tags. The default value for this delay is 10 milliseconds. The idea here is that a spider will try to render the page immediately, and will not wait for delayed scripts to be run, thus will never enable the hyperlinks. These two sub-settings can be used separately or together. If used together, then the delay timer does not start until after the first mouse movement is detected. See also [./loadmgmt.md|Managing Server Load] for a description of how expensive pages can be disabled when the server is under heavy load. <h2>The Ongoing Struggle</h2> Fossil currently does a very good job of providing easy access to humans while keeping out troublesome robots and spiders. However, spiders and bots continue to grow more sophisticated, requiring ever more advanced defenses. This "arms race" is unlikely to ever end. The developers of Fossil will continue to try improve the spider defenses of Fossil so check back from time to time for the latest releases and updates. Readers of this page who have suggestions on how to improve the spider defenses in Fossil are invited to submit your ideas to the Fossil Users forum: [https://fossil-scm.org/forum]. |
Changes to www/backoffice.md.
1 2 3 4 5 6 | Backoffice ========== This is technical documentation about the internal workings of Fossil. Ordinary Fossil users do not need to know about anything covered by this document. The information here is intended for people who want to enhance | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Backoffice ========== This is technical documentation about the internal workings of Fossil. Ordinary Fossil users do not need to know about anything covered by this document. The information here is intended for people who want to enhance or extend the Fossil code, or who just want a deeper understanding of the internal workings of Fossil. What Is The Backoffice ---------------------- The backoffice is a mechanism used by a [Fossil server](./server/) to do low-priority background work that is not directly related to the user interface. Here are some examples of the kinds of work that backoffice performs: 1. Sending email alerts and notifications 2. Sending out daily digests of email notifications 3. Other background email handling chores 4. Automatic syncing of peer repositories |
︙ | ︙ | |||
37 38 39 40 41 42 43 | This happens for every webpage, regardless of how that webpage is launched, and regardless of the purpose of the webpage. This also happens on the server for "[fossil sync](/help?cmd=sync)" and [fossil clone](/help?cmd=clone)" commands which are implemented as web requests - albeit requests that the human user never sees. Web requests can arrive at the Fossil server via direct TCP/IP (for example when Fossil is started using commands like "[fossil server](/help?cmd=server)") | | | | | | | | | 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 | This happens for every webpage, regardless of how that webpage is launched, and regardless of the purpose of the webpage. This also happens on the server for "[fossil sync](/help?cmd=sync)" and [fossil clone](/help?cmd=clone)" commands which are implemented as web requests - albeit requests that the human user never sees. Web requests can arrive at the Fossil server via direct TCP/IP (for example when Fossil is started using commands like "[fossil server](/help?cmd=server)") or via [CGI](./server/any/cgi.md) or [SCGI](./server/any/scgi.md) or via SSH. A backoffice process might be started regardless of the origin of the request. The backoffice is not a daemon. Each backoffice process runs for a short while and then exits. This helps keep Fossil easy to manage, since there are no daemons to start and stop. To upgrade Fossil to a new version, you simply replace the older "fossil" executable with the newer one, and the backoffice processes will (within a minute or so) start using the new one. (Upgrading the executable on Windows is more complicated, since on Windows it is not possible to replace an executable file that is in active use. But Windows users probably already know this.) The backoffice is serialized and rate limited. No more than a single backoffice process will be running at once, and backoffice runs will not occur more frequently than once every 60 seconds. If a Fossil server is idle, then no backoffice processes will be running. That means there are no extra processes sitting around taking up memory and process table slots for seldom accessed repositories. The backoffice is an on-demand system. A busy repository will usually have a backoffice running at all times. But an infrequently accessed repository will only have backoffice processes running for a minute or two following the most recent access. Manually Running The Backoffice ------------------------------- The automatic backoffice runs are sufficient for most installations. However, the daily digest of email notifications is handled by the backoffice. If a Fossil server can sometimes go more than a day without being accessed, then the automatic backoffice will never run, and the daily digest might not go out until somebody does visit a webpage. If this is a problem, an administrator can set up a cron job to periodically run: > fossil backoffice _REPOSITORY_ That command will cause backoffice processing to occur immediately. Note that this is almost never necessary for an internet-facing Fossil repository, since most repositories will get multiple accesses per day from random robots, which will be sufficient to kick off the daily digest emails. And even for a private server, if there is very little traffic, then the daily digests are probably a no-op anyhow |
︙ | ︙ | |||
116 117 118 119 120 121 122 | > fossil test-backoffice-lease -R _REPOSITORY_ If a system has been idle for a long time, then there will be no backoffice processes. (Either the process id entries in the lease will be zero, or there will exist no process associated with the process id.) When a new web request comes in, the system sees that no backoffice process is active and so it kicks off a separate | | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | > fossil test-backoffice-lease -R _REPOSITORY_ If a system has been idle for a long time, then there will be no backoffice processes. (Either the process id entries in the lease will be zero, or there will exist no process associated with the process id.) When a new web request comes in, the system sees that no backoffice process is active and so it kicks off a separate process to run backoffice. The new backoffice process becomes the "current" process. It sets a lease expiration time for itself to be 60 seconds in the future. Then it does the backoffice processing and exits. Note that usually the backoffice process will exit long before its lease expires. That is ok. The lease is there to limit the rate at which backoffice processes run. If a new backoffice process starts up and sees that the "current" lease has |
︙ | ︙ | |||
164 165 166 167 168 169 170 | for a repository: > fossil test-backoffice-lease -R _REPOSITORY_ Running that command every few seconds should show what is going on with backoffice processing in a particular repository. | | > > > > > | > | 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 | for a repository: > fossil test-backoffice-lease -R _REPOSITORY_ Running that command every few seconds should show what is going on with backoffice processing in a particular repository. There are also settings that control backoffice behavior. The "backoffice-nodelay" setting prevents the "next" process from taking a lease and sleeping. If "backoffice-nodelay" is set, that causes all backoffice processes to exit either immediately or after doing whatever backoffice works needs to be done. If something is going wrong and backoffice leases are causing delays in webpage processing, then setting "backoffice-nodelay" to true can work around the problem until the bug can be fixed. The "backoffice-logfile" setting is the name of a log file onto which is appended a short message everything a backoffice process actually starts to do the backoffice work. This log file can be used to verify that backoffice really is running, if there is any doubt. The "backoffice-disable" setting prevents automatic backoffice processing, if true. Use this to completely disable backoffice processing that occurs automatically after each HTTP request. The "backoffice-disable" setting does not affect the operation of the manual "fossil backoffice" command. Most installations should leave "backoffice-nodelay" and "backoffice-disable" set to their default values of off and leave "backoffice-logfile" unset or set to an empty string. |
Added www/blockchain.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Fossil As Blockchain Fossil is a version control system built around blockchain. Wikipedia defines "blockchain" as > "a growing list of records, called blocks, which are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data..." [(1)][] By that definition, Fossil is clearly an implementation of blockchain. The blocks are ["manifests" artifacts](./fileformat.wiki#manifest). Each manifest has a SHA1 or SHA3 hash of its parent or parents, a timestamp, and other transactional data. The repository grows by adding new manifests onto the list. Some people have come to associate blockchain with cryptocurrency, however, and since Fossil has nothing to do with cryptocurrency, the claim that Fossil is built around blockchain is met with skepticism. The key thing to note here is that cryptocurrency implementations like BitCoin are built around blockchain, but they are not synonymous with blockchain. Blockchain is a much broader concept. Blockchain is a mechanism for constructing a distributed ledger of transactions. Yes, you can use a distributed ledger to implement a cryptocurrency, but you can also use a distributed ledger to implement a version control system, and probably many other kinds of applications as well. Blockchain is a much broader idea than cryptocurrency. [(1)]: https://en.wikipedia.org/wiki/Blockchain |
Deleted www/branch01.gif.
cannot compute difference between binary files
Added www/branch01.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="414.5" y="-648.1669921875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="474.5" y="-648.1669921875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="534.5" y="-648.1669921875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="593.5" y="-648.1669921875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n0" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/branch01.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="211" stroke-miterlimit="10" font-weight="normal" height="32" font-style="normal" font-size="12px" id="svg2" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="branch01.svg" style="font-style:normal;font-weight:normal;font-size:12px;font-family:Dialog;color-interpolation:auto;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto"> <metadata id="metadata61"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1240" inkscape:window-height="1382" id="namedview59" showgrid="false" inkscape:zoom="0.17717718" inkscape:cx="106" inkscape:cy="15.833008" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" /> <!--Generated by ySVG 2.5--> <defs id="genericDefs" /> <g id="g5" transform="translate(-261.5,-649.83301)"> <g transform="translate(206,1954)" id="g7" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="71.5" cy="-1288.167" id="circle9" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(206,1954)" id="g11" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="71.5" cy="-1288.167" id="circle13" style="fill:none" /> <text x="67.7061" y="-1283.6318" clip-path="url(#clipPath2)" xml:space="preserve" id="text15" style="font-family:sans-serif;stroke:none;stroke-width:1">1</text> </g> <g transform="translate(206,1954)" id="g17" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="131.5" cy="-1288.167" id="circle19" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(206,1954)" id="g21" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="131.5" cy="-1288.167" id="circle23" style="fill:none" /> <text x="127.7061" y="-1283.6318" clip-path="url(#clipPath2)" xml:space="preserve" id="text25" style="font-family:sans-serif;stroke:none;stroke-width:1">2</text> </g> <g transform="translate(206,1954)" id="g27" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="191.5" cy="-1288.167" id="circle29" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(206,1954)" id="g31" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="191.5" cy="-1288.167" id="circle33" style="fill:none" /> <text x="187.7061" y="-1283.6318" clip-path="url(#clipPath2)" xml:space="preserve" id="text35" style="font-family:sans-serif;stroke:none;stroke-width:1">3</text> </g> <g transform="translate(206,1954)" id="g37" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="250.5" cy="-1288.167" id="circle39" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(206,1954)" id="g41" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="250.5" cy="-1288.167" id="circle43" style="fill:none" /> <text x="246.7061" y="-1283.6318" clip-path="url(#clipPath2)" xml:space="preserve" id="text45" style="font-family:sans-serif;stroke:none;stroke-width:1">4</text> <path d="m 86.5,-1288.167 22,0" clip-path="url(#clipPath2)" id="path47" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 116.5,-1288.167 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path49" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 146.5,-1288.167 22,0" clip-path="url(#clipPath2)" id="path51" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 176.5,-1288.167 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path53" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 206.5,-1288.167 21,0" clip-path="url(#clipPath2)" id="path55" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 235.5,-1288.167 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path57" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> </g> </g> </svg> |
Deleted www/branch02.gif.
cannot compute difference between binary files
Added www/branch02.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="415.0" y="-432.0009765625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="475.0" y="-432.0009765625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="535.0" y="-474.0009765625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="534.0" y="-385.0009765625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n0" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n1" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/branch02.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="152" stroke-miterlimit="10" font-weight="normal" height="121" font-style="normal" font-size="12px" id="svg4677" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="branch02.svg" style="font-style:normal;font-weight:normal;font-size:12px;font-family:Dialog;color-interpolation:auto;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto"> <metadata id="metadata4743"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview4741" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.93768769" inkscape:cx="76" inkscape:cy="60.165985" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg4677" /> <!--Generated by ySVG 2.5--> <defs id="genericDefs" /> <g id="g4680" transform="translate(-291.5,-605.16599)"> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M 0,0 735,0 735,1332 0,1332 0,0 Z" id="path4684" inkscape:connector-curvature="0" /> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="m 47,-1129 735,0 0,1332 -735,0 0,-1332 z" id="path4687" inkscape:connector-curvature="0" /> </clipPath> </defs> <g transform="translate(-47,1129)" id="g4689" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="354.5" cy="-465.83401" id="circle4691" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-47,1129)" id="g4693" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="354.5" cy="-465.83401" id="circle4695" style="fill:none" /> <text x="350.70609" y="-461.2988" clip-path="url(#clipPath2)" xml:space="preserve" id="text4697" style="font-family:sans-serif;stroke:none;stroke-width:1">1</text> </g> <g transform="translate(-47,1129)" id="g4699" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="414.5" cy="-465.83401" id="circle4701" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-47,1129)" id="g4703" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="414.5" cy="-465.83401" id="circle4705" style="fill:none" /> <text x="410.70609" y="-461.2988" clip-path="url(#clipPath2)" xml:space="preserve" id="text4707" style="font-family:sans-serif;stroke:none;stroke-width:1">2</text> </g> <g transform="translate(-47,1129)" id="g4709" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="474.5" cy="-507.83401" id="circle4711" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-47,1129)" id="g4713" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="474.5" cy="-507.83401" id="circle4715" style="fill:none" /> <text x="470.70609" y="-503.2988" clip-path="url(#clipPath2)" xml:space="preserve" id="text4717" style="font-family:sans-serif;stroke:none;stroke-width:1">3</text> </g> <g transform="translate(-47,1129)" id="g4719" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="473.5" cy="-418.83401" id="circle4721" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-47,1129)" id="g4723" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="473.5" cy="-418.83401" id="circle4725" style="fill:none" /> <text x="469.70609" y="-414.2988" clip-path="url(#clipPath2)" xml:space="preserve" id="text4727" style="font-family:sans-serif;stroke:none;stroke-width:1">4</text> <path d="m 369.5,-465.834 22,0" clip-path="url(#clipPath2)" id="path4729" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 399.5,-465.834 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path4731" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 426.7885,-474.4359 28.8692,-20.2084" clip-path="url(#clipPath2)" id="path4733" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 462.2115,-499.2321 -12.6981,2.7854 5.325,2.3758 0.4096,5.8166 z" clip-path="url(#clipPath2)" id="path4735" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 426.2324,-456.4878 29.2779,23.323" clip-path="url(#clipPath2)" id="path4737" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 461.7676,-428.1801 -6.2705,-11.3878 -0.769,5.7801 -5.4618,2.0415 z" clip-path="url(#clipPath2)" id="path4739" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> </g> </g> </svg> |
Deleted www/branch03.gif.
cannot compute difference between binary files
Added www/branch03.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="288.0" y="-271.935546875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="348.0" y="-271.935546875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="408.0" y="-313.935546875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="407.0" y="-224.935546875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="467.0" y="-271.935546875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n0" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n1" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n2" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n3" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="dashed" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/branch03.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="211" stroke-miterlimit="10" font-weight="normal" height="121" font-style="normal" font-size="12px" id="svg4877" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="branch03.svg" style="font-style:normal;font-weight:normal;font-size:12px;font-family:Dialog;color-interpolation:auto;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto"> <metadata id="metadata4961"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview4959" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.93768769" inkscape:cx="105.5" inkscape:cy="60.998993" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg4877" /> <!--Generated by ySVG 2.5--> <defs id="genericDefs" /> <g id="g4880" transform="translate(-262,-605.99899)"> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M 0,0 735,0 735,1332 0,1332 0,0 Z" id="path4884" inkscape:connector-curvature="0" /> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="m 46,-911 735,0 0,1332 -735,0 0,-1332 z" id="path4887" inkscape:connector-curvature="0" /> </clipPath> </defs> <g transform="translate(-46,911)" id="g4889" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="324" cy="-247.00101" id="circle4891" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-46,911)" id="g4893" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="324" cy="-247.00101" id="circle4895" style="fill:none" /> <text x="320.20609" y="-242.46581" clip-path="url(#clipPath2)" xml:space="preserve" id="text4897" style="font-family:sans-serif;stroke:none;stroke-width:1">1</text> </g> <g transform="translate(-46,911)" id="g4899" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="384" cy="-247.00101" id="circle4901" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-46,911)" id="g4903" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="384" cy="-247.00101" id="circle4905" style="fill:none" /> <text x="380.20609" y="-242.46581" clip-path="url(#clipPath2)" xml:space="preserve" id="text4907" style="font-family:sans-serif;stroke:none;stroke-width:1">2</text> </g> <g transform="translate(-46,911)" id="g4909" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="444" cy="-289.00101" id="circle4911" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-46,911)" id="g4913" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="444" cy="-289.00101" id="circle4915" style="fill:none" /> <text x="440.20609" y="-284.46579" clip-path="url(#clipPath2)" xml:space="preserve" id="text4917" style="font-family:sans-serif;stroke:none;stroke-width:1">3</text> </g> <g transform="translate(-46,911)" id="g4919" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="443" cy="-200.00101" id="circle4921" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-46,911)" id="g4923" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="443" cy="-200.00101" id="circle4925" style="fill:none" /> <text x="439.20609" y="-195.46581" clip-path="url(#clipPath2)" xml:space="preserve" id="text4927" style="font-family:sans-serif;stroke:none;stroke-width:1">4</text> </g> <g transform="translate(-46,911)" id="g4929" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="503" cy="-247.00101" id="circle4931" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-46,911)" id="g4933" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="503" cy="-247.00101" id="circle4935" style="fill:none" /> <text x="499.20609" y="-242.46581" clip-path="url(#clipPath2)" xml:space="preserve" id="text4937" style="font-family:sans-serif;stroke:none;stroke-width:1">5</text> <path d="m 339,-247.001 22,0" clip-path="url(#clipPath2)" id="path4939" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 369,-247.001 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path4941" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 396.2885,-255.6029 28.8692,-20.2084" clip-path="url(#clipPath2)" id="path4943" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 431.7115,-280.399 -12.6981,2.7854 5.325,2.3757 0.4096,5.8166 z" clip-path="url(#clipPath2)" id="path4945" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 395.7324,-237.6548 29.2779,23.3231" clip-path="url(#clipPath2)" id="path4947" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 431.2676,-209.3471 -6.2705,-11.3877 -0.7689,5.78 -5.4619,2.0415 z" clip-path="url(#clipPath2)" id="path4949" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 456.22,-280.302 28.0427,19.9626" clip-path="url(#clipPath2)" id="path4951" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 490.78,-255.7 -6.8763,-11.0325 -0.4557,5.8132 -5.3436,2.3335 z" clip-path="url(#clipPath2)" id="path4953" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 454.8084,-209.2509 30.0854,-23.5668" clip-path="url(#clipPath2)" id="path4955" inkscape:connector-curvature="0" style="fill:none;stroke-width:1;stroke-dasharray:6, 2" /> <path d="m 491.1916,-237.7511 -12.53,3.4639 5.4449,2.0861 0.7217,5.7861 z" clip-path="url(#clipPath2)" id="path4957" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1;stroke-dasharray:6, 2" /> </g> </g> </svg> |
Deleted www/branch04.gif.
cannot compute difference between binary files
Added www/branch04.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="298.8666666666667" x="290.6333333333333" y="-425.66796875"/> <y:Fill color="#9ACCFC" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="sides" modelPosition="s" textColor="#000000" verticalTextPosition="bottom" visible="true" width="25.779296875" x="136.54368489583328" xml:space="preserve" y="50.0">test</y:NodeLabel> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="203.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="263.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="323.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="322.5" y="-418.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="382.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n6"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="441.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">7<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n7"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="500.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">8<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n8"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="559.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.17578125" x="5.412109375" xml:space="preserve" y="5.93359375">10<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n9"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="412.5" y="-418.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">6<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n10"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="530.5" y="-418.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">9<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n2" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n3" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n4" target="n9"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e5" source="n5" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e6" source="n6" target="n7"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e7" source="n7" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e8" source="n9" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="dashed" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e9" source="n9" target="n10"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e10" source="n10" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="dashed" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/branch04.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="388" stroke-miterlimit="10" font-weight="normal" height="104.77151" font-style="normal" font-size="12px" id="svg2" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="branch04.svg" style="font-style:normal;font-weight:normal;font-size:12px;font-family:Dialog;color-interpolation:auto;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto"> <metadata id="metadata170"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview168" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.17717718" inkscape:cx="194" inkscape:cy="49.103516" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2" /> <!--Generated by ySVG 2.5--> <defs id="genericDefs" /> <g id="g5" transform="translate(-173.5,-610.332)"> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M 0,0 735,0 735,1332 0,1332 0,0 Z" id="path9" inkscape:connector-curvature="0" /> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="m 29,-1077 735,0 0,1332 -735,0 0,-1332 z" id="path12" inkscape:connector-curvature="0" /> </clipPath> </defs> <g transform="translate(-29,1077)" id="g14" style="fill:#9accfc;stroke:#9accfc;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <rect x="290.6333" width="298.8667" height="46" y="-425.668" clip-path="url(#clipPath2)" id="rect16" style="stroke:none" /> </g> <g transform="translate(-29,1077)" stroke-miterlimit="1.45" id="g18" style="fill:#7ca5cc;stroke:#7ca5cc;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <rect x="290.6333" width="298.8667" height="46" y="-425.668" clip-path="url(#clipPath2)" id="rect20" style="fill:none" /> <text x="429.177" y="-362.06641" clip-path="url(#clipPath2)" xml:space="preserve" id="text22" style="font-family:sans-serif;fill:#000000;stroke:none">test</text> </g> <g transform="translate(-29,1077)" id="g24" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" id="circle26" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g28" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" id="circle30" style="fill:none" /> <text x="214.7061" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text32" style="font-family:sans-serif;stroke:none;stroke-width:1">1</text> </g> <g transform="translate(-29,1077)" id="g34" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="278.5" cy="-450.668" id="circle36" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g38" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="278.5" cy="-450.668" id="circle40" style="fill:none" /> <text x="274.70609" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text42" style="font-family:sans-serif;stroke:none;stroke-width:1">2</text> </g> <g transform="translate(-29,1077)" id="g44" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="338.5" cy="-450.668" id="circle46" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g48" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="338.5" cy="-450.668" id="circle50" style="fill:none" /> <text x="334.70609" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text52" style="font-family:sans-serif;stroke:none;stroke-width:1">3</text> </g> <g transform="translate(-29,1077)" id="g54" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="337.5" cy="-403.668" id="circle56" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g58" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="337.5" cy="-403.668" id="circle60" style="fill:none" /> <text x="333.70609" y="-399.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text62" style="font-family:sans-serif;stroke:none;stroke-width:1">4</text> </g> <g transform="translate(-29,1077)" id="g64" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-450.668" id="circle66" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g68" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-450.668" id="circle70" style="fill:none" /> <text x="393.70609" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text72" style="font-family:sans-serif;stroke:none;stroke-width:1">5</text> </g> <g transform="translate(-29,1077)" id="g74" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="456.5" cy="-450.668" id="circle76" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g78" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="456.5" cy="-450.668" id="circle80" style="fill:none" /> <text x="452.70609" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text82" style="font-family:sans-serif;stroke:none;stroke-width:1">7</text> </g> <g transform="translate(-29,1077)" id="g84" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="515.5" cy="-450.668" id="circle86" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g88" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="515.5" cy="-450.668" id="circle90" style="fill:none" /> <text x="511.70609" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text92" style="font-family:sans-serif;stroke:none;stroke-width:1">8</text> </g> <g transform="translate(-29,1077)" id="g94" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="574.5" cy="-450.668" id="circle96" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g98" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="574.5" cy="-450.668" id="circle100" style="fill:none" /> <text x="566.91211" y="-446.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text102" style="font-family:sans-serif;stroke:none;stroke-width:1">10</text> </g> <g transform="translate(-29,1077)" id="g104" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="427.5" cy="-403.668" id="circle106" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g108" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="427.5" cy="-403.668" id="circle110" style="fill:none" /> <text x="423.70609" y="-399.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text112" style="font-family:sans-serif;stroke:none;stroke-width:1">6</text> </g> <g transform="translate(-29,1077)" id="g114" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="545.5" cy="-403.668" id="circle116" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-29,1077)" id="g118" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="545.5" cy="-403.668" id="circle120" style="fill:none" /> <text x="541.70612" y="-399.13281" clip-path="url(#clipPath2)" xml:space="preserve" id="text122" style="font-family:sans-serif;stroke:none;stroke-width:1">9</text> <path d="m 233.5,-450.668 22,0" clip-path="url(#clipPath2)" id="path124" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 263.5,-450.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path126" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 293.5,-450.668 22,0" clip-path="url(#clipPath2)" id="path128" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 323.5,-450.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path130" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 290.2324,-441.3218 29.2779,23.3231" clip-path="url(#clipPath2)" id="path132" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 325.7676,-413.0141 -6.2705,-11.3878 -0.769,5.7801 -5.4618,2.0415 z" clip-path="url(#clipPath2)" id="path134" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 353.5,-450.668 21,0" clip-path="url(#clipPath2)" id="path136" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 382.5,-450.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path138" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 412.5,-450.668 21,0" clip-path="url(#clipPath2)" id="path140" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 441.5,-450.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path142" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 471.5,-450.668 21,0" clip-path="url(#clipPath2)" id="path144" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 500.5,-450.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path146" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 530.5,-450.668 21,0" clip-path="url(#clipPath2)" id="path148" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 559.5,-450.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path150" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 352.5,-403.668 52,0" clip-path="url(#clipPath2)" id="path152" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 412.5,-403.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path154" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 435.3766,-416.4335 9.0459,-14.6606" clip-path="url(#clipPath2)" id="path156" inkscape:connector-curvature="0" style="fill:none;stroke-width:1;stroke-dasharray:6, 2" /> <path d="m 448.6234,-437.9024 -10.5565,7.5869 5.8305,0.0724 2.6799,5.1786 z" clip-path="url(#clipPath2)" id="path158" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1;stroke-dasharray:6, 2" /> <path d="m 442.5,-403.668 80,0" clip-path="url(#clipPath2)" id="path160" inkscape:connector-curvature="0" style="fill:none;stroke-width:1" /> <path d="m 530.5,-403.668 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path162" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1" /> <path d="m 553.3766,-416.4335 9.0459,-14.6606" clip-path="url(#clipPath2)" id="path164" inkscape:connector-curvature="0" style="fill:none;stroke-width:1;stroke-dasharray:6, 2" /> <path d="m 566.6234,-437.9024 -10.5564,7.5868 5.8305,0.0725 2.6798,5.1786 z" clip-path="url(#clipPath2)" id="path166" inkscape:connector-curvature="0" style="stroke:none;stroke-width:1;stroke-dasharray:6, 2" /> </g> </g> </svg> |
Deleted www/branch05.gif.
cannot compute difference between binary files
Added www/branch05.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="298.8666666666667" x="278.8833333333333" y="-198.5361328125"/> <y:Fill color="#9ACCFC" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="sides" modelPosition="s" textColor="#000000" verticalTextPosition="bottom" visible="true" width="25.779296875" x="136.54368489583334" xml:space="preserve" y="50.0">test</y:NodeLabel> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="191.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="251.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="311.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="310.75" y="-191.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="370.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n6"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="429.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">7<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n7"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="488.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">8<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n8"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="547.75" y="-238.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.17578125" x="5.412109375" xml:space="preserve" y="5.93359375">10<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n9"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="400.75" y="-191.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">6<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n10"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="518.75" y="-191.5361328125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">9<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n11"> <data key="d6"> <y:ShapeNode> <y:Geometry height="39.0" width="110.0" x="151.75" y="-178.5361328125"/> <y:Fill color="#D8D8D8" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.265625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="84.9765625" x="12.51171875" xml:space="preserve" y="3.3671875">branch=trunk sym-trunk<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="fatarrow"/> </y:ShapeNode> </data> </node> <node id="n12"> <data key="d6"> <y:ShapeNode> <y:Geometry height="67.0" width="142.5" x="254.5" y="-122.5361328125"/> <y:Fill color="#D8D8D8" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="60.53125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="111.900390625" x="15.2998046875" xml:space="preserve" y="3.234375">branch=test sym-test bgcolor=blue cancel=sym-trunk<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="fatarrow"/> </y:ShapeNode> </data> </node> <node id="n13"> <data key="d6"> <y:ShapeNode> <y:Geometry height="39.0" width="141.0" x="463.25" y="-117.5361328125"/> <y:Fill color="#D8D8D8" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="32.265625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="101.62890625" x="19.685546875" xml:space="preserve" y="3.3671875">sym-release-1.0 closed<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="fatarrow"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n2" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n3" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n4" target="n9"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e5" source="n5" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e6" source="n6" target="n7"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e7" source="n7" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e8" source="n9" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="dashed" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e9" source="n9" target="n10"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e10" source="n10" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="dashed" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e11" source="n11" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e12" source="n12" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e13" source="n13" target="n10"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/branch05.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="453.55252" stroke-miterlimit="10" font-weight="normal" height="184.5" font-style="normal" font-size="12px" id="svg172" version="1.1" inkscape:version="0.91 r13725" sodipodi:docname="branch05.svg" style="font-style:normal;font-weight:normal;font-size:12px;font-family:Dialog;color-interpolation:auto;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto"> <metadata id="metadata392"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview390" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.17717718" inkscape:cx="226.18549" inkscape:cy="91.9639" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg172" /> <!--Generated by ySVG 2.5--> <defs id="genericDefs" /> <g id="g175" transform="translate(-141.31451,-573.4639)"> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M 0,0 735,0 735,1332 0,1332 0,0 Z" id="path179" inkscape:connector-curvature="0" /> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="m 10,-813 735,0 0,1332 -735,0 0,-1332 z" id="path182" inkscape:connector-curvature="0" /> </clipPath> </defs> <g transform="translate(-10,813)" id="g184" style="fill:#9accfc;stroke:#9accfc;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <rect x="278.8833" width="298.8667" height="46" y="-198.5361" clip-path="url(#clipPath2)" id="rect186" style="stroke:none" /> </g> <g transform="translate(-10,813)" stroke-miterlimit="1.45" id="g188" style="fill:#7ca5cc;stroke:#7ca5cc;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <rect x="278.8833" width="298.8667" height="46" y="-198.5361" clip-path="url(#clipPath2)" id="rect190" style="fill:none" /> <text x="417.427" y="-134.9346" clip-path="url(#clipPath2)" xml:space="preserve" id="text192" style="font-family:sans-serif;fill:#000000;stroke:none">test</text> </g> <g transform="translate(-10,813)" id="g194" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="206.75" cy="-223.5361" id="circle196" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g198" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="206.75" cy="-223.5361" id="circle200" style="fill:none" /> <text x="202.9561" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text202" style="font-family:sans-serif;stroke:none;stroke-width:1">1</text> </g> <g transform="translate(-10,813)" id="g204" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="266.75" cy="-223.5361" id="circle206" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g208" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="266.75" cy="-223.5361" id="circle210" style="fill:none" /> <text x="262.95609" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text212" style="font-family:sans-serif;stroke:none;stroke-width:1">2</text> </g> <g transform="translate(-10,813)" id="g214" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="326.75" cy="-223.5361" id="circle216" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g218" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="326.75" cy="-223.5361" id="circle220" style="fill:none" /> <text x="322.95609" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text222" style="font-family:sans-serif;stroke:none;stroke-width:1">3</text> </g> <g transform="translate(-10,813)" id="g224" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="325.75" cy="-176.5361" id="circle226" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g228" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="325.75" cy="-176.5361" id="circle230" style="fill:none" /> <text x="321.95609" y="-172.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text232" style="font-family:sans-serif;stroke:none;stroke-width:1">4</text> </g> <g transform="translate(-10,813)" id="g234" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="385.75" cy="-223.5361" id="circle236" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g238" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="385.75" cy="-223.5361" id="circle240" style="fill:none" /> <text x="381.95609" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text242" style="font-family:sans-serif;stroke:none;stroke-width:1">5</text> </g> <g transform="translate(-10,813)" id="g244" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="444.75" cy="-223.5361" id="circle246" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g248" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="444.75" cy="-223.5361" id="circle250" style="fill:none" /> <text x="440.95609" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text252" style="font-family:sans-serif;stroke:none;stroke-width:1">7</text> </g> <g transform="translate(-10,813)" id="g254" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="503.75" cy="-223.5361" id="circle256" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g258" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="503.75" cy="-223.5361" id="circle260" style="fill:none" /> <text x="499.95609" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text262" style="font-family:sans-serif;stroke:none;stroke-width:1">8</text> </g> <g transform="translate(-10,813)" id="g264" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="562.75" cy="-223.5361" id="circle266" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g268" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="562.75" cy="-223.5361" id="circle270" style="fill:none" /> <text x="555.16211" y="-219.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text272" style="font-family:sans-serif;stroke:none;stroke-width:1">10</text> </g> <g transform="translate(-10,813)" id="g274" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="415.75" cy="-176.5361" id="circle276" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g278" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="415.75" cy="-176.5361" id="circle280" style="fill:none" /> <text x="411.95609" y="-172.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text282" style="font-family:sans-serif;stroke:none;stroke-width:1">6</text> </g> <g transform="translate(-10,813)" id="g284" style="fill:#ffffff;stroke:#ffffff;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="533.75" cy="-176.5361" id="circle286" style="stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g288" style="stroke-width:2;stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <circle r="15" clip-path="url(#clipPath2)" cx="533.75" cy="-176.5361" id="circle290" style="fill:none" /> <text x="529.95612" y="-172.00101" clip-path="url(#clipPath2)" xml:space="preserve" id="text292" style="font-family:sans-serif;stroke:none;stroke-width:1">9</text> </g> <g transform="translate(-10,813)" id="g294" style="fill:#d8d8d8;stroke:#d8d8d8;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <path d="m 151.75,-178.5361 99,0 11,19.5 -11,19.5 -99,0 11,-19.5 z" clip-path="url(#clipPath2)" id="path296" inkscape:connector-curvature="0" style="fill-rule:evenodd;stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g298" style="stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <path d="m 151.75,-178.5361 99,0 11,19.5 -11,19.5 -99,0 11,-19.5 z" clip-path="url(#clipPath2)" id="path300" inkscape:connector-curvature="0" style="fill:none;fill-rule:evenodd" /> <text x="166.2617" xml:space="preserve" y="-161.5674" clip-path="url(#clipPath2)" id="text302" style="font-family:sans-serif;stroke:none">branch=trunk</text> <text x="175.83009" xml:space="preserve" y="-147.4346" clip-path="url(#clipPath2)" id="text304" style="font-family:sans-serif;stroke:none">sym-trunk</text> </g> <g transform="translate(-10,813)" id="g306" style="fill:#d8d8d8;stroke:#d8d8d8;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <path d="m 254.5,-122.5361 128.25,0 14.25,33.5 -14.25,33.5 -128.25,0 14.25,-33.5 z" clip-path="url(#clipPath2)" id="path308" inkscape:connector-curvature="0" style="fill-rule:evenodd;stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g310" style="stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <path d="m 254.5,-122.5361 128.25,0 14.25,33.5 -14.25,33.5 -128.25,0 14.25,-33.5 z" clip-path="url(#clipPath2)" id="path312" inkscape:connector-curvature="0" style="fill:none;fill-rule:evenodd" /> <text x="290.02539" xml:space="preserve" y="-105.7002" clip-path="url(#clipPath2)" id="text314" style="font-family:sans-serif;stroke:none">branch=test</text> <text x="299.59381" xml:space="preserve" y="-91.567398" clip-path="url(#clipPath2)" id="text316" style="font-family:sans-serif;stroke:none">sym-test</text> <text x="286.25201" xml:space="preserve" y="-77.434601" clip-path="url(#clipPath2)" id="text318" style="font-family:sans-serif;stroke:none">bgcolor=blue</text> <text x="271.7998" xml:space="preserve" y="-63.3018" clip-path="url(#clipPath2)" id="text320" style="font-family:sans-serif;stroke:none">cancel=sym-trunk</text> </g> <g transform="translate(-10,813)" id="g322" style="fill:#d8d8d8;stroke:#d8d8d8;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <path d="m 463.25,-117.5361 126.9,0 14.1,19.5 -14.1,19.5 -126.9,0 14.1,-19.5 z" clip-path="url(#clipPath2)" id="path324" inkscape:connector-curvature="0" style="fill-rule:evenodd;stroke:none" /> </g> <g stroke-miterlimit="1.45" transform="translate(-10,813)" id="g326" style="stroke-linecap:butt;stroke-miterlimit:1.45000005;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"> <path d="m 463.25,-117.5361 126.9,0 14.1,19.5 -14.1,19.5 -126.9,0 14.1,-19.5 z" clip-path="url(#clipPath2)" id="path328" inkscape:connector-curvature="0" style="fill:none;fill-rule:evenodd" /> <text x="484.93549" xml:space="preserve" y="-100.5674" clip-path="url(#clipPath2)" id="text330" style="font-family:sans-serif;stroke:none">sym-release-1.0</text> <text x="515.0791" xml:space="preserve" y="-86.434601" clip-path="url(#clipPath2)" id="text332" style="font-family:sans-serif;stroke:none">closed</text> <path d="m 221.75,-223.5361 22,0" clip-path="url(#clipPath2)" id="path334" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 251.75,-223.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path336" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 281.75,-223.5361 22,0" clip-path="url(#clipPath2)" id="path338" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 311.75,-223.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path340" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 278.4824,-214.19 29.2779,23.3231" clip-path="url(#clipPath2)" id="path342" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 314.0176,-185.8823 -6.2705,-11.3877 -0.7689,5.78 -5.4619,2.0416 z" clip-path="url(#clipPath2)" id="path344" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 341.75,-223.5361 21,0" clip-path="url(#clipPath2)" id="path346" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 370.75,-223.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path348" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 400.75,-223.5361 21,0" clip-path="url(#clipPath2)" id="path350" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 429.75,-223.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path352" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 459.75,-223.5361 21,0" clip-path="url(#clipPath2)" id="path354" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 488.75,-223.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path356" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 518.75,-223.5361 21,0" clip-path="url(#clipPath2)" id="path358" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 547.75,-223.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path360" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 340.75,-176.5361 52,0" clip-path="url(#clipPath2)" id="path362" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 400.75,-176.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path364" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 423.6266,-189.3017 9.0459,-14.6606" clip-path="url(#clipPath2)" id="path366" inkscape:connector-curvature="0" style="fill:none;stroke-dasharray:6, 2" /> <path d="m 436.8734,-210.7706 -10.5565,7.5869 5.8305,0.0724 2.6799,5.1787 z" clip-path="url(#clipPath2)" id="path368" inkscape:connector-curvature="0" style="stroke:none;stroke-dasharray:6, 2" /> <path d="m 430.75,-176.5361 80,0" clip-path="url(#clipPath2)" id="path370" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 518.75,-176.5361 -12,-5 3,5 -3,5 z" clip-path="url(#clipPath2)" id="path372" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 541.6266,-189.3017 9.0459,-14.6606" clip-path="url(#clipPath2)" id="path374" inkscape:connector-curvature="0" style="fill:none;stroke-dasharray:6, 2" /> <path d="m 554.8734,-210.7706 -10.5564,7.5869 5.8305,0.0724 2.6798,5.1787 z" clip-path="url(#clipPath2)" id="path376" inkscape:connector-curvature="0" style="stroke:none;stroke-dasharray:6, 2" /> <path d="m 206.75,-178.531 0,-22.0051" clip-path="url(#clipPath2)" id="path378" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 206.75,-208.5361 -5,12 5,-3 5,3 z" clip-path="url(#clipPath2)" id="path380" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 325.75,-122.575 0,-30.9611" clip-path="url(#clipPath2)" id="path382" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 325.75,-161.5361 -5,12 5,-3 5,3 z" clip-path="url(#clipPath2)" id="path384" inkscape:connector-curvature="0" style="stroke:none" /> <path d="m 533.75,-117.5461 0,-35.99" clip-path="url(#clipPath2)" id="path386" inkscape:connector-curvature="0" style="fill:none" /> <path d="m 533.75,-161.5361 -5,12 5,-3 5,3 z" clip-path="url(#clipPath2)" id="path388" inkscape:connector-curvature="0" style="stroke:none" /> </g> </g> </svg> |
Added www/branch06.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0" yfiles.foldertype="group"> <data key="d6"> <y:TableNode configuration="YED_TABLE_NODE"> <y:Geometry height="470.0" width="487.0" x="-208.0" y="-1933.666015625"/> <y:Fill color="#ECF5FF" color2="#0042F440" transparent="false"/> <y:BorderStyle color="#000000" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="21.666015625" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="290.259765625" x="98.3701171875" xml:space="preserve" y="4.0">Varying User Views of Fossil Repository</y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="29.822265625" x="3.0" xml:space="preserve" y="70.0888671875">Alan<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_0" inside="true"/></y:ModelParameter></y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="32.833984375" x="3.0" xml:space="preserve" y="178.5830078125">Betty<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_1" inside="true"/></y:ModelParameter></y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="44.91015625" x="3.0" xml:space="preserve" y="282.044921875">Charlie<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_2" inside="true"/></y:ModelParameter></y:NodeLabel> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" rotationAngle="270.0" textColor="#000000" verticalTextPosition="bottom" visible="true" width="48.8125" x="3.0" xml:space="preserve" y="390.09375">Darlene<y:LabelModel><y:RowNodeLabelModel offset="3.0"/></y:LabelModel><y:ModelParameter><y:RowNodeLabelModelParameter horizontalPosition="0.0" id="row_3" inside="true"/></y:ModelParameter></y:NodeLabel> <y:StyleProperties> <y:Property class="java.awt.Color" name="yed.table.section.color" value="#7192b2"/> <y:Property class="java.lang.Double" name="yed.table.header.height" value="24.0"/> <y:Property class="java.awt.Color" name="yed.table.lane.color.main" value="#c4d7ed"/> <y:Property class="java.awt.Color" name="yed.table.lane.color.alternating" value="#abc8e2"/> <y:Property class="java.awt.Color" name="yed.table.header.color.alternating" value="#abc8e2"/> <y:Property class="java.lang.String" name="yed.table.lane.style" value="lane.style.rows"/> <y:Property class="java.awt.Color" name="yed.table.header.color.main" value="#c4d7ed"/> </y:StyleProperties> <y:State autoResize="true" closed="false" closedHeight="80.0" closedWidth="100.0"/> <y:Insets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/> <y:BorderInsets bottom="20" bottomF="20.333984375" left="12" leftF="12.0" right="18" rightF="18.0" top="17" topF="17.0"/> <y:Table autoResizeTable="true" defaultColumnWidth="120.0" defaultMinimumColumnWidth="80.0" defaultMinimumRowHeight="50.0" defaultRowHeight="80.0"> <y:DefaultColumnInsets bottom="0.0" left="0.0" right="0.0" top="0.0"/> <y:DefaultRowInsets bottom="0.0" left="24.0" right="0.0" top="0.0"/> <y:Insets bottom="0.0" left="0.0" right="0.0" top="30.0"/> <y:Columns> <y:Column id="column_0" minimumWidth="80.0" width="463.0"> <y:Insets bottom="0.0" left="0.0" right="0.0" top="0.0"/> </y:Column> </y:Columns> <y:Rows> <y:Row height="110.0" id="row_0" minimumHeight="50.0"> <y:Insets bottom="0.0" left="24.0" right="0.0" top="0.0"/> </y:Row> <y:Row height="110.0" id="row_1" minimumHeight="50.0"> <y:Insets bottom="0.0" left="24.0" right="0.0" top="0.0"/> </y:Row> <y:Row height="109.0" id="row_2" minimumHeight="50.0"> <y:Insets bottom="0.0" left="24.0" right="0.0" top="0.0"/> </y:Row> <y:Row height="111.0" id="row_3" minimumHeight="50.0"> <y:Insets bottom="0.0" left="24.0" right="0.0" top="0.0"/> </y:Row> </y:Rows> </y:Table> </y:TableNode> </data> <graph edgedefault="directed" id="n0:"> <node id="n0::n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-172.0" y="-1775.666015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-65.0" y="-1733.166015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="64.0" x="197.0" y="-1775.666015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="39.390625" x="12.3046875" xml:space="preserve" y="5.93359375">future<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-112.0" y="-1775.666015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-5.0" y="-1733.166015625"/> <y:Fill color="#C0C0C0" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-172.0" y="-1556.5"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n6"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-65.0" y="-1514.0"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n7"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="64.0" x="197.0" y="-1556.5"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="39.390625" x="12.3046875" xml:space="preserve" y="5.93359375">future<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n8"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-112.0" y="-1556.5"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n9"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-5.0" y="-1514.0"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n10"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="55.0" y="-1556.5"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n11"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="115.0" y="-1556.5"/> <y:Fill color="#C0C0C0" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">6<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n12"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-172.0" y="-1886.666015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n13"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-65.0" y="-1844.166015625"/> <y:Fill color="#C0C0C0" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n14"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="64.0" x="197.0" y="-1886.666015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="39.390625" x="12.3046875" xml:space="preserve" y="5.93359375">future<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n15"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-112.0" y="-1886.666015625"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n16"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-112.0" y="-1658.3330078125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n17"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="55.0" y="-1658.3330078125"/> <y:Fill color="#C0C0C0" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n18"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="-172.0" y="-1658.3330078125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.587890625" x="9.2060546875" xml:space="preserve" y="5.93359375">1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n0::n19"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="64.0" x="197.0" y="-1658.3330078125"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="39.390625" x="12.3046875" xml:space="preserve" y="5.93359375">future<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> </graph> </node> <edge id="n0::e0" source="n0::n0" target="n0::n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e1" source="n0::n0" target="n0::n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e2" source="n0::n1" target="n0::n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e3" source="n0::n3" target="n0::n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e4" source="n0::n5" target="n0::n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e5" source="n0::n5" target="n0::n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e6" source="n0::n6" target="n0::n9"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e7" source="n0::n8" target="n0::n10"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e8" source="n0::n10" target="n0::n11"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e9" source="n0::n11" target="n0::n7"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e10" source="n0::n12" target="n0::n13"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:EdgeLabel alignment="right" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="free" modelPosition="anywhere" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="31.50390625" x="-10.295267551621464" xml:space="preserve" y="10.186450915544128">fork!<y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e11" source="n0::n12" target="n0::n15"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e12" source="n0::n15" target="n0::n14"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e13" source="n0::n16" target="n0::n17"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="4.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="two_pos" modelPosition="head" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="72.71875" x="32.140625" xml:space="preserve" y="-22.1328125">goes offline<y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e14" source="n0::n18" target="n0::n16"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="n0::e15" source="n0::n17" target="n0::n19"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="46.3984375" horizontalTextPosition="center" iconTextGap="4" modelName="two_pos" modelPosition="tail" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="74.822265625" x="18.5888671875" xml:space="preserve" y="2.0">back online, pushes 5, pulls 3 & 4<y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/branch06.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="517" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="501" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"> <!--Generated by ySVG 2.5--> <defs id="genericDefs"/> <g> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L517 0 L517 501 L0 501 L0 0 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="M-223 -1949 L294 -1949 L294 -1448 L-223 -1448 L-223 -1949 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath3"> <path d="M115.2451 -18 L115.2451 499 L-385.7549 499 L-385.7549 -18 L115.2451 -18 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath4"> <path d="M226.751 -18 L226.751 499 L-274.249 499 L-274.249 -18 L226.751 -18 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath5"> <path d="M342.2891 -18 L342.2891 499 L-158.7109 499 L-158.7109 -18 L342.2891 -18 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath6"> <path d="M454.2402 -18 L454.2402 499 L-46.7598 499 L-46.7598 -18 L454.2402 -18 Z"/> </clipPath> </defs> <g fill="rgb(236,245,255)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="rgb(236,245,255)"> <path d="M-208 -1933.666 L-208 -1903.666 L279 -1903.666 L279 -1933.666 Z" stroke="none" clip-path="url(#clipPath2)"/> <rect x="-208" width="487" height="440" y="-1903.666" clip-path="url(#clipPath2)" stroke="none"/> <line clip-path="url(#clipPath2)" fill="rgb(113,146,178)" x1="-184" x2="279" y1="-1903.666" y2="-1903.666" stroke="none"/> <rect x="-208" y="-1903.666" clip-path="url(#clipPath2)" fill="rgb(196,215,237)" width="24" height="110" stroke="none"/> <rect x="-184" y="-1903.666" clip-path="url(#clipPath2)" fill="rgb(196,215,237)" width="463" height="110" stroke="none"/> <rect x="-208" y="-1793.666" clip-path="url(#clipPath2)" fill="rgb(171,200,226)" width="24" height="110" stroke="none"/> <rect x="-184" y="-1793.666" clip-path="url(#clipPath2)" fill="rgb(171,200,226)" width="463" height="110" stroke="none"/> <rect x="-208" y="-1683.666" clip-path="url(#clipPath2)" fill="rgb(196,215,237)" width="24" height="109" stroke="none"/> <rect x="-184" y="-1683.666" clip-path="url(#clipPath2)" fill="rgb(196,215,237)" width="463" height="109" stroke="none"/> <rect x="-208" y="-1574.666" clip-path="url(#clipPath2)" fill="rgb(171,200,226)" width="24" height="111" stroke="none"/> <rect x="-184" y="-1574.666" clip-path="url(#clipPath2)" fill="rgb(171,200,226)" width="463" height="111" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <rect fill="none" x="-208" width="487" height="470" y="-1933.666" clip-path="url(#clipPath2)"/> <rect fill="none" x="-184" width="463" height="440" y="-1903.666" clip-path="url(#clipPath2)"/> <rect fill="none" x="-208" width="487" height="110" y="-1903.666" clip-path="url(#clipPath2)"/> <rect fill="none" x="-208" width="487" height="110" y="-1793.666" clip-path="url(#clipPath2)"/> <rect fill="none" x="-208" width="487" height="109" y="-1683.666" clip-path="url(#clipPath2)"/> <rect fill="none" x="-208" width="487" height="111" y="-1574.666" clip-path="url(#clipPath2)"/> </g> <g font-size="15px" stroke-linecap="butt" transform="matrix(1,0,0,1,223,1949)" text-rendering="geometricPrecision" font-family="sans-serif" shape-rendering="geometricPrecision" stroke-miterlimit="1.45"> <text x="-107.6299" xml:space="preserve" y="-1913.1641" clip-path="url(#clipPath2)" stroke="none">Varying User Views of Fossil Repository</text> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" shape-rendering="geometricPrecision" font-family="sans-serif" transform="matrix(-0,-1,1,-0,18,115.2451)" stroke-linecap="butt"> <text x="2" xml:space="preserve" y="13.6016" clip-path="url(#clipPath3)" stroke="none">Alan</text> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" shape-rendering="geometricPrecision" font-family="sans-serif" transform="matrix(-0,-1,1,-0,18,226.751)" stroke-linecap="butt"> <text x="2" xml:space="preserve" y="13.6016" clip-path="url(#clipPath4)" stroke="none">Betty</text> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" shape-rendering="geometricPrecision" font-family="sans-serif" transform="matrix(-0,-1,1,-0,18,342.2891)" stroke-linecap="butt"> <text x="2" xml:space="preserve" y="13.6016" clip-path="url(#clipPath5)" stroke="none">Charlie</text> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" shape-rendering="geometricPrecision" font-family="sans-serif" transform="matrix(-0,-1,1,-0,18,454.2402)" stroke-linecap="butt"> <text x="2" xml:space="preserve" y="13.6016" clip-path="url(#clipPath6)" stroke="none">Darlene</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1760.666" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1760.666"/> <text x="-160.7939" y="-1756.1309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-50" cy="-1718.166" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-50" cy="-1718.166"/> <text x="-53.7939" y="-1713.6309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <ellipse rx="32" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1760.666" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <ellipse rx="32" fill="none" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1760.666"/> <text x="211.3047" y="-1756.1309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">future</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1760.666" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1760.666"/> <text x="-100.7939" y="-1756.1309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">2</text> </g> <g fill="silver" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="silver"> <circle r="15" clip-path="url(#clipPath2)" cx="10" cy="-1718.166" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="10" cy="-1718.166"/> <text x="6.2061" y="-1713.6309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">4</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1541.5" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1541.5"/> <text x="-160.7939" y="-1536.9648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-50" cy="-1499" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-50" cy="-1499"/> <text x="-53.7939" y="-1494.4648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <ellipse rx="32" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1541.5" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <ellipse rx="32" fill="none" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1541.5"/> <text x="211.3047" y="-1536.9648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">future</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1541.5" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1541.5"/> <text x="-100.7939" y="-1536.9648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="10" cy="-1499" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="10" cy="-1499"/> <text x="6.2061" y="-1494.4648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">4</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="70" cy="-1541.5" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="70" cy="-1541.5"/> <text x="66.2061" y="-1536.9648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">5</text> </g> <g fill="silver" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="silver"> <circle r="15" clip-path="url(#clipPath2)" cx="130" cy="-1541.5" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="130" cy="-1541.5"/> <text x="126.2061" y="-1536.9648" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">6</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1871.666" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1871.666"/> <text x="-160.7939" y="-1867.1309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">1</text> </g> <g fill="silver" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="silver"> <circle r="15" clip-path="url(#clipPath2)" cx="-50" cy="-1829.166" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-50" cy="-1829.166"/> <text x="-53.7939" y="-1824.6309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <ellipse rx="32" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1871.666" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <ellipse rx="32" fill="none" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1871.666"/> <text x="211.3047" y="-1867.1309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">future</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1871.666" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1871.666"/> <text x="-100.7939" y="-1867.1309" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1643.333" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-97" cy="-1643.333"/> <text x="-100.7939" y="-1638.7979" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">2</text> </g> <g fill="silver" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="silver"> <circle r="15" clip-path="url(#clipPath2)" cx="70" cy="-1643.333" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="70" cy="-1643.333"/> <text x="66.2061" y="-1638.7979" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">5</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1643.333" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="-157" cy="-1643.333"/> <text x="-160.7939" y="-1638.7979" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke="white"> <ellipse rx="32" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1643.333" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,223,1949)" stroke-linecap="butt"> <ellipse rx="32" fill="none" ry="15" clip-path="url(#clipPath2)" cx="229" cy="-1643.333"/> <text x="211.3047" y="-1638.7979" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">future</text> <path fill="none" d="M-143.0594 -1755.1289 L-71.3756 -1726.6564" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-63.9406 -1723.7031 L-73.2473 -1732.7798 L-72.3049 -1727.0255 L-76.9388 -1723.4861 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-142 -1760.666 L-120 -1760.666" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-112 -1760.666 L-124 -1765.666 L-121 -1760.666 L-124 -1755.666 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-82 -1760.666 L189 -1760.666" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M197 -1760.666 L185 -1765.666 L188 -1760.666 L185 -1755.666 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-35 -1718.166 L-13 -1718.166" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-5 -1718.166 L-17 -1723.166 L-14 -1718.166 L-17 -1713.166 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-143.0594 -1535.9629 L-71.3756 -1507.4904" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-63.9406 -1504.5371 L-73.2473 -1513.6138 L-72.3049 -1507.8595 L-76.9388 -1504.3201 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-142 -1541.5 L-120 -1541.5" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-112 -1541.5 L-124 -1546.5 L-121 -1541.5 L-124 -1536.5 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-35 -1499 L-13 -1499" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-5 -1499 L-17 -1504 L-14 -1499 L-17 -1494 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-82 -1541.5 L47 -1541.5" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M55 -1541.5 L43 -1546.5 L46 -1541.5 L43 -1536.5 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M85 -1541.5 L107 -1541.5" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M115 -1541.5 L103 -1546.5 L106 -1541.5 L103 -1536.5 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M145 -1541.5 L189 -1541.5" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M197 -1541.5 L185 -1546.5 L188 -1541.5 L185 -1536.5 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-143.0594 -1866.1289 L-71.3756 -1837.6564" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-63.9406 -1834.7031 L-73.2473 -1843.7798 L-72.3049 -1838.0255 L-76.9388 -1834.4861 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <text x="-151.3547" y="-1842.3409" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">fork!</text> <path fill="none" d="M-142 -1871.666 L-120 -1871.666" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-112 -1871.666 L-124 -1876.666 L-121 -1871.666 L-124 -1866.666 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-82 -1871.666 L189 -1871.666" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M197 -1871.666 L185 -1876.666 L188 -1871.666 L185 -1866.666 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M-82 -1643.333 L47 -1643.333" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M55 -1643.333 L43 -1648.333 L46 -1643.333 L43 -1638.333 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <text x="-47.8594" y="-1651.8643" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">goes offline</text> <path fill="none" d="M-142 -1643.333 L-120 -1643.333" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M-112 -1643.333 L-124 -1648.333 L-121 -1643.333 L-124 -1638.333 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M85 -1643.333 L189 -1643.333" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M197 -1643.333 L185 -1648.333 L188 -1643.333 L185 -1638.333 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <text x="105.5889" y="-1627.7314" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">back online,</text> <text x="112.7256" y="-1613.5986" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">pushes 5,</text> <text x="109.5059" y="-1599.4658" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">pulls 3 & 4</text> </g> </g> </svg> |
Changes to www/branching.wiki.
1 2 3 4 | <title>Branching, Forking, Merging, and Tagging</title> <h2>Background</h2> In a simple and perfect world, the development of a project would proceed | | | | < | | | | | | | | | | > > > > > > > > | > > > > > > > > > > > > | | | | | | > | > | | | | | | | | | | | | | > | | | | > > > > > > > | | | | | | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | 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 | <title>Branching, Forking, Merging, and Tagging</title> <h2>Background</h2> In a simple and perfect world, the development of a project would proceed linearly, as shown in Figure 1. <table border=1 cellpadding=10 hspace=10 vspace=10 align="center"> <tr><td align="center"> <img src="branch01.svg"><br> Figure 1 </td></tr></table> Each circle represents a check-in. For the sake of clarity, the check-ins are given small consecutive numbers. In a real system, of course, the check-in numbers would be long hexadecimal hashes since it is not possible to allocate collision-free sequential numbers in a distributed system. But as sequential numbers are easier to read, we will substitute them for the long hashes in this document. The arrows in Figure 1 show the evolution of a project. The initial check-in is 1. Check-in 2 is derived from 1. In other words, check-in 2 was created by making edits to check-in 1 and then committing those edits. We say that 2 is a <i>child</i> of 1 and that 1 is a <i>parent</i> of 2. Check-in 3 is derived from check-in 2, making 3 a child of 2. We say that 3 is a <i>descendant</i> of both 1 and 2 and that 1 and 2 are both <i>ancestors</i> of 3. <h2 id="dag">DAGs</h2> The graph of check-ins is a [http://en.wikipedia.org/wiki/Directed_acyclic_graph | directed acyclic graph] commonly shortened to <i>DAG</i>. Check-in 1 is the <i>root</i> of the DAG since it has no ancestors. Check-in 4 is a <i>leaf</i> of the DAG since it has no descendants. (We will give a more precise definition later of "leaf.") Alas, reality often interferes with the simple linear development of a project. Suppose two programmers make independent modifications to check-in 2. After both changes are committed, the check-in graph looks like Figure 2: <table border=1 cellpadding=10 hspace=10 vspace=10 align="center"> <tr><td align="center"> <img src="branch02.svg"><br> Figure 2 </td></tr></table> The graph in Figure 2 has two leaves: check-ins 3 and 4. Check-in 2 has two children, check-ins 3 and 4. We call this state a <i>fork</i>. Fossil tries to prevent forks. Suppose two programmers named Alice and Bob are each editing check-in 2 separately. Alice finishes her edits first and commits her changes, resulting in check-in 3. Later, when Bob attempts to commit his changes, Fossil verifies that check-in 2 is still a leaf. Fossil sees that check-in 3 has occurred and aborts Bob's commit attempt with a message "would fork." This allows Bob to do a "fossil update" which pulls in Alice's changes, merging them into his own changes. After merging, Bob commits check-in 4 as a child of check-in 3. The result is a linear graph as shown in Figure 1. This is how CVS works. This is also how Fossil works in [./concepts.wiki#workflow | "autosync"] mode. But perhaps Bob is off-network when he does his commit, so he has no way of knowing that Alice has already committed her changes. Or, it could be that Bob has turned off "autosync" mode in Fossil. Or, maybe Bob just doesn't want to merge in Alice's changes before he has saved his own, so he forces the commit to occur using the "--allow-fork" option to the <b>fossil commit</b> command. For any of these reasons, two commits against check-in 2 have occurred and now the DAG has two leaves. So which version of the project is the "latest" in the sense of having the most features and the most bug fixes? When there is more than one leaf in the graph, you don't really know, so we like to have check-in graphs with a single leaf. Fossil resolves such problems using the check-in time on the leaves to decide which leaf to use as the parent of new leaves. When a branch is forked as in Figure 2, Fossil will choose check-in 4 as the parent for a later check-in 5, but <i>only</i> if it has sync'd that check-in down into the local repository. If autosync is disabled or the user is off-network when that fifth check-in occurs, so that check-in 3 is the latest on that branch at the time within that clone of the repository, Fossil will make check-in 3 the parent of check-in 5! Fossil also uses a forked branch's leaf check-in timestamps when checking out that branch: it gives you the fork with the latest check-in, which in turn selects which parent your next check-in will be a child of. This situation means development on that branch can fork into two independent lines of development, based solely on which branch tip is newer at the time the next user starts his work on it. Because of this, we strongly recommend that you do not intentionally create forks on long-lived shared working branches with "--allow-fork". (Prime example: trunk.) Let us return to Figure 2. To resolve such situations before they can become a real problem, Alice can use the <b>fossil merge</b> command to merge Bob's changes into her local copy of check-in 3. Then she can commit the results as check-in 5. This results in a DAG as shown in Figure 3. <table border=1 cellpadding=10 hspace=10 vspace=10 align="center"> <tr><td align="center"> <img src="branch03.svg"><br> Figure 3 </td></tr></table> Check-in 5 is a child of check-in 3 because it was created by editing check-in 3. But check-in 5 also inherits the changes from check-in 4 by virtue of the merge. So we say that check-in 5 is a <i>merge child</i> of check-in 4 and that it is a <i>direct child</i> of check-in 3. The graph is now back to a single leaf, check-in 5. We have already seen that if Fossil is in autosync mode then Bob would have been warned about the potential fork the first time he tried to commit check-in 4. If Bob had updated his local check-out to merge in Alice's check-in 3 changes, then committed, then the fork would have never occurred. The resulting graph would have been linear, as shown in Figure 1. Realize that the graph of Figure 1 is a subset of Figure 3. Hold your hand over the check-in 4 circle of Figure 3 and then Figure 3 looks exactly like Figure 1, except that the leaf has a different check-in number, but that is just a notational difference — the two check-ins have exactly the same content. In other words, Figure 3 is really a superset of Figure 1. The check-in 4 of Figure 3 captures additional state which is omitted from Figure 1. Check-in 4 of Figure 3 holds a copy of Bob's local checkout before he merged in Alice's changes. That snapshot of Bob's changes, which is independent of Alice's changes, is omitted from Figure 1. Some people say that the approach taken in Figure 3 is better because it preserves this extra intermediate state. Others say that the approach taken in Figure 1 is better because it is much easier to visualize a linear line of development and because the merging happens automatically instead of as a separate manual step. We will not take sides in that debate. We will simply point out that Fossil enables you to do it either way. <h2 id="branching">The Alternative to Forking: Branching</h2> Having more than one leaf in the check-in DAG is called a "fork." This is usually undesirable and either avoided entirely, as in Figure 1, or else quickly resolved as shown in Figure 3. But sometimes, one does want to have multiple leaves. For example, a project might have one leaf that is the latest version of the project under development and another leaf that is the latest version that has been tested. When multiple leaves are desirable, we call this <i>branching</i> instead of <i>forking</i>: <blockquote> <b>Key Distinction:</b> A branch is a <i>named, intentional</i> fork. </blockquote> Forks <i>may</i> be intentional, but most of the time, they're accidental. Figure 4 shows an example of a project where there are two branches, one for development work and another for testing. <table border=1 cellpadding=10 hspace=10 vspace=10 align="center"> <tr><td align="center"> <img src="branch04.svg"><br> Figure 4 </td></tr></table> The hypothetical scenario of Figure 4 is this: The project starts and progresses to a point where (at check-in 2) it is ready to enter testing for its first release. In a real project, of course, there might be hundreds or thousands of check-ins before a project reaches this point, but for simplicity of presentation we will say that the project is ready after check-in 2. The project then splits into two branches that are used by separate teams. The testing team, using the blue branch, finds and fixes a few bugs. This is shown by check-ins 6 and 9. Meanwhile the development team, working on the top uncolored branch, is busy adding features for the second release. Of course, the development team would like to take advantage of the bug fixes implemented by the testing team. So periodically, the changes in the test branch are merged into the dev branch. This is shown by the dashed merge arrows between check-ins 6 and 7 and between check-ins 9 and 10. In both Figures 2 and 4, check-in 2 has two children. In Figure 2, we call this a "fork." In diagram 4, we call it a "branch." What is the difference? As far as the internal Fossil data structures are concerned, there is no difference. The distinction is in the intent. In Figure 2, the fact that check-in 2 has multiple children is an accident that stems from concurrent development. In Figure 4, giving check-in 2 multiple children is a deliberate act. So, to a good approximation, we define forking to be by accident and branching to be by intent. Apart from that, they are the same. Fossil offers two primary ways to create named, intentional forks, a.k.a. branches. First: <pre> $ fossil commit --branch my-new-branch-name </pre> This is the method we recommend for most cases: it creates a branch as part of a checkin using the version in the current checkout directory as its basis. (This is normally the tip of the current branch, though it doesn't have to be. You can create a branch from an ancestor checkin on a branch as well.) After making this branch-creating checkin, your local working directory is switched to that branch, so that further checkins occur on that branch as well, as children of the tip checkin on that branch. The second, more complicated option is: <pre> $ fossil branch new my-new-branch-name trunk $ fossil update my-new-branch-name $ fossil commit </pre> Not only is this three commands instead of one, the first of which is longer than the entire simpler command above, you must give the second command before creating any checkins, because until you do, your local working directory remains on the same branch it was on at the time you issued the command, so that the commit would otherwise put the new material on the original branch instead of the new one. In addition to those problems, the second method is a violation of the [https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it|YAGNI Principle]. We recommend that you wait until you actually need the branch and create it using the first command above. (Keep in mind that trunk is just another branch in Fossil. It is simply the default branch name for the first checkin and every checkin made as one of its direct descendants. It is special only in that it is Fossil's default when it has no better idea of which branch you mean.) <h2 id="forking">Justifications For Forking</h2> The primary cases where forking is justified over branching are all when it is done purely in software in order to avoid losing information: <ol> <li><p id="offline">By Fossil itself when two users check in children to the same leaf of a branch, as in Figure 2. If the fork occurs because autosync is disabled on one or both of the repositories or because the user doing the check-in has no network connection at the moment of the commit, Fossil has no way of knowing that it is creating a fork until the two repositories are later synchronized.</p></li> <li><p id="dist-clone">By Fossil when the cloning hierarchy is more than 2 levels deep. <br><br> [./sync.wiki|Fossil's synchronization protocol] is a two-party negotiation; syncs don't automatically propagate up the clone tree beyond that. Because of that, if you have a master repository and Alice clones it, then Bobby clones from Alice's repository, a check-in by Bobby that autosyncs with Alice's repo will <i>not</i> also autosync with the master repo. The master doesn't get a copy of Bobby's checkin until Alice <i>separately</i> syncs with the master. If Carol cloned from the master repo and checks something in that creates a fork relative to Bobby's check-in, the master repo won't know about that fork until Alice syncs her repo with the master. Even then, realize that Carol still won't know about the fork until she subsequently syncs with the master repo. <br><br> One way to deal with this is to just accept it as a fact of using a [https://en.wikipedia.org/wiki/Distributed_version_control|Distributed Version Control System] like Fossil. <br><br> Another option, which we recommend you consider carefully, is to make it a local policy that checkins be made only against the master repo or one of its immediate child clones so that the autosync algorithm can do its job most effectively; any clones deeper than that should be treated as read-only and thus get a copy of the new state of the world only once these central repos have negotiated that new state. This policy avoids a class of inadvertent fork you might not need to tolerate. Since [#bad-fork|forks on long-lived shared working branches can end up dividing a team's development effort], a team may easily justify this restriction on distributed cloning.</p></li> <li><p id="automation">You've automated Fossil (e.g. with a shell script) and forking is a possibility, so you write <b>fossil commit --allow-fork</b> commands to prevent Fossil from refusing the check-in because it would create a fork. It's better to write such a script to detect this condition and cope with it (e.g. <b>fossil update</b>) but if the alternative is losing information, you may feel justified in creating forks that an interactive user must later clean up with <b>fossil merge</b> commands.</p></li> </ol> That leaves only one case where we can recommend use of "--allow-fork" by interactive users: when you're working on a personal branch so that creating a dual-tipped branch isn't going to cause any other user an inconvenience or risk forking the development. Only one developer is involved, and the fork may be short-lived, so there is no risk of [#bad-fork|inadvertently forking the overall development effort]. This is a good alternative to branching when you just need to temporarily fork the branch's development. It avoids cluttering the global branch namespace with short-lived temporary named branches. There's a common generalization of that case: you're a solo developer, so that the problems with branching vs forking simply don't matter. In that case, feel free to use "--allow-fork" as much as you like. <h2 id="fix">Fixing Forks</h2> If your local checkout is on a forked branch, you can usually fix a fork automatically with: <pre> $ fossil merge </pre> Normally you need to pass arguments to <b>fossil merge</b> to tell it what you want to merge into the current basis view of the repository, but without arguments, the command seeks out and fixes forks. <h2 id="tags">Tags And Properties</h2> Tags and properties are used in Fossil to help express the intent, and thus to distinguish between forks and branches. Figure 5 shows the same scenario as Figure 4 but with tags and properties added: <table border=1 cellpadding=10 hspace=10 vspace=10 align="center"> <tr><td align="center"> <img src="branch05.svg"><br> Figure 5 </td></tr></table> A <i>tag</i> is a name that is attached to a check-in. A <i>property</i> is a name/value pair. Internally, Fossil implements tags as properties with a NULL value. So, tags and properties really are much the same thing, and henceforth we will use the word "tag" to mean either a tag or a property. A tag can be a one-time tag, a propagating tag or a cancellation tag. A one-time tag only applies to the check-in to which it is attached. A propagating tag applies to the check-in to which it is attached and also to all direct descendants of that check-in. A <i>direct descendant</i> is a descendant through direct children. Tag propagation does not cross merges. Tag propagation also stops as soon as it encounters another check-in with the same tag. A cancellation tag is attached to a single check-in in order to either override a one-time tag that was previously placed on that same check-in, or to block tag propagation from an ancestor. The initial check-in of every repository has two propagating tags. In Figure 5, that initial check-in is check-in 1. The <b>branch</b> tag tells (by its value) what branch the check-in is a member of. The default branch is called "trunk." All tags that begin with "<b>sym-</b>" are symbolic name tags. When a symbolic name tag is attached to a check-in, that allows you to refer to that check-in by its symbolic name rather than by its hexadecimal hash name. When a symbolic name tag propagates (as does the <b>sym-trunk</b> tag) then referring to that name is the same as referring to the most recent check-in with that name. |
︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | Figure 5 also shows two one-time tags on check-in 9. (The diagram does not make a graphical distinction between one-time and propagating tags.) The <b>sym-release-1.0</b> tag means that check-in 9 can be referred to using the more meaningful name "release-1.0." The <b>closed</b> tag means that check-in 9 is a "closed leaf." A closed leaf is a leaf that should never have direct children. <h2>Review Of Terminology</h2> <blockquote><dl> <dt><b>Branch</b></dt> <dd><p>A branch is a set of check-ins with the same value for their "branch" property.</p></dd> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | Figure 5 also shows two one-time tags on check-in 9. (The diagram does not make a graphical distinction between one-time and propagating tags.) The <b>sym-release-1.0</b> tag means that check-in 9 can be referred to using the more meaningful name "release-1.0." The <b>closed</b> tag means that check-in 9 is a "closed leaf." A closed leaf is a leaf that should never have direct children. <h2 id="bad-fork">How Can Forks Divide Development Effort?</h2> [#dist-clone|Above], we stated that forks carry a risk that development effort on a branch can be divided among the forks. It might not be immediately obvious why this is so. To see it, consider this swim lane diagram: <table border=1 cellpadding=10 hspace=10 vspace=10 align="center"> <tr><td align="center"> <img src="branch06.svg"><br> Figure 6 </td></tr></table> This is a happy, cooperating team. That is an important restriction on our example, because you must understand that this sort of problem can arise without any malice, selfishness, or willful ignorance in sight. All users on this diagram start out with the same view of the repository, cloned from the same master repo, and all of them are working toward their shared vision of a unified future. All users, except possibly Alan, start out with the same two initial checkins in their local working clones, 1 & 2. It might be that Alan starts out with only check-in 1 in his local clone, but we'll deal with that detail later. It doesn't matter which branch this happy team is working on, only that our example makes the most sense if you think of it as a long-lived shared working branch like trunk. Each user makes only one check-in, shaded light gray in the diagram. <h3 id="bf-alan">Step 1: Alan</h3> Alan sets the stage for this problem by creating a fork from check-in 1 as check-in 3. How and why Alan did this doesn't affect what happens next, though we will walk through the possible cases and attempt to assign blame [#post-mortem|in the <i>post mortem</i>]. For now, you can assume that Alan did this out of unavoidable ignorance. <h3 id="bf-betty">Step 2: Betty</h3> Because Betty's local clone is autosyncing with the same upstream repository as Alan's clone, there are a number of ways she can end up seeing Alan's check-in 3 as the latest on that branch: <ol> <li><p>The working check-out directory she's using at the moment was on a different branch at the time Alan made check-in 3, so Fossil sees that as the tip at the time she switches her working directory to that branch with a <b>fossil update $BRANCH</b> command. (There is an implicit autosync in that command, if the option was enabled at the time of the update.)</p></li> <li><p>The same thing, only in a fresh checkout directory with a <b>fossil open $REPO $BRANCH</b> command.</p></li> <li><p>Alan makes his check-in 3 while Betty has check-in 1 or 2 as the tip in her local clone, but because she's working with an autosync'd connection to the same upstream repository as Alan, on attempting what will become check-in 4, she gets the "would fork" message from <b>fossil ci</b>, so she dutifully updates her clone and tries again, moving her work to be a child of the new tip, check-in 3. (If she doesn't update, she creates a <i>second</i> fork, which simply complicates matters beyond what we need here for our illustration.)</p></li> </ol> For our purposes here, it doesn't really matter which one happened. All that matters is that Alan's check-in 3 becomes the parent of Betty's check-in 4 because it was the newest tip of the working branch at the time Betty does her check-in. <h3 id="bf-charlie">Step 3: Charlie</h3> Meanwhile, Charlie went offline after syncing his repo with check-in 2 as the latest on that branch. When he checks his changes in, it is as a child of 2, not of 4, because Charlie doesn't know about check-ins 3 & 4 yet. He does this at an absolute wall clock time <i>after</i> Alan and Betty made their check-ins, so when Charlie comes back online and pushes his check-in 5 to the master repository and learns about check-ins 3 and 4 during Fossil sync, Charlie inadvertently revives the other side of the fork. <h3 id="bf-darlene">Step 4: Darlene</h3> Darlene sees all of this, because she joins in on the work on this branch after Alan, Betty, and Charlie made their check-ins and pushed them to the master repository. She's taking one of the same three steps as we [#bf-betty|outlined for Betty above]. Regardless of her path to this view, it happens after Charlie pushed his check-in 5 to the master repo, so Darlene sees that as the latest on the branch, causing her work to be saved as a child of check-in 5, not of check-in 4, as it would if Charlie didn't come back online and sync before Darlene started work on that branch. <h3 id="post-mortem">Post Mortem</h3> The end result of all of this is that even though everyone makes only one check-in and no one disables autosync without genuine need, half of the check-ins end up on one side of the fork and half on the other. A future user — his mother calls him Edward, but please call him Eddie — can then join in on the work on this branch and end up on <i>either</i> side of the fork. If Eddie joins in with the state of the repository as drawn above, he'll end up on the top side of the fork, because check-in 6 is the latest, but if Alan or Betty makes a seventh check-in to that branch first, it will be as a child of check-in 4 since that's the version in their local check-out directories. Since that check-in 7 will then be the latest, Eddie will end up on the bottom side of the fork instead. In all of this, realize that neither side of the fork is obviously "correct." Every participant was doing the right thing by their own lights at the time they made their lone check-in. Who, then, is to blame? We can only blame the consequences of creating the fork on Alan if he did so on purpose, as by passing "--allow-fork" when creating a check-in on a shared working branch. Alan might have created it inadvertently by going offline while check-in 1 was the tip of the branch in his local clone, so that by the time he made his check-in 3, check-in 2 had arrived at the shared parent repository from someone else. (Francine?) When Alan rejoins the network and does an autosync, he learns about check-in 2. Since his #3 is already checked into his local clone because autosync was off or blocked, the sync creates an unavoidable fork. We can't blame either Alan or Francine here: they were both doing the right thing given their imperfect view of the state of the global situation. The same is true of Betty, Charlie, and Darlene. None of them tried to create a fork, and none of them chose a side in this fork to participate in. They just took Fossil's default and assumed it was correct. The only blame I can assign here is on any of these users who believed forks couldn't happen before this did occur, and I blame them only for their avoidable ignorance. (You, dear reader, have been ejected from that category by reading this very document.) Any time someone can work without getting full coordination from every other clone of the repo, forks are possible. Given enough time, they're all but inevitable. This is a general property of DVCSes, not just of Fossil. This sort of consequence is why forks on shared working branches are bad, which is why [./concepts.wiki#workflow|Fossil tries so hard to avoid them], why it warns you about it when they do occur, and why it makes it relatively [#fix|quick and painless to fix them] when they do occur. <h2>Review Of Terminology</h2> <blockquote><dl> <dt><b>Branch</b></dt> <dd><p>A branch is a set of check-ins with the same value for their "branch" property.</p></dd> |
︙ | ︙ | |||
248 249 250 251 252 253 254 | children in the same branch.</p></dd> <dt><b>Branch Point</b></dt> <dd><p>A branch point occurs when a check-in has two or more direct (non-merge) children in different branches. A branch point is similar to a fork, except that the children are in different branches.</p></dd> </dl></blockquote> | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | children in the same branch.</p></dd> <dt><b>Branch Point</b></dt> <dd><p>A branch point occurs when a check-in has two or more direct (non-merge) children in different branches. A branch point is similar to a fork, except that the children are in different branches.</p></dd> </dl></blockquote> Check-in 4 of Figure 3 is not a leaf because it has a child (check-in 5) in the same branch. Check-in 9 of Figure 5 also has a child (check-in 10) but that child is in a different branch, so check-in 9 is a leaf. Because of the <b>closed</b> tag on check-in 9, it is a closed leaf. Check-in 2 of Figure 3 is considered a "fork" because it has two children in the same branch. Check-in 2 of Figure 5 also has two children, but each child is in a different branch, hence in Figure 5, check-in 2 is considered a "branch point." <h2>Differences With Other DVCSes</h2> <h3 id="single">Single DAG</h3> Fossil keeps all check-ins on a single DAG. Branches are identified with tags. This means that check-ins can be freely moved between branches simply by altering their tags. Most other DVCSes maintain a separate DAG for each branch. <h3 id="unique">Branch Names Need Not Be Unique</h3> Fossil does not require that branch names be unique, as in some VCSes, most notably Git. Just as with unnamed branches (which we call forks) Fossil resolves such ambiguities using the timestamps on the latest checkin in each branch. If you have two branches named "foo" and you say <b>fossil up foo</b>, you get the tip of the "foo" branch with the most recent checkin. This fact is helpful because it means you can reuse branch names, which is especially useful with utility branches. There are several of these in the SQLite and Fossil repositories: "broken-build," "declined," "mistake," etc. As you might guess from these names, such branch names are used in renaming the tip of one branch to shunt it off away from the mainline of that branch due to some human error. (See <b>fossil amend</b> and the Fossil UI checkin amendment features.) This is a workaround for Fossil's [./shunning.wiki|normal inability to forget history]: we usually don't want to actually <i>remove</i> history, but would like to sometimes set some of it aside under a new label. Because some VCSes can't cope with duplicate branch names, Fossil collapses such names down on export using the same time stamp based arbitration logic, so that only the branch with the newest checkin gets the branch name in the export. All of the above is true of tags in general, not just branches. |
Changes to www/build.wiki.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 | <h2>2.0 Compiling</h2> <ol> <li value="5"> <p>Unpack the ZIP or tarball you downloaded then <b>cd</b> into the directory created.</p></li> <li><i>(Optional, Unix only)</i> Run <b>./configure</b> to construct a makefile. <ol type="a"> <li><p> | > > > > > > > > > > > > > > | > > | > > > > > > > > > | 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 | <h2>2.0 Compiling</h2> <ol> <li value="5"> <p>Unpack the ZIP or tarball you downloaded then <b>cd</b> into the directory created.</p></li> <li><i>(Optional, Debian-compatible Linux only)</i> Make sure you have all the necessary tools and libraries at hand by running: <b>sudo apt install tcl-dev tk libssl-dev</b>. <li><i>(Optional, Unix only)</i> Run <b>./configure</b> to construct a makefile. <ol type="a"> <li><p> The build system for Fossil on Unix-like systems assumes that the OpenSSL development and runtime files are available on your system, because unprotected repositories are trivial to attack otherwise. Indeed, some public Fossil repositories — including Fossil's own — today run in an HTTPS-only mode, so that you can't even do an anonymous clone from them without using the TLS features added to Fossil by OpenSSL. To weaken that stance could allow a [https://en.wikipedia.org/wiki/Man-in-the-middle_attack|man in the middle attack], such as one that substitutes malicious code into your Fossil repository clone.</p> <p>You can force the Fossil build system to avoid searching for, building against, and linking to the OpenSSL library by passing <b>--with-openssl=none</b> to the <tt>configure</tt> script.</p> <p>If you do not have the OpenSSL development libraries on your system, we recommend that you install them, typically via your OS's package manager. The Fossil build system goes to a lot of effort to seek these out wherever they may be found, so that is typically all you need to do.</p> <p>For more advanced use cases, see the [./ssl.wiki#openssl-bin|OpenSSL discussion in the "TLS and Fossil" document].</p> <li><p> To build a statically linked binary (suitable for use inside a chroot jail) add the <b>--static</b> option. <li><p> To enable the native [./th1.md#tclEval | Tcl integration feature] feature, |
︙ | ︙ | |||
106 107 108 109 110 111 112 | <li><p><i>Unix without running "configure"</i> → if you prefer to avoid running configure, you can also use: <b>make -f Makefile.classic</b>. You may want to make minor edits to Makefile.classic to configure the build for your system. <li><p><i>MinGW 3.x (<u>not</u> 4.x) / MinGW-w64</i> → Use the MinGW makefile: "<b>make -f win/Makefile.mingw</b>". On a Windows box you will need either | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | <li><p><i>Unix without running "configure"</i> → if you prefer to avoid running configure, you can also use: <b>make -f Makefile.classic</b>. You may want to make minor edits to Makefile.classic to configure the build for your system. <li><p><i>MinGW 3.x (<u>not</u> 4.x) / MinGW-w64</i> → Use the MinGW makefile: "<b>make -f win/Makefile.mingw</b>". On a Windows box you will need either Cygwin or MSYS as build environment. On Cygwin, Linux or Darwin you may want to make minor edits to win/Makefile.mingw to configure the cross-compile environment. To enable the native [./th1.md#tclEval | Tcl integration feature], use a command line like the following (all on one line): <b>make -f win/Makefile.mingw FOSSIL_ENABLE_TCL=1 FOSSIL_ENABLE_TCL_STUBS=1 FOSSIL_ENABLE_TCL_PRIVATE_STUBS=1</b> |
︙ | ︙ | |||
134 135 136 137 138 139 140 | file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | file "<b>win\buildmsvc.bat</b>" may be used and it will attempt to detect and use the latest installed version of MSVC.<br><br>To enable the optional <a href="https://www.openssl.org/">OpenSSL</a> support, first <a href="https://www.openssl.org/source/">download the official source code for OpenSSL</a> and extract it to an appropriately named "<b>openssl-X.Y.ZA</b>" subdirectory within the local [/tree?ci=trunk&name=compat | compat] directory (e.g. "<b>compat/openssl-1.1.1d</b>"), then make sure that some recent <a href="http://www.perl.org/">Perl</a> binaries are installed locally, and finally run one of the following commands: <blockquote><pre> nmake /f Makefile.msc FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin </pre></blockquote> <blockquote><pre> buildmsvc.bat FOSSIL_ENABLE_SSL=1 FOSSIL_BUILD_SSL=1 PERLDIR=C:\full\path\to\Perl\bin |
︙ | ︙ | |||
163 164 165 166 167 168 169 | "openssl-devel" packages installed first. </ol> </ol> <h2>3.0 Installing</h2> <ol> | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | "openssl-devel" packages installed first. </ol> </ol> <h2>3.0 Installing</h2> <ol> <li value="9"> <p>The finished binary is named "fossil" (or "fossil.exe" on Windows). Put this binary in a directory that is somewhere on your PATH environment variable. It does not matter where.</p> <li> <p><b>(Optional:)</b> |
︙ | ︙ | |||
202 203 204 205 206 207 208 | TCC += -DSQLITE_WITHOUT_ZONEMALLOC TCC += -D_BSD_SOURCE TCC += -DWITHOUT_ICONV TCC += -Dsocketlen_t=int TCC += -DSQLITE_MAX_MMAP_SIZE=0 </pre></blockquote> </ul> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | TCC += -DSQLITE_WITHOUT_ZONEMALLOC TCC += -D_BSD_SOURCE TCC += -DWITHOUT_ICONV TCC += -Dsocketlen_t=int TCC += -DSQLITE_MAX_MMAP_SIZE=0 </pre></blockquote> </ul> <h2>5.0 Building a Static Binary on Linux using Docker</h2> Building a static binary on Linux is not as straightforward as it could be because the GNU C library requires that certain components be dynamically loadable. That can be worked around by building against a different C library, which is simplest to do by way of a container environment like [https://www.docker.com/ | Docker]. The following instructions for building fossil using Docker were adapted from [https://fossil-scm.org/forum/forumpost/5dd2d61e5f | forumpost/5dd2d61e5f]. These instructions assume that docker is installed and that the user running these instructions has permission to do so (i.e., they are <tt>root</tt> or are a member of the <tt>docker</tt> group). First, create a file named <tt>Dockerfile</tt> with the following contents: <pre><code> FROM alpine:edge RUN apk update \ && apk upgrade \ \ && apk add --no-cache \ curl gcc make tcl \ musl-dev \ openssl-dev zlib-dev \ openssl-libs-static zlib-static \ \ && curl \ "https://www.fossil-scm.org/index.html/tarball/fossil-src.tar.gz?name=fossil-src&uuid=trunk" \ -o fossil-src.tar.gz \ \ && tar xf fossil-src.tar.gz \ && cd fossil-src \ \ && ./configure \ --static \ --disable-fusefs \ --with-th1-docs \ --with-th1-hooks \ \ && make </code></pre> Be sure to modify the <tt>configure</tt> flags, if desired. e.g., add <tt>--json</tt> for JSON support. From the directory containing that file, build it with docker: <pre><code># docker build -t fossil_static .</code></pre> If you get permissions errors when running that as a non-root user, be sure to add the user to the <tt>docker</tt> group before trying again. That creates a docker image and builds a static fossil binary inside it. That step will take several minutes or more, depending on the speed of the build environment. Next, create a docker container to host the image we just created: <pre><code># docker create --name fossil fossil_static</code></pre> Then copy the fossil binary from that container: <pre><code># docker cp fossil:/fossil-src/fossil fossil</code></pre> The resulting binary will be <em>huge</em> because it is built with debug info. To strip that information, reducing the size greatly: <pre><code># strip fossil</code></pre> To delete the Docker container and image (if desired), run: <pre><code># docker container rm fossil # docker image ls </code></pre> Note the IDs of the images named <tt>fossil_static</tt> and <tt>alpine</tt>, then: <pre><code>docker image rm THE_FOSSIL_ID THE_ALPINE_ID</code></pre> |
Added www/caps/admin-v-setup.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Differences Between Setup and Admin User This document explains the distinction between [Setup users][caps] and [Admin users][capa]. For other information about use types, see: * [Administering User Capabilities](./) * [How Moderation Works](../forum.wiki#moderation) * [Users vs Subscribers](../alerts.md#uvs) * [Defense Against Spiders](../antibot.wiki) ## <a name="philosophy"></a>Philosophical Core The Setup user "owns" the Fossil repository and may delegate a subset of that power to one or more Admin users. The Setup user can grant Admin capability and take it away, but Admin users cannot grant themselves Setup capability, either directly via the Admin → Users UI page or via any indirect means. (If you discover indirect means to elevate Admin privilege to Setup, it's a bug, so please [report it][forum]!) It is common for the Setup user to have administrative control over the host system running the Fossil repository, whereas it makes no sense for Admin users to have that ability. If an Admin-only user had `root` access on a Linux box running the Fossil instance they are an Admin on, they could elevate their capability to Setup in several ways. (The `fossil user` command, the `fossil sql` command, editing the repository DB file directly, etc.) Therefore, if you wish to grant someone Setup-like capability on a Fossil repository but you're unwilling to give them a login on the host system, you probably want to grant them Admin capability instead. Admin power is delegated from Setup. When a Setup user grants Admin capability, it is an expression of trust in that user's judgement. Admin-only users must not fight against the policies of the Setup user. Such a rift would be just cause for the Setup user to strip the Admin user's capabilities. This may then create a fork in the project’s development effort as the ex-Admin takes their clone and stands it up elsewhere, so they may become that fork’s Setup user. A useful rule of thumb here is that Admin users should only change things that the Setup user has not changed from the stock configuration. In this way, an Admin-only user can avoid overriding the Setup user's choices. You can also look at the role of Admin from the other direction, up through the [user power hierarchy][ucap] rather than down from Setup. An Admin user is usually a “super-developer” role, given full control over the repository’s managed content: versioned artifacts in [the block chain][bc], [unversioned content][uv], forum posts, wiki articles, tickets, etc. We’ll explore these distinctions in the rest of this document. [bc]: ../blockchain.md [ucap]: ./index.md#ucap [uv]: ../unvers.wiki ## <a name="binary"></a>No Granularity Fossil doesn’t make any distinction between these two user types beyond this binary choice: Setup or Admin. A few features of Fossil are broken down so that only part of the feature is accessible to Admin, with the rest left only to Setup users, but for the most part each feature affected by this distinction is either Admin + Setup or Setup-only. We could add more capability letters to break down individual sub-features, but we’d run out of ASCII alphanumerics pretty quickly, and we might even run out of ASCII punctuation and symbols. Then would we need to shift to Unicode? Consider the Admin → Settings page, which is currently restricted to Setup users only: you might imagine breaking this up into several subsets so that some settings can be changed by Admin users. Is that a good idea? Maybe, but it should be done only after due consideration. It would definitely be wrong to assign a user capability bit to *each* setting on that page. Now consider the opposite sort of case, Admin → Skins. Fossil grants Admin users full access to this page so that the Admins can maintain and extend the skin as the repository evolves, not so Admins can switch the entire skin to another without consulting with the Setup user first. How would Fossil decide, using user capabilities only, which skin changes the Admin user is allowed to do, and which must be left to Setup? Do we assign a separate capability letter to each step in `/setup_skin`? Do we assign one more each to the five sections of a skin? (Header, Footer, CSS, JavaScript, and Details.) It quickly becomes unmanageable. ## <a name="capgroups"></a>Capability Groups We can break up the set of powers the Admin user capability grants into several groups, then defend each group as a coherent whole. ### <a name="security"></a>Security While establishing the Fossil repository's security policy is a task for the Setup user, *maintaining* that policy is something that Fossil allows a Setup user to delegate to trustworthy users via the Admin user capability: * **Manage users**: The only thing an Admin-only user cannot do on the Admin → Users page is grant Setup capability, either to themselves or to other users. The intent is that Admin users be able to take some of the load of routine user management tasks off the shoulders of the Setup user: delete accounts created by spammers, fix email alert subscriptions, reset passwords, etc. * **Security audit**: The Admin → Security-Audit page runs several tests on the Fossil repository's configuration, then reports potential problems it found and offers canned solutions. Those canned solutions do not do anything that an Admin-user could not do via other means, so this page offers the Admin-only user no more power than they otherwise had. For example, this page's "Take it Private" feature can also be done manually via Admin → Users. This page is a convenience, not a grant of new power to the Admin-only user. * **Logging**:<a id="log"></a> Admin-only users get to see the various Fossil logs in case they need to use them to understand a problem they're empowered to solve. An obvious example is a spam attack: the Admin might want to find the user's last-used IP, see if they cloned the repository, see if they attempted to brute-force an existing login before self-registering, etc. Some security-conscious people might be bothered by the fact that Admin-only users have these abilities. Think of a large IT organization: if the CIO hires a [tiger team][tt] to test the company's internal IT defenses, the line grunts fix the reported problems, not the CIO. ### <a name="administrivia"></a>Administrivia It is perfectly fine for a Fossil repository to only have Setup users, no Admin users. The smaller the repository, the more likely the repository has no Admin-only users. If the Setup user neither needs nor wants to grant Admin power to others, there is no requirement in Fossil to do so. [Setup capability is a pure superset of Admin capability.][sia] As the number of users on a Fossil repository grows, the value in delegating administrivia also grows, because the Setup user typically has other time sinks they consider more important. Admin users can take over the following routine tasks on behalf of the Setup user: * **Shunning**: After user management, this is one of the greatest powers of an Admin-only user. Fossil grants access to the Admin → Shunned page to Admin users rather than reserve it to Setup users because one of the primary purposes of [the Fossil shunning system][shun] is to clean up after a spammer, and that's exactly the sort of administrivia we wish to delegate to Admin users. Coupled with the Rebuild button on the same page, an Admin user has the power to delete the repository's entire [blockchain][bc]! This makes this feature a pretty good razor in deciding whether to grant someone Admin capability: do you trust that user to shun Fossil artifacts responsibly? Realize that shunning is cooperative in Fossil. As long as there are surviving repository clones, an Admin-only user who deletes the whole blockchain has merely caused a nuisance. An Admin-only user cannot permanently destroy the repository unless the Setup user has been so silly as to have no up-to-date clones. * **Moderation**: According to the power hierarchy laid out at the top of this article, Admins are greater than Moderators, so control over what Moderators can do clearly belongs to both Admins and to the Setup user(s). * **Status**: Although the Fossil `/stat` page is visible to every user with Read capability, there are several additional things this page gives access to when a user also has the Admin capability: * <p>[Email alerts][ale] and [backoffice](../backoffice.md) status. Admin-only users cannot modify the email alerts setup, but they can see some details about its configuration and current status.</p> * <p>The `/urllist` page, which is a read-only page showing the ways the repository can be accessed and how it has been accessed in the past. Logically, this is an extension to logging, [covered above](#log).</p> * <p>The Fossil repository SQL schema. This is not particularly sensitive information, since you get more or less the same information when you clone the repository. It's restricted to Admin because it's primarily useful in debugging SQL errors, which happen most often when Fossil itself is in flux and the schema isn't being automatically updated correctly. That puts this squarely into the "administrivia" category.</p> * <p>Web cache status, environment, and logging: more administrivia meant to help the Admin debug problems.</p> * **Configure search** [ale]: ../alerts.md [shun]: ../shunning.wiki ### <a name="cosmetics"></a>Cosmetics While the Setup user is responsible for setting up the initial "look" of a Fossil repository, the Setup user entrusts Admin users with *maintaining* that look. An Admin-only user therefore has the following special abilities: * Modify the repository skin * Create and modify URL aliases * Manage the "ad units" feature, if enabled. * Adjust the `/timeline` display preferences. * Change the "logo" element displayed by some skins. These capabilities allow an Admin-only user to affect the branding and possibly even the back-end finances of a project. This is why we began this document with a philosophical discussion: if you cannot entrust a user with these powers, you should not grant that user Admin capability. ## <a name="clones"></a>Clones and Backups Keep in mind that Fossil is a *distributed* version control system, which means that a user known to Fossil might have Setup capability on one repository but be a mere "user" on one of its clones. The most common case is that when you clone a repository, even anonymously, you gain Setup power over the local clone. The distinctions above therefore are intransitive: they apply only within a single repository instance. The exception to this is when the clone is done as a Setup user, since this also copies the `user` table on the initial clone. A user with Setup capability can subsequently say [`fossil conf pull all`][fcp] to update that table and everything else not normally synchronized between Fossil repositories. In this way, a Setup user can create multiple interchangeable clones. This is useful not only to guard against rogue Admin-only users, it is a useful element of a load balancing and failover system. ## <a name="apsu"></a>The All-Powerful Setup User Setup users get [every user capability](./ref.html) of Fossil except for [two exceptionally dangerous capabilities](#dcap), which they can later grant to themselves or to others. In addition, Setup users can use every feature of the Fossil UI. If Fossil can do a thing, a Setup user on that repo can make Fossil do it. Setup users can do many things that Admin users cannot: * Use all of the Admin UI features * See record IDs (RIDs) on screens that show them * See the MIME type of attachments on [`/ainfo` pages](/help?cmd=/ainfo) * See a remote repo’s HTTP [cache status](/help?cmd=/cachestat) and [pull cache entries](/help?cmd=/cacheget) * Edit a Setup user’s account! The “Admin” feature of Fossil UI is so-named because Admin users can use about half of its functions, but only Setup can use these pages: * **Access**: This page falls under the [Security](#security) category above, but like Configuration, it's generally something set up once and never touched, so only Setup users should change it. * **Configuration**: This page nominally falls under [Cosmetics](#cosmetics) above, but it's such a core part of the Fossil configuration — something every Setup user is expected to fully specify on initial repository setup — that we have trouble justifying any case where an Admin-only user would have good cause to modify any of it. This page is generally set up once and then never touched again. * **Email-Server**: This is an experimental SMTP server feature which is currently unused in Fossil. Should we get it working, it will likely remain Setup-only, since it will likely be used as a replacement for the platform’s default SMTP server, a powerful position for a piece of software to take. * **Login-Group**: [Login groups][lg] allow one Fossil repository to delegate user access to another. Since an Admin-only user on one repo might not have such access to another repo on the same host system, this must be a Setup-only task. * **Notification**: This is the main UI for setting up integration with a platform’s SMTP service, for use in sending out [email notifications][ale]. Because this screen can set commands to execute on the host, and because finishing the configuration requires a login on the Fossil host system, it is not appropriate to give Admin users access to it. * **Settings**: The [repository settings][rs] available via Admin → Settings have too wide a range of power to allow modification by Admin-only users: * <p><b>Harmless</b>: Admin-only users on a repository may well have checkin rights on the repository, so the fact that versionable settings like `crlf-glob` can also be set at the repository level seems like a thing we might want to allow Admin-only users the ability to change. Since Fossil currently has no way to allow only some settings to be changed by Admin-only users and some not, we can't just show these harmless settings to Admin-only users.</p> * <p><b>Low-Risk</b>: The <tt>admin-log</tt> setting controls whether the Fossil admin log is generated. Since we've <a href="#log">already decided</a> that Admin-only users can see this log, it seems fine that the Admin users can choose whether this log gets generated in the first place.</p> <p>There's a small risk that a rogue Admin user could disable the log before doing something evil that the log would capture, so ideally, we'd want to restrict changing this setting from 1 to 0 to Setup only while allowing Admin-only users to change it from 0 to 1. Fossil doesn't currently allow that.</p> * <p><b>Risky</b>: The <tt>https-login</tt> setting falls under the "Security" section above, but it should probably never be adjusted by Admin-only users. Sites that want it on will never want it to be disabled without a very good reason.</p> <p>There is also an inverse risk: if the site has a front-end HTTPS proxy that uses HTTP to communicate over localhost to Fossil, enabling this setting will create an infinite redirect loop! (Ask me how I know.)</p> * <p><b>Dangerous</b>: The <tt>email-send-command</tt> setting could allow a rogue Admin to run arbitrary commands on the host system, unless it's prevented via some kind of host-specific restriction. (chroot, jails, SELinux, VMs, etc.) Since it makes no sense to trust Admin-only users with <tt>root</tt> level access on the host system, we almost certainly don't want to allow them to change such settings.</p> * **SQL**: The Admin → SQL feature allows the Setup user to enter raw SQL queries against the Fossil repository via Fossil UI. This not only allows arbitrary ability to modify the repository blockchain and its backing data tables, it can probably also be used to damage the host such as via `PRAGMA temp_store = FILE`. * **Tickets**: This section allows input of aribtrary TH1 code that runs on the server, affecting the way the Fossil ticketing system works. The justification in the **TH1** section below therefore applies. * **TH1**: The [TH1 language][TH1] is quite restricted relative to the Tcl language it descends from, so this author does not believe there is a way to damage the Fossil repository or its host via the Admin → TH1 feature, which allows execution of arbitrary TH1 code within the repository's execution context. Nevertheless, interpreters are a well-known source of security problems, so it seems best to restrict this feature to Setup-only users as long as we lack a good reason for Admin-only users to have access to it. * **Transfers**: This is for setting up TH1 hooks on various actions, so the justification in the **TH1** section above applies. * **Wiki**: These are mainly cosmetic and usability settings. We might open this up to Admin users in the future. Just remember, [user caps affect Fossil’s web interfaces only][webo]. A user is a Setup user by default on their local clone of a repo, and Fossil’s ability to protect itself against malicious (or even simply incorrect) pushes is limited. Someone with clone and push capability on your repo could clone it, modify their local repo, and then push the changes back to your repo. Be careful who you give that combination of capabilities to! When you run [`fossil ui`][fui], you are the Setup user on that repo through that UI instance, regardless of the capability set defined in the repo’s user table. This is true even if you cloned a remote repo where you do not have Setup caps. This is why `ui` always binds to `localhost` without needing the `--localhost` flag: in this mode, anyone who can connect to that repo’s web UI has full power over that repo. ## <a name="dcap"></a>Dangerous Capabilities Initially Denied to Everyone There are two capabilities that Fossil doesn’t grant by default to Setup or Admin users automatically. They are exceptionally dangerous, so Fossil makes these users grant themselves (or others) these capabilities deliberately, hopefully after careful consideration. ### <a name="y"></a>Write Unversioned Fossil currently doesn’t distinguish the sub-operations of [`fossil uv`](/help?cmd=uv); they’re all covered by [**WrUnver**][capy] (“y”) capability. Since some of these operations are unconditionally destructive due to the nature of unversioned content, and since this goes against Fossil’s philosophy of immutable history, nobody gets cap “y” on a Fossil repo by default, not even the Setup or Admin users. A Setup or Admin user must grant cap “y” to someone — not necessarily themselves! — before modifications to remote unversioned content are possible. Operations on unversioned content made without this capability affect your local clone only. In this way, your local unversioned file table can have different content from that in its parent repo. This state of affairs will continue until your user either gets cap “y” and syncs that content with its parent or you say `fossil uv revert` to make your local unversioned content table match that of its parent repo. ### <a name="x"></a>Private Branch Push For private branches to remain private, they must never be accidentally pushed to a public repository. It can be [difficult to impossible][shun] to recover from such a mistake, so nobody gets [**Private**][capx] (“x”) capability on a Fossil repo by default, not even Admin or Setup users. There are two common uses for private branches. One use is part of a local social contract allowing individual developers to work on some things in private until they’re ready to push them up to the parent repository. This goes against [a core tenet][fdp] of Fossil’s design philosophy, but Fossil allows it, so some development organizations do this. If yours is one of these, you might give cap “x” to the “developer” category. The other use is in development organizations that follow the Fossil philosophy, where you do not work in private unless you absolutely must. You may have a public-facing project — let’s call it “SQLite” for the sake of argument — but then someone comes along and commissions a custom modification to your project which they wish to keep proprietary. You do your work on a private branch, which you absolutely must never push to the public repo, because that would be illegal. (Breach of contract, copyright violation on a work-for-hire agreement, etc.) If you are using Fossil in this way, we recommend that you give “x” capability to a special developer account only, if at all, to minimize the chance of an accidental push. [capa]: ./ref.html#a [caps]: ./ref.html#s [capx]: ./ref.html#x [capy]: ./ref.html#y [fcp]: https://fossil-scm.org/fossil/help?cmd=configuration [fdp]: ../fossil-v-git.wiki#devorg [forum]: https://fossil-scm.org/forum/ [fui]: /help?cmd=ui [lg]: ./login-groups.md [rs]: https://www.fossil-scm.org/index.html/doc/trunk/www/settings.wiki [sia]: https://fossil-scm.org/fossil/artifact?udc=1&ln=1259-1260&name=0fda31b6683c206a [snoy]: https://fossil-scm.org/forum/forumpost/00e1c4ecff [tt]: https://en.wikipedia.org/wiki/Tiger_team#Security |
Added www/caps/impl.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Implementation Details of User Capabilities ## <a name="choices"></a>Capability Letter Choices We [assigned][ref] user capability characters using only lowercase ASCII letters at first, so those are the most important within Fossil: they control the functions most core to Fossil’s operation. Once we used up most of the lowercase letters, we started using uppercase, and then during the development of the [forum feature][for] we assigned most of the decimal numerals. All of the lowercase ASCII letters are now assigned. Eventually, we might have to start using ASCII punctuation and symbols. We expect to run out of reasons to define new caps before we’re forced to switch to Unicode, though the possibilities for [mnemonic][mn] assignments with emoji are intriguing. <span style="vertical-align: bottom">😉</span> The existing caps are usually mnemonic, especially among the earliest and therefore most central assignments, made when we still had lots of letters to choose from. There is still hope for good future mnemonic assignments among the uppercase letters, which are mostly still unused. ## <a name="bitfield"></a>Why Not Bitfields? Some may question the use of ASCII character strings for [capability sets][ucap] instead of bitfields, which are more efficient, both in terms of storage and processing time. Fossil handles these character strings in one of two ways. For most HTTP hits, Fossil [expands][sexp] the string into a [`struct` full of flags][sff] so that later code can just do simple Boolean tests. In a minority of cases, where Fossil only needs to check for the presence of a single flag, it just does a [`strchr()` call][sc] on the string instead. Both methods are slower than bit testing in a bitfield, but keep the execution context in mind: at the front end of an HTTP request handler, where the nanosecond differences in such implementation details are completely swamped by the millisecond scale ping time of that repo’s network connection, followed by the required I/O to satisfy the request. Either method is plenty fast in that context. In exchange for this immeasurable cost per hit, we get human-readable capability sets. ## <a name="filter"></a>Why Doesn’t Fossil Filter “Bad” Artifacts on Sync? Fossil is more trusting about the content it receives from a remote clone during sync than you might expect. Common manifestations of this design choice are: 1. A user may be able to impersonate other users. This can be [accidental](./index.md#defuser) as well as purposeful. 2. If your local system clock is out-of-sync with absolute time, artifacts committed to that repo will appear with the “wrong” time when sync’d. If the time sync error is big enough, it can make check-ins appear to go back in time and other bad effects. 3. You can purposely overwrite good timestamps with bad ones and push those changes up to the remote with no interference, even though Fossil tries to make that a Setup-only operation. All of this falls out of two of Fossil’s design choices: sync is all-or-nothing, and [the Fossil block chain][bc] is immutable. Fossil would have to violate one or both of these principles to filter such problems out of incoming syncs. We have considered auto-[shunning][shun] “bad” content on sync, but this is [difficult][asd] due to [the design of the sync protocol][dsp]. This is not an impossible set of circumstances, but implementing a robust filter on this input path would be roughly as difficult as writing a basic [inter-frame video codec][ifvc]: do-able, but still a lot of work. Patches to do this will be thoughtfully considered. We can’t simply change content as it arrives. Such manipulations would change the artifact manifests, which would change the hashes, which would require rewriting all parts of the block chain from that point out to the tips of those branches. The local Fossil repo must then go through the same process as the remote one on subsequent syncs in order to build up a sync sequence that the remote can understand. Even if you’re willing to accept all of that, this would break all references to the old artifact IDs in forum posts, wiki articles, check-in comments, tickets, etc. The bottom line here is that [**Clone**](./ref.html#g) and [**Write**](./ref.html#i) are a potent combination of user capabilities. Be careful who you give that pair to! ----- *[Back to Administering User Capabilities](./)* <!-- add padding so anchor links always scroll ref’d section to top --> <div style="height: 75em"></div> [asd]: https://fossil-scm.org/forum/forumpost/ce4a3b5f3e [bc]: ../blockchain.md [dsp]: https://fossil-scm.org/fossil/doc/trunk/www/sync.wiki [for]: ./forum.wiki [ifvc]: https://en.wikipedia.org/wiki/Inter_frame [mn]: https://en.wikipedia.org/wiki/Mnemonic [ref]: ./ref.html [sexp]: http://fossil-scm.org/fossil/artifact?udc=1&ln=1223-1298&name=889d6724 [sff]: http://fossil-scm.org/fossil/artifact?udc=1&ln=80-117&name=52d2860f [sc]: https://en.cppreference.com/w/c/string/byte/strchr [shun]: ../shunning.wiki [ucap]: ./index.md#ucap |
Added www/caps/index.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Administering User Capabilities Fossil includes a powerful [role-based access control system][rbac] which affects which users have which capabilities within a given [served][svr] Fossil repository. We call this the capability system, or “caps” for short. Fossil stores a user’s caps as an unordered string of ASCII characters, one capability per, [currently](./impl.md#choices) limited to [alphanumerics][an]. Caps are case-sensitive: “**A**” and “**a**” are different user capabilities. This is a complex topic, so some sub-topics have their own documents: 1. [Login Groups][lg] 2. [Implementation Details](./impl.md) 3. [User Capability Reference](./ref.html) [an]: https://en.wikipediAsa.org/wiki/Alphanumeric [avs]: ./admin-v-setup.md [lg]: ./login-groups.md [rbac]: https://en.wikipedia.org/wiki/Role-based_access_control ## <a name="ucat"></a>User Categories Before we explain individual user capabilities and their proper administration, we want to talk about an oft-overlooked and misunderstood feature of Fossil: user categories. Fossil defines four user categories. Two of these apply based on the user’s login status: **nobody** and **anonymous**. The other two act like Unix or LDAP user groups: **reader** and **developer**. Because we use the word “group” for [another purpose][lg] in Fossil, we will avoid using it that way again in this document. The correct term in Fossil is “category.” Fossil user categories give you a way to define capability sets for four hard-coded situations within the Fossil C source code. Logically speaking: > *(developer* ∨ *reader)* ≥ *anonymous* ≥ *nobody* When a user visits a [served Fossil repository][svr] via its web UI, they initially get the capabilities of the “nobody” user category. This category would be better named “everybody” because it applies whether you’re logged in or not. When a user logs in as “anonymous” via [`/login`](/help?name=/login) they get all of the “nobody” category’s caps plus those assigned to the “anonymous” user category. It would be better named “user” because it affects all logged-in users, not just those logged in via Fossil’s anonymous user feature. When a user with either the “reader” ([**u**][u]) or “developer” ([**v**][v]) capability letter logs in, they get their [individual user caps](#ucap) plus those assigned to this special user category. They also get those assigned to the “anonymous” and “nobody” categories. Because “developer” users do not automatically inherit “reader” caps, it is standard practice to give both letters to your “developer” users: **uv**. You could instead just assign cap **u** to the “developer” category. Fossil shows how these capabilities apply hierarchically in the user editing screen (Admin → Users → name) with the `[N]` `[A]` `[D]` `[R]` tags next to each capability check box. If a user gets a capability from one of the user categories already assigned to it, there is no value in redundantly assigning that same cap to the user explicitly. For example, with the default **dei** cap set for the “developer” category, the cap set **ve** is redundant because **v** grants **dei**, which includes **e**. We suggest that you lean heavily on these fixed user categories when setting up new users. Ideally, your users will group neatly into one of the predefined categories, but if not, you might be able to shoehorn them into our fixed scheme. For example, the administrator of a wiki-only Fossil repo for non-developers could treat the “developer” user category as if it were called “author,” and a forum-only repo could treat the same category as if it were called “member.” There is currently no way to define custom user categories. [svr]: ../server/ ## <a name="ucap"></a>Individual User Capabilities When one or more users need to be different from the basic capabilities defined in user categories, you can assign caps to individual users. You may want to have the [cap reference][ref] open when doing such work. It is useful at this time to expand on the logical expression [above](#cat), which covered only the four fixed user categories. When we bring the individual user capabilities into it, the complete expression of the way Fossil implements user power becomes: > *setup* ≥ *admin* ≥ *moderator* ≥ *(developer* ∨ *reader)* ≥ *[subscriber]* ≥ *anonymous* ≥ *nobody* The two additions at the top are clear: [setup is all-powerful][apsu], and since admin users have [all capabilities][ref] except for Setup capability, they are [subordinate only to the setup user(s)][avsp]. The moderator insertion could go anywhere from where it’s shown now down to above the “anonymous” level, depending on what other caps you give to your moderators. Also, there is not just one type of moderator: Fossil has [wiki][l], [ticket][q], and [forum][5] moderators, each independent of the others. Usually your moderators are fairly high-status users, with developer capabilities or higher, but Fossil does allow the creation of low-status moderators. The placement of “subscriber” in that hierarchy is for the sort of subscriber who has registered an account on the repository purely to [receive email alerts and announcements][7]. Users with additional caps can also be subscribers, but not all users *are* in fact subscribers, which is why we show it in square brackets. (See [Users vs Subscribers](../alerts.md#uvs).) [apsu]: ./admin-v-setup.md#apsu [avsp]: ./admin-v-setup.md#philosophy ## <a name="new"></a>New Repository Defaults Fossil creates one user account in new repos, which is named after your OS user name [by default](#defuser). Fossil gives the initial repository user the [all-powerful Setup capability][apsu]. Users who visit a [served repository][svr] without logging in get the “nobody” user category’s caps which default to **[g][g][j][j][o][o][r][r][z][z]**: clone the repo, read the wiki, check-out files via the web UI, view tickets, and pull version archives. This default is suited to random passers-by on a typical FOSS project’s public web site and its code repository. Users who [prove they are not a bot][bot] by logging in — even if only as “anonymous” — get the “nobody” capability set plus **[h][h][m][m][n][n][c][c]**: see internal hyperlinks, append to existing wiki articles, file new tickets, and comment on existing tickets. We chose these additional capabilities as those we don’t want bots to have, but which a typical small FOSS project would be happy to give anonymous humans visiting the project site. The “reader” user category is typically assigned to users who want to be identified within the repository but who primarily have a passive role in the project. The default capability set on a Fossil repo adds **[k][k][p][p][t][t][w][w]** caps to those granted by “nobody” and “anonymous”. This category is not well-named, because the default caps are all about modifying repository content: edit existing wiki pages, change one’s own password, create new ticket report formats, and modify existing tickets. This category would be better named “participant”. Those in the “developer” category get the “nobody” and “anonymous” cap sets plus **[d][d][e][e][i][i]**: delete wiki articles and tickets, view sensitive user material, and check in changes. [bot]: ../antibot.wiki ## <a name="pvt"></a>Consequences of Taking a Repository Private When you click Admin → Security-Audit → “Take it private,” one of the things it does is set the user capabilities for the “nobody” and “anonymous” user categories to blank, so that users who haven’t logged in can’t even see your project’s home page, and the option to log in as “anonymous” isn’t even offered. Until you log in with a user name, all you see is the repository’s skin and those few UI elements that work without any user capability checks at all, such as the “Login” link. Beware: Fossil does not reassign the capabilities these users had to other users or to the “reader” or “developer” user category! All users except those with Setup capability will lose all capabilities they inherited from “nobody” and “anonymous” categories. Setup is the [lone exception][apsu]. If you will have non-Setup users in your private repo, you should parcel out some subset of the capability set the “nobody” and “anonymous” categories had to other categories or to individual users first. ## <a name="read-v-clone"></a>Reading vs. Cloning Fossil has two capabilities that are often confused: [**Read**](./ref.html#o) and [**Clone**](./ref.html#g). The **Read** capability has nothing to do with reading data from a local repository, because [caps affect Fossil’s web interfaces only](#webonly). Once you’ve cloned a remote repository to your local machine, you can do any reading you want on that repository irrespective of whether your local user within that repo has <b>Read</b> capability. The repo clone is completely under your user’s power at that point, affected only by OS file permissions and such. If you need to prevent that, you want to deny **Clone** capability instead. Withholding the **Read** capability has a different effect: it prevents a web client from viewing [embedded documentation][edoc], using [the file browser](/help?name=/dir), and pulling file content via the [`/artifact`](/help?name=/artifact), [`/file`](/help?name=/file), and [`/raw`](/help?name=/raw) URLs. It is is common to withhold **Read** capability from low-status visitors on private or semi-private repos to prevent them from pulling individual elements of the repo over the web one at a time, as someone may do when denied the bulk **Clone** capability. [edoc]: ../embeddeddoc.wiki ## <a name="defuser"></a>Default User Name By default, Fossil assumes your OS user account name is the same as the one you use in any Fossil repository. It is the [default for a new repository](#new), though you can override this with [the `--admin-user` option][auo]. Fossil has other ways of overriding this in other contexts such as the `name@` syntax in clone URLs. It’s simplest to stick with the default; a mismatch can cause problems. For example, if you clone someone else’s repo anonymously, turn off autosync, and make check-ins to that repository, they will be assigned to your OS user name by default. If you later get a login on the remote repository under a different name and sync your repo with it, your earlier “private” check-ins will get synced to the remote under your OS user name! When such problems occur, you can amend the check-in to hide the incorrect name from Fossil reports, but the original values remain in the repository [forever][shun]. It is [difficult enough][fos] to fix such problems automatically during sync that we are unlikely to ever do so. [auo]: /help?name=new [fos]: ./impl.md#filter [shun]: ../shunning.wiki ## <a name="utclone"></a>Cloning the User Table When cloning over HTTP, the initial user table in the local clone is set to its “[new state:](#new)” only one user with Setup capability, named after either your OS user account, per the default above, or after the user given in the clone URL. There is one exception: if you clone as a named Setup user, you get a complete copy of the user information. This restriction keeps the user table private except for the only user allowed to make absolutely complete clones of a remote repo, such as for failover or backup purposes. Every other user’s clone is missing this and a few other items, either for information security or PII privacy reasons. When cloning with file system paths, `file://` URLs, or over SSH, you get a complete clone, including the parent repo’s complete user table. All of the above applies to [login groups][lg] as well. ## <a name="webonly"></a>Caps Affect Web Interfaces Only User caps only affect Fossil’s [UI pages][wp], remote operations over `http[s]://` URLs, and [the JSON API][japi]. User caps *do not* affect operations done on a local repo opened via a `file://` URL or a file system path. This should strike you as sensible: only local file permissions matter when operating on a local SQLite DB file. The same is true when working on a clone done over such a path, except that there are then two sets of file system permission checks: once to modify the working check-out’s repo clone DB file, then again on [sync][sync] with the parent DB file. The Fossil capability checks are effectively defeated because your user has [**Setup**][s] capability on both sides of the sync. What may surprise you is that user caps *also do not affect SSH!* When you make a change to such a repository, the change first goes to the local clone, where file system permissions are all that matter, but then upon sync, the situation is effectively the same as when the parent repo is on the local file system. If you can log into the remote system over SSH and that user has the necessary file system permissions on that remote repo DB file, it is the same situation as for `file://` URLs. All Fossil syncs are done over HTTP, even for `file://` and `ssh://` URLs: * For `ssh://` URLs, Fossil pipes the HTTP conversation through a local SSH client to a remote instance of Fossil running the [`test-http`](/help?name=test-http) command to recieve the tunneled HTTP connection without cap checks. The SSH client defaults to “`ssh -e none -T`” on most platforms, except on Windows where it defaults to “`plink -ssh -T`”. You can override this with [the `ssh-command` setting](/help?name=ssh-command). * For `file://` URLs, the “sending” Fossil instance writes its side of the HTTP conversation out to a temporary file in the same directory as the local repo clone and then calls itself on the “receiving” repository to read that same HTTP transcript file back in to apply those changes to that repository. Presumably Fossil doesn’t do this with a pipe to ease portability to Windows. Because both mechanisms work on local repos, the checks for capabilities like [**Read**][o] and [**Write**][i] within the HTTP conversation for such URLs can never return “false,” because you are the [**Setup**][s] user on both sides of the conversation. Such checks only have a useful effect when done over an `http[s]://` URL. ## <a name="pubpg"></a>Public Pages In Admin → Access, there is an option for giving a list of [globs][glob] to name URLs which get treated as if the visitor had [the default cap set](#defcap). For example, you could take the [**Read**][o] capability away from the “nobody” user category, who has it by default, to prevent users without logins from pulling down your repository contents one artifact at a time, yet give those users the ability to read the project documentation by setting the glob to match your [embedded documentation][edoc]’s URL root. ## <a name="defcap"></a>Default User Capability Set In Admin → Access, you can define a default user capability set, which is used as: 1. the default caps for users newly created by an Admin or Setup user 2. the default caps for self-registered users, an option in that same UI 3. the effective caps for URIs considered [public pages](#pubpg) This defaults to [**Reader**][u]. <!-- add padding so anchor links always scroll ref’d section to top --> <div style="height: 75em"></div> [ref]: ./ref.html [a]: ./ref.html#a [b]: ./ref.html#b [c]: ./ref.html#c [d]: ./ref.html#d [e]: ./ref.html#e [f]: ./ref.html#f [g]: ./ref.html#g [h]: ./ref.html#h [i]: ./ref.html#i [j]: ./ref.html#j [k]: ./ref.html#k [l]: ./ref.html#l [m]: ./ref.html#m [n]: ./ref.html#n [o]: ./ref.html#o [p]: ./ref.html#p [q]: ./ref.html#q [r]: ./ref.html#r [s]: ./ref.html#s [t]: ./ref.html#t [u]: ./ref.html#u [v]: ./ref.html#v [w]: ./ref.html#w [x]: ./ref.html#x [y]: ./ref.html#y [z]: ./ref.html#z [2]: ./ref.html#2 [3]: ./ref.html#3 [4]: ./ref.html#4 [5]: ./ref.html#5 [6]: ./ref.html#6 [7]: ./ref.html#7 [glob]: https://en.wikipedia.org/wiki/Glob_(programming) [japi]: https://docs.google.com/document/d/1fXViveNhDbiXgCuE7QDXQOKeFzf2qNUkBEgiUvoqFN4/view#heading=h.6k0k5plm18p1 [sp]: ../sync.wiki [sync]: /help?name=sync [wp]: /help#webpages |
Added www/caps/login-groups.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Login Groups The Admin → Login-Groups UI feature and its corresponding [`login-group` command][lg] solve a common problem with Fossil: you’ve created multiple repositories that some set of users all need access to, those users all have the same access level on all of these shared repositories, and you don’t want to redundantly configure the user set for each repository. This feature ties changes to the “`user`” table in one repo to that in one or more other repos. With this configured, you get a new choice on the user edit screen, offering to make changes specific to the one repository only or to apply it to all others in the login group as well. A user can log into one repo in a login group only if that user has an entry in that repo’s user table. That is, setting up a login group doesn’t automatically transfer all user accounts from the joined repo to the joining repo. Only when a user exists by name in both repos will that user be able to share credentials across the repos. Login groups can have names, allowing one “master” repo to host multiple subsets of its users to other repos. Trust in login groups is transitive within a single server. If repo C joined repo B and repo B joined A, changes in C’s user table affect both A and B, if you tell Fossil that the change applies to all repos in the login group. [lg]: /help?cmd=login-group ----- *[Back to Administering User Capabilities](./)* |
Added www/caps/ref.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 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 | <div class='fossil-doc' data-title="User Capability Reference"> <style type="text/css"> p#backlink { /* Make empty space below the table so hyperlinks to named anchors near the bottom of the table still scroll that row to the top of the user's browser, even on tall screens. */ margin-bottom: 75em; } tr > th { background-color: #e8e8e8; vertical-align: top; } tr.cols th { white-space: nowrap; } td, th { padding: 0.4em; } </style> <p>Here we document each currently-defined user capability character in more detail than the brief summary on the <a href="/setup_ucap_list">“key” page</a> in the Fossil user editor. Each row gives the capability letter used in the Fossil user editor followed by the C code’s name for that cap within the <tt>FossilUserPerms</tt> object, so you can use this reference both from the UI down and from the C code up.</p> <p>The <a href="https://en.wikipedia.org/wiki/Mnemonic">mnemonics</a> given here vary from obviously-correct to <i>post facto</i> rationalizations to the outright fanciful. To <a href="./impl.md#choices">some extent</a>, this is unavoidable.</p> <h2>Reference</h2> <table> <tr class="cols"> <th>?</th> <th>Name</th> <th style="text-align: left">Description</th> </tr> <tr id="a"> <th>a</th> <th>Admin</th> <td> Admin users have <em>all</em> of the capabilities below except for <a href="#s">setup</a>, <a herf="#x">Private</a>, and <a href="#y">WrUnver</a>. See <a href="admin-v-setup.md">Admin vs. Setup</a> for a more nuanced discussion. Mnemonic: <b>a</b>dministrate. </td> </tr> <tr id="b"> <th>b</th> <th>Attach</th> <td> Add attachments to wiki articles or tickets. Mnemonics: <b>b</b>ind, <b>b</b>utton, <b>b</b>ond, or <b>b</b>olt. </td> </tr> <tr id="c"> <th>c</th> <th>ApndTkt</th> <td> Append comments to existing tickets. Mnemonic: <b>c</b>omment. </td> </tr> <tr id="d"> <th>d</th> <th>Delete</th> <td> Delete wiki articles or tickets. Mnemonic: <b>d</b>elete. </td> </tr> <tr id="e"> <th>e</th> <th>RdAddr</th> <td> View <a href="https://en.wikipedia.org/wiki/Personal_data">personal identifying information</a> (PII) about other users such as email addresses. Mnemonics: show <b>e</b>mail addresses; or <b>E</b>urope, home of <a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>. </td> </tr> <tr id="f"> <th>f</th> <th>NewWiki</th> <td> Create new wiki articles. Mnemonic: <b>f</b>ast, English translation of the Hawaiian word <a href="https://en.wikipedia.org/wiki/History_of_wikis#WikiWikiWeb,_the_first_wiki"><i>wiki</i></a>. </td> </tr> <tr id="g"> <th>g</th> <th>Clone</th> <td> Clone the repository. Note that this is distinct from <a href="#o">check-out capability, <b>o</b></a>. Mnemonic: <b>g</b>et. </td> </tr> <tr id="h"> <th>h</th> <th>Hyperlink</th> <td> Get hyperlinks in generated HTML which link you to other parts of the repository. This capability exists so we can deny it to the “nobody” category, to <a href="../antibot.wiki">prevent bots from wandering around aimlessly</a> in the site’s hyperlink web, <a href="../loadmgmt.md">chewing up server resources</a> to little good purpose. Mnemonic: <b>h</b>yperlink. </td> </tr> <tr id="i"> <th>i</th> <th>Write</th> <td> Check changes into the repository. Note that a lack of this capability does not prevent you from checking changes into your local clone, only from syncing those changes up to the parent repo, and then <a href="./basics.md#webonly">only over HTTP</a>. Granting this capability also grants <b>o (Read)</b> Mnemonics: <b>i</b>nput, check <b>i</b>n changes. </td> </tr> <tr id="j"> <th>j</th> <th>RdWiki</th> <td> View wiki articles. Mnemonic: in<b>j</b>est page content. (All right, you critics, you do better, then.) </td> </tr> <tr id="k"> <th>k</th> <th>WrWiki</th> <td> Edit wiki articles. Granting this capability also grants <a href="#j"><b>RdWiki</b></a> and <a href="#m"><b>ApndWiki</b></a>, but it does <em>not</em> grant <a href="#f"><b>NewWiki</b></a>! Mnemonic: <b>k</b>ontribute. </td> </tr> <tr id="l"> <th>l</th> <th>ModWiki</th> <td> Moderate <a href="#m">wiki article appends</a>. Appends do not get saved permanently to the receiving repo’s block chain until <a href="#s">Setup</a> or someone with this cap approves it. Mnemonic: a<b>l</b>low. </td> </tr> <tr id="m"> <th>m</th> <th>ApndWiki</th> <td> Append content to existing wiki articles. Mnemonic: a<b>m</b>end wiki </td> </tr> <tr id="n"> <th>n</th> <th>NewTkt</th> <td> File new tickets. Mnemonic: <b>n</b>ew ticket. </td> </tr> <tr id="o"> <th>o</th> <th>Read</th> <td> Read repository content from a remote Fossil instance over HTTP. See <a href="index.md#read-v-clone">Reading vs. Cloning</a>. Mnemonic: check <b>o</b>ut remote repo contents. </td> </tr> <tr id="p"> <th>p</th> <th>Password</th> <td> Change one’s own password. Mnemonic: <b>p</b>assword. </td> </tr> <tr id="q"> <th>q</th> <th>ModTkt</th> <td> Moderate tickets: delete comments appended to tickets. Mnemonic: <b>q</b>uash noise commentary. </td> </tr> <tr id="r"> <th>r</th> <th>RdTkt</th> <td> View existing tickets. Mnemonic: <b>r</b>ead tickets. </td> </tr> <tr id="s"> <th>s</th> <th>Setup</th> <td> The <a href="./admin-v-setup.md#apsu">all-powerful Setup user</a>. Mnemonics: <b>s</b>etup or <b>s</b>uperuser. </td> </tr> <tr id="t"> <th>t</th> <th>TktFmt</th> <td> Create new ticket report formats. Note that although this allows the user to provide SQL code to be run in the server’s context, and this capability is given to the untrusted “anonymous” user category by default, this is a safe capability to give to users because it is internally restricted to read-only queries on the tickets table only. (This restriction is done with a SQLite authorization hook, not by any method so weak as SQL text filtering.) Mnemonic: new <b>t</b>icket report. </td> </tr> <tr id="u"> <th>u</th> <th>n/a</th> <td> Inherit all capabilities of the “reader” user category; does not have a dedicated flag internally within Fossil. Mnemonic: <a href="./index.md#ucat"><b>u</b>ser</a> </td> </tr> <tr id="v"> <th>v</th> <th>n/a</th> <td> Inherit all capabilities of the “developer” user category; does not have a dedicated flag internally within Fossil. Mnemonic: de<b>v</b>eloper. </td> </tr> <tr id="w"> <th>w</th> <th>WrTkt</th> <td> Edit existing tickets. Granting this capability also grants <a href="#r"><b>RdTkt</b></a>, <a href="#c"><b>ApndTkt</b></a>, and <a href="#n"><b>NewTkt</b></a>. Mnemonic: <b>w</b>rite to ticket. </td> </tr> <tr id="x"> <th>x</th> <th>Private</th> <td> Push or pull <a href="../private.wiki">private branches</a>. Mnemonic: e<b>x</b>clusivity; “x” connotes unknown material in many Western languages due to its <a href="https://en.wikipedia.org/wiki/La_Géométrie#The_text">traditional use in mathematics</a>. </td> </tr> <tr id="y"> <th>y</th> <th>WrUnver</th> <td> Push <a href="../unvers.wiki">unversioned content</a>. Mnemonic: <b>y</b>ield, <a href="https://en.wiktionary.org/wiki/yield">sense 4</a>: “hand over.” </td> </tr> <tr id="z"> <th>z</th> <th>Zip</th> <td> Pull archives of particular repository versions via <a href="/help?cmd=/zip"><tt>/zip</tt></a>, <a href="/help?cmd=/tarball"><tt>/tarball</tt></a>, and <a href="/help?cmd=/sqlar"><tt>/sqlar</tt></a> URLs. This is an expensive capability to grant, because creating such archives can put a large load on <a href="../server/">a Fossil server</a> which you may then need to <a href="../loadmgmt.md">manage</a>. Mnemonic: <b>z</b>ip file download. </td> </tr> <tr id="2"> <th>2</th> <th>RdForum</th> <td> Read <a href="../forum.wiki">forum posts</a> by other users. Mnemonic: from thee <b>2</b> me. </td> </tr> <tr id="3"> <th>3</th> <th>WrForum</th> <td> Create new forum threads, reply to threads created by others, and edit one’s own posts. New posts are <a href="../forum.wiki#moderation">held for moderation</a> and do not appear in repo clones or syncs. Granting this capability also grants <a href="#2"><b>RdForum</b></a>. Mnemonic: post for <b>3</b> audiences: me, <a href="#5">the mods</a>, and <a href="https://en.wikipedia.org/wiki/The_Man">the Man</a>. </td> </tr> <tr id="4"> <th>4</th> <th>WrTForum</th> <td> Extends <a href="#3"><b>WrForum</b></a>, bypassing the moderation and sync restrictions. Mnemonic: post <b>4</b> immediate release. </td> </tr> <tr id="5"> <th>5</th> <th>ModForum</th> <td> <a href="../forum.wiki#moderation">Moderate forum posts</a>. Granting this capability also grants <a href="#4"><b>WrTForum</b></a> and <a href="#2"><b>RdForum</b></a>, so a user with this cap never has to moderate their own posts. Mnemonic: “May I have <b>5</b> seconds of your time, honored Gatekeeper?” </td> </tr> <tr id="6"> <th>6</th> <th>AdminForum</th> <td> Users with this capability see a checkbox on unmoderated forum posts labeled “Trust user X so that future posts by user X do not require moderation.” Checking that box and then clicking the moderator-only “Approve” button on that post grants <a href="#4"><b>WrTForum</b></a> capability to that post’s author. There is currently no UI for a user with this cap to <em>revoke</em> trust from a user once it is granted; only <a href="#a"><b>Admin</b></a> and <a href="#s"><b>Setup</b></a> can currently revoke granted caps. Granting this capability also grants <a href="#5"><b>ModForum</b></a> and those it in turn grants. Mnemonic: “I’m <b>6</b> [sick] of hitting Approve on your posts!” </td> </tr> <tr id="7"> <th>7</th> <th>EmailAlert</th> <td> User can sign up for <a href="../alerts.md">email alerts</a>. Mnemonic: <a href="https://en.wikipedia.org/wiki/Heaven_Can_Wait">Seven can wait</a>, I’ve got email to read now. </td> </tr> <tr id="A"> <th>A</th> <th>Announce</th> <td> Send email announcements to users <a href="#7">signed up to receive them</a>. Mnemonic: <b>a</b>nnounce. </td> </tr> <tr id="D"> <th>D</th> <th>Debug</th> <td> Enable debugging features. Mnemonic: <b>d</b>ebug. </td> </tr> </table> <hr/> <p id="backlink"><a href="./"><em>Back to Administering User Capabilities</em></a></p> |
Added www/cgi.wiki.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <title>CGI Script Configuration Options</title> <h1>Summary</h1> It is not necessary to have a central server in order to use Fossil. But a central server can help a project run more smoothly by giving developers a common point of rendezvous for syncing, and by providing a web-based portal where developers and non-developers alike can learn about the project and its current state. Setting up a server using Fossil is easy. A [./server/|separate document] talks about all of the many different methods for setting up a Fossil server, one of which is [./server/any/cgi.md | as a CGI script]. CGI is the technique that the three [./selfhost.wiki|self-hosting Fossil repositories] all use. Setting up a Fossil server using CGI is mostly about writing a short script (usually just 2 lines line) in the cgi-bin folder of an ordinary web-browser. But there are a lot of extra options that can be added to this script, to customize the configuration. This article descripts those options. <h1>CGI Script Options</h1> The CGI script used to launch a Fossil server will usually look something like this: <blockquote><verbatim> #!/usr/bin/fossil repository: /home/www/fossils/myproject.fossil </verbatim></blockquote> Of course, pathnames will likely be different. The first line (the "shebang") always gives the name of the Fossil executable. Subsequent lines are of the form "<b>property: argument ...</b>". The remainder of this document describes the available properties and their arguments. <hr> <h2 id="repository">repository: <i>PATH</i></h2> This property defines the Fossil repository that the server will use. Every Fossil CGI requires either this property or the [#directory|<b>directory:</b>] property (but not both). Many Fossil repository sets have this one property and no other. <h2 id="directory">directory: <i>PATH</i></h2> The PATH is the name of a directory that contains one or more Fossil repository files having the suffix ".fossil". If this property is used instead of [#repository|<b>repository:</b>], then the Fossil server is able to serve all of the repositories in the directory. The specific repository used is selected by a prefix on the PATH_INFO. <h2 id="errorlog">errorlog: <i>FILENAME</i></h2> This setting causes the server to log any errors in FILENAME. It is ok for multiple Fossil CGIs to share the same error log. Setting up an error log for Fossil servers is not required, but it is recommended. <h2 id="notfound">notfound: <i>URL</i></h2> If the [#directory|<b>directory:</b>] option is used and if the PATH_INFO of the HTTP request does not correspond to any Fossil repository, then the request redirects to URL. <h2 id="repolist">repolist</h2> This is a Boolean property. If it is present, and if the [#directory:|<b>directory:</b>] option is used, and if the PATH_INFO string is empty, then Fossil will show a list of available Fossil repositories. The "skin" of the reply is determined by the first repository in the list that has a non-zero [/help?cmd=repolist-skin|repolist-skin] setting. If no repository has such a non-zero repolist-skin setting, then the repository list is generic HTML without any decoration. <h2 id="extroot">extroot: <i>PATH</i></h2> This property defines the DOCUMENT_ROOT for the [./serverext.wiki|CGI Server Extensions]. If this property is present, then CGI Server Extensions are enabled. When this property is omitted, CGI Server Extensions are disabled. A cascade of CGI invocations can occur here. Fossil itself is started as CGI, then Fossil can turn around and invoke a sub-CGI extension. The sub-CGI extension outputs reply text, when Fossil then (optionally) augments with its own header and footer and returns to the original requestor. The property controls the DOCUMENT_ROOT of the sub-CGI. <h2 id="timeout">timeout: <i>N</i></h2> This property changes the timeout on each CGI request to N seconds. If N is zero, then there is no timeout. If this property is omitted, then the default timeout is 300 seconds (5 minutes). <h2 id="localauth">localauth</h2> This is a Boolean property. If it is present, [./caps/ref.html#s | setup capability] is granted to any HTTP request that comes in over a loopback interface, such as 127.0.0.1. If the PATH_INFO string is empty, Fossil will show a list of available Fossil repositories. <h2 id="skin">skin: <i>NAME</i></h2> If NAME is the name of one of the built-in skins supported by Fossil, then this option causes Fossil to display using that built-in skin, and to ignore any custom skin that might be configured in the repository itself. So, if you wanted to set up a server for a single Fossil project, but also give users the option to use several of the different built-in skins, you could create multiple CGI scripts, each with a different "<b>skin:</b>" property, but all pointing to the same <b>repository:</b>. Then users can select which skin to use by using the appropriate CGI. <h2 id="files">files: </i>GLOBLIST</i></h2> The GLOBLIST argument is a comma-separate list of "globs" that specify filenames. In [#directory|<b>directory:</b> mode], if the PATH_INFO does not identify any Fossil repository, but it does refer some other file in the directory, and that filename matches one of the glob patterns in the GLOBLIST, then the file is returned as static content. <h2 id="setenv">setenv: <i>NAME VALUE</i></h2> This parameter causes additional environment variable NAME to have VALUE. This parameter can be repeated as many times as necessary. <h2 id="HOME">HOME: <i>PATH</i></h2> This parameter is a short-hand for "<b>setenv HOME <i>PATH</i></b>". <h2 id="cgi-debug">cgi-debug: <i>FILE</i></h2> Cause CGI-related debugging information to be appended in <i>FILE</i>. Use this to help debug CGI problems. |
Changes to www/changes.wiki.
1 2 3 | <title>Change Log</title> <a name='v2_7'></a> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > > | > | < > > > > > > | 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 | <title>Change Log</title> <a name='v2_11'></a> <h2>Changes for Version 2.11 (pending)</h2> * Support Markdown in the default ticket configuration. * Rework the "[/help?cmd=grep|fossil grep]" command to be more useful. * Expose the [/help?cmd=redirect-to-https|redirect-to-https] setting to the [/help?cmd=settings|settings] command. * Improve support for CGI on IIS web servers. * The [/help?cmd=/ext|/ext page] can now render index files, analog to how the embedded docs do. * Most commands now support the Unix-conventional "<tt>--</tt>" flag to treat all following arguments as filenames instead of flags. * Several minor enhancements to existing features. <a name='v2_10'></a> <h2>Changes for Version 2.10 (2019-10-04)</h2> * Added support for [./serverext.wiki|CGI-based Server Extensions]. * Added the [/help?cmd=repolist-skin|repolist-skin] setting used to add style to repository list pages. * Enhance the hierarchical display of Forum threads to do less indentation and to provide links back to the previous message in the thread. Provide sequential numbers for all messages in a forum thread. * Add support for fenced code blocks and improved hyperlink processing to the [/md_rules|markdown formatter]. * Add support for hyperlinks to wiki pages in the [/md_rules|markdown formatter]. * Enhance the [/help?cmd=/stat|/stat] page so that it gives the option to show a breakdown of forum posts. * The special check-in name "merge-in:BRANCH" means the source of the most recent merge-in from the parent branch of BRANCH. * Add hyperlinks to branch-diffs on the /info page and from timelines of a branch. * Add graphical context on the [/help?cmd=/vdiff|/vdiff] page. * Uppercase query parameters, POST parameters, and cookie names are converted to all lowercase and entered into the parameter set, instead of being discarded. * Change the default [./hashpolicy.wiki|hash policy] to SHA3. * Timeout [./server/any/cgi.md|CGI requests] after 300 seconds, or some other value set by the [./cgi.wiki#timeout|"timeout:" property] in the CGI script. * The check-in lock interval is reduced from 24 hours to 60 seconds, though the interval is now configurable using a setting. An additional check for conflicts is added after interactive check-in comment entry, to compensate for the reduced lock interval. * Performance optimizations. * Many documentation improvements. <a name='v2_9'></a> <h2>Changes for Version 2.9 (2019-07-13)</h2> * Added the [/help?cmd=git|fossil git export] command and instructions for [./mirrortogithub.md|creating a GitHub mirror of a Fossil project]. * Improved handling of relative hyperlinks on the [/help?cmd=/artifact|/artifact] pages for wiki. For example, hyperlinks and the lizard <img> now work correctly for both [/artifact/2ff24ab0887cf522] and [/doc/0d7ac90d575004c2415/www/index.wiki]. * Enhancements to the timeline graph layout, to show more information with less clutter. * Added tool-tips to the /timeline graph. On by default but can be disabled by setting the "Tooltip dwell time" to 0 in the timeline configuration. * Copy buttons added to various check-in hash and branch name links. * Double-clicking on a /timeline graph node now jumps to the /info page for the check-in. So, repurpose the timestamp hyperlink to show all activity around that check-in in time. * Added the [/help?cmd=touch|fossil touch] command, and the --setmtime option on the [/help?cmd=open|fossil open] and [/help?cmd=update|fossil update] commands. * Many documentation enhancements. * For the "[/help?cmd=update|fossil update]" and "[/help?cmd=checkout|fossil checkout]" commands, if a managed file is removed because it is no longer part of the target check-in and the directory containing the file is empty after the file is removed and the directory is not the current working directory and is not on the [/help?cmd=empty-dirs|empty-dirs] list, then also remove the directory. * Update internal Unicode character tables, used in regular expression handling, from version 11.0 to 12.1. * In "[/help?cmd=regexp|fossil regexp]", "[/help?cmd=grep|fossil grep]" and the TH1 "regexp" command, the -nocase option now removes multiple diacritics from the same character (derived from SQLite's remove_diacritics=2) * Added the [/help?cmd=/secureraw|/secureraw] page that requires the complete SHA1 or SHA3 hash, not just a prefix, before it will deliver content. * Accept purely numeric ISO8601 date/time strings as long as they do not conflict with a hash. Example: "20190510134217" instead of "2019-05-10 13:42:17". This helps keep URLs shorter and less complicated * Support both "1)" and "1." for numbered lists in markdown, as commonmark does. * The sync and clone HTTP requests omit the extra /xfer path element from the end of the request URI. All servers since 2010 know that the HTTP request is for a sync or clone from the mimetype so the extra path element is not needed. * If an automatic sync gets a permanent redirect request, then update the saved remote URL to the new address. * Temporary filenames (for example used for external "diff" commands) try to preserve the suffix of the original file. * Added the [/help?cmd=/thisdayinhistory|/thisdayinhistory] web page. * Enhanced parsing of [/help?cmd=/timeline|/timeline] query parameters "ymd=", "ym=", and "yw=". All arguments are option (in which case they default to the current time) and all accept ISO8601 date/times without punctuation. * Automatically disapprove pending moderation requests for a user when that user is deleted. This helps in dealing with spam-bots. * Improvements to the "Capability Summary" section in the [/help?cmd=/secaudit0|Security Audit] web-page. * Use new "ci-lock" and "ci-lock-failed" pragmas in the [./sync.wiki|sync protocol] to try to prevent accident forks caused by concurrent commits when operating in auto-sync mode. * Fix a bug ([https://www.fossil-scm.org/forum/forumpost/c51b9a1169|details]) that can cause repository databases to be overwritten with debugging output, thus corrupting the repository. This is only a factor when CGI debugging is enabled, and even then is a rare occurrence, but it is obviously an important fix. <a name='v2_8'></a> <h2>Changes for Version 2.8 (2019-02-20)</h2> * Show cherry-pick merges as dotted lines on the timeline graph. → The "fossil rebuild" command must be run to create and populate the new "cherrypick" table in the repository in order for this feature to operate. * Add the ability to associate branches, check-ins, and tags with specially-named Wiki pages. This gives the ability to better document branches and tags, and provide more documentation on check-ins beyond the check-in comment. The associated Wiki is automatically displayed on /info pages for check-ins, and on /timeline?r=BRANCH and /timeline?t=TAG pages for branches and tags. This feature is on by default, but can be disabled in on the Admin/Wiki page. * Enhance the repository list page (shown for example by "fossil all ui") so that it shows the name and last check-in time for each project. The implementation of the repository list page is now broken out into a separate source file (repolist.c). * Allow users with Forum Supervisor permission ('6') to add Forum Write Trusted permission ('4') to users as they are approving a forum post by that user. * When running a bisect, report the number of check-ins still in the search range and the estimated number of bisect steps remaining. Do this at each step of the bisect. * Provide a permanent link to a bisect timeline using the bid= query parameter. * Make the chronological forum display feature available to all users, and make it the default format on mobile devices. * Break out Wiki setup into a separate /setup_wiki page, accessible on the standard menus through Admin/Wiki. * Add "Next" and "Previous" buttons on the /wdiff page, allowing the user to step through the versions of a wiki page. * Improve the display of the /whistory page. * Omit the "HH:MM" timestamps on timeline graphs on narrow-screen devices, to improve horizontal space uses. This helps make Fossil more mobile-friendly. * Enhance /wcontent to show a sortable list of Wiki pages together with the number of revisions and the most recent change time for each page. * Hyperlinks to Wiki pages on the /timeline go to the specific version of the Wiki page named in the timeline, not to the latest version. * Enhancements to the "amend", "tag", and "reparent" commands, including adding options --override-date, --override-user, and --dry-run. * Add the global --comment-format command-line option and the comment-format setting to control the display of the command-line timeline. * Change the "fossil reparent" command so that it only works from within an active checkout. * On the /setup_ucap_list, show administrators how many users have each capability. The counts are a hyperlink to the /setup_ulist page showing the subset of users that have that capability. * Provide the ability to redirect all HTTP pages to HTTPS. Formerly one could cause this to occur for the /login page only. That option still exists, but the redirect can now also be done for all pages. * "Compress" the built-in javascript by omitting comments and leading and trailing whitespace. * Detect when the repository used by a checkout is swapped out for a clone that uses different RID values, and make appropriate adjustments to the checkout database to avoid any problems. * Add the backoffice-disable setting to completely disable the backoffice feature. * Update the built-in SQLite to version 3.27.1. * Various other small enhancements to webpages and documentation. <a name='v2_7'></a> <h2>Changes for Version 2.7 (2018-09-22)</h2> * Add the [./alerts.md|email alerts] feature for commits, ticket changes, wiki changes, forum posts, and announcements. This is still a work in progress. It is functional, but it is not as easy to setup and use as it ought to be. * Add the [./forum.wiki|discussion forum] feature. * Add new user capabilities letters needed to support alerts and forum. Formerly, user capabilities were letters from [a-z], but with the enhancements, the supply of lower case letters was exhausted. User capabilities are now letters in [a-zA-Z0-9]. * The built-in skins are now responsive, providing better layout on small screens, including mobile devices. * The default skin now includes a hamburger menu that is generated by the [/sitemap] page. * All of the built-in skins now use a [https://en.wikipedia.org/wiki/Content_Security_Policy|Content Security Policy (CSP)] to help prevent cross-site injection and forgery attacks. There are no known vulnerabilities in Fossil. The added CSP does not fix anything; it merely adds another layer of defense. * The [/sitemap] and other list pages show as multiple columns if the viewing window is wide enough. * There is an optional "js" file for each skin that can be used to hold javascript. This file can be loaded by reference or can be included in the header or footer. * Add the [./backoffice.md|backoffice]. * Update internal Unicode character tables, used in regular expression handling, from version 10.0 to 11.0. * Improvements to the "Security Audit" administration page * Add the [/help?cmd=branch|fossil branch current] command. * Add the [./grep.md|grep] command. * Update the built-in SQLite to version 3.25.1. * Some code and interfaces are in place to support sending and receiving email directly via SMTP, but this feature is not yet complete or ready for production use. * The `mv-rm-files` setting is now compiled into Fossil in the default Fossil configuration; no longer must you say <tt>./configure --with-legacy-mv-rm</tt> to make it available. The setting remains disabled by default, however, so you must still say <tt>fossil set mv-rm-files 1</tt> to enable it on each repository where you want hard <tt>mv/rm</tt> behavior. <a name='v2_6'></a> <h2>Changes for Version 2.6 (2018-05-04)</h2> * Fix a bug that was causing crashes while trying to clone the TCL repository. This fix is the main reason for the current release. * Added the new "Classic" timeline viewing mode. "Classic" is the |
︙ | ︙ |
Changes to www/checkin_names.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <title>Check-in Names</title> <table align="right" border="1" width="33%" cellpadding="10"> <tr><td> <h3>Executive Summary</h3> <p>A check-in can be identified using any of the following names: <ul> <li> Cryptographic hash prefix <li> Tag or branchname <li> Timestamp: <i>YYYY-MM-DD HH:MM:SS</i> <li> <i>tag-name</i> <big><b>:</b></big> <i>timestamp</i> <li> <b>root :</b> <i>branchname</i> <li> Special names: <ul> <li> <b>tip</b> <li> <b>current</b> <li> <b>next</b> <li> <b>previous</b> or <b>prev</b> <li> <b>ckout</b> for embedded docs | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <title>Check-in Names</title> <table align="right" border="1" width="33%" cellpadding="10"> <tr><td> <h3>Executive Summary</h3> <p>A check-in can be identified using any of the following names: <ul> <li> Cryptographic hash prefix <li> Tag or branchname <li> Timestamp: <i>YYYY-MM-DD HH:MM:SS</i> <li> <i>tag-name</i> <big><b>:</b></big> <i>timestamp</i> <li> <b>root :</b> <i>branchname</i> <li> <b>merge-in :</b> <i>branchname</i> <li> Special names: <ul> <li> <b>tip</b> <li> <b>current</b> <li> <b>next</b> <li> <b>previous</b> or <b>prev</b> <li> <b>ckout</b> for embedded docs |
︙ | ︙ | |||
140 141 142 143 144 145 146 | Again, this behavior only occurs on a few commands where it make sense. <h2>Timestamps</h2> A timestamp in one of the formats shown below means the most recent check-in that occurs no later than the timestamp given: | | | | | > > > > | | > > | 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 | Again, this behavior only occurs on a few commands where it make sense. <h2>Timestamps</h2> A timestamp in one of the formats shown below means the most recent check-in that occurs no later than the timestamp given: 1. <i>YYYY-MM-DD</i> 2. <i>YYYY-MM-DD HH:MM</i> 3. <i>YYYY-MM-DD HH:MM:SS</i> 4. <i>YYYY-MM-DD HH:MM:SS.SSS</i> 5. <i>YYYYMMDD</i> 6. <i>YYYYMMDDHHMM</i> 7. <i>YYYYMMDDHHMMSS</i> In the second through the fourth forms, the space between the day and the year can optionally be replaced by an uppercase <b>T</b> and the entire timestamp can optionally be followed by "<b>z</b>" or "<b>Z</b>". In the fourth form with fractional seconds, any number of digits may follow the decimal point, though due to precision limits only the first three digits will be significant. The final three pure-digit forms without punctuation are only valid if the number they encode is not also the prefix of an artifact hash. In its default configuration, Fossil interprets and displays all dates in Universal Coordinated Time (UTC). This tends to work the best for distributed projects where participants are scattered around the globe. But there is an option on the Admin/Timeline page of the web-interface to switch to local time. The "<b>Z</b>" suffix on a timestamp check-in name is meaningless if Fossil is in the default mode of using UTC for |
︙ | ︙ | |||
203 204 205 206 207 208 209 210 211 212 213 214 215 216 | Such a label is useful, for example, in computing all diffs for a single branch. The following example will show all changes in the hypothetical branch "xyzzy": <blockquote> fossil diff --from root:xyzzy --to xyzzy </blockquote> <h2>Special Tags</h2> The tag "tip" means the most recent check-in. The "tip" tag is roughly equivalent to the timestamp tag "5000-01-01". | > > > > > > | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | Such a label is useful, for example, in computing all diffs for a single branch. The following example will show all changes in the hypothetical branch "xyzzy": <blockquote> fossil diff --from root:xyzzy --to xyzzy </blockquote> A branch name that begins with the "<tt>merge-in:</tt>" prefix refers not to the root of the branch, but to the most recent merge-in for that branch from its parent. The most recent merge-in is the version to diff the branch against in order to see all changes in just the branch itself, omitting any changes that have already been merged in from the parent branch. <h2>Special Tags</h2> The tag "tip" means the most recent check-in. The "tip" tag is roughly equivalent to the timestamp tag "5000-01-01". |
︙ | ︙ |
Added www/chroot.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # The Server Chroot Jail If you run Fossil as root in any mode that [serves data on the network][srv], and you're running it on Unix or a compatible OS, Fossil will drop itself into a [`chroot(2)` jail][cj] shortly after starting up, once it's done everything that requires root access. Most commonly, you run Fossil as root to allow it to bind to TCP port 80 for HTTP service, since normal users are restricted to ports 1024 and up on OSes where this behavior occurs. Fossil uses the owner of the Fossil repository file as its new user ID when dropping root privileges. When this happens, Fossil needs to have all of its dependencies inside the chroot jail in order to continue work. There are several things you typically need in order to make things work properly: * the repository file(s) * `/dev/null` — create it with `mknod(8)` inside the jail directory ([Linux example][mnl]) * `/dev/urandom` — ditto * `/proc` — you might need to mount this virtual filesystem inside the jail on Linux systems that make use of [Fossil’s server load shedding feature][fls] * any shared libraries your `fossil` binary is linked to, unless you [configured Fossil with `--static`][bld] to avoid it Fossil does all of this in order to protect the host OS. You can make it bypass the jail part of this by passing <tt>--nojail</tt> to <tt>fossil server</tt>, but you cannot make it skip the dropping of root privileges, on purpose. [bld]: https://www.fossil-scm.org/fossil/doc/trunk/www/build.wiki [cj]: https://en.wikipedia.org/wiki/Chroot [fls]: ./loadmgmt.md [mnl]: https://fossil-scm.org/forum/forumpost/90caff30cb [srv]: ./server/ |
Added www/collisions.ipynb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "*Pull in the packages we need:*" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "require(stats)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Parameters\n", "\n", "* **cpd** - Checkins per day. Defaults to 20.\n", "\n", "* **days** - Number of days to simulate. Defaults to 10000, or roughly\n", " 40 working years.\n", "\n", "* **winSz** - Size of the commit window as a fraction of `workSec`. Defaults\n", " to 0.01%, which is roughly 3 seconds for the default 8-hour work day, a\n", " a long-ish commit time for Fossil.\n", "\n", "* **workSec** - Seconds in working day, defaulting to 8 hours. This value\n", " only affects the reporting output, not the results of the underlying\n", " simulation. It's a scaling parameter to humanize the results.\n", " \n", "* **spread** - Adjustment factor in computing the standard deviation for our \n", " normally-distributed random numbers. The default gives \"nice\" distributions,\n", " spread over the working day with a low chance of generating values outside\n", " the working day.\n", " \n", " The smaller this value gets (<4), the more spread out the checkins, and\n", " so the lower the chance of collisions. You might want to decrease it a bit\n", " to simulate early and late workers.\n", " \n", " As you increase this value (>4) you're simulating a work environment\n", " where people tend to check their work in closer and closer to mid-day,\n", " which increases the chance of collision." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "collisions <- function(\n", " cpd = 20,\n", " days = 10000,\n", " winSz = 0.01 / 100,\n", " workSec = 8 * 60 * 60,\n", " spread = 4)\n", "{\n", " cat(\"Running simulation...\\n\")\n", "\n", " day = 0\n", " collisions = 0\n", " winSec = workSec * winSz\n", " mean = workSec / 2\n", " sd = workSec / spread\n", "\n", " while (day < days) {\n", " # Create the commit time vector as random values in a normal\n", " # distribution.\n", " times = sort(rnorm(cpd, mean, sd))\n", "\n", " # Are there any pairs in the time vector that are within the\n", " # passed window size? If so, that's a Fossil checkin collision.\n", " i = 1\n", " while (i < cpd) {\n", " if (abs(times[i] - times[i + 1]) < winSec) {\n", " collisions = collisions + 1\n", " }\n", " i = i + 1\n", " }\n", " \n", " day = day + 1\n", " }\n", " \n", " cat(\"Found\", collisions, \"collisions in\", days, (workSec / 3600),\n", " \"hour working days with\", winSec, \"second windows.\\n\")\n", "}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Run the following cell, possibly changing parameters documented above:*" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running simulation...\n", "Found 422 collisions in 10000 8 hour working days with 2.88 second windows.\n" ] } ], "source": [ "collisions()" ] } ], "metadata": { "kernelspec": { "display_name": "R", "language": "R", "name": "ir" }, "language_info": { "codemirror_mode": "r", "file_extension": ".r", "mimetype": "text/x-r-source", "name": "R", "pygments_lexer": "r", "version": "3.3.2" } }, "nbformat": 4, "nbformat_minor": 2 } |
Changes to www/concepts.wiki.
︙ | ︙ | |||
80 81 82 83 84 85 86 | Communication between repositories is via HTTP. Remote repositories are identified by URL. You can also point a web browser at a repository and get human-readable status, history, and tracking information about the project. <h3>2.1 Identification Of Artifacts</h3> | | | | > | > > | < | > | | | | 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 | Communication between repositories is via HTTP. Remote repositories are identified by URL. You can also point a web browser at a repository and get human-readable status, history, and tracking information about the project. <h3>2.1 Identification Of Artifacts</h3> A particular version of a particular file is called an "artifact". Each artifact has a universally unique name which is the <a href="http://en.wikipedia.org/wiki/SHA1">SHA1</a> or <a href="http://en.wikipedia.org/wiki/SHA3">SHA3-256</a> hash of the content of that file expressed as either 40 or 64 characters of lower-case hexadecimal. (See the [./hashpolicy.wiki|hash policy document] for information on which algorithm is used, when.) Such a hash is referred to as the Artifact ID. These hash algorithms were created with Fossil's purpose in mind: to provide a highly forgery-resistant identifier for a blob of data, such as a file. Given any file, it is simple to find the artifact ID for that file. But given an artifact ID, it is computationally intractable to generate a file that will have that same artifact ID. Artifact IDs look something like this: <blockquote><b> 6089f0b563a9db0a6d90682fe47fd7161ff867c8<br> 59712614a1b3ccfd84078a37fa5b606e28434326<br> 19dbf73078be9779edd6a0156195e610f81c94f9<br> |
︙ | ︙ | |||
191 192 193 194 195 196 197 | by downloading a <a href="https://www.fossil-scm.org/fossil/uv/download.html">pre-compiled version</a> or [./build.wiki | compiling it yourself]) and then putting that file somewhere on your PATH. Fossil is completely self-contained. It is not necessary to install any other software in order to use Fossil. You do <u>not</u> need | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | by downloading a <a href="https://www.fossil-scm.org/fossil/uv/download.html">pre-compiled version</a> or [./build.wiki | compiling it yourself]) and then putting that file somewhere on your PATH. Fossil is completely self-contained. It is not necessary to install any other software in order to use Fossil. You do <u>not</u> need CVS, gzip, diff, rsync, Python, Perl, Tcl, Java, Apache, PostgreSQL, MySQL, SQLite, patch, or any similar software on your system in order to use Fossil effectively. You will want to have some kind of text editor for entering check-in comments. Fossil will use whatever text editor is identified by your VISUAL environment variable. Fossil will also use GPG to clearsign your manifests if you happen to have it installed, but Fossil will skip that step if GPG missing from your system. You can optionally set up Fossil to use external "diff" programs, |
︙ | ︙ | |||
418 419 420 421 422 423 424 | SCGI requests from web-servers like Nginx. <li><p><b>Inetd or Stunnel.</b> Configure programs like inetd, xinetd, or stunnel to hand off HTTP requests directly to the [/help?cmd=http|fossil http] command. </ol> | | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | SCGI requests from web-servers like Nginx. <li><p><b>Inetd or Stunnel.</b> Configure programs like inetd, xinetd, or stunnel to hand off HTTP requests directly to the [/help?cmd=http|fossil http] command. </ol> See the [./server/ | How To Configure A Fossil Server] document for details. <h2>6.0 Review Of Key Concepts</h2> <ul> <li>The <b>fossil</b> program is a self-contained stand-alone executable. Just put it somewhere on your PATH to install it.</li> |
︙ | ︙ |
Changes to www/contribute.wiki.
︙ | ︙ | |||
53 54 55 56 57 58 59 | Fossil Architect (Richard Hipp) will merge changes onto the trunk.</p> Contributors are required to following the [./checkin.wiki | pre-checkin checklist] prior to every check-in to the Fossil self-hosting repository. This checklist is short and succinct and should only require a few seconds to follow. Contributors should print out a copy of the pre-checkin checklist and keep | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | Fossil Architect (Richard Hipp) will merge changes onto the trunk.</p> Contributors are required to following the [./checkin.wiki | pre-checkin checklist] prior to every check-in to the Fossil self-hosting repository. This checklist is short and succinct and should only require a few seconds to follow. Contributors should print out a copy of the pre-checkin checklist and keep it on a note card beside their workstations, for quick reference. Contributors should review the [./style.wiki | Coding Style Guidelines] and mimic the coding style used through the rest of the Fossil source code. Your code should blend in. A third-party reader should be unable to distinguish your code from any other code in the source corpus. |
︙ | ︙ |
Changes to www/custom_ticket.wiki.
︙ | ︙ | |||
81 82 83 84 85 86 87 | $<assigned_to> </td> <td align="right">Opened by:</td><td bgcolor="#d0d0d0"> $<opened_by> </td> </pre> This will add a row which displays these two fields, in the event the user has | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | $<assigned_to> </td> <td align="right">Opened by:</td><td bgcolor="#d0d0d0"> $<opened_by> </td> </pre> This will add a row which displays these two fields, in the event the user has <a href="./caps/ref.html#w">ticket "edit" capability</a>. </p> </blockquote> <h2>Modify the 'edit ticket' page</h2><blockquote> <p> Before the "Severity:" line, add this: <pre> |
︙ | ︙ |
Changes to www/customskin.md.
|
| | < < > < | < | > > < | | < | > > | > > > > | | > | > > > | > | > | > | | > | < > | < | 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 | # Skinning the Fossil Web Interface Every HTML page generated by Fossil has the following basic structure: <blockquote><table border=1 cellpadding=10><tbody> <tr><td style='background-color:lightblue;text-align:center;'>Header</td></tr> <tr><td style='background-color:lightgreen;text-align:center;'> Fossil-Generated Content</td></tr> <tr><td style='background-color:lightblue;text-align:center;'>Footer</td></tr> <tr><td style='background-color:lightyellow;text-align:center;'>Javascript (optional)</td></tr> </tbody></table></blockquote> The default header looks something like this: <div class="header"> <div class="title"><h1>$<project_name></h1>$<title></div> ... top banner and menu bar ... The Fossil-generated content section looks like this: <div class="content"> ... generated content here ... </div> And the footer looks like this: <div class="footer"> ... skin-specific stuff here ... </div> <script nonce="$<nonce>"> <th1>styleScript</th1> </script> Notice that there are no `<html>` or `<head>` elements in the header, nor is there an `</html>` closing tag in the footer. Fossil generates this material automatically unless it sees that you have provided your own HTML document header within the skin’s Header section. This design lets most users get the benefit of Fossil’s automatic HTML document header, which takes care of quite a few different things for you, while still allowing you to [override if at need](#headfoot). When overriding the default document header, you might want to use some of the [TH1 variables documented below](#vars) such as `$stylesheet_url` to avoid hand-writing code that Fossil can generate for you. The middle "content" section comprises the bulk of most pages and contains the actual Fossil-generated data that the user is interested in seeing. The text of this content section is not normally configurable. The content text can be styled using CSS, but it is otherwise fixed. Hence it is the header, the footer, and the CSS that determine the look of a repository. We call the bundle of built-in CSS, header, and footer a "skin". ## <a name="builtin"></a>Built-in Skins Fossil comes with several built-in skins. The sources to these built-ins can be found in the Fossil source tree under the skins/ folder. The skins/ folder contains a separate subfolder for each built-in skin, with each subfolders holding four files, "css.txt", "details.txt", "footer.txt", and "header.txt", that describe the CSS, rendering options, footer, and header for that skin, respectively. The skin of a repository can be changed to any of the built-in skins using the web interface by going to the /setup_skin web page (requires Admin privileges) and clicking the appropriate button. Or, the --skin command line option can be used for the [fossil ui](../../../help?cmd=ui) or [fossil server](../../../help?cmd=server) commands to force that particular instance of Fossil to use the specified built-in skin. ## <a name="sharing"></a>Sharing Skins The skin of a repository is not part of the versioned state and does not "push" or "pull" like checked-in files. The skin is local to the repository. However, skins can be shared between repositories using the [fossil config](../../../help?cmd=configuration) command. The "fossil config push skin" command will send the local skin to a remote repository and the "fossil config pull skin" command will import a skin |
︙ | ︙ | |||
86 87 88 89 90 91 92 | will provide an historical record of what the skin used to be and allow the historical look of the repositories to be recreated if necessary. When cloning a repository, the skin of new repository is initialized to the skin of the repository from which it was cloned. | > | < | | | | | < < | < | < < < < < | < < | < | | < < < < > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 | will provide an historical record of what the skin used to be and allow the historical look of the repositories to be recreated if necessary. When cloning a repository, the skin of new repository is initialized to the skin of the repository from which it was cloned. ## <a name="headfoot"></a>Header and Footer Processing The `header.txt` and `footer.txt` files of a skin are merely the HTML text of the header and footer, except that before being prepended and appended to the content, their text content is run through a [TH1 interpreter](./th1.md) that might adjust the text as follows: * All text within <th1>...</th1> is elided from the output and that text is instead run as a TH1 script. That TH1 script has the opportunity to insert new text in place of itself, or to inhibit or enable the output of subsequent text. * Text of the form "$NAME" or "$<NAME>" is replaced with the value of the TH1 variable NAME. Above, we saw the first few lines of a typical Fossil skin header: <div class="header"> <div class="title"><h1>$<project_name></h1>$<title>/div> After variables are substituted by TH1, that will look more like this: <div class="header"> <div class="title"><h1>Project Name</h1>Page Title</div> As you can see, two TH1 variable substitutions were done. The same TH1 interpreter is used for both the header and the footer and for all scripts contained within them both. Hence, any global TH1 variables that are set by the header are available to the footer. Fossil provides the HTML document container tags `<html>`, `<head>`, and their inner content when your skin’s header and footer don’t include them. This default header declares the repository’s Content Security Policy (CSP) which is well worth understanding, but since it is not strictly about skinning, we cover that in [a separate document](./defcsp.md). ## <a name="menu"></a>Customizing the ≡ Hamburger Menu The menu bar of the default skin has an entry to open a drop-down menu with additional navigation links, represented by the ≡ button (hence the name "hamburger menu"). The Javascript logic to open and close the hamburger menu when the button is clicked is contained in the optional Javascript part (js.txt) of the default skin. Out of the box, the drop-down menu shows the [Site Map](../../../sitemap), loaded by an AJAX request prior to the first display. The ≡ button for the hamburger menu is added to the menu bar by the following TH1 command in the default skin header.txt, right before the menu bar links: html "<a id='hbbtn' href='#'>☰</a>" The hamburger button can be repositioned between the other menu links (but the drop-down menu is always left-aligned with the menu bar), or it can be removed by deleting the above statement (the Javascript logic detects this case and remains idle, so it's not necessary to modify the default skin js.txt). The following empty element at the bottom of the default skin header.txt serves as the panel to hold the drop-down menu elements: <div id='hbdrop'></div> Out of the box, the contents of the panel is populated with the [Site Map](../../../sitemap), but only if the panel does not already contain any HTML elements (that is, not just comments, plain text or non-presentational white space). So the hamburger menu can be customized by replacing the empty `<div id='hbdrop'></div>` element with a menu structure knitted according to the following template: <div id="hbdrop" data-anim-ms="400"> <ul class="columns" style="column-width: 20em; column-count: auto"> <!-- NEW GROUP WITH HEADING LINK --> <li> <a href="$home$index_page">Link: Home</a> <ul> <li><a href="$home/timeline">Link: Timeline</a></li> <li><a href="$home/dir?ci=tip">Link: File List</a></li> </ul> </li> <!-- NEW GROUP WITH HEADING TEXT --> <li> Heading Text <ul> <li><a href="$home/doc/trunk/www/customskin.md">Link: Theming</a></li> <li><a href="$home/doc/trunk/www/th1.md">Link: TH1 Scripts</a></li> </ul> </li> <!-- NEXT GROUP GOES HERE --> </ul> </div> The custom `data-anim-ms` attribute can be added to the panel element to direct the Javascript logic to override the default menu animation duration of 400 ms. A faster animation duration of 80-200 ms may be preferred for smaller menus. The animation is disabled by setting the attribute to `"0"`. ## <a name="vars"></a>TH1 Variables Before expanding the TH1 within the header and footer, Fossil first initializes a number of TH1 variables to values that depend on repository settings and the specific page being generated. * **project_name** - The project_name variable is filled with the name of the project as configured under the Admin/Configuration menu. * **project_description** - The project_description variable is filled with the description of the project as configured under |
︙ | ︙ | |||
172 173 174 175 176 177 178 179 180 181 182 183 184 185 | specified by the Admin/Configuration setup page. * **current_page** - The name of the page currently being processed, without the leading "/" and without query parameters. Examples: "timeline", "doc/trunk/README.txt", "wiki". * **csrf_token** - A token used to prevent cross-site request forgery. * **release_version** - The release version of Fossil. Ex: "1.31" * **manifest_version** - A prefix on the check-in hash of the specific version of fossil that is running. Ex: "\[47bb6432a1\]" * **manifest_date** - The date of the source-code check-in for the | > > > > > > > > | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | specified by the Admin/Configuration setup page. * **current_page** - The name of the page currently being processed, without the leading "/" and without query parameters. Examples: "timeline", "doc/trunk/README.txt", "wiki". * **csrf_token** - A token used to prevent cross-site request forgery. * **default_csp** - [Fossil’s default CSP](./defcsp.md) unless [overridden by custom TH1 code](./defcsp.md#th1). Useful within the skin for inserting the CSP into a `<meta>` tag within [a custom `<head>` element](#headfoot). * **nonce** - The value of the cryptographic nonce for the request being processed. * **release_version** - The release version of Fossil. Ex: "1.31" * **manifest_version** - A prefix on the check-in hash of the specific version of fossil that is running. Ex: "\[47bb6432a1\]" * **manifest_date** - The date of the source-code check-in for the |
︙ | ︙ | |||
201 202 203 204 205 206 207 | project, as configured on the Admin/Logo page. All of the above are variables in the sense that either the header or the footer is free to change or erase them. But they should probably be treated as constants. New predefined values are likely to be added in future releases of Fossil. | > | < | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | project, as configured on the Admin/Logo page. All of the above are variables in the sense that either the header or the footer is free to change or erase them. But they should probably be treated as constants. New predefined values are likely to be added in future releases of Fossil. ## <a name="procedure"></a>Suggested Skin Customization Procedure Developers are free, of course, to develop new skins using any method they want, but the following is a technique that has worked well in the past and can serve as a starting point for future work: 1. Select a built-in skin that is closest to the desired look. Make copies of the css, footer, and header into files name "css.txt", |
︙ | ︙ | |||
235 236 237 238 239 240 241 | Iterate until the desired look is achieved. 4. Copy/paste the resulting css.txt, details.txt, header.txt, and footer.txt files into the CSS, details, header, and footer configuration screens under the Admin/Skins menu. | > | < | 305 306 307 308 309 310 311 312 313 314 315 | Iterate until the desired look is achieved. 4. Copy/paste the resulting css.txt, details.txt, header.txt, and footer.txt files into the CSS, details, header, and footer configuration screens under the Admin/Skins menu. ## See Also * [Customizing the Timeline Graph](customgraph.md) |
Added www/defcsp.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # The Default Content Security Policy (CSP) When Fossil’s web interface generates an HTML page, it normally includes a [Content Security Policy][csp] (CSP) in the `<head>`. The CSP defines a “white list” to tell the browser what types of content (HTML, images, CSS, JavaScript...) the document may reference and the sources the browser is allowed to pull and interpret such content from. The aim is to prevent certain classes of [cross-site scripting][xss] (XSS) and code injection attacks. The browser will not pull content types disallowed by the CSP; the CSP also adds restrictions on the types of inline content the browser is allowed to interpret. Fossil has built-in server-side content filtering logic. For example, it purposely breaks `<script>` tags when it finds them in Markdown and Fossil Wiki documents. (But not in [HTML-formatted embedded docs][hfed]!) We also back that with multiple levels of analysis and checks to find and fix content security problems: compile-time static analysis, run-time dynamic analysis, and manual code inspection. Fossil is open source software, so it benefits from the “[many eyeballs][llaw],” limited by the size of its developer community. However, there is a practical limit to the power of server-side filtering and code quality practices. First, there is an endless battle between those looking for clever paths around such barriers and those erecting the barriers. The developers of Fossil are committed to holding up our end of that fight, but this is, to some extent, a reactive posture. It is cold comfort if Fossil’s developers react quickly to a report of code injection — as we do! — if the bad guys learn of it and start exploiting it first. Second, Fossil has purposefully powerful features that are inherently difficult to police from the server side: HTML tags [in wiki](/wiki_rules) and [in Markdown](/md_rules) docs, [TH1 docs](./th1.md), the Admin → Wiki → “Use HTML as wiki markup language” mode, etc. Fossil’s strong default CSP adds client-side filtering as a backstop for all of this. Fossil site administrators can [modify the default CSP](#override), perhaps to add trusted external sources for auxiliary content. But for maximum safety, site developers are encouraged to work within the restrictions imposed by the default CSP and avoid the temptation to relax the CSP unless they fully understand the security implications of what they are doing. [llaw]: https://en.wikipedia.org/wiki/Linus%27s_Law ## The Default Restrictions The Fossil default CSP declares the following content restrictions: ### <a name="base"></a> default-src 'self' data: This policy means mixed-origin content isn’t allowed, so you can’t refer to resources on other web domains. Browsers will ignore a link like the one in the following Markdown under our default CSP:  If you look in the browser’s developer console, you should see a CSP error when attempting to render such a page. The default policy does allow inline `data:` URIs, which means you could [data-encode][de] your image content and put it inline within the document:  That method is best used for fairly small resources. Large `data:` URIs are hard to read and edit. There are secondary problems as well: if you put a large image into a Fossil forum post this way, anyone subscribed to email alerts will get a copy of the raw URI text, which can amount to pages and pages of [ugly Base64-encoded text][b64]. For inline images within [embedded documentation][ed], it suffices to store the referred-to files in the repo and then refer to them using repo-relative URLs:  This avoids bloating the doc text with `data:` URI blobs: There are many other cases, [covered below](#serving). [b64]: https://en.wikipedia.org/wiki/Base64 [svr]: ./server/ ### <a name="style"></a> style-src 'self' 'unsafe-inline' This policy allows CSS information to come from separate files hosted under the Fossil repo server’s Internet domain. It also allows inline CSS `<style>` tags within the document text. The `'unsafe-inline'` declaration allows CSS within individual HTML elements: <p style="margin-left: 4em">Indented text.</p> As the "`unsafe-`" prefix on the name implies, the `'unsafe-inline'` feature is suboptimal for security. However, there are a few places in the Fossil-generated HTML that benefit from this flexibility and the work-arounds are verbose and difficult to maintain. Futhermore, the harm that can be done with style injections is far less than the harm possible with injected javascript. And so the `'unsafe-inline'` compromise is accepted for now, though it might go away in some future release of Fossil. ### <a name="script"></a> script-src 'self' 'nonce-%s' This policy disables in-line JavaScript and only allows `<script>` elements if the `<script>` includes a `nonce` attribute that matches the one declared by the CSP. That nonce is a large random number, unique for each HTTP page generated by Fossil, so an attacker cannot guess the value, so the browser will ignore an attacker’s injected JavaScript. That nonce can only come from one of three sources, all of which should be protected at the system administration level on the Fossil server: * **Fossil server C code:** All code paths in Fossil that emit `<script>` elements include the `nonce` attribute. There are several cases, such as the “JavaScript” section of a [custom skin][cs]. That text is currently inserted into each HTML page generated by Fossil,¹ which means it needs to include a `nonce` attribute to allow it to run under this default CSP. We consider JavaScript emitted via these paths to be safe because it’s audited by the Fossil developers. We assume that you got your Fossil server’s code from a trustworthy source and that an attacker cannot replace your Fossil server binary. * **TH1 code:** The Fossil TH1 interpreter pre-defines the [`$nonce` variable](./th1.md#nonce) for use in [custom skins][cs]. For example, some of the stock skins that ship with Fossil include a wall clock feature up in the corner that updates once a minute. These paths are safe in the default Fossil configuration because only the [all-powerful Setup user][su] can write TH1 code that executes in the server’s running context. There is, however, [a default-disabled path](#xss) to beware of, covered in the next section. * **[CGI server extensions][ext]:** Fossil exports the nonce to the CGI in the `FOSSIL_NONCE` environment variable, which it can then use in `<script>` elements it generates. Because these extensions can only be installed by the Fossil server’s system administrator, this path is also considered safe. [ext]: ./serverext.wiki [su]: ./caps/admin-v-setup.md#apsu #### <a name="xss"></a>Cross-Site Scripting via Ordinary User Capabilities We’re so restrictive about how we treat JavaScript because it can lead to difficult-to-avoid scripting attacks. If we used the same CSP for `<script>` tags [as for `<style>` tags](#style), anyone with check-in rights on your repository could add a JavaScript file to your repository and then refer to it from other content added to the site. Since JavaScript code can access any data from any URI served under its same Internet domain, and many Fossil users host multiple Fossil repositories under a single Internet domain, such a CSP would only be safe if all of those repositories are trusted equally. Consider [the Chisel hosting service](http://chiselapp.com/), which offers free Fossil repository hosting to anyone on the Internet, all served under the same `http://chiselapp.com/user/$NAME/$REPO` URL scheme. Any one of those hundreds of repositories could trick you into visiting their repository home page, set to [an HTML-formatted embedded doc page][hfed] via Admin → Configuration → Index Page, with this content: <script src="/doc/trunk/bad.js"></script> That script can then do anything allowed in JavaScript to *any other* Chisel repository your browser can access.The possibilities for mischief are *vast*. For just one example, if you have login cookies on four different Chisel repositories, your attacker could harvest the login cookies for all of them through this path if we allowed Fossil to serve JavaScript files under the same CSP policy as we do for CSS files. This is why the default configuration of Fossil has no way for [embedded docs][ed], [wiki articles][wiki], [tickets][tkt], [forum posts][fp], or [tech notes][tn] to automatically insert a nonce into the page content. This is all user-provided content, which could link to user-provided JavaScript via check-in rights, effectively giving all such users a capability that is usually reserved to the repository’s administrator. The default-disabled [TH1 documents feature][edtf] is the only known path around this restriction. If you are serving a Fossil repository that has any user you do not implicitly trust to a level that you would willingly run any JavaScript code they’ve provided, blind, you **must not** give the `--with-th1-docs` option when configuring Fossil, because that allows substitution of the [pre-defined `$nonce` TH1 variable](./th1.md#nonce) into [HTML-formatted embedded docs][hfed]: <script src="/doc/trunk/bad.js" nonce="$nonce"></script> Even with this feature enabled, you cannot put `<script>` tags into Fossil Wiki or Markdown-formatted content, because our HTML generators for those formats purposely strip or disable such tags in the output. Therefore, if you trust those users with check-in rights to provide JavaScript but not those allowed to file tickets, append to wiki articles, etc., you might justify enabling TH1 docs on your repository, since the only way to create or modify HTML-formatted embedded docs is through check-ins. [ed]: ./embeddeddoc.wiki [edtf]: ./embeddeddoc.wiki#th1 [hfed]: ./embeddeddoc.wiki#html ## <a name="serving"></a>Serving Files Within the Limits There are several ways to serve files within the above restrictions, avoiding the need to [override the default CSP](#override). In decreasing order of simplicity and preference: 1. Within [embedded documentation][ed] (only!) you can refer to files stored in the repo using document-relative file URLs:  2. Relative file URLs don’t work from [wiki articles][wiki], [tickets][tkt], [forum posts][fp], or [tech notes][tn], but you can still refer to them inside the repo with [`/doc`][du] or [`/raw`][ru] URLs:  <img src="/raw/logo.png" style="float: right; margin-left: 2em"> 3. Store the files as [unversioned content][uv], referred to using [`/uv`][uu] URLs instead:  4. Use the [optional CGI server extensions feature](./serverext.wiki) to serve such content via `/ext` URLs. 5. Put Fossil behind a [front-end proxy server][svr] as a virtual subdirectory within the site, so that our default CSP’s “self” rules match static file routes on that same site. For instance, your repo might be at `https://example.com/code`, allowing documentes in that repo to refer to: * images as `/image/foo.png` * JavaScript files as `/js/bar.js` * CSS style sheets as `/style/qux.css` Although those files are all outside the Fossil repo at `/code`, keep in mind that it is the browser’s notion of “self” that matters here, not Fossil’s. All resources come from the same Internet domain, so the browser cannot distinguish Fossil-provided content from static content served directly by the proxy server. This method opens up many other potential benefits, such as [TLS encryption](./tls-nginx.md), high-performance tuning via custom HTTP headers, integration with other web technologies like PHP, etc. You might wonder why we rank in-repo content as most preferred above. It is because the first two options are the only ones that cause such resources to be included in an initial clone or in subsequent repo syncs. The methods further down the list have a number of undesirable properties: 1. Relative links to out-of-repo files break in `fossil ui` when run on a clone. 2. Absolute links back to the public repo instance solve that:  ...but using them breaks some types of failover and load-balancing schemes, because it creates a [single point of failure][spof]. 3. Absolute links fail when one’s purpose in using a clone is to recover from the loss of a project web site by standing that clone up [as a server][svr] elsewhere. You probably forgot to copy such external resources in the backup copies, so that when the main repo site disappears, so do those files. Unversioned content is in the middle of the first list above — between fully-external content and fully in-repo content — because it isn’t included in a clone unless you give the `--unversioned` flag. If you then want updates to the unversioned content to be included in syncs, you have to give the same flag to [a `sync` command](/help?cmd=sync). There is no equivalent with other commands such as `up` and `pull`, so you must then remember to give `fossil uv` commands when necessary to pull new unversioned content down. Thus our recommendation that you refer to in-repo resources exclusively. [du]: /help?cmd=/doc [fp]: ./forum.wiki [ru]: /help?cmd=/raw [spof]: https://en.wikipedia.org/wiki/Single_point_of_failure [tkt]: ./tickets.wiki [tn]: ./event.wiki [uu]: /help?cmd=/uv [uv]: ./unvers.wiki [wiki]: ./wikitheory.wiki ## <a name="override"></a>Overriding the Default CSP If you wish to relax the default CSP’s restrictions or to tighten them further, there are two ways to accomplish that: ### <a name="th1"></a>TH1 Setup Hook The stock CSP text is hard-coded in the Fossil C source code, but it’s only used to set the default value of one of [the TH1 skinning variables](./customskin.md#vars), `$default_csp`. That means you can override the default CSP by giving this variable a value before Fossil sees that it’s undefined and uses this default. The best place to do that is from the [`th1-setup` script](./th1-hooks.md), which runs before TH1 processing happens during skin processing: $ fossil set th1-setup "set default_csp {default-src: 'self'}" This is the cleanest method, allowing you to set a custom CSP without recompiling Fossil or providing a hand-written `<head>` section in the Header section of a custom skin. You can’t remove the CSP entirely with this method, but you can get the same effect by telling the browser there are no content restrictions: $ fossil set th1-setup 'set default_csp {default-src: *}' ### <a name="header"></a>Custom Skin Header Fossil only inserts a CSP into the HTML pages it generates when the [skin’s Header section](./customskin.md#headfoot) doesn’t contain a `<head>` tag. None of the stock skins include a `<head>` tag,² so if you haven’t [created a custom skin][cs], you should be getting Fossil’s default CSP. We say “should” because long-time Fossil users may be hanging onto a legacy behavior from before Fossil 2.5, when Fossil added this automatic `<head>` insertion feature. Repositories created before that release where the admin either defined a custom skin *or chose one of the stock skins* (!) will effectively override this automatic HTML `<head>` insertion feature because the skins from before that time did include these elements. Unless the admin for such a repository updated the skin to track this switch to automatic `<head>` insertion, the default CSP added to the generated header text in Fossil 2.7 is probably being overridden by the skin. If you want the protection of the default CSP in your custom skin, the simplest method is to leave the `<html><head>...` elements out of the skin’s Header section, starting it with the `<div class="head">` element instead as described in the custom skinning guide. Alternately, you can [make use of `$default_csp`](#th1). This then tells you one way to override Fossil’s default CSP: provide your own HTML header in a custom skin. A useful combination is to entirely override the default CSP in the skin but then provide a new CSP [in the front-end proxy layer][svr] using any of the many reverse proxy servers that can define custom HTTP headers. ------------ **Asides and Digressions:** 1. Fossil might someday switch to serving the “JavaScript” section of a custom skin as a virtual text file, allowing it to be cached by the browser, reducing page load times. 2. The stock Bootstrap skin does actually include a `<head>` tag, but from Fossil 2.7 through Fossil 2.9, it just repeated the same CSP text that Fossil’s C code inserts into the HTML header for all other stock skins. With Fossil 2.10, the stock Bootstrap skin uses `$default_csp` instead, so you can [override it as above](#th1). [cs]: ./customskin.md [csp]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP [de]: https://dopiaza.org/tools/datauri/index.php [xss]: https://en.wikipedia.org/wiki/Cross-site_scripting |
Changes to www/delta_format.wiki.
1 | <title>Fossil Delta Format</title> | < | | | | > > | > > > > | > > > > > > | > > | > > | > > | > > | > > > | > > > | > > > | > > | > > > > > > > > | | | | | | | | | | | 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 | <title>Fossil Delta Format</title> <h1>1.0 Overview</h1> <p>Fossil achieves efficient storage and low-bandwidth synchronization through the use of delta-compression. Instead of storing or transmitting the complete content of an artifact, Fossil stores or transmits only the changes relative to a related artifact. </p> <p>This document describes the delta-encoding format used by Fossil. The intended audience is developers working on either <a href="index.wiki">Fossil</a> itself, or on tools compatible with Fossil. Understanding of this document is <em>not</em> required for ordinary users of Fossil. This document is an implementation detail.</p> <p>This document only describes the delta file format. A [./delta_encoder_algorithm.wiki|separate document] describes one possible algorithm for generating deltas in this format.</p> <h2>1.1 Sample Software And Analysis Tools</h2> <p>The core routines used to generate and apply deltas in this format are contained in the [../src/delta.c|delta.c] source file. Interface logic, including "test-*" commands to directly manipulate deltas are contained in the [../src/deltacmd.c|deltacmd.c] source file. SQL functions to create, apply, and analyze deltas are implemented by code in the [../src/deltafunc.c|deltafunc.c] source file. <p>The following command-line tools are available to create and apply deltas and to test the delta logic: * [/help?cmd=test-delta|fossil test-delta] → Run self-tests of the delta logic * [/help?cmd=test-delta-create|fossil test-delta-create X Y] → compute a delta that converts file X into file Y. Output that delta. * [/help?cmd=test-delta-apply|fossil test-delta-apply X D] → apply delta D to input file X and output the result. * [/help?cmd=test-delta-analyze|fossil test-delta-analyze X Y] → compute and delta that converts file X into file Y but instead of writing the delta to output, write performance information about the delta. <p>When running the [/help?cmd=sqlite3|fossil sql] command to get an interactive SQL session connected to the repository, the following additional SQL functions are provided: * <b>delta_create(</b><i>X</i><b>,</b><i>Y</i><b>)</b> → Compute a data that carries blob X into blob Y and return that delta as a blob. * <b>delta_apply(</b><i>X</i><b>,</b><i>D</i><b>)</b> → Apply delta D to input blob X return a new blob which is the result. * <b>delta_output_size(</b><i>D</i>)</b> → Return the size of the output that would result from applying delta D. * <b>delta_parse(</b><i>D</i>)</b> → This is a table-valued function that returns one row for the header, for the trailer, and for each segment in delta D. <a name="structure"></a><h1>2.0 Structure</h1> <img src="delta1.gif" align="left" hspace="10"> <p>A delta consists of three parts, a "header", a "trailer", and a "segment-list" between them.</p> <p>Both header and trailer provide information about the target helping the decoder, and the segment-list describes how the target can be constructed from the original.</p> <a name="header"></a><h2>2.1 Header</h2> <img src="delta6.gif" align="left" hspace="10"> <p>The header consists of a single number followed by a newline character (ASCII 0x0a). The number is the length of the target in bytes.</p> <p>This means that, given a delta, the decoder can compute the size of the target (and allocate any necessary memory based on that) by simply reading the first line of the delta and decoding the number found there. In other words, before it has to decode everything else.</p> <a name="trailer"></a><h2>2.2 Trailer</h2> <img src="delta5.gif" align="left" hspace="10"> <p>The trailer consists of a single number followed by a semicolon (ASCII 0x3b). This number is a checksum of the target and can be used by a decoder to verify that the delta applied correctly, reconstructing the target from the original.</p> <p>The checksum is computed by treating the target as a series of 32-bit integer numbers (MSB first), and summing these up, modulo 2^32-1. A target whose length is not a multiple of 4 is padded with 0-bytes (ASCII 0x00) at the end.</p> <p>By putting this information at the end of the delta a decoder has it available immediately after the target has been reconstructed fully.</p> <a name="slist"></a><h2>2.3 Segment-List</h2> <img src="delta2.gif" align="left" hspace="10"> <p>The segment-list of a delta describes how to create the target from the original by a combination of inserting literal byte-sequences and copying ranges of bytes from the original. This is where the compression takes place, by encoding the large common parts of original and target in small copy instructions.</p> <p>The target is constructed from beginning to end, with the data generated by each instruction appended after the data of all previous instructions, with no gaps.</p> <a name="insertlit"></a><h3>2.3.1 Insert Literal</h3> <p>A literal is specified by two elements, the size of the literal in bytes, and the bytes of the literal itself.</p> <img src="delta4.gif" align="left" hspace="10"> <p>The length is written first, followed by a colon character (ASCII 0x3a), followed by the bytes of the literal.</p> <a name="copyrange"></a><h3>2.3.2 Copy Range</h3> <p>A range to copy is specified by two numbers, the offset of the first byte in the original to copy, and the size of the range, in bytes. The size zero is special, its usage indicates that the range extends to the end of the original.</p> <img src="delta3.gif" align="left" hspace="10"> <p>The length is written first, followed by an "at" character (ASCII 0x40), then the offset, followed by a comma (ASCII 0x2c).</p> <a name="intcoding"></a><h1>3.0 Encoding of integers</h1> <p> The format currently handles only 32 bit integer numbers. They are written base-64 encoded, MSB first, and without leading "0"-characters, except if they are significant (i.e. 0 => "0"). </p> <p> The base-64 coding is described in <a href="http://www.ietf.org/rfc/rfc3548.txt">RFC 3548</a>. </p> <a name="examples"></a><h1>4.0 Examples</h1> <a name="examplesint"></a><h2>4.1 Integer encoding</h2> <table border=1> <tr> <th>Value</th> <th>Encoding</th> </tr> <tr> <td>0</td> <td>0</td> </tr> <tr> <td>6246</td> <td>1Xb</td> </tr> <tr> <td>-1101438770</td> <td>2zMM3E</td> </tr> </table> <a name="examplesdelta"></a><h2>4.2 Delta encoding</h2> <p>An example of a delta using the specified encoding is:</p> <table border=1><tr><td><pre> 1Xb 4E@0,2:thFN@4C,6:scenda1B@Jd,6:scenda5x@Kt,6:pieces79@Qt,F: Example: eskil~E@Y0,2zMM3E;</pre> </td></tr></table> |
︙ | ︙ | |||
204 205 206 207 208 209 210 | * Ticketing interface (expand this bullet) </pre></td></tr></table> | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | * Ticketing interface (expand this bullet) </pre></td></tr></table> <a name="notes"></a><h1>Notes</h1> <ul> <li>Pure text files generate a pure text delta. </li> <li>Binary files generate a delta that may contain some binary data. </li> <li>The delta encoding does not attempt to compress the content. It was considered to be much more sensible to do compression using a separate general-purpose compression library, like <a href="http://www.zlib.net">zlib</a>. </li> </ul> |
Changes to www/embeddeddoc.wiki.
︙ | ︙ | |||
78 79 80 81 82 83 84 | [/md_rules | Markdown markup language]. Documentation files ending in ".txt" are plain text. Wiki, markdown, and plain text documentation files are rendered with the standard fossil header and footer added. Most other mimetypes are delivered directly to the requesting web browser without interpretation, additions, or changes. | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | [/md_rules | Markdown markup language]. Documentation files ending in ".txt" are plain text. Wiki, markdown, and plain text documentation files are rendered with the standard fossil header and footer added. Most other mimetypes are delivered directly to the requesting web browser without interpretation, additions, or changes. <a name="html"></a>Files with the mimetype "text/html" (the .html or .htm suffix) are usually rendered directly to the browser without interpretation. However, if the file begins with a <div> element like this: <b><div class='fossil-doc' data-title='<i>Title Text</i>'></b> Then the standard Fossil header and footer are added to the document prior to being displayed. The "class='fossil-doc'" attribute is required for this to occur. The "data-title='...'" attribute is optional, but if it is present the text will become the title displayed in the Fossil header. An example of this can be seen in the text of the [/artifact/84b4b3d041d93a?txt=1 | Index Of Fossil Documentation] document. Beware that such HTML files render in the same browser security context as all other embedded documentation served from Fossil; they are not fully-independent web pages. One practical consequence of this is that embedded <tt><script></tt> tags will cause a [https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | Content Security Policy] error in your browser with the default CSP as served by Fossil. See the documentation on [./customskin.md#headfoot | Header and Footer Processing] and [./defcsp.md | The Default CSP]. <h2>Server-Side Text Substitution</h2> Fossil can do a few types of substitution of server-side information into the embedded document. <h3>1. $ROOT</h3> To allow for repositories [./server/ | served deeper than the root of the URL hierarchy], Fossil can substitute the repository's root in the URL scheme into HTML <tt>href</tt> and <tt>action</tt> attributes. For example: <nowiki><pre> [$ROOT/doc.wiki | doc at project root] </pre></nowiki> might become this in the rendered HTML: <nowiki><pre> <a href="/project/root/doc.wiki">doc at project root</a> </pre></nowiki> As you can see, this happens for all source document types that end up rendering as HTML, not just source documents in the HTML <tt>fossil-doc</tt> format described at the end of the prior section. <h3 id="th1">2. TH1 Documents</h3> Fossil will substitute the value of [./th1.md | TH1 expressions] within <tt>{</tt> curly braces <tt>}</tt> into the output HTML if you have configured it with the <tt>--with-th1-docs</tt> option, which is disabled by default. <h2>Examples</h2> This file that you are currently reading is an example of embedded documentation. The name of this file in the fossil source tree is "<b>www/embeddeddoc.wiki</b>". You are perhaps looking at this |
︙ | ︙ | |||
115 116 117 118 119 120 121 | CGI mode. The "index.html" CGI script looks like this: <blockquote><pre> #!/usr/bin/fossil repository: /fossil/fossil.fossil </pre></blockquote> | | | | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | CGI mode. The "index.html" CGI script looks like this: <blockquote><pre> #!/usr/bin/fossil repository: /fossil/fossil.fossil </pre></blockquote> This is one of the many ways to set up a <a href="./server/">Fossil server</a>. The "<b>/trunk/</b>" part of the URL tells fossil to use the documentation files from the most recent trunk check-in. If you wanted to see an historical version of this document, you could substitute the name of a check-in for "<b>/trunk/</b>". For example, to see the version of this document associated with check-in [9be1b00392], simply replace the "<b>/trunk/</b>" with |
︙ | ︙ |
Changes to www/encryptedrepos.wiki.
︙ | ︙ | |||
48 49 50 51 52 53 54 | </pre></blockquote> A setting of 1 or greater prevents fossil from trying to remember the previous sync password. <blockquote><pre> export FOSSIL_SECURITY_LEVEL=2 </pre></blockquote> A setting of 2 or greater | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | </pre></blockquote> A setting of 1 or greater prevents fossil from trying to remember the previous sync password. <blockquote><pre> export FOSSIL_SECURITY_LEVEL=2 </pre></blockquote> A setting of 2 or greater causes all password prompts to be preceded by a random translation matrix similar to the following: <blockquote><pre> abcde fghij klmno pqrst uvwyz qresw gjymu dpcoa fhkzv inlbt </pre></blockquote> When entering the password, the user must substitute the letter on the second line that corresponds to the letter on the first line. Uppercase substitutes |
︙ | ︙ |
Changes to www/env-opts.md.
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | * _8_ — Attempts to break lines on word boundaries while honoring the logical line length. * _16_ — Looks for the original comment text within the text being printed. Upon matching, a new line will be emitted, thus preserving more of the pre-existing formatting. `--errorlog ERRLOG`: Name a file to which fossil will log panics, errors, and warnings. `--help`: If `--help` is found anywhere on the command line, translate the command to `fossil help cmdname` where `cmdname` is the first | > > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | * _8_ — Attempts to break lines on word boundaries while honoring the logical line length. * _16_ — Looks for the original comment text within the text being printed. Upon matching, a new line will be emitted, thus preserving more of the pre-existing formatting. `--comment-format NUMBER`: Alias for `--comfmtflags NUMBER`. `--errorlog ERRLOG`: Name a file to which fossil will log panics, errors, and warnings. `--help`: If `--help` is found anywhere on the command line, translate the command to `fossil help cmdname` where `cmdname` is the first |
︙ | ︙ | |||
107 108 109 110 111 112 113 114 | `--vfs VFSNAME`: Load the named VFS into SQLite. Environment Variables --------------------- | > > > > > > | > | > > | > | < | 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 | `--vfs VFSNAME`: Load the named VFS into SQLite. Environment Variables --------------------- On most platforms, the location of the user’s account-wide `.fossil` file is either `FOSSIL_HOME` or `HOME`, in that order. This ordering lets you put this file somewhere other than at the top of your user’s home directory by defining `FOSSIL_HOME` to mask the always-defined `HOME`. For native Windows builds and for Cygwin builds, the file is called `_fossil` instead to avoid problems with old programs that assume file names cannot begin with a dot, as was true in old versions of Windows and in MS-DOS. (Newer Microsoft OSes and file systems don’t have a problem with such files, but still we take the safe path in case you’re on a system with software that can’t cope.) We start our search with `FOSSIL_HOME` again, but instead of falling back to `HOME`, we instead try `USERPROFILE`, then `LOCALAPPDATA`, then `APPDATA`, and finally we concatenate `HOMEDRIVE` + `HOMEPATH`. `EDITOR`: Name the editor to use for check-in and stash comments. Overridden by the local or global `editor` setting or the `VISUAL` environment variable. `FOSSIL_BREAK`: If set, an opportunity will be created to attach a debugger to the Fossil process prior to any significant work being |
︙ | ︙ | |||
143 144 145 146 147 148 149 | variable found in the environment from the list `FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is used as the location of the `~/.fossil` file. `FOSSIL_USE_SEE_TEXTKEY`: If set, treat the encryption key string for | | > > > > > > > > > > > > < < < < < < < < < < | 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 | variable found in the environment from the list `FOSSIL_HOME`, `LOCALAPPDATA` (Windows), `APPDATA` (Windows), `HOMEDRIVE` and `HOMEPATH` (Windows, used together), and `HOME` is used as the location of the `~/.fossil` file. `FOSSIL_USE_SEE_TEXTKEY`: If set, treat the encryption key string for SEE as text to be hashed into the actual encryption key. This has no effect if Fossil was not compiled with SEE support enabled. `FOSSIL_USER`: Name of the default user account if the checkout, local or global `default-user` setting is not present. The first environment variable found in the environment from the list `FOSSIL_USER`, `USER`, `LOGNAME`, and `USERNAME` is the user name. If none of those are set, then the default user name is "root". See the discussion of Fossil Username below for a lot more detail. `FOSSIL_SECURITY_LEVEL`: If set to any of the values listed below, additional measures for password security will be enabled (also see [How To Use Encrypted Repositories][encryptedrepos.wiki]): [encryptedrepos.wiki]: /doc/trunk/www/encryptedrepos.wiki * _≥1_ — Do not remember passwords. * _≥2_ — Use a scrambled matrix for password input. `FOSSIL_TCL_PATH`: When Tcl stubs support is configured, point to a specific file or folder containing the version of Tcl to load at run time. `FOSSIL_TEST_DANGEROUS_IGNORE_OPEN_CHECKOUT`: When set to the literal value `YES_DO_IT`, the test suite will relax the constraint that some tests may not run within an open checkout. This is subject to removal in the future. `FOSSIL_VFS`: Name a VFS to load into SQLite. `GATEWAY_INTERFACE`: If present and the `--nocgi` option is not, assume fossil is invoked from a web server as a CGI command, and act accordingly. `HOME`: Location of the `~/.fossil` file. The first environment |
︙ | ︙ | |||
242 243 244 245 246 247 248 | `SQLITE_TMPDIR`: Names the temporary file location for SQLite. When set, this will be used instead of `TMPDIR`. `SYSTEMROOT`: (Windows) Used to locate `notepad.exe` as a fall back comment editor. | < < < < < < | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | `SQLITE_TMPDIR`: Names the temporary file location for SQLite. When set, this will be used instead of `TMPDIR`. `SYSTEMROOT`: (Windows) Used to locate `notepad.exe` as a fall back comment editor. `TERM`: If the linenoise library is used (almost certainly not on Windows), it will check `TERM` to verify that the interactive terminal is not named on a short list on terminals known to not work with linenoise. Linenoise is a library that provides command history and command line editing to interactive programs, and can be used in the `fossil sqlite3` command. |
︙ | ︙ | |||
279 280 281 282 283 284 285 | when processing the `--set-anon-caps` option for the `test-th-eval`, `test-th-render`, and `test-th-source` test commands. `TH1_TEST_USER_CAPS`: Override the default user permissions used when processing the `--set-user-caps` option for the `test-th-eval`, `test-th-render`, and `test-th-source` test commands. | < < < < < < < < < < < < | 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 | when processing the `--set-anon-caps` option for the `test-th-eval`, `test-th-render`, and `test-th-source` test commands. `TH1_TEST_USER_CAPS`: Override the default user permissions used when processing the `--set-user-caps` option for the `test-th-eval`, `test-th-render`, and `test-th-source` test commands. `TMPDIR`: Names the temporary file location for SQLite. `USER`: Name of the logged in user on many Unix-like platforms. Used as the fossil user name if `FOSSIL_USER` is not specified. See the discussion of Fossil Username below for a lot more detail. `USERNAME`: Name of the logged in user on Windows platforms. Used as the fossil user name if `FOSSIL_USER` is not specified. See the discussion of Fossil Username below for a lot more detail. `VISUAL`: Name the editor to use for check-in and stash comments. Overrides the `EDITOR` environment variable. Overridden by the local or global `editor` setting. Notes on Related Values |
︙ | ︙ | |||
434 435 436 437 438 439 440 | If the default VFS underneath SQLite is not suitable, an alternative can be selected with either the `--vfs VFSNAME` option or the `FOSSIL_VFS` environment variable. The `--vfs` option takes precedence. | | | | > | > > | > > | > | > | | < | < | | | < | | 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 | If the default VFS underneath SQLite is not suitable, an alternative can be selected with either the `--vfs VFSNAME` option or the `FOSSIL_VFS` environment variable. The `--vfs` option takes precedence. ### <a name="temp"></a>Temporary File Location Fossil places some temporary files in the checkout directory. Most notably, supporting files related to merge conflicts are placed in the same folder as the merge result. Other temporary files need a different home. The rules for choosing one are complicated. Fossil-specific code uses `FOSSIL_TEMP`, `TEMP`, and `TMP`, in that order. Fossil’s own test suite prepends `FOSSIL_TEST_TEMP` to that list. The underlying SQLite code uses several different path sets for its temp files, depending on the platform type. On Unix-like platforms, excepting Cygwin, SQLite first checks the environment variables `SQLITE_TMPDIR` and `TMPDIR`, in that order. If neither is defined, it falls back to a hard-coded list of paths: `/var/tmp`, `/usr/tmp`, and `/tmp`. If all of that fails, it uses the current working directory. For Cygwin builds, SQLite instead uses the first defined variable in this list: `SQLITE_TMPDIR`, `TMPDIR`, `TMP`, `TEMP`, and `USERPROFILE`. For native Windows builds, SQLite simply calls the OS’s [`GetTempPath()` API][gtp]. See that reference page for details. [gtp]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx That said, it is not unusual for utilities on all platforms to assume that `TEMP` or `TMP` point somewhere safe for temporary files. |
︙ | ︙ |
Changes to www/event.wiki.
︙ | ︙ | |||
21 22 23 24 25 26 27 | * <b>Milestones</b>. Project milestones, such as releases or beta-test cycles, can be recorded as technotes. The timeline entry for the technote can be something simple like "Version 1.2.3" perhaps with a bright color background to draw attention to the entry and the wiki content can contain release notes, for example. * <b>Blog Entries</b>. Blog entries from developers describing the current | | | | 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 | * <b>Milestones</b>. Project milestones, such as releases or beta-test cycles, can be recorded as technotes. The timeline entry for the technote can be something simple like "Version 1.2.3" perhaps with a bright color background to draw attention to the entry and the wiki content can contain release notes, for example. * <b>Blog Entries</b>. Blog entries from developers describing the current state of a project, or rationale for various design decisions, or roadmaps for future development, can be entered as technotes. * <b>Process Checkpoints</b>. For projects that have a formal process, technotes can be used to record the completion or the initiation of various process steps. For example, a technote can be used to record the successful completion of a long-running test, perhaps with performance results and details of where the test was run and who ran it recorded in the wiki content. * <b>News Articles</b>. Significant occurrences in the life cycle of a project can be recorded as news articles using technotes. Perhaps the domain name of the canonical website for a project changes, or new server hardware is obtained. Such happenings are appropriate for reporting as news. * <b>Announcements</b>. Changes to the composition of the development team or acquisition of new project sponsors can be communicated as |
︙ | ︙ |
Changes to www/fileformat.wiki.
︙ | ︙ | |||
123 124 125 126 127 128 129 | <b>Q</b> (<b>+</b>|<b>-</b>)<i>artifact-hash</i> ?<i>artifact-hash</i>?<br> <b>R</b> <i>repository-checksum</i><br> <b>T</b> (<b>+</b>|<b>-</b>|<b>*</b>)<i>tag-name</i> <b>*</b> ?<i>value</i>?<br> <b>U</b> <i>user-login</i><br> <b>Z</b> <i>manifest-checksum</i> </blockquote> | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | <b>Q</b> (<b>+</b>|<b>-</b>)<i>artifact-hash</i> ?<i>artifact-hash</i>?<br> <b>R</b> <i>repository-checksum</i><br> <b>T</b> (<b>+</b>|<b>-</b>|<b>*</b>)<i>tag-name</i> <b>*</b> ?<i>value</i>?<br> <b>U</b> <i>user-login</i><br> <b>Z</b> <i>manifest-checksum</i> </blockquote> A manifest may optionally have a single <b>B</b> card. The <b>B</b> card specifies another manifest that serves as the "baseline" for this manifest. A manifest that has a <b>B</b> card is called a delta-manifest and a manifest that omits the <b>B</b> card is a baseline-manifest. The other manifest identified by the argument of the <b>B</b> card must be a baseline-manifest. A baseline-manifest records the complete contents of a check-in. A delta-manifest records only changes from its baseline. A manifest must have exactly one <b>C</b> card. The sole argument to the <b>C</b> card is a check-in comment that describes the check-in that the manifest defines. The check-in comment is text. The following escape sequences are applied to the text: A space (ASCII 0x20) is represented as "\s" (ASCII 0x5C, 0x73). A newline (ASCII 0x0a) is "\n" (ASCII 0x5C, x6E). A backslash (ASCII 0x5C) is represented as two backslashes "\\". Apart from space and newline, no other whitespace characters are allowed in the check-in comment. Nor are any unprintable characters allowed in the comment. A manifest must have exactly one <b>D</b> card. The sole argument to the <b>D</b> card is a date-time stamp in the ISO8601 format. The date and time should be in coordinated universal time (UTC). The format one of: <blockquote> <i>YYYY</i><b>-</b><i>MM</i><b>-</b><i>DD</i><b>T</b><i>HH</i><b>:</b><i>MM</i><b>:</b><i>SS</i><br> <i>YYYY</i><b>-</b><i>MM</i><b>-</b><i>DD</i><b>T</b><i>HH</i><b>:</b><i>MM</i><b>:</b><i>SS</i><b>.</b><i>SSS</i> </blockquote> A manifest has zero or more <b>F</b> cards. Each <b>F</b> card identifies a file that is part of the check-in. There are one, two, three, or four arguments. The first argument is the pathname of the file in the check-in relative to the root of the project file hierarchy. No ".." or "." directories are allowed within the filename. Space characters are escaped as in <b>C</b> card comment text. Backslash characters and newlines are not allowed within filenames. The directory separator character is a forward slash (ASCII 0x2F). The second argument to the <b>F</b> card is the lower-case hexadecimal artifact hash of the content artifact. The second argument is required for baseline manifests but is optional for delta manifests. When the second argument to the <b>F</b> card is omitted, it means that the file has been deleted relative to the baseline (files removed in baseline manifests versions are <em>not</em> added as <b>F</b> cards). The optional 3rd argument defines any special access permissions associated with the file. This can be defined as "x" to mean that the file is executable or "l" (small letter ell) to mean a symlink. All files are always readable and writable. This can be expressed by "w" permission if desired but is optional. The file format might be extended with new permission letters in the future. The optional 4th argument is the name of the same file as it existed in the parent check-in. If the name of the file is unchanged from its parent, then the 4th argument is omitted. A manifest has zero or one <b>N</b> cards. The <b>N</b> card specifies the mimetype for the text in the comment of the <b>C</b> card. If the <b>N</b> card is omitted, a default mimetype is used. A manifest has zero or one <b>P</b> cards. Most manifests have one <b>P</b> card. The <b>P</b> card has a varying number of arguments that define other manifests from which the current manifest is derived. Each argument is a lowercase hexadecimal artifact hash of a predecessor manifest. All arguments to the <b>P</b> card must be unique within that card. The first argument is the artifact hash of the direct ancestor of the manifest. Other arguments define manifests with which the first was merged to yield the current manifest. Most manifests have a <b>P</b> card with a single argument. The first manifest in the project has no ancestors and thus has no <b>P</b> card or (depending on the Fossil version) an empty <b>P</b> card (no arguments). A manifest has zero or more <b>Q</b> cards. A <b>Q</b> card is similar to a <b>P</b> card in that it defines a predecessor to the current check-in. But whereas a <b>P</b> card defines the immediate ancestor or a merge ancestor, the <b>Q</b> card is used to identify a single check-in or a small range of check-ins which were cherry-picked for inclusion in or exclusion from the current manifest. The first argument of the <b>Q</b> card is the artifact ID of another manifest (the "target") which has had its changes included or excluded in the current manifest. The target is preceded by "+" or "-" to show inclusion or exclusion, respectively. The optional second argument to the <b>Q</b> card is another manifest artifact ID which is the "baseline" for the cherry-pick. If omitted, the baseline is the primary parent of the target. The changes included or excluded consist of all changes moving from the baseline to the target. The <b>Q</b> card was added to the interface specification on 2011-02-26. Older versions of Fossil will reject manifests that contain <b>Q</b> cards. A manifest may optionally have a single <b>R</b> card. The <b>R</b> card has a single argument which is the MD5 checksum of all files in the check-in except the manifest itself. The checksum is expressed as 32 characters of lowercase hexadecimal. The checksum is computed as follows: For each file in the check-in (except for the manifest itself) in strict sorted lexicographical order, take the pathname of the file relative to the root of the repository, append a single space (ASCII 0x20), the size of the file in ASCII decimal, a single newline character (ASCII 0x0A), and the complete text of the file. Compute the MD5 checksum of the result. A manifest might contain one or more <b>T</b> cards used to set [./branching.wiki#tags | tags or properties] on the check-in. The format of the <b>T</b> card is the same as described in <i>Control Artifacts</i> section below, except that the second argument is the single character "<b>*</b>" instead of an artifact ID. The <b>*</b> in place of the artifact ID indicates that the tag or property applies to the current artifact. It is not possible to encode the current artifact ID as part of an artifact, since the act of inserting the artifact ID would change the artifact ID, hence a <b>*</b> is used to represent "self". <b>T</b> cards are typically added to manifests in order to set the <b>branch</b> property and a symbolic name when the check-in is intended to start a new branch. Each manifest has a single <b>U</b> card. The argument to the <b>U</b> card is the login of the user who created the manifest. The login name is encoded using the same character escapes as is used for the check-in comment argument to the <b>C</b> card. A manifest must have a single <b>Z</b> card as its last line. The argument to the <b>Z</b> card is a 32-character lowercase hexadecimal MD5 hash of all prior lines of the manifest up to and including the newline character that immediately precedes the "Z", excluding any PGP clear-signing prefix. The <b>Z</b> card is a sanity check to prove that the manifest is well-formed and consistent. A sample manifest from Fossil itself can be seen [/artifact/28987096ac | here]. <a name="cluster"></a> |
︙ | ︙ | |||
268 269 270 271 272 273 274 | Allowed cards in the cluster are as follows: <blockquote> <b>M</b> <i>artifact-id</i><br /> <b>Z</b> <i>checksum</i> </blockquote> | | | | | | | | | | | | | 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 | Allowed cards in the cluster are as follows: <blockquote> <b>M</b> <i>artifact-id</i><br /> <b>Z</b> <i>checksum</i> </blockquote> A cluster contains one or more <b>M</b> cards followed by a single <b>Z</b> card. Each <b>M</b> card has a single argument which is the artifact ID of another artifact in the repository. The <b>Z</b> card works exactly like the <b>Z</b> card of a manifest. The argument to the <b>Z</b> card is the lower-case hexadecimal representation of the MD5 checksum of all prior cards in the cluster. The <b>Z</b> card is required. An example cluster from Fossil can be seen [/artifact/d03dbdd73a2a8 | here]. <a name="ctrl"></a> <h3>2.3 Control Artifacts</h3> Control artifacts are used to assign properties to other artifacts within the repository. Allowed cards in a control artifact are as follows: <blockquote> <b>D</b> <i>time-and-date-stamp</i><br /> <b>T</b> (<b>+</b>|<b>-</b>|<b>*</b>)<i>tag-name</i> <i>artifact-id</i> ?<i>value</i>?<br /> <b>U</b> <i>user-name</i><br /> <b>Z</b> <i>checksum</i><br /> </blockquote> A control artifact must have one <b>D</b> card, one <b>U</b> card, one <b>Z</b> card and one or more <b>T</b> cards. No other cards or other text is allowed in a control artifact. Control artifacts might be PGP clearsigned. The <b>D</b> card and the <b>Z</b> card of a control artifact are the same as in a manifest. The <b>T</b> card represents a [./branching.wiki#tags | tag or property] that is applied to some other artifact. The <b>T</b> card has two or three values. The second argument is the lowercase artifact ID of the artifact to which the tag is to be applied. The first value is the tag name. The first character of the tag is either "+", "-", or "*". The "+" means the tag should be added to the artifact. The "-" means the tag should be removed. The "*" character means the tag should be added to the artifact and all direct descendants (but not descendants through a merge) down to but not including the first descendant that contains a |
︙ | ︙ | |||
326 327 328 329 330 331 332 | Some tags have special meaning. The "comment" tag when applied to a check-in will override the check-in comment of that check-in for display purposes. The "user" tag overrides the name of the check-in user. The "date" tag overrides the check-in date. The "branch" tag sets the name of the branch that at check-in belongs to. Symbolic tags begin with the "sym-" prefix. | | | > | | | | | | | | | > > > > > > > | | | | | | | | | | | | | 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 | Some tags have special meaning. The "comment" tag when applied to a check-in will override the check-in comment of that check-in for display purposes. The "user" tag overrides the name of the check-in user. The "date" tag overrides the check-in date. The "branch" tag sets the name of the branch that at check-in belongs to. Symbolic tags begin with the "sym-" prefix. The <b>U</b> card is the name of the user that created the control artifact. The <b>Z</b> card is the usual required artifact checksum. An example control artifacts can be seen [/info/9d302ccda8 | here]. <a name="wikichng"></a> <h3>2.4 Wiki Pages</h3> A wiki artifact defines a single version of a single wiki page. Wiki artifacts accept the following card types: <blockquote> <b>C</b> <i>change-comment</i><br> <b>D</b> <i>time-and-date-stamp</i><br /> <b>L</b> <i>wiki-title</i><br /> <b>N</b> <i>mimetype</i><br /> <b>P</b> <i>parent-artifact-id</i>+<br /> <b>U</b> <i>user-name</i><br /> <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> <b>Z</b> <i>checksum</i> </blockquote> The <b>D</b> card is the date and time when the wiki page was edited. The <b>P</b> card specifies the parent wiki pages, if any. The <b>L</b> card gives the name of the wiki page. The optional <b>N</b> card specifies the mimetype of the wiki text. If the <b>N</b> card is omitted, the mimetype is assumed to be text/x-fossil-wiki. The <b>U</b> card specifies the login of the user who made this edit to the wiki page. The <b>Z</b> card is the usual checksum over the entire artifact and is required. The <b>W</b> card is used to specify the text of the wiki page. The argument to the <b>W</b> card is an integer which is the number of bytes of text in the wiki page. That text follows the newline character that terminates the <b>W</b> card. The wiki text is always followed by one extra newline. The <b>C</b> card on a wiki page is optional. The argument is a comment that explains why the changes was made. The ability to have a <b>C</b> card on a wiki page artifact was added on 2019-12-02 at the suggestion of user George Krivov and is not currently used or generated by the implementation. Older versions of Fossil will reject a wiki-page artifact that includes a <b>C</b> card. An example wiki artifact can be seen [/artifact?name=7b2f5fd0e0&txt=1 | here]. <a name="tktchng"></a> <h3>2.5 Ticket Changes</h3> A ticket-change artifact represents a change to a trouble ticket. The following cards are allowed on a ticket change artifact: <blockquote> <b>D</b> <i>time-and-date-stamp</i><br /> <b>J</b> ?<b>+</b>?<i>name</i> ?<i>value</i>?<br /> <b>K</b> <i>ticket-id</i><br /> <b>U</b> <i>user-name</i><br /> <b>Z</b> <i>checksum</i> </blockquote> The <b>D</b> card is the usual date and time stamp and represents the point in time when the change was entered. The <b>U</b> card is the login of the programmer who entered this change. The <b>Z</b> card is the required checksum over the entire artifact. Every ticket has a distinct ticket-id: 40-character lower-case hexadecimal number. The ticket-id is given in the <b>K</b> card. A ticket exists if it contains one or more changes. The first "change" to a ticket is what brings the ticket into existence. <b>J</b> cards specify changes to the "value" of "fields" in the ticket. If the <i>value</i> parameter of the <b>J</b> card is omitted, then the field is set to an empty string. Each fossil server has a ticket configuration which specifies the fields its understands. The ticket configuration is part of the local state for the repository and thus can vary from one repository to another. Hence a <b>J</b> card might specify a <i>field</i> that do not exist in the local ticket configuration. If a <b>J</b> card specifies a <i>field</i> that is not in the local configuration, then that <b>J</b> card is simply ignored. The first argument of the <b>J</b> card is the field name. The second value is the field value. If the field name begins with "+" then the value is appended to the prior value. Otherwise, the value on the <b>J</b> card replaces any previous value of the field. The field name and value are both encoded using the character escapes defined for the <b>C</b> card of a manifest. An example ticket-change artifact can be seen [/artifact/91f1ec6af053 | here]. <a name="attachment"></a> <h3>2.6 Attachments</h3> |
︙ | ︙ | |||
432 433 434 435 436 437 438 | <b>C</b> <i>comment</i><br /> <b>D</b> <i>time-and-date-stamp</i><br /> <b>N</b> <i>mimetype</i><br /> <b>U</b> <i>user-name</i><br /> <b>Z</b> <i>checksum</i> </blockquote> | | | | | | | | | | | | | | 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 | <b>C</b> <i>comment</i><br /> <b>D</b> <i>time-and-date-stamp</i><br /> <b>N</b> <i>mimetype</i><br /> <b>U</b> <i>user-name</i><br /> <b>Z</b> <i>checksum</i> </blockquote> The <b>A</b> card specifies a filename for the attachment in its first argument. The second argument to the <b>A</b> card is the name of the wiki page or ticket or technical note to which the attachment is connected. The third argument is either missing or else it is the lower-case artifact ID of the attachment itself. A missing third argument means that the attachment should be deleted. The <b>C</b> card is an optional comment describing what the attachment is about. The <b>C</b> card is optional, but there can only be one. A single <b>D</b> card is required to give the date and time when the attachment was applied. There may be zero or one <b>N</b> cards. The <b>N</b> card specifies the mimetype of the comment text provided in the <b>C</b> card. If the <b>N</b> card is omitted, the <b>C</b> card mimetype is taken to be text/plain. A single <b>U</b> card gives the name of the user who added the attachment. If an attachment is added anonymously, then the <b>U</b> card may be omitted. The <b>Z</b> card is the usual checksum over the rest of the attachment artifact. The <b>Z</b> card is required. <a name="event"></a> <h3>2.7 Technical Notes</h3> A technical note or "technote" artifact (formerly known as an "event" artifact) associates a timeline comment and a page of text |
︙ | ︙ | |||
478 479 480 481 482 483 484 | <b>P</b> <i>parent-artifact-id</i>+<br /> <b>T</b> <b>+</b><i>tag-name</i> <b>*</b> ?<i>value</i>?<br /> <b>U</b> <i>user-name</i><br /> <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> <b>Z</b> <i>checksum</i> </blockquote> | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | <b>P</b> <i>parent-artifact-id</i>+<br /> <b>T</b> <b>+</b><i>tag-name</i> <b>*</b> ?<i>value</i>?<br /> <b>U</b> <i>user-name</i><br /> <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> <b>Z</b> <i>checksum</i> </blockquote> The <b>C</b> card contains text that is displayed on the timeline for the technote. The <b>C</b> card is optional, but there can only be one. A single <b>D</b> card is required to give the date and time when the technote artifact was created. This is different from the time at which the technote appears on the timeline. A single <b>E</b> card gives the time of the technote (the point on the timeline where the technote is displayed) and a unique identifier for the technote. When there are multiple artifacts with the same technote-id, the one with the most recent <b>D</b> card is the only one used. The technote-id must be a 40-character lower-case hexadecimal string. The optional <b>N</b> card specifies the mimetype of the text of the technote that is contained in the <b>W</b> card. If the <b>N</b> card is omitted, then the <b>W</b> card text mimetype is assumed to be text/x-fossil-wiki, which is the Fossil wiki format. The optional <b>P</b> card specifies a prior technote with the same technote-id from which the current technote is an edit. The <b>P</b> card is a hint to the system that it might be space efficient to store one technote as a delta of the other. A technote might contain one or more <b>T</b> cards used to set [./branching.wiki#tags | tags or properties] on the technote. The format of the <b>T</b> card is the same as described in [#ctrl | Control Artifacts] section above, except that the second argument is the single character "<b>*</b>" instead of an artifact ID and the name is always prefaced by "<b>+</b>". The <b>*</b> in place of the artifact ID indicates that the tag or property applies to the current artifact. It is not possible to encode the current artifact ID as part of an artifact, since the act of inserting the artifact ID would change the artifact ID, hence a <b>*</b> is used to represent "self". The "<b>+</b>" on the name means that tags can only be add and they can only be non-propagating tags. In a technote, <b>T</b> cards are normally used to set the background display color for timelines. The optional <b>U</b> card gives name of the user who entered the technote. A single <b>W</b> card provides wiki text for the document associated with the technote. The format of the <b>W</b> card is exactly the same as for a [#wikichng | wiki artifact]. The <b>Z</b> card is the required checksum over the rest of the artifact. <a name="forum"></a> <h3>2.8 Forum Posts</h3> Forum posts are intended as a mechanism for users and developers to discuss a project. Forum posts are like messages on a mailing list. The following cards are allowed on an forum post artifact: <blockquote> <b>D</b> <i>time-and-date-stamp</i><br /> <b>G</b> <i>thread-root</i><br /> <b>H</b> <i>thread-title</i><br /> <b>I</b> <i>in-reply-to</i><br /> <b>N</b> <i>mimetype</i><br /> <b>P</b> <i>parent-artifact-id</i><br /> <b>U</b> <i>user-name</i><br /> <b>W</b> <i>size</i> <b>\n</b> <i>text</i> <b>\n</b><br /> <b>Z</b> <i>checksum</i> </blockquote> Every forum post must have either one <b>I</b> card and one <b>G</b> card or one <b>H</b> card. Forum posts are organized into topic threads. The initial post for a thread (the root post) has an <b>H</b> card giving the title or subject for that thread. The argument to the <b>H</b> card is a string in the same format as a comment string in a <b>C</b> card. All follow-up posts have an <b>I</b> card that indicates which prior post in the same thread the current forum post is replying to, and a <b>G</b> card specifying the root post for the entire thread. The argument to G and <b>I</b> cards is the artifact hash for the prior forum post to which the card refers. In theory, it is sufficient for follow-up posts to have only an <b>I</b> card, since the <b>G</b> card value could be computed by following a chain of <b>I</b> cards. However, the <b>G</b> card is required in order to associate the artifact with a forum thread in the case where an intermediate artifact in the <b>I</b> card chain is shunned or otherwise becomes unreadable. A single <b>D</b> card is required to give the date and time when the forum post was created. The optional <b>N</b> card specifies the mimetype of the text of the technote that is contained in the <b>W</b> card. If the <b>N</b> card is omitted, then the <b>W</b> card text mimetype is assumed to be text/x-fossil-wiki, which is the Fossil wiki format. The optional <b>P</b> card specifies a prior forum post for which this forum post is an edit. For display purposes, only the child post is shown, though the historical post is retained as a record. If <b>P</b> cards are used and there exist multiple versions of the same forum post, then <b>I</b> cards for other artifacts refer to whichever version of the post was current at the time the reply was made, but <b>G</b> cards refer to the initial, unedited root post for the thread. Thus, following the chain of <b>I</b> cards back to the root of the thread may land on a different post than the one given in the <b>G</b> card. However, following the chain of <b>I</b> cards back to the thread root, then following <b>P</b> cards back to the initial version of the thread root must give the same artifact as is provided by the <b>G</b> card, otherwise the artifact containing the <b>G</b> card is considered invalid and should be ignored. In general, <b>P</b> cards may contain multiple arguments, indicating a merge. But since forum posts cannot be merged, the <b>P</b> card of a forum post may only contain a single argument. The <b>U</b> card gives name of the user who entered the forum post. A single <b>W</b> card provides wiki text for the forum post. The format of the <b>W</b> card is exactly the same as for a [#wikichng | wiki artifact]. The <b>Z</b> card is the required checksum over the rest of the artifact. <a name="summary"></a> <h2>3.0 Card Summary</h2> The following table summarizes the various kinds of cards that appear on Fossil artifacts. A blank entry means that combination of card and |
︙ | ︙ | |||
651 652 653 654 655 656 657 | <td> </td> </tr> <tr> <td><b>C</b> <i>comment-text</i></td> <td align=center><b>1</b></td> <td> </td> <td> </td> | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | <td> </td> </tr> <tr> <td><b>C</b> <i>comment-text</i></td> <td align=center><b>1</b></td> <td> </td> <td> </td> <td align=center><b>0-1</b></td> <td> </td> <td align=center><b>0-1</b></td> <td align=center><b>0-1</b></td> <td> </td> </tr> <tr> <td><b>D</b> <i>date-time-stamp</i></td> |
︙ | ︙ | |||
866 867 868 869 870 871 872 | This section contains additional information which may be useful when implementing algorithms described above. <h3>4.1 R-Card Hash Calculation</h3> Given a manifest file named <tt>MF</tt>, the following Bash shell code | | | 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | This section contains additional information which may be useful when implementing algorithms described above. <h3>4.1 R-Card Hash Calculation</h3> Given a manifest file named <tt>MF</tt>, the following Bash shell code demonstrates how to compute the value of the <b>R</b> card in that manifest. This example uses manifest [28987096ac]. Lines starting with <tt>#</tt> are shell input and other lines are output. This demonstration assumes that the file versions represented by the input manifest are checked out under the current directory. <nowiki><pre> # head MF |
︙ | ︙ | |||
898 899 900 901 902 903 904 | </pre></nowiki> Minor caveats: the above demonstration will work only when none of the filenames in the manifest are "fossilized" (encoded) because they contain spaces. In that case the shell-generated hash would differ because the <tt>stat</tt> calls will fail to find such files (which are output in encoded form here). That approach also won't work for delta manifests. Calculating | | | 906 907 908 909 910 911 912 913 914 915 | </pre></nowiki> Minor caveats: the above demonstration will work only when none of the filenames in the manifest are "fossilized" (encoded) because they contain spaces. In that case the shell-generated hash would differ because the <tt>stat</tt> calls will fail to find such files (which are output in encoded form here). That approach also won't work for delta manifests. Calculating the <b>R</b> card for delta manifests requires traversing both the delta and its baseline in lexical order of the files, preferring the delta's copy if both contain a given file. |
Changes to www/fiveminutes.wiki.
︙ | ︙ | |||
63 64 65 66 67 68 69 | <p>fossil finfo myfile: Note the first hash, which is the UUID of the commit when the file was committed</p> <p>fossil gdiff --from UUID#1 --to UUID#2 myfile.c</p> <h2>Cancel changes and go back to previous revision</h2> <p>fossil revert myfile.c</p> <p>Fossil does not prompt when reverting a file. It simply reminds the user about the "undo" command, just in case the revert was a mistake.</p> | < < < < < < < | 63 64 65 66 67 68 69 | <p>fossil finfo myfile: Note the first hash, which is the UUID of the commit when the file was committed</p> <p>fossil gdiff --from UUID#1 --to UUID#2 myfile.c</p> <h2>Cancel changes and go back to previous revision</h2> <p>fossil revert myfile.c</p> <p>Fossil does not prompt when reverting a file. It simply reminds the user about the "undo" command, just in case the revert was a mistake.</p> |
Changes to www/forum.wiki.
︙ | ︙ | |||
57 58 59 60 61 62 63 | or back to the office before you can search for past posts. * <b>Contribute Off-Line:</b> Fossil forum posts work like any other insertion into the repository, so a user can create new threads and reply to existing ones while off-line, then sync their contributions to the server they cloned from when back on-line. Yes, you can post to the forum from inside a tent, miles from the | | | | | | | 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 | or back to the office before you can search for past posts. * <b>Contribute Off-Line:</b> Fossil forum posts work like any other insertion into the repository, so a user can create new threads and reply to existing ones while off-line, then sync their contributions to the server they cloned from when back on-line. Yes, you can post to the forum from inside a tent, miles from the nearest WiFi router or cellular data tower. * <b>Interlink with Other Fossil-Managed Artifacts:</b> Because forum posts are normal Fossil artifacts, you can interlink them with other Fossil artifacts using short internal links: link to forum threads from a [./tickets.wiki | ticket], link to a wiki document from a forum post, etc. * <b>Durable Links:</b> Once you create a valid internal artifact link in Fossil, it <em>remains</em> valid, durably. With third-party forum software and mailing list search engines, your links are only valid until the third-party component changes its URL scheme or disappears from the web. * <b>Role-Based Access Control:</b> The forum uses the same [./caps/ | capability-based access control system] that Fossil uses to control all other repository accesses. The Fossil forum feature simply adds [./caps/ref.html#2 | several new fine-grained capabilities] to the existing system. * <b>Enduring, Open File Format:</b> Since Fossil has an [./fileformat.wiki | open and well-documented file format], your discussion archives are truly that: <em>archives</em>. You are no longer dependent on the lifetime and business model of a third-party piece of software or service. Should you choose to stop using Fossil, you can easily extract your discussion traffic for |
︙ | ︙ | |||
107 108 109 110 111 112 113 | digest delivery. <h2 id="setup">Setting up a Fossil Forum</h2> <h3 id="caps">Capabilities</h3> | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > > | | | | | > | | | 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 | digest delivery. <h2 id="setup">Setting up a Fossil Forum</h2> <h3 id="caps">Capabilities</h3> By default, no Fossil user has permission to use the forums except for users with Setup and Admin capabilities, which get these as part of the large package of other capabilities they get. For public Fossil repositories that wish to accept new users without involving a human, go into Admin → Access and enable the "Allow users to register themselves" setting. You may also wish to give users in [./caps/#ucat | the <tt>anonymous</tt> user category] the <b>[./caps/ref.html#2 | RdForum]</b> and <b>[./caps/ref.html#3 | WrForum]</b> capabilities: this allows people to post without creating an account simply by solving [./antibot.wiki | a simple CAPTCHA]. For a private repository, you probably won't want to give the <tt>anonymous</tt> user any forum access, but you may wish to give the <b>RdForum</b> capability to users in the <tt>reader</tt> category. For either type of repository, you are likely to want to give at least the <b>[./caps/ref.html#4 | WrTForum]</b> capability to users in the <tt>developer</tt> category. If you did not give the <b>RdForum</b> capability to <tt>anonymous</tt> above, you should give <tt>developer</tt> that capability here if you choose to give it <b>WrForum</b> or <b>WrTForum</b> capability. If you want to use the email alert feature, by default only those users in the Setup and Admin user categories can make use of it. Grant the <b>[./caps/ref.html#7 | EmailAlert]</b> capability to give others access to this feature. Alternately, you can handle alert signups outside of Fossil, with a Setup or Admin users manually signing users up via Admin → Notification. You'll want to grant this capability to the <tt>nobody</tt> user category if you want anyone to sign up without any restrictions. Give it to <tt>anonymous</tt> instead if you want the user to solve a simple CAPTCHA before signing up. Or, give it to <tt>reader</tt> or <tt>developer</tt> if you want only users with Fossil logins to have this ability. (That's assuming you give one or both of these capabilities to every user on your Fossil repository.) By following this advice, you should not need to tediously add capabilities to individual accounts except in atypical cases, such as to grant the <b>[./caps/ref.html#5 | ModForum]</b> capability to an uncommonly highly-trusted user. <h3 id="skin">Skin Setup</h3> If you create a new Fossil repository with version 2.7 or newer, its default skin is already set up correctly for typical forum |
︙ | ︙ | |||
208 209 210 211 212 213 214 | <verbatim> if {[anycap 23456] || [anoncap 2] || [anoncap 3]} { menulink /forum Forum } </verbatim> | | | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | <verbatim> if {[anycap 23456] || [anoncap 2] || [anoncap 3]} { menulink /forum Forum } </verbatim> These rules say that any logged-in user with any [./caps/ref.html#2 | forum-related capability] or an anonymous user <b>RdForum</b> or <b>WrForum</b> capability will see the "Forum" navbar link, which just takes you to <tt>/forum</tt>. The exact code you need here varies depending on which skin you're using. Follow the style you see for the other navbar links. The new forum feature also brings many new CSS styles to the table. If you're using the stock skin or something sufficiently close, the changes |
︙ | ︙ | |||
301 302 303 304 305 306 307 | participating in the forum have special capability bits for project assets managed by Fossil, so you wish to segregate the two user sets. Yet, what of the users who will have logins on both repositories? Some users will be trusted with access to the project's main Fossil repository, and these users will probably also participate in the project's Fossil-hosted forum. Fossil has a feature to solve this | | < < < | | | | < < | | | | 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 | participating in the forum have special capability bits for project assets managed by Fossil, so you wish to segregate the two user sets. Yet, what of the users who will have logins on both repositories? Some users will be trusted with access to the project's main Fossil repository, and these users will probably also participate in the project's Fossil-hosted forum. Fossil has a feature to solve this problem: [./caps/login-groups.md | login groups]. <h3 id="alerts">Email Alerts (a.k.a. Notifications)</h3> Internet email service has become rather complicated since its initial simple and insecure implementation decades ago. Fossil's role in all of this is rather small at the moment, but the details of the integration are complex enough to justify [./alerts.md | a separate document]. (The other reason that document is separate is that Fossil's email alerts system also gets used by features of Fossil other than the forum.) <h2 id="access">Accessing the Forum</h2> There are many paths to a repository's Fossil forum: <ul> <li> If you're using the default Fossil skin as shipped with Fossil 2.7+ or one [#skin | updated] to support it, there is a Forum button in the navbar which appears for users able to access the forum. With the default skin, that button will only appear if the user's browser window is at least 1200 pixels wide. The Fossil admin can adjust this limit in the skin's CSS section, down near the bottom in the definition of the `wideonly` style. </li> <li>The other stock skins have this button in them as of 2.7 as well, without the screen width restriction, since the navbar in those skins wraps on narrow screens more gracefully than the default skin does.</li> |
︙ | ︙ | |||
366 367 368 369 370 371 372 | In this section, we're going to call all of the following a "forum update:" * create a new post * reply to an existing post * edit a post or reply | | | | < | | | | | | | 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 | In this section, we're going to call all of the following a "forum update:" * create a new post * reply to an existing post * edit a post or reply When a person with the normal <b>WrForum</b> capability updates the forum, Fossil saves the update in its block chain, but this update is impermanent because of two other table updates made at the same time: <ol> <li>Fossil saves the update artifact's ID in its <tt>private</tt> table, preventing Fossil from sending such artifacts to any of the repository's clones. (This is the same mechanism behind [./private.wiki | private branches].)</li> <li>Fossil also adds a reference to that artifact in the <tt>modreq</tt> table, which backs the moderation feature. This is what causes Fossil to leave out the Reply button when rendering that post's HTML in the forum's web interface.</li> </ol> When a moderator approves an update, Fossil deletes these table entries, making the update [./shunning.wiki | semi-permanent]. This changes how Fossil renders the HTML for that update. It also means the artifact will now sync to users with <b>[./caps/ref.html#g | Clone]</b> capability. When a forum user edits a moderator-approved artifact, what actually happens under the hood is that Fossil writes another artifact to the repository which refers to the original version as its parent, causing Fossil UI to present the new version instead of the original. The original version remains in the repository, just as with historical checkins. The parent must remain in the repository for referential integrity purposes. When you "Delete" a moderator-approved post or reply through Fossil UI, it's actually an edit with blank replacement content. The only way to truly delete such artifacts is through [./shunning.wiki | shunning]. When a user with <b>WrTForum</b> capability updates the forum, it happens in the same way except that Fossil skips the <tt>private</tt> and <tt>modreq</tt> table insertions. When a moderator rejects an update, that artifact is unceremoniously removed from the tip of the block chain. This is safe because Fossil prevents replies to a reply or post awaiting moderator approval, so referential integrity cannot be harmed. Rejecting an edit is even safer, since the original post remains behind, so that replies continue to refer to that original post. <h2 id="mod-user">Using the Moderation Feature</h2> Having described all of the work that Fossil performs under the hood on behalf of its users, we can now give the short list of work left for the repository's administrators and moderators: <ol> <li>Add the <b>[./caps/ref.html#5 | ModForum]</b> capability to any of your users who should have this ability. You don't need to do this for any user with <b>[./caps/ref.html#s | Setup]</b> or <b>[./caps/ref.html#a | Admin]</b> capability; it's [http://fossil-scm.org/index.html/artifact/b16221ffb736caa2?ln=1246-1257 | already included].</li> <li>When someone updates the forum, an entry will appear in the timeline if the type filter is set to "Forum" or "Any Type". If that user has only the <b>WrForum</b> capability, any other user with the <b>ModForum</b> capability will see a conditional link appear at the top of the main forum page: "Moderation Requests". Clicking this takes the moderator to the <tt>/modreq</tt> page. A moderator may wish to keep the main forum page open in a browser tab, reloading it occasionally to see when the "Moderation Requests" link reappears.</li> <li>A moderator viewing an update pending moderation sees two buttons at the bottom, "Approve" and "Reject" in place of the "Delete" button that the post's creator sees. Beware that both actions are durable and have no undo. Be careful!</li> </ol> |
Changes to www/fossil-v-git.wiki.
1 2 3 4 | <title>Fossil Versus Git</title> <h2>1.0 Don't Stress!</h2> | > > > > > > > > > > > > | | < > | | < > | < < < | > | > > > | > > > > > > | > > | > > > > > > > | > > > | | > | > > > > > > > > > > > | | > > > | | > | > > > > > > > > > > | | | | > > > > | | | > > > | > > > > > | | > > > > > > > > > | > > > > > > > | > | > > > > > > > | > > > > > > > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | > > | | | > > | | | | | | > > > > | | > | > > > | > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > > | > > > | < > > > > | | > | > > > > > | > > > > | > | > | > > | > | > > > > > > | < | > > > > > > > > > > | > > | > > | > > > | > > > | > > > > > > > > > > > > > | > > > > > > > > > > > > > | | < > | > > > > > > > > > > > | > > > > > | > > > > | > > | > > > > > > > > > | > > > > > > > > > > > > > > | > > > > > > | > > | > | > | > | > > > > > | > > > | > > > > > > | | > | > > > > > > > > > | < | > | > > > > > > | > > > > > > > > > > | > > > > > > > > > | > > > | > > > > > > > | > > > > > > > > | | > | > > > | > > > > > > > > > > > > > > > > > > > > | | > | > > > | > > > > > > > | > > > > > > > > > > > | > > > > > > < | > < > > > > | > > > > > > > > > > > > | | > > > > > | > > > > | | | | > > > > > > > > | > | > | < > > > > > > | > | < > > > > > > > > > > > > > < < < | | | | | < < < | > > > | | | | > > > > | > > > > > < < < | | < < | > > > > | | < < > > | > > < > > > > > > | > > > > > > > > > > | > | > > > > > > > > > | > | > > | < | < > > > > > | < > < > > > > > > < < < < < | < > > > > > > > | > | | > > > > | > | < > | | > > > > > | | < | > | | < > > | > > | > > > | < < < > > > > > > > > > > > > | < > > > > > | < < > > | 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 | <title>Fossil Versus Git</title> <h2>1.0 Don't Stress!</h2> The feature sets of Fossil and [http://git-scm.com | Git] overlap in many ways. Both are [https://en.wikipedia.org/wiki/Distributed_version_control | distributed version control systems] which store a tree of check-in objects to a local repository clone. In both systems, the local clone starts out as a full copy of the remote parent. New content gets added to the local clone and then later optionally pushed up to the remote, and changes to the remote can be pulled down to the local clone at will. Both systems offer diffing, patching, branching, merging, cherry-picking, bisecting, private branches, a stash, etc. Fossil has inbound and outbound Git conversion features, so if you start out using one DVCS and later decide you like the other better, you can easily [./inout.wiki | move your version-controlled file content].¹ In this document, we set all of that similarity and interoperability aside and focus on the important differences between the two, especially those that impact the user experience. Keep in mind that you are reading this on a Fossil website, and though we try to be fair, the information here might be biased in favor of Fossil, if only because we spend most of our time using Fossil, not Git. Ask around for second opinions from people who have used <em>both</em> Fossil and Git. <h2>2.0 Differences Between Fossil And Git</h2> Differences between Fossil and Git are summarized by the following table, with further description in the text that follows. <blockquote><table border=1 cellpadding=5 align=center> <tr><th width="49%">GIT</th><th width="49%">FOSSIL</th><th width="2%">more</th></tr> <tr> <td>File versioning only</td> <td>VCS, tickets, wiki, docs, notes, forum, UI, [https://en.wikipedia.org/wiki/Role-based_access_control|RBAC]</td> <td><a href="#features">2.1 ↓</a></td> </tr> <tr> <td>Sprawling, incoherent, and inefficient</td> <td>Self-contained and efficient</td> <td><a href="#efficient">2.2 ↓</a></td> </tr> <tr> <td>Ad-hoc pile-of-files key/value database</td> <td>[https://sqlite.org/famous.html|The most popular database in the world]</td> <td><a href="#durable">2.3 ↓</a></td> </tr> <tr> <td>Portable to POSIX systems only</td> <td>Runs just about anywhere</td> <td><a href="#portable">2.4 ↓</a></td> </tr> <tr> <td>Bazaar-style development</td> <td>Cathedral-style development</td> <td><a href="#devorg">2.5.1 ↓</a></td> </tr> <tr> <td>Designed for Linux kernel development</td> <td>Designed for SQLite development</td> <td><a href="#scale">2.5.2 ↓</a></td> </tr> <tr> <td>Many contributors</td> <td>Select contributors</td> <td><a href="#contrib">2.5.3 ↓</a></td> </tr> <tr> <td>Focus on individual branches</td> <td>Focus on the entire tree of changes</td> <td><a href="#branches">2.5.4 ↓</a></td> </tr> <tr> <td>One check-out per repository</td> <td>Many check-outs per repository</td> <td><a href="#checkouts">2.6 ↓</a></td> </tr> <tr> <td>Remembers what you should have done</td> <td>Remembers what you actually did</td> <td><a href="#history">2.7 ↓</a></td> </tr> <tr> <td>Commit first</td> <td>Test first</td> <td><a href="#testing">2.8 ↓</a></td> </tr> <tr> <td>SHA-2</td> <td>SHA-3</td> <td><a href="#hash">2.9 ↓</a></td> </tr> </table></blockquote> <h3 id="features">2.1 Featureful</h3> Git provides file versioning services only, whereas Fossil adds an integrated [./wikitheory.wiki | wiki], [./bugtheory.wiki | ticketing & bug tracking], [./embeddeddoc.wiki | embedded documentation], [./event.wiki | technical notes], and a [./forum.wiki | web forum], all within a single nicely-designed [./customskin.md|skinnable] web [/help?cmd=ui|UI], protected by [./caps/ | a fine-grained role-based access control system]. These additional capabilities are available for Git as 3rd-party add-ons, but with Fossil they are integrated into the design. One way to describe Fossil is that it is "[https://github.com/ | GitHub]-in-a-box." Fossil can do operations over all local repo clones and check-out directories with a single command. For example, Fossil lets you say <tt>fossil all pull</tt> on a laptop prior to taking it off the network hosting those repos. You can sync up to all of the private repos on your company network plus those public Internet-hosted repos you use. Whether going out for a working lunch or on a transoceanic an airplane trip, one command gets you in sync. This works with several other Fossil sub-commands, such as <tt>fossil all changes</tt> to get a list of files that you forgot to commit prior to the end of your working day, across all repos. Whenever Fossil is told to modify the local checkout in some destructive way ([/help?cmd=rm|fossil rm], [/help?cmd=update|fossil update], [/help?cmd=revert|fossil revert], etc.) Fossil remembers the prior state and is able to return the check-out directory to that state with a <tt>fossil undo</tt> command. You cannot undo a commit in Fossil ([#history | on purpose!]) but as long as the change remains confined to the local check-out directory only, Fossil makes undo [https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things|easier than in Git]. For developers who choose to self-host projects (rather than using a 3rd-party service such as GitHub) Fossil is much easier to set up, since the stand-alone Fossil executable together with a [./server/any/cgi.md|2-line CGI script] suffice to instantiate a full-featured developer website. To accomplish the same using Git requires locating, installing, configuring, integrating, and managing a wide assortment of separate tools. Standing up a developer website using Fossil can be done in minutes, whereas doing the same using Git requires hours or days. Fossil is small, complete, and self-contained. If you clone [https://github.com/git/git|Git's self-hosting repository], you get just Git's source code. If you clone Fossil's self-hosting repository, you get the entire Fossil website — source code, documentation, ticket history, and so forth.² That means you get a copy of this very article and all of its historical versions, plus the same for all of the other public content on this site. <h3 id="efficient" name="effective">2.2 Efficient</h3> Git is actually a collection of many small tools, each doing one small part of the job, which can be recombined (by experts) to perform powerful operations. Git has a lot of complexity and many dependencies, so that most people end up installing it via some kind of package manager, simply because the creation of complicated binary packages is best delegated to people skilled in their creation. Normal Git users are not expected to build Git from source and install it themselves. Fossil is a single self-contained stand-alone executable which by default depends only on common platform libraries. If your platform allows static linking — not all do these days! — you can even get it down to a single executable with no external dependencies at all. Most notably, we deliver the official Windows builds of Fossil this way: the Zip file contains only <tt>fossil.exe</tt>, a self-contained Fossil executable; it is not a <tt>setup.exe</tt> style installer, it is the whole enchilada. A typical Fossil executable is about 5 MiB, not counting system libraries it shares in common with Git such as OpenSSL and zlib, which we can factor out of the discussion. These properties allow Fossil to easily run inside a minimally configured [https://en.wikipedia.org/wiki/Chroot|chroot jail], from a Windows memory stick, off a Raspberry Pi with a tiny SD card, etc. To install Fossil, one merely puts the executable somewhere in the <tt>$PATH</tt>. Fossil is [https://fossil-scm.org/fossil/doc/trunk/www/build.wiki|straightforward to build and install], so that many Fossil users do in fact build and install "trunk" versions to get new features between formal releases. Contrast a basic installation of Git, which takes up about 15 MiB on Debian 10 across 230 files, not counting the contents of <tt>/usr/share/doc</tt> or <tt>/usr/share/locale</tt>. If you need to deploy to any platform where you cannot count facilities like the POSIX shell, Perl interpreter, and Tcl/Tk platform needed to fully use Git as part of the base platform, the full footprint of a Git installation extends to more like 45 MiB and thousands of files. This complicates several common scenarios: Git for Windows, chrooted Git servers, Docker images... Some say that Git more closely adheres to the Unix philosophy, summarized as "many small tools, loosely joined," but we have many examples of other successful Unix software that violates that principle to good effect, from Apache to Python to ZFS. We can infer from that that this is not an absolute principle of good software design. Sometimes "many features, tightly-coupled" works better. What actually matters is effectiveness and efficiency. We believe Fossil achieves this. The above size comparisons aren't apples-to-apples anyway. We've compared the size of Fossil with all of its [#features | many built-in features] to a fairly minimal Git installation. You must add a lot of third-party software to Git to give it a Fossil-equivalent feature set. Consider [https://about.gitlab.com/|GitLab], a third-party extension to Git wrapping it in many features, making it roughly Fossil-equivalent, though [https://docs.gitlab.com/ee/install/requirements.html|much more resource hungry] and hence more costly to run than the equivalent Fossil setup. GitLab's basic requirements are easy to accept when you're dedicating a local rack server or blade to it, since its minimum requirements are more or less a description of the smallest thing you could call a "server" these days, but when you go to host that in the cloud, you can expect to pay about 8× as much to comfortably host GitLab as for Fossil.³ This difference is largely due to basic technology choices: Ruby and PostgreSQL vs C and SQLite. The Fossil project itself is [./selfhost.wiki|hosted on a very small VPS], and we've received many reports on the Fossil forum about people successfully hosting Fossil service on bare-bones $5/month VPS hosts, spare Raspberry Pi boards, and other small hosts. <h3 id="durable" name="database">2.3 Durable</h3> The baseline data structures for Fossil and Git are the same, modulo formatting details. Both systems manage a [https://en.wikipedia.org/wiki/Directed_acyclic_graph | directed acyclic graph] (DAG) of [https://en.wikipedia.org/wiki/Merkle_tree | Merkle tree] / [./blockchain.md | block chain] structured check-in objects. Check-ins are identified by a cryptographic hash of the check-in comment, and each check-in refers to its parent via <i>its</i> hash. The difference is that Git stores its objects as individual files in the <tt>.git</tt> folder or compressed into bespoke [https://git-scm.com/book/en/v2/Git-Internals-Packfiles|pack-files], whereas Fossil stores its objects in a [https://www.sqlite.org/|SQLite] database file using a hybrid NoSQL/relational data model of the check-in history. Git's data storage system is an ad-hoc pile-of-files key/value database, whereas Fossil uses a proven, [https://sqlite.org/testing.html|heavily-tested], general-purpose, [https://sqlite.org/transactional.html|durable] SQL database. This difference is more than an implementation detail. It has important practical consequences. With Git, one can easily locate the ancestors of a particular check-in by following the pointers embedded in the check-in object, but it is difficult to go the other direction and locate the descendants of a check-in. It is so difficult, in fact, that neither native Git nor GitHub provide this capability short of [http://catb.org/jargon/html/G/grovel.html|groveling] the [https://www.git-scm.com/docs/git-log|commit log]. With Git, if you are looking at some historical check-in then you cannot ask "What came next?" or "What are the children of this check-in?" Fossil, on the other hand, parses essential information about check-ins (parents, children, committers, comments, files changed, etc.) into a relational database that can be easily queried using concise SQL statements to find both ancestors and descendants of a check-in. This is the hybrid data model mentioned above: Fossil manages your check-in and other data in a NoSQL block chain structured data store, but that's backed by a set of relational lookup tables for quick indexing into that artifact store. (See "[./theory1.wiki|Thoughts On The Design Of The Fossil DVCS]" for more details.) Leaf check-ins in Git that lack a "ref" become "detached," making them difficult to locate and subject to garbage collection. This [http://gitfaq.org/articles/what-is-a-detached-head.html|detached head state] problem has caused untold grief for countless Git users. With Fossil, detached heads are simply impossible because we can always find our way back into the block chain using one or more of the relational indices it automatically manages for you. This design difference shows up in several other places within each tool. It is why Fossil's [/help?cmd=timeline|timeline] is generally more detailed yet more clear than those available in Git front-ends. (Contrast [/timeline?c=6df7a853ec16865b|this Fossil timeline] with [https://github.com/drhsqlite/fossil-mirror/commits/master?after=f720c106d297ca1f61bccb30c5c191b88a626d01+34|its closest equivalent in GitHub].) It's why there is no inverse of the cryptic <tt>@~</tt> notation in Git, meaning "the parent of HEAD," which Fossil simply calls "prev", but there <i>is</i> a "next" [./checkin_names.wiki|special check-in name] in Fossil. It is why Fossil has so many [./webpage-ex.md|built-in status reports] to help maintain situational awareness, aid comprehension, and avoid errors. These differences are due, in part, to Fossil's start a year later than Git: we were able to learn from its key design mistakes. <h3 id="portable">2.4 Portable</h3> Fossil is largely written in ISO C, almost purely conforming to the original 1989 standard. We make very little use of [https://en.wikipedia.org/wiki/C99|C99], and we do not knowingly make any use of [https://en.wikipedia.org/wiki/C11_(C_standard_revision)|C11]. Fossil does call POSIX and Windows APIs where necessary, but it's about as portable as you can ask given that ISO C doesn't define all of the facilities Fossil needs to do its thing. (Network sockets, file locking, etc.) There are certainly well-known platforms Fossil hasn't been ported to yet, but that's most likely due to lack of interest rather than inherent difficulties in doing the port. We believe the most stringent limit on its portability is that it assumes at least a 32-bit CPU and several megs of flat-addressed memory.⁴ Fossil isn't quite as [https://www.sqlite.org/custombuild.html|portable as SQLite], but it's close. Over half of the C code in Fossil is actually an embedded copy of the current version of SQLite. Much of what is Fossil-specific after you set SQLite itself aside is SQL code calling into SQLite. The number of lines of SQL code in Fossil isn't large by percentage, but since SQL is such an expressive, declarative language, it has an outsized contribution to Fossil's user-visible functionality. Fossil isn't entirely C and SQL code. Its web UI [./javascript.md | uses JavaScript where necessary]. The server-side UI scripting uses a custom minimal [https://en.wikipedia.org/wiki/Tcl|Tcl] dialect called [https://www.fossil-scm.org/xfer/doc/trunk/www/th1.md|TH1], which is embedded into Fossil itself. Fossil's build system and test suite are largely based on Tcl.⁵ All of this is quite portable. About half of Git's code is POSIX C, and about a third is POSIX shell code. This is largely why the so-called "Git for Windows" distributions (both [https://git-scm.com/download/win|first-party] and [https://gitforwindows.org/|third-party]) are actually an [http://mingw.org/wiki/msys|MSYS POSIX portability environment] bundled with all of the Git stuff, because it would be too painful to port Git natively to Windows. Git is a foreign citizen on Windows, speaking to it only through a translator.⁶ While Fossil does lean toward POSIX norms when given a choice — LF-only line endings are treated as first-class citizens over CR+LF, for example — the Windows build of Fossil is truly native. The third-party extensions to Git tend to follow this same pattern. [http://mingw.org/wiki/msys|GitLab isn't portable to Windows at all], for example. For that matter, GitLab isn't even officially supported on macOS, the BSDs, or uncommon Linuxes! We have many users who regularly build and run Fossil on all of these systems. <h3 id="vs-linux">2.5 Linux vs. SQLite</h3> Fossil and Git promote different development styles because each one was specifically designed to support the creator's main software development project: [https://en.wikipedia.org/wiki/Linus_Torvalds|Linus Torvalds] designed Git to support development of [https://www.kernel.org/|the Linux kernel], and [https://en.wikipedia.org/wiki/D._Richard_Hipp|D. Richard Hipp] designed Fossil to support the development of [https://sqlite.org/|SQLite]. Both projects must rank high on any objective list of "most important FOSS projects," yet these two projects are almost entirely unlike one another, so it is natural that the DVCSes created to support these projects also differ in many ways. In the following sections, we will explain how four key differences between the Linux and SQLite software development projects dictated the design of each DVCS's low-friction usage path. When deciding between these two DVCSes, you should ask yourself, "Is my project more like Linux or more like SQLite?" <h4 id="devorg">2.5.1 Development Organization</h4> Eric S. Raymond's seminal essay-turned-book "[https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar|The Cathedral and the Bazaar]" details the two major development organization styles found in [https://en.wikipedia.org/wiki/Free_and_open-source_software|FOSS] projects. As it happens, Linux and SQLite fall on opposite sides of this dichotomy. Differing development organization styles dictate a different design and low-friction usage path in the tools created to support each project. Git promotes the Linux kernel's bazaar development style, in which a loosely-associated mass of developers contribute their work through [https://git-scm.com/book/en/v2/Distributed-Git-Distributed-Workflows#_dictator_and_lieutenants_workflow|a hierarchy of lieutenants] who manage and clean up these contributions for consideration by Linus Torvalds, who has the power to cherry-pick individual contributions into his version of the Linux kernel. Git allows an anonymous developer to rebase and push specific locally-named private branches, so that a Git repo clone often isn't really a clone at all: it may have an arbitrary number of differences relative to the repository it originally cloned from. Git encourages siloed development. Select work in a developer's local repository may remain private indefinitely. All of this is exactly what one wants when doing bazaar-style development. Fossil's normal mode of operation differs on every one of these points, with the specific designed-in goal of promoting SQLite's cathedral development model: <ul> <li><p><b>Personal engagement:</b> SQLite's developers know each other by name and work together daily on the project.</p></li> <li><p><b>Trust over hierarchy:</b> SQLite's developers check changes into their local repository, and these are immediately and automatically synchronized up to the central repository; there is no "[https://git-scm.com/book/en/v2/Distributed-Git-Distributed-Workflows#_dictator_and_lieutenants_workflow|dictator and lieutenants]" hierarchy as with Linux kernel contributions. D. Richard Hipp rarely overrides decisions made by those he has trusted with commit access on his repositories. Fossil allows you to give [./caps/admin-v-setup.md|some users] more power over what they can do with the repository, but Fossil [./caps/index.md#ucap | only loosely supports] the enforcement of a development organization's social and power hierarchies. Fossil is a great fit for [https://en.wikipedia.org/wiki/Flat_organization|flat organizations].</p></li> <li><p><b>No easy drive-by contributions:</b> Git [https://www.git-scm.com/docs/git-request-pull|pull requests] offer a low-friction path to accepting [https://www.jonobacon.com/2012/07/25/building-strong-community-structural-integrity/|drive-by contributions]. Fossil's closest equivalent is its unique [/help?cmd=bundle|bundle] feature, which requires higher engagement than firing off a PR.⁷ This difference comes directly from the initial designed purpose for each tool: the SQLite project doesn't accept outside contributions from previously-unknown developers, but the Linux kernel does.</p></li> <li><p><b>No rebasing:</b> When your local repo clone syncs changes up to its parent, those changes are sent exactly as they were committed locally. [#history|There is no rebasing mechanism in Fossil, on purpose.]</p></li> <li><p><b>Sync over push:</b> Explicit pushes are uncommon in Fossil-based projects: the default is to rely on [/help?cmd=autosync|autosync mode] instead, in which each commit syncs immediately to its parent repository. This is a mode so you can turn it off temporarily when needed, such as when working offline. Fossil is still a truly distributed version control system; it's just that its starting default is to assume you're rarely out of communication with the parent repo. <br><br> This is not merely a reflection of modern always-connected computing environments. It is a conscious decision in direct support of SQLite's cathedral development model: we don't want developers going dark, then showing up weeks later with a massive bolus of changes for us to integrate all at once. [https://en.wikipedia.org/wiki/Jim_McCarthy_(author)|Jim McCarthy] put it well in his book on software project management, <i>[https://www.amazon.com/dp/0735623198/|Dynamics of Software Development]</i>: "[https://www.youtube.com/watch?v=oY6BCHqEbyc|Beware of a guy in a room]."</p></li> <li><p><b>Branch names sync:</b> Unlike in Git, branch names in Fossil are not purely local labels. They sync along with everything else, so everyone sees the same set of branch names. Fossil's design choice here is a direct reflection of the Linux vs. SQLite project outlook: SQLite's developers collaborate closely on a single coherent project, whereas Linux's developers go off on tangents and occasionally sync changes up with each other.</p></li> <li><p><b>Private branches are rare:</b> [/doc/trunk/www/private.wiki|Private branches exist in Fossil], but they're normally used to handle rare exception cases, whereas in many Git projects, they're part of the straight-line development process.</p></li> <li><p><b>Identical clones:</b> Fossil's autosync system tries to keep each local clone identical to the repository it cloned from.</p></li> </ul> Where Git encourages siloed development, Fossil fights against it. Fossil places a lot of emphasis on synchronizing everyone's work and on reporting on the state of the project and the work of its developers, so that everyone — especially the project leader — can maintain a better mental picture of what is happening, leading to better situational awareness. You can think about this difference in terms of [https://en.wikipedia.org/wiki/Feedback | feedback loop size], which we know from the mathematics of [https://en.wikipedia.org/wiki/Control_theory | control theory] to directly affect the speed at which any system can safely make changes. The larger the feedback loop, the slower the whole system must run in order to avoid loss of control. The same concept shows up in other contexts, such as in the [https://en.wikipedia.org/wiki/OODA_loop | OODA loop] concept originally developed to explain the success of the US F-86 Sabre fighter aircraft over the on-paper superior MiG-15, then later applied in other contexts, such as business process management. Committing your changes to private branches in order to delay a public push to the parent repo increases the size of your collaborators' control loops, either causing them to slow their work in order to safely react to your work, or to overcorrect in response to each change. Each DVCS can be used in the opposite style, but doing so works against their low-friction paths. <h4 id="scale">2.5.2 Scale</h4> The Linux kernel has a far bigger developer community than that of SQLite: there are thousands and thousands of contributors to Linux, most of whom do not know each others names. These thousands are responsible for producing roughly 89⨉ more code than is in SQLite. (10.7 [https://en.wikipedia.org/wiki/Source_lines_of_code|MLOC] vs. 0.12 MLOC according to [https://dwheeler.com/sloccount/|SLOCCount].) The Linux kernel and its development process were already uncommonly large back in 2005 when Git was designed, specifically to support the consequences of having such a large set of developers working on such a large code base. 95% of the code in SQLite comes from just four programmers, and 64% of it is from the lead developer alone. The SQLite developers know each other well and interact daily. Fossil was designed for this development model. We think you should ask yourself whether you have Linus Torvalds scale software configuration management problems or D. Richard Hipp scale problems when choosing your DVCS. An [https://en.wikipedia.org/wiki/Impact_wrench|automotive air impact wrench] running at 8000 RPM driving an M8 socket-cap bolt at 16 cm/s is not the best way to hang a picture on the living room wall. <h4 id="contrib">2.5.3 Accepting Contributions</h4> As of this writing, Git has received about 4.5⨉ as many commits as Fossil resulting in about 2.5⨉ as many lines of source code. The line count excludes tests and in-tree third-party dependencies. It does not exclude the default GUI for each, since it's integral for Fossil, so we count the size of <tt>gitk</tt> in this. It is obvious that Git is bigger in part because of its first-mover advantage, which resulted in a larger user community, which results in more contributions. But is that the <i>only</i> reason? We believe there are other relevant differences that also play into this which fall out of the "Linux vs. SQLite" framing: licensing, community structure, and how we react to [https://www.jonobacon.com/2012/07/25/building-strong-community-structural-integrity/|drive-by contributions]. In brief, it's harder to get a new feature into Fossil than into Git. A larger feature set is not necessarily a good thing. Git's command line interface is famously arcane. Masters of the arcane are able to do wizardly things, but only by studying their art deeply for years. This strikes us as a good thing only in cases where use of the tool itself is the primary point of that user's work. Almost no one uses a DVCS for its own sake; very few people get paid specifically in order to drive a DVCS. We use DVCSes as a tool to support some other effort, so we do not necessarily want the DVCS with the most features. We want a DVCS with easily internalized behavior so we can thoroughly master it despite spending only a small fraction of our working time thinking about the DVCS. We want to pick the tool up, use it quickly, and then set it aside in order to get back to our actual job as quickly as possible. Professional software developers in particular are prone to focusing on feature set sizes when choosing tools because this is sometimes a highly important consideration. They spend all day, every day, in their favorite text editors, and time they spend learning all of the arcana of their favorite programming languages is well-spent. Skills with these tools are direct productivity drivers, which in turn directly drives how much money a developer can make. (Or how much idle time they can afford to take, which amounts to the same thing.) But if you are a professional software developer, we want you to ask yourself a question: "How do I get paid more by mastering arcane features of my DVCS?" Unless you have a good answer to that, you probably do not want to be choosing a DVCS based on how many arcane features it has. The argument is similar for other types of users: if you are a hobbyist, how much time do you want to spend mastering your DVCS instead of on the hobby supported by use of that DVCS? There is some minimal set of features required to achieve the purposes that drive our selection of a DVCS, but there is a level beyond which more features only slow us down while we're learning the tool, since we must plow through documentation on features we're not likely to ever use. When the number of features grows to the point where people of normal motivation cannot spend the time to master them all, the tool becomes <i>less</i> productive to use. The core developers of the Fossil project achieve a balance between feature set size and ease of use by carefully choosing which users to give commit bits to, then in being choosy about which of the contributed feature branches to merge down to trunk. We say "no" to a lot of feature proposals. The end result is that Fossil more closely adheres to [https://en.wikipedia.org/wiki/Principle_of_least_astonishment|the principle of least astonishment] than Git does. <h4 id="branches">2.5.4 Individual Branches vs. The Entire Change History</h4> Both Fossil and Git store history as a directed acyclic graph (DAG) of changes, but Git tends to focus more on individual branches of the DAG, whereas Fossil puts more emphasis on the entire DAG. For example, the default behavior in Git is to only synchronize a single branch, whereas with Fossil the only sync option is to sync the entire DAG. Git commands, GitHub, and GitLab tend to show only a single branch at a time, whereas Fossil usually shows all parallel branches at once. Git has commands like "rebase" that help keep all relevant changes on a single branch, whereas Fossil encourages a style of many concurrent branches constantly springing into existence, undergoing active development in parallel for a few days or weeks, then merging back into the main line and disappearing. This difference in emphasis arises from the different purposes of the two systems. Git focuses on individual branches, because that is exactly what you want for a highly-distributed bazaar-style project such as Linux. Linus Torvalds does not want to see every check-in by every contributor to Linux, as such extreme visibility does not scale well. But Fossil was written for the cathedral-style SQLite project with just a handful of active committers. Seeing all changes on all branches all at once helps keep the whole team up-to-date with what everybody else is doing, resulting in a more tightly focused and cohesive implementation. <h3 id="checkouts">2.6 One vs. Many Check-outs per Repository</h3> Because Git commingles the repository data with the initial checkout of that repository, the default mode of operation in Git is to stick to that single work/repo tree, even when that's a shortsighted way of working. Fossil doesn't work that way. A Fossil repository is a SQLite database file which is normally stored outside the working checkout directory. You can [/help?cmd=open | open] a Fossil repository any number of times into any number of working directories. A common usage pattern is to have one working directory per active working branch, so that switching branches is done with a <tt>cd</tt> command rather than by checking out the branches successively in a single working directory. Fossil does allow you to switch branches within a working checkout directory, and this is also often done. It is simply that there is no inherent penalty to either choice in Fossil as there is in Git. The standard advice is to use a switch-in-place workflow in Fossil when the disturbance from switching branches is small, and to use multiple checkouts when you have long-lived working branches that are different enough that switching in place is disruptive. You can use Git in the Fossil style, either by manually symlinking the <tt>.git</tt> directory from one working directory to another or by use of the <tt>[https://git-scm.com/docs/git-worktree|git-worktree]</tt> feature. Nevertheless, Git's default tie between working directory and repository means the standard method for working with a Git repo is to have one working directory only. Most Git tutorials teach this style, so it is how most people learn to use Git. Because relatively few people use Git with multiple working directories per repository, there are [https://duckduckgo.com/?q=git+worktree+problem | several known problems] with that way of working, problems which don't happen in Fossil because of the clear separation between repository and working directory. This distinction matters because switching branches inside a single working directory loses local context on each switch. For instance, in any software project where the runnable program must be built from source files, you invalidate build objects on each switch, artificially increasing the time required to switch versions. Most obviously, this affects software written in statically-compiled programming languages such as C, Java, and Haskell, but it can even affect programs written in dynamic languages like JavaScript. A typical [https://en.wikipedia.org/wiki/Single-page_application | SPA] build process involves several passes: [http://browserify.org/ | Browserify] to convert [https://nodejs.org/ | Node] packages so they'll run in a web browser, [https://sass-lang.com | SASS] to CSS translation, transpilation of [https://www.typescriptlang.org | Typescript] to JavaScript, [https://github.com/mishoo/UglifyJS | uglification], etc. Once all that processing work is done for a given input file in a given working directory, why re-do that work just to switch versions? If most of the files that differ between versions don't change very often, you can save substantial time by switching branches with <tt>cd</tt> rather than swapping versions in-place within a working checkout directory. For another example, you might have an active long-running test grinding away in a working directory, then get a call from a customer requiring that you switch to a stable branch to answer questions in terms of the version that customer is running. You don't want to stop the test in order to switch your lone working directory to the stable branch. Disk space is cheap. Having several working directories, each with its own local state, makes switching versions cheap and fast. Plus, <tt>cd</tt> is faster to type than <tt>git checkout</tt> or <tt>fossil update</tt>. <h3 id="history">2.7 What you should have done vs. What you actually did</h3> Git puts a lot of emphasis on maintaining a "clean" check-in history. Extraneous and experimental branches by individual developers often never make it into the main repository. And branches are often rebased before being pushed, to make it appear as if development had been linear. Git strives to record what the development of a project should have looked like had there been no mistakes. Fossil, in contrast, puts more emphasis on recording exactly what happened, including all of the messy errors, dead-ends, experimental branches, and so forth. One might argue that this makes the history of a Fossil project "messy," but another point of view is that this makes the history "accurate." In actual practice, the superior reporting tools available in Fossil mean that the added "mess" is not a factor. Like Git, Fossil has an [/help?cmd=amend|amend command] for modifying prior commits, but unlike in Git, this works not by replacing data in the repository, but by adding a correction record to the repository that affects how later Fossil operations present the corrected data. The old information is still there in the repository, it is just overridden from the amendment point forward. For extreme situations, Fossil adds the [/doc/trunk/www/shunning.wiki|shunning mechanism], but it has strict limitations that prevent global history rewrites. One commentator characterized Git as recording history according to the victors, whereas Fossil records history as it actually happened. We go into more detail on this topic in a separate article, [./rebaseharm.md | Rebase Considered Harmful]. <h3 id="testing">2.8 Test Before Commit</h3> One of the things that falls out of Git's default separation of commit from push is that there are several Git sub-commands that jump straight to the commit step before a change could possibly be tested. Fossil, by contrast, makes the equivalent change to the local working check-out only, requiring a separate check-in step to commit the change. This design difference falls naturally out of Fossil's default-enabled autosync feature. The prime example in Git is rebasing: the change happens to the local repository immediately if successful, even though you haven't tested the change yet. It's possible to argue for such a design in a tool like Git which doesn't automatically push the change up to its parent, because you can still test the change before pushing local changes to the parent repo, but in the meantime you've made a durable change to your local Git repository's blockchain. You must do something drastic like <tt>git reset --hard</tt> to revert that rebase if it causes a problem. If you push your rebased local repo up to the parent without testing first, you've now committed the error on a public branch, effectively a violation of [https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing | the golden rule of rebasing]. Lesser examples are the Git <tt>merge</tt>, <tt>cherry-pick</tt>, and <tt>revert</tt> commands, all of which apply work from one branch onto another, and all of which do their work immediately without giving you an opportunity to test the change first locally unless you give the <tt>--no-commit</tt> option. Fossil cannot sensibly work that way because of its default-enabled autosync feature. Instead of jumping straight to the commit step, Fossil applies the proposed merge to the local working directory only, requiring a separate check-in step before the change is committed to the repository blockchain. This gives you a chance to test the change, whether manually, or by running your software's automatic tests, or both. Another difference is that because Fossil requires an explicit commit for a merge, it makes you give an explicit commit <i>message</i> for each merge, whereas Git writes that commit message itself by default unless you give the optional <tt>--edit</tt> flag to override it. We don't look at this difference as a workaround in Fossil for autosync, but instead as a test-first philosophical difference. When every commit is pushed to the parent repo by default, it encourages a working style in which every commit is tested first. We think this is an inherently good thing. Incidentally, this is a good example of Git's messy command design. These three commands: <pre> $ git merge HASH $ git cherry-pick HASH $ git revert HASH </pre> ...are all the same command in Fossil: <pre> $ fossil merge HASH $ fossil merge --cherrypick HASH $ fossil merge --backout HASH </pre> If you think about it, they're all the same function: apply work done on one branch to another. All that changes between these commands is how much work gets applied — just one check-in or a whole branch — and the merge direction. This is the sort of thing we mean when we point out that Fossil's command interface is simpler than Git's: there are fewer concepts to keep track of in your mental model of Fossil's internal operation. Fossil's implementation of the feature is also simpler to describe. The brief online help for <tt>[/help?cmd=merge | fossil merge]</tt> is currently 41 lines long, to which you want to add the 600 lines of [./branching.wiki | the branching document]. The equivalent documentation in Git is the aggregation of the man pages for the above three commands, which is over 1000 lines, much of it mutually redundant. (e.g. the <tt>--edit</tt> and <tt>--no-commit</tt> options get described three times, each time differently.) Fossil's documentation is not only more concise, it gives a nice split of brief online help and full online documentation. <h3 id="hash">2.9 Hash Algorithm: SHA-3 vs SHA-2 vs SHA-1</h3> Fossil started out using 160-bit SHA-1 hashes to identify check-ins, just as in Git. That changed in early 2017 when news of the [https://shattered.io/|SHAttered attack] broke, demonstrating that SHA-1 collisions were now practical to create. Two weeks later, the creator of Fossil delivered a new release allowing a clean migration to [https://en.wikipedia.org/wiki/SHA-3|256-bit SHA-3] with [./hashpolicy.wiki|full backwards compatibility] to old SHA-1 based repositories. By mid-2019, that feature arrived in every software package repository shipping Fossil, the last mover being Debian's stable package repo, which has a highly conservative policy on upgrading to new versions. With that hurdle run, we were able to change the default hash mode in Fossil 2.10 (released 2019-10-04) to require SHA-3 support both for new repositories and to create SHA-3 hashes in existing repos, effectively upgrading them if they were created with Fossil 1.<i>x</i>. This not only solves the SHAttered problem, it should prevent a reoccurrence of similar problems for the foreseeable future. Meanwhile, the Git community took until August 2018 to announce [https://git-scm.com/docs/hash-function-transition/2.18.0|their plan] for solving the same problem by moving to SHA-256 (a variant of the [https://en.wikipedia.org/wiki/SHA-2|older SHA-2 algorithm]) and until February 2019 to release a version containing the change. It's looking like this will take years more to percolate through the community. The practical impact of SHAttered on structured data stores like the one in Git and Fossil isn't clear, but you want to have your repositories moved over to a stronger hash algorithm before someone figures out how to make use of the weaknesses in the old one. Fossil's developers moved on this problem quickly and had a widely-deployed solution to it years ago. <hr/> <h3>Asides and Digressions</h3> <i><small><ol> <li><p>[./mirrorlimitations.md|Many things are lost] in making a Git mirror of a Fossil repo due to limitations of Git relative to Fossil. GitHub adds some of these missing features to stock Git, but because they're not part of Git proper, [./mirrortogithub.md|exporting a Fossil repository to GitHub] will still not include them; Fossil tickets do not become GitHub issues, for example. <li><p>The <tt>fossil-scm.org</tt> web site is actually hosted in several parts, so that it is not strictly true that "everything" on it is in the self-hosting Fossil project repo. The web forum is hosted as [https://fossil-scm.org/forum/|a separate Fossil repo] from the [https://fossil-scm.org/fossil/|main Fossil self-hosting repo] for administration reasons, and the Download page content isn't normally synchronized with a "<tt>fossil clone</tt>" command unless you add the "-u" option. (See "[./aboutdownload.wiki|How the Download Page Works]" for details.) There may also be some purely static elements of the web site served via D. Richard Hipp's own lightweight web server, <tt>[https://sqlite.org/docsrc/doc/trunk/misc/althttpd.md|althttpd]</tt>, which is configured as a front end to Fossil running in CGI mode on these sites. <li><p>That estimate is based on pricing at Digital Ocean in mid-2019: Fossil will run just fine on the smallest instance they offer, at US $5/month, but the closest match to GitLab's minimum requirements among Digital Ocean's offerings currently costs $40/month. <li><p>This means you can give up waiting for Fossil to be ported to the PDP-11, but we remain hopeful that someone may eventually port it to [https://en.wikipedia.org/wiki/Z/OS|z/OS]. <li><p>"Why is there all this Tcl in and around Fossil?" you may ask. It is because D. Richard Hipp is a long-time Tcl user and contributor. SQLite started out as an embedded database for Tcl specifically. ([https://sqlite.org/tclsqlite.html | [Reference]]) When he then created Fossil to manage the development of SQLite, it was natural for him to use Tcl-based tools for its scripting, build system, test system, etc. It came full circle in 2011 when [https://www.reddit.com/r/programming/comments/fwrx5/tcl_and_tk_move_away_from_cvs_to_fossil/ | the Tcl and Tk projects moved from CVS to Fossil]. <li><p>A minority of the pieces of the Git core software suite are written in other languages, primarily Perl, Python, and Tcl. (e.g. <tt>git-send-mail</tt>, <tt>git-p4</tt>, and <tt>gitk</tt>, respectively.) Although these interpreters are quite portable, they aren't installed by default everywhere, and on some platforms you can't count on them at all. (Not just Windows, but also the BSDs and many other non-Linux platforms.) This expands the dependency footprint of Git considerably. It is why the current Git for Windows distribution is 44.7 MiB but the current <tt>fossil.exe</tt> zip file for Windows is 2.24 MiB. Fossil is much smaller despite using a roughly similar amount of high-level scripting code because its interpreters are compact and built into Fossil itself. <li><p>Both Fossil and Git support [https://en.wikipedia.org/wiki/Patch_(Unix)|<tt>patch(1)</tt> files], a common way to allow drive-by contributions, but it's a lossy contribution path for both systems. Unlike Git PRs and Fossil bundles, patch files collapse multiple checkins together, they don't include check-in comments, and they cannot encode changes made above the individual file content layer: you lose branching decisions, tag changes, file renames, and more when using patch files.</p></li> </ol></i></small> |
Changes to www/fossil_prompt.sh.
︙ | ︙ | |||
11 12 13 14 15 16 17 | # variable $fossil_info_project_name to an empty string and return. # function get_fossil_data() { fossil_info_project_name="" eval `get_fossil_data2` } function get_fossil_data2() { | > | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # variable $fossil_info_project_name to an empty string and return. # function get_fossil_data() { fossil_info_project_name="" eval `get_fossil_data2` } function get_fossil_data2() { fossil info 2> /dev/null |tr '\042\047\140' _|grep "^[^ ]*:" | while read LINE ; do local field=`echo $LINE | sed 's/:.*$//' | sed 's/-/_/'` local value=`echo $LINE | sed 's/^[^ ]*: *//'` echo fossil_info_${field}=\"${value}\" done } #------------------------------------------------------------------------- |
︙ | ︙ |
Changes to www/fossil_prompt.wiki.
1 2 3 4 5 6 7 | <title>Fossilized Bash Prompt</title> <h1>2013-02-21</h1> Dan Kennedy has contributed a [./fossil_prompt.sh?mimetype=text/plain | bash script] that manipulates the bash prompt to show the status of the Fossil repository that the user is currently visiting. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <title>Fossilized Bash Prompt</title> <h1>2013-02-21</h1> Dan Kennedy has contributed a [./fossil_prompt.sh?mimetype=text/plain | bash script] that manipulates the bash prompt to show the status of the Fossil repository that the user is currently visiting. The prompt shows the branch, version, and time stamp for the current checkout, and the prompt changes colors from blue to red when there are uncommitted changes. To try out this script, simply download it from the link above, then type: <blockquote><pre> |
︙ | ︙ |
Added www/grep.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Fossil grep vs POSIX grep As of Fossil 2.7, there is a `grep` command which acts roughly like POSIX's `grep -E` over all historical versions of a single file name. This document explains the commonalities and divergences between [POSIX `grep`](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html) and Fossil `grep`. ## Options Fossil `grep` supports only a small subset of the options specified for POSIX `grep`: | Option | Meaning |--------|------------------------------------------------------------- | `-i` | ignore case in matches | `-l` | list a checkin ID prefix for matching historical versions of the file | `-v` | print each checkin ID considered, regardless of whether it matches That leaves many divergences at the option level from POSIX `grep`: * There is no built-in way to get a count of matches, as with `grep -c`. * You cannot give more than one pattern, as with `grep -e` or `grep -f`. * There is no equivalent of `grep -F` to do literal fixed-string matches only. * `fossil grep -l` does not do precisely the same thing as POSIX `grep -l`: it lists checkin ID prefixes, not file names. * Fossil always gives the line number in its output, which is to say that it acts like `grep -n`. There is no way to disable the line number in `fossil grep` output. * There is no way to suppress all output, returning only a status code to indicate whether the pattern matched, as with `grep -q`. * There is no way to suppress error output, as with `grep -s`. * Fossil `grep` accepts only a single input file name. You cannot give it a list of file names, and you cannot give it a directory name for Fossil to expand to the set of all files under that directory. This means Fossil `grep` has no equivalent of the common POSIX `grep -R` extension. (And if it did, it would probably have a different option letter, since `-R` in Fossil has a different meaning, by convention.) * You cannot invert the match, as with `grep -v`. Patches to remove those limitations will be thoughtfully considered. ## Regular Expression Dialect Fossil contains a built-in regular expression engine implementing a subset of the [POSIX extended regular expression][ere] dialect: [ere]: https://en.wikipedia.org/wiki/Regular_expression#POSIX_extended | Atom | Meaning |---------|------------------------------------------------------------- | `X*` | zero or more occurrences of X | `X+` | one or more occurrences of X | `X?` | zero or one occurrences of X | `X{p,q}`| between p and q occurrences of X, inclusive | `(X)` | match X | <tt>X\|Y</tt>| X or Y | `^X` | X occurring at the beginning of a line | `X$` | X occurring at the end of a line | `.` | Match any single character | `\c` | Character `c` where `c` is one of <tt>{}()[]\|\*+?.\\</tt> | `\c` | C-language escapes for `c` in `afnrtv`. ex: `\t` or `\n` | `\uXXXX`| Where XXXX is exactly 4 hex digits, Unicode value XXXX | `\xXX` | Where XX is exactly 2 hex digits, Unicode value XX | `[abc]` | Any single character from the set `abc` | `[^abc]`| Any single character not in the set `abc` | `[a-z]` | Any single character in the range `a-z` | `[^a-z]`| Any single character not in the range `a-z` | `\b` | Word boundary | `\w` | Word character: `[A-Za-z0-9_]` | `\W` | Non-word character: `[^A-Za-z0-9_]` | `\d` | Digit: `[0-9]` | `\D` | Non-digit: `[^0-9]` | `\s` | Whitespace character: `[ \t\r\n\v\f]` | `\S` | Non-whitespace character: `[^ \t\r\n\v\f]` There are several restrictions in Fossil `grep` relative to a fully POSIX compatible regular expression engine. Among them are: * There is currently no support for POSIX character classes such as `[:lower:]`. * Fossil `grep` does not currently attempt to take your operating system's locale settings into account when doing this match. Since Fossil has no way to mark a given file as having a particular encoding, Fossil `grep` assumes the input files are in UTF-8 format. This means Fossil `grep` will not work correctly if the files in your repository are in an encoding that is not backwards-compatible with ASCII, such as UTF-16. Partially compatible encodings such as ISO 8859 should work with Fossil `grep` as long as you stick to their ASCII-compatible subset. The Fossil `grep` language is not a strict subset of POSIX extended regular expressions. Some of the features documented above are well-understood extensions to it, such as the "word" features `\b`, `\w` and `\W`. Fossil `grep` is based on the Unicode engine from [SQLite's FTS5 feature][fts5]. This means it does do things like Unicode-aware case folding. Therefore, it is usually a user error to attempt to substitute `[a-z]` for a lack of the POSIX character class `[:lower:]` if you are grepping over pretty much any human written language other than English. Use `fossil grep -i` instead, which does Unicode case folding. [fts5]: https://www.sqlite.org/fts5.html ## Algorithm Details Fossil `grep` uses a [nondeterministic finite automaton][nfa] for matching, so the performance is bounded by ***O(nm)*** where ***n*** is the size of the regular expression and ***m*** is the size of the input string. [nfa]: https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton In order to avoid [ReDoS attacks][redos], the Fossil regular expression matcher was purposely written to avoid [implementation choices][rei] which have the potential to require exponential evaluation time. This constrains the possible feature set we can support in the Fossil `grep` dialect. For instance, we are unlikely to ever add support for [backtracking][bt]. [redos]: https://en.wikipedia.org/wiki/ReDoS [rei]: https://en.wikipedia.org/wiki/Regular_expression#Implementations_and_running_times [bt]: https://en.wikipedia.org/wiki/Backtracking The `X{p,q}` operator expands to `p` copies of `X` followed by `q-p` copies of `X?` before RE evaluation. The ***O(nm)*** performance bound above remains true for this case, but realize that it applies to the RE *after* this expansion, not to the form as given by the user. In other words, as `q-p` increases, so does the RE evaluation time. |
Changes to www/hacker-howto.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <title>Fossil Hackers How-To</title> The following links are of interest to programmers who want to modify or enhance Fossil. Ordinary users can safely ignore this information. * [./build.wiki | How To Compile And Install Fossil] * [./customskin.md | Theming Fossil] * [./makefile.wiki | The Fossil Build Process] * [./build_in_ide.md | Using IDE for Fossil Development] * [./tech_overview.wiki | A Technical Overview of Fossil] * [./adding_code.wiki | Adding Features To Fossil] * [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project] * [./fileformat.wiki|Fossil Artifact File Format] * [./style.wiki | Coding Style Guidelines] * [./checkin.wiki | Pre-checkin Checklist] * [../test/release-checklist.wiki | Release Checklist] * [./backoffice.md | The "backoffice" subsystem] | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <title>Fossil Hackers How-To</title> The following links are of interest to programmers who want to modify or enhance Fossil. Ordinary users can safely ignore this information. * [./build.wiki | How To Compile And Install Fossil] * [./customskin.md | Theming Fossil] * [./makefile.wiki | The Fossil Build Process] * [./build_in_ide.md | Using IDE for Fossil Development] * [./tech_overview.wiki | A Technical Overview of Fossil] * [./adding_code.wiki | Adding Features To Fossil] * [./contribute.wiki|Contributing Code Or Enhancements To The Fossil Project] * [./fileformat.wiki|Fossil Artifact File Format] * [./sync.wiki|The Sync Protocol] * [./style.wiki | Coding Style Guidelines] * [./checkin.wiki | Pre-checkin Checklist] * [../test/release-checklist.wiki | Release Checklist] * [./backoffice.md | The "backoffice" subsystem] |
Changes to www/hashpolicy.wiki.
1 2 | <title>Hash Policy</title> | > > | | > | | | | | > | | | | | | | 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 | <title>Hash Policy</title> <h2>Executive Summary</h2> <b>Or: How To Avoid Reading This Article</b> There was much angst over the [http://www.shattered.io|SHAttered attack] against SHA1 when it was announced in early 2017. If you are concerned about this and its implications for Fossil, simply [./quickstart.wiki#install|upgrade to Fossil 2.1 or later], and the problem will go away. Everything will continue to work as before. All of your legacy repositories will continue to work, and all of your old check-ins will still have the same name. Your workflow will be unchanged. But if you are curious and want a deeper understanding of what is going on, read on... <h2>Introduction</h2> The first snapshot-based distributed version control system was [http://www.monotone.ca|Monotone]. Many of the ideas behind the design of Fossil were copied from Monotone, including the use of a SHA1 hash to assign names to artifacts. Git and Mercurial did the same thing. The SHA1 hash algorithm is used only to create names for artifacts in Fossil (and in Git, Mercurial, and Monotone). It is not used for security. Nevertheless, when the [http://www.shattered.io|SHAttered attack] found two different PDF files with the same SHA1 hash, many users learned that "SHA1 is broken". They see that Fossil (and Git, Mercurial, and Monotone) use SHA1 and they therefore conclude that "Fossil is broken". This is not true, but it is a public relations problem. So the decision was made to migrate Fossil away from SHA1. This article describes how that migration is occurring. <h2>Use Of Hardened SHA1</h2> In Fossil version 2.0 ([/timeline?c=version-2.0|2017-03-03]), the internal SHA1 implementation was changed from a generic FIPS PUB 180-4 SHA1 implementation to a "Hardened SHA1" [[https://github.com/cr-marcstevens/sha1collisiondetection|1]] [[https://marc-stevens.nl/research/papers/C13-S.pdf|2]]. The Hardened SHA1 algorithm automatically detects when the artifact being hashed is specifically designed to exploit the known weaknesses in the SHA1 algorithm, and when it detects such an attack it changes the hash algorithm (by increasing the number of rounds in the compression function) to make the algorithm secure again. If the attack detection gets a false possible, that means that Hardened SHA1 will get a different answer than the standard FIPS PUB 180-4 SHA1, but the creators of Hardened SHA1 (see the second paper [[https://marc-stevens.nl/research/papers/C13-S.pdf|2]]) report that the probability of a false positive is vanishingly small - less than 1 false positive out of 10<sup><font size=1>27</font></sup> hashes. Hardened SHA1 is slower (and a lot bigger) but Fossil does not do that much hashing, so performance is not really an issue. All versions of Fossil moving forward will use Hardened SHA1. So if someone says "SHA1 is broken, and Fossil uses SHA1, therefore Fossil is broken," you can rebut the argument by pointing out that Fossil uses <em>Hardened SHA1</em>, not generic SHA1, and Hardened SHA1 is <em>not</em> broken. <h2>Support For SHA3-256</h2> Prior to Fossil version 2.0 ([/timeline?c=version-2.0|2017-03-03]), all artifacts in all Fossil repositories were named by only a SHA1 hash. Version 2.0 extended the [./fileformat.wiki|Fossil file format] to allow artifacts to be named by either SHA1 or SHA3-256 hashes. (SHA3-256 is the only variant of SHA3 that Fossil uses for artifact naming, so for the remainder of this article it will be called simply "SHA3". Similarly, "Hardened SHA1" will shortened to "SHA1" in the remaining text.) Other than permitting the use of SHA3 in addition to SHA1, there were no file format changes in Fossil version 2.0 relative to the previous version 1.37. Both Fossil 2.0 and Fossil 1.37 read and write all the same repositories and sync with one another, as long as none of the repositories contain artifacts named using SHA3. If a repository does contain artifacts named using SHA3, Fossil 1.37 will |
︙ | ︙ | |||
106 107 108 109 110 111 112 | name, then continue to use the older SHA1 name. Use SHA3 for new artifacts that have never before been encountered.</td> </tr> <tr> <td valign='top'>sha3-only</td> <td>Name new artifacts using the SHA3 hash algorithm even if the artifact already has a SHA1 name. In other words, force the use of SHA3. This can | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | name, then continue to use the older SHA1 name. Use SHA3 for new artifacts that have never before been encountered.</td> </tr> <tr> <td valign='top'>sha3-only</td> <td>Name new artifacts using the SHA3 hash algorithm even if the artifact already has a SHA1 name. In other words, force the use of SHA3. This can cause some artifacts to be added to the repository twice, once under their SHA1 name and again under their SHA3 name. But delta compression will prevent that from causing repository size problems.</td> </tr> <tr> <td valign='top'>shun-sha1</td> <td>Like "sha3-only" but at this level do not accept a push of SHA1-named artifacts. If another Fossil instance tries to push a SHA1-named artifact, |
︙ | ︙ | |||
162 163 164 165 166 167 168 | Of course, if some members of your team stubbornly refuse to upgrade past Fossil 1.37, you should avoid changing the hash policy and creating artifacts with SHA3 names, because once you do that your recalcitrant coworkers will no longer be able to collaborate. <h2>A Pure SHA3 Future</h2> | < | | > > > | > | > | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | Of course, if some members of your team stubbornly refuse to upgrade past Fossil 1.37, you should avoid changing the hash policy and creating artifacts with SHA3 names, because once you do that your recalcitrant coworkers will no longer be able to collaborate. <h2>A Pure SHA3 Future</h2> Fossil 2.10 will change the default hash policy to "sha3" mode. We decided to make the change since the last known distributor of Fossil 1.x binaries — Debian 9 — was finally replaced in June 2019 by a newer version distributing Fossil 2.x. All other known sources of Fossil 1.x binaries upgraded well before that point. Because Fossil 2.x tends to silently upgrade existing repos to SHA-3 mode unless carefully forced not to, you probably won't even notice the change. |
Added www/image-format-vs-repo-size.ipynb.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 | { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Image Format vs Fossil Repository Size\n", "\n", "## Prerequisites\n", "\n", "This notebook was developed with [JupyterLab][jl]. To follow in my footsteps, install that and the needed Python packages:\n", "\n", " $ pip install jupyterlab matplotlib pandas wand\n", "\n", "In principle, it should also work with [Anaconda Navigator][an], but because [Wand][wp] is not currently in the Anaconda base package set, you may run into difficulties making it work, as we did on macOS. There seems to be some sandboxing that causes problems with OS interaction in that environment. Therefore, we recommend using straight JupyterLab.\n", "\n", "This notebook was originally written for the Python 2 kernel because macOS does not include Python 3, but it was later updated for Python 3. It should still be compatible with Python 2, though.\n", "\n", "[an]: https://www.anaconda.com/distribution/\n", "[jl]: https://github.com/jupyterlab/\n", "[wp]: http://wand-py.org/\n", "\n", "\n", "## Running\n", "\n", "The next cell generates the test repositories. This takes about 45 seconds to run, primarily due to the `sleep 1` synchronization call, made 40 times in the main test loop.\n", "\n", "The one after that produces the bar chart from the collected data, all but instantaneously.\n", "\n", "This split allows you to generate the expensive experimental data in a single pass, then play as many games as you like with the generated data.\n", "\n", "\n", "## Discussion\n", "\n", "That is kept in [a separate document](image-format-vs-repo-size.md) so we can share that document with Fossil's Markdown renderer." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Experiment completed in 44.186978816986084 seconds.\n" ] } ], "source": [ "import os\n", "import random\n", "import time\n", "\n", "from wand.color import Color\n", "from wand.drawing import Drawing\n", "from wand.image import Image\n", "\n", "import pandas as pd\n", "\n", "size = 256\n", "iterations = 10\n", "start = time.time()\n", "repo_sizes = []\n", "\n", "formats = ['JPEG', 'BMP', 'TIFF', 'PNG']\n", "for f in formats:\n", " ext = f.lower()\n", " tdir = 'test' + '-' + ext\n", " repo = tdir + '.fossil'\n", " ifn = 'test.' + ext\n", " ipath = os.path.join(tdir, ifn)\n", " rs = []\n", " \n", " def add_repo_size():\n", " rs.append(os.path.getsize(repo) / 1024.0 / 1024.0)\n", "\n", " try:\n", " # Create test repo\n", " if not os.path.exists(tdir): os.mkdir(tdir, 0o700)\n", " cmd = 'cd {0} ; fossil init ../{1} && fossil open --nested ../{1} && fossil set binary-glob \"*.{2}\"'.format(\n", " tdir, repo, ext\n", " )\n", " if os.system(cmd) != 0:\n", " raise RuntimeError('Failed to create test repo ' + repo)\n", " add_repo_size()\n", "\n", " # Create test image and add it to the repo\n", " img = Image(width = size, height = size, depth = 8,\n", " background = 'white')\n", " img.alpha_channel = 'remove'\n", " img.evaluate('gaussiannoise', 1.0)\n", " img.save(filename = ipath)\n", " cmd = 'cd {0} ; fossil add {1} && fossil ci -m \"initial\"'.format(\n", " tdir, ifn\n", " )\n", " if os.system(cmd) != 0:\n", " raise RuntimeError('Failed to add ' + ifn + ' to test repo')\n", " #print \"Created test repo \" + repo + \" for format \" + f + \".\"\n", " add_repo_size()\n", "\n", " # Change a random pixel to a random RGB value and check it in\n", " # $iterations times.\n", " for i in range(iterations):\n", " with Drawing() as draw:\n", " x = random.randint(0, size - 1)\n", " y = random.randint(0, size - 1)\n", "\n", " r = random.randint(0, 255)\n", " g = random.randint(0, 255)\n", " b = random.randint(0, 255)\n", " \n", " draw.fill_color = Color('rgb({0},{1},{2})'.format(\n", " r, g, b\n", " ))\n", " draw.color(x, y, 'point')\n", " draw(img)\n", " img.save(filename = ipath)\n", " \n", " # ImageMagick appears to use some kind of asynchronous\n", " # file saving mechanism, so we have to give it time to\n", " # complete.\n", " time.sleep(1.0)\n", " \n", " cmd = 'cd {0} ; fossil ci -m \"change {1} step {2}\"'.format(\n", " tdir, f, i\n", " )\n", " if os.system(cmd) != 0:\n", " raise RuntimeError('Failed to change ' + f + ' image, step ' + str(i))\n", " add_repo_size()\n", " \n", " # Repo complete for this format\n", " repo_sizes.append(pd.Series(rs, name=f))\n", "\n", " finally:\n", " if os.path.exists(ipath): os.remove(ipath)\n", " if os.path.exists(tdir):\n", " os.system('cd ' + tdir + ' ; fossil close -f')\n", " os.rmdir(tdir)\n", " if os.path.exists(repo): os.remove(repo)\n", " \n", "print(\"Experiment completed in \" + str(time.time() - start) + \" seconds.\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n", "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", "<!-- Created with matplotlib (https://matplotlib.org/) -->\n", "<svg height=\"268.743125pt\" version=\"1.1\" viewBox=\"0 0 389.28125 268.743125\" width=\"389.28125pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", " <defs>\n", " <style type=\"text/css\">\n", "*{stroke-linecap:butt;stroke-linejoin:round;}\n", " </style>\n", " </defs>\n", " <g id=\"figure_1\">\n", " <g id=\"patch_1\">\n", " <path d=\"M 0 268.743125 \n", "L 389.28125 268.743125 \n", "L 389.28125 0 \n", "L 0 0 \n", "z\n", "\" style=\"fill:none;\"/>\n", " </g>\n", " <g id=\"axes_1\">\n", " <g id=\"patch_2\">\n", " <path d=\"M 43.78125 228.14 \n", "L 378.58125 228.14 \n", "L 378.58125 10.7 \n", "L 43.78125 10.7 \n", "z\n", "\" style=\"fill:#ffffff;\"/>\n", " </g>\n", " <g id=\"patch_3\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 52.78125 228.14 \n", "L 59.98125 228.14 \n", "L 59.98125 154.732751 \n", "L 52.78125 154.732751 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_4\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 88.78125 228.14 \n", "L 95.98125 228.14 \n", "L 95.98125 154.732751 \n", "L 88.78125 154.732751 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_5\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 124.78125 228.14 \n", "L 131.98125 228.14 \n", "L 131.98125 144.687548 \n", "L 124.78125 144.687548 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_6\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 160.78125 228.14 \n", "L 167.98125 228.14 \n", "L 167.98125 130.006098 \n", "L 160.78125 130.006098 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_7\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 196.78125 228.14 \n", "L 203.98125 228.14 \n", "L 203.98125 128.460682 \n", "L 196.78125 128.460682 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_8\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 232.78125 228.14 \n", "L 239.98125 228.14 \n", "L 239.98125 126.915267 \n", "L 232.78125 126.915267 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_9\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 268.78125 228.14 \n", "L 275.98125 228.14 \n", "L 275.98125 126.915267 \n", "L 268.78125 126.915267 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_10\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 304.78125 228.14 \n", "L 311.98125 228.14 \n", "L 311.98125 116.870064 \n", "L 304.78125 116.870064 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_11\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 340.78125 228.14 \n", "L 347.98125 228.14 \n", "L 347.98125 110.688401 \n", "L 340.78125 110.688401 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_12\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 59.98125 228.14 \n", "L 67.18125 228.14 \n", "L 67.18125 118.41548 \n", "L 59.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_13\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 95.98125 228.14 \n", "L 103.18125 228.14 \n", "L 103.18125 118.41548 \n", "L 95.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_14\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 131.98125 228.14 \n", "L 139.18125 228.14 \n", "L 139.18125 118.41548 \n", "L 131.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_15\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 167.98125 228.14 \n", "L 175.18125 228.14 \n", "L 175.18125 118.41548 \n", "L 167.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_16\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 203.98125 228.14 \n", "L 211.18125 228.14 \n", "L 211.18125 118.41548 \n", "L 203.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_17\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 239.98125 228.14 \n", "L 247.18125 228.14 \n", "L 247.18125 118.41548 \n", "L 239.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_18\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 275.98125 228.14 \n", "L 283.18125 228.14 \n", "L 283.18125 118.41548 \n", "L 275.98125 118.41548 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_19\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 311.98125 228.14 \n", "L 319.18125 228.14 \n", "L 319.18125 117.642772 \n", "L 311.98125 117.642772 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_20\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 347.98125 228.14 \n", "L 355.18125 228.14 \n", "L 355.18125 117.642772 \n", "L 347.98125 117.642772 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_21\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 67.18125 228.14 \n", "L 74.38125 228.14 \n", "L 74.38125 118.41548 \n", "L 67.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_22\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 103.18125 228.14 \n", "L 110.38125 228.14 \n", "L 110.38125 118.41548 \n", "L 103.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_23\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 139.18125 228.14 \n", "L 146.38125 228.14 \n", "L 146.38125 118.41548 \n", "L 139.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_24\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 175.18125 228.14 \n", "L 182.38125 228.14 \n", "L 182.38125 118.41548 \n", "L 175.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_25\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 211.18125 228.14 \n", "L 218.38125 228.14 \n", "L 218.38125 118.41548 \n", "L 211.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_26\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 247.18125 228.14 \n", "L 254.38125 228.14 \n", "L 254.38125 118.41548 \n", "L 247.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_27\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 283.18125 228.14 \n", "L 290.38125 228.14 \n", "L 290.38125 118.41548 \n", "L 283.18125 118.41548 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_28\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 319.18125 228.14 \n", "L 326.38125 228.14 \n", "L 326.38125 117.642772 \n", "L 319.18125 117.642772 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_29\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 355.18125 228.14 \n", "L 362.38125 228.14 \n", "L 362.38125 117.642772 \n", "L 355.18125 117.642772 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_30\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 74.38125 228.14 \n", "L 81.58125 228.14 \n", "L 81.58125 119.188188 \n", "L 74.38125 119.188188 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_31\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 110.38125 228.14 \n", "L 117.58125 228.14 \n", "L 117.58125 104.506738 \n", "L 110.38125 104.506738 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_32\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 146.38125 228.14 \n", "L 153.58125 228.14 \n", "L 153.58125 88.279872 \n", "L 146.38125 88.279872 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_33\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 182.38125 228.14 \n", "L 189.58125 228.14 \n", "L 189.58125 77.461962 \n", "L 182.38125 77.461962 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_34\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 218.38125 228.14 \n", "L 225.58125 228.14 \n", "L 225.58125 73.598422 \n", "L 218.38125 73.598422 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_35\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 254.38125 228.14 \n", "L 261.58125 228.14 \n", "L 261.58125 57.371557 \n", "L 254.38125 57.371557 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_36\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 290.38125 228.14 \n", "L 297.58125 228.14 \n", "L 297.58125 57.371557 \n", "L 290.38125 57.371557 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_37\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 326.38125 228.14 \n", "L 333.58125 228.14 \n", "L 333.58125 31.872196 \n", "L 326.38125 31.872196 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"patch_38\">\n", " <path clip-path=\"url(#p836f19e185)\" d=\"M 362.38125 228.14 \n", "L 369.58125 228.14 \n", "L 369.58125 21.054286 \n", "L 362.38125 21.054286 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"matplotlib.axis_1\">\n", " <g id=\"xtick_1\">\n", " <g id=\"line2d_1\">\n", " <defs>\n", " <path d=\"M 0 0 \n", "L 0 3.5 \n", "\" id=\"m1f6b1ebb34\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n", " </defs>\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"67.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_1\">\n", " <!-- 3 -->\n", " <defs>\n", " <path d=\"M 40.578125 39.3125 \n", "Q 47.65625 37.796875 51.625 33 \n", "Q 55.609375 28.21875 55.609375 21.1875 \n", "Q 55.609375 10.40625 48.1875 4.484375 \n", "Q 40.765625 -1.421875 27.09375 -1.421875 \n", "Q 22.515625 -1.421875 17.65625 -0.515625 \n", "Q 12.796875 0.390625 7.625 2.203125 \n", "L 7.625 11.71875 \n", "Q 11.71875 9.328125 16.59375 8.109375 \n", "Q 21.484375 6.890625 26.8125 6.890625 \n", "Q 36.078125 6.890625 40.9375 10.546875 \n", "Q 45.796875 14.203125 45.796875 21.1875 \n", "Q 45.796875 27.640625 41.28125 31.265625 \n", "Q 36.765625 34.90625 28.71875 34.90625 \n", "L 20.21875 34.90625 \n", "L 20.21875 43.015625 \n", "L 29.109375 43.015625 \n", "Q 36.375 43.015625 40.234375 45.921875 \n", "Q 44.09375 48.828125 44.09375 54.296875 \n", "Q 44.09375 59.90625 40.109375 62.90625 \n", "Q 36.140625 65.921875 28.71875 65.921875 \n", "Q 24.65625 65.921875 20.015625 65.03125 \n", "Q 15.375 64.15625 9.8125 62.3125 \n", "L 9.8125 71.09375 \n", "Q 15.4375 72.65625 20.34375 73.4375 \n", "Q 25.25 74.21875 29.59375 74.21875 \n", "Q 40.828125 74.21875 47.359375 69.109375 \n", "Q 53.90625 64.015625 53.90625 55.328125 \n", "Q 53.90625 49.265625 50.4375 45.09375 \n", "Q 46.96875 40.921875 40.578125 39.3125 \n", "z\n", "\" id=\"DejaVuSans-51\"/>\n", " </defs>\n", " <g transform=\"translate(69.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-51\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_2\">\n", " <g id=\"line2d_2\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"103.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_2\">\n", " <!-- 4 -->\n", " <defs>\n", " <path d=\"M 37.796875 64.3125 \n", "L 12.890625 25.390625 \n", "L 37.796875 25.390625 \n", "z\n", "M 35.203125 72.90625 \n", "L 47.609375 72.90625 \n", "L 47.609375 25.390625 \n", "L 58.015625 25.390625 \n", "L 58.015625 17.1875 \n", "L 47.609375 17.1875 \n", "L 47.609375 0 \n", "L 37.796875 0 \n", "L 37.796875 17.1875 \n", "L 4.890625 17.1875 \n", "L 4.890625 26.703125 \n", "z\n", "\" id=\"DejaVuSans-52\"/>\n", " </defs>\n", " <g transform=\"translate(105.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-52\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_3\">\n", " <g id=\"line2d_3\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"139.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_3\">\n", " <!-- 5 -->\n", " <defs>\n", " <path d=\"M 10.796875 72.90625 \n", "L 49.515625 72.90625 \n", "L 49.515625 64.59375 \n", "L 19.828125 64.59375 \n", "L 19.828125 46.734375 \n", "Q 21.96875 47.46875 24.109375 47.828125 \n", "Q 26.265625 48.1875 28.421875 48.1875 \n", "Q 40.625 48.1875 47.75 41.5 \n", "Q 54.890625 34.8125 54.890625 23.390625 \n", "Q 54.890625 11.625 47.5625 5.09375 \n", "Q 40.234375 -1.421875 26.90625 -1.421875 \n", "Q 22.3125 -1.421875 17.546875 -0.640625 \n", "Q 12.796875 0.140625 7.71875 1.703125 \n", "L 7.71875 11.625 \n", "Q 12.109375 9.234375 16.796875 8.0625 \n", "Q 21.484375 6.890625 26.703125 6.890625 \n", "Q 35.15625 6.890625 40.078125 11.328125 \n", "Q 45.015625 15.765625 45.015625 23.390625 \n", "Q 45.015625 31 40.078125 35.4375 \n", "Q 35.15625 39.890625 26.703125 39.890625 \n", "Q 22.75 39.890625 18.8125 39.015625 \n", "Q 14.890625 38.140625 10.796875 36.28125 \n", "z\n", "\" id=\"DejaVuSans-53\"/>\n", " </defs>\n", " <g transform=\"translate(141.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-53\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_4\">\n", " <g id=\"line2d_4\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"175.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_4\">\n", " <!-- 6 -->\n", " <defs>\n", " <path d=\"M 33.015625 40.375 \n", "Q 26.375 40.375 22.484375 35.828125 \n", "Q 18.609375 31.296875 18.609375 23.390625 \n", "Q 18.609375 15.53125 22.484375 10.953125 \n", "Q 26.375 6.390625 33.015625 6.390625 \n", "Q 39.65625 6.390625 43.53125 10.953125 \n", "Q 47.40625 15.53125 47.40625 23.390625 \n", "Q 47.40625 31.296875 43.53125 35.828125 \n", "Q 39.65625 40.375 33.015625 40.375 \n", "z\n", "M 52.59375 71.296875 \n", "L 52.59375 62.3125 \n", "Q 48.875 64.0625 45.09375 64.984375 \n", "Q 41.3125 65.921875 37.59375 65.921875 \n", "Q 27.828125 65.921875 22.671875 59.328125 \n", "Q 17.53125 52.734375 16.796875 39.40625 \n", "Q 19.671875 43.65625 24.015625 45.921875 \n", "Q 28.375 48.1875 33.59375 48.1875 \n", "Q 44.578125 48.1875 50.953125 41.515625 \n", "Q 57.328125 34.859375 57.328125 23.390625 \n", "Q 57.328125 12.15625 50.6875 5.359375 \n", "Q 44.046875 -1.421875 33.015625 -1.421875 \n", "Q 20.359375 -1.421875 13.671875 8.265625 \n", "Q 6.984375 17.96875 6.984375 36.375 \n", "Q 6.984375 53.65625 15.1875 63.9375 \n", "Q 23.390625 74.21875 37.203125 74.21875 \n", "Q 40.921875 74.21875 44.703125 73.484375 \n", "Q 48.484375 72.75 52.59375 71.296875 \n", "z\n", "\" id=\"DejaVuSans-54\"/>\n", " </defs>\n", " <g transform=\"translate(177.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-54\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_5\">\n", " <g id=\"line2d_5\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"211.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_5\">\n", " <!-- 7 -->\n", " <defs>\n", " <path d=\"M 8.203125 72.90625 \n", "L 55.078125 72.90625 \n", "L 55.078125 68.703125 \n", "L 28.609375 0 \n", "L 18.3125 0 \n", "L 43.21875 64.59375 \n", "L 8.203125 64.59375 \n", "z\n", "\" id=\"DejaVuSans-55\"/>\n", " </defs>\n", " <g transform=\"translate(213.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-55\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_6\">\n", " <g id=\"line2d_6\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"247.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_6\">\n", " <!-- 8 -->\n", " <defs>\n", " <path d=\"M 31.78125 34.625 \n", "Q 24.75 34.625 20.71875 30.859375 \n", "Q 16.703125 27.09375 16.703125 20.515625 \n", "Q 16.703125 13.921875 20.71875 10.15625 \n", "Q 24.75 6.390625 31.78125 6.390625 \n", "Q 38.8125 6.390625 42.859375 10.171875 \n", "Q 46.921875 13.96875 46.921875 20.515625 \n", "Q 46.921875 27.09375 42.890625 30.859375 \n", "Q 38.875 34.625 31.78125 34.625 \n", "z\n", "M 21.921875 38.8125 \n", "Q 15.578125 40.375 12.03125 44.71875 \n", "Q 8.5 49.078125 8.5 55.328125 \n", "Q 8.5 64.0625 14.71875 69.140625 \n", "Q 20.953125 74.21875 31.78125 74.21875 \n", "Q 42.671875 74.21875 48.875 69.140625 \n", "Q 55.078125 64.0625 55.078125 55.328125 \n", "Q 55.078125 49.078125 51.53125 44.71875 \n", "Q 48 40.375 41.703125 38.8125 \n", "Q 48.828125 37.15625 52.796875 32.3125 \n", "Q 56.78125 27.484375 56.78125 20.515625 \n", "Q 56.78125 9.90625 50.3125 4.234375 \n", "Q 43.84375 -1.421875 31.78125 -1.421875 \n", "Q 19.734375 -1.421875 13.25 4.234375 \n", "Q 6.78125 9.90625 6.78125 20.515625 \n", "Q 6.78125 27.484375 10.78125 32.3125 \n", "Q 14.796875 37.15625 21.921875 38.8125 \n", "z\n", "M 18.3125 54.390625 \n", "Q 18.3125 48.734375 21.84375 45.5625 \n", "Q 25.390625 42.390625 31.78125 42.390625 \n", "Q 38.140625 42.390625 41.71875 45.5625 \n", "Q 45.3125 48.734375 45.3125 54.390625 \n", "Q 45.3125 60.0625 41.71875 63.234375 \n", "Q 38.140625 66.40625 31.78125 66.40625 \n", "Q 25.390625 66.40625 21.84375 63.234375 \n", "Q 18.3125 60.0625 18.3125 54.390625 \n", "z\n", "\" id=\"DejaVuSans-56\"/>\n", " </defs>\n", " <g transform=\"translate(249.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-56\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_7\">\n", " <g id=\"line2d_7\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"283.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_7\">\n", " <!-- 9 -->\n", " <defs>\n", " <path d=\"M 10.984375 1.515625 \n", "L 10.984375 10.5 \n", "Q 14.703125 8.734375 18.5 7.8125 \n", "Q 22.3125 6.890625 25.984375 6.890625 \n", "Q 35.75 6.890625 40.890625 13.453125 \n", "Q 46.046875 20.015625 46.78125 33.40625 \n", "Q 43.953125 29.203125 39.59375 26.953125 \n", "Q 35.25 24.703125 29.984375 24.703125 \n", "Q 19.046875 24.703125 12.671875 31.3125 \n", "Q 6.296875 37.9375 6.296875 49.421875 \n", "Q 6.296875 60.640625 12.9375 67.421875 \n", "Q 19.578125 74.21875 30.609375 74.21875 \n", "Q 43.265625 74.21875 49.921875 64.515625 \n", "Q 56.59375 54.828125 56.59375 36.375 \n", "Q 56.59375 19.140625 48.40625 8.859375 \n", "Q 40.234375 -1.421875 26.421875 -1.421875 \n", "Q 22.703125 -1.421875 18.890625 -0.6875 \n", "Q 15.09375 0.046875 10.984375 1.515625 \n", "z\n", "M 30.609375 32.421875 \n", "Q 37.25 32.421875 41.125 36.953125 \n", "Q 45.015625 41.5 45.015625 49.421875 \n", "Q 45.015625 57.28125 41.125 61.84375 \n", "Q 37.25 66.40625 30.609375 66.40625 \n", "Q 23.96875 66.40625 20.09375 61.84375 \n", "Q 16.21875 57.28125 16.21875 49.421875 \n", "Q 16.21875 41.5 20.09375 36.953125 \n", "Q 23.96875 32.421875 30.609375 32.421875 \n", "z\n", "\" id=\"DejaVuSans-57\"/>\n", " </defs>\n", " <g transform=\"translate(285.940625 241.5025)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-57\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_8\">\n", " <g id=\"line2d_8\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"319.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_8\">\n", " <!-- 10 -->\n", " <defs>\n", " <path d=\"M 12.40625 8.296875 \n", "L 28.515625 8.296875 \n", "L 28.515625 63.921875 \n", "L 10.984375 60.40625 \n", "L 10.984375 69.390625 \n", "L 28.421875 72.90625 \n", "L 38.28125 72.90625 \n", "L 38.28125 8.296875 \n", "L 54.390625 8.296875 \n", "L 54.390625 0 \n", "L 12.40625 0 \n", "z\n", "\" id=\"DejaVuSans-49\"/>\n", " <path d=\"M 31.78125 66.40625 \n", "Q 24.171875 66.40625 20.328125 58.90625 \n", "Q 16.5 51.421875 16.5 36.375 \n", "Q 16.5 21.390625 20.328125 13.890625 \n", "Q 24.171875 6.390625 31.78125 6.390625 \n", "Q 39.453125 6.390625 43.28125 13.890625 \n", "Q 47.125 21.390625 47.125 36.375 \n", "Q 47.125 51.421875 43.28125 58.90625 \n", "Q 39.453125 66.40625 31.78125 66.40625 \n", "z\n", "M 31.78125 74.21875 \n", "Q 44.046875 74.21875 50.515625 64.515625 \n", "Q 56.984375 54.828125 56.984375 36.375 \n", "Q 56.984375 17.96875 50.515625 8.265625 \n", "Q 44.046875 -1.421875 31.78125 -1.421875 \n", "Q 19.53125 -1.421875 13.0625 8.265625 \n", "Q 6.59375 17.96875 6.59375 36.375 \n", "Q 6.59375 54.828125 13.0625 64.515625 \n", "Q 19.53125 74.21875 31.78125 74.21875 \n", "z\n", "\" id=\"DejaVuSans-48\"/>\n", " </defs>\n", " <g transform=\"translate(321.940625 247.865)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-49\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"xtick_9\">\n", " <g id=\"line2d_9\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"355.18125\" xlink:href=\"#m1f6b1ebb34\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_9\">\n", " <!-- 11 -->\n", " <g transform=\"translate(357.940625 247.865)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-49\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-49\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"text_10\">\n", " <!-- Checkin index -->\n", " <defs>\n", " <path d=\"M 64.40625 67.28125 \n", "L 64.40625 56.890625 \n", "Q 59.421875 61.53125 53.78125 63.8125 \n", "Q 48.140625 66.109375 41.796875 66.109375 \n", "Q 29.296875 66.109375 22.65625 58.46875 \n", "Q 16.015625 50.828125 16.015625 36.375 \n", "Q 16.015625 21.96875 22.65625 14.328125 \n", "Q 29.296875 6.6875 41.796875 6.6875 \n", "Q 48.140625 6.6875 53.78125 8.984375 \n", "Q 59.421875 11.28125 64.40625 15.921875 \n", "L 64.40625 5.609375 \n", "Q 59.234375 2.09375 53.4375 0.328125 \n", "Q 47.65625 -1.421875 41.21875 -1.421875 \n", "Q 24.65625 -1.421875 15.125 8.703125 \n", "Q 5.609375 18.84375 5.609375 36.375 \n", "Q 5.609375 53.953125 15.125 64.078125 \n", "Q 24.65625 74.21875 41.21875 74.21875 \n", "Q 47.75 74.21875 53.53125 72.484375 \n", "Q 59.328125 70.75 64.40625 67.28125 \n", "z\n", "\" id=\"DejaVuSans-67\"/>\n", " <path d=\"M 54.890625 33.015625 \n", "L 54.890625 0 \n", "L 45.90625 0 \n", "L 45.90625 32.71875 \n", "Q 45.90625 40.484375 42.875 44.328125 \n", "Q 39.84375 48.1875 33.796875 48.1875 \n", "Q 26.515625 48.1875 22.3125 43.546875 \n", "Q 18.109375 38.921875 18.109375 30.90625 \n", "L 18.109375 0 \n", "L 9.078125 0 \n", "L 9.078125 75.984375 \n", "L 18.109375 75.984375 \n", "L 18.109375 46.1875 \n", "Q 21.34375 51.125 25.703125 53.5625 \n", "Q 30.078125 56 35.796875 56 \n", "Q 45.21875 56 50.046875 50.171875 \n", "Q 54.890625 44.34375 54.890625 33.015625 \n", "z\n", "\" id=\"DejaVuSans-104\"/>\n", " <path d=\"M 56.203125 29.59375 \n", "L 56.203125 25.203125 \n", "L 14.890625 25.203125 \n", "Q 15.484375 15.921875 20.484375 11.0625 \n", "Q 25.484375 6.203125 34.421875 6.203125 \n", "Q 39.59375 6.203125 44.453125 7.46875 \n", "Q 49.3125 8.734375 54.109375 11.28125 \n", "L 54.109375 2.78125 \n", "Q 49.265625 0.734375 44.1875 -0.34375 \n", "Q 39.109375 -1.421875 33.890625 -1.421875 \n", "Q 20.796875 -1.421875 13.15625 6.1875 \n", "Q 5.515625 13.8125 5.515625 26.8125 \n", "Q 5.515625 40.234375 12.765625 48.109375 \n", "Q 20.015625 56 32.328125 56 \n", "Q 43.359375 56 49.78125 48.890625 \n", "Q 56.203125 41.796875 56.203125 29.59375 \n", "z\n", "M 47.21875 32.234375 \n", "Q 47.125 39.59375 43.09375 43.984375 \n", "Q 39.0625 48.390625 32.421875 48.390625 \n", "Q 24.90625 48.390625 20.390625 44.140625 \n", "Q 15.875 39.890625 15.1875 32.171875 \n", "z\n", "\" id=\"DejaVuSans-101\"/>\n", " <path d=\"M 48.78125 52.59375 \n", "L 48.78125 44.1875 \n", "Q 44.96875 46.296875 41.140625 47.34375 \n", "Q 37.3125 48.390625 33.40625 48.390625 \n", "Q 24.65625 48.390625 19.8125 42.84375 \n", "Q 14.984375 37.3125 14.984375 27.296875 \n", "Q 14.984375 17.28125 19.8125 11.734375 \n", "Q 24.65625 6.203125 33.40625 6.203125 \n", "Q 37.3125 6.203125 41.140625 7.25 \n", "Q 44.96875 8.296875 48.78125 10.40625 \n", "L 48.78125 2.09375 \n", "Q 45.015625 0.34375 40.984375 -0.53125 \n", "Q 36.96875 -1.421875 32.421875 -1.421875 \n", "Q 20.0625 -1.421875 12.78125 6.34375 \n", "Q 5.515625 14.109375 5.515625 27.296875 \n", "Q 5.515625 40.671875 12.859375 48.328125 \n", "Q 20.21875 56 33.015625 56 \n", "Q 37.15625 56 41.109375 55.140625 \n", "Q 45.0625 54.296875 48.78125 52.59375 \n", "z\n", "\" id=\"DejaVuSans-99\"/>\n", " <path d=\"M 9.078125 75.984375 \n", "L 18.109375 75.984375 \n", "L 18.109375 31.109375 \n", "L 44.921875 54.6875 \n", "L 56.390625 54.6875 \n", "L 27.390625 29.109375 \n", "L 57.625 0 \n", "L 45.90625 0 \n", "L 18.109375 26.703125 \n", "L 18.109375 0 \n", "L 9.078125 0 \n", "z\n", "\" id=\"DejaVuSans-107\"/>\n", " <path d=\"M 9.421875 54.6875 \n", "L 18.40625 54.6875 \n", "L 18.40625 0 \n", "L 9.421875 0 \n", "z\n", "M 9.421875 75.984375 \n", "L 18.40625 75.984375 \n", "L 18.40625 64.59375 \n", "L 9.421875 64.59375 \n", "z\n", "\" id=\"DejaVuSans-105\"/>\n", " <path d=\"M 54.890625 33.015625 \n", "L 54.890625 0 \n", "L 45.90625 0 \n", "L 45.90625 32.71875 \n", "Q 45.90625 40.484375 42.875 44.328125 \n", "Q 39.84375 48.1875 33.796875 48.1875 \n", "Q 26.515625 48.1875 22.3125 43.546875 \n", "Q 18.109375 38.921875 18.109375 30.90625 \n", "L 18.109375 0 \n", "L 9.078125 0 \n", "L 9.078125 54.6875 \n", "L 18.109375 54.6875 \n", "L 18.109375 46.1875 \n", "Q 21.34375 51.125 25.703125 53.5625 \n", "Q 30.078125 56 35.796875 56 \n", "Q 45.21875 56 50.046875 50.171875 \n", "Q 54.890625 44.34375 54.890625 33.015625 \n", "z\n", "\" id=\"DejaVuSans-110\"/>\n", " <path id=\"DejaVuSans-32\"/>\n", " <path d=\"M 45.40625 46.390625 \n", "L 45.40625 75.984375 \n", "L 54.390625 75.984375 \n", "L 54.390625 0 \n", "L 45.40625 0 \n", "L 45.40625 8.203125 \n", "Q 42.578125 3.328125 38.25 0.953125 \n", "Q 33.9375 -1.421875 27.875 -1.421875 \n", "Q 17.96875 -1.421875 11.734375 6.484375 \n", "Q 5.515625 14.40625 5.515625 27.296875 \n", "Q 5.515625 40.1875 11.734375 48.09375 \n", "Q 17.96875 56 27.875 56 \n", "Q 33.9375 56 38.25 53.625 \n", "Q 42.578125 51.265625 45.40625 46.390625 \n", "z\n", "M 14.796875 27.296875 \n", "Q 14.796875 17.390625 18.875 11.75 \n", "Q 22.953125 6.109375 30.078125 6.109375 \n", "Q 37.203125 6.109375 41.296875 11.75 \n", "Q 45.40625 17.390625 45.40625 27.296875 \n", "Q 45.40625 37.203125 41.296875 42.84375 \n", "Q 37.203125 48.484375 30.078125 48.484375 \n", "Q 22.953125 48.484375 18.875 42.84375 \n", "Q 14.796875 37.203125 14.796875 27.296875 \n", "z\n", "\" id=\"DejaVuSans-100\"/>\n", " <path d=\"M 54.890625 54.6875 \n", "L 35.109375 28.078125 \n", "L 55.90625 0 \n", "L 45.3125 0 \n", "L 29.390625 21.484375 \n", "L 13.484375 0 \n", "L 2.875 0 \n", "L 24.125 28.609375 \n", "L 4.6875 54.6875 \n", "L 15.28125 54.6875 \n", "L 29.78125 35.203125 \n", "L 44.28125 54.6875 \n", "z\n", "\" id=\"DejaVuSans-120\"/>\n", " </defs>\n", " <g transform=\"translate(175.885938 259.463437)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-67\"/>\n", " <use x=\"69.824219\" xlink:href=\"#DejaVuSans-104\"/>\n", " <use x=\"133.203125\" xlink:href=\"#DejaVuSans-101\"/>\n", " <use x=\"194.726562\" xlink:href=\"#DejaVuSans-99\"/>\n", " <use x=\"249.707031\" xlink:href=\"#DejaVuSans-107\"/>\n", " <use x=\"307.617188\" xlink:href=\"#DejaVuSans-105\"/>\n", " <use x=\"335.400391\" xlink:href=\"#DejaVuSans-110\"/>\n", " <use x=\"398.779297\" xlink:href=\"#DejaVuSans-32\"/>\n", " <use x=\"430.566406\" xlink:href=\"#DejaVuSans-105\"/>\n", " <use x=\"458.349609\" xlink:href=\"#DejaVuSans-110\"/>\n", " <use x=\"521.728516\" xlink:href=\"#DejaVuSans-100\"/>\n", " <use x=\"585.205078\" xlink:href=\"#DejaVuSans-101\"/>\n", " <use x=\"646.712891\" xlink:href=\"#DejaVuSans-120\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"matplotlib.axis_2\">\n", " <g id=\"ytick_1\">\n", " <g id=\"line2d_10\">\n", " <defs>\n", " <path d=\"M 0 0 \n", "L -3.5 0 \n", "\" id=\"mc174bd9713\" style=\"stroke:#000000;stroke-width:0.8;\"/>\n", " </defs>\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"43.78125\" xlink:href=\"#mc174bd9713\" y=\"228.14\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_11\">\n", " <!-- 0.0 -->\n", " <defs>\n", " <path d=\"M 10.6875 12.40625 \n", "L 21 12.40625 \n", "L 21 0 \n", "L 10.6875 0 \n", "z\n", "\" id=\"DejaVuSans-46\"/>\n", " </defs>\n", " <g transform=\"translate(20.878125 231.939219)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-48\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-46\"/>\n", " <use x=\"95.410156\" xlink:href=\"#DejaVuSans-48\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"ytick_2\">\n", " <g id=\"line2d_11\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"43.78125\" xlink:href=\"#mc174bd9713\" y=\"188.577356\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_12\">\n", " <!-- 0.2 -->\n", " <defs>\n", " <path d=\"M 19.1875 8.296875 \n", "L 53.609375 8.296875 \n", "L 53.609375 0 \n", "L 7.328125 0 \n", "L 7.328125 8.296875 \n", "Q 12.9375 14.109375 22.625 23.890625 \n", "Q 32.328125 33.6875 34.8125 36.53125 \n", "Q 39.546875 41.84375 41.421875 45.53125 \n", "Q 43.3125 49.21875 43.3125 52.78125 \n", "Q 43.3125 58.59375 39.234375 62.25 \n", "Q 35.15625 65.921875 28.609375 65.921875 \n", "Q 23.96875 65.921875 18.8125 64.3125 \n", "Q 13.671875 62.703125 7.8125 59.421875 \n", "L 7.8125 69.390625 \n", "Q 13.765625 71.78125 18.9375 73 \n", "Q 24.125 74.21875 28.421875 74.21875 \n", "Q 39.75 74.21875 46.484375 68.546875 \n", "Q 53.21875 62.890625 53.21875 53.421875 \n", "Q 53.21875 48.921875 51.53125 44.890625 \n", "Q 49.859375 40.875 45.40625 35.40625 \n", "Q 44.1875 33.984375 37.640625 27.21875 \n", "Q 31.109375 20.453125 19.1875 8.296875 \n", "z\n", "\" id=\"DejaVuSans-50\"/>\n", " </defs>\n", " <g transform=\"translate(20.878125 192.376575)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-48\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-46\"/>\n", " <use x=\"95.410156\" xlink:href=\"#DejaVuSans-50\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"ytick_3\">\n", " <g id=\"line2d_12\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"43.78125\" xlink:href=\"#mc174bd9713\" y=\"149.014712\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_13\">\n", " <!-- 0.4 -->\n", " <g transform=\"translate(20.878125 152.813931)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-48\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-46\"/>\n", " <use x=\"95.410156\" xlink:href=\"#DejaVuSans-52\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"ytick_4\">\n", " <g id=\"line2d_13\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"43.78125\" xlink:href=\"#mc174bd9713\" y=\"109.452068\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_14\">\n", " <!-- 0.6 -->\n", " <g transform=\"translate(20.878125 113.251287)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-48\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-46\"/>\n", " <use x=\"95.410156\" xlink:href=\"#DejaVuSans-54\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"ytick_5\">\n", " <g id=\"line2d_14\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"43.78125\" xlink:href=\"#mc174bd9713\" y=\"69.889424\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_15\">\n", " <!-- 0.8 -->\n", " <g transform=\"translate(20.878125 73.688643)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-48\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-46\"/>\n", " <use x=\"95.410156\" xlink:href=\"#DejaVuSans-56\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"ytick_6\">\n", " <g id=\"line2d_15\">\n", " <g>\n", " <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"43.78125\" xlink:href=\"#mc174bd9713\" y=\"30.32678\"/>\n", " </g>\n", " </g>\n", " <g id=\"text_16\">\n", " <!-- 1.0 -->\n", " <g transform=\"translate(20.878125 34.125999)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-49\"/>\n", " <use x=\"63.623047\" xlink:href=\"#DejaVuSans-46\"/>\n", " <use x=\"95.410156\" xlink:href=\"#DejaVuSans-48\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"text_17\">\n", " <!-- Repo size (MiB) -->\n", " <defs>\n", " <path d=\"M 44.390625 34.1875 \n", "Q 47.5625 33.109375 50.5625 29.59375 \n", "Q 53.5625 26.078125 56.59375 19.921875 \n", "L 66.609375 0 \n", "L 56 0 \n", "L 46.6875 18.703125 \n", "Q 43.0625 26.03125 39.671875 28.421875 \n", "Q 36.28125 30.8125 30.421875 30.8125 \n", "L 19.671875 30.8125 \n", "L 19.671875 0 \n", "L 9.8125 0 \n", "L 9.8125 72.90625 \n", "L 32.078125 72.90625 \n", "Q 44.578125 72.90625 50.734375 67.671875 \n", "Q 56.890625 62.453125 56.890625 51.90625 \n", "Q 56.890625 45.015625 53.6875 40.46875 \n", "Q 50.484375 35.9375 44.390625 34.1875 \n", "z\n", "M 19.671875 64.796875 \n", "L 19.671875 38.921875 \n", "L 32.078125 38.921875 \n", "Q 39.203125 38.921875 42.84375 42.21875 \n", "Q 46.484375 45.515625 46.484375 51.90625 \n", "Q 46.484375 58.296875 42.84375 61.546875 \n", "Q 39.203125 64.796875 32.078125 64.796875 \n", "z\n", "\" id=\"DejaVuSans-82\"/>\n", " <path d=\"M 18.109375 8.203125 \n", "L 18.109375 -20.796875 \n", "L 9.078125 -20.796875 \n", "L 9.078125 54.6875 \n", "L 18.109375 54.6875 \n", "L 18.109375 46.390625 \n", "Q 20.953125 51.265625 25.265625 53.625 \n", "Q 29.59375 56 35.59375 56 \n", "Q 45.5625 56 51.78125 48.09375 \n", "Q 58.015625 40.1875 58.015625 27.296875 \n", "Q 58.015625 14.40625 51.78125 6.484375 \n", "Q 45.5625 -1.421875 35.59375 -1.421875 \n", "Q 29.59375 -1.421875 25.265625 0.953125 \n", "Q 20.953125 3.328125 18.109375 8.203125 \n", "z\n", "M 48.6875 27.296875 \n", "Q 48.6875 37.203125 44.609375 42.84375 \n", "Q 40.53125 48.484375 33.40625 48.484375 \n", "Q 26.265625 48.484375 22.1875 42.84375 \n", "Q 18.109375 37.203125 18.109375 27.296875 \n", "Q 18.109375 17.390625 22.1875 11.75 \n", "Q 26.265625 6.109375 33.40625 6.109375 \n", "Q 40.53125 6.109375 44.609375 11.75 \n", "Q 48.6875 17.390625 48.6875 27.296875 \n", "z\n", "\" id=\"DejaVuSans-112\"/>\n", " <path d=\"M 30.609375 48.390625 \n", "Q 23.390625 48.390625 19.1875 42.75 \n", "Q 14.984375 37.109375 14.984375 27.296875 \n", "Q 14.984375 17.484375 19.15625 11.84375 \n", "Q 23.34375 6.203125 30.609375 6.203125 \n", "Q 37.796875 6.203125 41.984375 11.859375 \n", "Q 46.1875 17.53125 46.1875 27.296875 \n", "Q 46.1875 37.015625 41.984375 42.703125 \n", "Q 37.796875 48.390625 30.609375 48.390625 \n", "z\n", "M 30.609375 56 \n", "Q 42.328125 56 49.015625 48.375 \n", "Q 55.71875 40.765625 55.71875 27.296875 \n", "Q 55.71875 13.875 49.015625 6.21875 \n", "Q 42.328125 -1.421875 30.609375 -1.421875 \n", "Q 18.84375 -1.421875 12.171875 6.21875 \n", "Q 5.515625 13.875 5.515625 27.296875 \n", "Q 5.515625 40.765625 12.171875 48.375 \n", "Q 18.84375 56 30.609375 56 \n", "z\n", "\" id=\"DejaVuSans-111\"/>\n", " <path d=\"M 44.28125 53.078125 \n", "L 44.28125 44.578125 \n", "Q 40.484375 46.53125 36.375 47.5 \n", "Q 32.28125 48.484375 27.875 48.484375 \n", "Q 21.1875 48.484375 17.84375 46.4375 \n", "Q 14.5 44.390625 14.5 40.28125 \n", "Q 14.5 37.15625 16.890625 35.375 \n", "Q 19.28125 33.59375 26.515625 31.984375 \n", "L 29.59375 31.296875 \n", "Q 39.15625 29.25 43.1875 25.515625 \n", "Q 47.21875 21.78125 47.21875 15.09375 \n", "Q 47.21875 7.46875 41.1875 3.015625 \n", "Q 35.15625 -1.421875 24.609375 -1.421875 \n", "Q 20.21875 -1.421875 15.453125 -0.5625 \n", "Q 10.6875 0.296875 5.421875 2 \n", "L 5.421875 11.28125 \n", "Q 10.40625 8.6875 15.234375 7.390625 \n", "Q 20.0625 6.109375 24.8125 6.109375 \n", "Q 31.15625 6.109375 34.5625 8.28125 \n", "Q 37.984375 10.453125 37.984375 14.40625 \n", "Q 37.984375 18.0625 35.515625 20.015625 \n", "Q 33.0625 21.96875 24.703125 23.78125 \n", "L 21.578125 24.515625 \n", "Q 13.234375 26.265625 9.515625 29.90625 \n", "Q 5.8125 33.546875 5.8125 39.890625 \n", "Q 5.8125 47.609375 11.28125 51.796875 \n", "Q 16.75 56 26.8125 56 \n", "Q 31.78125 56 36.171875 55.265625 \n", "Q 40.578125 54.546875 44.28125 53.078125 \n", "z\n", "\" id=\"DejaVuSans-115\"/>\n", " <path d=\"M 5.515625 54.6875 \n", "L 48.1875 54.6875 \n", "L 48.1875 46.484375 \n", "L 14.40625 7.171875 \n", "L 48.1875 7.171875 \n", "L 48.1875 0 \n", "L 4.296875 0 \n", "L 4.296875 8.203125 \n", "L 38.09375 47.515625 \n", "L 5.515625 47.515625 \n", "z\n", "\" id=\"DejaVuSans-122\"/>\n", " <path d=\"M 31 75.875 \n", "Q 24.46875 64.65625 21.28125 53.65625 \n", "Q 18.109375 42.671875 18.109375 31.390625 \n", "Q 18.109375 20.125 21.3125 9.0625 \n", "Q 24.515625 -2 31 -13.1875 \n", "L 23.1875 -13.1875 \n", "Q 15.875 -1.703125 12.234375 9.375 \n", "Q 8.59375 20.453125 8.59375 31.390625 \n", "Q 8.59375 42.28125 12.203125 53.3125 \n", "Q 15.828125 64.359375 23.1875 75.875 \n", "z\n", "\" id=\"DejaVuSans-40\"/>\n", " <path d=\"M 9.8125 72.90625 \n", "L 24.515625 72.90625 \n", "L 43.109375 23.296875 \n", "L 61.8125 72.90625 \n", "L 76.515625 72.90625 \n", "L 76.515625 0 \n", "L 66.890625 0 \n", "L 66.890625 64.015625 \n", "L 48.09375 14.015625 \n", "L 38.1875 14.015625 \n", "L 19.390625 64.015625 \n", "L 19.390625 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-77\"/>\n", " <path d=\"M 19.671875 34.8125 \n", "L 19.671875 8.109375 \n", "L 35.5 8.109375 \n", "Q 43.453125 8.109375 47.28125 11.40625 \n", "Q 51.125 14.703125 51.125 21.484375 \n", "Q 51.125 28.328125 47.28125 31.5625 \n", "Q 43.453125 34.8125 35.5 34.8125 \n", "z\n", "M 19.671875 64.796875 \n", "L 19.671875 42.828125 \n", "L 34.28125 42.828125 \n", "Q 41.5 42.828125 45.03125 45.53125 \n", "Q 48.578125 48.25 48.578125 53.8125 \n", "Q 48.578125 59.328125 45.03125 62.0625 \n", "Q 41.5 64.796875 34.28125 64.796875 \n", "z\n", "M 9.8125 72.90625 \n", "L 35.015625 72.90625 \n", "Q 46.296875 72.90625 52.390625 68.21875 \n", "Q 58.5 63.53125 58.5 54.890625 \n", "Q 58.5 48.1875 55.375 44.234375 \n", "Q 52.25 40.28125 46.1875 39.3125 \n", "Q 53.46875 37.75 57.5 32.78125 \n", "Q 61.53125 27.828125 61.53125 20.40625 \n", "Q 61.53125 10.640625 54.890625 5.3125 \n", "Q 48.25 0 35.984375 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-66\"/>\n", " <path d=\"M 8.015625 75.875 \n", "L 15.828125 75.875 \n", "Q 23.140625 64.359375 26.78125 53.3125 \n", "Q 30.421875 42.28125 30.421875 31.390625 \n", "Q 30.421875 20.453125 26.78125 9.375 \n", "Q 23.140625 -1.703125 15.828125 -13.1875 \n", "L 8.015625 -13.1875 \n", "Q 14.5 -2 17.703125 9.0625 \n", "Q 20.90625 20.125 20.90625 31.390625 \n", "Q 20.90625 42.671875 17.703125 53.65625 \n", "Q 14.5 64.65625 8.015625 75.875 \n", "z\n", "\" id=\"DejaVuSans-41\"/>\n", " </defs>\n", " <g transform=\"translate(14.798438 158.109062)rotate(-90)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-82\"/>\n", " <use x=\"69.419922\" xlink:href=\"#DejaVuSans-101\"/>\n", " <use x=\"130.943359\" xlink:href=\"#DejaVuSans-112\"/>\n", " <use x=\"194.419922\" xlink:href=\"#DejaVuSans-111\"/>\n", " <use x=\"255.601562\" xlink:href=\"#DejaVuSans-32\"/>\n", " <use x=\"287.388672\" xlink:href=\"#DejaVuSans-115\"/>\n", " <use x=\"339.488281\" xlink:href=\"#DejaVuSans-105\"/>\n", " <use x=\"367.271484\" xlink:href=\"#DejaVuSans-122\"/>\n", " <use x=\"419.761719\" xlink:href=\"#DejaVuSans-101\"/>\n", " <use x=\"481.285156\" xlink:href=\"#DejaVuSans-32\"/>\n", " <use x=\"513.072266\" xlink:href=\"#DejaVuSans-40\"/>\n", " <use x=\"552.085938\" xlink:href=\"#DejaVuSans-77\"/>\n", " <use x=\"638.365234\" xlink:href=\"#DejaVuSans-105\"/>\n", " <use x=\"666.148438\" xlink:href=\"#DejaVuSans-66\"/>\n", " <use x=\"734.751953\" xlink:href=\"#DejaVuSans-41\"/>\n", " </g>\n", " </g>\n", " </g>\n", " <g id=\"patch_39\">\n", " <path d=\"M 43.78125 228.14 \n", "L 43.78125 10.7 \n", "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n", " </g>\n", " <g id=\"patch_40\">\n", " <path d=\"M 378.58125 228.14 \n", "L 378.58125 10.7 \n", "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n", " </g>\n", " <g id=\"patch_41\">\n", " <path d=\"M 43.78125 228.14 \n", "L 378.58125 228.14 \n", "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n", " </g>\n", " <g id=\"patch_42\">\n", " <path d=\"M 43.78125 10.7 \n", "L 378.58125 10.7 \n", "\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\n", " </g>\n", " <g id=\"legend_1\">\n", " <g id=\"patch_43\">\n", " <path d=\"M 50.78125 77.4125 \n", "L 105.828125 77.4125 \n", "Q 107.828125 77.4125 107.828125 75.4125 \n", "L 107.828125 17.7 \n", "Q 107.828125 15.7 105.828125 15.7 \n", "L 50.78125 15.7 \n", "Q 48.78125 15.7 48.78125 17.7 \n", "L 48.78125 75.4125 \n", "Q 48.78125 77.4125 50.78125 77.4125 \n", "z\n", "\" style=\"fill:#ffffff;opacity:0.8;stroke:#cccccc;stroke-linejoin:miter;\"/>\n", " </g>\n", " <g id=\"patch_44\">\n", " <path d=\"M 52.78125 27.298437 \n", "L 72.78125 27.298437 \n", "L 72.78125 20.298437 \n", "L 52.78125 20.298437 \n", "z\n", "\" style=\"fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"text_18\">\n", " <!-- JPEG -->\n", " <defs>\n", " <path d=\"M 9.8125 72.90625 \n", "L 19.671875 72.90625 \n", "L 19.671875 5.078125 \n", "Q 19.671875 -8.109375 14.671875 -14.0625 \n", "Q 9.671875 -20.015625 -1.421875 -20.015625 \n", "L -5.171875 -20.015625 \n", "L -5.171875 -11.71875 \n", "L -2.09375 -11.71875 \n", "Q 4.4375 -11.71875 7.125 -8.046875 \n", "Q 9.8125 -4.390625 9.8125 5.078125 \n", "z\n", "\" id=\"DejaVuSans-74\"/>\n", " <path d=\"M 19.671875 64.796875 \n", "L 19.671875 37.40625 \n", "L 32.078125 37.40625 \n", "Q 38.96875 37.40625 42.71875 40.96875 \n", "Q 46.484375 44.53125 46.484375 51.125 \n", "Q 46.484375 57.671875 42.71875 61.234375 \n", "Q 38.96875 64.796875 32.078125 64.796875 \n", "z\n", "M 9.8125 72.90625 \n", "L 32.078125 72.90625 \n", "Q 44.34375 72.90625 50.609375 67.359375 \n", "Q 56.890625 61.8125 56.890625 51.125 \n", "Q 56.890625 40.328125 50.609375 34.8125 \n", "Q 44.34375 29.296875 32.078125 29.296875 \n", "L 19.671875 29.296875 \n", "L 19.671875 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-80\"/>\n", " <path d=\"M 9.8125 72.90625 \n", "L 55.90625 72.90625 \n", "L 55.90625 64.59375 \n", "L 19.671875 64.59375 \n", "L 19.671875 43.015625 \n", "L 54.390625 43.015625 \n", "L 54.390625 34.71875 \n", "L 19.671875 34.71875 \n", "L 19.671875 8.296875 \n", "L 56.78125 8.296875 \n", "L 56.78125 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-69\"/>\n", " <path d=\"M 59.515625 10.40625 \n", "L 59.515625 29.984375 \n", "L 43.40625 29.984375 \n", "L 43.40625 38.09375 \n", "L 69.28125 38.09375 \n", "L 69.28125 6.78125 \n", "Q 63.578125 2.734375 56.6875 0.65625 \n", "Q 49.8125 -1.421875 42 -1.421875 \n", "Q 24.90625 -1.421875 15.25 8.5625 \n", "Q 5.609375 18.5625 5.609375 36.375 \n", "Q 5.609375 54.25 15.25 64.234375 \n", "Q 24.90625 74.21875 42 74.21875 \n", "Q 49.125 74.21875 55.546875 72.453125 \n", "Q 61.96875 70.703125 67.390625 67.28125 \n", "L 67.390625 56.78125 \n", "Q 61.921875 61.421875 55.765625 63.765625 \n", "Q 49.609375 66.109375 42.828125 66.109375 \n", "Q 29.4375 66.109375 22.71875 58.640625 \n", "Q 16.015625 51.171875 16.015625 36.375 \n", "Q 16.015625 21.625 22.71875 14.15625 \n", "Q 29.4375 6.6875 42.828125 6.6875 \n", "Q 48.046875 6.6875 52.140625 7.59375 \n", "Q 56.25 8.5 59.515625 10.40625 \n", "z\n", "\" id=\"DejaVuSans-71\"/>\n", " </defs>\n", " <g transform=\"translate(80.78125 27.298437)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-74\"/>\n", " <use x=\"29.492188\" xlink:href=\"#DejaVuSans-80\"/>\n", " <use x=\"89.794922\" xlink:href=\"#DejaVuSans-69\"/>\n", " <use x=\"152.978516\" xlink:href=\"#DejaVuSans-71\"/>\n", " </g>\n", " </g>\n", " <g id=\"patch_45\">\n", " <path d=\"M 52.78125 41.976562 \n", "L 72.78125 41.976562 \n", "L 72.78125 34.976562 \n", "L 52.78125 34.976562 \n", "z\n", "\" style=\"fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"text_19\">\n", " <!-- BMP -->\n", " <g transform=\"translate(80.78125 41.976562)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-66\"/>\n", " <use x=\"68.603516\" xlink:href=\"#DejaVuSans-77\"/>\n", " <use x=\"154.882812\" xlink:href=\"#DejaVuSans-80\"/>\n", " </g>\n", " </g>\n", " <g id=\"patch_46\">\n", " <path d=\"M 52.78125 56.654687 \n", "L 72.78125 56.654687 \n", "L 72.78125 49.654687 \n", "L 52.78125 49.654687 \n", "z\n", "\" style=\"fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"text_20\">\n", " <!-- TIFF -->\n", " <defs>\n", " <path d=\"M -0.296875 72.90625 \n", "L 61.375 72.90625 \n", "L 61.375 64.59375 \n", "L 35.5 64.59375 \n", "L 35.5 0 \n", "L 25.59375 0 \n", "L 25.59375 64.59375 \n", "L -0.296875 64.59375 \n", "z\n", "\" id=\"DejaVuSans-84\"/>\n", " <path d=\"M 9.8125 72.90625 \n", "L 19.671875 72.90625 \n", "L 19.671875 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-73\"/>\n", " <path d=\"M 9.8125 72.90625 \n", "L 51.703125 72.90625 \n", "L 51.703125 64.59375 \n", "L 19.671875 64.59375 \n", "L 19.671875 43.109375 \n", "L 48.578125 43.109375 \n", "L 48.578125 34.8125 \n", "L 19.671875 34.8125 \n", "L 19.671875 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-70\"/>\n", " </defs>\n", " <g transform=\"translate(80.78125 56.654687)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-84\"/>\n", " <use x=\"61.083984\" xlink:href=\"#DejaVuSans-73\"/>\n", " <use x=\"90.576172\" xlink:href=\"#DejaVuSans-70\"/>\n", " <use x=\"148.095703\" xlink:href=\"#DejaVuSans-70\"/>\n", " </g>\n", " </g>\n", " <g id=\"patch_47\">\n", " <path d=\"M 52.78125 71.332812 \n", "L 72.78125 71.332812 \n", "L 72.78125 64.332812 \n", "L 52.78125 64.332812 \n", "z\n", "\" style=\"fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;\"/>\n", " </g>\n", " <g id=\"text_21\">\n", " <!-- PNG -->\n", " <defs>\n", " <path d=\"M 9.8125 72.90625 \n", "L 23.09375 72.90625 \n", "L 55.421875 11.921875 \n", "L 55.421875 72.90625 \n", "L 64.984375 72.90625 \n", "L 64.984375 0 \n", "L 51.703125 0 \n", "L 19.390625 60.984375 \n", "L 19.390625 0 \n", "L 9.8125 0 \n", "z\n", "\" id=\"DejaVuSans-78\"/>\n", " </defs>\n", " <g transform=\"translate(80.78125 71.332812)scale(0.1 -0.1)\">\n", " <use xlink:href=\"#DejaVuSans-80\"/>\n", " <use x=\"60.302734\" xlink:href=\"#DejaVuSans-78\"/>\n", " <use x=\"135.107422\" xlink:href=\"#DejaVuSans-71\"/>\n", " </g>\n", " </g>\n", " </g>\n", " </g>\n", " </g>\n", " <defs>\n", " <clipPath id=\"p836f19e185\">\n", " <rect height=\"217.44\" width=\"334.8\" x=\"43.78125\" y=\"10.7\"/>\n", " </clipPath>\n", " </defs>\n", "</svg>\n" ], "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "%config InlineBackend.figure_formats = ['svg']\n", "\n", "import matplotlib as mpl\n", "import matplotlib.pyplot as plt\n", "\n", "# Merge per-format test data into a single DataFrame without the first\n", "# first 3 rows: the initial empty repo state (boring) and the repo DB\n", "# size as it \"settles\" in its first few checkins.\n", "data = pd.concat(repo_sizes, axis=1).drop(range(3))\n", "\n", "mpl.rcParams['figure.figsize'] = (6, 4)\n", "ax = data.plot(kind = 'bar', colormap = 'coolwarm',\n", " grid = False, width = 0.8,\n", " edgecolor = 'white', linewidth = 2)\n", "ax.axes.set_xlabel('Checkin index')\n", "ax.axes.set_ylabel('Repo size (MiB)')\n", "plt.savefig('image-format-vs-repo-size.svg', transparent=True)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 } |
Added www/image-format-vs-repo-size.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Image Format vs Fossil Repo Size ## The Problem Fossil has a [delta compression][dc] feature which removes redundant information from a file — with respect to the version checked in at the tip of the current working branch — when checking in a subsequent version.¹ That delta is then [zlib][zl]-compressed before being stored in the Fossil repository database file. Storing pre-compressed data files in a Fossil repository defeats both of these space-saving measures: 1. Binary data compression algorithms — whether lossless as with zlib or lossy as with JPEG — turn the file data into [pseudorandom noise][prn].² Typical data compression algorithms are not [hash functions][hf], where the goal is that a change to each bit in the input has a statistically even chance of changing every bit in the output, but because they do approach that pathological condition, pre-compressed data tends to defeat Fossil’s delta compression algorithm, there being so little correlation between two different outputs from the binary data compression algorithm. 2. An ideal lossless binary data compression algorithm cannot be applied more than once to make the data even smaller, since random noise is incompressible. The consequence for our purposes here is that pre-compressed data doesn’t benefit from Fossil’s zlib compression. You might then ask, what does it matter if the space savings comes from the application file format (e.g. JPEG, Zip, etc.) or from Fossil itself? It really doesn’t, as far as point 2 above goes, but point 1 causes the Fossil repository to balloon out of proportion to the size of the input data change on each checkin. This article will illustrate that problem, quantify it, and give a solution to it. [dc]: ./delta_format.wiki [hf]: https://en.wikipedia.org/wiki/Hash_function [prn]: https://en.wikipedia.org/wiki/Pseudorandomness [zl]: http://www.zlib.net/ ## Affected File Formats In this article’s core experiment, we use 2D image file formats, but this article’s advice also applies to many other file types. For just a few examples out of what must be thousands: * **Microsoft Office**: The [OOXML document format][oox] used from Office 2003 onward (`.docx`, `.xlsx`, `.pptx`, etc.) are Zip files containing an XML document file and several collateral files. * **Libre Office**: Its [ODF][odf] format is designed in more or less the same way as OOXML. * **Java**: A Java [`.jar` file][jcl] is a Zip file containing JVM `.class` files, manifest files, and more. * **Windows Installer:** An [`*.msi` file][wi] is a proprietary database format that contains, among other things, [Microsoft Cabinet][cab]-compressed files, which in turn may hold Windows executables, which [may themselves be compressed][exc]. * **SVG, PDF, TIFF, etc.**: Many file formats are available in both compressed and uncompressed forms. You should use the uncompressed form with Fossil wherever practical, as we will show below. [cab]: https://en.wikipedia.org/wiki/Cabinet_(file_format) [exc]: https://en.wikipedia.org/wiki/Executable_compression [jcl]: https://en.wikipedia.org/wiki/Java_(programming_language) [odf]: https://en.wikipedia.org/wiki/OpenDocument [oox]: https://en.wikipedia.org/wiki/Office_Open_XML [wi]: https://en.wikipedia.org/wiki/Windows_Installer ## Demonstration The companion `image-format-vs-repo-size.ipynb` file ([download][nbd], [preview][nbp]) is a [Jupyter][jp] notebook implementing the following experiment: 1. Create an empty Fossil repository; save its initial size. 2. Use [ImageMagick][im] via [Wand][wp] to generate a JPEG file of a particular size — currently 256 px² — filled with Gaussian noise to make data compression more difficult than with a solid-color image. 3. Check that image into the new Fossil repo, and remember that size. 4. Change a random pixel in the image to a random RGB value, save that image, check it in, and remember the new Fossil repo size. 5. Iterate on step 4 some number of times — currently 10 — and remember the Fossil repo size at each step. 6. Repeat the above steps for BMP, TIFF,³ and PNG. 7. Create a bar chart showing how the Fossil repository size changes with each checkin. We chose to use Jupyter for this because it makes it easy for you to modify the notebook to try different things. Want to see how the results change with a different image size? Easy, change the `size` value in the second cell of the notebook. Want to try more image formats? You can put anything ImageMagick can recognize into the `formats` list. Want to find the break-even point for images like those in your own repository? Easily done with a small amount of code. [im]: https://www.imagemagick.org/ [jp]: https://jupyter.org/ [nbd]: ./image-format-vs-repo-size.ipynb [nbp]: https://nbviewer.jupyter.org/urls/fossil-scm.org/fossil/doc/trunk/www/image-format-vs-repo-size.ipynb [wp]: http://wand-py.org/ ## Results Running the notebook gives a bar chart something like⁴ this:  There are a few key things we want to draw your attention to in that chart: * BMP and uncompressed TIFF are nearly identical in size for all checkins, and the repository growth rate is negligible.⁵ We owe this economy to Fossil’s delta compression feature. * The JPEG and TIFF bars increase by large amounts on most checkins even though each checkin encodes only a *single-pixel change*! * Because JPEG’s lossy nature allows it to start smaller and have smaller size increases than than PNG, the crossover point with BMP/TIFF isn’t until 7-9 checkins in typical runs of this [Monte Carlo experiment][mce]. Given a choice among these four file formats and a willingness to use lossy image compression, a rational tradeoff is to choose JPEG for repositories where each image will change fewer than that number of times. [mce]: https://en.wikipedia.org/wiki/Monte_Carlo_method ## Automated Recompression Since programs that produce and consume binary-compressed data files often make it either difficult or impossible to work with the uncompressed form, we want an automated method for producing the uncompressed form to make Fossil happy while still having the compressed form to keep our content creation applications happy. This `Makefile` should⁶ do that for BMP, PNG, SVG, and XLSX files: .SUFFIXES: .bmp .png .svg .svgz .svgz.svg: gzip -dc < $< > $@ .svg.svgz: gzip -9c < $< > $@ .bmp.png: convert -quality 95 $< $@ .png.bmp: convert $< $@ SS_FILES := $(wildcard spreadsheet/*) all: $(SS_FILES) illus.svg image.bmp doc-big.pdf reconstitute: illus.svgz image.png ( cd spreadsheet ; zip -9 ../spreadsheet.xlsx) * ) qpdf doc-big.pdf doc-small.pdf $(SS_FILES): spreadsheet.xlsx unzip $@ -d $< doc-big.pdf: doc-small.pdf qpdf --stream-data=uncompress $@ $< This `Makefile` allows you to treat the compressed version as the process input, but to actually check in only the changes against the uncompressed version by typing “`make`” before “`fossil ci`”. This is not actually an extra step in practice, since if you’ve got a `Makefile`-based project, you should be building (and testing!) it before checking each change in anyway! Because this technique is based on dependency rules, only the necessary files are generated on each `make` command. You only have to run “`make reconstitute`” *once* after opening a fresh Fossil checkout to produce those compressed sources. After that, you work with the compressed files in your content creation programs. Your build system might include some kind of bootstrapping or auto-configuration step that you could attach this to, so that it doesn’t need to be run by hand. This `Makefile` illustrates two primary strategies: ### Input and Output File Formats Differ by Extension In the case of SVG and the bitmap image formats, the file name extension differs between the cases, so we can use `make` suffix rules to get the behavior we want. The top half of the `Makefile` just tells `make` how to map from `*.svg` to `*.svgz` and vice versa, and the same for `*.bmp` to/from `*.png`. ### Input and Output Use the Same Extension We don’t have that luxury for Excel and PDF files, each for a different reason: * **Excel:** Excel has no way to work with the unpacked Zip file contents at all, so we have to unpack it into a subdirectory, which is what we check into Fossil. On making a fresh Fossil checkout, we have to pack that subdirectory’s contents back up into an `*.xlsx` file with “`make reconstitute`” so we can edit it with Excel again. * **PDF:** All PDF readers can display an uncompressed PDF file, but many PDF-*producing* programs have no option for uncompressed output. Since the file name extension is the same either way, we treat the compressed PDF as the source to the process, yielding an automatically-uncompressed PDF for the benefit of Fossil. Unlike with the Excel case, there is no simple “file base name to directory name” mapping, so we just created the `-big` to `-small` name scheme here. ---- ## Footnotes and Digressions 1. Several other programs also do delta compression, so they’ll also be affected by this problem: [rsync][rs], [Unison][us], [Git][git], etc. When using file copying and synchronization programs *without* delta compression, it’s best to use the most highly-compressed file format you can tolerate, since they copy the whole file any time any bit of it changes. 2. In fact, a good way to gauge the effectiveness of a given compression scheme is to run its output through the same sort of tests we use to gauge how “random” a given [PRNG][prng] is. Another way to look at it is that if there is a discernible pattern in the output of a compression scheme, it’s information that could be further compressed. 3. We're using *uncompressed* TIFF here, not [LZW][lzw]- or Zip-compressed TIFF, either of which would give similar results to PNG, which is always zlib-compressed. 4. The raw data changes somewhat from one run to the next due to the use of random noise in the image to make the zlib/PNG compression more difficult, and the random pixel changes. Those test design choices make this a [Monte Carlo experiment][mce]. We’ve found that the overall character of the results doesn’t change from one run to the next. The code in the notebook’s third cell drops the first three columns of data because the first column (the empty repository size) is boring, and the subsequent two checkins show the SQLite DB file format settling in with its first few checkins. There’s a single line in the notebook you can comment out to get a bar chart with these data included. If you do this, you’ll see a mildly interesting result: the size of the first checkin in the BMP and TIFF cases is roughly the same as that for the PNG case, because both PNG and Fossil use the zlib binary data compression algorithm. 5. A low-tech format like BMP will have a small edge in practice because TIFF metadata includes the option for multiple timestamps, UUIDs, etc., which bloat the checkin size by creating many small deltas. If you don't need the advantages of TIFF, a less capable image file format will give smaller checkin sizes for a given amount of change. 6. The `Makefile` above is not battle-tested. Please report bugs and needed extensions [on the forum][for]. [for]: https://fossil-scm.org/forum/forumpost/15e677f2c8 [git]: https://git-scm.com/ [lzw]: https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch [prng]: https://en.wikipedia.org/wiki/Pseudorandom_number_generator [rs]: https://rsync.samba.org/ [us]: http://www.cis.upenn.edu/~bcpierce/unison/ |
Added www/image-format-vs-repo-size.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 | <?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!-- Created with matplotlib (https://matplotlib.org/) --> <svg height="288pt" version="1.1" viewBox="0 0 432 288" width="432pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css"> *{stroke-linecap:butt;stroke-linejoin:round;} </style> </defs> <g id="figure_1"> <g id="patch_1"> <path d="M 0 288 L 432 288 L 432 0 L 0 0 z " style="fill:none;"/> </g> <g id="axes_1"> <g id="patch_2"> <path d="M 54 252 L 388.8 252 L 388.8 34.56 L 54 34.56 z " style="fill:none;"/> </g> <g id="patch_3"> <path clip-path="url(#pb43dd894ca)" d="M 63 252 L 70.2 252 L 70.2 178.592751 L 63 178.592751 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_4"> <path clip-path="url(#pb43dd894ca)" d="M 99 252 L 106.2 252 L 106.2 178.592751 L 99 178.592751 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_5"> <path clip-path="url(#pb43dd894ca)" d="M 135 252 L 142.2 252 L 142.2 168.547548 L 135 168.547548 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_6"> <path clip-path="url(#pb43dd894ca)" d="M 171 252 L 178.2 252 L 178.2 153.866098 L 171 153.866098 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_7"> <path clip-path="url(#pb43dd894ca)" d="M 207 252 L 214.2 252 L 214.2 152.320682 L 207 152.320682 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_8"> <path clip-path="url(#pb43dd894ca)" d="M 243 252 L 250.2 252 L 250.2 150.775267 L 243 150.775267 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_9"> <path clip-path="url(#pb43dd894ca)" d="M 279 252 L 286.2 252 L 286.2 150.775267 L 279 150.775267 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_10"> <path clip-path="url(#pb43dd894ca)" d="M 315 252 L 322.2 252 L 322.2 140.730064 L 315 140.730064 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_11"> <path clip-path="url(#pb43dd894ca)" d="M 351 252 L 358.2 252 L 358.2 134.548401 L 351 134.548401 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_12"> <path clip-path="url(#pb43dd894ca)" d="M 70.2 252 L 77.4 252 L 77.4 142.27548 L 70.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_13"> <path clip-path="url(#pb43dd894ca)" d="M 106.2 252 L 113.4 252 L 113.4 142.27548 L 106.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_14"> <path clip-path="url(#pb43dd894ca)" d="M 142.2 252 L 149.4 252 L 149.4 142.27548 L 142.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_15"> <path clip-path="url(#pb43dd894ca)" d="M 178.2 252 L 185.4 252 L 185.4 142.27548 L 178.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_16"> <path clip-path="url(#pb43dd894ca)" d="M 214.2 252 L 221.4 252 L 221.4 142.27548 L 214.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_17"> <path clip-path="url(#pb43dd894ca)" d="M 250.2 252 L 257.4 252 L 257.4 142.27548 L 250.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_18"> <path clip-path="url(#pb43dd894ca)" d="M 286.2 252 L 293.4 252 L 293.4 142.27548 L 286.2 142.27548 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_19"> <path clip-path="url(#pb43dd894ca)" d="M 322.2 252 L 329.4 252 L 329.4 141.502772 L 322.2 141.502772 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_20"> <path clip-path="url(#pb43dd894ca)" d="M 358.2 252 L 365.4 252 L 365.4 141.502772 L 358.2 141.502772 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_21"> <path clip-path="url(#pb43dd894ca)" d="M 77.4 252 L 84.6 252 L 84.6 142.27548 L 77.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_22"> <path clip-path="url(#pb43dd894ca)" d="M 113.4 252 L 120.6 252 L 120.6 142.27548 L 113.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_23"> <path clip-path="url(#pb43dd894ca)" d="M 149.4 252 L 156.6 252 L 156.6 142.27548 L 149.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_24"> <path clip-path="url(#pb43dd894ca)" d="M 185.4 252 L 192.6 252 L 192.6 142.27548 L 185.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_25"> <path clip-path="url(#pb43dd894ca)" d="M 221.4 252 L 228.6 252 L 228.6 142.27548 L 221.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_26"> <path clip-path="url(#pb43dd894ca)" d="M 257.4 252 L 264.6 252 L 264.6 142.27548 L 257.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_27"> <path clip-path="url(#pb43dd894ca)" d="M 293.4 252 L 300.6 252 L 300.6 142.27548 L 293.4 142.27548 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_28"> <path clip-path="url(#pb43dd894ca)" d="M 329.4 252 L 336.6 252 L 336.6 141.502772 L 329.4 141.502772 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_29"> <path clip-path="url(#pb43dd894ca)" d="M 365.4 252 L 372.6 252 L 372.6 141.502772 L 365.4 141.502772 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_30"> <path clip-path="url(#pb43dd894ca)" d="M 84.6 252 L 91.8 252 L 91.8 143.048188 L 84.6 143.048188 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_31"> <path clip-path="url(#pb43dd894ca)" d="M 120.6 252 L 127.8 252 L 127.8 128.366738 L 120.6 128.366738 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_32"> <path clip-path="url(#pb43dd894ca)" d="M 156.6 252 L 163.8 252 L 163.8 112.139872 L 156.6 112.139872 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_33"> <path clip-path="url(#pb43dd894ca)" d="M 192.6 252 L 199.8 252 L 199.8 101.321962 L 192.6 101.321962 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_34"> <path clip-path="url(#pb43dd894ca)" d="M 228.6 252 L 235.8 252 L 235.8 97.458422 L 228.6 97.458422 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_35"> <path clip-path="url(#pb43dd894ca)" d="M 264.6 252 L 271.8 252 L 271.8 81.231557 L 264.6 81.231557 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_36"> <path clip-path="url(#pb43dd894ca)" d="M 300.6 252 L 307.8 252 L 307.8 81.231557 L 300.6 81.231557 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_37"> <path clip-path="url(#pb43dd894ca)" d="M 336.6 252 L 343.8 252 L 343.8 55.732196 L 336.6 55.732196 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="patch_38"> <path clip-path="url(#pb43dd894ca)" d="M 372.6 252 L 379.8 252 L 379.8 44.914286 L 372.6 44.914286 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="matplotlib.axis_1"> <g id="xtick_1"> <g id="line2d_1"> <defs> <path d="M 0 0 L 0 3.5 " id="m4ac62df1f0" style="stroke:#000000;stroke-width:0.8;"/> </defs> <g> <use style="stroke:#000000;stroke-width:0.8;" x="77.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_1"> <!-- 3 --> <defs> <path d="M 40.578125 39.3125 Q 47.65625 37.796875 51.625 33 Q 55.609375 28.21875 55.609375 21.1875 Q 55.609375 10.40625 48.1875 4.484375 Q 40.765625 -1.421875 27.09375 -1.421875 Q 22.515625 -1.421875 17.65625 -0.515625 Q 12.796875 0.390625 7.625 2.203125 L 7.625 11.71875 Q 11.71875 9.328125 16.59375 8.109375 Q 21.484375 6.890625 26.8125 6.890625 Q 36.078125 6.890625 40.9375 10.546875 Q 45.796875 14.203125 45.796875 21.1875 Q 45.796875 27.640625 41.28125 31.265625 Q 36.765625 34.90625 28.71875 34.90625 L 20.21875 34.90625 L 20.21875 43.015625 L 29.109375 43.015625 Q 36.375 43.015625 40.234375 45.921875 Q 44.09375 48.828125 44.09375 54.296875 Q 44.09375 59.90625 40.109375 62.90625 Q 36.140625 65.921875 28.71875 65.921875 Q 24.65625 65.921875 20.015625 65.03125 Q 15.375 64.15625 9.8125 62.3125 L 9.8125 71.09375 Q 15.4375 72.65625 20.34375 73.4375 Q 25.25 74.21875 29.59375 74.21875 Q 40.828125 74.21875 47.359375 69.109375 Q 53.90625 64.015625 53.90625 55.328125 Q 53.90625 49.265625 50.4375 45.09375 Q 46.96875 40.921875 40.578125 39.3125 z " id="DejaVuSans-51"/> </defs> <g transform="translate(80.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-51"/> </g> </g> </g> <g id="xtick_2"> <g id="line2d_2"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="113.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_2"> <!-- 4 --> <defs> <path d="M 37.796875 64.3125 L 12.890625 25.390625 L 37.796875 25.390625 z M 35.203125 72.90625 L 47.609375 72.90625 L 47.609375 25.390625 L 58.015625 25.390625 L 58.015625 17.1875 L 47.609375 17.1875 L 47.609375 0 L 37.796875 0 L 37.796875 17.1875 L 4.890625 17.1875 L 4.890625 26.703125 z " id="DejaVuSans-52"/> </defs> <g transform="translate(116.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-52"/> </g> </g> </g> <g id="xtick_3"> <g id="line2d_3"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="149.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_3"> <!-- 5 --> <defs> <path d="M 10.796875 72.90625 L 49.515625 72.90625 L 49.515625 64.59375 L 19.828125 64.59375 L 19.828125 46.734375 Q 21.96875 47.46875 24.109375 47.828125 Q 26.265625 48.1875 28.421875 48.1875 Q 40.625 48.1875 47.75 41.5 Q 54.890625 34.8125 54.890625 23.390625 Q 54.890625 11.625 47.5625 5.09375 Q 40.234375 -1.421875 26.90625 -1.421875 Q 22.3125 -1.421875 17.546875 -0.640625 Q 12.796875 0.140625 7.71875 1.703125 L 7.71875 11.625 Q 12.109375 9.234375 16.796875 8.0625 Q 21.484375 6.890625 26.703125 6.890625 Q 35.15625 6.890625 40.078125 11.328125 Q 45.015625 15.765625 45.015625 23.390625 Q 45.015625 31 40.078125 35.4375 Q 35.15625 39.890625 26.703125 39.890625 Q 22.75 39.890625 18.8125 39.015625 Q 14.890625 38.140625 10.796875 36.28125 z " id="DejaVuSans-53"/> </defs> <g transform="translate(152.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-53"/> </g> </g> </g> <g id="xtick_4"> <g id="line2d_4"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="185.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_4"> <!-- 6 --> <defs> <path d="M 33.015625 40.375 Q 26.375 40.375 22.484375 35.828125 Q 18.609375 31.296875 18.609375 23.390625 Q 18.609375 15.53125 22.484375 10.953125 Q 26.375 6.390625 33.015625 6.390625 Q 39.65625 6.390625 43.53125 10.953125 Q 47.40625 15.53125 47.40625 23.390625 Q 47.40625 31.296875 43.53125 35.828125 Q 39.65625 40.375 33.015625 40.375 z M 52.59375 71.296875 L 52.59375 62.3125 Q 48.875 64.0625 45.09375 64.984375 Q 41.3125 65.921875 37.59375 65.921875 Q 27.828125 65.921875 22.671875 59.328125 Q 17.53125 52.734375 16.796875 39.40625 Q 19.671875 43.65625 24.015625 45.921875 Q 28.375 48.1875 33.59375 48.1875 Q 44.578125 48.1875 50.953125 41.515625 Q 57.328125 34.859375 57.328125 23.390625 Q 57.328125 12.15625 50.6875 5.359375 Q 44.046875 -1.421875 33.015625 -1.421875 Q 20.359375 -1.421875 13.671875 8.265625 Q 6.984375 17.96875 6.984375 36.375 Q 6.984375 53.65625 15.1875 63.9375 Q 23.390625 74.21875 37.203125 74.21875 Q 40.921875 74.21875 44.703125 73.484375 Q 48.484375 72.75 52.59375 71.296875 z " id="DejaVuSans-54"/> </defs> <g transform="translate(188.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-54"/> </g> </g> </g> <g id="xtick_5"> <g id="line2d_5"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="221.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_5"> <!-- 7 --> <defs> <path d="M 8.203125 72.90625 L 55.078125 72.90625 L 55.078125 68.703125 L 28.609375 0 L 18.3125 0 L 43.21875 64.59375 L 8.203125 64.59375 z " id="DejaVuSans-55"/> </defs> <g transform="translate(224.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-55"/> </g> </g> </g> <g id="xtick_6"> <g id="line2d_6"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="257.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_6"> <!-- 8 --> <defs> <path d="M 31.78125 34.625 Q 24.75 34.625 20.71875 30.859375 Q 16.703125 27.09375 16.703125 20.515625 Q 16.703125 13.921875 20.71875 10.15625 Q 24.75 6.390625 31.78125 6.390625 Q 38.8125 6.390625 42.859375 10.171875 Q 46.921875 13.96875 46.921875 20.515625 Q 46.921875 27.09375 42.890625 30.859375 Q 38.875 34.625 31.78125 34.625 z M 21.921875 38.8125 Q 15.578125 40.375 12.03125 44.71875 Q 8.5 49.078125 8.5 55.328125 Q 8.5 64.0625 14.71875 69.140625 Q 20.953125 74.21875 31.78125 74.21875 Q 42.671875 74.21875 48.875 69.140625 Q 55.078125 64.0625 55.078125 55.328125 Q 55.078125 49.078125 51.53125 44.71875 Q 48 40.375 41.703125 38.8125 Q 48.828125 37.15625 52.796875 32.3125 Q 56.78125 27.484375 56.78125 20.515625 Q 56.78125 9.90625 50.3125 4.234375 Q 43.84375 -1.421875 31.78125 -1.421875 Q 19.734375 -1.421875 13.25 4.234375 Q 6.78125 9.90625 6.78125 20.515625 Q 6.78125 27.484375 10.78125 32.3125 Q 14.796875 37.15625 21.921875 38.8125 z M 18.3125 54.390625 Q 18.3125 48.734375 21.84375 45.5625 Q 25.390625 42.390625 31.78125 42.390625 Q 38.140625 42.390625 41.71875 45.5625 Q 45.3125 48.734375 45.3125 54.390625 Q 45.3125 60.0625 41.71875 63.234375 Q 38.140625 66.40625 31.78125 66.40625 Q 25.390625 66.40625 21.84375 63.234375 Q 18.3125 60.0625 18.3125 54.390625 z " id="DejaVuSans-56"/> </defs> <g transform="translate(260.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-56"/> </g> </g> </g> <g id="xtick_7"> <g id="line2d_7"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="293.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_7"> <!-- 9 --> <defs> <path d="M 10.984375 1.515625 L 10.984375 10.5 Q 14.703125 8.734375 18.5 7.8125 Q 22.3125 6.890625 25.984375 6.890625 Q 35.75 6.890625 40.890625 13.453125 Q 46.046875 20.015625 46.78125 33.40625 Q 43.953125 29.203125 39.59375 26.953125 Q 35.25 24.703125 29.984375 24.703125 Q 19.046875 24.703125 12.671875 31.3125 Q 6.296875 37.9375 6.296875 49.421875 Q 6.296875 60.640625 12.9375 67.421875 Q 19.578125 74.21875 30.609375 74.21875 Q 43.265625 74.21875 49.921875 64.515625 Q 56.59375 54.828125 56.59375 36.375 Q 56.59375 19.140625 48.40625 8.859375 Q 40.234375 -1.421875 26.421875 -1.421875 Q 22.703125 -1.421875 18.890625 -0.6875 Q 15.09375 0.046875 10.984375 1.515625 z M 30.609375 32.421875 Q 37.25 32.421875 41.125 36.953125 Q 45.015625 41.5 45.015625 49.421875 Q 45.015625 57.28125 41.125 61.84375 Q 37.25 66.40625 30.609375 66.40625 Q 23.96875 66.40625 20.09375 61.84375 Q 16.21875 57.28125 16.21875 49.421875 Q 16.21875 41.5 20.09375 36.953125 Q 23.96875 32.421875 30.609375 32.421875 z " id="DejaVuSans-57"/> </defs> <g transform="translate(296.159375 265.3625)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-57"/> </g> </g> </g> <g id="xtick_8"> <g id="line2d_8"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="329.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_8"> <!-- 10 --> <defs> <path d="M 12.40625 8.296875 L 28.515625 8.296875 L 28.515625 63.921875 L 10.984375 60.40625 L 10.984375 69.390625 L 28.421875 72.90625 L 38.28125 72.90625 L 38.28125 8.296875 L 54.390625 8.296875 L 54.390625 0 L 12.40625 0 z " id="DejaVuSans-49"/> <path d="M 31.78125 66.40625 Q 24.171875 66.40625 20.328125 58.90625 Q 16.5 51.421875 16.5 36.375 Q 16.5 21.390625 20.328125 13.890625 Q 24.171875 6.390625 31.78125 6.390625 Q 39.453125 6.390625 43.28125 13.890625 Q 47.125 21.390625 47.125 36.375 Q 47.125 51.421875 43.28125 58.90625 Q 39.453125 66.40625 31.78125 66.40625 z M 31.78125 74.21875 Q 44.046875 74.21875 50.515625 64.515625 Q 56.984375 54.828125 56.984375 36.375 Q 56.984375 17.96875 50.515625 8.265625 Q 44.046875 -1.421875 31.78125 -1.421875 Q 19.53125 -1.421875 13.0625 8.265625 Q 6.59375 17.96875 6.59375 36.375 Q 6.59375 54.828125 13.0625 64.515625 Q 19.53125 74.21875 31.78125 74.21875 z " id="DejaVuSans-48"/> </defs> <g transform="translate(332.159375 271.725)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-49"/> <use x="63.623047" xlink:href="#DejaVuSans-48"/> </g> </g> </g> <g id="xtick_9"> <g id="line2d_9"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="365.4" xlink:href="#m4ac62df1f0" y="252"/> </g> </g> <g id="text_9"> <!-- 11 --> <g transform="translate(368.159375 271.725)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-49"/> <use x="63.623047" xlink:href="#DejaVuSans-49"/> </g> </g> </g> <g id="text_10"> <!-- Checkin index --> <defs> <path d="M 64.40625 67.28125 L 64.40625 56.890625 Q 59.421875 61.53125 53.78125 63.8125 Q 48.140625 66.109375 41.796875 66.109375 Q 29.296875 66.109375 22.65625 58.46875 Q 16.015625 50.828125 16.015625 36.375 Q 16.015625 21.96875 22.65625 14.328125 Q 29.296875 6.6875 41.796875 6.6875 Q 48.140625 6.6875 53.78125 8.984375 Q 59.421875 11.28125 64.40625 15.921875 L 64.40625 5.609375 Q 59.234375 2.09375 53.4375 0.328125 Q 47.65625 -1.421875 41.21875 -1.421875 Q 24.65625 -1.421875 15.125 8.703125 Q 5.609375 18.84375 5.609375 36.375 Q 5.609375 53.953125 15.125 64.078125 Q 24.65625 74.21875 41.21875 74.21875 Q 47.75 74.21875 53.53125 72.484375 Q 59.328125 70.75 64.40625 67.28125 z " id="DejaVuSans-67"/> <path d="M 54.890625 33.015625 L 54.890625 0 L 45.90625 0 L 45.90625 32.71875 Q 45.90625 40.484375 42.875 44.328125 Q 39.84375 48.1875 33.796875 48.1875 Q 26.515625 48.1875 22.3125 43.546875 Q 18.109375 38.921875 18.109375 30.90625 L 18.109375 0 L 9.078125 0 L 9.078125 75.984375 L 18.109375 75.984375 L 18.109375 46.1875 Q 21.34375 51.125 25.703125 53.5625 Q 30.078125 56 35.796875 56 Q 45.21875 56 50.046875 50.171875 Q 54.890625 44.34375 54.890625 33.015625 z " id="DejaVuSans-104"/> <path d="M 56.203125 29.59375 L 56.203125 25.203125 L 14.890625 25.203125 Q 15.484375 15.921875 20.484375 11.0625 Q 25.484375 6.203125 34.421875 6.203125 Q 39.59375 6.203125 44.453125 7.46875 Q 49.3125 8.734375 54.109375 11.28125 L 54.109375 2.78125 Q 49.265625 0.734375 44.1875 -0.34375 Q 39.109375 -1.421875 33.890625 -1.421875 Q 20.796875 -1.421875 13.15625 6.1875 Q 5.515625 13.8125 5.515625 26.8125 Q 5.515625 40.234375 12.765625 48.109375 Q 20.015625 56 32.328125 56 Q 43.359375 56 49.78125 48.890625 Q 56.203125 41.796875 56.203125 29.59375 z M 47.21875 32.234375 Q 47.125 39.59375 43.09375 43.984375 Q 39.0625 48.390625 32.421875 48.390625 Q 24.90625 48.390625 20.390625 44.140625 Q 15.875 39.890625 15.1875 32.171875 z " id="DejaVuSans-101"/> <path d="M 48.78125 52.59375 L 48.78125 44.1875 Q 44.96875 46.296875 41.140625 47.34375 Q 37.3125 48.390625 33.40625 48.390625 Q 24.65625 48.390625 19.8125 42.84375 Q 14.984375 37.3125 14.984375 27.296875 Q 14.984375 17.28125 19.8125 11.734375 Q 24.65625 6.203125 33.40625 6.203125 Q 37.3125 6.203125 41.140625 7.25 Q 44.96875 8.296875 48.78125 10.40625 L 48.78125 2.09375 Q 45.015625 0.34375 40.984375 -0.53125 Q 36.96875 -1.421875 32.421875 -1.421875 Q 20.0625 -1.421875 12.78125 6.34375 Q 5.515625 14.109375 5.515625 27.296875 Q 5.515625 40.671875 12.859375 48.328125 Q 20.21875 56 33.015625 56 Q 37.15625 56 41.109375 55.140625 Q 45.0625 54.296875 48.78125 52.59375 z " id="DejaVuSans-99"/> <path d="M 9.078125 75.984375 L 18.109375 75.984375 L 18.109375 31.109375 L 44.921875 54.6875 L 56.390625 54.6875 L 27.390625 29.109375 L 57.625 0 L 45.90625 0 L 18.109375 26.703125 L 18.109375 0 L 9.078125 0 z " id="DejaVuSans-107"/> <path d="M 9.421875 54.6875 L 18.40625 54.6875 L 18.40625 0 L 9.421875 0 z M 9.421875 75.984375 L 18.40625 75.984375 L 18.40625 64.59375 L 9.421875 64.59375 z " id="DejaVuSans-105"/> <path d="M 54.890625 33.015625 L 54.890625 0 L 45.90625 0 L 45.90625 32.71875 Q 45.90625 40.484375 42.875 44.328125 Q 39.84375 48.1875 33.796875 48.1875 Q 26.515625 48.1875 22.3125 43.546875 Q 18.109375 38.921875 18.109375 30.90625 L 18.109375 0 L 9.078125 0 L 9.078125 54.6875 L 18.109375 54.6875 L 18.109375 46.1875 Q 21.34375 51.125 25.703125 53.5625 Q 30.078125 56 35.796875 56 Q 45.21875 56 50.046875 50.171875 Q 54.890625 44.34375 54.890625 33.015625 z " id="DejaVuSans-110"/> <path id="DejaVuSans-32"/> <path d="M 45.40625 46.390625 L 45.40625 75.984375 L 54.390625 75.984375 L 54.390625 0 L 45.40625 0 L 45.40625 8.203125 Q 42.578125 3.328125 38.25 0.953125 Q 33.9375 -1.421875 27.875 -1.421875 Q 17.96875 -1.421875 11.734375 6.484375 Q 5.515625 14.40625 5.515625 27.296875 Q 5.515625 40.1875 11.734375 48.09375 Q 17.96875 56 27.875 56 Q 33.9375 56 38.25 53.625 Q 42.578125 51.265625 45.40625 46.390625 z M 14.796875 27.296875 Q 14.796875 17.390625 18.875 11.75 Q 22.953125 6.109375 30.078125 6.109375 Q 37.203125 6.109375 41.296875 11.75 Q 45.40625 17.390625 45.40625 27.296875 Q 45.40625 37.203125 41.296875 42.84375 Q 37.203125 48.484375 30.078125 48.484375 Q 22.953125 48.484375 18.875 42.84375 Q 14.796875 37.203125 14.796875 27.296875 z " id="DejaVuSans-100"/> <path d="M 54.890625 54.6875 L 35.109375 28.078125 L 55.90625 0 L 45.3125 0 L 29.390625 21.484375 L 13.484375 0 L 2.875 0 L 24.125 28.609375 L 4.6875 54.6875 L 15.28125 54.6875 L 29.78125 35.203125 L 44.28125 54.6875 z " id="DejaVuSans-120"/> </defs> <g transform="translate(186.104688 283.323438)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-67"/> <use x="69.824219" xlink:href="#DejaVuSans-104"/> <use x="133.203125" xlink:href="#DejaVuSans-101"/> <use x="194.726562" xlink:href="#DejaVuSans-99"/> <use x="249.707031" xlink:href="#DejaVuSans-107"/> <use x="307.617188" xlink:href="#DejaVuSans-105"/> <use x="335.400391" xlink:href="#DejaVuSans-110"/> <use x="398.779297" xlink:href="#DejaVuSans-32"/> <use x="430.566406" xlink:href="#DejaVuSans-105"/> <use x="458.349609" xlink:href="#DejaVuSans-110"/> <use x="521.728516" xlink:href="#DejaVuSans-100"/> <use x="585.205078" xlink:href="#DejaVuSans-101"/> <use x="646.712891" xlink:href="#DejaVuSans-120"/> </g> </g> </g> <g id="matplotlib.axis_2"> <g id="ytick_1"> <g id="line2d_10"> <defs> <path d="M 0 0 L -3.5 0 " id="m78b7b2ee23" style="stroke:#000000;stroke-width:0.8;"/> </defs> <g> <use style="stroke:#000000;stroke-width:0.8;" x="54" xlink:href="#m78b7b2ee23" y="252"/> </g> </g> <g id="text_11"> <!-- 0.0 --> <defs> <path d="M 10.6875 12.40625 L 21 12.40625 L 21 0 L 10.6875 0 z " id="DejaVuSans-46"/> </defs> <g transform="translate(31.096875 255.799219)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-48"/> <use x="63.623047" xlink:href="#DejaVuSans-46"/> <use x="95.410156" xlink:href="#DejaVuSans-48"/> </g> </g> </g> <g id="ytick_2"> <g id="line2d_11"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="54" xlink:href="#m78b7b2ee23" y="212.437356"/> </g> </g> <g id="text_12"> <!-- 0.2 --> <defs> <path d="M 19.1875 8.296875 L 53.609375 8.296875 L 53.609375 0 L 7.328125 0 L 7.328125 8.296875 Q 12.9375 14.109375 22.625 23.890625 Q 32.328125 33.6875 34.8125 36.53125 Q 39.546875 41.84375 41.421875 45.53125 Q 43.3125 49.21875 43.3125 52.78125 Q 43.3125 58.59375 39.234375 62.25 Q 35.15625 65.921875 28.609375 65.921875 Q 23.96875 65.921875 18.8125 64.3125 Q 13.671875 62.703125 7.8125 59.421875 L 7.8125 69.390625 Q 13.765625 71.78125 18.9375 73 Q 24.125 74.21875 28.421875 74.21875 Q 39.75 74.21875 46.484375 68.546875 Q 53.21875 62.890625 53.21875 53.421875 Q 53.21875 48.921875 51.53125 44.890625 Q 49.859375 40.875 45.40625 35.40625 Q 44.1875 33.984375 37.640625 27.21875 Q 31.109375 20.453125 19.1875 8.296875 z " id="DejaVuSans-50"/> </defs> <g transform="translate(31.096875 216.236575)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-48"/> <use x="63.623047" xlink:href="#DejaVuSans-46"/> <use x="95.410156" xlink:href="#DejaVuSans-50"/> </g> </g> </g> <g id="ytick_3"> <g id="line2d_12"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="54" xlink:href="#m78b7b2ee23" y="172.874712"/> </g> </g> <g id="text_13"> <!-- 0.4 --> <g transform="translate(31.096875 176.673931)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-48"/> <use x="63.623047" xlink:href="#DejaVuSans-46"/> <use x="95.410156" xlink:href="#DejaVuSans-52"/> </g> </g> </g> <g id="ytick_4"> <g id="line2d_13"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="54" xlink:href="#m78b7b2ee23" y="133.312068"/> </g> </g> <g id="text_14"> <!-- 0.6 --> <g transform="translate(31.096875 137.111287)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-48"/> <use x="63.623047" xlink:href="#DejaVuSans-46"/> <use x="95.410156" xlink:href="#DejaVuSans-54"/> </g> </g> </g> <g id="ytick_5"> <g id="line2d_14"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="54" xlink:href="#m78b7b2ee23" y="93.749424"/> </g> </g> <g id="text_15"> <!-- 0.8 --> <g transform="translate(31.096875 97.548643)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-48"/> <use x="63.623047" xlink:href="#DejaVuSans-46"/> <use x="95.410156" xlink:href="#DejaVuSans-56"/> </g> </g> </g> <g id="ytick_6"> <g id="line2d_15"> <g> <use style="stroke:#000000;stroke-width:0.8;" x="54" xlink:href="#m78b7b2ee23" y="54.18678"/> </g> </g> <g id="text_16"> <!-- 1.0 --> <g transform="translate(31.096875 57.985999)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-49"/> <use x="63.623047" xlink:href="#DejaVuSans-46"/> <use x="95.410156" xlink:href="#DejaVuSans-48"/> </g> </g> </g> <g id="text_17"> <!-- Repo size (MiB) --> <defs> <path d="M 44.390625 34.1875 Q 47.5625 33.109375 50.5625 29.59375 Q 53.5625 26.078125 56.59375 19.921875 L 66.609375 0 L 56 0 L 46.6875 18.703125 Q 43.0625 26.03125 39.671875 28.421875 Q 36.28125 30.8125 30.421875 30.8125 L 19.671875 30.8125 L 19.671875 0 L 9.8125 0 L 9.8125 72.90625 L 32.078125 72.90625 Q 44.578125 72.90625 50.734375 67.671875 Q 56.890625 62.453125 56.890625 51.90625 Q 56.890625 45.015625 53.6875 40.46875 Q 50.484375 35.9375 44.390625 34.1875 z M 19.671875 64.796875 L 19.671875 38.921875 L 32.078125 38.921875 Q 39.203125 38.921875 42.84375 42.21875 Q 46.484375 45.515625 46.484375 51.90625 Q 46.484375 58.296875 42.84375 61.546875 Q 39.203125 64.796875 32.078125 64.796875 z " id="DejaVuSans-82"/> <path d="M 18.109375 8.203125 L 18.109375 -20.796875 L 9.078125 -20.796875 L 9.078125 54.6875 L 18.109375 54.6875 L 18.109375 46.390625 Q 20.953125 51.265625 25.265625 53.625 Q 29.59375 56 35.59375 56 Q 45.5625 56 51.78125 48.09375 Q 58.015625 40.1875 58.015625 27.296875 Q 58.015625 14.40625 51.78125 6.484375 Q 45.5625 -1.421875 35.59375 -1.421875 Q 29.59375 -1.421875 25.265625 0.953125 Q 20.953125 3.328125 18.109375 8.203125 z M 48.6875 27.296875 Q 48.6875 37.203125 44.609375 42.84375 Q 40.53125 48.484375 33.40625 48.484375 Q 26.265625 48.484375 22.1875 42.84375 Q 18.109375 37.203125 18.109375 27.296875 Q 18.109375 17.390625 22.1875 11.75 Q 26.265625 6.109375 33.40625 6.109375 Q 40.53125 6.109375 44.609375 11.75 Q 48.6875 17.390625 48.6875 27.296875 z " id="DejaVuSans-112"/> <path d="M 30.609375 48.390625 Q 23.390625 48.390625 19.1875 42.75 Q 14.984375 37.109375 14.984375 27.296875 Q 14.984375 17.484375 19.15625 11.84375 Q 23.34375 6.203125 30.609375 6.203125 Q 37.796875 6.203125 41.984375 11.859375 Q 46.1875 17.53125 46.1875 27.296875 Q 46.1875 37.015625 41.984375 42.703125 Q 37.796875 48.390625 30.609375 48.390625 z M 30.609375 56 Q 42.328125 56 49.015625 48.375 Q 55.71875 40.765625 55.71875 27.296875 Q 55.71875 13.875 49.015625 6.21875 Q 42.328125 -1.421875 30.609375 -1.421875 Q 18.84375 -1.421875 12.171875 6.21875 Q 5.515625 13.875 5.515625 27.296875 Q 5.515625 40.765625 12.171875 48.375 Q 18.84375 56 30.609375 56 z " id="DejaVuSans-111"/> <path d="M 44.28125 53.078125 L 44.28125 44.578125 Q 40.484375 46.53125 36.375 47.5 Q 32.28125 48.484375 27.875 48.484375 Q 21.1875 48.484375 17.84375 46.4375 Q 14.5 44.390625 14.5 40.28125 Q 14.5 37.15625 16.890625 35.375 Q 19.28125 33.59375 26.515625 31.984375 L 29.59375 31.296875 Q 39.15625 29.25 43.1875 25.515625 Q 47.21875 21.78125 47.21875 15.09375 Q 47.21875 7.46875 41.1875 3.015625 Q 35.15625 -1.421875 24.609375 -1.421875 Q 20.21875 -1.421875 15.453125 -0.5625 Q 10.6875 0.296875 5.421875 2 L 5.421875 11.28125 Q 10.40625 8.6875 15.234375 7.390625 Q 20.0625 6.109375 24.8125 6.109375 Q 31.15625 6.109375 34.5625 8.28125 Q 37.984375 10.453125 37.984375 14.40625 Q 37.984375 18.0625 35.515625 20.015625 Q 33.0625 21.96875 24.703125 23.78125 L 21.578125 24.515625 Q 13.234375 26.265625 9.515625 29.90625 Q 5.8125 33.546875 5.8125 39.890625 Q 5.8125 47.609375 11.28125 51.796875 Q 16.75 56 26.8125 56 Q 31.78125 56 36.171875 55.265625 Q 40.578125 54.546875 44.28125 53.078125 z " id="DejaVuSans-115"/> <path d="M 5.515625 54.6875 L 48.1875 54.6875 L 48.1875 46.484375 L 14.40625 7.171875 L 48.1875 7.171875 L 48.1875 0 L 4.296875 0 L 4.296875 8.203125 L 38.09375 47.515625 L 5.515625 47.515625 z " id="DejaVuSans-122"/> <path d="M 31 75.875 Q 24.46875 64.65625 21.28125 53.65625 Q 18.109375 42.671875 18.109375 31.390625 Q 18.109375 20.125 21.3125 9.0625 Q 24.515625 -2 31 -13.1875 L 23.1875 -13.1875 Q 15.875 -1.703125 12.234375 9.375 Q 8.59375 20.453125 8.59375 31.390625 Q 8.59375 42.28125 12.203125 53.3125 Q 15.828125 64.359375 23.1875 75.875 z " id="DejaVuSans-40"/> <path d="M 9.8125 72.90625 L 24.515625 72.90625 L 43.109375 23.296875 L 61.8125 72.90625 L 76.515625 72.90625 L 76.515625 0 L 66.890625 0 L 66.890625 64.015625 L 48.09375 14.015625 L 38.1875 14.015625 L 19.390625 64.015625 L 19.390625 0 L 9.8125 0 z " id="DejaVuSans-77"/> <path d="M 19.671875 34.8125 L 19.671875 8.109375 L 35.5 8.109375 Q 43.453125 8.109375 47.28125 11.40625 Q 51.125 14.703125 51.125 21.484375 Q 51.125 28.328125 47.28125 31.5625 Q 43.453125 34.8125 35.5 34.8125 z M 19.671875 64.796875 L 19.671875 42.828125 L 34.28125 42.828125 Q 41.5 42.828125 45.03125 45.53125 Q 48.578125 48.25 48.578125 53.8125 Q 48.578125 59.328125 45.03125 62.0625 Q 41.5 64.796875 34.28125 64.796875 z M 9.8125 72.90625 L 35.015625 72.90625 Q 46.296875 72.90625 52.390625 68.21875 Q 58.5 63.53125 58.5 54.890625 Q 58.5 48.1875 55.375 44.234375 Q 52.25 40.28125 46.1875 39.3125 Q 53.46875 37.75 57.5 32.78125 Q 61.53125 27.828125 61.53125 20.40625 Q 61.53125 10.640625 54.890625 5.3125 Q 48.25 0 35.984375 0 L 9.8125 0 z " id="DejaVuSans-66"/> <path d="M 8.015625 75.875 L 15.828125 75.875 Q 23.140625 64.359375 26.78125 53.3125 Q 30.421875 42.28125 30.421875 31.390625 Q 30.421875 20.453125 26.78125 9.375 Q 23.140625 -1.703125 15.828125 -13.1875 L 8.015625 -13.1875 Q 14.5 -2 17.703125 9.0625 Q 20.90625 20.125 20.90625 31.390625 Q 20.90625 42.671875 17.703125 53.65625 Q 14.5 64.65625 8.015625 75.875 z " id="DejaVuSans-41"/> </defs> <g transform="translate(25.017187 181.969063)rotate(-90)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-82"/> <use x="69.419922" xlink:href="#DejaVuSans-101"/> <use x="130.943359" xlink:href="#DejaVuSans-112"/> <use x="194.419922" xlink:href="#DejaVuSans-111"/> <use x="255.601562" xlink:href="#DejaVuSans-32"/> <use x="287.388672" xlink:href="#DejaVuSans-115"/> <use x="339.488281" xlink:href="#DejaVuSans-105"/> <use x="367.271484" xlink:href="#DejaVuSans-122"/> <use x="419.761719" xlink:href="#DejaVuSans-101"/> <use x="481.285156" xlink:href="#DejaVuSans-32"/> <use x="513.072266" xlink:href="#DejaVuSans-40"/> <use x="552.085938" xlink:href="#DejaVuSans-77"/> <use x="638.365234" xlink:href="#DejaVuSans-105"/> <use x="666.148438" xlink:href="#DejaVuSans-66"/> <use x="734.751953" xlink:href="#DejaVuSans-41"/> </g> </g> </g> <g id="patch_39"> <path d="M 54 252 L 54 34.56 " style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> </g> <g id="patch_40"> <path d="M 388.8 252 L 388.8 34.56 " style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> </g> <g id="patch_41"> <path d="M 54 252 L 388.8 252 " style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> </g> <g id="patch_42"> <path d="M 54 34.56 L 388.8 34.56 " style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> </g> <g id="legend_1"> <g id="patch_43"> <path d="M 61 101.2725 L 116.046875 101.2725 Q 118.046875 101.2725 118.046875 99.2725 L 118.046875 41.56 Q 118.046875 39.56 116.046875 39.56 L 61 39.56 Q 59 39.56 59 41.56 L 59 99.2725 Q 59 101.2725 61 101.2725 z " style="fill:#ffffff;opacity:0.8;stroke:#cccccc;stroke-linejoin:miter;"/> </g> <g id="patch_44"> <path d="M 63 51.158437 L 83 51.158437 L 83 44.158437 L 63 44.158437 z " style="fill:#3b4cc0;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="text_18"> <!-- JPEG --> <defs> <path d="M 9.8125 72.90625 L 19.671875 72.90625 L 19.671875 5.078125 Q 19.671875 -8.109375 14.671875 -14.0625 Q 9.671875 -20.015625 -1.421875 -20.015625 L -5.171875 -20.015625 L -5.171875 -11.71875 L -2.09375 -11.71875 Q 4.4375 -11.71875 7.125 -8.046875 Q 9.8125 -4.390625 9.8125 5.078125 z " id="DejaVuSans-74"/> <path d="M 19.671875 64.796875 L 19.671875 37.40625 L 32.078125 37.40625 Q 38.96875 37.40625 42.71875 40.96875 Q 46.484375 44.53125 46.484375 51.125 Q 46.484375 57.671875 42.71875 61.234375 Q 38.96875 64.796875 32.078125 64.796875 z M 9.8125 72.90625 L 32.078125 72.90625 Q 44.34375 72.90625 50.609375 67.359375 Q 56.890625 61.8125 56.890625 51.125 Q 56.890625 40.328125 50.609375 34.8125 Q 44.34375 29.296875 32.078125 29.296875 L 19.671875 29.296875 L 19.671875 0 L 9.8125 0 z " id="DejaVuSans-80"/> <path d="M 9.8125 72.90625 L 55.90625 72.90625 L 55.90625 64.59375 L 19.671875 64.59375 L 19.671875 43.015625 L 54.390625 43.015625 L 54.390625 34.71875 L 19.671875 34.71875 L 19.671875 8.296875 L 56.78125 8.296875 L 56.78125 0 L 9.8125 0 z " id="DejaVuSans-69"/> <path d="M 59.515625 10.40625 L 59.515625 29.984375 L 43.40625 29.984375 L 43.40625 38.09375 L 69.28125 38.09375 L 69.28125 6.78125 Q 63.578125 2.734375 56.6875 0.65625 Q 49.8125 -1.421875 42 -1.421875 Q 24.90625 -1.421875 15.25 8.5625 Q 5.609375 18.5625 5.609375 36.375 Q 5.609375 54.25 15.25 64.234375 Q 24.90625 74.21875 42 74.21875 Q 49.125 74.21875 55.546875 72.453125 Q 61.96875 70.703125 67.390625 67.28125 L 67.390625 56.78125 Q 61.921875 61.421875 55.765625 63.765625 Q 49.609375 66.109375 42.828125 66.109375 Q 29.4375 66.109375 22.71875 58.640625 Q 16.015625 51.171875 16.015625 36.375 Q 16.015625 21.625 22.71875 14.15625 Q 29.4375 6.6875 42.828125 6.6875 Q 48.046875 6.6875 52.140625 7.59375 Q 56.25 8.5 59.515625 10.40625 z " id="DejaVuSans-71"/> </defs> <g transform="translate(91 51.158437)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-74"/> <use x="29.492188" xlink:href="#DejaVuSans-80"/> <use x="89.794922" xlink:href="#DejaVuSans-69"/> <use x="152.978516" xlink:href="#DejaVuSans-71"/> </g> </g> <g id="patch_45"> <path d="M 63 65.836562 L 83 65.836562 L 83 58.836562 L 63 58.836562 z " style="fill:#aac7fd;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="text_19"> <!-- BMP --> <g transform="translate(91 65.836562)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-66"/> <use x="68.603516" xlink:href="#DejaVuSans-77"/> <use x="154.882812" xlink:href="#DejaVuSans-80"/> </g> </g> <g id="patch_46"> <path d="M 63 80.514687 L 83 80.514687 L 83 73.514687 L 63 73.514687 z " style="fill:#f7b89c;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="text_20"> <!-- TIFF --> <defs> <path d="M -0.296875 72.90625 L 61.375 72.90625 L 61.375 64.59375 L 35.5 64.59375 L 35.5 0 L 25.59375 0 L 25.59375 64.59375 L -0.296875 64.59375 z " id="DejaVuSans-84"/> <path d="M 9.8125 72.90625 L 19.671875 72.90625 L 19.671875 0 L 9.8125 0 z " id="DejaVuSans-73"/> <path d="M 9.8125 72.90625 L 51.703125 72.90625 L 51.703125 64.59375 L 19.671875 64.59375 L 19.671875 43.109375 L 48.578125 43.109375 L 48.578125 34.8125 L 19.671875 34.8125 L 19.671875 0 L 9.8125 0 z " id="DejaVuSans-70"/> </defs> <g transform="translate(91 80.514687)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-84"/> <use x="61.083984" xlink:href="#DejaVuSans-73"/> <use x="90.576172" xlink:href="#DejaVuSans-70"/> <use x="148.095703" xlink:href="#DejaVuSans-70"/> </g> </g> <g id="patch_47"> <path d="M 63 95.192813 L 83 95.192813 L 83 88.192813 L 63 88.192813 z " style="fill:#b40426;stroke:#ffffff;stroke-linejoin:miter;stroke-width:2;"/> </g> <g id="text_21"> <!-- PNG --> <defs> <path d="M 9.8125 72.90625 L 23.09375 72.90625 L 55.421875 11.921875 L 55.421875 72.90625 L 64.984375 72.90625 L 64.984375 0 L 51.703125 0 L 19.390625 60.984375 L 19.390625 0 L 9.8125 0 z " id="DejaVuSans-78"/> </defs> <g transform="translate(91 95.192813)scale(0.1 -0.1)"> <use xlink:href="#DejaVuSans-80"/> <use x="60.302734" xlink:href="#DejaVuSans-78"/> <use x="135.107422" xlink:href="#DejaVuSans-71"/> </g> </g> </g> </g> </g> <defs> <clipPath id="pb43dd894ca"> <rect height="217.44" width="334.8" x="54" y="34.56"/> </clipPath> </defs> </svg> |
Changes to www/index.wiki.
︙ | ︙ | |||
32 33 34 35 36 37 38 | 2. <b>Built-in Web Interface</b> - Fossil has a built-in, [https://fossil-scm.org/skins/index.html | themeable], and intuitive [./webui.wiki | web interface] with a rich variety of information pages ([./webpage-ex.md|examples]) promoting situational awareness. | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 2. <b>Built-in Web Interface</b> - Fossil has a built-in, [https://fossil-scm.org/skins/index.html | themeable], and intuitive [./webui.wiki | web interface] with a rich variety of information pages ([./webpage-ex.md|examples]) promoting situational awareness. <p> This entire website is just a running instance of Fossil. The pages you see here are all [./wikitheory.wiki | wiki] or [./embeddeddoc.wiki | embedded documentation] or (in the case of the [/uv/download.html|download] page) [./unvers.wiki | unversioned files]. When you clone Fossil from one of its [./selfhost.wiki | self-hosting repositories], |
︙ | ︙ | |||
59 60 61 62 63 64 65 | for network communications, so it works fine from behind restrictive firewalls, including [./quickstart.wiki#proxy|proxies]. The protocol is [./stats.wiki | bandwidth efficient] to the point that Fossil can be used comfortably over dial-up or over the exceedingly slow Wifi on airliners. | | | | > > | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | for network communications, so it works fine from behind restrictive firewalls, including [./quickstart.wiki#proxy|proxies]. The protocol is [./stats.wiki | bandwidth efficient] to the point that Fossil can be used comfortably over dial-up or over the exceedingly slow Wifi on airliners. 5. <b>Simple Server Setup</b> - No server is required, but if you want to set one up, Fossil supports [./server/ | several different server configurations] including CGI, SCGI, and direct HTTP. You can also easily set up your Fossil repository to automatically [./mirrortogithub.md | mirror content on GitHub]. 6. <b>Autosync</b> - Fossil supports [./concepts.wiki#workflow | "autosync" mode] which helps to keep projects moving forward by reducing the amount of needless [./branching.wiki | forking and merging] often associated with distributed projects. |
︙ | ︙ | |||
125 126 127 128 129 130 131 | subsystems, including [./customskin.md | theming]. * List of [./th1.md | TH1 commands provided by Fossil itself] that expose its key functionality to TH1 scripts. * List of [./th1-hooks.md | TH1 hooks exposed by Fossil] that enable customization of commands and web pages. * A free hosting server for Fossil repositories is available at [http://chiselapp.com/]. | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | subsystems, including [./customskin.md | theming]. * List of [./th1.md | TH1 commands provided by Fossil itself] that expose its key functionality to TH1 scripts. * List of [./th1-hooks.md | TH1 hooks exposed by Fossil] that enable customization of commands and web pages. * A free hosting server for Fossil repositories is available at [http://chiselapp.com/]. * How to [./server/ | set up a server] for your repository. * Customizing the [./custom_ticket.wiki | ticket system]. * Methods to [./checkin_names.wiki | identify a specific check-in]. * [./inout.wiki | Import and export] from and to Git. * [./fossil-v-git.wiki | Fossil versus Git]. * [./fiveminutes.wiki | Up and running in 5 minutes as a single user] (contributed by Gilles Ganault on 2013-01-08). * [./antibot.wiki | How Fossil defends against abuse by spiders and bots]. |
︙ | ︙ |
Changes to www/inout.wiki.
︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | As with the "import" command, the --git option is not required since the git-fast-export file format is currently the only VCS interchange format that Fossil will generate. However, future versions of Fossil might add the ability to generate other VCS interchange formats, and so for compatibility, the use of the --git option recommended. <h2>Bidirectional Synchronization</h2> Fossil also has the ability to synchronize with a Git repository via repeated imports and/or exports. To do this, it uses marks files to store a record of artifacts which are known by both Git and Fossil to exist at a given point in time. | > > > > > > > > > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | As with the "import" command, the --git option is not required since the git-fast-export file format is currently the only VCS interchange format that Fossil will generate. However, future versions of Fossil might add the ability to generate other VCS interchange formats, and so for compatibility, the use of the --git option recommended. <h2>Mirror A Fossil Repository In Git</h2> Fossil version 2.9 and later supports a simple mechanism for doing a Git or [./mirrortogithub.md|GitHub mirror of a Fossil repository]. See that separate document for details. Fossil is self-hosting, but a [https://github.com/drhsqlite/fossil-mirror|GitHub mirror of Fossil] is available as a proof-of-concept. <h2>Bidirectional Synchronization</h2> Fossil also has the ability to synchronize with a Git repository via repeated imports and/or exports. To do this, it uses marks files to store a record of artifacts which are known by both Git and Fossil to exist at a given point in time. |
︙ | ︙ |
Added www/javascript.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Use of JavaScript in Fossil ## Philosophy The Fossil development project’s policy is to use JavaScript where it helps make its web UI better, but to offer graceful fallbacks wherever practical. The intent is that the UI be usable with JavaScript entirely disabled. In every place where Fossil uses JavaScript, it is an enhancement to provided functionality, and there is always another way to accomplish a given end without using JavaScript. This is not to say that Fossil’s fall-backs for such cases are always as elegant and functional as a no-JS purist might wish. That is simply because [the vast majority of web users run with JS enabled](#stats), and a minority of those run with some kind of conditional JavaScript blocking in place. Fossil’s active developers do not deviate from that norm enough that we have many no-JS purists among us, so the no-JS case doesn’t get as much attention as some might want. We do [accept code contributions][cg], and we are philosophically in favor of graceful fall-backs, so you are welcome to appoint yourself the position of no-JS czar for the Fossil project! Evil is in actions, not in nouns, so we do not believe JavaScript *can* be evil. It is an active technology, but the actions that matter here are those of writing the code and checking it into the Fossil project repository. None of the JavaScript code in Fossil is evil, a fact we enforce by being careful about who we give check-in rights on the repository to and by policing what code does get contributed. The Fossil project does not accept non-trivial outside contributions. We think it’s better to ask not whether Fossil requires JavaScript but whether Fossil uses JavaScript *well*, so that [you can decide](#block) to block or allow Fossil’s use of JavaScript. [cg]: ./contribute.wiki ## <a id="block"></a>Blocking JavaScript Rather than either block JavaScript wholesale or give up on blocking JavaScript entirely, we recommend that you use tools like [NoScript][ns] or [uBlock Origin][ub] to selectively block problematic uses of JavaScript so the rest of the web can use the technology productively, as it was intended. There are doubtless other useful tools of this sort; we recommend only these two due to our limited experience, not out of any wish to exclude other tools. The primary difference between these two for our purposes is that NoScript lets you select scripts to run on a page on a case-by-case basis, whereas uBlock Origin delegates those choices to a group of motivated volunteers who maintain whitelists and blacklists to control all of this; you can then override UBO’s stock rules as needed. [ns]: https://noscript.net/ [ub]: https://github.com/gorhill/uBlock/ ## <a id="stats"></a>How Many Users Run with JavaScript Disabled Anyway? There are several studies that have directly measured the web audience to answer this question: * [What percentage of browsers with javascript disabled?][s1] * [How many people are missing out on JavaScript enhancement?][s2] * [Just how many web users really disable cookies or JavaScript?][s3] Our sense of this data is that only about 0.2% of web users had JavaScript disabled while participating in these studies. The Fossil user community is not typical of the wider web, but if we were able to comprehensively survey our users, we’d expect to find an interesting dichotomy. Because Fossil is targeted at software developers, who in turn are more likely to be power-users, we’d expect to find Fossil users to be more in favor of some amount of JavaScript blocking than the average web user. Yet, we’d also expect to find that our user base has a disproportionately high number who run [powerful conditional blocking plugins](#block) in their browsers, rather than block JS entirely. We suspect that between these two forces, the number of no-JS purists among Fossil’s user base is still a tiny minority. [s1]: https://blockmetry.com/blog/javascript-disabled [s2]: https://gds.blog.gov.uk/2013/10/21/how-many-people-are-missing-out-on-javascript-enhancement/ [s3]: https://w3techs.com/technologies/overview/client_side_language/all ## <a id="3pjs"></a>No Third-Party JavaScript in Fossil Fossil does not use any third-party JavaScript libraries, not even very common ones like jQuery. Every bit of JavaScript served by the stock version of Fossil was written specifically for the Fossil project and is stored [in its code repository](https://fossil-scm.org/fossil/file). Therefore, if you want to hack on the JavaScript code served by Fossil and mechanisms like [skin editing][cs] don’t suffice for your purposes, you can hack on the JavaScript in your local instance directly, just as you can hack on its C, SQL, and Tcl code. Fossil is free and open source software, under [a single license][2cbsd]. [2cbsd]: https://fossil-scm.org/home/doc/trunk/COPYRIGHT-BSD2.txt [cs]: ./customskin.md ## <a id="snoop"></a>Fossil Does Not Snoop On You There is no tracking or other snooping technology in Fossil other than that necessary for basic security, such as IP address logging on check-ins. (This is in part why we have no [comprehensive user statistics](#stats)!) Fossil attempts to set two cookies on all web clients: a login session cookie and a display preferences cookie. These cookies are restricted to the Fossil instance, so even this limited data cannot leak between Fossil instances or into other web sites. There is some server-side event logging, but that is done entirely without JavaScript, so it’s off-topic here. ## <a id="uses"></a>Places Where Fossil’s Web UI Uses JavaScript The remainder of this document will explain how Fossil currently uses JavaScript and what it does when these uses are blocked. ### <a id="timeline"></a>Timeline Graph Fossil’s [web timeline][wt] uses JavaScript to render the graph connecting the visible check-ins to each other, so you can visualize parent/child relationships, merge actions, etc. We’re not sure it’s even possible to render this in static HTML, even with the aid of SVG, due to the vagaries of web layout among browser engines, screen sizes, etc. Fossil also uses JavaScript to handle clicks on the graph nodes to allow diffs between versions, to display tooltips showing local context, etc. _Graceful Fallback:_ When JavaScript is disabled, this column of the timeline simply collapses to zero width. All of the information you can get from the timeline can be retrieved from Fossil in other ways not using JavaScript: the “`fossil timeline`” command, the “`fossil info`” command, by clicking around within the web UI, etc. _Potential Workaround:_ The timeline could be enhanced with `<noscript>` tags that replace the graph with a column of checkboxes that control what a series of form submit buttons do when clicked, replicating the current JS-based features of the graph using client-server round-trips. For example, you could click two of those checkboxes and then a button labeled “Diff Selected” to replicate the current “click two nodes to diff them” feature. [wt]: https://fossil-scm.org/fossil/timeline ### <a id="wedit"></a>WYSIWYG Wiki Editor The Admin → Wiki → “Enable WYSIWYG Wiki Editing” toggle switches the default plaintext editor for [Fossil wiki][fw] documents to one that works like a basic word processor. This feature requires JavaScript in order to react to editor button clicks like the “**B**” button, meaning “make \[selected\] text boldface.” There is no standard WYSIWYG editor component in browsers, doubtless because it’s relatively straightforward to create one using JavaScript. _Graceful Fallback:_ Edit your wiki documents in the default plain text wiki editor. Fossil’s wiki and Markdown language processors were designed to be edited that way. [fw]: ./wikitheory.wiki ### <a id="ln"></a>Line Numbering When viewing source files, Fossil offers to show line numbers in some cases. Toggling them on and off is currently handled in JavaScript. ([Example][mainc].) _Workaround:_ Edit the URL to give the “`ln`” query parameter per [the `/file` docs](/help?cmd=/file), or provide a patch to reload the page with this parameter included/excluded to implement the toggle via a server round-trip. [mainc]: https://fossil-scm.org/fossil/artifact?ln&name=87d67e745 ### <a id="sxsdiff"></a>Side-by-Side Diff Mode The default “diff” view is a side-by-side mode. If either of the boxes of output — the “from” and “to” versions of the repo contents for that check-in — requires a horizontal scroll bar given the box content, font size, browser window width, etc., both boxes will usually end up needing to scroll since they should contain roughly similar content. Fossil therefore scrolls both boxes when you drag the scroll bar on one because if you want to examine part of a line scrolled out of the HTML element in one box, you probably want to examine the same point on that line in the other box. _Graceful Fallback:_ Manually scroll both boxes to sync their views. ### <a id="sort"></a>Table Sorting On pages showing a data table, the column headers may be clickable to do a client-side sort of the data on that column. _Potential Workaround:_ This feature could be enhanced to do the sort on the server side using a page re-load. ### <a id="tree"></a>File Browser Tree View The [file browser’s tree view mode][tv] uses JavaScript to handle clicks on folders so they fold and unfold without needing to reload the entire page. _Graceful Fallback:_ When JavaScript is disabled, clicks on folders reload the page showing the folder contents instead. You then have to use the browser’s Back button to return to the higher folder level. [tv]: https://www.fossil-scm.org/fossil/dir?type=tree ### <a id="hash"></a>Version Hashes In several places where the Fossil web UI shows a check-in hash or similar, hovering over that check-in shows a tooltip with details about the type of artifact the hash refers to and allows you to click to copy the hash to the clipboard. _Graceful Fallback:_ When JavaScript is disabled, these tooltips simply don’t appear. You can then select and copy the hash using your browser, make “`fossil info`” queries on those hashes, etc. ### <a id="bots"></a>Anti-Bot Defenses Fossil has [anti-bot defenses][abd], and it has some JavaScript code that, if run, can drop some of these defenses if it decides a given page was loaded on behalf of a human, rather than a bot. _Graceful Fallback:_ You can use Fossil’s anonymous login feature to convince the remote Fossil instance that you are not a bot. Coupled with [the Fossil user capability system][caps], you can restore all functionality that Fossil’s anti-bot defenses deny to random web clients by default. [abd]: ./antibot.wiki [caps]: ./caps/ ### <a id="hbm"></a>Hamburger Menu The default skin includes a “hamburger menu” (☰) which uses JavaScript to show a simplified version of the Fossil UI site map using an animated-in dropdown. _Graceful Fallback:_ Clicking the hamburger menu button with JavaScript disabled will take you to the `/sitemap` page instead of showing a simplified version of that page’s content in a drop-down. _Workaround:_ You can remove this button by [editing the skin][cs] header. ### <a id="clock"></a>Clock Some stock Fossil skins include JavaScript-based features such as the current time of day. The Xekri skin includes this in its header, for example. A clock feature requires JavaScript not only to get the time and update inline on the page once a minute, but also so it displays *in the local time zone.* Since none of this code provides a necessary Fossil feature, the core developers are unlikely to try to make these features work better in the absence of JavaScript. However, we are willing to study patches to make this better. For example, the wall clock displays could include the page load time in the dynamically generated HTML shipped from the remote Fossil server, so that in the absence of JavaScript, you at least get the page generation time, expressed in the server’s time zone. |
Added www/loadmgmt.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Managing Server Load A Fossil server is very efficient and normally presents a very light load on the server. The Fossil [self-hosting server][sh] is a 1/24th slice VM at [Linode.com][lin] hosting 65 other repositories in addition to Fossil, including some very high-traffic sites such as <http://www.sqlite.org> and <http://system.data.sqlite.org>. This small VM has a typical load of 0.05 to 0.1. A single HTTP request to Fossil normally takes less than 10 milliseconds of CPU time to complete, so requests can be arriving at a continuous rate of 20 or more per second, and the CPU can still be mostly idle. However, there are some Fossil web pages that can consume large amounts of CPU time, especially on repositories with a large number of files or with long revision histories. High CPU usage pages include [`/zip`](/help/zip), [`/tarball`](/help/tarball), [`/annotate`](/help/annotate), and others. On very large repositories, these commands can take 15 seconds or more of CPU time. If these kinds of requests arrive too quickly, the load average on the server can grow dramatically, making the server unresponsive. Fossil provides two capabilities to help avoid server overload problems due to excessive requests to expensive pages: 1. An optional cache is available that remembers the 10 most recently requested `/zip` or `/tarball` pages and returns the precomputed answer if the same page is requested again. 2. Page requests can be configured to fail with a “[503 Server Overload][503]” HTTP error if an expensive request is received while the host load average is too high. Both of these load-control mechanisms are turned off by default, but they are recommended for high-traffic sites. The webpage cache is activated using the [`fossil cache init`](/help/cache) command-line on the server. Add a `-R` option to specify the specific repository for which to enable caching. If running this command as root, be sure to “`chown`” the cache database to give the Fossil server write permission for the user ID of the web server; this is a separate file in the same directory and with the same name as the repository but with the “`.fossil`” suffix changed to “`.cache`”. To activate the server load control feature visit the Admin → Access setup page in the administrative web interface; in the “**Server Load Average Limit**” box enter the load average threshold above which “503 Server Overload” replies will be issued for expensive requests. On the self-hosting Fossil server, that value is set to 1.5, but you could easily set it higher on a multi-core server. The maximum load average can also be set on the command line using commands like this: fossil set max-loadavg 1.5 fossil all set max-loadavg 1.5 The second form is especially useful for changing the maximum load average simultaneously on a large number of repositories. Note that this load-average limiting feature is only available on operating systems that support the [`getloadavg()`][gla] API. Most modern Unix systems have this interface, but Windows does not, so the feature will not work on Windows. Because Linux implements `getloadavg()` by accessing the `/proc/loadavg` virtual file, you will need to make sure `/proc` is available to the Fossil server. The most common reason for it to not be available is that you are running a Fossil instance [inside a `chroot(2)` jail](./chroot.md) and you have not mounted the `/proc` virtual file system inside that jail. On the [self-hosting Fossil repositories][sh], this was accomplished by adding a line to the `/etc/fstab` file: chroot_jail_proc /home/www/proc proc ro 0 0 The `/home/www/proc` pathname should be adjusted so that the `/proc` component is at the root of the chroot jail, of course. To see if the load-average limiter is functional, visit the [`/test_env`][hte] page of the server to view the current load average. If the value for the load average is greater than zero, that means that it is possible to activate the load-average limiter on that repository. If the load average shows exactly "0.0", then that means that Fossil is unable to find the load average. This can either be because it is in a `chroot(2)` jail without `/proc` access, or because it is running on a system that does not support `getloadavg()` and so the load-average limiter will not function. [503]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4 [hte]: /help?cmd=/test_env [gla]: https://linux.die.net/man/3/getloadavg [lin]: http://www.linode.com [sh]: ./selfhost.wiki |
Changes to www/makefile.wiki.
︙ | ︙ | |||
97 98 99 100 101 102 103 | all of the makefiles for all targets will be rebuild. There is an option code verification step implemented using 15. [/file/src/codecheck1.c | codecheck1.c] This file implements a small utility program ("codecheck1") | | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | all of the makefiles for all targets will be rebuild. There is an option code verification step implemented using 15. [/file/src/codecheck1.c | codecheck1.c] This file implements a small utility program ("codecheck1") that scans other Fossil source files looking for errors in printf-style format strings. The codecheck1 utility detects missing or surplus arguments on printf-like functions and dangerous uses of "%s" that might permit SQL injection or cross-site scripting attacks. This code check step is run automatically on each build of Fossil, and can also be run separately by typing "make codecheck". Note that the built-in printf format checking of GCC does not function for Fossil since Fossil implements its own printf (in the [/file/src/printf.c | printf.c] source file) that includes special |
︙ | ︙ |
Added www/mdtest/test1.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Markdown Link-test This document exist solely as a test for some of the hyperlinking capabilities of Markdown as implemented by Fossil. ## Relative-Path Links * The index: [](../index.wiki) * Load management: [](../loadmgmt.md) * Site-map: [](../../../../sitemap) * Windows CGI: [](../server/windows/cgi.md) ## The Magic $ROOT Path Prefix In text of the form `href="$ROOT/..."` in the HTML that markdown generates, the $ROOT is replaced by the complete URI for the root of the document tree. Note that the $ROOT translation only occurs within the `<a href="...">` element, not within the text of the hyperlink. So you should see the $ROOT text on this page, but if you mouse-over the hyperlink the $ROOT value should have been expanded to the actual document root. * Timeline: []($ROOT/timeline) * Site-map: []($ROOT/sitemap) The $ROOT prefix on markdown links is superfluous. The same link works without the $ROOT prefix. (Though: the $ROOT prefix is required for HTML documents.) * Timeline: [](/timeline) * Help: [](/help?cmd=help) * Site-map: [](/sitemap) ## The Magic $SELF Document Version Translation In URI text of the form `.../doc/$SELF/...` the $SELF value is converted to the version number of the document currently being displayed. This conversion happens after translation into HTML and only occurs on href='...' attributes so it does not occur for plain text. * Document index: [](/doc/$SELF/www/index.wiki) Both the $ROOT and the $SELF conversions can occur on the same link. * Document index: []($ROOT/doc/$SELF/www/index.wiki) The translations must be contained within HTML markup in order to work. They do not work for ordinary text that appears to be an href= attribute. * `x href='$ROOT/timeline'` * `x action="$ROOT/whatever"` * `x href="https://some-other-site.com/doc/$SELF/tail"` |
Added www/mirrorlimitations.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Limitations On Git Mirrors The "<tt>[fossil git export](/help?cmd=git)</tt>" command can be used to mirror a Fossil repository to Git. ([Setup instructions](./mirrortogithub.md) and an [example](https://github.com/drhsqlite/fossil-mirror).) But the export to Git is not perfect. Some information is lost during export due to limitations in Git. This page describes what content of Fossil is not included in an export to Git. ## (1) Wiki, Tickets, Technotes, Forum Git only supports version control. The additional features of Fossil such as Wiki, Tickets, Technotes, and the Forum are not supported in Git and so those features are not included in an export. ## (2) Cherrypick Merges The Git client supports cherrypick merges but does not remember them. In other words, Git does not record a history of cherrypick merges in its blockchain. Fossil tracks cherrypick merges in its blockchain and display cherrypicks (as dashed lines) in its timeline ([example](/timeline?c=0a9f12ce6655b7a5)). But history information of cherrypicks cannot be exported to Git because there is no way to represent it in the Git. ## (3) Named Branches Git has only limited support for named branches. Git identifies the head check-in of each branch. Depending on the check-in graph topology, this is sufficient to infer the branch for many historical check-ins as well. However, complex histories with lots of cross-merging can lead to ambiguities. Fossil keeps track of historical branch names unambiguously. But the extra details about branch names that Fossil keeps at hand cannot be exported to Git. ## (4) Non-unique Tags Git requires tags to be unique. Each tag must refer to exactly one check-in. Fossil does not have this restriction, and so it is common in Fossil to tag multiple check-ins with the same name. For example, it is common in Fossil to tag every release check-in with the "release" tag, so that all historical releases can be found all at once. ([example](/timeline?t=release)) Git does not allow this. The "release" tag must refer to just one check-in. The work-around is that the non-unique tag in the Git export is made to refer to only the most recent check-in with that tag. ## (5) Amendments To Check-ins Check-ins are immutable in both Fossil and Git. However, Fossil has a mechanism by which tags can be added its blockchain to provide after-the-fact corrections to prior check-ins. For example, tags can be added to check-ins that correct typos in the check-in comment. The original check-in is immutable and so the original comment is preserved in addition to the correction. But software that displays the check-ins knows to look for the comment-change tag and if present displays the corrected comment rather than the original. ([Example](/info/8ed91bbe44d0d383) changing the typo "os" into "so".) Git has no mechanism for providing corrections or clarifications to historical check-ins. When exporting from Fossil to Git, the latest corrections to a Fossil check-in are used to generate the corresponding Git check-in. But once the Git check-in has been created, any subsequent corrections are omitted as there is no way to transfer them to Git. |
Added www/mirrortogithub.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # How To Mirror A Fossil Repository On GitHub Beginning with Fossil version 2.9, you can mirror a Fossil-based project on GitHub (with [limitations](./mirrorlimitations.md)) by following these steps: <ol> <li><p>Create an account on GitHub if you do not have one already. Log into that account. <li><p>Create a new project. GitHub will ask you if you want to prepopulate your project with various things like a README file. Answer "no" to everything. You want a completely blank project. GitHub will then supply you with a URL for your project that will look something like this: <blockquote> https://github.com/username/project.git </blockquote> <li><p>Back on your workstation, move to a checkout for your Fossil project and type: <blockquote> <pre>$ fossil git export /path/to/git/repo --autopush \ https://<font color="orange">username</font>:<font color="red">password</font>@github.com/username/project.git</pre> </blockquote> <p> In place of the <code>/path/to...</code> argument above, put in some directory name that is <i>outside</i> of your Fossil checkout. If you keep multiple Fossil checkouts in a directory of their own, consider using <code>../git-mirror</code> to place the Git export mirror alongside them, for example. Fossil will create this directory if necessary. This directory will become a Git repository that holds a translation of your Fossil repository. <p> The <code>--autopush</code> option tells Fossil that you want to push the Git translation up to GitHub every time it is updated. <p> The URL parameter is the same as the one GitHub gave you, but with your GitHub <font color="orange">username</font> and <font color="red">password</font> added. <p> If your GitHub account uses two-factor authentication (2FA), you will have to <a href="https://github.com/settings/tokens">generate a personal access token</a> and use that in place of your actual password in the URL. This token should have “repo” scope enabled, only. <p> You can also run the command above outside of any open checkout of your project by supplying the “<code>-R repository</code>” option. <li><p>Get some coffee. Depending on the size of your project, the initial "<code>fossil git export</code>" command in the previous step might run for several minutes. <li><p>And you are done! Assuming everything worked, your project is now mirrored on GitHub. <li><p>Whenever you update your project, simply run this command to update the mirror: <blockquote> <pre>$ fossil git export</pre> </blockquote> <p> Unlike with the first time you ran that command, you don’t need the remaining arguments, because Fossil remembers those things. Subsequent mirror updates should usually happen in a fraction of a second. <li><p>To see the status of your mirror, run: <blockquote> <pre>$ fossil git status</pre> </blockquote> </ol> ## Notes: * The mirroring is one-way. If you check in changes on GitHub, those changes will not be reabsorbed by Fossil. There are technical problems that make a two-way mirror all but impossible. This also means that you cannot accept pull requests on GitHub. * The "`fossil git export`" command creates subprocesses that run "`git`" commands, so you must have Git installed on your machine for any of this to work. * The Git repository will have an extra unmanaged top-level directory named "`.mirror_state`" that contains one or more files. Those files are used to store the intermediate state of the translation so that subsequent invocations of "`fossil git export`" will know where you left off the last time and what new content needs to be moved over into Git. Be careful not to mess with the `.mirror_state` directory or any of its contents. Do not put those files under Git management. Do not edit or delete them. * The name of the "trunk" branch is automatically translated into "master" in the Git mirror. * Only check-ins and simple tags are translated to Git. Git does not support wiki or tickets or unversioned content or any of the other features of Fossil that make it so convenient to use, so those other elements cannot be mirrored in Git. * In Git, all tags must be unique. If your Fossil repository has the same tag on two or more check-ins, the tag will only be preserved on the chronologically newest check-in. * There is a [long list of restrictions](https://git-scm.com/docs/git-check-ref-format) on tag and branch names in Git. If any of your Fossil tag or branch names violate these rules, then the names are translated prior to being exported to Git. The translation usually involves converting the offending characters into underscores. <a name='ex1'></a> ## Example GitHub Mirrors As of this writing (2019-03-16) Fossil’s own repository is mirrored on GitHub at: > <https://github.com/drhsqlite/fossil-mirror> In addition, an official Git mirror of SQLite is available: > <https://github.com/sqlite/sqlite> The Fossil source repositories for these mirrors are at <https://www2.fossil-scm.org/fossil> and <https://www2.sqlite.org/src>, respectively. Both repositories are hosted on the same VM at [Linode](https://www.linode.com). On that machine, there is a [cron job](https://linux.die.net/man/8/cron) that runs at 17 minutes after the hour, every hour that does: > /usr/bin/fossil sync -u -R /home/www/fossil/fossil.fossil /usr/bin/fossil sync -R /home/www/fossil/sqlite.fossil /usr/bin/fossil git export -R /home/www/fossil/fossil.fossil /usr/bin/fossil git export -R /home/www/fossil/sqlite.fossil The initial two "sync" commands pull in changes from the primary Fossil repositories for Fossil and SQLite. The last two lines export the changes to Git and push the results up to GitHub. |
Changes to www/mkindex.tcl.
︙ | ︙ | |||
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 | aboutdownload.wiki {How The Download Page Works} adding_code.wiki {Adding New Features To Fossil} adding_code.wiki {Hacking Fossil} alerts.md {Email Alerts And Notifications} antibot.wiki {Defense against Spiders and Bots} backoffice.md {The "Backoffice" mechanism of Fossil} blame.wiki {The Annotate/Blame Algorithm Of Fossil} branching.wiki {Branching, Forking, Merging, and Tagging} bugtheory.wiki {Bug Tracking In Fossil} build.wiki {Compiling and Installing Fossil} changes.wiki {Fossil Changelog} checkin_names.wiki {Check-in And Version Names} checkin.wiki {Check-in Checklist} childprojects.wiki {Child Projects} copyright-release.html {Contributor License Agreement} concepts.wiki {Fossil Core Concepts} contribute.wiki {Contributing Code or Documentation To The Fossil Project} customgraph.md {Theming: Customizing the Timeline Graph} customskin.md {Theming: Customizing The Appearance of Web Pages} custom_ticket.wiki {Customizing The Ticket System} delta_encoder_algorithm.wiki {Fossil Delta Encoding Algorithm} delta_format.wiki {Fossil Delta Format} embeddeddoc.wiki {Embedded Project Documentation} encryptedrepos.wiki {How To Use Encrypted Repositories} env-opts.md {Environment Variables and Global Options} event.wiki {Events} faq.wiki {Frequently Asked Questions} fileformat.wiki {Fossil File Format} fiveminutes.wiki {Up and Running in 5 Minutes as a Single User} forum.wiki {Fossil Forums} foss-cklist.wiki {Checklist For Successful Open-Source Projects} fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE} fossil-v-git.wiki {Fossil Versus Git} globs.md {File Name Glob Patterns} hacker-howto.wiki {Hacker How-To} hashpolicy.wiki {Hash Policy: Choosing Between SHA1 and SHA3-256} /help {Lists of Commands and Webpages} hints.wiki {Fossil Tips And Usage Hints} index.wiki {Home Page} inout.wiki {Import And Export To And From Git} makefile.wiki {The Fossil Build Process} /md_rules {Markdown Formatting Rules} newrepo.wiki {How To Create A New Fossil Repository} password.wiki {Password Management And Authentication} pop.wiki {Principles Of Operation} private.wiki {Creating, Syncing, and Deleting Private Branches} qandc.wiki {Questions And Criticisms} quickstart.wiki {Fossil Quick Start Guide} quotes.wiki {Quotes: What People Are Saying About Fossil, Git, and DVCSes in General} ../test/release-checklist.wiki {Pre-Release Testing Checklist} reviews.wiki {Reviews} selfcheck.wiki {Fossil Repository Integrity Self Checks} selfhost.wiki {Fossil Self Hosting Repositories} | > > > > > > > > > > > > > > | > > > | 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 | aboutdownload.wiki {How The Download Page Works} adding_code.wiki {Adding New Features To Fossil} adding_code.wiki {Hacking Fossil} alerts.md {Email Alerts And Notifications} antibot.wiki {Defense against Spiders and Bots} backoffice.md {The "Backoffice" mechanism of Fossil} blame.wiki {The Annotate/Blame Algorithm Of Fossil} blockchain.md {Fossil As Blockchain} branching.wiki {Branching, Forking, Merging, and Tagging} bugtheory.wiki {Bug Tracking In Fossil} build.wiki {Compiling and Installing Fossil} caps/ {Administering User Capabilities} caps/admin-v-setup.md {Differences Between Setup and Admin Users} caps/ref.html {User Capability Reference} cgi.wiki {CGI Script Configuration Options} changes.wiki {Fossil Changelog} checkin_names.wiki {Check-in And Version Names} checkin.wiki {Check-in Checklist} childprojects.wiki {Child Projects} copyright-release.html {Contributor License Agreement} concepts.wiki {Fossil Core Concepts} contribute.wiki {Contributing Code or Documentation To The Fossil Project} customgraph.md {Theming: Customizing the Timeline Graph} customskin.md {Theming: Customizing The Appearance of Web Pages} customskin.md {Custom Skins} custom_ticket.wiki {Customizing The Ticket System} defcsp.md {The Default Content Security Policy} delta_encoder_algorithm.wiki {Fossil Delta Encoding Algorithm} delta_format.wiki {Fossil Delta Format} embeddeddoc.wiki {Embedded Project Documentation} encryptedrepos.wiki {How To Use Encrypted Repositories} env-opts.md {Environment Variables and Global Options} event.wiki {Events} faq.wiki {Frequently Asked Questions} fileformat.wiki {Fossil File Format} fiveminutes.wiki {Up and Running in 5 Minutes as a Single User} forum.wiki {Fossil Forums} foss-cklist.wiki {Checklist For Successful Open-Source Projects} fossil-from-msvc.wiki {Integrating Fossil in the Microsoft Express 2010 IDE} fossil_prompt.wiki {Fossilized Bash Prompt} fossil-v-git.wiki {Fossil Versus Git} globs.md {File Name Glob Patterns} grep.md {Fossil grep vs POSIX grep} hacker-howto.wiki {Hacker How-To} hashpolicy.wiki {Hash Policy: Choosing Between SHA1 and SHA3-256} /help {Lists of Commands and Webpages} hints.wiki {Fossil Tips And Usage Hints} index.wiki {Home Page} inout.wiki {Import And Export To And From Git} image-format-vs-repo-size.md {Image Format vs Fossil Repo Size} javascript.md {Use of JavaScript in Fossil} makefile.wiki {The Fossil Build Process} mirrorlimitations.md {Limitations On Git Mirrors} mirrortogithub.md {How To Mirror A Fossil Repository On GitHub} /md_rules {Markdown Formatting Rules} newrepo.wiki {How To Create A New Fossil Repository} password.wiki {Password Management And Authentication} pop.wiki {Principles Of Operation} private.wiki {Creating, Syncing, and Deleting Private Branches} qandc.wiki {Questions And Criticisms} quickstart.wiki {Fossil Quick Start Guide} quotes.wiki {Quotes: What People Are Saying About Fossil, Git, and DVCSes in General} ../test/release-checklist.wiki {Pre-Release Testing Checklist} rebaseharm.md {Rebase Considered Harmful} reviews.wiki {Reviews} selfcheck.wiki {Fossil Repository Integrity Self Checks} selfhost.wiki {Fossil Self Hosting Repositories} server/ {How To Configure A Fossil Server} serverext.wiki {CGI Server Extensions} serverext.wiki {Adding Extensions To A Fossil Server Using CGI Scripts} settings.wiki {Fossil Settings} /sitemap {Site Map} shunning.wiki {Shunning: Deleting Content From Fossil} stats.wiki {Performance Statistics} style.wiki {Source Code Style Guidelines} ssl.wiki {Using SSL with Fossil} sync.wiki {The Fossil Sync Protocol} tech_overview.wiki {A Technical Overview Of The Design And Implementation Of Fossil} tech_overview.wiki {SQLite Databases Used By Fossil} th1.md {The TH1 Scripting Language} tickets.wiki {The Fossil Ticket System} theory1.wiki {Thoughts On The Design Of The Fossil DVCS} tls-nginx.md {Proxying Fossil via HTTPS with nginx} unvers.wiki {Unversioned Files} webpage-ex.md {Webpage Examples} webui.wiki {The Fossil Web Interface} whyusefossil.wiki {Why You Should Use Fossil} whyusefossil.wiki {Benefits Of Version Control} wikitheory.wiki {Wiki In Fossil} /wiki_rules {Wiki Formatting Rules} |
︙ | ︙ |
Changes to www/password.wiki.
︙ | ︙ | |||
71 72 73 74 75 76 77 | hashes the password and compares it against the value stored in USER.PW. If they match, the server sets a cookie on the client to record the login. This cookie contains a large amount of high-quality randomness and is thus intractable to guess. The value of the cookie and the IP address of the client is stored in the USER.COOKIE and USER.IPADDR fields of the USER table on the server. The USER.CEXPIRE field holds an expiration date | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | hashes the password and compares it against the value stored in USER.PW. If they match, the server sets a cookie on the client to record the login. This cookie contains a large amount of high-quality randomness and is thus intractable to guess. The value of the cookie and the IP address of the client is stored in the USER.COOKIE and USER.IPADDR fields of the USER table on the server. The USER.CEXPIRE field holds an expiration date for the cookie, encoded as a Julian day number. On all subsequent HTTP requests, the cookie value is matched against the USER table to enable access to the repository. A login cookie will only work if the IP address matches. This feature is designed to make it more difficult for an attacker to sniff the cookie and take over the connection. A cookie-sniffing attack will only work if the attacker is able to send and receive from the same IP address as |
︙ | ︙ | |||
95 96 97 98 99 100 101 | Note that in order to log into a Fossil server, it is necessary to write information into the repository database. Hence, login is not possible on a Fossil repository with a read-only database file. The user password is sent over the wire as cleartext on the initial login attempt. The plan moving forward is to compute the SHA1 hash of | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | Note that in order to log into a Fossil server, it is necessary to write information into the repository database. Hence, login is not possible on a Fossil repository with a read-only database file. The user password is sent over the wire as cleartext on the initial login attempt. The plan moving forward is to compute the SHA1 hash of the password on the client using JavaScript and then send only the hash over the wire, but that plan has not yet been set in code. <h2>Sync Protocol Authentication</h2> A different authentication mechanism is used when one repository wants to sync (or push or pull or clone) another repository. When two repositories are syncing, the one that initiates the transaction is |
︙ | ︙ |
Changes to www/permutedindex.html.
︙ | ︙ | |||
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 | </ul> <a name="pindex"></a> <h2>Permuted Index:</h2> <ul> <li><a href="fiveminutes.wiki">5 Minutes as a Single User — Up and Running in</a></li> <li><a href="fossil-from-msvc.wiki">2010 IDE — Integrating Fossil in the Microsoft Express</a></li> <li><a href="tech_overview.wiki"><b>A Technical Overview Of The Design And Implementation Of Fossil</b></a></li> <li><a href="adding_code.wiki"><b>Adding New Features To Fossil</b></a></li> <li><a href="copyright-release.html">Agreement — Contributor License</a></li> <li><a href="alerts.md">Alerts And Notifications — Email</a></li> <li><a href="delta_encoder_algorithm.wiki">Algorithm — Fossil Delta Encoding</a></li> <li><a href="blame.wiki">Algorithm Of Fossil — The Annotate/Blame</a></li> <li><a href="blame.wiki">Annotate/Blame Algorithm Of Fossil — The</a></li> <li><a href="customskin.md">Appearance of Web Pages — Theming: Customizing The</a></li> <li><a href="faq.wiki">Asked Questions — Frequently</a></li> <li><a href="password.wiki">Authentication — Password Management And</a></li> <li><a href="backoffice.md">Backoffice mechanism of Fossil — The</a></li> <li><a href="whyusefossil.wiki"><b>Benefits Of Version Control</b></a></li> <li><a href="hashpolicy.wiki">Between SHA1 and SHA3-256 — Hash Policy: Choosing</a></li> <li><a href="antibot.wiki">Bots — Defense against Spiders and</a></li> <li><a href="private.wiki">Branches — Creating, Syncing, and Deleting Private</a></li> <li><a href="branching.wiki"><b>Branching, Forking, Merging, and Tagging</b></a></li> <li><a href="bugtheory.wiki"><b>Bug Tracking In Fossil</b></a></li> <li><a href="makefile.wiki">Build Process — The Fossil</a></li> <li><a href="aboutcgi.wiki">CGI Works In Fossil — How</a></li> <li><a href="changes.wiki">Changelog — Fossil</a></li> <li><a href="checkin_names.wiki"><b>Check-in And Version Names</b></a></li> <li><a href="checkin.wiki"><b>Check-in Checklist</b></a></li> <li><a href="checkin.wiki">Checklist — Check-in</a></li> <li><a href="../test/release-checklist.wiki">Checklist — Pre-Release Testing</a></li> <li><a href="foss-cklist.wiki"><b>Checklist For Successful Open-Source Projects</b></a></li> <li><a href="selfcheck.wiki">Checks — Fossil Repository Integrity Self</a></li> <li><a href="childprojects.wiki"><b>Child Projects</b></a></li> <li><a href="hashpolicy.wiki">Choosing Between SHA1 and SHA3-256 — Hash Policy:</a></li> <li><a href="contribute.wiki">Code or Documentation To The Fossil Project — Contributing</a></li> <li><a href="style.wiki">Code Style Guidelines — Source</a></li> <li><a href="../../../help">Commands and Webpages — Lists of</a></li> <li><a href="build.wiki"><b>Compiling and Installing Fossil</b></a></li> <li><a href="concepts.wiki">Concepts — Fossil Core</a></li> | > > > > > > > > > > > > | > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > | 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 | </ul> <a name="pindex"></a> <h2>Permuted Index:</h2> <ul> <li><a href="fiveminutes.wiki">5 Minutes as a Single User — Up and Running in</a></li> <li><a href="fossil-from-msvc.wiki">2010 IDE — Integrating Fossil in the Microsoft Express</a></li> <li><a href="tech_overview.wiki"><b>A Technical Overview Of The Design And Implementation Of Fossil</b></a></li> <li><a href="serverext.wiki"><b>Adding Extensions To A Fossil Server Using CGI Scripts</b></a></li> <li><a href="adding_code.wiki"><b>Adding New Features To Fossil</b></a></li> <li><a href="caps/admin-v-setup.md">Admin Users — Differences Between Setup and</a></li> <li><a href="caps/"><b>Administering User Capabilities</b></a></li> <li><a href="copyright-release.html">Agreement — Contributor License</a></li> <li><a href="alerts.md">Alerts And Notifications — Email</a></li> <li><a href="delta_encoder_algorithm.wiki">Algorithm — Fossil Delta Encoding</a></li> <li><a href="blame.wiki">Algorithm Of Fossil — The Annotate/Blame</a></li> <li><a href="blame.wiki">Annotate/Blame Algorithm Of Fossil — The</a></li> <li><a href="customskin.md">Appearance of Web Pages — Theming: Customizing The</a></li> <li><a href="faq.wiki">Asked Questions — Frequently</a></li> <li><a href="password.wiki">Authentication — Password Management And</a></li> <li><a href="backoffice.md">Backoffice mechanism of Fossil — The</a></li> <li><a href="fossil_prompt.wiki">Bash Prompt — Fossilized</a></li> <li><a href="whyusefossil.wiki"><b>Benefits Of Version Control</b></a></li> <li><a href="caps/admin-v-setup.md">Between Setup and Admin Users — Differences</a></li> <li><a href="hashpolicy.wiki">Between SHA1 and SHA3-256 — Hash Policy: Choosing</a></li> <li><a href="blockchain.md">Blockchain — Fossil As</a></li> <li><a href="antibot.wiki">Bots — Defense against Spiders and</a></li> <li><a href="private.wiki">Branches — Creating, Syncing, and Deleting Private</a></li> <li><a href="branching.wiki"><b>Branching, Forking, Merging, and Tagging</b></a></li> <li><a href="bugtheory.wiki"><b>Bug Tracking In Fossil</b></a></li> <li><a href="makefile.wiki">Build Process — The Fossil</a></li> <li><a href="caps/">Capabilities — Administering User</a></li> <li><a href="caps/ref.html">Capability Reference — User</a></li> <li><a href="cgi.wiki"><b>CGI Script Configuration Options</b></a></li> <li><a href="serverext.wiki">CGI Scripts — Adding Extensions To A Fossil Server Using</a></li> <li><a href="serverext.wiki"><b>CGI Server Extensions</b></a></li> <li><a href="aboutcgi.wiki">CGI Works In Fossil — How</a></li> <li><a href="changes.wiki">Changelog — Fossil</a></li> <li><a href="checkin_names.wiki"><b>Check-in And Version Names</b></a></li> <li><a href="checkin.wiki"><b>Check-in Checklist</b></a></li> <li><a href="checkin.wiki">Checklist — Check-in</a></li> <li><a href="../test/release-checklist.wiki">Checklist — Pre-Release Testing</a></li> <li><a href="foss-cklist.wiki"><b>Checklist For Successful Open-Source Projects</b></a></li> <li><a href="selfcheck.wiki">Checks — Fossil Repository Integrity Self</a></li> <li><a href="childprojects.wiki"><b>Child Projects</b></a></li> <li><a href="hashpolicy.wiki">Choosing Between SHA1 and SHA3-256 — Hash Policy:</a></li> <li><a href="contribute.wiki">Code or Documentation To The Fossil Project — Contributing</a></li> <li><a href="style.wiki">Code Style Guidelines — Source</a></li> <li><a href="../../../help">Commands and Webpages — Lists of</a></li> <li><a href="build.wiki"><b>Compiling and Installing Fossil</b></a></li> <li><a href="concepts.wiki">Concepts — Fossil Core</a></li> <li><a href="cgi.wiki">Configuration Options — CGI Script</a></li> <li><a href="server/">Configure A Fossil Server — How To</a></li> <li><a href="rebaseharm.md">Considered Harmful — Rebase</a></li> <li><a href="shunning.wiki">Content From Fossil — Shunning: Deleting</a></li> <li><a href="defcsp.md">Content Security Policy — The Default</a></li> <li><a href="contribute.wiki"><b>Contributing Code or Documentation To The Fossil Project</b></a></li> <li><a href="copyright-release.html"><b>Contributor License Agreement</b></a></li> <li><a href="whyusefossil.wiki">Control — Benefits Of Version</a></li> <li><a href="concepts.wiki">Core Concepts — Fossil</a></li> <li><a href="newrepo.wiki">Create A New Fossil Repository — How To</a></li> <li><a href="private.wiki"><b>Creating, Syncing, and Deleting Private Branches</b></a></li> <li><a href="qandc.wiki">Criticisms — Questions And</a></li> <li><a href="customskin.md"><b>Custom Skins</b></a></li> <li><a href="customskin.md">Customizing The Appearance of Web Pages — Theming:</a></li> <li><a href="custom_ticket.wiki"><b>Customizing The Ticket System</b></a></li> <li><a href="customgraph.md">Customizing the Timeline Graph — Theming:</a></li> <li><a href="tech_overview.wiki">Databases Used By Fossil — SQLite</a></li> <li><a href="defcsp.md">Default Content Security Policy — The</a></li> <li><a href="antibot.wiki"><b>Defense against Spiders and Bots</b></a></li> <li><a href="shunning.wiki">Deleting Content From Fossil — Shunning:</a></li> <li><a href="private.wiki">Deleting Private Branches — Creating, Syncing, and</a></li> <li><a href="delta_encoder_algorithm.wiki">Delta Encoding Algorithm — Fossil</a></li> <li><a href="delta_format.wiki">Delta Format — Fossil</a></li> <li><a href="tech_overview.wiki">Design And Implementation Of Fossil — A Technical Overview Of The</a></li> <li><a href="theory1.wiki">Design Of The Fossil DVCS — Thoughts On The</a></li> <li><a href="caps/admin-v-setup.md"><b>Differences Between Setup and Admin Users</b></a></li> <li><a href="embeddeddoc.wiki">Documentation — Embedded Project</a></li> <li><a href="contribute.wiki">Documentation To The Fossil Project — Contributing Code or</a></li> <li><a href="aboutdownload.wiki">Download Page Works — How The</a></li> <li><a href="theory1.wiki">DVCS — Thoughts On The Design Of The Fossil</a></li> <li><a href="quotes.wiki">DVCSes in General — Quotes: What People Are Saying About Fossil, Git, and</a></li> <li><a href="alerts.md"><b>Email Alerts And Notifications</b></a></li> <li><a href="embeddeddoc.wiki"><b>Embedded Project Documentation</b></a></li> <li><a href="delta_encoder_algorithm.wiki">Encoding Algorithm — Fossil Delta</a></li> <li><a href="encryptedrepos.wiki">Encrypted Repositories — How To Use</a></li> <li><a href="env-opts.md"><b>Environment Variables and Global Options</b></a></li> <li><a href="event.wiki"><b>Events</b></a></li> <li><a href="webpage-ex.md">Examples — Webpage</a></li> <li><a href="inout.wiki">Export To And From Git — Import And</a></li> <li><a href="fossil-from-msvc.wiki">Express 2010 IDE — Integrating Fossil in the Microsoft</a></li> <li><a href="serverext.wiki">Extensions — CGI Server</a></li> <li><a href="serverext.wiki">Extensions To A Fossil Server Using CGI Scripts — Adding</a></li> <li><a href="adding_code.wiki">Features To Fossil — Adding New</a></li> <li><a href="fileformat.wiki">File Format — Fossil</a></li> <li><a href="globs.md"><b>File Name Glob Patterns</b></a></li> <li><a href="unvers.wiki">Files — Unversioned</a></li> <li><a href="branching.wiki">Forking, Merging, and Tagging — Branching,</a></li> <li><a href="delta_format.wiki">Format — Fossil Delta</a></li> <li><a href="fileformat.wiki">Format — Fossil File</a></li> <li><a href="image-format-vs-repo-size.md">Format vs Fossil Repo Size — Image</a></li> <li><a href="../../../md_rules">Formatting Rules — Markdown</a></li> <li><a href="../../../wiki_rules">Formatting Rules — Wiki</a></li> <li><a href="forum.wiki">Forums — Fossil</a></li> <li><a href="blockchain.md"><b>Fossil As Blockchain</b></a></li> <li><a href="changes.wiki"><b>Fossil Changelog</b></a></li> <li><a href="concepts.wiki"><b>Fossil Core Concepts</b></a></li> <li><a href="delta_encoder_algorithm.wiki"><b>Fossil Delta Encoding Algorithm</b></a></li> <li><a href="delta_format.wiki"><b>Fossil Delta Format</b></a></li> <li><a href="fileformat.wiki"><b>Fossil File Format</b></a></li> <li><a href="forum.wiki"><b>Fossil Forums</b></a></li> <li><a href="grep.md"><b>Fossil grep vs POSIX grep</b></a></li> <li><a href="quickstart.wiki"><b>Fossil Quick Start Guide</b></a></li> <li><a href="selfcheck.wiki"><b>Fossil Repository Integrity Self Checks</b></a></li> <li><a href="selfhost.wiki"><b>Fossil Self Hosting Repositories</b></a></li> <li><a href="settings.wiki"><b>Fossil Settings</b></a></li> <li><a href="hints.wiki"><b>Fossil Tips And Usage Hints</b></a></li> <li><a href="fossil-v-git.wiki"><b>Fossil Versus Git</b></a></li> <li><a href="quotes.wiki">Fossil, Git, and DVCSes in General — Quotes: What People Are Saying About</a></li> <li><a href="fossil_prompt.wiki"><b>Fossilized Bash Prompt</b></a></li> <li><a href="faq.wiki"><b>Frequently Asked Questions</b></a></li> <li><a href="quotes.wiki">General — Quotes: What People Are Saying About Fossil, Git, and DVCSes in</a></li> <li><a href="fossil-v-git.wiki">Git — Fossil Versus</a></li> <li><a href="inout.wiki">Git — Import And Export To And From</a></li> <li><a href="mirrorlimitations.md">Git Mirrors — Limitations On</a></li> <li><a href="quotes.wiki">Git, and DVCSes in General — Quotes: What People Are Saying About Fossil,</a></li> <li><a href="mirrortogithub.md">GitHub — How To Mirror A Fossil Repository On</a></li> <li><a href="globs.md">Glob Patterns — File Name</a></li> <li><a href="env-opts.md">Global Options — Environment Variables and</a></li> <li><a href="customgraph.md">Graph — Theming: Customizing the Timeline</a></li> <li><a href="grep.md">grep — Fossil grep vs POSIX</a></li> <li><a href="grep.md">grep vs POSIX grep — Fossil</a></li> <li><a href="quickstart.wiki">Guide — Fossil Quick Start</a></li> <li><a href="style.wiki">Guidelines — Source Code Style</a></li> <li><a href="hacker-howto.wiki"><b>Hacker How-To</b></a></li> <li><a href="adding_code.wiki"><b>Hacking Fossil</b></a></li> <li><a href="rebaseharm.md">Harmful — Rebase Considered</a></li> <li><a href="hashpolicy.wiki"><b>Hash Policy: Choosing Between SHA1 and SHA3-256</b></a></li> <li><a href="hints.wiki">Hints — Fossil Tips And Usage</a></li> <li><a href="index.wiki"><b>Home Page</b></a></li> <li><a href="selfhost.wiki">Hosting Repositories — Fossil Self</a></li> <li><a href="aboutcgi.wiki"><b>How CGI Works In Fossil</b></a></li> <li><a href="aboutdownload.wiki"><b>How The Download Page Works</b></a></li> <li><a href="server/"><b>How To Configure A Fossil Server</b></a></li> <li><a href="newrepo.wiki"><b>How To Create A New Fossil Repository</b></a></li> <li><a href="mirrortogithub.md"><b>How To Mirror A Fossil Repository On GitHub</b></a></li> <li><a href="encryptedrepos.wiki"><b>How To Use Encrypted Repositories</b></a></li> <li><a href="hacker-howto.wiki">How-To — Hacker</a></li> <li><a href="tls-nginx.md">HTTPS with nginx — Proxying Fossil via</a></li> <li><a href="fossil-from-msvc.wiki">IDE — Integrating Fossil in the Microsoft Express 2010</a></li> <li><a href="image-format-vs-repo-size.md"><b>Image Format vs Fossil Repo Size</b></a></li> <li><a href="tech_overview.wiki">Implementation Of Fossil — A Technical Overview Of The Design And</a></li> <li><a href="inout.wiki"><b>Import And Export To And From Git</b></a></li> <li><a href="build.wiki">Installing Fossil — Compiling and</a></li> <li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li> <li><a href="selfcheck.wiki">Integrity Self Checks — Fossil Repository</a></li> <li><a href="webui.wiki">Interface — The Fossil Web</a></li> <li><a href="javascript.md">JavaScript in Fossil — Use of</a></li> <li><a href="th1.md">Language — The TH1 Scripting</a></li> <li><a href="copyright-release.html">License Agreement — Contributor</a></li> <li><a href="mirrorlimitations.md"><b>Limitations On Git Mirrors</b></a></li> <li><a href="../../../help"><b>Lists of Commands and Webpages</b></a></li> <li><a href="password.wiki">Management And Authentication — Password</a></li> <li><a href="../../../sitemap">Map — Site</a></li> <li><a href="../../../md_rules"><b>Markdown Formatting Rules</b></a></li> <li><a href="backoffice.md">mechanism of Fossil — The Backoffice</a></li> <li><a href="branching.wiki">Merging, and Tagging — Branching, Forking,</a></li> <li><a href="fossil-from-msvc.wiki">Microsoft Express 2010 IDE — Integrating Fossil in the</a></li> <li><a href="fiveminutes.wiki">Minutes as a Single User — Up and Running in 5</a></li> <li><a href="mirrortogithub.md">Mirror A Fossil Repository On GitHub — How To</a></li> <li><a href="mirrorlimitations.md">Mirrors — Limitations On Git</a></li> <li><a href="globs.md">Name Glob Patterns — File</a></li> <li><a href="checkin_names.wiki">Names — Check-in And Version</a></li> <li><a href="adding_code.wiki">New Features To Fossil — Adding</a></li> <li><a href="newrepo.wiki">New Fossil Repository — How To Create A</a></li> <li><a href="tls-nginx.md">nginx — Proxying Fossil via HTTPS with</a></li> <li><a href="alerts.md">Notifications — Email Alerts And</a></li> <li><a href="foss-cklist.wiki">Open-Source Projects — Checklist For Successful</a></li> <li><a href="pop.wiki">Operation — Principles Of</a></li> <li><a href="cgi.wiki">Options — CGI Script Configuration</a></li> <li><a href="env-opts.md">Options — Environment Variables and Global</a></li> <li><a href="tech_overview.wiki">Overview Of The Design And Implementation Of Fossil — A Technical</a></li> <li><a href="index.wiki">Page — Home</a></li> <li><a href="aboutdownload.wiki">Page Works — How The Download</a></li> <li><a href="customskin.md">Pages — Theming: Customizing The Appearance of Web</a></li> <li><a href="password.wiki"><b>Password Management And Authentication</b></a></li> <li><a href="globs.md">Patterns — File Name Glob</a></li> <li><a href="quotes.wiki">People Are Saying About Fossil, Git, and DVCSes in General — Quotes: What</a></li> <li><a href="stats.wiki"><b>Performance Statistics</b></a></li> <li><a href="defcsp.md">Policy — The Default Content Security</a></li> <li><a href="hashpolicy.wiki">Policy: Choosing Between SHA1 and SHA3-256 — Hash</a></li> <li><a href="grep.md">POSIX grep — Fossil grep vs</a></li> <li><a href="../test/release-checklist.wiki"><b>Pre-Release Testing Checklist</b></a></li> <li><a href="pop.wiki"><b>Principles Of Operation</b></a></li> <li><a href="private.wiki">Private Branches — Creating, Syncing, and Deleting</a></li> <li><a href="makefile.wiki">Process — The Fossil Build</a></li> <li><a href="contribute.wiki">Project — Contributing Code or Documentation To The Fossil</a></li> <li><a href="embeddeddoc.wiki">Project Documentation — Embedded</a></li> <li><a href="foss-cklist.wiki">Projects — Checklist For Successful Open-Source</a></li> <li><a href="childprojects.wiki">Projects — Child</a></li> <li><a href="fossil_prompt.wiki">Prompt — Fossilized Bash</a></li> <li><a href="sync.wiki">Protocol — The Fossil Sync</a></li> <li><a href="tls-nginx.md"><b>Proxying Fossil via HTTPS with nginx</b></a></li> <li><a href="faq.wiki">Questions — Frequently Asked</a></li> <li><a href="qandc.wiki"><b>Questions And Criticisms</b></a></li> <li><a href="quickstart.wiki">Quick Start Guide — Fossil</a></li> <li><a href="quotes.wiki"><b>Quotes: What People Are Saying About Fossil, Git, and DVCSes in General</b></a></li> <li><a href="rebaseharm.md"><b>Rebase Considered Harmful</b></a></li> <li><a href="caps/ref.html">Reference — User Capability</a></li> <li><a href="image-format-vs-repo-size.md">Repo Size — Image Format vs Fossil</a></li> <li><a href="selfhost.wiki">Repositories — Fossil Self Hosting</a></li> <li><a href="encryptedrepos.wiki">Repositories — How To Use Encrypted</a></li> <li><a href="newrepo.wiki">Repository — How To Create A New Fossil</a></li> <li><a href="selfcheck.wiki">Repository Integrity Self Checks — Fossil</a></li> <li><a href="mirrortogithub.md">Repository On GitHub — How To Mirror A Fossil</a></li> <li><a href="reviews.wiki"><b>Reviews</b></a></li> <li><a href="../../../md_rules">Rules — Markdown Formatting</a></li> <li><a href="../../../wiki_rules">Rules — Wiki Formatting</a></li> <li><a href="fiveminutes.wiki">Running in 5 Minutes as a Single User — Up and</a></li> <li><a href="quotes.wiki">Saying About Fossil, Git, and DVCSes in General — Quotes: What People Are</a></li> <li><a href="cgi.wiki">Script Configuration Options — CGI</a></li> <li><a href="th1.md">Scripting Language — The TH1</a></li> <li><a href="serverext.wiki">Scripts — Adding Extensions To A Fossil Server Using CGI</a></li> <li><a href="defcsp.md">Security Policy — The Default Content</a></li> <li><a href="selfcheck.wiki">Self Checks — Fossil Repository Integrity</a></li> <li><a href="selfhost.wiki">Self Hosting Repositories — Fossil</a></li> <li><a href="server/">Server — How To Configure A Fossil</a></li> <li><a href="serverext.wiki">Server Extensions — CGI</a></li> <li><a href="serverext.wiki">Server Using CGI Scripts — Adding Extensions To A Fossil</a></li> <li><a href="settings.wiki">Settings — Fossil</a></li> <li><a href="caps/admin-v-setup.md">Setup and Admin Users — Differences Between</a></li> <li><a href="hashpolicy.wiki">SHA1 and SHA3-256 — Hash Policy: Choosing Between</a></li> <li><a href="hashpolicy.wiki">SHA3-256 — Hash Policy: Choosing Between SHA1 and</a></li> <li><a href="shunning.wiki"><b>Shunning: Deleting Content From Fossil</b></a></li> <li><a href="fiveminutes.wiki">Single User — Up and Running in 5 Minutes as a</a></li> <li><a href="../../../sitemap"><b>Site Map</b></a></li> <li><a href="image-format-vs-repo-size.md">Size — Image Format vs Fossil Repo</a></li> <li><a href="customskin.md">Skins — Custom</a></li> <li><a href="style.wiki"><b>Source Code Style Guidelines</b></a></li> <li><a href="antibot.wiki">Spiders and Bots — Defense against</a></li> <li><a href="tech_overview.wiki"><b>SQLite Databases Used By Fossil</b></a></li> <li><a href="ssl.wiki">SSL with Fossil — Using</a></li> <li><a href="quickstart.wiki">Start Guide — Fossil Quick</a></li> <li><a href="stats.wiki">Statistics — Performance</a></li> <li><a href="style.wiki">Style Guidelines — Source Code</a></li> <li><a href="foss-cklist.wiki">Successful Open-Source Projects — Checklist For</a></li> <li><a href="sync.wiki">Sync Protocol — The Fossil</a></li> <li><a href="private.wiki">Syncing, and Deleting Private Branches — Creating,</a></li> <li><a href="custom_ticket.wiki">System — Customizing The Ticket</a></li> <li><a href="tickets.wiki">System — The Fossil Ticket</a></li> <li><a href="branching.wiki">Tagging — Branching, Forking, Merging, and</a></li> <li><a href="tech_overview.wiki">Technical Overview Of The Design And Implementation Of Fossil — A</a></li> <li><a href="../test/release-checklist.wiki">Testing Checklist — Pre-Release</a></li> <li><a href="th1.md">TH1 Scripting Language — The</a></li> <li><a href="backoffice.md"><b>The "Backoffice" mechanism of Fossil</b></a></li> <li><a href="blame.wiki"><b>The Annotate/Blame Algorithm Of Fossil</b></a></li> <li><a href="defcsp.md"><b>The Default Content Security Policy</b></a></li> <li><a href="makefile.wiki"><b>The Fossil Build Process</b></a></li> <li><a href="sync.wiki"><b>The Fossil Sync Protocol</b></a></li> <li><a href="tickets.wiki"><b>The Fossil Ticket System</b></a></li> <li><a href="webui.wiki"><b>The Fossil Web Interface</b></a></li> <li><a href="th1.md"><b>The TH1 Scripting Language</b></a></li> <li><a href="customskin.md"><b>Theming: Customizing The Appearance of Web Pages</b></a></li> <li><a href="customgraph.md"><b>Theming: Customizing the Timeline Graph</b></a></li> <li><a href="theory1.wiki"><b>Thoughts On The Design Of The Fossil DVCS</b></a></li> <li><a href="custom_ticket.wiki">Ticket System — Customizing The</a></li> <li><a href="tickets.wiki">Ticket System — The Fossil</a></li> <li><a href="customgraph.md">Timeline Graph — Theming: Customizing the</a></li> <li><a href="hints.wiki">Tips And Usage Hints — Fossil</a></li> <li><a href="bugtheory.wiki">Tracking In Fossil — Bug</a></li> <li><a href="unvers.wiki"><b>Unversioned Files</b></a></li> <li><a href="fiveminutes.wiki"><b>Up and Running in 5 Minutes as a Single User</b></a></li> <li><a href="hints.wiki">Usage Hints — Fossil Tips And</a></li> <li><a href="javascript.md"><b>Use of JavaScript in Fossil</b></a></li> <li><a href="fiveminutes.wiki">User — Up and Running in 5 Minutes as a Single</a></li> <li><a href="caps/">User Capabilities — Administering</a></li> <li><a href="caps/ref.html"><b>User Capability Reference</b></a></li> <li><a href="caps/admin-v-setup.md">Users — Differences Between Setup and Admin</a></li> <li><a href="serverext.wiki">Using CGI Scripts — Adding Extensions To A Fossil Server</a></li> <li><a href="ssl.wiki"><b>Using SSL with Fossil</b></a></li> <li><a href="env-opts.md">Variables and Global Options — Environment</a></li> <li><a href="whyusefossil.wiki">Version Control — Benefits Of</a></li> <li><a href="checkin_names.wiki">Version Names — Check-in And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> <li><a href="tls-nginx.md">via HTTPS with nginx — Proxying Fossil</a></li> <li><a href="image-format-vs-repo-size.md">vs Fossil Repo Size — Image Format</a></li> <li><a href="grep.md">vs POSIX grep — Fossil grep</a></li> <li><a href="webui.wiki">Web Interface — The Fossil</a></li> <li><a href="customskin.md">Web Pages — Theming: Customizing The Appearance of</a></li> <li><a href="webpage-ex.md"><b>Webpage Examples</b></a></li> <li><a href="../../../help">Webpages — Lists of Commands and</a></li> <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General — Quotes:</a></li> <li><a href="whyusefossil.wiki"><b>Why You Should Use Fossil</b></a></li> <li><a href="../../../wiki_rules"><b>Wiki Formatting Rules</b></a></li> <li><a href="wikitheory.wiki"><b>Wiki In Fossil</b></a></li> <li><a href="aboutdownload.wiki">Works — How The Download Page</a></li> <li><a href="aboutcgi.wiki">Works In Fossil — How CGI</a></li> <li><a href="whyusefossil.wiki">You Should Use Fossil — Why</a></li> </ul></div> |
Changes to www/private.wiki.
︙ | ︙ | |||
51 52 53 54 55 56 57 | to your Mac, including all private branches, use: <blockquote><pre> fossil clone --private http://user@linux.localnetwork:8080/ mac-clone.fossil </pre></blockquote> You'll have to supply a username and password in order for this to work. | | | | | | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | to your Mac, including all private branches, use: <blockquote><pre> fossil clone --private http://user@linux.localnetwork:8080/ mac-clone.fossil </pre></blockquote> You'll have to supply a username and password in order for this to work. Fossil will not clone (or sync) private branches anonymously. By default, there are no users that can do private branch syncing. You will have to give a user the "Private" capability ("x") if you want them to be able to do this. We deny such capability for normal users by default to add a barrier to accidental syncing of a private branch to a public server. It is highly recommended that you leave the "x" capability turned off on all repositories used for collaboration (repositories to which many people push and pull) and only enable "x" for local repositories when you need to share private branches. Private branch sync only works if you use the --private command-line option. Private branches are never synced via the auto-sync mechanism. Once |
︙ | ︙ |
Changes to www/quickstart.wiki.
1 2 3 4 5 6 | <title>Fossil Quick Start Guide</title> <h1 align="center">Fossil Quick Start</h1> <p>This is a guide to get you started using fossil quickly and painlessly.</p> | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <title>Fossil Quick Start Guide</title> <h1 align="center">Fossil Quick Start</h1> <p>This is a guide to get you started using fossil quickly and painlessly.</p> <h2 id="install">Installing</h2> <p>Fossil is a single self-contained C program. You need to either download a <a href="https://www.fossil-scm.org/fossil/uv/download.html">precompiled binary</a> or <a href="build.wiki">compile it yourself</a> from sources. Install fossil by putting the fossil binary |
︙ | ︙ | |||
144 145 146 147 148 149 150 | changes if told to do so.</p> <h2>Configuring Your Local Repository</h2> <p>When you create a new repository, either by cloning an existing project or create a new project of your own, you usually want to do some local configuration. This is easily accomplished using the web-server | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | changes if told to do so.</p> <h2>Configuring Your Local Repository</h2> <p>When you create a new repository, either by cloning an existing project or create a new project of your own, you usually want to do some local configuration. This is easily accomplished using the web-server that is built into fossil. Start the fossil web server like this: ([/help/ui | more info])</p> <blockquote> <b>fossil ui </b><i> repository-filename</i> </blockquote> <p>You can omit the <i>repository-filename</i> from the command above |
︙ | ︙ | |||
280 281 282 283 284 285 286 | <i># make sure the merge didn't break anything...</i><br> <b>fossil [/help/commit|commit] </blockquote> <p>The argument to the [/help/merge|merge] command can be any of the version identifier forms that work for [/help/update|update]. ([./checkin_names.wiki|more info].) | | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | <i># make sure the merge didn't break anything...</i><br> <b>fossil [/help/commit|commit] </blockquote> <p>The argument to the [/help/merge|merge] command can be any of the version identifier forms that work for [/help/update|update]. ([./checkin_names.wiki|more info].) The merge command has options to cherry-pick individual changes, or to back out individual changes, if you don't want to do a full merge.</p> The merge command puts all changes in your working check-out. No changes are made to the repository. You must run [/help/commit|commit] separately to add the merge changes into your repository to make them persistent |
︙ | ︙ | |||
336 337 338 339 340 341 342 | address only (and thus makes the web interface visible only on the local machine) and it automatically start your web browser pointing at the server. For cross-machine collaboration, use the <b>server</b> command, which binds on all IP addresses and does not try to start a web browser.</p> <p>Servers are also easily configured as: <ul> | | > | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | address only (and thus makes the web interface visible only on the local machine) and it automatically start your web browser pointing at the server. For cross-machine collaboration, use the <b>server</b> command, which binds on all IP addresses and does not try to start a web browser.</p> <p>Servers are also easily configured as: <ul> <li>[./server/any/inetd.md|inetd] <li>[./server/debian/service.md|systemd] <li>[./server/any/cgi.md|CGI] <li>[./server/any/scgi.md|SCGI] </ul> <p>The [./selfhost.wiki | self-hosting fossil repositories] use CGI. <a name="proxy"></a> <h2>HTTP Proxies</h2> |
︙ | ︙ |
Added www/rebase01.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="203.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C0<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="263.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="323.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="382.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="441.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="382.5" y="-511.8418334831767"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n0" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n2" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n3" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e5" source="n5" target="n4"> <data key="d9"/> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/rebase01.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="289" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="97" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"> <!--Generated by ySVG 2.5--> <defs id="genericDefs"/> <g> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L289 0 L289 97 L0 97 L0 0 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="M193 -522 L482 -522 L482 -425 L193 -425 L193 -522 Z"/> </clipPath> </defs> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="translate(-193,522)" stroke="white"> <rect x="193" width="289" height="97" y="-522" clip-path="url(#clipPath2)" stroke="none"/> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668"/> <text x="210.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C0</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="278.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="278.5" cy="-450.668"/> <text x="270.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="338.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="338.5" cy="-450.668"/> <text x="330.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-450.668"/> <text x="389.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="456.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="456.5" cy="-450.668"/> <text x="448.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C5</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-496.8418"/> <text x="389.5547" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C4</text> <path fill="none" d="M233.5 -450.668 L255.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M263.5 -450.668 L251.5 -455.668 L254.5 -450.668 L251.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M293.5 -450.668 L315.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M323.5 -450.668 L311.5 -455.668 L314.5 -450.668 L311.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M353.5 -450.668 L374.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M382.5 -450.668 L370.5 -455.668 L373.5 -450.668 L370.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M412.5 -450.668 L433.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M441.5 -450.668 L429.5 -455.668 L432.5 -450.668 L429.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M350.3126 -459.9126 L379.3874 -482.6667" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M385.6874 -487.5972 L373.1558 -484.139 L378.5999 -482.0504 L379.3189 -476.264 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M409.3126 -487.5972 L438.3874 -464.843" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M444.6874 -459.9126 L438.3189 -471.2458 L437.5999 -465.4594 L432.1559 -463.3708 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> </g> </g> </svg> |
Added www/rebase02.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="203.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C0<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="263.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="323.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="382.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="441.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="22.638671875" x="3.6806640625" xml:space="preserve" y="5.93359375">C4'<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="382.5" y="-511.8418334831767"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n0" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n1" target="n2"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n2" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n3" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/rebase02.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="289" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="97" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"> <!--Generated by ySVG 2.5--> <defs id="genericDefs"/> <g> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L289 0 L289 97 L0 97 L0 0 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="M193 -522 L482 -522 L482 -425 L193 -425 L193 -522 Z"/> </clipPath> </defs> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="translate(-193,522)" stroke="white"> <rect x="193" width="289" height="97" y="-522" clip-path="url(#clipPath2)" stroke="none"/> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668"/> <text x="210.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C0</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="278.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="278.5" cy="-450.668"/> <text x="270.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="338.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="338.5" cy="-450.668"/> <text x="330.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-450.668"/> <text x="389.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="456.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="456.5" cy="-450.668"/> <text x="447.1807" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C4'</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-193,522)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="397.5" cy="-496.8418"/> <text x="389.5547" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C4</text> <path fill="none" d="M233.5 -450.668 L255.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M263.5 -450.668 L251.5 -455.668 L254.5 -450.668 L251.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M293.5 -450.668 L315.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M323.5 -450.668 L311.5 -455.668 L314.5 -450.668 L311.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M353.5 -450.668 L374.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M382.5 -450.668 L370.5 -455.668 L373.5 -450.668 L370.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M412.5 -450.668 L433.5 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M441.5 -450.668 L429.5 -455.668 L432.5 -450.668 L429.5 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M350.3126 -459.9126 L379.3874 -482.6667" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M385.6874 -487.5972 L373.1558 -484.139 L378.5999 -482.0504 L379.3189 -476.264 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> </g> </g> </svg> |
Added www/rebase03.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="304.8657196180818" x="190.26470451454668" y="-473.84183348317674"/> <y:Fill color="#C6E2FF" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="sides" modelPosition="s" textColor="#000000" verticalTextPosition="bottom" visible="true" width="32.74609375" x="136.05981293404088" xml:space="preserve" y="50.0">main</y:NodeLabel> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="157.99516150784632" x="337.1352626247822" y="-519.8418334831767"/> <y:Fill color="#9ACCFC" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="sides" modelPosition="n" textColor="#000000" verticalTextPosition="bottom" visible="true" width="45.255859375" x="56.36965106642316" xml:space="preserve" y="-22.1328125">feature</y:NodeLabel> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="203.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C0<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="265.07206789081687" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="326.64413578163374" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="449.7882715632675" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C6<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n6"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="388.21620367245066" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n7"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="357.4301697270422" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n8"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="419.00223761785907" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n3" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n4" target="n7"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n4" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n6" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e5" source="n7" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e6" source="n7" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e7" source="n8" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/rebase03.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="326" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="157" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"> <!--Generated by ySVG 2.5--> <defs id="genericDefs"/> <g> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L326 0 L326 157 L0 157 L0 0 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="M180 -552 L506 -552 L506 -395 L180 -395 L180 -552 Z"/> </clipPath> </defs> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="translate(-180,552)" stroke="white"> <rect x="180" width="326" height="157" y="-552" clip-path="url(#clipPath2)" stroke="none"/> </g> <g fill="rgb(198,226,255)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="rgb(198,226,255)"> <rect x="190.2647" width="304.8657" height="46" y="-473.8418" clip-path="url(#clipPath2)" stroke="none"/> </g> <g stroke-linecap="butt" transform="matrix(1,0,0,1,-180,552)" fill="rgb(124,165,204)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" stroke="rgb(124,165,204)" stroke-miterlimit="1.45"> <rect fill="none" x="190.2647" width="304.8657" height="46" y="-473.8418" clip-path="url(#clipPath2)"/> <text x="328.3245" y="-410.2403" clip-path="url(#clipPath2)" fill="black" font-family="sans-serif" stroke="none" xml:space="preserve">main</text> </g> <g fill="rgb(154,204,252)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="rgb(154,204,252)"> <rect x="337.1353" width="157.9952" height="46" y="-519.8418" clip-path="url(#clipPath2)" stroke="none"/> </g> <g stroke-linecap="butt" transform="matrix(1,0,0,1,-180,552)" fill="rgb(124,165,204)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" stroke="rgb(124,165,204)" stroke-miterlimit="1.45"> <rect fill="none" x="337.1353" width="157.9952" height="46" y="-519.8418" clip-path="url(#clipPath2)"/> <text x="395.5049" y="-528.3731" clip-path="url(#clipPath2)" fill="black" font-family="sans-serif" stroke="none" xml:space="preserve">feature</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668"/> <text x="210.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C0</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="280.0721" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="280.0721" cy="-450.668"/> <text x="272.1268" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="341.6441" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="341.6441" cy="-450.668"/> <text x="333.6988" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="464.7883" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="464.7883" cy="-450.668"/> <text x="456.843" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C6</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="403.2162" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="403.2162" cy="-450.668"/> <text x="395.2709" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C4</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="372.4302" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="372.4302" cy="-496.8418"/> <text x="364.4849" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="434.0022" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,552)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="434.0022" cy="-496.8418"/> <text x="426.0569" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C5</text> <path fill="none" d="M233.5 -450.668 L257.0721 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M265.0721 -450.668 L253.0721 -455.668 L256.0721 -450.668 L253.0721 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M295.0721 -450.668 L318.6441 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M326.6441 -450.668 L314.6441 -455.668 L317.6441 -450.668 L314.6441 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M356.6441 -450.668 L380.2162 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M388.2162 -450.668 L376.2162 -455.668 L379.2162 -450.668 L376.2162 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M418.2162 -450.668 L441.7883 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M449.7883 -450.668 L437.7883 -455.668 L440.7883 -450.668 L437.7883 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M349.9653 -463.1483 L359.6711 -477.7054" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M364.109 -484.3615 L353.292 -477.151 L359.1163 -476.8734 L361.6122 -471.6036 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M387.4302 -496.8418 L411.0022 -496.8418" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M419.0022 -496.8418 L407.0022 -501.8418 L410.0022 -496.8418 L407.0022 -491.8418 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> </g> </g> </svg> |
Added www/rebase04.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="402.9304840497709" x="190.26470451454665" y="-473.84183348317674"/> <y:Fill color="#C6E2FF" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="256.0599259395354" x="337.1352626247822" y="-519.8418334831767"/> <y:Fill color="#9ACCFC" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="203.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C0<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="265.07206789081687" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="326.64413578163374" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="449.7882715632675" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C6<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n6"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="388.21620367245066" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n7"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="357.4301697270422" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n8"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="419.00223761785907" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n9"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="480.57430550867593" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="22.638671875" x="3.6806640625" xml:space="preserve" y="5.93359375">C3'<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n10"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="542.1463733994929" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="22.638671875" x="3.6806640625" xml:space="preserve" y="5.93359375">C5'<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n3" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n4" target="n7"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n4" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n6" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e5" source="n7" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e6" source="n7" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e7" source="n8" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e8" source="n5" target="n9"> <data key="d9"/> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e9" source="n9" target="n10"> <data key="d9"/> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/rebase04.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="424" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="113" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"> <!--Generated by ySVG 2.5--> <defs id="genericDefs"/> <g> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L424 0 L424 113 L0 113 L0 0 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="M180 -530 L604 -530 L604 -417 L180 -417 L180 -530 Z"/> </clipPath> </defs> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="translate(-180,530)" stroke="white"> <rect x="180" width="424" height="113" y="-530" clip-path="url(#clipPath2)" stroke="none"/> </g> <g fill="rgb(198,226,255)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="rgb(198,226,255)"> <rect x="190.2647" width="402.9305" height="46" y="-473.8418" clip-path="url(#clipPath2)" stroke="none"/> </g> <g stroke-linecap="butt" transform="matrix(1,0,0,1,-180,530)" fill="rgb(124,165,204)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" stroke="rgb(124,165,204)" stroke-miterlimit="1.45"> <rect fill="none" x="190.2647" width="402.9305" height="46" y="-473.8418" clip-path="url(#clipPath2)"/> </g> <g fill="rgb(154,204,252)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="rgb(154,204,252)"> <rect x="337.1353" width="256.0599" height="46" y="-519.8418" clip-path="url(#clipPath2)" stroke="none"/> </g> <g stroke-linecap="butt" transform="matrix(1,0,0,1,-180,530)" fill="rgb(124,165,204)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" stroke="rgb(124,165,204)" stroke-miterlimit="1.45"> <rect fill="none" x="337.1353" width="256.0599" height="46" y="-519.8418" clip-path="url(#clipPath2)"/> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668"/> <text x="210.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C0</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="280.0721" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="280.0721" cy="-450.668"/> <text x="272.1268" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="341.6441" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="341.6441" cy="-450.668"/> <text x="333.6988" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="464.7883" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="464.7883" cy="-450.668"/> <text x="456.843" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C6</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="403.2162" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="403.2162" cy="-450.668"/> <text x="395.2709" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C4</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="372.4302" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="372.4302" cy="-496.8418"/> <text x="364.4849" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="434.0022" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="434.0022" cy="-496.8418"/> <text x="426.0569" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C5</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="495.5743" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="495.5743" cy="-496.8418"/> <text x="486.255" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C3'</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="557.1464" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="557.1464" cy="-496.8418"/> <text x="547.827" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C5'</text> <path fill="none" d="M233.5 -450.668 L257.0721 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M265.0721 -450.668 L253.0721 -455.668 L256.0721 -450.668 L253.0721 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M295.0721 -450.668 L318.6441 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M326.6441 -450.668 L314.6441 -455.668 L317.6441 -450.668 L314.6441 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M356.6441 -450.668 L380.2162 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M388.2162 -450.668 L376.2162 -455.668 L379.2162 -450.668 L376.2162 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M418.2162 -450.668 L441.7883 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M449.7883 -450.668 L437.7883 -455.668 L440.7883 -450.668 L437.7883 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M349.9653 -463.1483 L359.6711 -477.7054" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M364.109 -484.3615 L353.292 -477.151 L359.1163 -476.8734 L361.6122 -471.6036 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M387.4302 -496.8418 L411.0022 -496.8418" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M419.0022 -496.8418 L407.0022 -501.8418 L410.0022 -496.8418 L407.0022 -491.8418 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M473.1094 -463.1483 L482.8152 -477.7054" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M487.2531 -484.3615 L476.4361 -477.151 L482.2605 -476.8734 L484.7563 -471.6036 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M510.5743 -496.8418 L534.1464 -496.8418" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M542.1464 -496.8418 L530.1464 -501.8418 L533.1464 -496.8418 L530.1464 -491.8418 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> </g> </g> </svg> |
Added www/rebase05.graphml.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> <!--Created by yEd 3.19--> <key attr.name="Description" attr.type="string" for="graph" id="d0"/> <key for="port" id="d1" yfiles.type="portgraphics"/> <key for="port" id="d2" yfiles.type="portgeometry"/> <key for="port" id="d3" yfiles.type="portuserdata"/> <key attr.name="url" attr.type="string" for="node" id="d4"/> <key attr.name="description" attr.type="string" for="node" id="d5"/> <key for="node" id="d6" yfiles.type="nodegraphics"/> <key for="graphml" id="d7" yfiles.type="resources"/> <key attr.name="url" attr.type="string" for="edge" id="d8"/> <key attr.name="description" attr.type="string" for="edge" id="d9"/> <key for="edge" id="d10" yfiles.type="edgegraphics"/> <graph edgedefault="directed" id="G"> <data key="d0" xml:space="preserve"/> <node id="n0"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="340.4059698148014" x="190.26470451454665" y="-473.84183348317674"/> <y:Fill color="#C6E2FF" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n1"> <data key="d6"> <y:ShapeNode> <y:Geometry height="46.0" width="193.53541170456577" x="337.1352626247822" y="-519.8418334831767"/> <y:Fill color="#9ACCFC" transparent="false"/> <y:BorderStyle color="#7CA5CC" raised="false" type="line" width="1.0"/> <y:Shape type="rectangle"/> </y:ShapeNode> </data> </node> <node id="n2"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="203.5" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C0<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n3"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="265.07206789081687" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C1<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n4"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="326.64413578163374" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C2<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n5"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="449.7882715632675" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C6<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n6"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="388.21620367245066" y="-465.66796875"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C4<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n7"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="357.4301697270422" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C3<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n8"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="419.00223761785907" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C5<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <node id="n9"> <data key="d6"> <y:ShapeNode> <y:Geometry height="30.0" width="30.0" x="480.57430550867593" y="-511.84183348317674"/> <y:Fill color="#FFFFFF" transparent="false"/> <y:BorderStyle color="#000000" raised="false" type="line" width="2.0"/> <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.1328125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="19.890625" x="5.0546875" xml:space="preserve" y="5.93359375">C7<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel> <y:Shape type="ellipse"/> </y:ShapeNode> </data> </node> <edge id="e0" source="n2" target="n3"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e1" source="n3" target="n4"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e2" source="n4" target="n7"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e3" source="n4" target="n6"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e4" source="n6" target="n5"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e5" source="n7" target="n8"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e6" source="n7" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e7" source="n8" target="n1"> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e8" source="n5" target="n9"> <data key="d9"/> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> <edge id="e9" source="n8" target="n9"> <data key="d9"/> <data key="d10"> <y:PolyLineEdge> <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> <y:LineStyle color="#000000" type="line" width="1.0"/> <y:Arrows source="none" target="standard"/> <y:BendStyle smoothed="false"/> </y:PolyLineEdge> </data> </edge> </graph> <data key="d7"> <y:Resources/> </data> </graphml> |
Added www/rebase05.svg.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="361" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" height="113" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"> <!--Generated by ySVG 2.5--> <defs id="genericDefs"/> <g> <defs id="defs1"> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath1"> <path d="M0 0 L361 0 L361 113 L0 113 L0 0 Z"/> </clipPath> <clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"> <path d="M180 -530 L541 -530 L541 -417 L180 -417 L180 -530 Z"/> </clipPath> </defs> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="translate(-180,530)" stroke="white"> <rect x="180" width="361" height="113" y="-530" clip-path="url(#clipPath2)" stroke="none"/> </g> <g fill="rgb(198,226,255)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="rgb(198,226,255)"> <rect x="190.2647" width="340.406" height="46" y="-473.8418" clip-path="url(#clipPath2)" stroke="none"/> </g> <g stroke-linecap="butt" transform="matrix(1,0,0,1,-180,530)" fill="rgb(124,165,204)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" stroke="rgb(124,165,204)" stroke-miterlimit="1.45"> <rect fill="none" x="190.2647" width="340.406" height="46" y="-473.8418" clip-path="url(#clipPath2)"/> </g> <g fill="rgb(154,204,252)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="rgb(154,204,252)"> <rect x="337.1353" width="193.5354" height="46" y="-519.8418" clip-path="url(#clipPath2)" stroke="none"/> </g> <g stroke-linecap="butt" transform="matrix(1,0,0,1,-180,530)" fill="rgb(124,165,204)" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" stroke="rgb(124,165,204)" stroke-miterlimit="1.45"> <rect fill="none" x="337.1353" width="193.5354" height="46" y="-519.8418" clip-path="url(#clipPath2)"/> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="218.5" cy="-450.668"/> <text x="210.5547" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C0</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="280.0721" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="280.0721" cy="-450.668"/> <text x="272.1268" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C1</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="341.6441" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="341.6441" cy="-450.668"/> <text x="333.6988" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C2</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="464.7883" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="464.7883" cy="-450.668"/> <text x="456.843" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C6</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="403.2162" cy="-450.668" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="403.2162" cy="-450.668"/> <text x="395.2709" y="-446.1328" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C4</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="372.4302" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="372.4302" cy="-496.8418"/> <text x="364.4849" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C3</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="434.0022" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="434.0022" cy="-496.8418"/> <text x="426.0569" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C5</text> </g> <g fill="white" text-rendering="geometricPrecision" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke="white"> <circle r="15" clip-path="url(#clipPath2)" cx="495.5743" cy="-496.8418" stroke="none"/> </g> <g text-rendering="geometricPrecision" stroke-miterlimit="1.45" stroke-width="2" shape-rendering="geometricPrecision" transform="matrix(1,0,0,1,-180,530)" stroke-linecap="butt"> <circle fill="none" r="15" clip-path="url(#clipPath2)" cx="495.5743" cy="-496.8418"/> <text x="487.629" y="-492.3067" clip-path="url(#clipPath2)" font-family="sans-serif" stroke="none" stroke-width="1" xml:space="preserve">C7</text> <path fill="none" d="M233.5 -450.668 L257.0721 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M265.0721 -450.668 L253.0721 -455.668 L256.0721 -450.668 L253.0721 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M295.0721 -450.668 L318.6441 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M326.6441 -450.668 L314.6441 -455.668 L317.6441 -450.668 L314.6441 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M356.6441 -450.668 L380.2162 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M388.2162 -450.668 L376.2162 -455.668 L379.2162 -450.668 L376.2162 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M418.2162 -450.668 L441.7883 -450.668" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M449.7883 -450.668 L437.7883 -455.668 L440.7883 -450.668 L437.7883 -445.668 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M349.9653 -463.1483 L359.6711 -477.7054" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M364.109 -484.3615 L353.292 -477.151 L359.1163 -476.8734 L361.6122 -471.6036 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M387.4302 -496.8418 L411.0022 -496.8418" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M419.0022 -496.8418 L407.0022 -501.8418 L410.0022 -496.8418 L407.0022 -491.8418 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M473.1094 -463.1483 L482.8152 -477.7054" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M487.2531 -484.3615 L476.4361 -477.151 L482.2605 -476.8734 L484.7563 -471.6036 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> <path fill="none" d="M449.0022 -496.8418 L472.5743 -496.8418" stroke-width="1" clip-path="url(#clipPath2)"/> <path d="M480.5743 -496.8418 L468.5743 -501.8418 L471.5743 -496.8418 L468.5743 -491.8418 Z" stroke-width="1" clip-path="url(#clipPath2)" stroke="none"/> </g> </g> </svg> |
Added www/rebaseharm.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Rebase Considered Harmful Fossil deliberately omits a "rebase" command, because the original designer of Fossil (and [original author][vhist] of this article) considers rebase to be an anti-pattern to be avoided. This article attempts to explain that point of view. [vhist]: /finfo?name=www/rebaseharm.md&ubg ## 1.0 Rebasing is dangerous Most people, even strident advocates of rebase, agree that rebase can cause problems when misused. The Git rebase documentation talks about the [golden rule of rebase][golden]: that it should never be used on a public branch. Horror stories of misused rebase abound, and the rebase documentation devotes considerable space toward explaining how to recover from rebase errors and/or misuse. ## <a name="cap-loss"></a>2.0 Rebase provides no new capabilities Sometimes sharp and dangerous tools are justified, because they accomplish things that cannot be done otherwise, or at least cannot be done easily. Rebase does not fall into that category, because it provides no new capabilities. ### <a name="orphaning"></a>2.1 A rebase is just a merge with historical references omitted A rebase is really nothing more than a merge (or a series of merges) that deliberately forgets one of the parents of each merge step. To help illustrate this fact, consider the first rebase example from the [Git documentation][gitrebase]. The merge looks like this:  And the rebase looks like this:  As the [Git documentation][gitrebase] points out, check-ins C4\' and C5 are identical. The only difference between C4\' and C5 is that C5 records the fact that C4 is its merge parent but C4\' does not. Thus, a rebase is just a merge that forgets where it came from. The Git documentation acknowledges this fact (in so many words) and justifies it by saying "rebasing makes for a cleaner history." I read that sentence as a tacit admission that the Git history display capabilities are weak and need active assistance from the user to keep things manageable. Surely a better approach is to record the complete ancestry of every check-in but then fix the tool to show a "clean" history in those instances where a simplified display is desirable and edifying, but retain the option to show the real, complete, messy history for cases where detail and accuracy are more important. So, another way of thinking about rebase is that it is a kind of merge that intentionally forgets some details in order to not overwhelm the weak history display mechanisms available in Git. ### <a name="clean-diffs"></a>2.2 Rebase does not actually provide better feature-branch diffs Another argument, often cited, is that rebasing a feature branch allows one to see just the changes in the feature branch without the concurrent changes in the main line of development. Consider a hypothetical case:  In the above, a feature branch consisting of check-ins C3 and C5 is run concurrently with the main line in check-ins C4 and C6. Advocates for rebase say that you should rebase the feature branch to the tip of main like the following:  You could choose to collapse C3\' and C5\' into a single check-in as part of this rebase, but that’s a side issue we’ll deal with [separately](#collapsing). If only merge is available, one would do a merge from the concurrent mainline changes into the feature branch as follows:  Check-ins C5\' and C7 check-ins hold identical code. The only difference is in their history. The argument from rebase advocates is that with merge it is difficult to see only the changes associated with the feature branch without the commingled mainline changes. In other words, diff(C2,C7) shows changes associated both the feature branch and from the mainline, whereas in the rebase case diff(C6,C5\') should only the feature branch changes. But that argument is comparing apples to oranges, since the two diffs do not have the same baseline. The correct way to see only the feature branch changes in the merge case is not diff(C2,C7) but rather diff(C6,C7). <center><table border="1" cellpadding="5" cellspacing="0"> <tr><th>Rebase<th>Merge<th>What You See <tr><td>diff(C2,C5\')<td>diff(C2,C7)<td>Commingled branch and mainline changes <tr><td>diff(C6,C5\')<td>diff(C6,C7)<td>Branch changes only </table></center> Remember: C7 and C5\' are bit-for-bit identical, so the output of the diff is not determined by whether you select C7 or C5\' as the target of the diff, but rather by your choice of the diff source, C2 or C6. So, to help with the problem of viewing changes associated with a feature branch, perhaps what is needed is not rebase but rather better tools to help users identify an appropriate baseline for their diffs. ## <a name="siloing"></a>3.0 Rebase encourages siloed development The [golden rule of rebase][golden] is that you should never do it on public branches, so if you are using rebase as intended, that means you are keeping private branches. Or, to put it another way, you are doing siloed development. You are not sharing your intermediate work with collaborators. This is not good for product quality. [Nagappan, et. al][nagappan] studied bugs in Windows Vista and found that best predictor of bugs is the distance on the org-chart between the stake-holders. Or, bugs are reduced when the engineers talk to one another. Similar findings arise in other disciplines. Keeping private branches does not prove that developers are communicating insufficiently, but it is a key symptom that problem. [Weinberg][weinberg] argues programming should be "egoless." That is to say, programmers should avoid linking their code with their sense of self, as that makes it more difficult for them to find and respond to bugs, and hence makes them less productive. Many developers are drawn to private branches out of sense of ego. "I want to get the code right before I publish it." I sympathize with this sentiment, and am frequently guilty of it myself. It is humbling to display your stupid mistake to the whole world on an internet that never forgets. And yet, humble programmers generate better code. What is the fastest path to solid code? Is it to continue staring at your private branch to seek out every last bug, or is it to publish it as-is, whereupon the many eyeballs will immediately see that last stupid error in the code? Testing and development are often done by separate groups within a larger software development organization, because developers get too close to their own code to see every problem in it. Given that, is it better for those many eyeballs to find your problems while they’re still isolated on a feature branch, or should that vetting wait until you finally push a collapsed version of a private working branch to the parent repo? Will the many eyeballs even see those errors when they’re intermingled with code implementing some tasty new feature? ## <a name="testing"></a>4.0 Rebase commits untested check-ins to the blockchain Rebase adds new check-ins to the blockchain without giving the operator an opportunity to test and verify those check-ins. Just because the underlying three-way merge had no conflict does not mean that the resulting code actually works. Thus, rebase runs the very real risk of adding non-functional check-ins to the permanent record. Of course, a user can also commit untested or broken check-ins without the help of rebase. But at least with an ordinary commit or merge (in Fossil at least), the operator has the *opportunity* to test and verify the merge before it is committed, and a chance to back out or fix the change if it is broken, without leaving busted check-ins on the blockchain to complicate future bisects. With rebase, pre-commit testing is not an option. ## <a name="timestamps"></a>5.0 Rebase causes timestamp confusion Consider the earlier example of rebasing a feature branch:  What timestamps go on the C3\' and C5\' check-ins? If you choose the same timestamps as the original C3 and C5, then you have the odd situation C3' is older than its parent C6. We call that a "timewarp" in Fossil. Timewarps can also happen due to misconfigured system clocks, so they are not unique to rebase. But they are very confusing and best avoided. The other option is to provide new unique timestamps for C3' and C5'. But then you lose the information about when those check-ins were originally created, which can make historical analysis of changes more difficult, and might also complicate prior art claims. ## <a name="lying"></a>6.0 Rebasing is the same as lying By discarding parentage information, rebase attempts to deceive the reader about how the code actually came together. The [Git rebase documentation][gitrebase] admits as much. They acknowledge that when you view a repository as record of what actually happened, doing a rebase is "blasphemous" and "you're _lying_ about what actually happened", but then goes on to justify rebase as follows: > _"The opposing point of view is that the commit history is the **story of how your project was made.** You wouldn\'t publish the first draft of a book, and the manual for how to maintain your software deserves careful editing. This is the camp that uses tools like rebase and filter-branch to tell the story in the way that’s best for future readers."_ I reject this argument utterly. Unless your project is a work of fiction, it is not a "story" but a "history." Honorable writers adjust their narrative to fit history. Rebase adjusts history to fit the narrative. Truthful texts can be redrafted for clarity and accuracy. Fossil supports this by providing mechanisms to fix typos in check-in comments, attach supplemental notes, and make other editorial changes. The corrections are accomplished by adding new modification records to the blockchain. The original incorrect inputs are preserved in the blockchain and are easily accessible. But for routine display purposes, the more readable edited presentation is provided. A repository can be a true and accurate representation of history even without getting everything perfect on the first draft. Unfortunately, Git does not provide the ability to add corrections or clarifications to historical check-ins in its blockchain. Hence, once again, rebase can be seen as an attempt to work around limitations of Git. Wouldn't it be better to fix the tool rather than to lie about the project history? ## <a name="collapsing"></a>7.0 Collapsing check-ins throws away valuable information One of the oft-cited advantages of rebasing in Git is that it lets you collapse multiple check-ins down to a single check-in to make the development history “clean.” The intent is that development appear as though every feature were created in a single step: no multi-step evolution, no back-tracking, no false starts, no mistakes. This ignores actual developer psychology: ideas rarely spring forth from fingers to files in faultless finished form. A wish for collapsed, finalized check-ins is a wish for a counterfactual situation. The common counterargument is that collapsed check-ins represent a better world, the ideal we’re striving for. What that argument overlooks is that we must throw away valuable information to get there. ### <a name="empathy"></a>7.1 Individual check-ins support developer empathy Ideally, future developers of our software can understand every feature in it using only context available in the version of the code they start work with. Prior to widespread version control, developers had no choice but to work that way. Pre-existing codebases could only be understood as-is or not at all. Developers in that world had an incentive to develop software that was easy to understand retrospectively, even if they were selfish people, because they knew they might end up being those future developers! Yet, sometimes we come upon a piece of code that we simply cannot understand. If you have never asked yourself, “What was this code’s developer thinking?” you haven’t been developing software for very long. When a developer can go back to the individual check-ins leading up to the current code, they can work out the answers to such questions using only the level of empathy necessary to be a good developer. To understand such code using only the finished form, you are asking future developers to make intuitive leaps that the original developer was unable to make. In other words, you are asking your future maintenance developers to be smarter than the original developers! That’s a beautiful wish, but there’s a sharp limit to how far you can carry it. Eventually you hit the limits of human brilliance. When the operation of some bit of code is not obvious, both Fossil and Git let you run a [`blame`](/help?cmd=blame) on the code file to get information about each line of code, and from that which check-in last touched a given line of code. If you squash the check-ins on a branch down to a single check-in, you throw away the information leading up to that finished form. Fossil not only preserves the check-ins surrounding the one that included the line of code you’re trying to understand, its [superior data model][sdm] lets you see the surrounding check-ins in both directions; not only what lead up to it, but what came next. Git can’t do that short of crawling the block-chain backwards from the tip of the branch to the check-in you’re looking at, an expensive operation. We believe it is easier to understand a line of code from the 10-line check-in it was a part of — and then to understand the surrounding check-ins as necessary — than it is to understand a 500-line check-in that collapses a whole branch’s worth of changes down to a single finished feature. [sdm]: ./fossil-v-git.wiki#durable ### <a name="bisecting"></a>7.2 Bisecting works better on small check-ins Git lets a developer write a feature in ten check-ins but collapse it down to an eleventh check-in and then deliberately push only that final collapsed check-in to the parent repo. Someone else may then do a bisect that blames the merged check-in as the source of the problem they’re chasing down; they then have to manually work out which of the 10 steps the original developer took to create it to find the source of the actual problem. Fossil pushes all 11 check-ins to the parent repository by default, so that someone doing that bisect sees the complete check-in history, so the bisect will point them at the single original check-in that caused the problem. ### <a name="comments"></a>7.3 Multiple check-ins require multiple check-in comments The more comments you have from a given developer on a given body of code, the more concise documentation you have of that developer’s thought process. To resume the bisecting example, a developer trying to work out what the original developer was thinking with a given change will have more success given a check-in comment that explains what the one check-in out of ten blamed by the “bisect” command was trying to accomplish than if they must work that out from the eleventh check-in’s comment, which only explains the “clean” version of the collapsed feature. ### <a name="cherrypicking"></a>7.4 Cherry-picks work better with small check-ins While working on a new feature in one branch, you may come across a bug in the pre-existing code that you need to fix in order for work on that feature to proceed. You could choose to switch briefly back to the parent branch, develop the fix there, check it in, then merge the parent back up to the feature branch in order to continue work, but that’s distracting. If the fix isn’t for a critical bug, fixing it on the parent branch can wait, so it’s better to maintain your mental working state by fixing the problem in place on the feature branch, then check the fix in on the feature branch, resume work on the feature, and later merge that fix down into the parent branch along with the feature. But now what happens if another branch *also* needs that fix? Let us say our code repository has a branch for the current stable release, a development branch for the next major version, and feature branches off of the development branch. If we rebase each feature branch down into the development branch as a single check-in, pushing only the rebase check-in up to the parent repo, only that fix’s developer has the information locally to perform the cherry-pick of the fix onto the stable branch. Developers working on new features often do not care about old stable versions, yet that stable version may have an end user community that depends on that version, who either cannot wait for the next stable version or who wish to put off upgrading to it for some time. Such users want backported bug fixes, yet the developers creating those fixes have poor incentives to provide those backports. Thus the existence of maintenance and support organizations, who end up doing such work. (There is [a famous company][rh] that built a multi-billion dollar enterprise on such work.) This work is far easier when each cherry-pick transfers completely and cleanly from one branch to another, and we increase the likelihood of achieving that state by working from the smallest check-ins that remain complete. If a support organization must manually disentangle a fix from a feature check-in, they are likely to introduce new bugs on the stable branch. Even if they manage to do their work without error, it takes them more time to do the cherry-pick that way. [rh]: https://en.wikipedia.org/wiki/Red_Hat ### <a name="backouts"></a>7.5 Back-outs also work better with small check-ins The inverse of the cherry-pick merge is the back-out merge. If you push only a collapsed version of a private working branch up to the parent repo, those working from that parent repo cannot automatically back out any of the individual check-ins that went into that private branch. Others must either manually disentangle the problematic part of your merge check-in or back out the entire feature. ## <a name="better-plan"></a>8.0 Cherry-pick merges work better than rebase Perhaps there are some cases where a rebase-like transformation is actually helpful. But those cases are rare. And when they do come up, running a series of cherry-pick merges achieve the same topology, but with advantages: 1. Cherry-pick merges preserve an honest record of history. (They do in Fossil at least. Git's file format does not have a slot to record cherry-pick merge history, unfortunately.) 2. Cherry-picks provide an opportunity to [test each new check-in before it is committed][tbc] to the blockchain 3. Cherry-pick merges are "safe" in the sense that they do not cause problems for collaborators if you do them on public branches. 4. Cherry-picks keep both the original and the revised check-ins, so both timestamps are preserved. [tbc]: ./fossil-v-git.wiki#testing ## <a name="conclusion"></a>9.0 Summary and conclusion Rebasing is an anti-pattern. It is dishonest. It deliberately omits historical information. It causes problems for collaboration. And it has no offsetting benefits. For these reasons, rebase is intentionally and deliberately omitted from the design of Fossil. [golden]: https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing [gitrebase]: https://git-scm.com/book/en/v2/Git-Branching-Rebasing [nagappan]: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2008-11.pdf [weinberg]: https://books.google.com/books?id=76dIAAAAMAAJ |
Changes to www/selfhost.wiki.
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 3. [https://www3.fossil-scm.org/site.cgi] The canonical repository is (1). Repositories (2) and (3) automatically stay in synchronization with (1) via a <a href="http://en.wikipedia.org/wiki/Cron">cron job</a> that invokes "fossil sync" at regular intervals. Note that the two secondary repositories are more than just read-only mirrors. All three servers support full read/write capabilities. Changes (such as new tickets or wiki or check-ins) can be implemented on any of the three servers and those changes automatically propagate to the other two servers. | > > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3. [https://www3.fossil-scm.org/site.cgi] The canonical repository is (1). Repositories (2) and (3) automatically stay in synchronization with (1) via a <a href="http://en.wikipedia.org/wiki/Cron">cron job</a> that invokes "fossil sync" at regular intervals. Repository (2) also publishes a [./mirrortogithub.md|GitHub mirror of Fossil] as a demonstration. Note that the two secondary repositories are more than just read-only mirrors. All three servers support full read/write capabilities. Changes (such as new tickets or wiki or check-ins) can be implemented on any of the three servers and those changes automatically propagate to the other two servers. |
︙ | ︙ | |||
52 53 54 55 56 57 58 | #!/home/hwaci/bin/fossil repository: /home/hwaci/fossil/fossil.fossil </pre></blockquote> In recent years, virtual private servers have become a more flexible and less expensive hosting option compared to shared hosting accounts. So on 2017-07-25, server (3) was moved | > | | > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #!/home/hwaci/bin/fossil repository: /home/hwaci/fossil/fossil.fossil </pre></blockquote> In recent years, virtual private servers have become a more flexible and less expensive hosting option compared to shared hosting accounts. So on 2017-07-25, server (3) was moved onto a $5/month "droplet" [https://en.wikipedia.org/wiki/Virtual_private_server|VPS] from [https://www.digitalocean.com|Digital Ocean] located in San Francisco. Server (3) is synchronized with the canonical server (1) by running the following command via cron: <blockquote><pre> /home/hwaci/bin/fossil sync -R /home/hwaci/fossil/fossil.fossil </pre></blockquote> Server (2) is a <a href="http://www.linode.com/">Linode 4096</a> located in Newark, NJ and set up just like the canonical server (1) with the addition of a cron job for synchronization. The same cron job also runs the [/help?cmd=git|fossil git export] command after each sync in order to [./mirrortogithub.md#ex1|mirror all changes to GitHub]. |
Added www/server/any/althttpd.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via althttpd [Althttpd][althttpd] is a light-weight web server that has been used to implement the SQLite and Fossil websites for well over a decade. Althttpd strives for simplicity, security, ease of configuration, and low resource usage. To set up a Fossil server as CGI on a host running the althttpd web server, follow these steps. <ol> <li<p>Get the althttpd webserver running on the host. This is easily done by following the [althttpd documentation][althttpd]. <li><p>Create a CGI script for your Fossil respository. The script will be typically be two lines of code that look something like this: ~~~ #!/usr/bin/fossil repository: /home/yourlogin/fossils/project.fossil ~~~ Modify the filenames to conform to your system, of course. The CGI script accepts [other options][cgi] besides the repository:" line. You can add in other options as you desire, but the single "repository:" line is normally all that is needed to get started. <li><p>Make the CGI script executable. <li><p>Verify that the fossil repository file and the directory that contains the repository are both writable by whatever user the web server is running and. </ol> And you are done. Visit the URL that corresponds to the CGI script you created to start using your Fossil server. *[Return to the top-level Fossil server article.](../)* [althttpd]: https://sqlite.org/docsrc/doc/trunk/misc/althttpd.md [cgi]: ../../cgi.wiki |
Added www/server/any/cgi.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via CGI A Fossil server can be run from most ordinary web servers as a CGI program. This feature allows Fossil to seamlessly integrate into a larger website. We use CGI for the [self-hosting Fossil repository web site](../../selfhost.wiki). To run Fossil as CGI, create a CGI script (here called "repo") in the CGI directory of your web server with content like this: #!/usr/bin/fossil repository: /home/fossil/repo.fossil Adjust the paths appropriately. It may be necessary to set certain permissions on this file or to modify an `.htaccess` file or make other server-specific changes. Consult the documentation for your particular web server. The following permissions are *normally* required, but, again, may be different for a particular configuration: * The Fossil binary (`/usr/bin/fossil` in the example above) must be readable/executable. * *All* directories leading up to the Fossil binary must be readable by the process which executes the CGI. * The CGI script must be executable for the user under which it will run, which often differs from the one running the web server. Consult your site's documentation or the web server’s system administrator. * *All* directories leading to the CGI script must be readable by the web server. * The repository file *and* the directory containing it must be writable by the same account which executes the Fossil binary. (This might differ from the user the web server normally runs under.) The directory holding the repository file(s) needs to be writable so that SQLite can write its journal files. * Fossil must be able to create temporary files in a [directory that varies by host OS](../../env-opts.md#temp). When the CGI process is operating [within a chroot](../../chroot.md), ensure that this directory exists and is readable/writeable by the user who executes the Fossil binary. Once the CGI script is set up correctly, and assuming your server is also set correctly, you should be able to access your repository with a URL like: <b>http://mydomain.org/cgi-bin/repo</b> This is assuming you are running a web server like Apache that uses a “`cgi-bin`” directory for scripts like our “`repo`” example. To serve multiple repositories from a directory using CGI, use the "directory:" tag in the CGI script rather than "repository:". You might also want to add a "notfound:" tag to tell where to redirect if the particular repository requested by the URL is not found: #!/usr/bin/fossil directory: /home/fossil/repos notfound: http://url-to-go-to-if-repo-not-found/ Once deployed, a URL like: <b>http://mydomain.org/cgi-bin/repo/XYZ</b> will serve up the repository `/home/fossil/repos/XYZ.fossil` if it exists. Additional options available to the CGI script are [documented separately](../../cgi.wiki). *[Return to the top-level Fossil server article.](../)* |
Added www/server/any/inetd.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via inetd A Fossil server can be launched on-demand by `inetd` by using the [`fossil http`](/help/http) command. To do so, add a line like the following to its configuration file, typically `/etc/inetd.conf`: 80 stream tcp nowait.1000 root /usr/bin/fossil /usr/bin/fossil http /home/fossil/repo.fossil In this example, you are telling `inetd` that when an incoming connection appears on TCP port 80 that it should launch the program `/usr/bin/fossil` with the arguments shown. Obviously you will need to modify the pathnames for your particular setup. The final argument is either the name of the fossil repository to be served or a directory containing multiple repositories. If you use a non-standard TCP port on systems where the port specification must be a symbolic name and cannot be numeric, add the desired name and port to `/etc/services`. For example, if you want your Fossil server running on TCP port 12345 instead of 80, you will need to add: fossil 12345/tcp # fossil server and use the symbolic name “`fossil`” instead of the numeric TCP port number (“12345” in the above example) in `inetd.conf`. Notice that we configured `inetd` to launch Fossil as root. See the top-level section on “[The Fossil Chroot Jail](../../chroot.md)” for the consequences of this and alternatives to it. You can instead configure `inetd` to bind to a higher-numbered TCP port, allowing Fossil to be run as a normal user. In that case, Fossil will not put itself into a chroot jail, because it assumes you have set up file permissions and such on the server appropriate for that user. The `inetd` daemon must be enabled for this to work, and it must be restarted whenever its configuration file changes. This is a more complicated method than the [standalone HTTP server method](./none.md), but it has the advantage of only using system resources when an actual connection is attempted. If no one ever connects to that port, a Fossil server will not (automatically) run. It has the disadvantage of requiring "root" access, which may not be available to you, either due to local IT policy or because of restrictions at your shared Internet hosting service. For further details, see the relevant section in your system's documentation. The FreeBSD Handbook covers `inetd` in [this chapter](https://www.freebsd.org/doc/en/books/handbook/network-inetd.html). *[Return to the top-level Fossil server article.](../)* |
Added www/server/any/none.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Standalone HTTP Server The easiest way to set up a Fossil server is to use either the [`server`](/help/server) or [`ui`](/help/ui) command: * **fossil server** _REPOSITORY_ * **fossil ui** _REPOSITORY_ The _REPOSITORY_ argument is either the name of the repository file or a directory containing many repositories named “`*.fossil`”. Both of these commands start a Fossil server, usually on TCP port 8080, though a higher numbered port will be used instead if 8080 is already occupied. You can access these using URLs of the form **http://localhost:8080/**, or if _REPOSITORY_ is a directory, URLs of the form **http://localhost:8080/**_repo_**/** where _repo_ is the base name of the repository file without the “`.fossil`” suffix. There are several key differences between “`ui`” and “`server`”: * “`ui`” always binds the server to the loopback IP address (127.0.0.1) so that it cannot serve to other machines. * Anyone who visits this URL is treated as the all-powerful Setup user, which is why the first difference exists. * “`ui`” launches a local web browser pointed at this URL. You can omit the _REPOSITORY_ argument if you run one of the above commands from within a Fossil checkout directory to serve that repository: $ fossil ui # or... $ fossil server You can abbreviate Fossil sub-commands as long as they are unambiguous. “`server`” can currently be as short as “`ser`”. You can serve a directory containing multiple `*.fossil` files like so: $ fossil server --port 9000 --repolist /path/to/repo/dir There is an [example script](/file/tools/fslsrv) in the Fossil distribution that wraps `fossil server` to produce more complicated effects. Feel free to take it, study it, and modify it to suit your local needs. See the [online documentation](/help/server) for more information on the options and arguments you can give to these commands. *[Return to the top-level Fossil server article.](../)* |
Added www/server/any/scgi.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via SCGI There is an alternative to running Fossil as a [standalone HTTP server](./none.md), which is to run it in SimpleCGI (a.k.a. SCGI) mode, which uses the same [`fossil server`](/help/server) command as for HTTP service. Simply add the `--scgi` command-line option and the stand-alone server will speak the SCGI protocol rather than raw HTTP. This can be used with a web server such as [nginx](http://nginx.org) which does not support [Fossil’s CGI mode](./cgi.md). A basic nginx configuration to support SCGI with Fossil looks like this: location /code/ { include scgi_params; scgi_param SCRIPT_NAME "/code"; scgi_pass localhost:9000; } The `scgi_params` file comes with nginx, and it simply translates nginx internal variables to `scgi_param` directives to create SCGI environment variables for the proxied program; in this case, Fossil. Our explicit `scgi_param` call to define `SCRIPT_NAME` adds one more variable to this set, which is necessary for this configuration to work properly, because our repo isn’t at the root of the URL hierarchy. Without it, when Fossil generates absolute URLs, they’ll be missing the `/code` part at the start, which will typically cause [404 errors][404]. The final directive simply tells nginx to proxy all calls to URLs under `/code` down to an SCGI program on TCP port 9000. We can temporarily set Fossil up as a server on that port like so: $ fossil server /path/to/repo.fossil --scgi --localhost --port 9000 & The `--scgi` option switches Fossil into SCGI mode from its default, which is [stand-alone HTTP server mode](./none.md). All of the other options discussed in that linked document — such as the ability to serve a directory full of Fossil repositories rather than just a single repository — work the same way in SCGI mode. The `--localhost` option is simply good security: we’re using nginx to expose Fossil service to the outside world, so there is no good reason to allow outsiders to contact this Fossil SCGI server directly. Giving an explicit non-default TCP port number via `--port` is a good idea to avoid conflicts with use of Fossil’s default TCP service port, 8080, which may conflict with local uses of `fossil ui` and such. We characterized the SCGI service start command above as “temporary” because running Fossil in the background like that means it won’t start back up on a reboot of the server. A simple solution to that is to add that command to `/etc/rc.local` on systems that have it. However, you might want to consider setting Fossil up as an OS service instead, so that you get the benefits of the platform’s service management framework: * [Linux (systemd)](../debian/service.md) * [Windows service](../windows/service.md) * [macOS (launchd)](../macos/service.md) * [xinetd](../any/xinetd.md) * [inetd](../any/inetd.md) We go into more detail on nginx service setup with Fossil in our [Debian/Ubuntu specific guide](../debian/nginx.md). Then in [a later article](../../tls-nginx.md) that builds upon that, we show how to add TLS encryption to this basic SCGI + nginx setup on Debian type OSes. *[Return to the top-level Fossil server article.](../)* [404]: https://en.wikipedia.org/wiki/HTTP_404 |
Added www/server/any/stunnel.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via stunnel [`stunnel`](https://www.stunnel.org/) is a TLS/SSL proxy for programs that themselves serve only via HTTP, such as Fossil. (Fossil *can* speak HTTPS, but only as a client.) `stunnel` decodes the HTTPS data from the outside world as HTTP before passing it to Fossil, and it encodes the HTTP replies from Fossil as HTTPS before sending them to the remote host that made the request. You can run `stunnel` in one of two modes: socket listener — much like in our [`inetd` doc](./inetd.md) — and as an HTTP reverse proxy. We’ll cover both cases here, separately. ## S<a name="sa"></a>ocket Activation The following `stunnel.conf` configuration configures it to run Fossil in socket listener mode, launching Fossil only when an HTTPS hit comes in, then shutting it back down as soon as the transaction is complete: ```dosini [fossil] accept = 443 TIMEOUTclose = 0 exec = /usr/bin/fossil execargs = /usr/bin/fossil http /home/fossil/ubercool.fossil --https cert = /etc/letsencrypt/live/ubercool-project.org/fullchain.pem key = /etc/letsencrypt/live/ubercool-project.org/privkey.pem ciphers = ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES128-SHA:DES-CBC3-SHA options = CIPHER_SERVER_PREFERENCE ``` This configuration shows the TLS certificate generated by the [Let’s Encrypt](https://letsencrypt.org) [Certbot](https://certbot.eff.org) in [certonly mode](https://certbot.eff.org/lets-encrypt/debianbuster-other). There are other ways to get TLS certificates, but this is a popular and free option. You will need to adjust the site names and paths in this example. Where this file goes varies by OS type, so check the man pages on your system to find out where it should be locally. See the `stunnel` documentation for further details about this configuration file. It is important that the [`fossil http`](/help/http) command in that configuration include the `--https` option to let Fossil know to use “`https://`” instead of “`http://`” in generated hyperlinks. ## <a name="proxy"></a>Reverse Proxy You can instead have Fossil running in the background in [standalone HTTP server mode](./none.md), bound to a high random TCP port number on localhost via the `--localhost` and `--port` flags, then configure `stunnel` to reverse proxy public HTTPS connections down to it via HTTP. The configuration is the same as the above except that you drop the `exec` and `execargs` directives and add this instead: ```dosini connect = 9000 ``` That tells `stunnel` to connect to an already-running process listening on the given TCP port number. There are a few advantages to this mode: 1. At the cost of some server memory and a tiny bit of idle CPU time, Fossil remains running so that hits can be served a smidge faster than in socket listener mode, where the Fossil binary has to be loaded and re-initialized on each HTTPS hit. 2. The socket listener mode doesn’t work on all platforms that `stunnel` runs on, particularly [on Windows](../windows/stunnel.md). *[Return to the top-level Fossil server article.](../)* |
Added www/server/any/xinetd.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via xinetd Some operating systems have replaced the old Unix `inetd` daemon with `xinetd`, which has a similar mission but with a very different configuration file format. The typical configuration file is either `/etc/xinetd.conf` or a subfile in the `/etc/xinetd.d` directory. You need a configuration something like this for Fossil: service http { port = 80 socket_type = stream wait = no user = root server = /usr/bin/fossil server_args = http /home/fossil/repos/ } This example configures Fossil to serve multiple repositories under the `/home/fossil/repos/` directory. Beyond this, see the general commentary in our article on [the `inetd` method](./inetd.md) as they also apply to service via `xinetd`. *[Return to the top-level Fossil server article.](../)* |
Added www/server/debian/nginx.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via nginx on Debian and Ubuntu This document is an extension of [the platform-independent SCGI instructions][scgii], which may suffice for your purposes if your needs are simple. Here, we add more detailed information on nginx itself, plus details about running it on Debian type OSes. We focus on Debian 10 (Buster) and Ubuntu 18.04 here, which are common Tier 1 OS offerings for [virtual private servers][vps]. This material may not work for older OSes. It is known in particular to not work as given for Debian 9 and older! If you want to add TLS to this configuration, that is covered [in a separate document][tls] which was written with the assumption that you’ve read this first. [scgii]: ../any/scgi.md [tls]: ../../tls-nginx.md [vps]: https://en.wikipedia.org/wiki/Virtual_private_server ## <a name="benefits"></a>Benefits This scheme is considerably more complicated than the [standalone HTTP server](../any/none.md) and [CGI options](../any/cgi.md). Even with the benefit of this guide and pre-built binary packages, it requires quite a bit of work to set it up. Why should you put up with this complexity? Because it gives many benefits that are difficult or impossible to get with the less complicated options: * **Power** — nginx is one of the most powerful web servers in the world. The chance that you will run into a web serving wall that you can’t scale with nginx is very low. To give you some idea of the sort of thing you can readily accomplish with nginx, your author runs a single public web server that provides transparent name-based virtual hosting for four separate domains: * One is entirely static, not involving any dynamic content or Fossil integration at all. * Another is served almost entirely by Fossil, with a few select static content exceptions punched past Fossil, which are handled entirely via nginx. * The other two domains are aliases for one another — e.g. `example.com` and `example.net` — with most of the content being static. This pair of domains has three different Fossil repo proxies attached to various sections of the URI hierarchy. By using nginx, I was able to do all of the above with minimal repetition between the site configurations. * **Integration** — Because nginx is so popular, it integrates with many different technologies, and many other systems integrate with it in turn. This makes it great middleware, sitting between the outer web world and interior site services like Fossil. It allows Fossil to participate seamlessly as part of a larger web stack. * **Availability** — nginx is already in most operating system binary package repositories, so you don’t need to go out of your way to get it. ## <a name="modes"></a>Fossil Service Modes Fossil provides four major ways to access a repository it’s serving remotely, three of which are straightforward to use with nginx: * **HTTP** — Fossil has a built-in HTTP server: [`fossil server`](../any/none.md). While this method is efficient and it’s possible to use nginx to proxy access to another HTTP server, we don’t see any particularly good reason to make nginx reinterpret Fossil’s own implementation of HTTP when we have a better option. (But see [below](#http).) * **CGI** — This method is simple but inefficient, because it launches a separate Fossil instance on every HTTP hit. Since Fossil is a relatively small self-contained program, and it’s designed to start up quickly, this method can work well in a surprisingly large number of cases. Nevertheless, we will avoid this option in this document because we’re already buying into a certain amount of complexity here in order to gain power. There’s no sense in throwing away any of that hard-won performance on CGI overhead. * **SCGI** — The [SCGI protocol][scgip] provides the simplicity of CGI without its performance problems. * **SSH** — This method exists primarily to avoid the need for HTTPS, but we *want* HTTPS. (We’ll get to that in [another document][tls].) There is probably a way to get nginx to proxy Fossil to HTTPS via SSH, but it would be pointlessly complicated. SCGI it is, then. [scgip]: https://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface ## <a name="deps"></a>Installing the Dependencies The first step is to install some non-default packages we’ll need. SSH into your server, then say: $ sudo apt install fossil nginx ## <a name="scgi"></a>Running Fossil in SCGI Mode For the following nginx configuration to work, it needs to contact a Fossil instance speaking the SCGI protocol. There are [many ways](../) to set that up. For Debian type systems, we primarily recommend following [our systemd user service guide](service.md). Another option would be to customize [the `fslsrv` shell script](/file/tools/fslsrv) that ships with Fossil as an example of launching multiple Fossil instances in the background to serve multiple URLs. However you do it, you need to match up the TCP port numbers between it and those in the nginx configuration below. ## <a name="config"></a>Configuration On Debian and Ubuntu systems the primary user-level configuration file for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this file contain only a list of include statements, one for each site that server hosts: include local/example.com include local/foo.net Those files then each define one domain’s configuration. Here, `/etc/nginx/local/example.com` contains the configuration for `*.example.com` and its alias `*.example.net`; and `local/foo.net` contains the configuration for `*.foo.net`. The configuration for our `example.com` web site, stored in `/etc/nginx/sites-enabled/local/example.com` is: server { server_name .example.com .example.net ""; include local/generic; access_log /var/log/nginx/example.com-https-access.log; error_log /var/log/nginx/example.com-https-error.log; # Bypass Fossil for the static documentation generated from # our source code by Doxygen, so it merges into the embedded # doc URL hierarchy at Fossil’s $ROOT/doc without requiring that # these generated files actually be stored in the repo. This # also lets us set aggressive caching on these docs, since # they rarely change. location /code/doc/html { root /var/www/example.com/code/doc/html; location ~* \.(html|ico|css|js|gif|jpg|png)$ { expires 7d; add_header Vary Accept-Encoding; access_log off; } } # Redirect everything else to the Fossil instance location /code { include scgi_params; scgi_param SCRIPT_NAME "/code"; scgi_pass 127.0.0.1:12345; } } As you can see, this is a pure extension of [the basic nginx service configuration for SCGI][scgii], showing off a few ideas you might want to try on your own site, such as static asset proxying. The `local/generic` file referenced above helps us reduce unnecessary repetition among the multiple sites this configuration hosts: root /var/www/$host; listen 80; listen [::]:80; charset utf-8; There are some configuration directives that nginx refuses to substitute variables into, citing performance considerations, so there is a limit to how much repetition you can squeeze out this way. One such example is the `access_log` and `error_log` directives, which follow an obvious pattern from one host to the next. Sadly, you must tolerate some repetition across `server { }` blocks when setting up multiple domains on a single server. The configuration for `foo.net` is similar. See [the nginx docs](http://nginx.org/en/docs/) for more ideas. ## <a name="http"></a>Proxying HTTP Anyway [Above](#modes), we argued that proxying SCGI is a better option than making nginx reinterpret Fossil’s own implementation of HTTP. If you want Fossil to speak HTTP, just [set Fossil up as a standalone server](../any/none.md). And if you want nginx to [provide TLS encryption for Fossil][tls], proxying HTTP instead of SCGI provides no benefit. However, it is still worth showing the proper method of proxying Fossil’s HTTP server through nginx if only to make reading nginx documentation on other sites easier: location /code { rewrite ^/code(/.*) $1 break; proxy_pass http://127.0.0.1:12345; } The most common thing people get wrong when hand-rolling a configuration like this is to get the slashes wrong. Fossil is senstitive to this. For instance, Fossil will not collapse double slashes down to a single slash, as some other HTTP servers will. *[Return to the top-level Fossil server article.](../)* |
Added www/server/debian/service.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via systemd on Debian and Ubuntu [`systemd`][sdhome] is the default service management framework on Debian [since version 8][wpa] and Ubuntu since version 15.04, both released in April 2015. There are multiple ways to get a service to launch under `systemd`. We’re going to show two methods which correspond approximately to two of our generic Fossil server setup methods, the [`inetd`](../any/inetd.md) and [standalone HTTP server](../any/none.md) methods. [sdhome]: https://www.freedesktop.org/wiki/Software/systemd/ [wpa]: https://en.wikipedia.org/wiki/Systemd#Adoption ## User Service A fun thing you can easily do with `systemd` that you can’t directly do with older technologies like `inetd` and `xinetd` is to set a server up as a “user” service. You can’t listen on TCP port 80 with this method due to security restrictions on TCP ports in every OS where `systemd` runs, but you can create a listener socket on a high-numbered (≥ 1024) TCP port, suitable for sharing a Fossil repo to a workgroup on a private LAN. To do this, write the following in `~/.local/share/systemd/user/fossil.service`: ```dosini [Unit] Description=Fossil user server After=network.target [Service] WorkingDirectory=/home/fossil/museum ExecStart=/home/fossil/bin/fossil server --port 9000 repo.fossil Restart=always RestartSec=3 [Install] WantedBy=sockets.target WantedBy=multi-user.target ``` Unlike with `inetd` and `xinetd`, we don’t need to tell `systemd` which user and group to run this service as, because we’ve installed it as a user service under the account we’re logged into. We’ve told `systemd` that we want automatic service restarts with back-off logic, making this much more robust than the by-hand launches of `fossil` in the platform-independent Fossil server instructions. The service will stay up until we explicitly tell it to shut down. Because we’ve set this up as a user service, the commands you give to manipulate the service vary somewhat from the sort you’re more likely to find online: $ systemctl --user daemon-reload $ systemctl --user enable fossil $ systemctl --user start fossil $ systemctl --user status -l fossil $ systemctl --user stop fossil That is, we don’t need to talk to `systemd` with `sudo` privileges, but we do need to tell it to look at the user configuration rather than the system-level configuration. This scheme isolates the permissions needed by the Fossil server, which reduces the amount of damage it can do if there is ever a remotely-triggerable security flaw found in Fossil. A simple and useful modification to the above scheme is to add the `--scgi` and `--localhost` flags to the `ExecStart` line to replace the use of `fslsrv` in [the generic SCGI instructions](../any/scgi.md), giving a much more robust configuration. ## Socket Activation Another useful method to serve a Fossil repo via `systemd` is via a socket listener, which `systemd` calls “[socket activation][sa].” It’s more complicated, but it has some nice properties. It is the feature that allows `systemd` to replace `inetd`, `xinetd`, Upstart, and several other competing technologies. We first need to define the privileged socket listener by writing `/etc/systemd/system/fossil.socket`: ```dosini [Unit] Description=Fossil socket [Socket] Accept=yes ListenStream=80 NoDelay=true [Install] WantedBy=sockets.target ``` Note the change of configuration directory from the `~/.local` directory to the system level. We need to start this socket listener at the root level because of the low-numbered TCP port restriction we brought up above. This configuration says more or less the same thing as the socket part of an `inted` entry [exemplified elsewhere in this documentation](../any/inetd.md). Next, create the service definition file in that same directory as `fossil@.service`: ```dosini [Unit] Description=Fossil socket server After=network.target [Service] WorkingDirectory=/home/fossil/museum ExecStart=/home/fossil/bin/fossil http repo.fossil StandardInput=socket [Install] WantedBy=sockets.target WantedBy=multi-user.target ``` We’ll explain the “`@`” in the file name below. Notice that we haven’t told `systemd` which user and group to run Fossil under. Since this is a system-level service definition, that means it will run as root, which then causes Fossil to [automatically drop into a `chroot(2)` jail](../../chroot.md) rooted at the `WorkingDirectory` we’ve configured above, shortly each `fossil http` call starts. The `Restart*` directives we had in the user service configuration above are unnecessary for this method, since Fossil isn’t supposed to remain running under it. Each HTTP hit starts one Fossil instance, which handles that single client’s request and then immediately shuts down. Next, you need to tell `systemd` to reload its system-level configuration files and enable the listening socket: $ sudo systemctl daemon-reload $ sudo systemctl enable fossil.socket And now you can manipulate the socket listener: $ sudo systemctl start fossil.socket $ sudo systemctl status -l fossil.socket $ sudo systemctl stop fossil.socket Notice that we’re working with the *socket*, not the *service*. The fact that we’ve given them the same base name and marked the service as an instantiated service with the “`@`” notation allows `systemd` to automatically start an instance of the service each time a hit comes in on the socket that `systemd` is monitoring on Fossil’s behalf. To see this service instantiation at work, visit a long-running Fossil page (e.g. `/tarball`) and then give a command like this: $ sudo systemctl --full | grep fossil This will show information about the `fossil` socket and service instances, which should show your `/tarball` hit handler, if it’s still running: fossil@20-127.0.0.1:80-127.0.0.1:38304.service You can feed that service instance description to a `systemctl kill` command to stop that single instance without restarting the whole `fossil` service, for example. In all of this, realize that we’re able to manipulate a single socket listener or single service instance at a time, rather than reload the whole externally-facing network configuration as with the far more primitive `inetd` service. [sa]: http://0pointer.de/blog/projects/socket-activation.html *[Return to the top-level Fossil server article.](../)* |
Name change from www/server.wiki to www/server/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 | <div class='fossil-doc' data-title="How To Configure A Fossil Server"> <style type="text/css"> p { margin-left: 4em; margin-right: 3em; } li p { margin-left: 0; } h2 { margin-left: 1em; } h3 { margin-left: 3em; } ol, ul { margin-left: 3em; } a#all { font-size: 90%; margin-left: 1em; } div#tutpick.show { max-height: 99em; transition: max-height 1000ms ease-in; } div#tutpick { max-height: 0; overflow: hidden; } th.fep { background-color: #e8e8e8; min-width: 3em; padding: 0.4em; white-space: nowrap; } th.host { background-color: #e8e8e8; padding: 0.4em; text-align: right; } td.doc { text-align: center; } </style> <h2>No Server Required</h2> <p>Fossil does not require a central server, but <a href="whyuseaserver.wiki">a server can be useful</a>.</p> <p>A Fossil server does not require much memory, CPU, or disk space and can run comfortably on a generic $5/month virtual host or on a small device like a Raspberry Pi, or it can co-exist on a host running other services without getting in the way. <p>This article is a quick-reference guide for setting up your own Fossil server, with links to more detailed instructions specific to particular systems, should you want extra help.</p> <h2 id="prep">Repository Prep</h2> <p>Prior to serving a Fossil repository to others, consider running <a href="$ROOT/help?cmd=ui"><tt>fossil ui</tt></a> locally and taking these minimum recommended preparation steps:</p> <ol> <li><p>Fossil creates only one user in a <a href="$ROOT/help?cmd=new">new repository</a> and gives it the <a href="../caps/admin-v-setup.md#apsu">all-powerful Setup capability</a>. The 10-digit random password generated for that user is fairly strong against remote attack, even without explicit password guess rate limiting, but because that user has so much power, you may want to give it a much stronger password under Admin → Users.</a></li> <li><p>Run the Admin → Security-Audit tool to verify that other security-related permissions and settings are as you want them. Consider clicking the “Take it private” link on that page to lock down the security on that site to a level appropriate to a private repository, even if you will eventually want some public service. It's better to start from a secure position and open up service feature-by-feature as necessary than it is to start from a fully open position and lock down features one by one to achieve a secure stance.</p></li> </ol> <p>With the repository secured, it is safe to upload a copy of the repository file to your server and proceed with server setup, below. Further configuration steps can wait until <a href="#postsetup">after the server is running</a>.</p> <h2 id="methods">Activation Methods</h2> <p>There are basically four ways to run a Fossil server:</p> <ol> <li><a id="cgi" href="any/cgi.md">CGI</a> <li>Socket listener <li><a id="standalone" href="any/none.md">Stand-alone HTTP server</a> <li><a id="scgi" href="any/scgi.md">SCGI</a> </ol> <p>All of these methods can serve either a single repository or a directory hierarchy containing mulitiple repositories.</p> <p>You are not restricted to a single server setup. The same Fossil repository can be served using two or more of the above techniques at the same time. These methods use clean, well-defined, standard interfaces (CGI, SCGI, and HTTP) which allow you to easily migrate from one method to another in response to changes in hosting providers or administrator preferences.</p> <h3>CGI</h3> <p>Most ordinary web servers can <a href="any/cgi.md">run Fossil as a CGI script</a>. This method is known to work with Apache, <tt>lighttpd</tt>, and <a href="any/althttpd.md"><tt>althttpd</tt></a>. The Fossil server administrator places a <a href="$ROOT/help?cmd=cgi">short CGI script</a> in the web server's document hierarchy and when a client requests the URL that corresponds to that script, Fossil runs and generates the response.</p> <p>CGI is a good choice for merging Fossil into an existing web site, particularly on hosts that have CGI set up and working. The Fossil <a href="../selfhost.wiki">self-hosting repositories</a> are implemented with CGI underneath <tt>althttpd</tt>.</p> <h3>Socket Listener</h3> <p>Socket listener daemons such as <a id="inetd" href="any/inetd.md"><tt>inetd</tt></a>, <a id="xinetd" href="any/xinetd.md"><tt>xinetd</tt></a>, <a id="stunnel" href="any/stunnel.md"><tt>stunnel</tt></a>, <a href="macos/service.md"><tt>launchd</tt></a>, and <a href="debian/service.md"><tt>systemd</tt></a> can be configured to invoke the the <a href="$ROOT/help?cmd=http"><tt>fossil http</tt></a> command to handle each incoming HTTP request. The "<tt>fossil http</tt>" command reads the HTTP request off of standard input, computes an appropriate reply, and writes the reply on standard output. There is a separate invocation of the "<tt>fossil http</tt>" command for each HTTP request. The socket listener daemon takes care of relaying content to and from the client, and (in the case of <a href="any/stunnel.md">stunnel</a>) handling TLS decryption and encryption. <h3>Stand-alone HTTP Server</h3> <p>This is the <a href="any/none.md">easiest method</a>. A stand-alone server uses the <a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command to run a process that listens for incoming HTTP requests on a socket and then dispatches a copy of itself to deal with each incoming request. You can expose Fossil directly to the clients in this way or you can interpose a <a href="https://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a> layer between the clients and Fossil.</p> <h3>SCGI</h3> <p>The Fossil standalone server can also handle <a href="any/scgi.md">SCGI</a>. When the <a href="$ROOT/help?cmd=server"><tt>fossil server</tt></a> command is run with the extra <tt>--scgi</tt> option, it listens for incoming SCGI requests rather than HTTP requests. This allows Fossil to respond to requests from web servers <a href="debian/nginx.md">such as nginx</a> that don't support CGI. SCGI is a simpler protocol to proxy than HTTP, since the HTTP doesn't have to be re-interpreted in terms of the proxy's existing HTTP implementation, but it's more complex to set up because you also have to set up an SCGI-to-HTTP proxy for it. It is worth taking on this difficulty only when you need to integrate Fossil into an existing web site already being served by an SCGI-capable web server.</p> <h2 id="matrix">Activation Tutorials</h2> <p>We've broken the configuration for each method out into a series of sub-articles. Some of these are generic, while others depend on particular operating systems or front-end software:</p> <div id="tutpick" class="show"></div> <table style="margin-left: 6em;"> <tr> <th class="host">⇩ OS / Method ⇨</th> <th class="fep">direct</th> <th class="fep">inetd</th> <th class="fep">stunnel</th> <th class="fep">CGI</th> <th class="fep">SCGI</th> <th class="fep">althttpd</th> <th class="fep">proxy</th> <th class="fep">service</th> </tr> <tr> <th class="host">Any</th> <td class="doc"><a href="any/none.md">✅</a></td> <td class="doc"><a href="any/inetd.md">✅</a></td> <td class="doc"><a href="any/stunnel.md">✅</a></td> <td class="doc"><a href="any/cgi.md">✅</a></td> <td class="doc"><a href="any/scgi.md">✅</a></td> <td class="doc"><a href="any/althttpd.md">✅</a></td> <td class="doc">❌</td> <td class="doc">❌</td> </tr> <tr> <th class="host">Debian/Ubuntu</th> <td class="doc"><a href="any/none.md">✅</a></td> <td class="doc"><a href="any/inetd.md">✅</a></td> <td class="doc"><a href="any/stunnel.md">✅</a></td> <td class="doc"><a href="any/cgi.md">✅</a></td> <td class="doc"><a href="any/scgi.md">✅</a></td> <td class="doc"><a href="any/althttpd.md">✅</a></td> <td class="doc"><a href="debian/nginx.md">✅</a></td> <td class="doc"><a href="debian/service.md">✅</a></td> </tr> <tr> <th class="host">macOS</th> <td class="doc"><a href="any/none.md">✅</a></td> <td class="doc">❌</td> <td class="doc"><a href="any/stunnel.md">✅</a></td> <td class="doc"><a href="any/cgi.md">✅</a></td> <td class="doc"><a href="any/scgi.md">✅</a></td> <td class="doc"><a href="any/althttpd.md">✅</a></td> <td class="doc">❌</td> <td class="doc"><a href="macos/service.md">✅</a></td> </tr> <tr> <th class="host">Windows</th> <td class="doc"><a href="windows/none.md">✅</a></td> <td class="doc">❌</td> <td class="doc"><a href="windows/stunnel.md">✅</a></td> <td class="doc"><a href="windows/cgi.md">✅</a></td> <td class="doc">❌</td> <td class="doc">❌</td> <td class="doc"><a href="windows/iis.md">✅</a></td> <td class="doc"><a href="windows/service.md">✅</a></td> </tr> </table> <p>Where there is a check mark in the "<b>Any</b>" row, the method for that is generic enough that it works across OSes that Fossil is known to work on. The check marks below that usually just link to this generic documentation.</p> <p>The method in the "<b>proxy</b>" column is for the platform's default web server configured as a <a href="https://en.wikipedia.org/wiki/Reverse_proxy">reverse proxy</a> for Fossil's built-in HTTP server: <a href="debian/nginx.md">nginx</a>, <a href="windows/iis.md">IIS</a>, Apache, etc.</p> <p>We welcome <a href="../contribute.wiki">contributions</a> to fill gaps (<font size="-2">❌</font>) in the table above.</p> </noscript> <h2 id="postsetup">Post-Activation Configuration</h2> <p>After the server is up and running, log into it as the Setup user and visit the Admin menu to finish configuring that repository for service:</p> <ol> <li><p>Add user accounts for your other team members. Use <a href="../caps/index.md#ucat">categories</a> to define access policies rather than redundantly give each new user the same <a href="../caps/index.md#ucap">individual capabilities</a>.</p></li> <li><p>Test access to the repository from each category of non-Setup user that you created. You may have to give your user categories some overlooked capabilities, particularly if you followed <a href="#prep">our earlier advice</a> to take the repository private prior to setting up the server.</p></li> <li><p>Modify the repository's look and feel by <a href="../customskin.md">customizing the skin</a>.</p></li> <li><p>If the repository includes <a href="../embeddeddoc.wiki">embedded documentation</a>, consider activating the search feature (Admin → Search) so that visitors can do full-text search on your documentation.</p></li> <li><p>Now that others can be making changes to the repository, consider monitoring them via <a href="../alerts.md">email alerts</a> or the <a href="$ROOT/help?cmd=/timeline.rss">timeline RSS feed</a>.</p></li> <li><p>Turn on the various logging features.</p></li> </ol> <p>Reload the Admin → Security-Audit page occasionally during this process to double check that you have not mistakenly configured the server in a way that might expose information that you want to keep private.</p> <h2 id="more">Further Details</h2> <ul> <li><a id="chroot" href="../chroot.md" >The Server Chroot Jail</a> <li><a id="loadmgmt" href="../loadmgmt.md" >Managing Server Load</a> <li><a id="bkofc" href="../backoffice.md" >The Backoffice</a> <li><a id="tls" href="../ssl.wiki" >Securing a Repository with TLS</a> <li><a id="ext" href="../serverext.wiki">CGI Server Extensions</a> <li><a id="about" href="../aboutcgi.wiki" >How CGI Works In Fossil</a> <li><a id="sync" href="../sync.wiki" >The Fossil Sync Protocol</a> </ul> </div> |
Added www/server/macos/service.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via launchd on macOS [`launchd`][ldhome] is the default service management framework on macOS [since the release of Tiger in 2005][wpa]. If you want a Fossil server to launch in the background on a Mac, it’s the way Apple wants you to do it. `launchd` is to macOS as `systemd` is to most modern Linux desktop systems. (Indeed, `systemd` arguably reinvented the perfectly good, pre-existing `launchd` wheel.) Unlike in [our `systemd` article](../debian/service.md), we’re not going to show the per-user method here, because those so-called [LaunchAgents][la] only start when a user is logged into the GUI, and they stop when that user logs out. This does not strike us as proper “server” behavior, so we’ll stick to system-level LaunchDaemons instead. However, we will still give two different configurations, just as in the `systemd` article: one for a standalone HTTP server, and one using socket activation. For more information on `launchd`, the single best resource we’ve found is [](launchd.info). The next best is: $ man launchd.plist [la]: http://www.grivet-tools.com/blog/2014/launchdaemons-vs-launchagents/ [ldhome]: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html [wpa]: https://en.wikipedia.org/wiki/Launchd ## Standalone HTTP Server To configure `launchd` to start Fossil as a standalone HTTP server, write the following as `com.example.dev.FossilHTTP.plist`: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.example.dev.FossilHTTP</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/fossil</string> <string>server</string> <string>--port</string> <string>9000</string> <string>repo.fossil</string> </array> <key>WorkingDirectory</key> <string>/Users/you/museum</string> <key>KeepAlive</key> <true/> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>/tmp/fossil-error.log</string> <key>StandardOutPath</key> <string>/tmp/fossil-info.log</string> <key>UserName</key> <string>you</string> <key>GroupName</key> <string>staff</string> <key>InitGroups</key> <true/> </dict> </plist> ``` In this example, we’re assuming your development organization uses the domain name “`dev.example.org`”, that your short macOS login name is “`you`”, and that you store your Fossils in “`~/museum`”. Adjust these elements of the plist file to suit your local situation. You might be wondering about the use of `UserName`: isn’t Fossil supposed to drop privileges and enter [a `chroot(2)` jail](../../chroot.md) when it’s started as root like this? Why do we need to give it a user name? Won’t Fossil use the owner of the repository file to set that? All I can tell you is that in testing here, if you leave the user and group configuration at the tail end of that plist file out, Fossil will remain running as root! Install that file and set it to start with: $ sudo install -o root -g wheel -m 644 com.example.dev.FossilHTTP.plist \ /Library/LaunchDaemons/ $ sudo launchctl load -w /Library/LaunchDaemons/com.example.dev.FossilHTTP.plist Because we set the `RunAtLoad` key, this will also launch the daemon. Stop the daemon with: $ sudo launchctl unload -w /Library/LaunchDaemons/com.example.dev.FossilHTTP.plist ## Socket Listener Another useful method to serve a Fossil repo via `launchd` is by setting up a socket listener: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.example.dev.FossilSocket</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/fossil</string> <string>http</string> <string>repo.fossil</string> </array> <key>Sockets</key> <dict> <key>Listeners</key> <dict> <key>SockServiceName</key> <string>9001</string> <key>SockType</key> <string>stream</string> <key>SockProtocol</key> <string>TCP</string> <key>SockFamily</key> <string>IPv4</string> </dict> </dict> <key>inetdCompatibility</key> <dict> <key>Wait</key> <false/> </dict> <key>WorkingDirectory</key> <string>/Users/you/museum</string> <key>UserName</key> <string>you</string> <key>GroupName</key> <string>staff</string> <key>InitGroups</key> <true/> </dict> </plist> ``` Save it as “`com.example.dev.FossilSocket.plist`” and install and load it into `launchd` as above. This version differs in several key ways: 1. We’re calling Fossil as `fossil http` rather than `fossil server` to make it serve a single request and then shut down immediately. 2. We’ve told `launchd` to listen on our TCP port number instead of passing it to `fossil`. 3. We’re running the daemon in `inetd` compatibility mode of `launchd` with “wait” mode off, which tells it to attach the connected socket to the `fossil` process’s stdio handles. 4. We’ve removed the `Standard*Path` keys because they interfere with our use of stdio handles for HTTP I/O. You might therefore want to start with the first method and then switch over to this one only once you’ve got the daemon launching debugged, since once you tie up stdio this way, you won’t be able to get logging information from Fossil via that path. (Fossil does have some internal logging mechanisms, but you can’t get at them until Fossil is launching!) 5. We’ve removed the `KeepAlive` and `RunAtLoad` keys because those options aren’t appropriate to this type of service. 6. Because we’re running it via a socket listener instead of as a standalone HTTP server, the Fossil service only takes system resources when it’s actually handling an HTTP hit. If your Fossil server is mostly idle, this method will be a bit more efficient than the first option. *[Return to the top-level Fossil server article.](../)* |
Added www/server/whyuseaserver.wiki.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <title>Benefits Of A Fossil Server</title> <h2>No Server Required</h2> Fossil does not require a central server. Data sharing and synchronization can be entirely peer-to-peer. Fossil uses [https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type|conflict-free replicated data types] to ensure that (in the limit) all participating peers see the same content. <h2>But, A Server Can Be Useful</h2> Fossil does not require a server, but a server can be very useful. Here are a few reasons to set up a Fossil server for your project: 1. <b>A server works as a complete project website.</b><p> Fossil does more than just version control. It also supports [../tickets.wiki|trouble-tickets], [../wikitheory.wiki|wiki], and a [../forum.wiki|forum]. The [../embeddeddoc.wiki|embedded documentation] feature provides a great mechanism for providing project documentation. The [../unvers.wiki|unversioned files] feature is a convenient way to host builds and downloads on the project website. 2. <b>A server gives developers a common point of rendezvous for syncing their work.</b><p> It is possible for developers to synchronize peer-to-peer but that requires the developers coordinate the sync, which in turn requires that the developers both want to sync at the same moment. A server aleviates this time dependency by allowing each developer to sync whenever it is convenient (for example, automatically syncing after each commit and before each update). Developers all stay in sync with each other, without having to interrupt each other constantly to set up a peer-to-peer sync. 3. <b>A server provides project leaders with up-to-date status.</b><p> Project coordinators and BDFLs can click on a link or two at the central Fossil server for a project, and quickly tell what is going on. They can do this from anywhere, even from their phones, without needing to actually sync to the device they are using. 4. <b>A server provides automatic off-site backups.</b><p> A Fossil server is an automatic remote backup for all the work going into a project. You can even set up multiple servers, at multiple sites, with automatic synchronization between them, for added redundancy. Such a set up means that no work is lost due to a single machine failur |
Added www/server/windows/cgi-bin-perm.png.
cannot compute difference between binary files
Added www/server/windows/cgi-exec-perm.png.
cannot compute difference between binary files
Added www/server/windows/cgi-install-iis.png.
cannot compute difference between binary files
Added www/server/windows/cgi-script-map.png.
cannot compute difference between binary files
Added www/server/windows/cgi.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via IIS + CGI ## This Is Not the Method You Are Looking For Setting up CGI service under IIS is surprisingly complicated compared to running Fossil as a CGI under most other operating systems. We recommend that you use the simpler [reverse proxying method](./iis.md) instead unless there is some compelling reason why that method cannot work for you, such as its dependence on non-stock IIS extensions. (Keep in mind that both extensions it requires are by Microsoft, not third parties!) Once you’ve got this scheme working, it gives the same benefits as those listed at the top of the linked-to document. There is a small benefit you get from using CGI over reverse proxying on other OSes, which is that the Fossil program only runs briefly in order to serve each HTTP hit. Once the request is done, that Fossil instance shuts back down, releasing all of its resources. You don’t need to keep a background Fossil HTTP server running full-time to provide CGI-based Fossil service. You lose a lot of that benefit on Windows: 1. It only matters to start with on servers that are highly RAM constrained. (Roughly ≤ 128 MiB.) Our configuration steps below assume you’re using the Windows and IIS GUIs, which have RAM requirements well in excess of this, making Fossil’s resource requirements a drop in the bucket next to them. On the [Azure B1s][b1s] virtual machine I used to prepare these instructions, the Windows Server Manager GUI kept filling the VM’s 1 GiB of RAM during feature installation and crashing. I had to upgrade the VM’s RAM to 2 GiB just to get useful work done! 2. Process creation on Windows is [much more expensive][cp] than on the other OSes Fossil runs on, so the benefits of firing up a Fossil executable to process each HTTP request are partially swamped by the overhead of doing so. Therefore, unless you’re willing to replace all of the GUI configuration steps below with command line equivalents, or shut the GUI down entirely after configuring IIS, CGI is a much less compelling option on Windows. **WARNING:** The following tutorial appears to fail with the current (2019-08-17) version of Fossil, [apparently][fbug] due to an inability of Fossil to detect that it’s being run in CGI mode. [b1s]: https://azure.microsoft.com/en-us/blog/introducing-b-series-our-new-burstable-vm-size/ [cp]: https://stackoverflow.com/a/48244/142454 [fbug]: https://fossil-scm.org/forum/forumpost/de18dc32c0 ## Install IIS with CGI Support The steps for this are identical to those for the [reverse proxying IIS setup](./iis.md#install) except that you need to enable CGI in the last step, since it isn’t installed by default. For Windows Server, the path is:  The path is similar on the consumer-focused versions of Windows, once you get to that last step. ## Setup 1. Install the Fossil executable to `c:\inetpub\wwwroot\bin` on the web server. We can’t use an executable you might already have because IIS runs under a separate user account, so we need to give that executable special permissions, and that’s easiest to do under the IIS tree:  2. In IIS Manager (a.k.a. `INETMGR`) drill down into the Sites folder in the left-side pane and right-click your web site’s configuration. (e.g. “Default Web Site”) 3. On that menu say “Add Virtual Directory.” Give it the alias “`cgi`” and point it at a suitable directory, such as “`c:\inetpub\wwwroot\cgi`”. 4. Double-click the “Handler Mappings” icon, then in the right-side pane, click “Add Script Map...” Apply the following settings:  The Executable path must point to the path we set up in step 1, not to some other `fossil.exe` you may have elsewhere on your system. You will need to change the default “`*.dll`” filter in the Open dialog to “`*.exe`” in order to see it when browsing via the “`...`” button. 5. Create a file called `repo.fslcgi` within the CGI directory you chose in step 3, with a single line like this: repository: c:\Users\SOMEONE\museum\repo.fossil Give the actual path to the repository, of course. 6. Up at the top level of IIS Manager, double-click the “ISAPI and CGI Restrictions” icon, then click “Add...” in the right-side pane. Give the script you just created permission to execute:  7. In the right-side pane, click “Restart” to apply this configuration, then test it by visiting the newly-available URL in a browser: http://localhost/cgi/repo.fslcgi For more complicated setups such as “directory” mode, see [the generic CGI instructions](../any/cgi.md). *[Return to the top-level Fossil server article.](../)* |
Added www/server/windows/iis.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving via IIS ## Why Bother? The first part of the scheme below sets Fossil up as an HTTP server, so you might be wondering why you wouldn’t just modify that to make it listen on all network interfaces on TCP port 80, so you can avoid the need for IIS entirely. For simple use cases, you can indeed do without IIS, but there are several use cases where adding it is helpful: 1. Proxying Fossil with IIS lets you [add TLS encryption][tls], which [Fossil does not currently speak](../../ssl.wiki) in its server role. 2. The URL rewriting we do below allows Fossil to be part of a larger site already being served with IIS. 3. You can have a mixed-mode site, with Fossil acting as a powerful dynamic content management service and IIS as a fast static content server. The pure-Fossil alternative requires that you check all of your static content into Fossil as versioned or unversioned artifacts. This article shows how you can get any combination of those benefits by using IIS as a reverse proxy for `fossil server`. There are other ways to use IIS to serve Fossil, such as [via CGI](./cgi.md). ## Background Fossil Service Setup You will need to have the Fossil HTTP server running in the background, serving some local repository, bound to localhost on a fixed high-numbered TCP port. For the purposes of testing, simply start it by hand in your command shell of choice: fossil serve --port 9000 --localhost repo.fossil That command assumes you’ve got `fossil.exe` in your `%PATH%` and you’re in a directory holding `repo.fossil`. See [the platform-independent instructions](../any/none.md) for further details. For a more robust setup, we recommend that you [install Fossil as a Windows service](./service.md), which will allow Fossil to start at system boot, before anyone has logged in interactively. ## <a name="install"></a>Install IIS IIS might not be installed in your system yet, so follow the path appropriate to your host OS. We’ve tested only the latest Microsoft OSes as of the time of this writing, but the basic process should be similar on older OSes. ### Windows Server 2019 1. Start “Server Manager” 2. Tell it you want to “Add roles and features” 3. Select “Role-based or feature-based installation” 4. Select your local server 5. In the Server Roles section, enable “Web Server (IIS)” ### Windows 1. Open Control Panel 2. Go to “Programs” 3. Select “Turn Windows features on or off” in the left-side pane 4. In the “Windows Features” dialog, enable “Internet Information Services” The default set of IIS features there will suffice for this tutorial, but you might want to enable additional features. ## Setting up the Proxy The stock IIS setup doesn’t have reverse proxying features, but they’re easily added through extensions. You will need to install the [Application Request Routing][arr] and [URL Rewrite][ure] extensions. In my testing here, URL Rewrite showed up immediately after installing it, but I had to reboot the server to get ARR to show up. (Yay Windows.) You can install these things through the direct links above, or you can do it via the Web Platform Installer feature of IIS Manager (a.k.a. `INETMGR`). Set these extensions up in IIS Manager like so: 1. Double-click the “Application Request Routing Cache” icon. 2. Right-click in the window that results, and select “Server Proxy Settings...” 3. Check the “Enable Proxy” box in the dialog. Click the “Apply” text in the right-side pane. 4. Return to the top server-level configuration area of IIS Manager and double-click the “URL Rewrite” icon. Alternately, you might find “URL Rewrite” in the right-side pane from within the ARR settings. 5. Right click in the window that results, and click “Add Rule(s)...” Tell it you want a “Blank rule” under “Inbound rules”. 6. In the dialog that results, create a new rule called “Fossil repo proxy.” Set the “Pattern” to “`^(.*)$`” and “Rewrite URL” set to “`http://localhost:9000/{R:1}`”. That tells it to take everything in the path part of the URL and send it down to localhost:9000, where `fossil server` is listening. 7. Click “Apply” in the right-side pane, then get back to the top level configuration for the server, and click “Restart” in that same pane. At this point, if you go to `http://localhost/` in your browser, you should see your Fossil repository’s web interface instead of the default IIS web site, as before you did all of the above. This is a very simple configuration. You can do more complicated and interesting things with this, such as redirecting only `/code` URLs to Fossil by setting the Pattern in step 6 to “`^/code(.*)$`”. (You would also need to pass `--baseurl http://example.com/code` in the `fossil server` command to make this work properly.) IIS would then directly serve all other URLs. You could also intermix ASP.NET applications in the URL scheme in this way. See the documentation on [URL Rewrite rules][urr] for more ideas. *[Return to the top-level Fossil server article.](../)* [arr]: https://www.iis.net/downloads/microsoft/application-request-routing [tls]: https://docs.microsoft.com/en-us/iis/manage/configuring-security/understanding-iis-url-authorization [ure]: https://www.iis.net/downloads/microsoft/url-rewrite [urr]: https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module |
Added www/server/windows/index.md.
> > > > > > > > | 1 2 3 4 5 6 7 8 | # Using Windows as a Fossil Server - [Fossil server command](./none.md) - [Fossil as CGI (IIS)](./iis.md) - [Fossil as a Service](./service.md) - [Using stunnel with Fossil on Windows](./stunnel.md) *[Return to the top-level Fossil server article.](../)* |
Added www/server/windows/none.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Serving as a Standalone Server on Windows On Windows, this method works more or less identically to how it’s documented in [the generic instructions](../any/none.md). ...but only while `fossil.exe` is actually running, which is the source of much trouble on Windows. This problem has two halves: ## No App Startup Without Desktop The easy methods for starting a program in Windows at system start all require an interactive desktop. There is no *easy* way to start an arbitrary program on Windows at boot before anyone has logged in. In Unix terms, Windows has no simple equivalent to [the `/etc/rc.local` file][rcl]. You can partially get around the first problem by setting your `fossil server` call up as one of the user’s interactive startup items. Windows 10 has its own [idiosyncratic way of doing this][si10], and in older systems you have [several alternatives to this][si7]. Regardless of the actual mechanism, these will cause the Fossil standalone HTTP server to start on an *interactive desktop login* only. While you’re sitting at the Windows login screen, the Fossil server is *down*. [rcl]: http://nixdoc.net/man-pages/FreeBSD/man8/rc.local.8.html [si10]: https://www.tenforums.com/tutorials/2944-add-delete-enable-disable-startup-items-windows-10-a.html [si7]: https://www.wikihow.com/Change-Startup-Programs-in-Windows-7 ## No Simple Background Mode Windows also lacks a direct equivalent of the Bourne shell’s “`&`” control operator to run a program in the background, which you can give in Unix’s `rc.local` file, which is just a normal Bourne shell script. By “background,” I mean “not attached to any interactive user’s login session.” When the `rc.local` script exits in Unix, any program it backgrounded *stays running*. There is no simple and direct equivalent to this mechanism in Windows. If you set `fossil server` to run on interactive login, as above, it will shut right back down again when that user logs back out. With Windows 10, it’s especially problematic because you can no longer make the OS put off updates arbitrarily: your Fossil server will go down every time Windows Update decides it needs to reboot your computer, and then Fossil service will *stay* down until someone logs back into that machine interactively. ## Better Solutions Because of these problems, we only recommend setting `fossil server` up on Windows this way when you’re a solo developer or you work in a small office where everyone arrives more or less at the same time each day, and everyone goes home about the same time each day, so that one user can keep the Fossil server up through the working day. If your needs go at all beyond this, you should expect proper “server” behavior, which you can get on Windows by [registering Fossil as a Windows service](./service.md), which solves the interactive startup and shutdown problems above, at a bit of complexity over the Startup Items method. You may also want to consider putting that service behind [an IIS front-end proxy](./iis.md) to add additional web serving features. *[Return to the top-level Fossil server article.](../)* |
Added www/server/windows/service.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Fossil as a Windows Service If you need Fossil to start automatically on Windows, it is suggested to install Fossil as a Windows Service. ## Assumptions 1. You have Administrative access to a Windows 2012r2 or above server. 2. You have PowerShell 5.1 or above installed. ## Place Fossil on Server However you obtained your copy of Fossil, it is recommended that you follow Windows conventions and place it within `\Program Files\FossilSCM`. Since Fossil 2.10 is a 64bit binary, this is the proper location for the executable. This way Fossil is at an expected location and you will have minimal issues with Windows interfering in your ability to run Fossil as a service. You will need Administrative rights to place fossil at the recommended location. If you will only be running Fossil as a service, you do not need to add this location to the path, though you may do so if you wish. ## Installing Fossil as a Service Luckily the hard work to use Fossil as a Windows Service has been done by the Fossil team. We simply have to install it with the proper command line options. Fossil on Windows has a command `fossil winsrv` to allow installing Fossil as a service on Windows. This command is only documented on the windows executable of Fossil. You must also run the command as administrator for it to be successful. ### Fossil winsrv Example The simplest form of the command is: ``` fossil winsrv create --repository D:/Path/to/Repo.fossil ``` This will create a windows service named 'Fossil-DSCM' running under the local system account and accessible on port 8080 by default. `fossil winsrv` can also start, stop, and delete the service. For all available options, please execute `fossil help winsrv` on a windows install of Fossil. If you wish to server a directory of repositories, the `fossil winsrv` command requires a slightly different set of options vs. `fossil server`: ``` fossil winsrv create --repository D:/Path/to/Repos --repolist ``` <a name='PowerShell'></a> ### Advanced service installation using PowerShell As great as `fossil winsrv` is, it does not have one to one reflection of all of the `fossil server` [options](/help?cmd=server). When you need to use some of the more advanced options, such as `--https`, `--skin`, or `--extroot`, you will need to use PowerShell to configure and install the Windows service. PowerShell provides the [New-Service](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-service?view=powershell-5.1) command, which we can use to install and configure Fossil as a service. The below should all be entered as a single line in an Administrative PowerShell console. ```PowerShell New-Service -Name fossil -DisplayName fossil -BinaryPathName '"C:\Program Files\FossilSCM\fossil.exe" server --port 8080 --repolist "D:/Path/to/Repos"' -StartupType Automatic ``` Please note the use of forward slashes in the repolist path passed to Fossil. Windows will accept either back slashes or forward slashes in path names, but Fossil has a preference for forward slashes. The use of `--repolist` will make this a multiple repository server. If you want to serve only a single repository, then leave off the `--repolist` parameter and provide the full path to the proper repository file. Other options are listed in the [fossil server](/help?cmd=server) documentation. The service will be installed by default to use the Local Service account. Since Fossil only needs access to local files, this is fine and causes no issues. The service will not be running once installed. You will need to start it to proceed (the `-StartupType Automatic` parameter to `New-Service` will result in the service auto-starting on boot). This can be done by entering ```PowerShell Start-Service -Name fossil ``` in the PowerShell console. Congratulations, you now have a base http accessible Fossil server running on Windows. *[Return to the top-level Fossil server article.](../)* |
Added www/server/windows/stunnel.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Using stunnel with Fossil on Windows While there are many ways to configure Fossil as a server using various web servers (Apache, IIS, nginx, etc.), this document will focus on setting up a minimal Fossil server using only Fossil's native [server capabilities](../any/none.md) and [stunnel](https://www.stunnel.org/) to provide a TLS proxy. It is recommended for public repositories to go to the extra step of configuring stunnel to provide a proper HTTPS setup. ## Assumptions 1. You have Administrative access to a Windows 2012r2 or above server. 2. You have PowerShell 5.1 or above installed. 3. You have acquired a certificate either from a Public CA or an Internal CA. These instructions were tested with Fossil 2.10 and stunnel 5.55. Other versions may not function in a similar manner. There is a bug in Fossil 2.9 and earlier that prevents these versions of Fossil from properly constructing https URLs when used with stunnel as a proxy. Please make sure you are using Fossil 2.10 or later on Windows. ## Configure Fossil Service for https Due to the need for the `--https` option for successfully using Fossil with stunnel, we will use [Advanced service installation using PowerShell](./service.md#PowerShell). We will need to change the command to install the Fossil Service to configure it properly for use with stunnel as an https proxy. Run the following: ```PowerShell New-Service -Name fossil-secure -DisplayName fossil-secure -BinaryPathName '"C:\Program Files\FossilSCM\fossil.exe" server --localhost --port 9000 --https --repolist "D:/Path/to/Repos"' -StartupType Automatic ``` The use of `--localhost` means Fossil will only listen for traffic on the local host on the designated port - 9000 in this case - and will not respond to network traffic. Using `--https` will tell Fossil to generate HTTPS URLs rather than HTTP ones. `New-Service` does not automatically start a service on install, so you will need to enter the following to avoid rebooting the server: ```PowerShell Start-Service -Name fossil-secure ``` ## Install stunnel 5.55 Download stunnel from the [downloads](https://www.stunnel.org/downloads.html) page. Select the latest stunnel windows package (at the time of writing this is `stunnel-5.55-win64-installer.exe`). Execute the installer and make sure you install openSSL tools when you install stunnel. You will need this to convert your certificate from PFX to PEM format. Even though the installer says it is for win64, it installs stunnel by default to `\Program Files (x86)\stunnel`. ## Get your certificate ready for Stunnel Whether you use a Public Certificate Authority or Internal Certificate Authority, the next step is exporting the certificate from Windows into a format useable by Stunnel. ### Export Certificate from Windows If your certificate is installed via Windows Certificate Management, you will need to export the certificate into a usable format. You can do this either using the Windows Certificate Management Console, or PowerShell. #### Certificate Management Console Start `mmc.exe` as an Administrator. Select 'File>Add/Remove Snapin', select 'Certificates' from the list, and click 'Add'. Select 'Computer Account', 'Next', 'Local Computer', and then 'Finish'. In the Console Root, expand 'Certificates', then 'Personal', and select 'Certificates'. In the middle pane find and select your certificate. Right click the certificate and select 'All Tasks>Export'. You want to export as PFX the Private Key, include all certificates in the certification path, and use a password only to secure the file. Enter a path and file name to a working directory and complete the export. Continue with [Convert Certificate from PFX to PEM](#convert). #### PowerShell If you know the Friendly Name of the Certificate this is relatively easy. Since you need to export the private key as well, you must run the following from an Administrative PowerShell console. ```PowerShell $passwd = ConvertTo-SecureString -string "yourpassword" -Force -AsPlainText Get-ChildItem Cert:\LocalMachine\My | Where{$_.FriendlyName -eq "FriendlyName"} | Export-PfxCertificate -FilePath fossil-scm.pfx -Password $passwd ``` You will now have your certificate stored as a PFX file. <a name="convert"></a> ### Convert Certificate from PFX to PEM For this step you will need the openssl tools that were installed with stunnel. ```PowerShell # Add stunnel\bin directory to path for this session. $env:PATH += ";${env:ProgramFiles(x86)}\stunnel\bin" # Export Private Key openssl.exe pkcs12 -in fossil-scm.pfx -out fossil-scm.key -nocerts -nodes # Export the Certificate openssl.exe pkcs12 -in fossil-scm.pfx -out fossil-scm.pem -nokeys ``` Now move `fossil-scm.key` and `fossil-scm.pem` to your stunnel config directory (by default this should be located at `\Program Files (x86)\stunne\config`). ## stunnel Configuration Use the reverse proxy configuration given in the generic [Serving via stunnel document](../any/stunnel.md#proxy). On Windows, the `stunnel.conf` file is located at `\Program Files (x86)\stunnel\config`. You will need to modify it to point at the PEM and key files generated above. After completing the above configuration restart the stunnel service in Windows with the following: ```PowerShell Restart-Service -Name stunnel ``` ## Open up port 443 in the Windows Firewall The following instructions are for the [Windows Advanced Firewall](https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-firewall/windows-firewall-with-advanced-security). If you are using a different Firewall, please consult your Firewall documentation for how to open port 443 for inbound traffic. The following command should be entered all on one line. ```PowerShell New-NetFirewallRule -DisplayName "Allow Fossil Inbound" -Description "Allow Fossil inbound on port 443 using Stunnel as TLS Proxy." -Direction Inbound -Protocol TCP -LocalPort 443 -Action Allow -Program "C:\Program Files (x86)\Stunnel\bin\stunnel.exe" ``` You should now be able to access your new Fossil Server via HTTPS. *[Return to the top-level Fossil server article.](../)* |
Added www/serverext.wiki.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <title>CGI Server Extensions</title> <h2>1.0 Introduction</h2> If you have a [./server/|Fossil server] for your project, you can add [https://en.wikipedia.org/wiki/Common_Gateway_Interface|CGI] extensions to that server. These extensions work like any other CGI program, except that they also have access to the Fossil login information and can (optionally) leverage the "skins" of Fossil so that they appear to be more tightly integrated into the project. An example of where this is useful is the [https://sqlite.org/src/ext/checklist|checklist application] on the [https://sqlite.org/|SQLite] project. The checklist helps the SQLite developers track which release tests have passed, or failed, or are still to be done. The checklist program began as a stand-alone CGI which kept its own private user database and implemented its own permissions and login system and provided its own CSS. By converting checklist into a Fossil extension, the same login that works for the [https://sqlite.org/src|main SQLite source repository] also works for the checklist. Permission to change elements of the checklist is tied on permission to check-in to the main source repository. And the standard Fossil header menu and footer appear on each page of the checklist. <h2>2.0 How It Works</h2> CGI Extensions are disabled by default. An administrator activates the CGI extension mechanism by specifying an "Extension Root Directory" or "extroot" as part of the server setup. If the Fossil server is itself run as [./server/any/cgi.md|CGI], then add a line to the [./cgi.wiki#extroot|CGI script file] that says: <blockquote><pre> extroot: <i>DIRECTORY</i> </pre></blockquote> Or, if the Fossil server is being run using the "[./server/any/none.md|fossil server]" or "[./server/any/none.md|fossil ui]" or "[./server/any/inetd.md|fossil http]" commands, then add an extra "--extroot <i>DIRECTORY</i>" option to that command. The <i>DIRECTORY</i> is the DOCUMENT_ROOT for the CGI. Files in the DOCUMENT_ROOT are accessed via URLs like this: <blockquote> https://example-project.org/ext/<i>FILENAME</i> </blockquote> In other words, access files in DOCUMENT_ROOT by appending the filename relative to DOCUMENT_ROOT to the [/help?cmd=/ext|/ext] page of the Fossil server. Files that are readable but not executable are returned as static content. Files that are executable are run as CGI. <h3>2.1 Example #1</h3> The source code repository for SQLite is a Fossil server that is run as CGI. The URL for the source code repository is [https://sqlite.org/src]. The CGI script looks like this: <blockquote><verbatim> #!/usr/bin/fossil repository: /fossil/sqlite.fossil errorlog: /logs/errors.txt extroot: /sqlite-src-ext </verbatim></blockquote> The "extroot: /sqlite-src-ext" line tells Fossil that it should look for extension CGIs in the /sqlite-src-ext directory. (All of this is happening inside of a chroot jail, so putting the document root in a top-level directory is a reasonable thing to do.) When a URL like "https://sqlite.org/src/ext/checklist" is received by the main webserver, it figures out that the /src part refers to the main Fossil CGI script and so it runs that script. Fossil gets the remainder of the URL to work with: "/ext/checklist". Fossil extracts the "/ext" prefix and uses that to determine that this a CGI extension request. Then it takes the leftover "/checklist" part and appends it to the "extroot" to get the filename "/sqlite-src-ext/checklist". Fossil finds that file to be executable, so it runs it as CGI and returns the result. The /sqlite-src-ext/checklist file is a [https://wapp.tcl.tk|Wapp program]. The current source code to the this program can be seen at [https://www.sqlite.org/src/ext/checklist/3070700/self] and recent historical versions are available at [https://sqlite.org/docsrc/finfo/misc/checklist.tcl] with older legacy at [https://sqlite.org/checklistapp/timeline?n=all] There is a cascade of CGIs happening here. The web server that receives the initial HTTP request runs Fossil as a CGI based on the "https://sqlite.org/src" portion of the URL. The Fossil instance then runs the checklist sub-CGI based on the "/ext/checklists" suffix. The output of the sub-CGI is read by Fossil and then relayed on to the main web server which in turn relays the result back to the original client. <h3>2.2 Example #2</h3> The [https://fossil-scm.org/home|Fossil self-hosting repository] is also a CGI that looks like this: <blockquote><verbatim> #!/usr/bin/fossil repository: /fossil/fossil.fossil errorlog: /logs/errors.txt extroot: /fossil-extroot </verbatim></blockquote> The extroot for this Fossil server is /fossil-extroot and in that directory is an executable file named "fileup1" - another [https://wapp.tcl.tk|Wapp] script. (The extension mechanism is not required to use Wapp. You can use any kind of program you like. But the creator of SQLite and Fossil is fond of [https://www.tcl.tk|Tcl/Tk] and so he tends to gravitate toward Tcl-based technologies like Wapp.) The fileup1 script is a demo program that lets the user upload a file using a form, and then displays that file in the reply. There is a link on the page that causes the fileup1 script to return a copy of its own source-code, so you can see how it works. <h2>3.0 CGI Inputs</h2> The /ext extension mechanism is an ordinary CGI interface. Parameters are passed to the CGI program using environment variables. The following standard CGI environment variables are supported: * AUTH_TYPE * AUTH_CONTENT * CONTENT_LENGTH * CONTENT_TYPE * DOCUMENT_ROOT * GATEWAY_INTERFACE * HTTP_ACCEPT * HTTP_ACCEPT_ENCODING * HTTP_COOKIE * HTTP_HOST * HTTP_IF_MODIFIED_SINCE * HTTP_IF_NONE_MATCH * HTTP_REFERER * HTTP_USER_AGENT * PATH_INFO * QUERY_STRING * REMOTE_ADDR * REMOTE_USER * REQUEST_METHOD * REQUEST_URI * SCRIPT_DIRECTORY * SCRIPT_FILENAME * SCRIPT_NAME * SERVER_NAME * SERVER_PORT * SERVER_PROTOCOL Do a web search for "[https://duckduckgo.com/?q=cgi+environment_variables|cgi environment variables]" to find more detail about what each of the above variables mean and how they are used. Live listings of the values of some or all of these environment variables can be found at links like these: * [https://fossil-scm.org/home/test_env] * [https://sqlite.org/src/ext/checklist/top/env] In addition to the standard CGI environment variables listed above, Fossil adds the following: * FOSSIL_CAPABILITIES * FOSSIL_NONCE * FOSSIL_REPOSITORY * FOSSIL_URI * FOSSIL_USER The FOSSIL_USER string is the name of the logged-in user. This variable is missing or is an empty string if the user is not logged in. The FOSSIL_CAPABILITIES string is a list of [./caps/ref.html|Fossil capabilities] that indicate what permissions the user has on the Fossil repository. The FOSSIL_REPOSITORY environment variable gives the filename of the Fossil repository that is running. The FOSSIL_URI variable shows the prefix of the REQUEST_URI that is the Fossil CGI script, or is an empty string if Fossil is being run by some method other than CGI. The [https://sqlite.org/src/ext/checklist|checklist application] uses the FOSSIL_USER environment variable to determine the name of the user and the FOSSIL_CAPABILITIES variable to determine if the user is allowed to mark off changes to the checklist. Only users with check-in permission to the Fossil repository are allowed to mark off checklist items. That means that the FOSSIL_CAPABILITIES string must contain the letter "i". Search for "FOSSIL_CAPABILITIES" in the [https://sqlite.org/src/ext/checklist/top/self|source listing] to see how this happens. If the CGI output is one of the forms for which Fossil inserts its own header and footer, then the inserted header will include a Content Security Policy (CSP) restriction on the use of javascript within the webpage. Any <script>...</script> elements within the CGI output must include a nonce or else they will be suppressed by the web browser. The FOSSIL_NONCE variable contains the value of that nonce. So, in other words, to get javascript to work, it must be enclosed in: <blockquote><verbatim> <script nonce='$FOSSIL_NONCE'>...</script> </verbatim></blockquote> Except, of course, the $FOSSIL_NONCE is replaced by the value of the FOSSIL_NONCE environment variable. If the HTTP request includes content (for example if this is a POST request) then the CONTENT_LENGTH value will be positive and the data for the content will be readable on standard input. <h2>4.0 CGI Outputs</h2> CGI programs construct a reply by writing to standard output. The first few lines of output are parameters intended for the web server that invoked the CGI. These are followed by a blank line and then the content. Typical parameter output looks like this: <blockquote><verbatim> Status: 200 Ok Content-Type: text/html </verbatim></blockquote> CGI programs can return any content type they want - they are not restricted to text replies. It is OK for a CGI program to return (for example) image/png. The fields of the CGI response header can be any valid HTTP header fields. Those that Fossil does not understand are simply relayed back to up the line to the requester. Fossil takes special action with some content types. If the Content-Type is "application/x-fossil-wiki" or "application/x-markdown" then Fossil converts the content from [/wiki_rules|Fossil-Wiki] or [/md_rules|Markdown] into HTML, adding its own header and footer text according to the repository skin. Content of type "text/html" is normally passed straight through unchanged. However, if the text/html content is of the form: <blockquote><verbatim> <div class='fossil-doc' data-title='DOCUMENT TITLE'> ... HTML content there ... </div> </verbatim></blockquote> In other words, if the outer-most markup of the HTML is a <div> element with a single class of "fossil-doc", then Fossil will adds its own header and footer to the HTML. The page title contained in the added header will be extracted from the "data-title" attribute. Except for the three cases noted above, Fossil makes no changes or additions to the CGI-generated content. Fossil just passes the verbatim content back up the stack towards the requester. <h2>5.0 Filename Restrictions</h2> For security reasons, Fossil places restrictions on the names of files in the extroot directory that can participate in the extension CGI mechanism: 1. Filenames must consist of only ASCII alphanumeric characters, ".", "_", and "-", and of course "/" as the file separator. Files with names that includes spaces or other punctuation or special characters are ignored. 2. No element of the pathname can begin with "." or "-". Files or directories whose names begin with "." or "-" are ignored. If a CGI program requires separate data files, it is safe to put those files in the same directory as the CGI program itself as long as the names of the data files contain special characters that cause them to be ignored by Fossil. <h2>6.0 Trouble-Shooting Hints</h2> Remember that the /ext will return any file in the extroot directory hierarchy as static content if the file is readable but not executable. When initially setting up the /ext mechanism, it is sometimes helpful to verify that you are able to receive static content prior to working on getting your CGIs working. Also remember that CGIs must be executable files. Fossil likes to run inside a chroot jail, and will automatically put itself inside a chroot jail if it can. The sub-CGI program will also run inside this same chroot jail. Make sure all embedded pathnames have been adjusted accordingly and that all resources needed by the CGI program are available within the chroot jail. If anything goes wrong while trying to process an /ext page, Fossil returns a 404 Not Found error with no details. However, if the requester is logged in as a user that has <b>[./caps/ref.html#D | Debug]</b> capability then additional diagnostic information may be included in the output. If the /ext page has a "fossil-ext-debug=1" query parameter and if the requester is logged in as a user with Debug privilege, then the CGI output is returned verbatim, as text/plain and with the original header intact. This is useful for diagnosing problems with the CGI script. |
Changes to www/shunning.wiki.
1 | <title>Deleting Content From Fossil</title> | | > | < > | | < | | | > > | | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <title>Deleting Content From Fossil</title> <h2>Good Reasons for Removing Content from a Fossil Repository</h2> Fossil is designed to keep all historical content forever. Fossil purposely makes it difficult for users to delete content. Old content is part of the project's <i>*ahem*</i> fossil record and should be maintained indefinitely to maintain an accurate history of the project. Nevertheless, there may occasionally arise legitimate reasons for deleting content. Such reasons include: * Spammers inserted inappropriate content into a wiki page, forum post, or ticket. Fossil lets you easily hide or amend such content, but since it is not a legitimate part of the project's history, there is no value in keeping it, so it is best removed permanently. * A file that contains trade secrets or that is under someone else's copyright was accidentally committed and needs to be backed out. * A malformed control artifact was inserted and is disrupting the operation of Fossil. <h2>Alternatives</h2> All of these are rare cases: Fossil is [./antibot.wiki | designed to foil spammers up front], legally problematic check-ins should range from rare to nonexistent, and you have to go way out of your way to force Fossil to insert bad control artifacts. Therefore, before we get to methods of permanently deleting content from a Fossil repos, let's give some alternatives that usually suffice, which don't damage the project's fossil record: <ul> <li><p>When a forum post or wiki article is "deleted," what actually happens is that a new empty version is added to the Fossil [./blockchain.md | block chain]. The web interface interprets this as "deleted," but the prior version remains available if you go digging for it.</p></li> <li><p>When you close a ticket, it's marked in a way that causes it to not show up in the normal ticket reports. You usually want to give it a Resolution such as "Rejected" when this happens, plus possibly a comment explaining why you're closing it. This is all new information added to the ticket, not deletion.</p></li> <li><p>When you <tt>fossil rm</tt> a file, a new manifest is checked into the repository with the same file list as for the prior version minus the "removed" file. The file is still present in the repository; it just isn't part of that version forward on that branch.</p></li> <li><p>If you make a bad check-in, you can shunt it off to the side by amending it to put it on a different branch, then continuing development on the prior branch: <p> <tt>$ fossil amend abcd1234 --branch BOGUS --hide<br> $ fossil up trunk</tt> <p> The first command moves check-in ID <tt>abcd1234</tt> (and any subsequent check-ins on that branch!) to a branch called <tt>BOGUS</tt>, then hides it so it doesn't show up on the timeline. You can call this branch anything you like, and you can re-use the same name as many times as you like. No content is actually deleted: it's just shunted off to the side and hidden away. You might find it easier to do this from the Fossil web UI in the "edit" function for a check-in. <p> The second command returns to the last good check-in on that branch so you can continue work from that point.</p></li> <li><p>When the check-in you want to remove is followed by good check-ins on the same branch, you can't use the previous method, because it will move the good check-ins, too. The solution is: <p> <tt>$ fossil merge --backout abcd1234</tt> <p>That creates a diff in the check-out directory that backs out the bad check-in <tt>abcd1234</tt>. You then fix up any merge conflicts, build, test, etc., then check the reverting change into the repository. Again, nothing is actually deleted; you're just adding more information to the repository which corrects a prior check-in.</p></li> </ul> <h2>Shunning</h2> Fossil provides a mechanism called "shunning" for removing content from a repository. Every Fossil repository maintains a list of the hash names of |
︙ | ︙ |
Changes to www/ssl.wiki.
|
| | | | > > > > > > > > > | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > | > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > > > > | > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | <title>Securing a Repository with TLS</title> <h2>Using TLS-Encrypted Communications with Fossil</h2> If you are storing sensitive information in a repository accessible over a network whose integrity you do not fully trust, you should use TLS to encrypt all communications with it. This is most true for repositories accessed over the Internet, especially if they will be accessed from edge networks you do not control, since that admits of various forms of [https://en.wikipedia.org/wiki/Man-in-the-middle_attack|man in the middle attack]. TLS protects the credentials used to access the server, prevents eavesdropping, prevents in-flight data modification, prevents server identify spoofing, and more. There are two major aspects to this, both of which have to be addressed in different ways. Those are the subjects of the next two major sections. <h2 id="client">Fossil TLS Configuration: Client Side</h2> Fossil itself has built-in support for TLS on the client side only. That is to say, you can build it against [https://www.openssl.org/|the OpenSSL library], which will allow it to clone and sync with a remote Fossil repository via <tt>https</tt> URIs. <h3 id="openssl-bin">Building Against OpenSSL Automatically</h3> The <tt>configure</tt> script will attempt to find OpenSSL on your system automatically. It first tries asking the <tt>pkg-config</tt> system where the OpenSSL development files are, and if that fails, it falls back to looking through a list of likely directories. If it can't find the files it needs, the most common solution is to install the OpenSSL development package on your system via your OS's package manager. Examples: * <b>RHEL & Fedora</b>: <tt>sudo yum install openssl-devel</tt> * <b>Debian & Ubuntu</b>: <tt>sudo apt install libssl-dev</tt> * <b>FreeBSD</b>: <tt>su -c 'pkg install openssl'</tt> * <b>macOS</b>: <tt>sudo brew install openssl</tt> * <b>Cygwin</b>: Install <tt>openssl-devel</tt> via Cygwin's <tt>setup-*.exe</tt> program The macOS case requires explanation. Apple last shipped OpenSSL develpoment files in OS X 10.6 (Snow Leopard), choosing to deprecate it from that point forward. (Apple wants you to use their proprietary platform-specific encryption methods instead.) Since macOS has no built-in package manager, a number have sprung up out of the FOSS world. It is not known to this author whether Fossil's current build system can find OpenSSL as installed with any of these other package managers, so unless you have a particular reason to avoid it, we recomend that you use [https://brew.sh|Homebrew] on macOS to install OpenSSL as above. Fossil's build system will seek it out and use it automatically. <h3 id="openssl-src">Building Against a Non-Platform Version of OpenSSL</h3> The Fossil build system has a few other methods for finding OpenSSL when the automatic methods fail or when you'd prefer that Fossil use a different version of OpenSSL than the one Fossil's build system picks on its own. A good reason to do this is when the Fossil build system finds a functioning version of OpenSSL which is nevertheless unsuitable. One common case is that your OS is sufficiently outdated that the platform version of OpenSSL can no longer communicate with remote systems adhering to the latest advice on secure communications. An old OpenSSL might not support any of the [https://en.wikipedia.org/wiki/Cipher_suite|cipher suites] the remote Fossil repository's HTTPS proxy is willing to offer, for example, so that even though both sides are speaking a variant of TLS/SSL, the peers cannot come to an agreement on the cryptography. If you've installed the OpenSSL development files somewhere that Fossil's build system cannot find on its own, you can clue it in by passing the <tt>--with-openssl</tt> option to the <tt>configure</tt> script. Type <tt>./configure --help</tt> for details. Another option is to download the source code to OpenSSL and build Fossil against that private version of OpenSSL: <pre> cd compat # relative to the Fossil source tree root tar xf /path/to/openssl-*.tar.gz ln -fs openssl-x.y.z openssl cd openssl ./config # or, e.g. ./Configure darwin64-x86_64-cc make -j11 cd ../.. ./configure --with-openssl=tree make -j11 </pre> That will get you a Fossil binary statically linked to this in-tree version of OpenSSL. Beware, taking this path typically opens you up to new problems, which are conveniently covered in the next section! <h3 id="certs">Certificates</h3> To verify the identify of a server, TLS uses [https://en.wikipedia.org/wiki/X.509#Certificates|X.509 certificates]. If you are using a self-signed certificate, you'll be asked if you want to accept the certificate the first time you communicate with the server. Verify the certificate fingerprint is correct, then answer "always" to remember your decision. If you are cloning from or syncing to Fossil servers that use a certificate signed by a [https://en.wikipedia.org/wiki/Certificate_authority|certificate authority] (CA), Fossil needs to know which CAs you trust to sign those certificates. Fossil relies on the OpenSSL library to have some way to check a trusted list of CA signing keys. There are two common ways this fails: # <p>The OpenSSL library Fossil is linked to doesn't have a CA signing key set at all, so that it initially trusts no certificates at all.</p> # <p>The OpenSSL library does have a CA cert set, but your Fossil server's TLS certificate was signed by a CA that isn't in that set.</p> A common reason to fall into the second trap is that you're using certificates signed by a local private CA, as often happens in large enterprises. You can solve this sort of problem by getting your local CA's signing certificate in PEM format and pointing OpenSSL at it: <pre> fossil set --global ssl-ca-location /path/to/local-ca.pem </pre> The use of <tt>--global</tt> with this option is common, since you may have multiple reposotories served under certificates signed by that same CA. A common way to run into the broader first problem is that you're on FreeBSD, which does not install a CA certificate set by default, even as a dependency of the OpenSSL library. If you're using a certificate signed by one of the major public CAs, you can solve this by installing the <tt>ca_root_nss</tt> package. That package contains the Mozilla NSS certificate bundle, which gets installed in a location that OpenSSL checks by default, so you don't need to change any Fossil settings. (This is the same certificate set that ships with Firefox, by the way.) The same sort of thing happens with the Windows build of OpenSSL, but for a different core reason: Windows does ship with a stock CA certificate set, but it's not in a format that OpenSSL understands how to use. Rather than try to find a way to convert the data format, you may find it acceptable to use the same Mozilla NSS cert set. I do not know of a way to easily get this from Mozilla themselves, but I did find a [https://curl.haxx.se/docs/caextract.html|third party source] for the <tt>cacert.pem</tt> file. Install it somewhere on your system, then point Fossil at it like so: <pre> fossil set --global ssl-ca-location /path/to/cacert.pem </pre> This can also happen if you've linked Fossil to a version of OpenSSL [#openssl-src|built from source]. That same <tt>cacert.pem</tt> fix can work in that case, too. When you build Fossil on Linux platforms against the binary OpenSSL package provided with the OS, you typically get a root cert store along with the platform OpenSSL package, either built-in or as a hard dependency. <h4>Client-Side Certificates</h4> You can also use client side certificates to add an extra layer of authentication, over and above Fossil's built in user management. If you are particularly paranoid, you'll want to use this to remove the ability of anyone on the internet from making any request to Fossil. Without presenting a valid client side certificate, the web server won't invoke the Fossil CGI handler. Configure your server to request a client side certificate, and set up a certificate authority to sign your client certificates. For each person who needs to access the repository, create a private key and certificate signed with that CA. The PEM encoded private key and certificate should be stored in a single file, simply by concatenating the key and certificate files. Specify the location of this file with the <tt>ssl-identity</tt> setting, or the <tt>--ssl-identity</tt> option to the <tt>clone</tt> command. If you've password protected the private key, the password will be requested every time you connect to the server. This password is not stored by fossil, as doing so would defeat the purpose of having a password. If you attempt to connect to a server which requests a client certificate, but don't provide one, fossil will show an error message which explains what to do to authenticate with the server. <h2 id="server">Fossil TLS Configuration: Server Side</h2> Fossil's built-in HTTP server feature does not currently have a built-in way to serve via HTTP over TLS, a.k.a. HTTPS, even when you've linked Fossil to OpenSSL. To serve a Fossil repository via HTTPS, you must put it behind some kind of HTTPS proxy. We have a number of documents elsewhere in this repository that cover your options for [./server/ | serving Fossil repositories]. A few of the most useful of these are: * <a id="stunnel" href="./server/any/stunnel.md">Serving via stunnel</a> * <a id="althttpd" href="./server/any/althttpd.md">Serving via stunnel + althttpd</a> * <a id="nginx" href="./server/any/scgi.md">Serving via SCGI (nginx)</a> <h2 id="enforcing">Enforcing TLS Access</h2> To use TLS encryption in cloning and syncing to a remote Fossil repository, be sure to use the <tt>https:</tt> URI scheme in <tt>clone</tt> and <tt>sync</tt> commands. If your server is configured to serve the repository via both HTTP and HTTPS, it's easy to accidentally use unencrypted HTTP if you forget the all-important 's'. As of Fossil 2.8, there is a setting in the Fossil UI under Admin → Access called "Redirect to HTTPS," which is set to "Off" by default. Changing this only affects web UI access to the Fossil repository. It doesn't affect clones and syncs done via the <tt>http</tt> URI scheme. In Fossil 2.7 and earlier, there was a much weaker form of this setting affecting the <tt>/login</tt> page only. If you're using this setting, you should migrate to the new setting as soon as possible, because the old setting allows multiple ways of defeating it. <b id="rloop">WARNING:</b> Enabling HTTPS redirects at the Fossil repo level while running Fossil behind an HTTPS proxy can result in an infinite redirect loop. It happens when the proxy mechanism presents "<tt>http</tt>" URIs to Fossil, so Fossil issues a redirect, so the browser fetches the page again, causing Fossil to see an "<tt>http</tt>" URI again, so it issues a redirect...'round and 'round it goes until the web browser detects it's in a redirect loop and gives up. This problem prevents you from getting back into the Admin UI to fix it, but there are several ways to fix it: # <p><b>Reset via CLI.</b> You can turn the setting back off from the CLI with the command "<tt>fossil -R /path/to/repo.fossil set redirect-to-https 0</tt>". (Currently doesn't work.)</p> # <p><b>Backup first.</b> This setting is stored in the Fossil repository, so if you make a backup first <i>on the server</i>, you can restore the repo file if enabling this feature creates a redirect loop.</p> # <p><b>Download, fix, and restore.</b> You can copy the remote repository file down to a local machine, use <tt>fossil ui</tt> to fix the setting, and then upload it to the repository server again.</p> It's best to enforce TLS-only access at the front-end proxy level anyway. It not only avoids the problem entirely, it can be significantly more secure. The [./tls-nginx.md|nginx TLS proxy guide] shows one way to achieve this.</p> <h2>Terminology Note</h2> This document is called <tt>ssl.wiki</tt> for historical reasons. The TLS protocol was originally called SSL, and it went through several revisions before being replaced by TLS. Years before this writing, SSL finally became entirely obsolete due to weaknesses in the protocol fixed in the later TLS series of protocols. Some people still use the term "SSL" when they actually mean "TLS," but in the Fossil project, we always use "TLS" except when we must preserve some sort of historical compatibility, as with this document's name in order to avoid broken external URLs. The Fossil TLS-related settings also often use "<tt>ssl</tt>" in their names, for the same reason. This series of protocols is also called "HTTPS" after the URI scheme used to specify "HTTP over TLS." |
Changes to www/stats.wiki.
︙ | ︙ | |||
123 124 125 126 127 128 129 | "GB" means gigabytes (10<sup><small>9</small></sup> bytes) not <a href="http://en.wikipedia.org/wiki/Gibibyte">gibibytes</a> (2<sup><small>30</small></sup> bytes). Similarly, "MB" and "KB" means megabytes and kilobytes, not mebibytes and kibibytes. <h2>Analysis And Supplemental Data</h2> | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | "GB" means gigabytes (10<sup><small>9</small></sup> bytes) not <a href="http://en.wikipedia.org/wiki/Gibibyte">gibibytes</a> (2<sup><small>30</small></sup> bytes). Similarly, "MB" and "KB" means megabytes and kilobytes, not mebibytes and kibibytes. <h2>Analysis And Supplemental Data</h2> Perhaps the two most interesting data points in the above table are SQLite and SLT. SQLite is a long-running project with long revision chains. Some of the files in SQLite have been edited over a thousand times. Each of these edits is stored as a delta, and hence the SQLite project gets excellent 80:1 compression. SLT, on the other hand, consists of many large (megabyte-sized) SQL scripts that have one or maybe two edits each. There is very little delta compression occurring and so the overall repository compression ratio is much lower. Note also that |
︙ | ︙ |
Changes to www/sync.wiki.
1 2 3 4 5 6 7 8 9 10 11 | <title>The Fossil Sync Protocol</title> <p>This document describes the wire protocol used to synchronize content between two Fossil repositories.</p> <h2>1.0 Overview</h2> <p>The global state of a fossil repository consists of an unordered collection of artifacts. Each artifact is identified by a cryptographic hash of its content, expressed as a lower-case hexadecimal string. Synchronization is the process of sharing artifacts between | | | | > > > > > > > > > > > > > > > > > | > > > > > > > > | | 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 | <title>The Fossil Sync Protocol</title> <p>This document describes the wire protocol used to synchronize content between two Fossil repositories.</p> <h2>1.0 Overview</h2> <p>The global state of a fossil repository consists of an unordered collection of artifacts. Each artifact is identified by a cryptographic hash of its content, expressed as a lower-case hexadecimal string. Synchronization is the process of sharing artifacts between repositories so that all repositories have copies of all artifacts. Because artifacts are unordered, the order in which artifacts are received is unimportant. It is assumed that the hash names of artifacts are unique - that every artifact has a different hash. To a first approximation, synchronization proceeds by sharing lists hash values for available artifacts, then sharing the content of artifacts whose names are missing from one side or the other of the connection. In practice, a repository might contain millions of artifacts. The list of hash names for this many artifacts can be large. So optimizations are employed that usually reduce the number of hashes that need to be shared to a few hundred.</p> <p>Each repository also has local state. The local state determines the web-page formatting preferences, authorized users, ticket formats, and similar information that varies from one repository to another. The local state is not usually transferred during a sync. Except, some local state is transferred during a [/help?cmd=clone|clone] in order to initialize the local state of the new repository. Also, an administrator can sync local state using the [/help?cmd=configuration|config push] and [/help?cmd=configuration|config pull] commands. <a name="crdt"></a> <h3>1.1 Conflict-Free Replicated Datatypes</h3> <p>The "bag of artifacts" data model used by Fossil Fossil is apparently an implementation of a particular [https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type|Conflict-Free Replicated Datatype (CRDT)] called a "G-Set" or "Grow-only Set". The academic literature on CRDTs only began to appear in about 2011, and Fossil predates that research by at least 4 years. But it is nice to know that theorists have now proven that the underlying data model of Fossil can provide strongly-consistent replicas using only peer-to-peer communication and without any kind of central authority.</p> <p>If you are already familiar with CRDTs and were wondering if Fossil used them, the answer is "yes". We just don't call them by that name.</p> <h2>2.0 Transport</h2> <p>All communication between client and server is via HTTP requests. The server is listening for incoming HTTP requests. The client issues one or more HTTP requests and receives replies for each request.</p> <p>The server might be running as an independent server using the <b>server</b> command, or it might be launched from inetd or xinetd using the <b>http</b> command. Or the server might be launched from CGI. (See "[./server/|How To Configure A Fossil Server]" for details.) The specifics of how the server listens for incoming HTTP requests is immaterial to this protocol. The important point is that the server is listening for requests and the client is the issuer of the requests.</p> <p>A single push, pull, or sync might involve multiple HTTP requests. The client maintains state between all requests. But on the server side, each request is independent. The server does not preserve any information about the client from one request to the next.</p> <p>Note: Throughout this article, we use the terms "server" and "client" to represent the listener and initiator of the interaction, respectively. Nothing in this protocol requires that the server actually be a back-room processor housed in a datacenter, nor does the client need to be a desktop or handheld device. For the purposes of this article "client" simply means the repository that initiates the conversation and "server" is the repository that responds. Nothing more.</p> <h4>2.0.1 Encrypted Transport</h4> <p>In the current implementation of Fossil, the server only understands HTTP requests. The client can send either clear-text HTTP requests or encrypted HTTPS requests. But when HTTPS requests are sent, they first must be decrypted by a web server or proxy before being passed to the Fossil server. This limitation may be relaxed in a future release.</p> <h3>2.1 Server Identification</h3> <p>The server is identified by a URL argument that accompanies the push, pull, or sync command on the client. (As a convenience to |
︙ | ︙ | |||
421 422 423 424 425 426 427 | holds. The client will use this information to figure out which unversioned files need to be synchronized. The server might also send a uvigot card when it receives a uvgimme card but its reply message size is already oversized and hence unable to hold the usual uvfile reply. <p>When a client receives a "uvigot" card, it checks to see if the | | | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | holds. The client will use this information to figure out which unversioned files need to be synchronized. The server might also send a uvigot card when it receives a uvgimme card but its reply message size is already oversized and hence unable to hold the usual uvfile reply. <p>When a client receives a "uvigot" card, it checks to see if the file needs to be transferred from client to server or from server to client. If a client-to-server transmission is needed, the client schedules that transfer to occur on a subsequent HTTP request. If a server-to-client transfer is needed, then the client sends a "uvgimme" card back to the server to request the file content. <h3>3.7 Gimme Cards</h3> |
︙ | ︙ | |||
623 624 625 626 627 628 629 | A pragma might have zero or more "value" arguments depending on the pragma name. <p>New pragma names may be added to the protocol from time to time in order to enhance the capabilities of Fossil. Unknown pragmas are silently ignored, for backwards compatibility. | | | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | A pragma might have zero or more "value" arguments depending on the pragma name. <p>New pragma names may be added to the protocol from time to time in order to enhance the capabilities of Fossil. Unknown pragmas are silently ignored, for backwards compatibility. <p>The following are the known pragma names as of 2019-06-30: <ol> <li><p><b>send-private</b> <p>The send-private pragma instructs the server to send all of its private artifacts to the client. The server will only obey this request if the user has the "x" or "Private" privilege. |
︙ | ︙ | |||
662 663 664 665 666 667 668 | content on the server exactly matches the content on the client and no further synchronization is required. <li><p><b>uv-pull-only</b></i> <p>A server sends the uv-pull-only pragma to the client in response to a uv-hash pragma with a mismatched content hash argument. This pragma indicates that there are differences in unversioned content | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | content on the server exactly matches the content on the client and no further synchronization is required. <li><p><b>uv-pull-only</b></i> <p>A server sends the uv-pull-only pragma to the client in response to a uv-hash pragma with a mismatched content hash argument. This pragma indicates that there are differences in unversioned content between the client and server but that content can only be transferred from server to client. The server is unwilling to accept content from the client because the client login lacks the "write-unversioned" permission.</p> <li><p><b>uv-push-ok</b></i> <p>A server sends the uv-push-ok pragma to the client in response to a uv-hash pragma with a mismatched content hash argument. This pragma indicates that there are differences in unversioned content between the client and server and that content can only be transferred in either direction. The server is willing to accept content from the client because the client login has the "write-unversioned" permission.</p> <li><p><b>ci-lock</b> <i>CHECKIN-HASH CLIENT-ID</i></p> <p>A client sends the "ci-lock" pragma to the server to indicate that it is about to add a new check-in as a child of the CHECKIN-HASH check-in and on the same branch as CHECKIN-HASH. If some other client has already indicated that it was also trying to commit against CHECKIN-HASH, that indicates that a fork is about to occur, and the server will reply with a "ci-lock-fail" pragma (see below). Check-in locks automatically expire when the check-in actually occurs, or after a timeout (currently 24-hours but subject to change). <li><p><b>ci-lock-fail</b> <i>LOGIN MTIME</i></p> <p>When a server receives two or more "ci-lock" pragma messages for the same check-in but from different clients, the second a subsequent ci-lock will provoke a ci-lock-fail pragma in the reply to let the client know that it if continues with the check-in it will likely generate a fork. The LOGIN and MTIME arguments are intended to provide information to the client to help it generate a more useful error message. </p> <li><p><b>ci-unlock</b> <i>CLIENT-ID</i></p> <p>A client sends the "ci-unlock" pragma to the server after a successful commit. This instructs the server to release any lock on any check-in previously held by that client. The ci-unlock pragma helps to avoid false-positive lock warnings that might arise if a check-in is aborted and then restarted on a branch. </ol> <h3>3.12 Comment Cards</h3> <p>Any card that begins with "#" (ASCII 0x23) is a comment card and is silently ignored.</p> |
︙ | ︙ |
Changes to www/tech_overview.wiki.
︙ | ︙ | |||
164 165 166 167 168 169 170 | Note that the zlib and delta compression is not an inherent part of the Fossil file format; it is just an optimization. The enduring file format for Fossil is the unordered set of artifacts. The compression techniques are just a detail of how the current implementation of Fossil happens to store these artifacts efficiently on disk. | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | Note that the zlib and delta compression is not an inherent part of the Fossil file format; it is just an optimization. The enduring file format for Fossil is the unordered set of artifacts. The compression techniques are just a detail of how the current implementation of Fossil happens to store these artifacts efficiently on disk. All of the original uncompressed and un-delta'd artifacts can be extracted from a Fossil repository database using the [/help/deconstruct | fossil deconstruct] command. Individual artifacts can be extracted using the [/help/artifact | fossil artifact] command. When accessing the repository database using raw SQL and the [/help/sqlite3 | fossil sql] command, the extension function "<tt>content()</tt>" with a single argument which is the SHA1 or |
︙ | ︙ | |||
312 313 314 315 316 317 318 | * State information for the [/help/bisect | bisect] command. For Fossil commands that run from within a working checkout, the first thing that happens is that Fossil locates the checkout database. Fossil first looks in the current directory. If not found there, it looks in the parent directory. If not found there, the parent of the parent. And so forth until either the checkout database is found | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | * State information for the [/help/bisect | bisect] command. For Fossil commands that run from within a working checkout, the first thing that happens is that Fossil locates the checkout database. Fossil first looks in the current directory. If not found there, it looks in the parent directory. If not found there, the parent of the parent. And so forth until either the checkout database is found or the search reaches the root of the file system. (In the latter case, Fossil returns an error, of course.) Once the checkout database is located, it is used to locate the repository database. Notice that the checkout database contains a pointer to the repository database but that the repository database has no record of the checkout databases. That means that a working checkout directory tree can be freely renamed or copied or deleted without consequence. But the |
︙ | ︙ |
Changes to www/th1.md.
︙ | ︙ | |||
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 | There are many new commands added to TH1 and used to access the special features of Fossil. The following is a summary of the extended commands: * anoncap * anycap * artifact * checkout * combobox * date * decorate * dir * enable\_output * encode64 * getParameter * glob\_match * globalState * hascap * hasfeature * html * htmlize * http * httpize * insertCsrf * linecount * markdown * puts * query * randhex * redirect * regexp * reinitialize * render | > > > | 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 | There are many new commands added to TH1 and used to access the special features of Fossil. The following is a summary of the extended commands: * anoncap * anycap * artifact * cgiHeaderLine * checkout * combobox * copybtn * date * decorate * dir * enable\_output * encode64 * getParameter * glob\_match * globalState * hascap * hasfeature * html * htmlize * http * httpize * insertCsrf * linecount * markdown * nonce * puts * query * randhex * redirect * regexp * reinitialize * render |
︙ | ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 222 223 | * tclMakeSafe * tclReady * trace * unversioned content * unversioned list * utime * verifyCsrf * wiki Each of the commands above is documented by a block comment above their implementation in the th\_main.c or th\_tcl.c source files. All commands starting with "tcl", with the exception of "tclReady", require the Tcl integration subsystem be included at compile-time. | > | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | * tclMakeSafe * tclReady * trace * unversioned content * unversioned list * utime * verifyCsrf * verifyLogin * wiki Each of the commands above is documented by a block comment above their implementation in the th\_main.c or th\_tcl.c source files. All commands starting with "tcl", with the exception of "tclReady", require the Tcl integration subsystem be included at compile-time. |
︙ | ︙ | |||
244 245 246 247 248 249 250 251 252 253 254 255 256 257 | ------------------------------------------- * artifact ID ?FILENAME? Attempts to locate the specified artifact and return its contents. An error is generated if the repository is not open or the artifact cannot be found. <a name="checkout"></a>TH1 checkout Command ------------------------------------------- * checkout ?BOOLEAN? Return the fully qualified directory name of the current checkout or an | > > > > > > > | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | ------------------------------------------- * artifact ID ?FILENAME? Attempts to locate the specified artifact and return its contents. An error is generated if the repository is not open or the artifact cannot be found. <a name="cgiHeaderLine"></a>TH1 cgiHeaderLine Command ----------------------------------------------------- * cgiHeaderLine line Adds the specified line to the CGI header. <a name="checkout"></a>TH1 checkout Command ------------------------------------------- * checkout ?BOOLEAN? Return the fully qualified directory name of the current checkout or an |
︙ | ︙ | |||
266 267 268 269 270 271 272 273 274 275 276 277 278 279 | Generates and emits an HTML combobox. NAME is both the name of the CGI parameter and the name of a variable that contains the currently selected value. TEXT-LIST is a list of possible values for the combobox. NUMLINES is 1 for a true combobox. If NUMLINES is greater than one then the display is a listbox with the number of lines given. <a name="date"></a>TH1 date Command ----------------------------------- * date ?-local? Return a strings which is the current time and date. If the -local option is used, the date appears using localtime instead of UTC. | > > > > > > > > > > > > > > > > > > > > > > | 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 | Generates and emits an HTML combobox. NAME is both the name of the CGI parameter and the name of a variable that contains the currently selected value. TEXT-LIST is a list of possible values for the combobox. NUMLINES is 1 for a true combobox. If NUMLINES is greater than one then the display is a listbox with the number of lines given. <a name="copybtn"></a>TH1 copybtn Command ----------------------------------------- * copybtn TARGETID FLIPPED TEXT ?COPYLENGTH? Output TEXT with a click-to-copy button next to it. Loads the copybtn.js Javascript module, and generates HTML elements with the following IDs: * TARGETID: The `<span>` wrapper around TEXT. * copy-TARGETID: The `<span>` for the copy button. If the FLIPPED argument is non-zero, the copy button is displayed after TEXT. The optional COPYLENGTH argument defines the length of the substring of TEXT copied to clipboard: * <= 0: No limit (default if the argument is omitted). * >= 3: Truncate TEXT after COPYLENGTH (single-byte) characters. * 1: Use the "hash-digits" setting as the limit. * 2: Use the length appropriate for URLs as the limit (defined at compile-time by `FOSSIL_HASH_DIGITS_URL`, defaults to 16). <a name="date"></a>TH1 date Command ----------------------------------- * date ?-local? Return a strings which is the current time and date. If the -local option is used, the date appears using localtime instead of UTC. |
︙ | ︙ | |||
299 300 301 302 303 304 305 | time zone configured for the repository). <a name="enable_output"></a>TH1 enable\_output Command ------------------------------------------------------ * enable\_output BOOLEAN | | | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | time zone configured for the repository). <a name="enable_output"></a>TH1 enable\_output Command ------------------------------------------------------ * enable\_output BOOLEAN Enable or disable sending output when the combobox, copybtn, puts, or wiki commands are used. <a name="encode64"></a>TH1 encode64 Command ------------------------------------------- * encode64 STRING |
︙ | ︙ | |||
443 444 445 446 447 448 449 450 451 452 453 454 455 456 | * markdown STRING Renders the input string as markdown. The result is a two-element list. The first element contains the body, rendered as HTML. The second element is the text-only title string. <a name="puts"></a>TH1 puts Command ----------------------------------- * puts STRING Outputs the STRING unchanged. | > > > > > > > | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | * markdown STRING Renders the input string as markdown. The result is a two-element list. The first element contains the body, rendered as HTML. The second element is the text-only title string. <a name="nonce"></a>TH1 nonce Command ------------------------------------- * nonce Returns the value of the cryptographic nonce for the request being processed. <a name="puts"></a>TH1 puts Command ----------------------------------- * puts STRING Outputs the STRING unchanged. |
︙ | ︙ | |||
692 693 694 695 696 697 698 699 700 701 702 703 704 705 | * verifyCsrf Before using the results of a form, first call this command to verify that this Anti-CSRF token is present and is valid. If the Anti-CSRF token is missing or is incorrect, that indicates a cross-site scripting attack. If the event of an attack is detected, an error message is generated and all further processing is aborted. <a name="wiki"></a>TH1 wiki Command ----------------------------------- * wiki STRING Renders STRING as wiki content. | > > > > > > > > | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | * verifyCsrf Before using the results of a form, first call this command to verify that this Anti-CSRF token is present and is valid. If the Anti-CSRF token is missing or is incorrect, that indicates a cross-site scripting attack. If the event of an attack is detected, an error message is generated and all further processing is aborted. <a name="verifyLogin"></a>TH1 verifyLogin Command ------------------------------------------------- * verifyLogin Returns non-zero if the specified user name and password represent a valid login for the repository. <a name="wiki"></a>TH1 wiki Command ----------------------------------- * wiki STRING Renders STRING as wiki content. |
︙ | ︙ |
Changes to www/tickets.wiki.
︙ | ︙ | |||
8 9 10 11 12 13 14 | to a ticket. The act of creating a ticket is considered a change. Each ticket change artifact contains the following information: <ul> <li>The ID of the ticket that was changed | | | | | 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 | to a ticket. The act of creating a ticket is considered a change. Each ticket change artifact contains the following information: <ul> <li>The ID of the ticket that was changed <li>The time stamp for when the change occurred <li>The user who made the change <li>A list of key/value pairs that show what changed in the ticket </ul> To determine the current state of a particular ticket, Fossil orders the change artifacts for that ticket from oldest to most recent, then applies each change in time stamp order. On each change artifact, there are one or more key/value pairs that implement the change. The key corresponds to a field of the ticket that is modified. The value may either replace the earlier value for that key, or the value may be appended to the prior value. <h2>2.0 Ticket Tables</h2> The low-level artifact format for ticket content is tedious and cumbersome to access in real time. To facility reporting and display of tickets, the low-level artifact information is collected and summarized in a pair of SQL tables in each local repository. Display and reporting of tickets is accomplished by querying these two tables. Note that only the low-level ticket change artifacts are synced. The content of the two ticket tables can always be reconstructed from the ticket change artifacts. And, indeed, the reconstruction of the ticket |
︙ | ︙ | |||
130 131 132 133 134 135 136 | <h3>2.2 Translating Artifacts To Tables</h3> Each row in the TICKETCHNG table corresponds to a single ticket change artifact. The tkt_id field is the integer primary key of the TICKET table entry for the corresponding ticket. The tkt_rid field is the integer primary key for the BLOB table entry that contains the low-level | | | | | 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 | <h3>2.2 Translating Artifacts To Tables</h3> Each row in the TICKETCHNG table corresponds to a single ticket change artifact. The tkt_id field is the integer primary key of the TICKET table entry for the corresponding ticket. The tkt_rid field is the integer primary key for the BLOB table entry that contains the low-level artifact text. The tkt_mtime field is the time stamp on the ticket change artifact, expressed as a Julian day number. If the ticket change artifact contains a key/value pair where the key is "login", then the corresponding value is stored in the login field of the TICKETCHNG table. The same it true for "username", "mimetype", and "icomment" fields. Any time there is a key/value pair in the ticket change artifact and the key corresponds to the name of a field in the TICKETCHNG table, then the value of that key/value pair is stored in the TICKETCHNG table. If the TICKETCHNG table has a field for which there is no corresponding key/value pair in the artifact, then that field of the TICKETCHNG table is NULL. If there are key/value pairs in the artifact that have no corresponding field in the TICKETCHNG table, those key/value pairs are silently ignored. Each row in the TICKET table records the overall status of a ticket. The tkt_id field is a unique integer primary key for the ticket. the tkt_uuid field is the global ticket identifier - a larger random hexadecimal constant. The tkt_mtime and tkt_ctime fields hold the times of the most recent and the oldest ticket change artifacts for this ticket, respectively. To reconstruct the TICKET table, the ticket change artifacts are visited in time stamp order. As each ticket change artifact is visited, its key/value pairs are examined. For any key/value pair in which the key is the same as a field in the TICKET table, the value of that pair either replaces or is appended to the previous value of the corresponding field in the TICKET table. Whether a value is replaced or appended is determined by markings in the ticket change artifact itself. Most fields are usually replaced. (For example, to change the status from "Open" to "Fixed" would involve a key value pair |
︙ | ︙ | |||
192 193 194 195 196 197 198 | support the "new-style" tickets. The TICKETCHNG table was added to support new-style tickets. In the new style, comment text is stored with the "icomment" (for "Incremental Comment") key and appears separately, and with its on mimetype, in multiple rows of the TICKETCHNG table. It then falls to the TH1 script code on the View Ticket Page to query the TICKETCHNG table and extract and format | | | 192 193 194 195 196 197 198 199 | support the "new-style" tickets. The TICKETCHNG table was added to support new-style tickets. In the new style, comment text is stored with the "icomment" (for "Incremental Comment") key and appears separately, and with its on mimetype, in multiple rows of the TICKETCHNG table. It then falls to the TH1 script code on the View Ticket Page to query the TICKETCHNG table and extract and format the various comments in time stamp order. |
Added www/tls-nginx.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # Proxying Fossil via HTTPS with nginx One of the [many ways](./ssl.wiki) to provide TLS-encrypted HTTP access (a.k.a. HTTPS) to Fossil is to run it behind a web proxy that supports TLS. This document explains how to use the powerful [nginx web server](http://nginx.org/) to do that. This document is an extension of the [Serving via nginx on Debian][nod] document. Please read that first, then come back here to extend its configuration with TLS. [nod]: ./server/debian/nginx.md ## Install Certbot The [nginx-on-Debian document][nod] had you install a few non-default packages to the system, but there’s one more you need for this guide: $ sudo apt install certbot You can extend this guide to other operating systems by following the instructions found via [the front Certbot web page][cb] instead, telling it what OS and web stack you’re using. Chances are good that they’ve got a good guide for you already. # Configuring Let’s Encrypt, the Easy Way If your web serving needs are simple, [Certbot][cb] can configure nginx for you and keep its certificates up to date. Simply follow Certbot’s [nginx on Ubuntu 18.04 LTS guide][cbnu]. We’d recommend one small change: to use the version of Certbot in the Ubuntu package repository rather than download it from the Certbot site. You should be able to use the nginx configuration given in our [Serving via nginx on Debian][nod] guide with little to no change. The main thing to watch out for is that the TCP port number in the nginx configuration needs to match the value you gave when starting Fossil. If you followed that guide’s advice, it will be 9000. Another option is to use [the `fslsrv` script](/file/tools/fslsrv), in which case the TCP port number will be 12345 or higher. # Configuring Let’s Encrypt, the Hard Way If you’re finding that you can’t get certificates to be issued or renewed using the Easy Way instructions, the problem is usually that your nginx configuration is too complicated for Certbot’s `--nginx` plugin to understand. It attempts to rewrite your nginx configuration files on the fly to achieve the renewal, and if it doesn’t put its directives in the right locations, the domain verification can fail. Let’s Encrypt uses the [Automated Certificate Management Environment][acme] protocol (ACME) to determine whether a given client actually has control over the domain(s) for which it wants a certificate minted. Let’s Encrypt will not blithely let you mint certificates for `google.com` and `paypal.com` just because you ask for it! Your author’s configuration, glossed [in the HTTP-only guide][nod], is complicated enough that the current version of Certbot (0.28 at the time of this writing) can’t cope with it. That’s the primary motivation for me to write this guide: I’m addressing the “me” years hence who needs to upgrade to Ubuntu 20.04 or 22.04 LTS and has forgotten all of this stuff. 😉 ## Step 1: Shifting into Manual The first thing to do is to turn off all of the Certbot automation, because it’ll only get in our way. First, disable the Certbot package’s automatic background updater: $ sudo systemctl disable certbot.timer Next, edit `/etc/letsencrypt/renewal/example.com.conf` to disable the nginx plugins. You’re looking for two lines setting the “install” and “auth” plugins to “nginx”. You can comment them out or remove them entirely. ## Step 2: Configuring nginx This is a straightforward extension to [the HTTP-only configuration](./server/debian/nginx.md#config): server { server_name .foo.net; include local/tls-common; charset utf-8; access_log /var/log/nginx/foo.net-https-access.log; error_log /var/log/nginx/foo.net-https-error.log; # Bypass Fossil for the static Doxygen docs location /doc/html { root /var/www/foo.net; location ~* \.(html|ico|css|js|gif|jpg|png)$ { expires 7d; add_header Vary Accept-Encoding; access_log off; } } # Redirect everything else to the Fossil instance location / { include scgi_params; scgi_pass 127.0.0.1:12345; scgi_param HTTPS "on"; scgi_param SCRIPT_NAME ""; } } server { server_name .foo.net; root /var/www/foo.net; include local/http-certbot-only; access_log /var/log/nginx/foo.net-http-access.log; error_log /var/log/nginx/foo.net-http-error.log; } One big difference between this and the HTTP-only case is that we need two `server { }` blocks: one for HTTPS service, and one for HTTP-only service. ### HTTP over TLS (HTTPS) Service The first `server { }` block includes this file, `local/tls-common`: listen 443 ssl; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; ssl_stapling on; ssl_stapling_verify on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256”; ssl_session_cache shared:le_nginx_SSL:1m; ssl_prefer_server_ciphers on; ssl_session_timeout 1440m; These are the common TLS configuration parameters used by all domains hosted by this server. The first line tells nginx to accept TLS-encrypted HTTP connections on the standard HTTPS port. It is the same as `listen 443; ssl on;` in older versions of nginx. Since all of those domains share a single TLS certificate, we reference the same `example.com/*.pem` files written out by Certbot with the `ssl_certificate*` lines. The `ssl_dhparam` directive isn’t strictly required, but without it, the server becomes vulnerable to the [Logjam attack][lja] because some of the cryptography steps are precomputed, making the attacker’s job much easier. The parameter file this directive references should be generated automatically by the Let’s Encrypt package upon installation, making those parameters unique to your server and thus unguessable. If the file doesn’t exist on your system, you can create it manually, so: $ sudo openssl dhparam -out /etc/letsencrypt/dhparams.pem 2048 Beware, this can take a long time. On a shared Linux host I tried it on running OpenSSL 1.1.0g, it took about 21 seconds, but on a fast, idle iMac running LibreSSL 2.6.5, it took 8 minutes and 4 seconds! The next section is also optional. It enables [OCSP stapling][ocsp], a protocol that improves the speed and security of the TLS connection negotiation. The next section containing the `ssl_protocols` and `ssl_ciphers` lines restricts the TLS implementation to only those protocols and ciphers that are currently believed to be safe and secure. This section is the one most prone to bit-rot: as new attacks on TLS and its associated technologies are discovered, this configuration is likely to need to change. Even if we fully succeed in [keeping this document up-to-date](#evolution), the nature of this guide is to recommend static configurations for your server. You will have to keep an eye on this sort of thing and evolve your local configuration as the world changes around it. Running a TLS certificate checker against your site occasionally is a good idea. The most thorough service I’m aware of is the [Qualys SSL Labs Test][qslt], which gives the site I’m basing this guide on an “A” rating at the time of this writing. The long `ssl_ciphers` line above is based on [their advice][qslc]: the default nginx configuration tells OpenSSL to use whatever ciphersuites it considers “high security,” but some of those have come to be considered “weak” in the time between that judgement and the time of this writing. By explicitly giving the list of ciphersuites we want OpenSSL to use within nginx, we can remove those that become considered weak in the future. <a id=”hsts”></a>There are a few things you can do to get an even better grade, such as to enable [HSTS][hsts], which prevents a particular variety of [man in the middle attack][mitm] where our HTTP-to-HTTPS permanent redirect is intercepted, allowing the attacker to prevent the automatic upgrade of the connection to a secure TLS-encrypted one. I didn’t enable that in the configuration above, because it is something a site administrator should enable only after the configuration is tested and stable, and then only after due consideration. There are ways to lock your users out of your site by jumping to HSTS hastily. When you’re ready, there are [guides you can follow][nest] elsewhere online. ### HTTP-Only Service While we’d prefer not to offer HTTP service at all, we need to do so for two reasons: * The temporary reason is that until we get Let’s Encrypt certificates minted and configured properly, we can’t use HTTPS yet at all. * The ongoing reason is that the Certbot [ACME][acme] HTTP-01 challenge used by the Let’s Encrypt service only runs over HTTP. This is not only because it has to work before HTTPS is first configured, but also because it might need to work after a certificate is accidentally allowed to lapse, to get that server back into a state where it can speak HTTPS safely again. So, from the second `service { }` block, we include this file to set up the minimal HTTP service we require, `local/http-certbot-only`: listen 80; listen [::]:80; # This is expressed as a rewrite rule instead of an "if" because # http://wiki.nginx.org/IfIsEvil #rewrite ^(/.well-known/acme-challenge/.*) $1 break; # Force everything else to HTTPS with a permanent redirect. #return 301 https://$host$request_uri; As written above, this configuration does nothing other than to tell nginx that it’s allowed to serve content via HTTP on port 80 as well. We’ll uncomment the `rewrite` and `return` directives below, when we’re ready to begin testing. Notice that this configuration is very different from that in the [HTTP-only nginx on Debian][nod] guide. Most of that guide’s nginx directives moved up into the TLS `server { }` block, because we eventually want this site to be as close to HTTPS-only as we can get it. ## Step 3: Dry Run We want to first request a dry run, because Let’s Encrypt puts some rather low limits on how often you’re allowed to request an actual certificate. You want to be sure everything’s working before you do that. You’ll run a command something like this: $ sudo certbot certonly --webroot --dry-run \ --webroot-path /var/www/example.com \ -d example.com -d www.example.com \ -d example.net -d www.example.net \ --webroot-path /var/www/foo.net \ -d foo.net -d www.foo.net There are two key options here. First, we’re telling Certbot to use its `--webroot` plugin instead of the automated `--nginx` plugin. With this plugin, Certbot writes the [ACME][acme] HTTP-01 challenge files to the static web document root directory behind each domain. For this example, we’ve got two web roots, one of which holds documents for two different second-level domains (`example.com` and `example.net`) with `www` at the third level being optional. This is a common sort of configuration these days, but you needn’t feel that you must slavishly imitate it; the other web root is for an entirely different domain, also with `www` being optional. Since all of these domains are served by a single nginx instance, we need to give all of this in a single command, because we want to mint a single certificate that authenticates all of these domains. The second key option is `--dry-run`, which tells Certbot not to do anything permanent. We’re just seeing if everything works as expected, at this point. ### Troubleshooting the Dry Run If that didn’t work, try creating a manual test: $ mkdir -p /var/www/example.com/.well-known/acme-challenge $ echo hi > /var/www/example.com/.well-known/acme-challenge/test Then try to pull that file over HTTP — not HTTPS! — as `http://example.com/.well-known/acme-challenge/test`. I’ve found that using Firefox or Safari is better for this sort of thing than Chrome, because Chrome is more aggressive about automatically forwarding URLs to HTTPS even if you requested “`http`”. In extremis, you can do the test manually: $ telnet foo.net 80 GET /.well-known/acme-challenge/test HTTP/1.1 Host: example.com HTTP/1.1 200 OK Server: nginx/1.14.0 (Ubuntu) Date: Sat, 19 Jan 2019 19:43:58 GMT Content-Type: application/octet-stream Content-Length: 3 Last-Modified: Sat, 19 Jan 2019 18:21:54 GMT Connection: keep-alive ETag: "5c436ac2-4" Accept-Ranges: bytes hi You type the first two lines at the remote system, plus the doubled “Enter” to create the blank line, and you get something back that hopefully looks like the rest of the text above. The key bits you’re looking for here are the “hi” line at the end — the document content you created above — and the “200 OK” response code. If you get a 404 or other error response, you need to look into your web server logs to find out what’s going wrong. Note that it’s important to do this test with HTTP/1.1 when debugging a name-based virtual hosting configuration like this. Unless you test only with the primary domain name alias for the server, this test will fail. Using the example configuration above, you can only use the easier-to-type HTTP/1.0 protocol to test the `foo.net` alias. If you’re still running into trouble, the log file written by Certbot can be helpful. It tells you where it’s writing it early in each run. ## Step 4: Getting Your First Certificate Once the dry run is working, you can drop the `--dry-run` option and re-run the long command above. (The one with all the `--webroot*` flags.) This should now succeed, and it will save all of those flag values to your Let’s Encrypt configuration file, so you don’t need to keep giving them. ## Step 5: Test It Edit the `local/http-certbot-only` file and uncomment the `redirect` and `return` directives, then restart your nginx server and make sure it now forces everything to HTTPS like it should: $ sudo systemctl restart nginx Test ideas: * Visit both Fossil and non-Fossil URLs * Log into the repo, log out, and log back in * Clone via `http`: ensure that it redirects to `https`, and that subsequent `fossil sync` commands go directly to `https` due to the 301 permanent redirect. This forced redirect is why we don’t need the Fossil Admin → Access "Redirect to HTTPS on the Login page" setting to be enabled. Not only is it unnecessary with this HTTPS redirect at the front-end proxy level, it would actually [cause an infinite redirect loop if enabled](./ssl.wiki#rloop). ## Step 6: Re-Point Fossil at Your Repositories As of Fossil 2.9, the permanent HTTP-to-HTTPS redirect we enabled above causes Fossil to remember the new URL automatically the first time it’s redirected to it. All you need to do to switch your syncs to HTTPS is: $ cd ~/path/to/checkout $ fossil sync ## Step 7: Renewing Automatically Now that the configuration is solid, you can renew the LE cert with the `certbot` command from above without the `--dry-run` flag plus a restart of nginx: sudo certbot certonly --webroot \ --webroot-path /var/www/example.com \ -d example.com -d www.example.com \ -d example.net -d www.example.net \ --webroot-path /var/www/foo.net \ -d foo.net -d www.foo.net sudo systemctl restart nginx I put those commands in a script in the `PATH`, then arrange to call that periodically. Let’s Encrypt doesn’t let you renew the certificate very often unless forced, and when forced there’s a maximum renewal counter. Nevertheless, some people recommend running this daily and just letting it fail until the server lets you renew. Others arrange to run it no more often than it’s known to work without complaint. Suit yourself. ----------- <a id=”evolution”></a> **Document Evolution** Large parts of this article have been rewritten several times now due to shifting technology in the TLS and proxying spheres. There is no particularly good reason to expect that this sort of thing will not continue to happen, so we consider this to be a living document. If you do not have commit access on the `fossil-scm.org` repository to update this document as the world changes around it, you can discuss this document [on the forum][fd]. This document’s author keeps an eye on the forum and expects to keep this document updated with ideas that appear in that thread. [acme]: https://en.wikipedia.org/wiki/Automated_Certificate_Management_Environment [cb]: https://certbot.eff.org/ [cbnu]: https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx [fd]: https://fossil-scm.org/forum/forumpost/ae6a4ee157 [hsts]: https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security [lja]: https://en.wikipedia.org/wiki/Logjam_(computer_security) [mitm]: https://en.wikipedia.org/wiki/Man-in-the-middle_attack [nest]: https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/ [ocsp]: https://en.wikipedia.org/wiki/OCSP_stapling [qslc]: https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices [qslt]: https://www.ssllabs.com/ssltest/ |
Changes to www/unvers.wiki.
1 2 3 4 5 6 7 8 | <title>Unversioned Content</title> <h1 align="center">Unversioned Content</h1> "Unversioned content" or "unversioned files" are files stored in a Fossil repository without history. Only the newest version of each unversioned file is retained. Though history is omitted, unversioned content is synced between | | | | | 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 | <title>Unversioned Content</title> <h1 align="center">Unversioned Content</h1> "Unversioned content" or "unversioned files" are files stored in a Fossil repository without history. Only the newest version of each unversioned file is retained. Though history is omitted, unversioned content is synced between repositories. In the event of a conflict during a sync, the most recent version of each unversioned file is retained and older versions are discarded. Unversioned files are useful for storing ephemeral content such as builds or frequently changing web pages. The [https://www.fossil-scm.org/fossil/uv/download.html|download] page of the self-hosting Fossil repository is stored as unversioned content, for example. <h2>Accessing Unversioned Files</h2> Unversioned files are <u>not</u> a part of a check-out. Unversioned files are intended to be accessible as web pages using URLs of the form: "http://domain/cgi-script/<b>uv</b>/<i>FILENAME</i>". In other words, the URI method "<b>uv</b>" (short for "unversioned") followed by the name of the unversioned file will retrieve the content of the file. The MIME type is inferred from the filename suffix. The content of unversioned files can also be retrieved using the [/help?cmd=unversioned|fossil unvers cat <i>FILENAME</i>] command. A list of all unversioned files on a server can be seen using the [/help?cmd=/uvlist|/uvlist] URL. ([/uvlist|example]). <h2>Syncing Unversioned Files</h2> Unversioned content is synced between repositories, though not by default. Special commands or command-line options are required. Unversioned content can be synced using the following commands: <blockquote><pre> fossil sync <b>-u</b> fossil clone <b>-u</b> <i>URL local-repo-name</i> fossil unversioned sync |
︙ | ︙ |
Changes to www/webui.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <title>The Fossil Web Interface</title> One of the innovative features of Fossil is its built-in web interface. This web interface provides everything you need to run a software development project: * [./bugtheory.wiki | Ticketing and bug tracking] * [./wikitheory.wiki | Wiki] * [./embeddeddoc.wiki | On-line documentation] * [./event.wiki | Technical notes] * Timelines * Full text search over all of the above * Status information * Graphs of revision and branching history * File and version lists and differences * Download historical versions as ZIP archives * Historical change data | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <title>The Fossil Web Interface</title> One of the innovative features of Fossil is its built-in web interface. This web interface provides everything you need to run a software development project: * [./bugtheory.wiki | Ticketing and bug tracking] * [./wikitheory.wiki | Wiki] * [./embeddeddoc.wiki | On-line documentation] * [./event.wiki | Technical notes] * [./forum.wiki | Forum] * Timelines * Full text search over all of the above * Status information * Graphs of revision and branching history * File and version lists and differences * Download historical versions as ZIP archives * Historical change data |
︙ | ︙ | |||
49 50 51 52 53 54 55 | To start using the built-in Fossil web interface on an existing Fossil repository, simply type this: <b>fossil ui existing-repository.fossil</b> Substitute the name of your repository, of course. | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | To start using the built-in Fossil web interface on an existing Fossil repository, simply type this: <b>fossil ui existing-repository.fossil</b> Substitute the name of your repository, of course. The "ui" command will start a web server running (it figures out an available TCP port to use on its own) and then automatically launches your web browser to point at that server. If you run the "ui" command from within an open check-out, you can omit the repository name: <b>fossil ui</b> The latter case is a very useful short-cut when you are working on a |
︙ | ︙ | |||
105 106 107 108 109 110 111 | your edits will automatically merge with those of your co-workers when your repository synchronizes. You can view summary reports of <b>branches</b> in the check-in graph by visiting the "Branches" link on the menu bar. From those pages you can follow hyperlinks to get additional details. These screens allow you to easily keep track of what is going | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | your edits will automatically merge with those of your co-workers when your repository synchronizes. You can view summary reports of <b>branches</b> in the check-in graph by visiting the "Branches" link on the menu bar. From those pages you can follow hyperlinks to get additional details. These screens allow you to easily keep track of what is going on with separate sub-teams within your project team. The "Files" link on the menu allows you to browse through the <b>file hierarchy</b> of the project and to view complete changes histories on individual files, with hyperlinks to the check-ins that made those changes, and with diffs and annotated diffs between versions. The web interface supports [./embeddeddoc.wiki | embedded documentation]. |
︙ | ︙ |
Changes to www/wikitheory.wiki.
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 | <title>Wiki In Fossil</title> <h2>Introduction</h2> Fossil uses [/wiki_rules | Fossil wiki markup] and/or [/md_rules | Markdown markup] for many things: * Stand-alone wiki pages. * Description and comments in [./bugtheory.wiki | bug reports]. * Check-in comments. * [./embeddeddoc.wiki | Embedded documentation] files whose name ends in ".wiki" or ".md" or ".markdown". * [./event.wiki | Technical notes]. The [/wiki_rules | formatting rules for fossil wiki] are designed to be simple and intuitive. The idea is that wiki provides paragraph breaks, numbered and bulleted lists, and hyperlinking for simple documents together with a safe subset of HTML for more complex formatting tasks. The [/md_rules | Markdown formatting rules] are more complex, but are also more widely known, and are thus provided as an alternative. <h2>Stand-alone Wiki Pages</h2> Each wiki page has its own revision history which is independent of the sequence of check-ins (check-ins). Wiki pages can branch and merge just like check-ins, though as of this writing (2008-07-29) there is no mechanism in the user interface to support branching and merging. The current implementation of the wiki shows the version of the wiki | > > | | 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 | <title>Wiki In Fossil</title> <h2>Introduction</h2> Fossil uses [/wiki_rules | Fossil wiki markup] and/or [/md_rules | Markdown markup] for many things: * Stand-alone wiki pages. * Description and comments in [./bugtheory.wiki | bug reports]. * Check-in comments. * [./embeddeddoc.wiki | Embedded documentation] files whose name ends in ".wiki" or ".md" or ".markdown". * [./event.wiki | Technical notes]. * [./forum.wiki | Forum messages]. * Auxiliary notes on check-ins and branches. The [/wiki_rules | formatting rules for fossil wiki] are designed to be simple and intuitive. The idea is that wiki provides paragraph breaks, numbered and bulleted lists, and hyperlinking for simple documents together with a safe subset of HTML for more complex formatting tasks. The [/md_rules | Markdown formatting rules] are more complex, but are also more widely known, and are thus provided as an alternative. <h2>Stand-alone Wiki Pages</h2> Each wiki page has its own revision history which is independent of the sequence of check-ins (check-ins). Wiki pages can branch and merge just like check-ins, though as of this writing (2008-07-29) there is no mechanism in the user interface to support branching and merging. The current implementation of the wiki shows the version of the wiki page that has the most recent time stamp. In other words, if two users make unrelated changes to the same wiki page on separate repositories and those repositories are synced, the wiki page will fork. The web interface will display whichever edit was checked in last. The other edit can be found in the history. The file format will support merging the branches back together, but there is no mechanism in the user interface (yet) to perform the merge. |
︙ | ︙ | |||
54 55 56 57 58 59 60 | so that only developers with check-in privileges can change it. Embedded documentation serves this latter purpose. Both forms of documentation use the exact same markup. Some projects may choose to use both forms of documentation at the same time. Because the same format is used, it is trivial to move a file from wiki to embedded documentation or back again as the project evolves. | | > > > > > > > > > > > > > > > > > | 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 | so that only developers with check-in privileges can change it. Embedded documentation serves this latter purpose. Both forms of documentation use the exact same markup. Some projects may choose to use both forms of documentation at the same time. Because the same format is used, it is trivial to move a file from wiki to embedded documentation or back again as the project evolves. <h2>Bug-reports and check-in comments and Forum messages</h2> The comments on check-ins and the text in the descriptions of bug reports both use wiki formatting. Exactly the same set of formatting rules apply. There is never a need to learn one formatting language for documentation and a different markup for bugs or for check-in comments. <h2>Auxiliary notes attached to check-ins or branches</h2> Stand-alone wiki pages with special names "branch/<i>BRANCHNAME</i>" or "checkin/<i>HASH</i>" are associated with the corresponding branch or check-in. The wiki text appears in an "About" section of timelines and info screens. Examples: * [/timeline?r=graph-test-branch] shows the text of the [/wiki?name=branch/graph-test-branch|branch/graph-test-branch] wiki page at the top of the timeline * [/info/19c60b7fc9e2] shows the text of the [/wiki?name=checkin/19c60b7fc9e2400e56a6f938bbad0e34ca746ca2eabdecac10945539f1f5e8c6|checkin/19c60b7fc9e2...] wiki page in the "About" section. This special wiki pages are very useful for recording historical notes. |