ADDED .fossil-settings/clean-glob Index: .fossil-settings/clean-glob ================================================================== --- /dev/null +++ .fossil-settings/clean-glob @@ -0,0 +1,17 @@ +*.a +*.lib +*.manifest +*.o +*.obj +*.pdb +*.res +Makefile +bld/* +wbld/* +win/*.c +win/*.h +win/*.exe +win/headers +win/linkopts +autoconfig.h +config.log ADDED .fossil-settings/ignore-glob Index: .fossil-settings/ignore-glob ================================================================== --- /dev/null +++ .fossil-settings/ignore-glob @@ -0,0 +1,5 @@ +compat/openssl* +compat/tcl* +fossil +fossil.exe +win/fossil.exe ADDED .fossil-settings/keep-glob Index: .fossil-settings/keep-glob ================================================================== --- /dev/null +++ .fossil-settings/keep-glob @@ -0,0 +1,5 @@ +compat/openssl* +compat/tcl* +fossil +fossil.exe +win/fossil.exe ADDED Makefile.Cygwin.in Index: Makefile.Cygwin.in ================================================================== --- /dev/null +++ Makefile.Cygwin.in @@ -0,0 +1,52 @@ +#!/usr/bin/make +# +# This is the top-level makefile for Fossil when the build is occurring +# on the Cygwin platform. +# +#### The toplevel directory of the source tree. Fossil can be built +# in a directory that is separate from the source tree. Just change +# the following to point from the build directory to the src/ folder. +# +SRCDIR = @srcdir@/src + +#### The directory into which object code files should be written. +# Having a "./" prefix in the value of this variable breaks our use of the +# "makeheaders" tool when running make on the MinGW platform, apparently +# due to some command line argument manipulation performed automatically +# by the shell. +# +# +OBJDIR = bld + +#### C Compiler and options for use in building executables that +# will run on the platform that is doing the build. This is used +# to compile code-generator programs as part of the build process. +# See TCC below for the C compiler for building the finished binary. +# +BCC = @CC_FOR_BUILD@ + +#### The suffix to add to final executable file. When cross-compiling +# to windows, make this ".exe". Otherwise leave it blank. +# +E = @EXEEXT@ + +TCC = @CC@ + +#### 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 = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ +TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H +INSTALLDIR =$(DESTDIR)@prefix@/bin +USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ +FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ +FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ +FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ +SQLITE_CFLAGS += -DSQLITE_WIN32_NO_ANSI -DSQLITE_WINNT_MAX_PATH_CHARS=4096 + +include $(SRCDIR)/main.mk + +distclean: clean + rm -f autoconfig.h config.log Makefile Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -37,15 +37,16 @@ # care about testing the end result, this can be blank. # TCLSH = tclsh LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ -TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -Dstrcmp=fossil_strcmp +TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H INSTALLDIR = $(DESTDIR)@prefix@/bin USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ FOSSIL_ENABLE_TCL = @FOSSIL_ENABLE_TCL@ FOSSIL_ENABLE_TCL_STUBS = @FOSSIL_ENABLE_TCL_STUBS@ +FOSSIL_ENABLE_TCL_PRIVATE_STUBS = @FOSSIL_ENABLE_TCL_PRIVATE_STUBS@ include $(SRCDIR)/main.mk distclean: clean rm -f autoconfig.h config.log Makefile Index: VERSION ================================================================== --- VERSION +++ VERSION @@ -1,1 +1,1 @@ -1.25 +1.28 Index: ajax/i-test/rhino-test.js ================================================================== --- ajax/i-test/rhino-test.js +++ ajax/i-test/rhino-test.js @@ -183,11 +183,11 @@ onResponse:function(resp,req){ rs = resp; } }); assertResponseOK(rs); - assert(3 == rs.payload.artifact.parents.length, 'Got 3 parent artifacts.'); + assert(3 == rs.payload.parents.length, 'Got 3 parent artifacts.'); } testFetchCheckinArtifact.description = '/json/artifact/CHECKIN'; function testAnonLogout(){ var rs; Index: auto.def ================================================================== --- auto.def +++ auto.def @@ -5,17 +5,18 @@ options { with-openssl:path|auto|none => {Look for openssl in the given path, or auto or none} with-zlib:path => {Look for zlib in the given path} with-tcl:path => {Enable Tcl integration, with Tcl in the specified path} - with-tcl-stubs=0 => {Enable Tcl integration via stubs mechanism} - internal-sqlite=1 => {Don't use the internal sqlite, use the system one} + with-tcl-stubs=0 => {Enable Tcl integration via stubs library mechanism} + with-tcl-private-stubs=0 + => {Enable Tcl integration via private stubs mechanism} + internal-sqlite=1 => {Don't use the internal SQLite, use the system one} static=0 => {Link a static executable} lineedit=1 => {Disable line editing} fossil-debug=0 => {Build with fossil debugging enabled} json=0 => {Build with fossil JSON API enabled} - markdown=0 => {Build with markdown engine enabled} } # sqlite wants these types if possible cc-with {-includes {stdint.h inttypes.h}} { cc-check-types uint32_t uint16_t int16_t uint8_t @@ -61,10 +62,14 @@ user-error "system sqlite3 not found" } find_internal_sqlite } + +if {[string match *-solaris* [get-define host]]} { + define-append EXTRA_CFLAGS -D_XOPEN_SOURCE=500 +} if {[opt-bool fossil-debug]} { define-append EXTRA_CFLAGS -DFOSSIL_DEBUG } @@ -75,14 +80,13 @@ # reading config.h first. define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON define FOSSIL_ENABLE_JSON } -if {[opt-bool markdown]} { - define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_MARKDOWN - define FOSSIL_ENABLE_MARKDOWN -} +#if {[opt-bool markdown]} { +# # no-op. Markdown is now enabled by default. +#} if {[opt-bool static]} { # XXX: This will not work on all systems. define-append EXTRA_LDFLAGS -static } @@ -98,46 +102,63 @@ user-error "zlib not found please install it or specify the location with --with-zlib" } set tclpath [opt-val with-tcl] if {$tclpath ne ""} { + set tclprivatestubs [opt-bool with-tcl-private-stubs] # Note parse-tclconfig-sh is in autosetup/local.tcl if {$tclpath eq "1"} { - # Use the system Tcl. Look in some likely places. - array set tclconfig [parse-tclconfig-sh \ - /usr /usr/local /usr/share /opt/local] - set msg "on your system" + if {$tclprivatestubs} { + set tclconfig(TCL_INCLUDE_SPEC) -Icompat/tcl-8.6/generic + set tclconfig(TCL_VERSION) {Private Stubs} + set tclconfig(TCL_PATCH_LEVEL) {} + set tclconfig(TCL_PREFIX) {compat/tcl-8.6} + set tclconfig(TCL_LD_FLAGS) { } + } else { + # Use the system Tcl. Look in some likely places. + array set tclconfig [parse-tclconfig-sh \ + compat/tcl-8.6/unix compat/tcl-8.6/win \ + /usr /usr/local /usr/share /opt/local] + set msg "on your system" + } } else { array set tclconfig [parse-tclconfig-sh $tclpath] set msg "at $tclpath" } if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} { user-error "Cannot find Tcl $msg" } set tclstubs [opt-bool with-tcl-stubs] - if {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} { + if {$tclprivatestubs} { + define FOSSIL_ENABLE_TCL_PRIVATE_STUBS + define USE_TCL_STUBS + } elseif {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} { set libs "$tclconfig(TCL_STUB_LIB_SPEC)" define FOSSIL_ENABLE_TCL_STUBS define USE_TCL_STUBS } else { set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)" } set cflags $tclconfig(TCL_INCLUDE_SPEC) - cc-with [list -cflags $cflags -libs $libs] { - if {$tclstubs} { - if {![cc-check-functions Tcl_InitStubs]} { - user-error "Cannot find a usable Tcl stubs library $msg" - } - } else { - if {![cc-check-functions Tcl_CreateInterp]} { - user-error "Cannot find a usable Tcl library $msg" + if {!$tclprivatestubs} { + cc-with [list -cflags $cflags -libs $libs] { + if {$tclstubs} { + if {![cc-check-functions Tcl_InitStubs]} { + user-error "Cannot find a usable Tcl stubs library $msg" + } + } else { + if {![cc-check-functions Tcl_CreateInterp]} { + user-error "Cannot find a usable Tcl library $msg" + } } } } set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL) msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)" - define-append LIBS $libs + if {!$tclprivatestubs} { + define-append LIBS $libs + } define-append EXTRA_CFLAGS $cflags define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS) define FOSSIL_ENABLE_TCL } @@ -233,8 +254,10 @@ # Check for getpassphrase() for Solaris 10 where getpass() truncates to 10 chars if {![cc-check-functions getpassphrase]} { # Haiku needs this cc-check-function-in-lib getpass bsd } +cc-check-function-in-lib dlopen dl make-template Makefile.in +make-template Makefile.Cygwin.in make-config-header autoconfig.h -auto {USE_* FOSSIL_*} Index: autosetup/README.autosetup ================================================================== --- autosetup/README.autosetup +++ autosetup/README.autosetup @@ -1,1 +1,1 @@ -This is autosetup v0.6.4. See http://msteveb.github.com/autosetup/ +This is autosetup v0.6.5. See http://msteveb.github.com/autosetup/ Index: autosetup/autosetup ================================================================== --- autosetup/autosetup +++ autosetup/autosetup @@ -3,11 +3,11 @@ # All rights reserved # vim:se syntax=tcl: # \ dir=`dirname "$0"`; exec "`$dir/find-tclsh`" "$0" "$@" -set autosetup(version) 0.6.4 +set autosetup(version) 0.6.5 # Can be set to 1 to debug early-init problems set autosetup(debug) 0 ################################################################## @@ -85,11 +85,11 @@ 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 (in the 'autosetup/' subdirectory)" - force init => "create an initial 'configure' script if none exists" + force init:=help => "create initial auto.def, etc. Use --init=help for known types" # Undocumented options option-checking=1 nopager quiet timing @@ -116,10 +116,15 @@ # 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 + foreach file [glob -nocomplain $autosetup(libdir)/*.auto $autosetup(libdir)/*/*.auto] { + automf_load source $file + } if {[opt-val help] ne ""} { incr autosetup(showhelp) use help autosetup_help [opt-val help] @@ -128,13 +133,13 @@ if {[opt-val {manual ref reference}] ne ""} { use help autosetup_reference [opt-val {manual ref reference}] } - if {[opt-bool init]} { + if {[opt-val init] ne ""} { use init - autosetup_init + autosetup_init [opt-val init] } if {[opt-val install] ne ""} { use install autosetup_install [opt-val install] @@ -141,11 +146,11 @@ } if {![file exists $autosetup(autodef)]} { # Check for invalid option first options {} - user-error "No auto.def found in $autosetup(srcdir)" + user-error "No auto.def found in \"$autosetup(srcdir)\" (use [file tail $::autosetup(exe)] --init to create one)" } # Parse extra arguments into autosetup(cmdline) foreach arg $argv { if {[regexp {([^=]*)=(.*)} $arg -> n v]} { @@ -165,18 +170,23 @@ define AUTOREMAKE $cmd # 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 if {$autosetup(debug)} { - parray define + msg-result "Writing all defines to config.log" + configlog "================ defines ======================" + foreach n [lsort [array names define]] { + configlog "define $n $define($n)" + } } exit 0 } @@ -419,22 +429,27 @@ } proc config_guess {} { if {[file-isexec $::autosetup(dir)/config.guess]} { exec-with-stderr sh $::autosetup(dir)/config.guess + if {[catch {exec-with-stderr sh $::autosetup(dir)/config.guess} alias]} { + user-error $alias + } + return $alias } else { configlog "No 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)/config.sub]} { - exec-with-stderr sh $::autosetup(dir)/config.sub $alias - } else { - return $alias + if {[catch {exec-with-stderr sh $::autosetup(dir)/config.sub $alias} alias]} { + user-error $alias + } } + return $alias } # @define name ?value=1? # # Defines the named variable to the given value. @@ -752,12 +767,17 @@ lappend ::autosetup(notices) $msg } # Incorrect usage in the auto.def file. Identify the location. proc autosetup-error {msg} { + autosetup-full-error [error-location $msg] +} + +# Like autosetup-error, except $msg is the full error message. +proc autosetup-full-error {msg} { show-notices - puts stderr [error-location $msg] + puts stderr $msg exit 1 } proc show-notices {} { if {$::autosetup(msg-checking)} { @@ -863,32 +883,55 @@ # # @use module ... # # Load the given library modules. -# e.g. use cc cc-shared +# e.g. 'use cc cc-shared' +# +# Note that module 'X' is implemented in either 'autosetup/X.tcl' +# 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 { if {[info exists ::libmodule($m)]} { continue } set ::libmodule($m) 1 if {[info exists ::modsource($m)]} { - uplevel #0 eval $::modsource($m) + automf_load eval $::modsource($m) } else { - set source $::autosetup(libdir)/${m}.tcl - if {[file exists $source]} { - uplevel #0 [list source $source] + set sources [list $::autosetup(libdir)/${m}.tcl $::autosetup(libdir)/${m}/init.tcl] + set found 0 + foreach source $sources { + if {[file exists $source]} { + incr 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 { - puts "Looking for $source" autosetup-error "use: No such module: $m" } } } } + +# 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] + } +} # Initial settings set autosetup(exe) $::argv0 set autosetup(istcl) 1 set autosetup(start) [clock millis] @@ -1144,13 +1187,13 @@ } # 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 "" && ![string match "not a tty" [exec tty]]} { + if {![opt-bool nopager] && [getenv PAGER ""] ne "" && [isatty? stdin] && [isatty? stdout]} { catch { - exec [info nameofexecutable] $::argv0 --nopager {*}$::argv | [getenv PAGER] >@stdout <@stdin 2>/dev/null + exec [info nameofexecutable] $::argv0 --nopager {*}$::argv |& [getenv PAGER] >@stdout <@stdin } exit 0 } } @@ -1276,59 +1319,60 @@ # Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/ # All rights reserved # Module to help create auto.def and configure -proc autosetup_init {} { - set create_configure 1 - 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 "Use autosetup --init --force to overwrite." - set create_configure 0 - } - } 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 {$create_configure} { - if {!$::autosetup(installed)} { - user-notice "Warning: Initialising from the development version of autosetup" - - writefile configure "#!/bin/sh\nWRAPPER=\"\$0\"; export WRAPPER; exec $::autosetup(dir)/autosetup \"\$@\"\n" - } else { - writefile configure \ -{#!/bin/sh -dir="`dirname "$0"`/autosetup" -WRAPPER="$0"; export WRAPPER; exec "`$dir/find-tclsh`" "$dir/autosetup" "$@" -} - } - catch {exec chmod 755 configure} - } - if {![file exists auto.def]} { - puts "I don't see auto.def, so I will create a default one." - writefile auto.def {# Initial auto.def created by 'autosetup --init' - -use cc - -# Add any user options here -options { -} - -make-config-header config.h -make-template Makefile.in -} - } - if {![file exists Makefile.in]} { - puts "Note: I don't see Makefile.in. You will probably need to create one." - } - - exit 0 +proc autosetup_init {type} { + set help 0 + if {$type in {? help}} { + incr help + } elseif {![dict exists $::autosetup(inittypes) $type]} { + puts "Unknown type, --init=$type" + incr help + } + if {$help} { + puts "Use one of the following types (e.g. --init=make)\n" + foreach type [lsort [dict keys $::autosetup(inittypes)]] { + lassign [dict get $::autosetup(inittypes) $type] desc + # XXX: Use the options-show code to wrap the description + puts [format "%-10s %s" $type $desc] + } + exit 0 + } + lassign [dict get $::autosetup(inittypes) $type] desc script + + puts "Initialising $type: $desc\n" + + # All initialisations happens in the top level srcdir + cd $::autosetup(srcdir) + + uplevel #0 $script + + exit 0 +} + +proc autosetup_add_init_type {type desc script} { + dict set ::autosetup(inittypes) $type [list $desc $script] +} + +# This is for in creating build-system init scripts +# +# If the file doesn't exist, create it containing $contents +# If the file does exist, only overwrite if --force is specified. +# +proc autosetup_check_create {filename contents} { + if {[file exists $filename]} { + if {!$::autosetup(force)} { + puts "I see $filename already exists." + return + } else { + puts "I will overwrite the existing $filename because you used --force." + } + } else { + puts "I don't see $filename, so I will create it." + } + writefile $filename $contents } } # ----- module install ----- @@ -1343,11 +1387,11 @@ cd $dir file mkdir autosetup set f [open autosetup/autosetup w] - set publicmodules {} + set publicmodules $::autosetup(libdir)/default.auto # 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 --##"} { @@ -1391,14 +1435,39 @@ } error]} { user-error "Failed to install autosetup: $error" } puts "Installed [autosetup_version] to autosetup/" - catch {exec [info nameofexecutable] autosetup/autosetup --init >@stdout 2>@stderr} + + # Now create 'configure' if necessary + autosetup_create_configure exit 0 } + +proc autosetup_create_configure {} { + 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." + } + writefile configure \ +{#!/bin/sh +dir="`dirname "$0"`/autosetup" +WRAPPER="$0"; export WRAPPER; exec "`$dir/find-tclsh`" "$dir/autosetup" "$@" +} + catch {exec chmod 755 configure} +} # Append the contents of $file to filehandle $f proc autosetup_install_append {f file} { set in [open $file] puts $f [read $in] @@ -1539,19 +1608,32 @@ if {[llength $args]} { return [lindex $args 0] } return -code error "environment variable \"$name\" does not exist" } -} elseif {$autosetup(iswin)} { - # On Windows, backslash convert all environment variables - # (Assume that Tcl does this for us) - proc getenv {name args} { - string map {\\ /} [env $name {*}$args] + proc isatty? {channel} { + dict exists [fconfigure $channel] -xchar } } else { - # Jim on unix is simple - alias getenv env + if {$autosetup(iswin)} { + # On Windows, backslash convert all environment variables + # (Assume that Tcl does this for us) + proc getenv {name args} { + string map {\\ /} [env $name {*}$args] + } + } else { + # Jim on unix is simple + alias getenv env + } + proc isatty? {channel} { + set tty 0 + catch { + # isatty is a recent addition to Jim Tcl + set tty [$channel isatty] + } + return $tty + } } # In case 'file normalize' doesn't exist # proc file-normalize {path} { @@ -1596,50 +1678,46 @@ #puts "Skipping $info(file):$info(line)" } return $msg } -# Similar to error-location, but called when user code generates an error -# In this case we want to show the stack trace in user code, but not in autosetup code -# (unless --debug is enabled) +# If everything is working properly, the only errors which occur +# should be generated in user code (e.g. auto.def). +# By default, we only want to show the error location in user code. +# We use [info frame] to achieve this, but it works differently on Tcl and Jim. +# +# This is designed to be called for incorrect usage in auto.def, via autosetup-error # proc error-stacktrace {msg} { - if {$::autosetup(istcl)} { - if {[regexp {file "([^ ]*)" line ([0-9]*)} $::errorInfo dummy file line]} { - return "[relative-path $file]:$line $msg\n$::errorInfo" - } - return $::errorInfo - } else { - # Prepend a live stacktrace to the error stacktrace, omitting the current level - set stacktrace [concat [info stacktrace] [lrange [stacktrace] 3 end]] - - if {!$::autosetup(debug)} { - # Omit any levels from autosetup or with no file - set newstacktrace {} - foreach {p f l} $stacktrace { - if {[string match "*autosetup" $f] || $f eq ""} { - #puts "Skipping $p $f:$l" - continue - } - lappend newstacktrace $p $f $l - } - set stacktrace $newstacktrace - } - - # Convert filenames to relative paths - set newstacktrace {} - foreach {p f l} $stacktrace { - lappend newstacktrace $p [relative-path $f] $l - } - lassign $newstacktrace p f l - if {$f ne ""} { - set prefix "$f:$l: " - } else { - set prefix "" - } - - return "${prefix}Error: $msg\n[stackdump $newstacktrace]" + if {$::autosetup(debug)} { + return -code error $msg + } + # Search back through the stack trace for the first error in a .def file + for {set i 1} {$i < [info level]} {incr i} { + if {$::autosetup(istcl)} { + array set info [info frame -$i] + } else { + lassign [info frame -$i] info(caller) info(file) info(line) + } + if {[string match *.def $info(file)]} { + return "[relative-path $info(file)]:$info(line): Error: $msg" + } + #puts "Skipping $info(file):$info(line)" + } + return $msg +} + +# Given the return from [catch {...} msg opts], returns an appropriate +# error message. A nice one for Jim and a less-nice one for Tcl. +# +# This is designed for developer errors, e.g. in module code +# +proc error-dump {msg opts} { + if {$::autosetup(istcl)} { + return "Error: [dict get $opts -errorinfo]" + } else { + return "Error: $msg\n[stackdump $opts(-errorinfo)]" } } } # ----- module text-formatting ----- Index: autosetup/cc-lib.tcl ================================================================== --- autosetup/cc-lib.tcl +++ autosetup/cc-lib.tcl @@ -73,5 +73,89 @@ msg-result "unknown" } } return $rc } + +# @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 [subst -nobackslashes { + printf("minimum alignment is %d == %d\n", ${keyword}(char), ${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 +} Index: autosetup/cc-shared.tcl ================================================================== --- autosetup/cc-shared.tcl +++ autosetup/cc-shared.tcl @@ -5,74 +5,99 @@ # # 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 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 to strip a dynamic library module-options {} -foreach i {SH_LINKFLAGS SH_CFLAGS SH_LDFLAGS SHOBJ_CFLAGS SHOBJ_LDFLAGS} { - define $i "" -} - +# 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_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 SH_CFLAGS -dynamic - define SH_LDFLAGS "-dynamiclib" define SHOBJ_CFLAGS "-dynamic -fno-common" define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup" - define SHOBJ_LDFLAGS_R "-bundle" - define LD_LIBRARY_PATH DYLD_LIBRARY_PATH - } - *-*-ming* { - define SH_LDFLAGS -shared - define SHOBJ_LDFLAGS -shared - define SHOBJ_LDFLAGS_R -shared - } - *-*-cygwin { - define SH_LDFLAGS -shared - define SHOBJ_LDFLAGS -shared + 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 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_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, + } else { + # sparc has a very small GOT table limit, so use -fPIC + define SH_CFLAGS -fPIC + define SHOBJ_CFLAGS -fPIC + } } *-*-solaris* { - # XXX: These haven't been fully tested. - #define SH_LINKFLAGS -Wl,-export-dynamic - define SH_CFLAGS -Kpic - define SHOBJ_CFLAGS -Kpic - define SHOBJ_LDFLAGS "-G" + 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, + } } *-*-hpux { # XXX: These haven't been tested - define SH_LINKFLAGS -Wl,+s - define SH_CFLAGS +z define SHOBJ_CFLAGS "+O3 +z" define SHOBJ_LDFLAGS -b + define SH_CFLAGS +z + define SH_LINKFLAGS -Wl,+s define LD_LIBRARY_PATH SHLIB_PATH } - sparc* { - # sparc has a very small GOT table limit, so use -fPIC - define SH_LINKFLAGS -rdynamic - define SH_CFLAGS -fPIC - define SH_LDFLAGS -shared - define SHOBJ_CFLAGS -fPIC - define SHOBJ_LDFLAGS -shared - } - * { - # Generic Unix settings - define SH_LINKFLAGS -rdynamic - define SH_CFLAGS -fpic - define SH_LDFLAGS -shared - define SHOBJ_CFLAGS -fpic - define SHOBJ_LDFLAGS -shared - } } if {![is-defined SHOBJ_LDFLAGS_R]} { define SHOBJ_LDFLAGS_R [get-define SHOBJ_LDFLAGS] } Index: autosetup/cc.tcl ================================================================== --- autosetup/cc.tcl +++ autosetup/cc.tcl @@ -114,11 +114,11 @@ 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 + msg-quiet cc-check-includes {*}$deps foreach i $deps { if {[have-feature $i]} { lappend with $i } } @@ -131,16 +131,18 @@ cctest -includes $each } } } -# @cc-include-needs include required +# @cc-include-needs include required ... # # Ensures that when checking for 'include', a check is first -# made for 'required', and if found, it is #included -proc cc-include-needs {file depfile} { - dict set ::autosetup(cc-include-deps) $file $depfile 1 +# made for each 'required' file, and if found, it is #included +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. @@ -254,21 +256,29 @@ # 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] set exe [get-env $TOOL [get-define cross]$tool] - if {![find-executable $exe]} { - user-error "Failed to find $exe" + if {[find-executable {*}$exe]} { + define $TOOL $exe + continue + } + if {[find-executable {*}$tool]} { + msg-result "Warning: Failed to find $exe, falling back to $tool which may be incorrect" + define $TOOL $tool + continue } - define $TOOL $exe + user-error "Failed to find $exe" } } # @cc-check-progs prog ... # @@ -489,18 +499,12 @@ if {!$opts(-link)} { set tmp conftest__.o lappend cmdline -c } - lappend cmdline {*}$opts(-cflags) - - switch -glob -- [get-define host] { - *-*-darwin* { - # Don't generate .dSYM directories - lappend cmdline -gstabs - } - } + lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""] + lappend cmdline $src -o $tmp {*}$opts(-libs) # At this point we have the complete command line and the # complete source to be compiled. Get the result from cache if # we can @@ -587,20 +591,20 @@ } -none { continue } -str { - set value \"$value\" + set value \"[string map [list \\ \\\\ \" \\\"] $value]\" } -auto { # Automatically determine the type if {$value eq "0"} { lappend lines "/* #undef $n */" continue } if {![string is integer -strict $value]} { - set value \"$value\" + set value \"[string map [list \\ \\\\ \" \\\"] $value]\" } } "" { continue } @@ -657,12 +661,10 @@ } # CXXFLAGS default to CFLAGS if not specified define CXXFLAGS [get-env CXXFLAGS [get-define CFLAGS]] -cc-check-tools ld - # May need a CC_FOR_BUILD, so look for one 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 ", "]" @@ -677,9 +679,19 @@ msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]" if {[get-define CXX] ne "false"} { msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS]" } msg-result "Build C compiler...[get-define CC_FOR_BUILD]" + +# On Darwin, we prefer to use -gstabs to avoid creating .dSYM directories +# but some compilers don't support -gstabs, so test for it here. +switch -glob -- [get-define host] { + *-*-darwin* { + if {[cctest -cflags {-gstabs}]} { + define cc-default-debug -gstabs + } + } +} if {![cc-check-includes stdlib.h]} { user-error "Compiler does not work. See config.log" } Index: autosetup/config.guess ================================================================== --- autosetup/config.guess +++ autosetup/config.guess @@ -802,10 +802,13 @@ echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) Index: autosetup/config.sub ================================================================== --- autosetup/config.sub +++ autosetup/config.sub @@ -796,10 +796,14 @@ ;; mvs) basic_machine=i370-ibm os=-mvs ;; + msys) + basic_machine=i386-pc + os=-msys + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) @@ -1313,11 +1317,11 @@ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ ADDED autosetup/default.auto Index: autosetup/default.auto ================================================================== --- /dev/null +++ autosetup/default.auto @@ -0,0 +1,25 @@ +# Copyright (c) 2012 WorkWare Systems http://www.workware.net.au/ +# All rights reserved + +# Auto-load module for 'make' build system integration + +use init + +autosetup_add_init_type make {Simple "make" build system} { + autosetup_check_create auto.def \ +{# Initial auto.def created by 'autosetup --init=make' + +use cc + +# Add any user options here +options { +} + +make-config-header config.h +make-template Makefile.in +} + + if {![file exists Makefile.in]} { + puts "Note: I don't see Makefile.in. You will probably need to create one." + } +} Index: autosetup/jimsh0.c ================================================================== --- autosetup/jimsh0.c +++ autosetup/jimsh0.c @@ -37,10 +37,11 @@ #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_SYS_TIME_H #define HAVE_DIRENT_H #define HAVE_UNISTD_H #endif #ifndef JIM_WIN32COMPAT_H @@ -184,11 +185,11 @@ #endif #define UCHAR(c) ((unsigned char)(c)) -#define JIM_VERSION 73 +#define JIM_VERSION 74 #define JIM_OK 0 #define JIM_ERR 1 #define JIM_RETURN 2 #define JIM_BREAK 3 @@ -320,14 +321,14 @@ #define Jim_GetHashTableSize(ht) ((ht)->size) #define Jim_GetHashTableUsed(ht) ((ht)->used) typedef struct Jim_Obj { - int refCount; char *bytes; - int length; const struct Jim_ObjType *typePtr; + int refCount; + int length; union { jim_wide wideValue; @@ -532,10 +533,11 @@ 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; @@ -663,12 +665,10 @@ JIM_EXPORT Jim_Obj * Jim_NewObj (Jim_Interp *interp); JIM_EXPORT void Jim_FreeObj (Jim_Interp *interp, Jim_Obj *objPtr); JIM_EXPORT void Jim_InvalidateStringRep (Jim_Obj *objPtr); -JIM_EXPORT void Jim_InitStringRep (Jim_Obj *objPtr, const char *bytes, - int length); JIM_EXPORT Jim_Obj * Jim_DuplicateObj (Jim_Interp *interp, Jim_Obj *objPtr); JIM_EXPORT const char * Jim_GetString(Jim_Obj *objPtr, int *lenPtr); JIM_EXPORT const char *Jim_String(Jim_Obj *objPtr); @@ -875,10 +875,12 @@ 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_CheckSignal(Jim_Interp *interp); +#define Jim_CheckSignal(i) ((i)->signal_level && (i)->sigmask) JIM_EXPORT int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName); JIM_EXPORT void Jim_FreeLoadHandles(Jim_Interp *interp); @@ -1078,13 +1080,108 @@ "\n" "\n" "\n" "\n" "\n" +"\n" "\n" "package require readdir\n" "\n" +"\n" +"proc glob.globdir {dir pattern} {\n" +" set result {}\n" +" set files [readdir $dir]\n" +" lappend files . ..\n" +"\n" +" foreach name $files {\n" +" if {[string match $pattern $name]} {\n" +"\n" +" if {[string index $name 0] eq \".\" && [string index $pattern 0] ne \".\"} {\n" +" continue\n" +" }\n" +" lappend result $name\n" +" }\n" +" }\n" +"\n" +" return $result\n" +"}\n" +"\n" +"\n" +"\n" +"\n" +"proc glob.explode {pattern} {\n" +" set oldexp {}\n" +" set newexp {\"\"}\n" +"\n" +" while 1 {\n" +" set oldexp $newexp\n" +" set newexp {}\n" +" set ob [string first \\{ $pattern]\n" +" set cb [string first \\} $pattern]\n" +"\n" +" if {$ob < $cb && $ob != -1} {\n" +" set mid [string range $pattern 0 $ob-1]\n" +" set subexp [lassign [glob.explode [string range $pattern $ob+1 end]] pattern]\n" +" if {$pattern eq \"\"} {\n" +" error \"unmatched open brace in glob pattern\"\n" +" }\n" +" set pattern [string range $pattern 1 end]\n" +"\n" +" foreach subs $subexp {\n" +" foreach sub [split $subs ,] {\n" +" foreach old $oldexp {\n" +" lappend newexp $old$mid$sub\n" +" }\n" +" }\n" +" }\n" +" } elseif {$cb != -1} {\n" +" set suf [string range $pattern 0 $cb-1]\n" +" set rest [string range $pattern $cb end]\n" +" break\n" +" } else {\n" +" set suf $pattern\n" +" set rest \"\"\n" +" break\n" +" }\n" +" }\n" +"\n" +" foreach old $oldexp {\n" +" lappend newexp $old$suf\n" +" }\n" +" linsert $newexp 0 $rest\n" +"}\n" +"\n" +"\n" +"\n" +"proc glob.glob {base pattern} {\n" +" set dir [file dirname $pattern]\n" +" if {$pattern eq $dir || $pattern eq \"\"} {\n" +" return [list [file join $base $dir] $pattern]\n" +" } elseif {$pattern eq [file tail $pattern]} {\n" +" set dir \"\"\n" +" }\n" +"\n" +"\n" +" set dirlist [glob.glob $base $dir]\n" +" set pattern [file tail $pattern]\n" +"\n" +"\n" +" set result {}\n" +" foreach {realdir dir} $dirlist {\n" +" if {![file isdir $realdir]} {\n" +" continue\n" +" }\n" +" if {[string index $dir end] ne \"/\" && $dir ne \"\"} {\n" +" append dir /\n" +" }\n" +" foreach name [glob.globdir $realdir $pattern] {\n" +" lappend result [file join $realdir $name] $dir$name\n" +" }\n" +" }\n" +" return $result\n" +"}\n" +"\n" "\n" "\n" "\n" "\n" "\n" @@ -1093,114 +1190,75 @@ "\n" "\n" "\n" "\n" "proc glob {args} {\n" -"\n" -"\n" -"\n" -"\n" -" local proc glob.readdir_pattern {dir pattern} {\n" -" set result {}\n" -"\n" -"\n" -" if {$pattern in {. ..}} {\n" -" return $pattern\n" -" }\n" -"\n" -"\n" -" if {[string match {*[[*?]*} $pattern]} {\n" -"\n" -" set files [readdir -nocomplain $dir]\n" -" } elseif {[file isdir $dir] && [file exists $dir/$pattern]} {\n" -" set files [list $pattern]\n" -" } else {\n" -" set files \"\"\n" -" }\n" -"\n" -" foreach name $files {\n" -" if {[string match $pattern $name]} {\n" -"\n" -" if {[string index $name 0] eq \".\" && [string index $pattern 0] ne \".\"} {\n" -" continue\n" -" }\n" +" set nocomplain 0\n" +" set base \"\"\n" +"\n" +" set n 0\n" +" foreach arg $args {\n" +" if {[info exists param]} {\n" +" set $param $arg\n" +" unset param\n" +" incr n\n" +" continue\n" +" }\n" +" switch -glob -- $arg {\n" +" -d* {\n" +" set switch $arg\n" +" set param base\n" +" }\n" +" -n* {\n" +" set nocomplain 1\n" +" }\n" +" -t* {\n" +"\n" +" }\n" +"\n" +" -* {\n" +" return -code error \"bad option \\\"$switch\\\": must be -directory, -nocomplain, -tails, or --\"\n" +" }\n" +" -- {\n" +" incr n\n" +" break\n" +" }\n" +" * {\n" +" break\n" +" }\n" +" }\n" +" incr n\n" +" }\n" +" if {[info exists param]} {\n" +" return -code error \"missing argument to \\\"$switch\\\"\"\n" +" }\n" +" if {[llength $args] <= $n} {\n" +" return -code error \"wrong # args: should be \\\"glob ?options? pattern ?pattern ...?\\\"\"\n" +" }\n" +"\n" +" set args [lrange $args $n end]\n" +"\n" +" set result {}\n" +" foreach pattern $args {\n" +" set pattern [string map {\n" +" \\\\\\\\ \\x01 \\\\\\{ \\x02 \\\\\\} \\x03 \\\\, \\x04\n" +" } $pattern]\n" +" set patexps [lassign [glob.explode $pattern] rest]\n" +" if {$rest ne \"\"} {\n" +" return -code error \"unmatched close brace in glob pattern\"\n" +" }\n" +" foreach patexp $patexps {\n" +" set patexp [string map {\n" +" \\x01 \\\\\\\\ \\x02 \\{ \\x03 \\} \\x04 ,\n" +" } $patexp]\n" +" foreach {realname name} [glob.glob $base $patexp] {\n" " lappend result $name\n" " }\n" " }\n" -"\n" -" return $result\n" -" }\n" -"\n" -"\n" -"\n" -"\n" -"\n" -" proc glob.expandbraces {pattern} {\n" -"\n" -"\n" -" if {[set fb [string first \"\\{\" $pattern]] < 0} {\n" -" return [list $pattern]\n" -" }\n" -" if {[set nb [string first \"\\}\" $pattern $fb]] < 0} {\n" -" return [list $pattern]\n" -" }\n" -" set before [string range $pattern 0 $fb-1]\n" -" set braced [string range $pattern $fb+1 $nb-1]\n" -" set after [string range $pattern $nb+1 end]\n" -"\n" -" lmap part [split $braced ,] {\n" -" set pat $before$part$after\n" -" }\n" -" }\n" -"\n" -"\n" -" proc glob.glob {pattern} {\n" -" set dir [file dirname $pattern]\n" -" if {$dir eq $pattern} {\n" -"\n" -" return [list $dir]\n" -" }\n" -"\n" -"\n" -" set dirlist [glob.glob $dir]\n" -" set pattern [file tail $pattern]\n" -"\n" -"\n" -" set result {}\n" -" foreach dir $dirlist {\n" -" set globdir $dir\n" -" if {[string match \"*/\" $dir]} {\n" -" set sep \"\"\n" -" } elseif {$dir eq \".\"} {\n" -" set globdir \"\"\n" -" set sep \"\"\n" -" } else {\n" -" set sep /\n" -" }\n" -" foreach pat [glob.expandbraces $pattern] {\n" -" foreach name [glob.readdir_pattern $dir $pat] {\n" -" lappend result $globdir$sep$name\n" -" }\n" -" }\n" -" }\n" -" return $result\n" -" }\n" -"\n" -"\n" -" set nocomplain 0\n" -"\n" -" if {[lindex $args 0] eq \"-nocomplain\"} {\n" -" set nocomplain 1\n" -" set args [lrange $args 1 end]\n" -" }\n" -"\n" -" set result {}\n" -" foreach pattern $args {\n" -" lappend result {*}[glob.glob $pattern]\n" -" }\n" -"\n" -" if {$nocomplain == 0 && [llength $result] == 0} {\n" +" }\n" +"\n" +" if {!$nocomplain && [llength $result] == 0} {\n" " return -code error \"no files matched glob patterns\"\n" " }\n" "\n" " return $result\n" "}\n" @@ -1628,10 +1686,11 @@ " file delete $path\n" "}\n" ); } + #include #include #include #include @@ -1651,10 +1710,17 @@ #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 @@ -1935,10 +2001,22 @@ } JimAioSetError(interp, af->filename); return JIM_ERR; } +static int aio_cmd_isatty(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ +#ifdef HAVE_ISATTY + AioFile *af = Jim_CmdPrivData(interp); + Jim_SetResultInt(interp, isatty(fileno(af->fp))); +#else + Jim_SetResultInt(interp, 0); +#endif + + return JIM_OK; +} + static int aio_cmd_flush(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); @@ -1965,11 +2043,11 @@ static int aio_cmd_seek(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); int orig = SEEK_SET; - long offset; + jim_wide offset; if (argc == 2) { if (Jim_CompareStringImmediate(interp, argv[1], "start")) orig = SEEK_SET; else if (Jim_CompareStringImmediate(interp, argv[1], "current")) @@ -1978,14 +2056,14 @@ orig = SEEK_END; else { return -1; } } - if (Jim_GetLong(interp, argv[0], &offset) != JIM_OK) { + if (Jim_GetWide(interp, argv[0], &offset) != JIM_OK) { return JIM_ERR; } - if (fseek(af->fp, offset, orig) == -1) { + if (fseeko(af->fp, offset, orig) == -1) { JimAioSetError(interp, af->filename); return JIM_ERR; } return JIM_OK; } @@ -1992,11 +2070,11 @@ static int aio_cmd_tell(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { AioFile *af = Jim_CmdPrivData(interp); - Jim_SetResultInt(interp, ftell(af->fp)); + Jim_SetResultInt(interp, ftello(af->fp)); return JIM_OK; } static int aio_cmd_filename(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { @@ -2167,10 +2245,17 @@ "?-nonewline? str", aio_cmd_puts, 1, 2, + }, + { "isatty", + NULL, + aio_cmd_isatty, + 0, + 0, + }, { "flush", NULL, aio_cmd_flush, 0, @@ -3048,11 +3133,13 @@ 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) { + 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); } @@ -3116,16 +3203,17 @@ const char *path = Jim_String(argv[0]); char *newname = Jim_Alloc(MAXPATHLEN + 1); if (realpath(path, newname)) { Jim_SetResult(interp, Jim_NewStringObjNoAlloc(interp, newname, -1)); + return JIM_OK; } else { Jim_Free(newname); - Jim_SetResult(interp, argv[0]); + Jim_SetResultFormatted(interp, "can't normalize \"%#s\": %s", argv[0], strerror(errno)); + return JIM_ERR; } - return JIM_OK; #else Jim_SetResultString(interp, "Not implemented", -1); return JIM_ERR; #endif } @@ -4934,11 +5022,11 @@ return env; } static void JimRestoreEnv(char **env) { - JimFreeEnv(env, NULL); + JimFreeEnv(env, Jim_GetEnviron()); } static Jim_Obj * JimWinBuildCommandLine(Jim_Interp *interp, char **argv) { @@ -5583,10 +5671,13 @@ #ifdef JIM_MAINTAINER #define JIM_DEBUG_COMMAND #define JIM_DEBUG_PANIC #endif + +#define JIM_INTEGER_SPACE 24 + const char *jim_tt_name(int type); #ifdef JIM_DEBUG_PANIC static void JimPanicDump(int panic_condition, const char *fmt, ...); #define JimPanic(X) JimPanicDump X @@ -5602,10 +5693,11 @@ 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); static Jim_Obj *JimExpandDictSugar(Jim_Interp *interp, Jim_Obj *objPtr); static void SetDictSubstFromAny(Jim_Interp *interp, Jim_Obj *objPtr); +static Jim_Obj **JimDictPairs(Jim_Obj *dictPtr, int *len); static void JimSetFailedEnumResult(Jim_Interp *interp, const char *arg, const char *badtype, const char *prefix, const char *const *tablePtr, const char *name); static int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc, Jim_Obj *const *argv); static int JimGetWideNoErr(Jim_Interp *interp, Jim_Obj *objPtr, jim_wide * widePtr); static int JimSign(jim_wide w); @@ -5846,15 +5938,42 @@ } return n; } #endif -int Jim_WideToString(char *buf, jim_wide wideValue) +static int JimWideToString(char *buf, jim_wide wideValue) { - const char *fmt = "%" JIM_WIDE_MODIFIER; + int pos = 0; - return sprintf(buf, fmt, wideValue); + if (wideValue == 0) { + buf[pos++] = '0'; + } + else { + char tmp[JIM_INTEGER_SPACE]; + int num = 0; + int i; + + if (wideValue < 0) { + buf[pos++] = '-'; + + i = wideValue % 10; + tmp[num++] = (i > 0) ? (10 - i) : -i; + wideValue /= -10; + } + + while (wideValue) { + tmp[num++] = wideValue % 10; + wideValue /= 10; + } + + for (i = 0; i < num; i++) { + buf[pos++] = '0' + tmp[num - i - 1]; + } + } + buf[pos] = 0; + + return pos; } static int JimCheckConversion(const char *str, const char *endptr) { if (str[0] == '\0' || str == endptr) { @@ -5869,16 +5988,103 @@ endptr++; } } return JIM_OK; } + +static int JimNumberBase(const char *str, int *base, int *sign) +{ + int i = 0; + + *base = 10; + + while (isspace(UCHAR(str[i]))) { + i++; + } + + if (str[i] == '-') { + *sign = -1; + i++; + } + else { + 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; + } + + return 10; +} + +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) { char *endptr; - *widePtr = strtoull(str, &endptr, base); + if (base) { + *widePtr = strtoull(str, &endptr, base); + } + else { + *widePtr = jim_strtoull(str, &endptr); + } return JimCheckConversion(str, endptr); } int Jim_DoubleToString(char *buf, double doubleValue) @@ -6053,10 +6259,18 @@ ht->size = 0; ht->sizemask = 0; ht->used = 0; ht->collisions = 0; } + +static void JimInitHashTableIterator(Jim_HashTable *ht, Jim_HashTableIterator *iter) +{ + iter->ht = ht; + iter->index = -1; + iter->entry = NULL; + iter->nextEntry = NULL; +} int Jim_InitHashTable(Jim_HashTable *ht, const Jim_HashTableType *type, void *privDataPtr) { JimResetHashTable(ht); @@ -6233,15 +6447,11 @@ } Jim_HashTableIterator *Jim_GetHashTableIterator(Jim_HashTable *ht) { Jim_HashTableIterator *iter = Jim_Alloc(sizeof(*iter)); - - iter->ht = ht; - iter->index = -1; - iter->entry = NULL; - iter->nextEntry = NULL; + JimInitHashTableIterator(ht, iter); return iter; } Jim_HashEntry *Jim_NextHashEntry(Jim_HashTableIterator *iter) { @@ -7390,27 +7600,10 @@ Jim_Free(objPtr->bytes); } objPtr->bytes = NULL; } -#define Jim_SetStringRep(o, b, l) \ - do { (o)->bytes = b; (o)->length = l; } while (0) - -void Jim_InitStringRep(Jim_Obj *objPtr, const char *bytes, int length) -{ - if (length == 0) { - objPtr->bytes = JimEmptyStringRep; - objPtr->length = 0; - } - else { - objPtr->bytes = Jim_Alloc(length + 1); - objPtr->length = length; - memcpy(objPtr->bytes, bytes, length); - objPtr->bytes[length] = '\0'; - } -} - Jim_Obj *Jim_DuplicateObj(Jim_Interp *interp, Jim_Obj *objPtr) { Jim_Obj *dupPtr; @@ -7417,12 +7610,22 @@ 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 { - Jim_InitStringRep(dupPtr, objPtr->bytes, objPtr->length); + 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) { @@ -7596,13 +7799,12 @@ Jim_Obj *Jim_NewStringObjNoAlloc(Jim_Interp *interp, char *s, int len) { Jim_Obj *objPtr = Jim_NewObj(interp); - if (len == -1) - len = strlen(s); - Jim_SetStringRep(objPtr, s, len); + objPtr->bytes = s; + objPtr->length = len == -1 ? strlen(s) : len; objPtr->typePtr = NULL; return objPtr; } static void StringAppendString(Jim_Obj *objPtr, const char *str, int len) @@ -7818,11 +8020,11 @@ if (JimStringGetRange(interp, firstObjPtr, lastObjPtr, len, &first, &last, &rangeLen) != JIM_OK) { return NULL; } - if (last <= first) { + if (last < first) { return strObjPtr; } str = Jim_String(strObjPtr); @@ -8169,19 +8371,19 @@ Jim_DecrRefCount(interp, objPtr->internalRep.sourceValue.fileNameObj); } void DupSourceInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { - dupPtr->internalRep = srcPtr->internalRep; + dupPtr->internalRep.sourceValue = srcPtr->internalRep.sourceValue; Jim_IncrRefCount(dupPtr->internalRep.sourceValue.fileNameObj); } static void JimSetSourceInfo(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *fileNameObj, int lineNumber) { JimPanic((Jim_IsShared(objPtr), "JimSetSourceInfo called with shared object")); - JimPanic((objPtr->typePtr != NULL, "JimSetSourceInfo called with typePtr != NULL")); + JimPanic((objPtr->typePtr == &sourceObjType, "JimSetSourceInfo called with non-source object")); Jim_IncrRefCount(fileNameObj); objPtr->internalRep.sourceValue.fileNameObj = fileNameObj; objPtr->internalRep.sourceValue.lineNumber = lineNumber; objPtr->typePtr = &sourceObjType; } @@ -8557,13 +8759,16 @@ return JIM_OK; } ScriptObj *Jim_GetScript(Jim_Interp *interp, Jim_Obj *objPtr) { - struct ScriptObj *script = Jim_GetIntRepPtr(objPtr); + if (objPtr == interp->emptyObj) { + + objPtr = interp->nullScriptObj; + } - if (objPtr->typePtr != &scriptObjType || script->substFlags) { + if (objPtr->typePtr != &scriptObjType || ((struct ScriptObj *)Jim_GetIntRepPtr(objPtr))->substFlags) { SetScriptFromAny(interp, objPtr, NULL); } return (ScriptObj *) Jim_GetIntRepPtr(objPtr); } @@ -10045,16 +10250,18 @@ i->result = i->emptyObj; i->stackTrace = Jim_NewListObj(i, NULL, 0); i->unknown = Jim_NewStringObj(i, "unknown", -1); i->errorProc = i->emptyObj; i->currentScriptObj = Jim_NewEmptyStringObj(i); + i->nullScriptObj = Jim_NewEmptyStringObj(i); Jim_IncrRefCount(i->emptyObj); Jim_IncrRefCount(i->errorFileNameObj); Jim_IncrRefCount(i->result); Jim_IncrRefCount(i->stackTrace); Jim_IncrRefCount(i->unknown); Jim_IncrRefCount(i->currentScriptObj); + Jim_IncrRefCount(i->nullScriptObj); Jim_IncrRefCount(i->errorProc); Jim_IncrRefCount(i->trueObj); Jim_IncrRefCount(i->falseObj); @@ -10084,10 +10291,11 @@ Jim_DecrRefCount(i, i->stackTrace); Jim_DecrRefCount(i, i->errorProc); Jim_DecrRefCount(i, i->unknown); Jim_DecrRefCount(i, i->errorFileNameObj); Jim_DecrRefCount(i, i->currentScriptObj); + Jim_DecrRefCount(i, i->nullScriptObj); Jim_FreeHashTable(&i->commands); #ifdef JIM_REFERENCES Jim_FreeHashTable(&i->references); #endif Jim_FreeHashTable(&i->packages); @@ -10159,11 +10367,11 @@ if (levelObjPtr) { str = Jim_String(levelObjPtr); if (str[0] == '#') { char *endptr; - level = strtol(str + 1, &endptr, 0); + level = jim_strtol(str + 1, &endptr); if (str[1] == '\0' || endptr[0] != '\0') { level = -1; } } else { @@ -10327,12 +10535,10 @@ int Jim_GetExitCode(Jim_Interp *interp) { return interp->exitCode; } -#define JIM_INTEGER_SPACE 24 - static void UpdateStringOfInt(struct Jim_Obj *objPtr); static int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags); static const Jim_ObjType intObjType = { "int", @@ -10349,16 +10555,16 @@ UpdateStringOfInt, JIM_TYPE_NONE, }; -void UpdateStringOfInt(struct Jim_Obj *objPtr) +static void UpdateStringOfInt(struct Jim_Obj *objPtr) { int len; char buf[JIM_INTEGER_SPACE + 1]; - len = Jim_WideToString(buf, JimWideValue(objPtr)); + len = JimWideToString(buf, JimWideValue(objPtr)); objPtr->bytes = Jim_Alloc(len + 1); memcpy(objPtr->bytes, buf, len + 1); objPtr->length = len; } @@ -10582,11 +10788,11 @@ } #define JIM_ELESTR_SIMPLE 0 #define JIM_ELESTR_BRACE 1 #define JIM_ELESTR_QUOTE 2 -static int ListElementQuotingType(const char *s, int len) +static unsigned char ListElementQuotingType(const char *s, int len) { int i, level, blevel, trySimple = 1; if (len == 0) @@ -10730,17 +10936,23 @@ return p - q; } static void JimMakeListStringRep(Jim_Obj *objPtr, Jim_Obj **objv, int objc) { + #define STATIC_QUOTING_LEN 32 int i, bufLen, realLength; const char *strRep; char *p; - int *quotingType; + unsigned char *quotingType, staticQuoting[STATIC_QUOTING_LEN]; - quotingType = Jim_Alloc(sizeof(int) * objc + 1); + 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); @@ -10802,11 +11014,14 @@ realLength++; } } *p = '\0'; objPtr->length = realLength; - Jim_Free(quotingType); + + if (quotingType != staticQuoting) { + Jim_Free(quotingType); + } } static void UpdateStringOfList(struct Jim_Obj *objPtr) { JimMakeListStringRep(objPtr, objPtr->internalRep.listValue.ele, objPtr->internalRep.listValue.len); @@ -10822,18 +11037,16 @@ if (objPtr->typePtr == &listObjType) { return JIM_OK; } -#if 0 - - if (Jim_IsDict(objPtr)) { + if (Jim_IsDict(objPtr) && !Jim_IsShared(objPtr)) { Jim_Obj **listObjPtrPtr; int len; int i; - Jim_DictPairs(interp, objPtr, &listObjPtrPtr, &len); + listObjPtrPtr = JimDictPairs(objPtr, &len); for (i = 0; i < len; i++) { Jim_IncrRefCount(listObjPtrPtr[i]); } @@ -10843,11 +11056,10 @@ objPtr->internalRep.listValue.maxLen = len; objPtr->internalRep.listValue.ele = listObjPtrPtr; return JIM_OK; } -#endif if (objPtr->typePtr == &sourceObjType) { fileNameObj = objPtr->internalRep.sourceValue.fileNameObj; linenr = objPtr->internalRep.sourceValue.lineNumber; @@ -10866,20 +11078,22 @@ objPtr->internalRep.listValue.len = 0; objPtr->internalRep.listValue.maxLen = 0; objPtr->internalRep.listValue.ele = NULL; - JimParserInit(&parser, str, strLen, linenr); - while (!parser.eof) { - Jim_Obj *elementPtr; - - JimParseList(&parser); - if (parser.tt != JIM_TT_STR && parser.tt != JIM_TT_ESC) - continue; - elementPtr = JimParserGetTokenObj(interp, &parser); - JimSetSourceInfo(interp, elementPtr, fileNameObj, parser.tline); - ListAppendElement(objPtr, elementPtr); + 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) + continue; + elementPtr = JimParserGetTokenObj(interp, &parser); + JimSetSourceInfo(interp, elementPtr, fileNameObj, parser.tline); + ListAppendElement(objPtr, elementPtr); + } } Jim_DecrRefCount(interp, fileNameObj); return JIM_OK; } @@ -11053,14 +11267,22 @@ int requiredLen = currentLen + elemc; int i; Jim_Obj **point; if (requiredLen > listPtr->internalRep.listValue.maxLen) { - listPtr->internalRep.listValue.maxLen = requiredLen * 2; + if (requiredLen < 2) { + + requiredLen = 4; + } + else { + requiredLen *= 2; + } listPtr->internalRep.listValue.ele = Jim_Realloc(listPtr->internalRep.listValue.ele, - sizeof(Jim_Obj *) * listPtr->internalRep.listValue.maxLen); + sizeof(Jim_Obj *) * requiredLen); + + listPtr->internalRep.listValue.maxLen = requiredLen; } if (idx < 0) { idx = currentLen; } point = listPtr->internalRep.listValue.ele + idx; @@ -11351,55 +11573,53 @@ } void DupDictInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr) { Jim_HashTable *ht, *dupHt; - Jim_HashTableIterator *htiter; + 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); - htiter = Jim_GetHashTableIterator(ht); - while ((he = Jim_NextHashEntry(htiter)) != NULL) { + JimInitHashTableIterator(ht, &htiter); + while ((he = Jim_NextHashEntry(&htiter)) != NULL) { const Jim_Obj *keyObjPtr = he->key; Jim_Obj *valObjPtr = he->u.val; Jim_IncrRefCount((Jim_Obj *)keyObjPtr); Jim_IncrRefCount(valObjPtr); Jim_AddHashEntry(dupHt, keyObjPtr, valObjPtr); } - Jim_FreeHashTableIterator(htiter); dupPtr->internalRep.ptr = dupHt; dupPtr->typePtr = &dictObjType; } static Jim_Obj **JimDictPairs(Jim_Obj *dictPtr, int *len) { Jim_HashTable *ht; - Jim_HashTableIterator *htiter; + Jim_HashTableIterator htiter; Jim_HashEntry *he; Jim_Obj **objv; int i; ht = dictPtr->internalRep.ptr; objv = Jim_Alloc((ht->used * 2) * sizeof(Jim_Obj *)); - htiter = Jim_GetHashTableIterator(ht); + JimInitHashTableIterator(ht, &htiter); i = 0; - while ((he = Jim_NextHashEntry(htiter)) != NULL) { + while ((he = Jim_NextHashEntry(&htiter)) != NULL) { objv[i++] = (Jim_Obj *)he->key; objv[i++] = he->u.val; } *len = i; - Jim_FreeHashTableIterator(htiter); return objv; } static void UpdateStringOfDict(struct Jim_Obj *objPtr) { @@ -11682,11 +11902,11 @@ end = 1; str += 3; idx = 0; } else { - idx = strtol(str, &endptr, 0); + idx = jim_strtol(str, &endptr); if (endptr == str) { goto badindex; } str = endptr; @@ -11694,11 +11914,11 @@ if (*str == '+' || *str == '-') { int sign = (*str == '+' ? 1 : -1); - idx += sign * strtol(++str, &endptr, 0); + idx += sign * jim_strtol(++str, &endptr); if (str == endptr || *endptr) { goto badindex; } str = endptr; } @@ -11917,14 +12137,15 @@ typedef struct Jim_ExprOperator { const char *name; - int precedence; - int arity; int (*funcop) (Jim_Interp *interp, struct JimExprState * e); - int lazy; + unsigned char precedence; + unsigned char arity; + unsigned char lazy; + unsigned char namelen; } Jim_ExprOperator; static void ExprPush(struct JimExprState *e, Jim_Obj *obj) { Jim_IncrRefCount(obj); @@ -12602,93 +12823,96 @@ LAZY_OP, LAZY_LEFT, LAZY_RIGHT }; +#define OPRINIT(N, P, A, F, L) {N, F, P, A, L, sizeof(N) - 1} + static const struct Jim_ExprOperator Jim_ExprOperators[] = { - {"*", 200, 2, JimExprOpBin, LAZY_NONE}, - {"/", 200, 2, JimExprOpBin, LAZY_NONE}, - {"%", 200, 2, JimExprOpIntBin, LAZY_NONE}, - - {"-", 100, 2, JimExprOpBin, LAZY_NONE}, - {"+", 100, 2, JimExprOpBin, LAZY_NONE}, - - {"<<", 90, 2, JimExprOpIntBin, LAZY_NONE}, - {">>", 90, 2, JimExprOpIntBin, LAZY_NONE}, - - {"<<<", 90, 2, JimExprOpIntBin, LAZY_NONE}, - {">>>", 90, 2, JimExprOpIntBin, LAZY_NONE}, - - {"<", 80, 2, JimExprOpBin, LAZY_NONE}, - {">", 80, 2, JimExprOpBin, LAZY_NONE}, - {"<=", 80, 2, JimExprOpBin, LAZY_NONE}, - {">=", 80, 2, JimExprOpBin, LAZY_NONE}, - - {"==", 70, 2, JimExprOpBin, LAZY_NONE}, - {"!=", 70, 2, JimExprOpBin, LAZY_NONE}, - - {"&", 50, 2, JimExprOpIntBin, LAZY_NONE}, - {"^", 49, 2, JimExprOpIntBin, LAZY_NONE}, - {"|", 48, 2, JimExprOpIntBin, LAZY_NONE}, - - {"&&", 10, 2, NULL, LAZY_OP}, - {NULL, 10, 2, JimExprOpAndLeft, LAZY_LEFT}, - {NULL, 10, 2, JimExprOpAndOrRight, LAZY_RIGHT}, - - {"||", 9, 2, NULL, LAZY_OP}, - {NULL, 9, 2, JimExprOpOrLeft, LAZY_LEFT}, - {NULL, 9, 2, JimExprOpAndOrRight, LAZY_RIGHT}, - - {"?", 5, 2, JimExprOpNull, LAZY_OP}, - {NULL, 5, 2, JimExprOpTernaryLeft, LAZY_LEFT}, - {NULL, 5, 2, JimExprOpNull, LAZY_RIGHT}, - - {":", 5, 2, JimExprOpNull, LAZY_OP}, - {NULL, 5, 2, JimExprOpColonLeft, LAZY_LEFT}, - {NULL, 5, 2, JimExprOpNull, LAZY_RIGHT}, - - {"**", 250, 2, JimExprOpBin, LAZY_NONE}, - - {"eq", 60, 2, JimExprOpStrBin, LAZY_NONE}, - {"ne", 60, 2, JimExprOpStrBin, LAZY_NONE}, - - {"in", 55, 2, JimExprOpStrBin, LAZY_NONE}, - {"ni", 55, 2, JimExprOpStrBin, LAZY_NONE}, - - {"!", 300, 1, JimExprOpNumUnary, LAZY_NONE}, - {"~", 300, 1, JimExprOpIntUnary, LAZY_NONE}, - {NULL, 300, 1, JimExprOpNumUnary, LAZY_NONE}, - {NULL, 300, 1, JimExprOpNumUnary, LAZY_NONE}, - - - - {"int", 400, 1, JimExprOpNumUnary, LAZY_NONE}, - {"abs", 400, 1, JimExprOpNumUnary, LAZY_NONE}, - {"double", 400, 1, JimExprOpNumUnary, LAZY_NONE}, - {"round", 400, 1, JimExprOpNumUnary, LAZY_NONE}, - {"rand", 400, 0, JimExprOpNone, LAZY_NONE}, - {"srand", 400, 1, JimExprOpIntUnary, LAZY_NONE}, + OPRINIT("*", 110, 2, JimExprOpBin, LAZY_NONE), + OPRINIT("/", 110, 2, JimExprOpBin, LAZY_NONE), + OPRINIT("%", 110, 2, JimExprOpIntBin, LAZY_NONE), + + OPRINIT("-", 100, 2, JimExprOpBin, LAZY_NONE), + OPRINIT("+", 100, 2, JimExprOpBin, LAZY_NONE), + + OPRINIT("<<", 90, 2, JimExprOpIntBin, LAZY_NONE), + OPRINIT(">>", 90, 2, JimExprOpIntBin, LAZY_NONE), + + OPRINIT("<<<", 90, 2, JimExprOpIntBin, LAZY_NONE), + OPRINIT(">>>", 90, 2, JimExprOpIntBin, LAZY_NONE), + + OPRINIT("<", 80, 2, JimExprOpBin, LAZY_NONE), + OPRINIT(">", 80, 2, JimExprOpBin, LAZY_NONE), + OPRINIT("<=", 80, 2, JimExprOpBin, LAZY_NONE), + OPRINIT(">=", 80, 2, JimExprOpBin, LAZY_NONE), + + OPRINIT("==", 70, 2, JimExprOpBin, LAZY_NONE), + OPRINIT("!=", 70, 2, JimExprOpBin, LAZY_NONE), + + OPRINIT("&", 50, 2, JimExprOpIntBin, LAZY_NONE), + OPRINIT("^", 49, 2, JimExprOpIntBin, LAZY_NONE), + OPRINIT("|", 48, 2, JimExprOpIntBin, LAZY_NONE), + + OPRINIT("&&", 10, 2, NULL, LAZY_OP), + OPRINIT(NULL, 10, 2, JimExprOpAndLeft, LAZY_LEFT), + OPRINIT(NULL, 10, 2, JimExprOpAndOrRight, LAZY_RIGHT), + + OPRINIT("||", 9, 2, NULL, LAZY_OP), + OPRINIT(NULL, 9, 2, JimExprOpOrLeft, LAZY_LEFT), + OPRINIT(NULL, 9, 2, JimExprOpAndOrRight, LAZY_RIGHT), + + OPRINIT("?", 5, 2, JimExprOpNull, LAZY_OP), + OPRINIT(NULL, 5, 2, JimExprOpTernaryLeft, LAZY_LEFT), + OPRINIT(NULL, 5, 2, JimExprOpNull, LAZY_RIGHT), + + OPRINIT(":", 5, 2, JimExprOpNull, LAZY_OP), + OPRINIT(NULL, 5, 2, JimExprOpColonLeft, LAZY_LEFT), + OPRINIT(NULL, 5, 2, JimExprOpNull, LAZY_RIGHT), + + OPRINIT("**", 250, 2, JimExprOpBin, LAZY_NONE), + + OPRINIT("eq", 60, 2, JimExprOpStrBin, LAZY_NONE), + OPRINIT("ne", 60, 2, JimExprOpStrBin, LAZY_NONE), + + OPRINIT("in", 55, 2, JimExprOpStrBin, LAZY_NONE), + OPRINIT("ni", 55, 2, JimExprOpStrBin, LAZY_NONE), + + OPRINIT("!", 150, 1, JimExprOpNumUnary, LAZY_NONE), + OPRINIT("~", 150, 1, JimExprOpIntUnary, LAZY_NONE), + OPRINIT(NULL, 150, 1, JimExprOpNumUnary, LAZY_NONE), + OPRINIT(NULL, 150, 1, JimExprOpNumUnary, LAZY_NONE), + + + + OPRINIT("int", 200, 1, JimExprOpNumUnary, LAZY_NONE), + OPRINIT("abs", 200, 1, JimExprOpNumUnary, LAZY_NONE), + OPRINIT("double", 200, 1, JimExprOpNumUnary, LAZY_NONE), + OPRINIT("round", 200, 1, JimExprOpNumUnary, LAZY_NONE), + OPRINIT("rand", 200, 0, JimExprOpNone, LAZY_NONE), + OPRINIT("srand", 200, 1, JimExprOpIntUnary, LAZY_NONE), #ifdef JIM_MATH_FUNCTIONS - {"sin", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"cos", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"tan", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"asin", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"acos", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"atan", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"sinh", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"cosh", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"tanh", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"ceil", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"floor", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"exp", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"log", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"log10", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"sqrt", 400, 1, JimExprOpDoubleUnary, LAZY_NONE}, - {"pow", 400, 2, JimExprOpBin, LAZY_NONE}, + OPRINIT("sin", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("cos", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("tan", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("asin", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("acos", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("atan", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("sinh", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("cosh", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("tanh", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("ceil", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("floor", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("exp", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("log", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("log10", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("sqrt", 200, 1, JimExprOpDoubleUnary, LAZY_NONE), + OPRINIT("pow", 200, 2, JimExprOpBin, LAZY_NONE), #endif }; +#undef OPRINIT #define JIM_EXPR_OPERATORS_NUM \ (sizeof(Jim_ExprOperators)/sizeof(struct Jim_ExprOperator)) static int JimParseExpression(struct JimParserCtx *pc) @@ -12769,32 +12993,57 @@ } static int JimParseExprNumber(struct JimParserCtx *pc) { int allowdot = 1; - int allowhex = 0; + int base = 10; pc->tt = JIM_TT_EXPR_INT; pc->tstart = pc->p; pc->tline = pc->linenr; + + + if (pc->p[0] == '0') { + switch (pc->p[1]) { + case 'x': + case 'X': + base = 16; + allowdot = 0; + pc->p += 2; + pc->len -= 2; + break; + case 'o': + case 'O': + base = 8; + allowdot = 0; + pc->p += 2; + pc->len -= 2; + break; + case 'b': + case 'B': + base = 2; + allowdot = 0; + pc->p += 2; + pc->len -= 2; + break; + } + } + while (isdigit(UCHAR(*pc->p)) - || (allowhex && isxdigit(UCHAR(*pc->p))) + || (base == 16 && isxdigit(UCHAR(*pc->p))) + || (base == 8 && *pc->p >= '0' && *pc->p <= '7') + || (base == 2 && (*pc->p == '0' || *pc->p == '1')) || (allowdot && *pc->p == '.') - || (pc->p - pc->tstart == 1 && *pc->tstart == '0' && (*pc->p == 'x' || *pc->p == 'X')) ) { - if ((*pc->p == 'x') || (*pc->p == 'X')) { - allowhex = 1; - allowdot = 0; - } if (*pc->p == '.') { allowdot = 0; pc->tt = JIM_TT_EXPR_DOUBLE; } pc->p++; pc->len--; - if (!allowhex && (*pc->p == 'e' || *pc->p == 'E') && (pc->p[1] == '-' || pc->p[1] == '+' + if (base == 10 && (*pc->p == 'e' || *pc->p == 'E') && (pc->p[1] == '-' || pc->p[1] == '+' || isdigit(UCHAR(pc->p[1])))) { pc->p += 2; pc->len -= 2; pc->tt = JIM_TT_EXPR_DOUBLE; } @@ -12829,20 +13078,18 @@ int i; int bestIdx = -1, bestLen = 0; for (i = 0; i < (signed)JIM_EXPR_OPERATORS_NUM; i++) { - const char *opname; - int oplen; + const char * const opname = Jim_ExprOperators[i].name; + const int oplen = Jim_ExprOperators[i].namelen; - opname = Jim_ExprOperators[i].name; - if (opname == NULL) { + if (opname == NULL || opname[0] != pc->p[0]) { continue; } - oplen = strlen(opname); - if (strncmp(opname, pc->p, oplen) == 0 && oplen > bestLen) { + if (oplen > bestLen && strncmp(opname, pc->p, oplen) == 0) { bestIdx = i + JIM_TT_EXPR_OP; bestLen = oplen; } } if (bestIdx == -1) { @@ -12914,12 +13161,12 @@ }; typedef struct ExprByteCode { - int len; ScriptToken *token; + int len; int inUse; } ExprByteCode; static void ExprFreeByteCode(Jim_Interp *interp, ExprByteCode * expr) { @@ -13183,29 +13430,39 @@ case JIM_TT_ESC: case JIM_TT_VAR: case JIM_TT_DICTSUGAR: case JIM_TT_EXPRSUGAR: case JIM_TT_CMD: - token->objPtr = Jim_NewStringObj(interp, t->token, t->len); token->type = t->type; +strexpr: + token->objPtr = Jim_NewStringObj(interp, t->token, t->len); if (t->type == JIM_TT_CMD) { JimSetSourceInfo(interp, token->objPtr, fileNameObj, t->line); } expr->len++; break; case JIM_TT_EXPR_INT: - token->objPtr = Jim_NewIntObj(interp, strtoull(t->token, NULL, 0)); - token->type = t->type; - expr->len++; - break; - case JIM_TT_EXPR_DOUBLE: - token->objPtr = Jim_NewDoubleObj(interp, strtod(t->token, NULL)); - token->type = t->type; - expr->len++; + { + char *endptr; + if (t->type == JIM_TT_EXPR_INT) { + token->objPtr = Jim_NewIntObj(interp, jim_strtoull(t->token, &endptr)); + } + else { + token->objPtr = Jim_NewDoubleObj(interp, strtod(t->token, &endptr)); + } + if (endptr != t->token + t->len) { + + Jim_FreeNewObj(interp, token->objPtr); + token->type = JIM_TT_STR; + goto strexpr; + } + token->type = t->type; + expr->len++; + } break; case JIM_TT_SUBEXPR_START: Jim_StackPush(&stack, t); prevtt = JIM_TT_NONE; @@ -13648,16 +13905,16 @@ typedef struct ScanFmtPartDescr { - char type; - char modifier; + char *arg; + char *prefix; size_t width; int pos; - char *arg; - char *prefix; + char type; + char modifier; } ScanFmtPartDescr; typedef struct ScanFmtStringObj { @@ -13984,13 +14241,15 @@ int base = descr->type == 'o' ? 8 : descr->type == 'x' ? 16 : descr->type == 'i' ? 0 : 10; - w = strtoull(tok, &endp, base); - if (endp == tok && base == 0) { - w = strtoull(tok, &endp, 10); + if (base == 0) { + w = jim_strtoull(tok, &endp); + } + else { + w = strtoull(tok, &endp, base); } if (endp != tok) { *valObjPtr = Jim_NewIntObj(interp, w); @@ -14662,12 +14921,12 @@ } if (retcode == JIM_OK && argc) { retcode = JimInvokeCommand(interp, argc, argv); - if (interp->signal_level && interp->sigmask) { - + + if (Jim_CheckSignal(interp)) { retcode = JIM_SIGNAL; } } @@ -14816,10 +15075,15 @@ 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; @@ -15079,78 +15343,49 @@ Jim_DecrRefCount(interp, scriptObjPtr); return retcode; } -static int JimParseSubstStr(struct JimParserCtx *pc) +static void JimParseSubst(struct JimParserCtx *pc, int flags) { pc->tstart = pc->p; pc->tline = pc->linenr; - while (pc->len && *pc->p != '$' && *pc->p != '[') { + + if (pc->len == 0) { + pc->tend = pc->p; + pc->tt = JIM_TT_EOL; + pc->eof = 1; + return; + } + if (*pc->p == '[' && !(flags & JIM_SUBST_NOCMD)) { + 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; + } + if (*pc->p == '[' && !(flags & JIM_SUBST_NOCMD)) { + break; + } if (*pc->p == '\\' && pc->len > 1) { pc->p++; pc->len--; } pc->p++; pc->len--; } pc->tend = pc->p - 1; - pc->tt = JIM_TT_ESC; - return JIM_OK; -} - -static int JimParseSubst(struct JimParserCtx *pc, int flags) -{ - int retval; - - if (pc->len == 0) { - pc->tstart = pc->tend = pc->p; - pc->tline = pc->linenr; - pc->tt = JIM_TT_EOL; - pc->eof = 1; - return JIM_OK; - } - switch (*pc->p) { - case '[': - retval = JimParseCmd(pc); - if (flags & JIM_SUBST_NOCMD) { - pc->tstart--; - pc->tend++; - pc->tt = (flags & JIM_SUBST_NOESC) ? JIM_TT_STR : JIM_TT_ESC; - } - return retval; - break; - case '$': - if (JimParseVar(pc) == JIM_ERR) { - pc->tstart = pc->tend = pc->p++; - pc->len--; - pc->tline = pc->linenr; - pc->tt = JIM_TT_STR; - } - else { - if (flags & JIM_SUBST_NOVAR) { - pc->tstart--; - if (flags & JIM_SUBST_NOESC) - pc->tt = JIM_TT_STR; - else - pc->tt = JIM_TT_ESC; - if (*pc->tstart == '{') { - pc->tstart--; - if (*(pc->tend + 1)) - pc->tend++; - } - } - } - break; - default: - retval = JimParseSubstStr(pc); - if (flags & JIM_SUBST_NOESC) - pc->tt = JIM_TT_STR; - return retval; - break; - } - return JIM_OK; + pc->tt = (flags & JIM_SUBST_NOESC) ? JIM_TT_STR : JIM_TT_ESC; } static int SetSubstFromAny(Jim_Interp *interp, struct Jim_Obj *objPtr, int flags) { @@ -15261,17 +15496,17 @@ if (he) { callback(interp, listObjPtr, he, type); } } else { - Jim_HashTableIterator *htiter = Jim_GetHashTableIterator(ht); - while ((he = Jim_NextHashEntry(htiter)) != NULL) { + Jim_HashTableIterator htiter; + JimInitHashTableIterator(ht, &htiter); + while ((he = Jim_NextHashEntry(&htiter)) != NULL) { if (patternObjPtr == NULL || JimGlobMatch(Jim_String(patternObjPtr), he->key, 0)) { callback(interp, listObjPtr, he, type); } } - Jim_FreeHashTableIterator(htiter); } return listObjPtr; } @@ -17173,10 +17408,13 @@ OPT_TRIM, OPT_TRIMLEFT, OPT_TRIMRIGHT, OPT_TOLOWER, OPT_TOUPPER, OPT_TOTITLE }; static const char * const nocase_options[] = { "-nocase", NULL }; + static const char * const nocase_length_options[] = { + "-nocase", "-length", NULL + }; if (argc < 2) { Jim_WrongNumArgs(interp, 1, argv, "option ?arguments ...?"); return JIM_ERR; } @@ -17200,27 +17438,58 @@ Jim_SetResultInt(interp, len); return JIM_OK; case OPT_COMPARE: case OPT_EQUAL: - if (argc != 4 && - (argc != 5 || - Jim_GetEnum(interp, argv[2], nocase_options, &opt_case, NULL, - JIM_ENUM_ABBREV) != JIM_OK)) { - Jim_WrongNumArgs(interp, 2, argv, "?-nocase? string1 string2"); - return JIM_ERR; - } - if (opt_case == 0) { - argv++; - } - if (option == OPT_COMPARE || !opt_case) { - Jim_SetResultInt(interp, Jim_StringCompareObj(interp, argv[2], argv[3], !opt_case)); - } - else { - Jim_SetResultBool(interp, Jim_StringEqObj(argv[2], argv[3])); - } - return JIM_OK; + { + + 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 { + n = Jim_StringCompareObj(interp, argv[0], argv[1], !opt_case); + } + Jim_SetResultInt(interp, option == OPT_COMPARE ? n : n == 0); + } + return JIM_OK; + } case OPT_MATCH: if (argc != 4 && (argc != 5 || Jim_GetEnum(interp, argv[2], nocase_options, &opt_case, NULL, @@ -17281,11 +17550,11 @@ case OPT_REPLACE:{ Jim_Obj *objPtr; if (argc != 5 && argc != 6) { - Jim_WrongNumArgs(interp, 2, argv, "string first last ?newstring?"); + Jim_WrongNumArgs(interp, 2, argv, "string first last ?string?"); return JIM_ERR; } objPtr = JimStringReplaceObj(interp, argv[2], argv[3], argv[4], argc == 6 ? argv[5] : NULL); if (objPtr == NULL) { return JIM_ERR; @@ -17576,11 +17845,11 @@ if ((ignore_mask & (1 << JIM_SIGNAL)) == 0) { sig++; } interp->signal_level += sig; - if (interp->signal_level && interp->sigmask) { + if (Jim_CheckSignal(interp)) { exitCode = JIM_SIGNAL; } else { exitCode = Jim_EvalObj(interp, argv[0]); @@ -17732,25 +18001,24 @@ static int JimInfoReferences(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *listObjPtr; - Jim_HashTableIterator *htiter; + Jim_HashTableIterator htiter; Jim_HashEntry *he; listObjPtr = Jim_NewListObj(interp, NULL, 0); - htiter = Jim_GetHashTableIterator(&interp->references); - while ((he = Jim_NextHashEntry(htiter)) != NULL) { - char buf[JIM_REFERENCE_SPACE]; + JimInitHashTableIterator(&interp->references, &htiter); + while ((he = Jim_NextHashEntry(&htiter)) != NULL) { + char buf[JIM_REFERENCE_SPACE + 1]; Jim_Reference *refPtr = he->u.val; - const jim_wide *refId = he->key; + const unsigned long *refId = he->key; JimFormatReference(buf, refPtr, *refId); Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, buf, -1)); } - Jim_FreeHashTableIterator(htiter); Jim_SetResult(interp, listObjPtr); return JIM_OK; } #endif @@ -17786,17 +18054,17 @@ { Jim_HashEntry *he; Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0); - Jim_HashTableIterator *htiter = Jim_GetHashTableIterator(ht); - while ((he = Jim_NextHashEntry(htiter)) != NULL) { + Jim_HashTableIterator htiter; + JimInitHashTableIterator(ht, &htiter); + while ((he = Jim_NextHashEntry(&htiter)) != NULL) { if (patternObjPtr == NULL || JimGlobMatch(Jim_String(patternObjPtr), Jim_String((Jim_Obj *)he->key), 0)) { callback(interp, listObjPtr, he, type); } } - Jim_FreeHashTableIterator(htiter); return listObjPtr; } @@ -17988,11 +18256,10 @@ static int Jim_InfoCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { int cmd; Jim_Obj *objPtr; int mode = 0; - int nons = 0; static const char * const commands[] = { "body", "statics", "commands", "procs", "channels", "exists", "globals", "level", "frame", "locals", "vars", "version", "patchlevel", "complete", "args", "hostname", "script", "source", "stacktrace", "nameofexecutable", "returncodes", @@ -18003,20 +18270,25 @@ INFO_FRAME, INFO_LOCALS, INFO_VARS, INFO_VERSION, INFO_PATCHLEVEL, INFO_COMPLETE, INFO_ARGS, INFO_HOSTNAME, INFO_SCRIPT, INFO_SOURCE, INFO_STACKTRACE, INFO_NAMEOFEXECUTABLE, INFO_RETURNCODES, INFO_REFERENCES, INFO_ALIAS }; - if (argc < 2) { - Jim_WrongNumArgs(interp, 1, argv, "subcommand ?args ...?"); - return JIM_ERR; - } +#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_ERR; } Index: autosetup/system.tcl ================================================================== --- autosetup/system.tcl +++ autosetup/system.tcl @@ -104,11 +104,11 @@ # # Reads the input file /$template and writes the output file $outfile. # 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 by the corresponding +# Each pattern of the form @define@ is replaced the the corresponding # define, if it exists, or left unchanged if not. # # The special value @srcdir@ is subsituted with the relative # path to the source directory from the directory where the output # file is created. Use @top_srcdir@ for the absolute path. @@ -215,11 +215,12 @@ define host [config_sub $host] set cross $host- } define cross [get-env CROSS $cross] -set prefix [opt-val prefix /usr/local] +# Do "define defaultprefix myvalue" to set the default prefix *before* the first "use" +set prefix [opt-val prefix [get-define defaultprefix /usr/local]] # These are for compatibility with autoconf define target [get-define host] define prefix $prefix define builddir $autosetup(builddir) @@ -252,11 +253,11 @@ define SHELL [get-env SHELL [find-an-executable sh bash ksh]] # Windows vs. non-Windows switch -glob -- [get-define host] { - *-*-ming* - *-*-cygwin { + *-*-ming* - *-*-cygwin - *-*-msys { define-feature windows define EXEEXT .exe } default { define EXEEXT "" ADDED compat/tcl-8.6/generic/tcl.h Index: compat/tcl-8.6/generic/tcl.h ================================================================== --- /dev/null +++ compat/tcl-8.6/generic/tcl.h @@ -0,0 +1,2653 @@ +/* + * tcl.h -- + * + * This header file describes the externally-visible facilities of the + * Tcl interpreter. + * + * Copyright (c) 1987-1994 The Regents of the University of California. + * Copyright (c) 1993-1996 Lucent Technologies. + * Copyright (c) 1994-1998 Sun Microsystems, Inc. + * Copyright (c) 1998-2000 by Scriptics Corporation. + * Copyright (c) 2002 by Kevin B. Kenny. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCL +#define _TCL + +/* + * For C++ compilers, use extern "C" + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The following defines are used to indicate the various release levels. + */ + +#define TCL_ALPHA_RELEASE 0 +#define TCL_BETA_RELEASE 1 +#define TCL_FINAL_RELEASE 2 + +/* + * When version numbers change here, must also go into the following files and + * update the version numbers: + * + * library/init.tcl (1 LOC patch) + * unix/configure.in (2 LOC Major, 2 LOC minor, 1 LOC patch) + * win/configure.in (as above) + * win/tcl.m4 (not patchlevel) + * win/makefile.bc (not patchlevel) 2 LOC + * README (sections 0 and 2, with and without separator) + * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC + * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC + * macosx/Tcl.xcode/project.pbxproj (not patchlevel) 2 LOC + * macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC + * macosx/Tcl-Common.xcconfig (not patchlevel) 1 LOC + * win/README (not patchlevel) (sections 0 and 2) + * unix/tcl.spec (1 LOC patch) + * tools/tcl.hpj.in (not patchlevel, for windows installer) + */ + +#define TCL_MAJOR_VERSION 8 +#define TCL_MINOR_VERSION 6 +#define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE +#define TCL_RELEASE_SERIAL 0 + +#define TCL_VERSION "8.6" +#define TCL_PATCH_LEVEL "8.6.0" + +/* + *---------------------------------------------------------------------------- + * The following definitions set up the proper options for Windows compilers. + * We use this method because there is no autoconf equivalent. + */ + +#ifndef __WIN32__ +# if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__) || (defined(__WATCOMC__) && defined(__WINDOWS_386__)) +# define __WIN32__ +# ifndef WIN32 +# define WIN32 +# endif +# ifndef _WIN32 +# define _WIN32 +# endif +# endif +#endif + +/* + * STRICT: See MSDN Article Q83456 + */ + +#ifdef __WIN32__ +# ifndef STRICT +# define STRICT +# endif +#endif /* __WIN32__ */ + +/* + * Utility macros: STRINGIFY takes an argument and wraps it in "" (double + * quotation marks), JOIN joins two arguments. + */ + +#ifndef STRINGIFY +# define STRINGIFY(x) STRINGIFY1(x) +# define STRINGIFY1(x) #x +#endif +#ifndef JOIN +# define JOIN(a,b) JOIN1(a,b) +# define JOIN1(a,b) a##b +#endif + +/* + * A special definition used to allow this header file to be included from + * windows resource files so that they can obtain version information. + * RC_INVOKED is defined by default by the windows RC tool. + * + * Resource compilers don't like all the C stuff, like typedefs and function + * declarations, that occur below, so block them out. + */ + +#ifndef RC_INVOKED + +/* + * Special macro to define mutexes, that doesn't do anything if we are not + * using threads. + */ + +#ifdef TCL_THREADS +#define TCL_DECLARE_MUTEX(name) static Tcl_Mutex name; +#else +#define TCL_DECLARE_MUTEX(name) +#endif + +/* + * Tcl's public routine Tcl_FSSeek() uses the values SEEK_SET, SEEK_CUR, and + * SEEK_END, all #define'd by stdio.h . + * + * Also, many extensions need stdio.h, and they've grown accustomed to tcl.h + * providing it for them rather than #include-ing it themselves as they + * should, so also for their sake, we keep the #include to be consistent with + * prior Tcl releases. + */ + +#include + +/* + *---------------------------------------------------------------------------- + * Support for functions with a variable number of arguments. + * + * The following TCL_VARARGS* macros are to support old extensions + * written for older versions of Tcl where the macros permitted + * support for the varargs.h system as well as stdarg.h . + * + * New code should just directly be written to use stdarg.h conventions. + */ + +#include +#ifndef TCL_NO_DEPRECATED +# define TCL_VARARGS(type, name) (type name, ...) +# define TCL_VARARGS_DEF(type, name) (type name, ...) +# define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) +#endif +#if defined(__GNUC__) && (__GNUC__ > 2) +# define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) +#else +# define TCL_FORMAT_PRINTF(a,b) +#endif + +/* + * Allow a part of Tcl's API to be explicitly marked as deprecated. + * + * Used to make TIP 330/336 generate moans even if people use the + * compatibility macros. Change your code, guys! We won't support you forever. + */ + +#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC__MINOR__ >= 5)) +# define TCL_DEPRECATED_API(msg) __attribute__ ((__deprecated__ (msg))) +# else +# define TCL_DEPRECATED_API(msg) __attribute__ ((__deprecated__)) +# endif +#else +# define TCL_DEPRECATED_API(msg) /* nothing portable */ +#endif + +/* + *---------------------------------------------------------------------------- + * Macros used to declare a function to be exported by a DLL. Used by Windows, + * maps to no-op declarations on non-Windows systems. The default build on + * windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be + * nonempty. To build a static library, the macro STATIC_BUILD should be + * defined. + * + * Note: when building static but linking dynamically to MSVCRT we must still + * correctly decorate the C library imported function. Use CRTIMPORT + * for this purpose. _DLL is defined by the compiler when linking to + * MSVCRT. + */ + +#if (defined(__WIN32__) && (defined(_MSC_VER) || (__BORLANDC__ >= 0x0550) || defined(__LCC__) || defined(__WATCOMC__) || (defined(__GNUC__) && defined(__declspec)))) +# define HAVE_DECLSPEC 1 +# ifdef STATIC_BUILD +# define DLLIMPORT +# define DLLEXPORT +# ifdef _DLL +# define CRTIMPORT __declspec(dllimport) +# else +# define CRTIMPORT +# endif +# else +# define DLLIMPORT __declspec(dllimport) +# define DLLEXPORT __declspec(dllexport) +# define CRTIMPORT __declspec(dllimport) +# endif +#else +# define DLLIMPORT +# if defined(__GNUC__) && __GNUC__ > 3 +# define DLLEXPORT __attribute__ ((visibility("default"))) +# else +# define DLLEXPORT +# endif +# define CRTIMPORT +#endif + +/* + * These macros are used to control whether functions are being declared for + * import or export. If a function is being declared while it is being built + * to be included in a shared library, then it should have the DLLEXPORT + * storage class. If is being declared for use by a module that is going to + * link against the shared library, then it should have the DLLIMPORT storage + * class. If the symbol is beind declared for a static build or for use from a + * stub library, then the storage class should be empty. + * + * The convention is that a macro called BUILD_xxxx, where xxxx is the name of + * a library we are building, is set on the compile line for sources that are + * to be placed in the library. When this macro is set, the storage class will + * be set to DLLEXPORT. At the end of the header file, the storage class will + * be reset to DLLIMPORT. + */ + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +# define TCL_STORAGE_CLASS DLLEXPORT +#else +# ifdef USE_TCL_STUBS +# define TCL_STORAGE_CLASS +# else +# define TCL_STORAGE_CLASS DLLIMPORT +# endif +#endif + +/* + * The following _ANSI_ARGS_ macro is to support old extensions + * written for older versions of Tcl where it permitted support + * for compilers written in the pre-prototype era of C. + * + * New code should use prototypes. + */ + +#ifndef TCL_NO_DEPRECATED +# undef _ANSI_ARGS_ +# define _ANSI_ARGS_(x) x +#endif + +/* + * Definitions that allow this header file to be used either with or without + * ANSI C features. + */ + +#ifndef INLINE +# define INLINE +#endif + +#ifdef NO_CONST +# ifndef const +# define const +# endif +#endif +#ifndef CONST +# define CONST const +#endif + +#ifdef USE_NON_CONST +# ifdef USE_COMPAT_CONST +# error define at most one of USE_NON_CONST and USE_COMPAT_CONST +# endif +# define CONST84 +# define CONST84_RETURN +#else +# ifdef USE_COMPAT_CONST +# define CONST84 +# define CONST84_RETURN const +# else +# define CONST84 const +# define CONST84_RETURN const +# endif +#endif + +#ifndef CONST86 +# define CONST86 CONST84 +#endif + +/* + * Make sure EXTERN isn't defined elsewhere. + */ + +#ifdef EXTERN +# undef EXTERN +#endif /* EXTERN */ + +#ifdef __cplusplus +# define EXTERN extern "C" TCL_STORAGE_CLASS +#else +# define EXTERN extern TCL_STORAGE_CLASS +#endif + +/* + *---------------------------------------------------------------------------- + * The following code is copied from winnt.h. If we don't replicate it here, + * then can't be included after tcl.h, since tcl.h also defines + * VOID. This block is skipped under Cygwin and Mingw. + */ + +#if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID) +#ifndef VOID +#define VOID void +typedef char CHAR; +typedef short SHORT; +typedef long LONG; +#endif +#endif /* __WIN32__ && !HAVE_WINNT_IGNORE_VOID */ + +/* + * Macro to use instead of "void" for arguments that must have type "void *" + * in ANSI C; maps them to type "char *" in non-ANSI systems. + */ + +#ifndef NO_VOID +# define VOID void +#else +# define VOID char +#endif + +/* + * Miscellaneous declarations. + */ + +#ifndef _CLIENTDATA +# ifndef NO_VOID + typedef void *ClientData; +# else + typedef int *ClientData; +# endif +# define _CLIENTDATA +#endif + +/* + * Darwin specific configure overrides (to support fat compiles, where + * configure runs only once for multiple architectures): + */ + +#ifdef __APPLE__ +# ifdef __LP64__ +# undef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_IS_LONG 1 +# define TCL_CFG_DO64BIT 1 +# else /* !__LP64__ */ +# define TCL_WIDE_INT_TYPE long long +# undef TCL_WIDE_INT_IS_LONG +# undef TCL_CFG_DO64BIT +# endif /* __LP64__ */ +# undef HAVE_STRUCT_STAT64 +#endif /* __APPLE__ */ + +/* + * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define + * Tcl_WideUInt to be the unsigned variant of that type (assuming that where + * we have one, we can have the other.) + * + * Also defines the following macros: + * TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a real + * 64-bit system.) + * Tcl_WideAsLong - forgetful converter from wideInt to long. + * Tcl_LongAsWide - sign-extending converter from long to wideInt. + * Tcl_WideAsDouble - converter from wideInt to double. + * Tcl_DoubleAsWide - converter from double to wideInt. + * + * The following invariant should hold for any long value 'longVal': + * longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal)) + * + * Note on converting between Tcl_WideInt and strings. This implementation (in + * tclObj.c) depends on the function + * sprintf(...,"%" TCL_LL_MODIFIER "d",...). + */ + +#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG) +# if defined(__WIN32__) +# define TCL_WIDE_INT_TYPE __int64 +# ifdef __BORLANDC__ +# define TCL_LL_MODIFIER "L" +# else /* __BORLANDC__ */ +# define TCL_LL_MODIFIER "I64" +# endif /* __BORLANDC__ */ +# elif defined(__GNUC__) +# define TCL_WIDE_INT_TYPE long long +# define TCL_LL_MODIFIER "ll" +# else /* ! __WIN32__ && ! __GNUC__ */ +/* + * Don't know what platform it is and configure hasn't discovered what is + * going on for us. Try to guess... + */ +# ifdef NO_LIMITS_H +# error please define either TCL_WIDE_INT_TYPE or TCL_WIDE_INT_IS_LONG +# else /* !NO_LIMITS_H */ +# include +# if (INT_MAX < LONG_MAX) +# define TCL_WIDE_INT_IS_LONG 1 +# else +# define TCL_WIDE_INT_TYPE long long +# endif +# endif /* NO_LIMITS_H */ +# endif /* __WIN32__ */ +#endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ +#ifdef TCL_WIDE_INT_IS_LONG +# undef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_TYPE long +#endif /* TCL_WIDE_INT_IS_LONG */ + +typedef TCL_WIDE_INT_TYPE Tcl_WideInt; +typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; + +#ifdef TCL_WIDE_INT_IS_LONG +# define Tcl_WideAsLong(val) ((long)(val)) +# define Tcl_LongAsWide(val) ((long)(val)) +# define Tcl_WideAsDouble(val) ((double)((long)(val))) +# define Tcl_DoubleAsWide(val) ((long)((double)(val))) +# ifndef TCL_LL_MODIFIER +# define TCL_LL_MODIFIER "l" +# endif /* !TCL_LL_MODIFIER */ +#else /* TCL_WIDE_INT_IS_LONG */ +/* + * The next short section of defines are only done when not running on Windows + * or some other strange platform. + */ +# ifndef TCL_LL_MODIFIER +# define TCL_LL_MODIFIER "ll" +# endif /* !TCL_LL_MODIFIER */ +# define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) +# define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) +# define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) +# define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) +#endif /* TCL_WIDE_INT_IS_LONG */ + +#if defined(__WIN32__) +# ifdef __BORLANDC__ + typedef struct stati64 Tcl_StatBuf; +# elif defined(_WIN64) + typedef struct __stat64 Tcl_StatBuf; +# elif (defined(_MSC_VER) && (_MSC_VER < 1400)) || defined(_USE_32BIT_TIME_T) + typedef struct _stati64 Tcl_StatBuf; +# else + typedef struct _stat32i64 Tcl_StatBuf; +# endif /* _MSC_VER < 1400 */ +#elif defined(__CYGWIN__) + typedef struct _stat32i64 { + dev_t st_dev; + unsigned short st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + /* Here is a 2-byte gap */ + dev_t st_rdev; + /* Here is a 4-byte gap */ + long long st_size; + struct {long tv_sec;} st_atim; + struct {long tv_sec;} st_mtim; + struct {long tv_sec;} st_ctim; + /* Here is a 4-byte gap */ + } Tcl_StatBuf; +#elif defined(HAVE_STRUCT_STAT64) + typedef struct stat64 Tcl_StatBuf; +#else + typedef struct stat Tcl_StatBuf; +#endif + +/* + *---------------------------------------------------------------------------- + * Data structures defined opaquely in this module. The definitions below just + * provide dummy types. A few fields are made visible in Tcl_Interp + * structures, namely those used for returning a string result from commands. + * Direct access to the result field is discouraged in Tcl 8.0. The + * interpreter result is either an object or a string, and the two values are + * kept consistent unless some C code sets interp->result directly. + * Programmers should use either the function Tcl_GetObjResult() or + * Tcl_GetStringResult() to read the interpreter's result. See the SetResult + * man page for details. + * + * Note: any change to the Tcl_Interp definition below must be mirrored in the + * "real" definition in tclInt.h. + * + * Note: Tcl_ObjCmdProc functions do not directly set result and freeProc. + * Instead, they set a Tcl_Obj member in the "real" structure that can be + * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). + */ + +typedef struct Tcl_Interp +#ifndef TCL_NO_DEPRECATED +{ + /* TIP #330: Strongly discourage extensions from using the string + * result. */ +#ifdef USE_INTERP_RESULT + char *result TCL_DEPRECATED_API("use Tcl_GetResult/Tcl_SetResult"); + /* If the last command returned a string + * result, this points to it. */ + void (*freeProc) (char *blockPtr) + TCL_DEPRECATED_API("use Tcl_GetResult/Tcl_SetResult"); + /* Zero means the string result is statically + * allocated. TCL_DYNAMIC means it was + * allocated with ckalloc and should be freed + * with ckfree. Other values give the address + * of function to invoke to free the result. + * Tcl_Eval must free it before executing next + * command. */ +#else + char *resultDontUse; /* Don't use in extensions! */ + void (*freeProcDontUse) (char *); /* Don't use in extensions! */ +#endif +#ifdef USE_INTERP_ERRORLINE + int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine"); + /* When TCL_ERROR is returned, this gives the + * line number within the command where the + * error occurred (1 if first line). */ +#else + int errorLineDontUse; /* Don't use in extensions! */ +#endif +} +#endif /* TCL_NO_DEPRECATED */ +Tcl_Interp; + +typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; +typedef struct Tcl_Channel_ *Tcl_Channel; +typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion; +typedef struct Tcl_Command_ *Tcl_Command; +typedef struct Tcl_Condition_ *Tcl_Condition; +typedef struct Tcl_Dict_ *Tcl_Dict; +typedef struct Tcl_EncodingState_ *Tcl_EncodingState; +typedef struct Tcl_Encoding_ *Tcl_Encoding; +typedef struct Tcl_Event Tcl_Event; +typedef struct Tcl_InterpState_ *Tcl_InterpState; +typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle; +typedef struct Tcl_Mutex_ *Tcl_Mutex; +typedef struct Tcl_Pid_ *Tcl_Pid; +typedef struct Tcl_RegExp_ *Tcl_RegExp; +typedef struct Tcl_ThreadDataKey_ *Tcl_ThreadDataKey; +typedef struct Tcl_ThreadId_ *Tcl_ThreadId; +typedef struct Tcl_TimerToken_ *Tcl_TimerToken; +typedef struct Tcl_Trace_ *Tcl_Trace; +typedef struct Tcl_Var_ *Tcl_Var; +typedef struct Tcl_ZLibStream_ *Tcl_ZlibStream; + +/* + *---------------------------------------------------------------------------- + * Definition of the interface to functions implementing threads. A function + * following this definition is given to each call of 'Tcl_CreateThread' and + * will be called as the main fuction of the new thread created by that call. + */ + +#if defined __WIN32__ +typedef unsigned (__stdcall Tcl_ThreadCreateProc) (ClientData clientData); +#else +typedef void (Tcl_ThreadCreateProc) (ClientData clientData); +#endif + +/* + * Threading function return types used for abstracting away platform + * differences when writing a Tcl_ThreadCreateProc. See the NewThread function + * in generic/tclThreadTest.c for it's usage. + */ + +#if defined __WIN32__ +# define Tcl_ThreadCreateType unsigned __stdcall +# define TCL_THREAD_CREATE_RETURN return 0 +#else +# define Tcl_ThreadCreateType void +# define TCL_THREAD_CREATE_RETURN +#endif + +/* + * Definition of values for default stacksize and the possible flags to be + * given to Tcl_CreateThread. + */ + +#define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack. */ +#define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default + * behaviour. */ +#define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable. */ + +/* + * Flag values passed to Tcl_StringCaseMatch. + */ + +#define TCL_MATCH_NOCASE (1<<0) + +/* + * Flag values passed to Tcl_GetRegExpFromObj. + */ + +#define TCL_REG_BASIC 000000 /* BREs (convenience). */ +#define TCL_REG_EXTENDED 000001 /* EREs. */ +#define TCL_REG_ADVF 000002 /* Advanced features in EREs. */ +#define TCL_REG_ADVANCED 000003 /* AREs (which are also EREs). */ +#define TCL_REG_QUOTE 000004 /* No special characters, none. */ +#define TCL_REG_NOCASE 000010 /* Ignore case. */ +#define TCL_REG_NOSUB 000020 /* Don't care about subexpressions. */ +#define TCL_REG_EXPANDED 000040 /* Expanded format, white space & + * comments. */ +#define TCL_REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ +#define TCL_REG_NLANCH 000200 /* ^ matches after \n, $ before. */ +#define TCL_REG_NEWLINE 000300 /* Newlines are line terminators. */ +#define TCL_REG_CANMATCH 001000 /* Report details on partial/limited + * matches. */ + +/* + * Flags values passed to Tcl_RegExpExecObj. + */ + +#define TCL_REG_NOTBOL 0001 /* Beginning of string does not match ^. */ +#define TCL_REG_NOTEOL 0002 /* End of string does not match $. */ + +/* + * Structures filled in by Tcl_RegExpInfo. Note that all offset values are + * relative to the start of the match string, not the beginning of the entire + * string. + */ + +typedef struct Tcl_RegExpIndices { + long start; /* Character offset of first character in + * match. */ + long end; /* Character offset of first character after + * the match. */ +} Tcl_RegExpIndices; + +typedef struct Tcl_RegExpInfo { + int nsubs; /* Number of subexpressions in the compiled + * expression. */ + Tcl_RegExpIndices *matches; /* Array of nsubs match offset pairs. */ + long extendStart; /* The offset at which a subsequent match + * might begin. */ + long reserved; /* Reserved for later use. */ +} Tcl_RegExpInfo; + +/* + * Picky compilers complain if this typdef doesn't appear before the struct's + * reference in tclDecls.h. + */ + +typedef Tcl_StatBuf *Tcl_Stat_; +typedef struct stat *Tcl_OldStat_; + +/* + *---------------------------------------------------------------------------- + * When a TCL command returns, the interpreter contains a result from the + * command. Programmers are strongly encouraged to use one of the functions + * Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's + * result. See the SetResult man page for details. Besides this result, the + * command function returns an integer code, which is one of the following: + * + * TCL_OK Command completed normally; the interpreter's result + * contains the command's result. + * TCL_ERROR The command couldn't be completed successfully; the + * interpreter's result describes what went wrong. + * TCL_RETURN The command requests that the current function return; + * the interpreter's result contains the function's + * return value. + * TCL_BREAK The command requests that the innermost loop be + * exited; the interpreter's result is meaningless. + * TCL_CONTINUE Go on to the next iteration of the current loop; the + * interpreter's result is meaningless. + */ + +#define TCL_OK 0 +#define TCL_ERROR 1 +#define TCL_RETURN 2 +#define TCL_BREAK 3 +#define TCL_CONTINUE 4 + +#define TCL_RESULT_SIZE 200 + +/* + *---------------------------------------------------------------------------- + * Flags to control what substitutions are performed by Tcl_SubstObj(): + */ + +#define TCL_SUBST_COMMANDS 001 +#define TCL_SUBST_VARIABLES 002 +#define TCL_SUBST_BACKSLASHES 004 +#define TCL_SUBST_ALL 007 + +/* + * Argument descriptors for math function callbacks in expressions: + */ + +typedef enum { + TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT +} Tcl_ValueType; + +typedef struct Tcl_Value { + Tcl_ValueType type; /* Indicates intValue or doubleValue is valid, + * or both. */ + long intValue; /* Integer value. */ + double doubleValue; /* Double-precision floating value. */ + Tcl_WideInt wideValue; /* Wide (min. 64-bit) integer value. */ +} Tcl_Value; + +/* + * Forward declaration of Tcl_Obj to prevent an error when the forward + * reference to Tcl_Obj is encountered in the function types declared below. + */ + +struct Tcl_Obj; + +/* + *---------------------------------------------------------------------------- + * Function types defined by Tcl: + */ + +typedef int (Tcl_AppInitProc) (Tcl_Interp *interp); +typedef int (Tcl_AsyncProc) (ClientData clientData, Tcl_Interp *interp, + int code); +typedef void (Tcl_ChannelProc) (ClientData clientData, int mask); +typedef void (Tcl_CloseProc) (ClientData data); +typedef void (Tcl_CmdDeleteProc) (ClientData clientData); +typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp, + int argc, CONST84 char *argv[]); +typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp, + int level, char *command, Tcl_CmdProc *proc, + ClientData cmdClientData, int argc, CONST84 char *argv[]); +typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp, + int level, const char *command, Tcl_Command commandInfo, int objc, + struct Tcl_Obj *const *objv); +typedef void (Tcl_CmdObjTraceDeleteProc) (ClientData clientData); +typedef void (Tcl_DupInternalRepProc) (struct Tcl_Obj *srcPtr, + struct Tcl_Obj *dupPtr); +typedef int (Tcl_EncodingConvertProc) (ClientData clientData, const char *src, + int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, + int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); +typedef void (Tcl_EncodingFreeProc) (ClientData clientData); +typedef int (Tcl_EventProc) (Tcl_Event *evPtr, int flags); +typedef void (Tcl_EventCheckProc) (ClientData clientData, int flags); +typedef int (Tcl_EventDeleteProc) (Tcl_Event *evPtr, ClientData clientData); +typedef void (Tcl_EventSetupProc) (ClientData clientData, int flags); +typedef void (Tcl_ExitProc) (ClientData clientData); +typedef void (Tcl_FileProc) (ClientData clientData, int mask); +typedef void (Tcl_FileFreeProc) (ClientData clientData); +typedef void (Tcl_FreeInternalRepProc) (struct Tcl_Obj *objPtr); +typedef void (Tcl_FreeProc) (char *blockPtr); +typedef void (Tcl_IdleProc) (ClientData clientData); +typedef void (Tcl_InterpDeleteProc) (ClientData clientData, + Tcl_Interp *interp); +typedef int (Tcl_MathProc) (ClientData clientData, Tcl_Interp *interp, + Tcl_Value *args, Tcl_Value *resultPtr); +typedef void (Tcl_NamespaceDeleteProc) (ClientData clientData); +typedef int (Tcl_ObjCmdProc) (ClientData clientData, Tcl_Interp *interp, + int objc, struct Tcl_Obj *const *objv); +typedef int (Tcl_PackageInitProc) (Tcl_Interp *interp); +typedef int (Tcl_PackageUnloadProc) (Tcl_Interp *interp, int flags); +typedef void (Tcl_PanicProc) (const char *format, ...); +typedef void (Tcl_TcpAcceptProc) (ClientData callbackData, Tcl_Channel chan, + char *address, int port); +typedef void (Tcl_TimerProc) (ClientData clientData); +typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr); +typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr); +typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp, + CONST84 char *part1, CONST84 char *part2, int flags); +typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp, + const char *oldName, const char *newName, int flags); +typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc, + ClientData clientData); +typedef void (Tcl_DeleteFileHandlerProc) (int fd); +typedef void (Tcl_AlertNotifierProc) (ClientData clientData); +typedef void (Tcl_ServiceModeHookProc) (int mode); +typedef ClientData (Tcl_InitNotifierProc) (void); +typedef void (Tcl_FinalizeNotifierProc) (ClientData clientData); +typedef void (Tcl_MainLoopProc) (void); + +/* + *---------------------------------------------------------------------------- + * The following structure represents a type of object, which is a particular + * internal representation for an object plus a set of functions that provide + * standard operations on objects of that type. + */ + +typedef struct Tcl_ObjType { + const char *name; /* Name of the type, e.g. "int". */ + Tcl_FreeInternalRepProc *freeIntRepProc; + /* Called to free any storage for the type's + * internal rep. NULL if the internal rep does + * not need freeing. */ + Tcl_DupInternalRepProc *dupIntRepProc; + /* Called to create a new object as a copy of + * an existing object. */ + Tcl_UpdateStringProc *updateStringProc; + /* Called to update the string rep from the + * type's internal representation. */ + Tcl_SetFromAnyProc *setFromAnyProc; + /* Called to convert the object's internal rep + * to this type. Frees the internal rep of the + * old type. Returns TCL_ERROR on failure. */ +} Tcl_ObjType; + +/* + * One of the following structures exists for each object in the Tcl system. + * An object stores a value as either a string, some internal representation, + * or both. + */ + +typedef struct Tcl_Obj { + int refCount; /* When 0 the object will be freed. */ + char *bytes; /* This points to the first byte of the + * object's string representation. The array + * must be followed by a null byte (i.e., at + * offset length) but may also contain + * embedded null characters. The array's + * storage is allocated by ckalloc. NULL means + * the string rep is invalid and must be + * regenerated from the internal rep. Clients + * should use Tcl_GetStringFromObj or + * Tcl_GetString to get a pointer to the byte + * array as a readonly value. */ + int length; /* The number of bytes at *bytes, not + * including the terminating null. */ + const Tcl_ObjType *typePtr; /* Denotes the object's type. Always + * corresponds to the type of the object's + * internal rep. NULL indicates the object has + * no internal rep (has no type). */ + union { /* The internal representation: */ + long longValue; /* - an long integer value. */ + double doubleValue; /* - a double-precision floating value. */ + void *otherValuePtr; /* - another, type-specific value. */ + Tcl_WideInt wideValue; /* - a long long value. */ + struct { /* - internal rep as two pointers. */ + void *ptr1; + void *ptr2; + } twoPtrValue; + struct { /* - internal rep as a pointer and a long, + * the main use of which is a bignum's + * tightly packed fields, where the alloc, + * used and signum flags are packed into a + * single word with everything else hung + * off the pointer. */ + void *ptr; + unsigned long value; + } ptrAndLongRep; + } internalRep; +} Tcl_Obj; + +/* + * Macros to increment and decrement a Tcl_Obj's reference count, and to test + * whether an object is shared (i.e. has reference count > 1). Note: clients + * should use Tcl_DecrRefCount() when they are finished using an object, and + * should never call TclFreeObj() directly. TclFreeObj() is only defined and + * made public in tcl.h to support Tcl_DecrRefCount's macro definition. + */ + +void Tcl_IncrRefCount(Tcl_Obj *objPtr); +void Tcl_DecrRefCount(Tcl_Obj *objPtr); +int Tcl_IsShared(Tcl_Obj *objPtr); + +/* + *---------------------------------------------------------------------------- + * The following structure contains the state needed by Tcl_SaveResult. No-one + * outside of Tcl should access any of these fields. This structure is + * typically allocated on the stack. + */ + +typedef struct Tcl_SavedResult { + char *result; + Tcl_FreeProc *freeProc; + Tcl_Obj *objResultPtr; + char *appendResult; + int appendAvl; + int appendUsed; + char resultSpace[TCL_RESULT_SIZE+1]; +} Tcl_SavedResult; + +/* + *---------------------------------------------------------------------------- + * The following definitions support Tcl's namespace facility. Note: the first + * five fields must match exactly the fields in a Namespace structure (see + * tclInt.h). + */ + +typedef struct Tcl_Namespace { + char *name; /* The namespace's name within its parent + * namespace. This contains no ::'s. The name + * of the global namespace is "" although "::" + * is an synonym. */ + char *fullName; /* The namespace's fully qualified name. This + * starts with ::. */ + ClientData clientData; /* Arbitrary value associated with this + * namespace. */ + Tcl_NamespaceDeleteProc *deleteProc; + /* Function invoked when deleting the + * namespace to, e.g., free clientData. */ + struct Tcl_Namespace *parentPtr; + /* Points to the namespace that contains this + * one. NULL if this is the global + * namespace. */ +} Tcl_Namespace; + +/* + *---------------------------------------------------------------------------- + * The following structure represents a call frame, or activation record. A + * call frame defines a naming context for a procedure call: its local scope + * (for local variables) and its namespace scope (used for non-local + * variables; often the global :: namespace). A call frame can also define the + * naming context for a namespace eval or namespace inscope command: the + * namespace in which the command's code should execute. The Tcl_CallFrame + * structures exist only while procedures or namespace eval/inscope's are + * being executed, and provide a Tcl call stack. + * + * A call frame is initialized and pushed using Tcl_PushCallFrame and popped + * using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the + * Tcl_PushCallFrame caller, and callers typically allocate them on the C call + * stack for efficiency. For this reason, Tcl_CallFrame is defined as a + * structure and not as an opaque token. However, most Tcl_CallFrame fields + * are hidden since applications should not access them directly; others are + * declared as "dummyX". + * + * WARNING!! The structure definition must be kept consistent with the + * CallFrame structure in tclInt.h. If you change one, change the other. + */ + +typedef struct Tcl_CallFrame { + Tcl_Namespace *nsPtr; + int dummy1; + int dummy2; + void *dummy3; + void *dummy4; + void *dummy5; + int dummy6; + void *dummy7; + void *dummy8; + int dummy9; + void *dummy10; + void *dummy11; + void *dummy12; + void *dummy13; +} Tcl_CallFrame; + +/* + *---------------------------------------------------------------------------- + * Information about commands that is returned by Tcl_GetCommandInfo and + * passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command + * function while proc is a traditional Tcl argc/argv string-based function. + * Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and + * proc are non-NULL and can be called to execute the command. However, it may + * be faster to call one instead of the other. The member isNativeObjectProc + * is set to 1 if an object-based function was registered by + * Tcl_CreateObjCommand, and to 0 if a string-based function was registered by + * Tcl_CreateCommand. The other function is typically set to a compatibility + * wrapper that does string-to-object or object-to-string argument conversions + * then calls the other function. + */ + +typedef struct Tcl_CmdInfo { + int isNativeObjectProc; /* 1 if objProc was registered by a call to + * Tcl_CreateObjCommand; 0 otherwise. + * Tcl_SetCmdInfo does not modify this + * field. */ + Tcl_ObjCmdProc *objProc; /* Command's object-based function. */ + ClientData objClientData; /* ClientData for object proc. */ + Tcl_CmdProc *proc; /* Command's string-based function. */ + ClientData clientData; /* ClientData for string proc. */ + Tcl_CmdDeleteProc *deleteProc; + /* Function to call when command is + * deleted. */ + ClientData deleteData; /* Value to pass to deleteProc (usually the + * same as clientData). */ + Tcl_Namespace *namespacePtr;/* Points to the namespace that contains this + * command. Note that Tcl_SetCmdInfo will not + * change a command's namespace; use + * TclRenameCommand or Tcl_Eval (of 'rename') + * to do that. */ +} Tcl_CmdInfo; + +/* + *---------------------------------------------------------------------------- + * The structure defined below is used to hold dynamic strings. The only + * fields that clients should use are string and length, accessible via the + * macros Tcl_DStringValue and Tcl_DStringLength. + */ + +#define TCL_DSTRING_STATIC_SIZE 200 +typedef struct Tcl_DString { + char *string; /* Points to beginning of string: either + * staticSpace below or a malloced array. */ + int length; /* Number of non-NULL characters in the + * string. */ + int spaceAvl; /* Total number of bytes available for the + * string and its terminating NULL char. */ + char staticSpace[TCL_DSTRING_STATIC_SIZE]; + /* Space to use in common case where string is + * small. */ +} Tcl_DString; + +#define Tcl_DStringLength(dsPtr) ((dsPtr)->length) +#define Tcl_DStringValue(dsPtr) ((dsPtr)->string) +#define Tcl_DStringTrunc Tcl_DStringSetLength + +/* + * Definitions for the maximum number of digits of precision that may be + * specified in the "tcl_precision" variable, and the number of bytes of + * buffer space required by Tcl_PrintDouble. + */ + +#define TCL_MAX_PREC 17 +#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10) + +/* + * Definition for a number of bytes of buffer space sufficient to hold the + * string representation of an integer in base 10 (assuming the existence of + * 64-bit integers). + */ + +#define TCL_INTEGER_SPACE 24 + +/* + * Flag values passed to Tcl_ConvertElement. + * TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to + * use backslash quoting instead. + * TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It + * is safe to leave the hash unquoted when the element is not the first + * element of a list, and this flag can be used by the caller to indicate + * that condition. + */ + +#define TCL_DONT_USE_BRACES 1 +#define TCL_DONT_QUOTE_HASH 8 + +/* + * Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow + * abbreviated strings. + */ + +#define TCL_EXACT 1 + +/* + *---------------------------------------------------------------------------- + * Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv. + * WARNING: these bit choices must not conflict with the bit choices for + * evalFlag bits in tclInt.h! + * + * Meanings: + * TCL_NO_EVAL: Just record this command + * TCL_EVAL_GLOBAL: Execute script in global namespace + * TCL_EVAL_DIRECT: Do not compile this script + * TCL_EVAL_INVOKE: Magical Tcl_EvalObjv mode for aliases/ensembles + * o Run in iPtr->lookupNsPtr or global namespace + * o Cut out of error traces + * o Don't reset the flags controlling ensemble + * error message rewriting. + * TCL_CANCEL_UNWIND: Magical Tcl_CancelEval mode that causes the + * stack for the script in progress to be + * completely unwound. + * TCL_EVAL_NOERR: Do no exception reporting at all, just return + * as the caller will report. + */ + +#define TCL_NO_EVAL 0x010000 +#define TCL_EVAL_GLOBAL 0x020000 +#define TCL_EVAL_DIRECT 0x040000 +#define TCL_EVAL_INVOKE 0x080000 +#define TCL_CANCEL_UNWIND 0x100000 +#define TCL_EVAL_NOERR 0x200000 + +/* + * Special freeProc values that may be passed to Tcl_SetResult (see the man + * page for details): + */ + +#define TCL_VOLATILE ((Tcl_FreeProc *) 1) +#define TCL_STATIC ((Tcl_FreeProc *) 0) +#define TCL_DYNAMIC ((Tcl_FreeProc *) 3) + +/* + * Flag values passed to variable-related functions. + * WARNING: these bit choices must not conflict with the bit choice for + * TCL_CANCEL_UNWIND, above. + */ + +#define TCL_GLOBAL_ONLY 1 +#define TCL_NAMESPACE_ONLY 2 +#define TCL_APPEND_VALUE 4 +#define TCL_LIST_ELEMENT 8 +#define TCL_TRACE_READS 0x10 +#define TCL_TRACE_WRITES 0x20 +#define TCL_TRACE_UNSETS 0x40 +#define TCL_TRACE_DESTROYED 0x80 +#define TCL_INTERP_DESTROYED 0x100 +#define TCL_LEAVE_ERR_MSG 0x200 +#define TCL_TRACE_ARRAY 0x800 +#ifndef TCL_REMOVE_OBSOLETE_TRACES +/* Required to support old variable/vdelete/vinfo traces. */ +#define TCL_TRACE_OLD_STYLE 0x1000 +#endif +/* Indicate the semantics of the result of a trace. */ +#define TCL_TRACE_RESULT_DYNAMIC 0x8000 +#define TCL_TRACE_RESULT_OBJECT 0x10000 + +/* + * Flag values for ensemble commands. + */ + +#define TCL_ENSEMBLE_PREFIX 0x02/* Flag value to say whether to allow + * unambiguous prefixes of commands or to + * require exact matches for command names. */ + +/* + * Flag values passed to command-related functions. + */ + +#define TCL_TRACE_RENAME 0x2000 +#define TCL_TRACE_DELETE 0x4000 + +#define TCL_ALLOW_INLINE_COMPILATION 0x20000 + +/* + * The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now + * always parsed whenever the part2 is NULL. (This is to avoid a common error + * when converting code to use the new object based APIs and forgetting to + * give the flag) + */ + +#ifndef TCL_NO_DEPRECATED +# define TCL_PARSE_PART1 0x400 +#endif + +/* + * Types for linked variables: + */ + +#define TCL_LINK_INT 1 +#define TCL_LINK_DOUBLE 2 +#define TCL_LINK_BOOLEAN 3 +#define TCL_LINK_STRING 4 +#define TCL_LINK_WIDE_INT 5 +#define TCL_LINK_CHAR 6 +#define TCL_LINK_UCHAR 7 +#define TCL_LINK_SHORT 8 +#define TCL_LINK_USHORT 9 +#define TCL_LINK_UINT 10 +#define TCL_LINK_LONG 11 +#define TCL_LINK_ULONG 12 +#define TCL_LINK_FLOAT 13 +#define TCL_LINK_WIDE_UINT 14 +#define TCL_LINK_READ_ONLY 0x80 + +/* + *---------------------------------------------------------------------------- + * Forward declarations of Tcl_HashTable and related types. + */ + +typedef struct Tcl_HashKeyType Tcl_HashKeyType; +typedef struct Tcl_HashTable Tcl_HashTable; +typedef struct Tcl_HashEntry Tcl_HashEntry; + +typedef unsigned (Tcl_HashKeyProc) (Tcl_HashTable *tablePtr, void *keyPtr); +typedef int (Tcl_CompareHashKeysProc) (void *keyPtr, Tcl_HashEntry *hPtr); +typedef Tcl_HashEntry * (Tcl_AllocHashEntryProc) (Tcl_HashTable *tablePtr, + void *keyPtr); +typedef void (Tcl_FreeHashEntryProc) (Tcl_HashEntry *hPtr); + +/* + * This flag controls whether the hash table stores the hash of a key, or + * recalculates it. There should be no reason for turning this flag off as it + * is completely binary and source compatible unless you directly access the + * bucketPtr member of the Tcl_HashTableEntry structure. This member has been + * removed and the space used to store the hash value. + */ + +#ifndef TCL_HASH_KEY_STORE_HASH +# define TCL_HASH_KEY_STORE_HASH 1 +#endif + +/* + * Structure definition for an entry in a hash table. No-one outside Tcl + * should access any of these fields directly; use the macros defined below. + */ + +struct Tcl_HashEntry { + Tcl_HashEntry *nextPtr; /* Pointer to next entry in this hash bucket, + * or NULL for end of chain. */ + Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */ +#if TCL_HASH_KEY_STORE_HASH + void *hash; /* Hash value, stored as pointer to ensure + * that the offsets of the fields in this + * structure are not changed. */ +#else + Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to first + * entry in this entry's chain: used for + * deleting the entry. */ +#endif + ClientData clientData; /* Application stores something here with + * Tcl_SetHashValue. */ + union { /* Key has one of these forms: */ + char *oneWordValue; /* One-word value for key. */ + Tcl_Obj *objPtr; /* Tcl_Obj * key value. */ + int words[1]; /* Multiple integer words for key. The actual + * size will be as large as necessary for this + * table's keys. */ + char string[1]; /* String for key. The actual size will be as + * large as needed to hold the key. */ + } key; /* MUST BE LAST FIELD IN RECORD!! */ +}; + +/* + * Flags used in Tcl_HashKeyType. + * + * TCL_HASH_KEY_RANDOMIZE_HASH - + * There are some things, pointers for example + * which don't hash well because they do not use + * the lower bits. If this flag is set then the + * hash table will attempt to rectify this by + * randomising the bits and then using the upper + * N bits as the index into the table. + * TCL_HASH_KEY_SYSTEM_HASH - If this flag is set then all memory internally + * allocated for the hash table that is not for an + * entry will use the system heap. + */ + +#define TCL_HASH_KEY_RANDOMIZE_HASH 0x1 +#define TCL_HASH_KEY_SYSTEM_HASH 0x2 + +/* + * Structure definition for the methods associated with a hash table key type. + */ + +#define TCL_HASH_KEY_TYPE_VERSION 1 +struct Tcl_HashKeyType { + int version; /* Version of the table. If this structure is + * extended in future then the version can be + * used to distinguish between different + * structures. */ + int flags; /* Flags, see above for details. */ + Tcl_HashKeyProc *hashKeyProc; + /* Calculates a hash value for the key. If + * this is NULL then the pointer itself is + * used as a hash value. */ + Tcl_CompareHashKeysProc *compareKeysProc; + /* Compares two keys and returns zero if they + * do not match, and non-zero if they do. If + * this is NULL then the pointers are + * compared. */ + Tcl_AllocHashEntryProc *allocEntryProc; + /* Called to allocate memory for a new entry, + * i.e. if the key is a string then this could + * allocate a single block which contains + * enough space for both the entry and the + * string. Only the key field of the allocated + * Tcl_HashEntry structure needs to be filled + * in. If something else needs to be done to + * the key, i.e. incrementing a reference + * count then that should be done by this + * function. If this is NULL then Tcl_Alloc is + * used to allocate enough space for a + * Tcl_HashEntry and the key pointer is + * assigned to key.oneWordValue. */ + Tcl_FreeHashEntryProc *freeEntryProc; + /* Called to free memory associated with an + * entry. If something else needs to be done + * to the key, i.e. decrementing a reference + * count then that should be done by this + * function. If this is NULL then Tcl_Free is + * used to free the Tcl_HashEntry. */ +}; + +/* + * Structure definition for a hash table. Must be in tcl.h so clients can + * allocate space for these structures, but clients should never access any + * fields in this structure. + */ + +#define TCL_SMALL_HASH_TABLE 4 +struct Tcl_HashTable { + Tcl_HashEntry **buckets; /* Pointer to bucket array. Each element + * points to first entry in bucket's hash + * chain, or NULL. */ + Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE]; + /* Bucket array used for small tables (to + * avoid mallocs and frees). */ + int numBuckets; /* Total number of buckets allocated at + * **bucketPtr. */ + int numEntries; /* Total number of entries present in + * table. */ + int rebuildSize; /* Enlarge table when numEntries gets to be + * this large. */ + int downShift; /* Shift count used in hashing function. + * Designed to use high-order bits of + * randomized keys. */ + int mask; /* Mask value used in hashing function. */ + int keyType; /* Type of keys used in this table. It's + * either TCL_CUSTOM_KEYS, TCL_STRING_KEYS, + * TCL_ONE_WORD_KEYS, or an integer giving the + * number of ints that is the size of the + * key. */ + Tcl_HashEntry *(*findProc) (Tcl_HashTable *tablePtr, const char *key); + Tcl_HashEntry *(*createProc) (Tcl_HashTable *tablePtr, const char *key, + int *newPtr); + const Tcl_HashKeyType *typePtr; + /* Type of the keys used in the + * Tcl_HashTable. */ +}; + +/* + * Structure definition for information used to keep track of searches through + * hash tables: + */ + +typedef struct Tcl_HashSearch { + Tcl_HashTable *tablePtr; /* Table being searched. */ + int nextIndex; /* Index of next bucket to be enumerated after + * present one. */ + Tcl_HashEntry *nextEntryPtr;/* Next entry to be enumerated in the current + * bucket. */ +} Tcl_HashSearch; + +/* + * Acceptable key types for hash tables: + * + * TCL_STRING_KEYS: The keys are strings, they are copied into the + * entry. + * TCL_ONE_WORD_KEYS: The keys are pointers, the pointer is stored + * in the entry. + * TCL_CUSTOM_TYPE_KEYS: The keys are arbitrary types which are copied + * into the entry. + * TCL_CUSTOM_PTR_KEYS: The keys are pointers to arbitrary types, the + * pointer is stored in the entry. + * + * While maintaining binary compatability the above have to be distinct values + * as they are used to differentiate between old versions of the hash table + * which don't have a typePtr and new ones which do. Once binary compatability + * is discarded in favour of making more wide spread changes TCL_STRING_KEYS + * can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the + * same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is + * accessed from the entry and not the behaviour. + */ + +#define TCL_STRING_KEYS (0) +#define TCL_ONE_WORD_KEYS (1) +#define TCL_CUSTOM_TYPE_KEYS (-2) +#define TCL_CUSTOM_PTR_KEYS (-1) + +/* + * Structure definition for information used to keep track of searches through + * dictionaries. These fields should not be accessed by code outside + * tclDictObj.c + */ + +typedef struct { + void *next; /* Search position for underlying hash + * table. */ + int epoch; /* Epoch marker for dictionary being searched, + * or -1 if search has terminated. */ + Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ +} Tcl_DictSearch; + +/* + *---------------------------------------------------------------------------- + * Flag values to pass to Tcl_DoOneEvent to disable searches for some kinds of + * events: + */ + +#define TCL_DONT_WAIT (1<<1) +#define TCL_WINDOW_EVENTS (1<<2) +#define TCL_FILE_EVENTS (1<<3) +#define TCL_TIMER_EVENTS (1<<4) +#define TCL_IDLE_EVENTS (1<<5) /* WAS 0x10 ???? */ +#define TCL_ALL_EVENTS (~TCL_DONT_WAIT) + +/* + * The following structure defines a generic event for the Tcl event system. + * These are the things that are queued in calls to Tcl_QueueEvent and + * serviced later by Tcl_DoOneEvent. There can be many different kinds of + * events with different fields, corresponding to window events, timer events, + * etc. The structure for a particular event consists of a Tcl_Event header + * followed by additional information specific to that event. + */ + +struct Tcl_Event { + Tcl_EventProc *proc; /* Function to call to service this event. */ + struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */ +}; + +/* + * Positions to pass to Tcl_QueueEvent: + */ + +typedef enum { + TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK +} Tcl_QueuePosition; + +/* + * Values to pass to Tcl_SetServiceMode to specify the behavior of notifier + * event routines. + */ + +#define TCL_SERVICE_NONE 0 +#define TCL_SERVICE_ALL 1 + +/* + * The following structure keeps is used to hold a time value, either as an + * absolute time (the number of seconds from the epoch) or as an elapsed time. + * On Unix systems the epoch is Midnight Jan 1, 1970 GMT. + */ + +typedef struct Tcl_Time { + long sec; /* Seconds. */ + long usec; /* Microseconds. */ +} Tcl_Time; + +typedef void (Tcl_SetTimerProc) (CONST86 Tcl_Time *timePtr); +typedef int (Tcl_WaitForEventProc) (CONST86 Tcl_Time *timePtr); + +/* + * TIP #233 (Virtualized Time) + */ + +typedef void (Tcl_GetTimeProc) (Tcl_Time *timebuf, ClientData clientData); +typedef void (Tcl_ScaleTimeProc) (Tcl_Time *timebuf, ClientData clientData); + +/* + *---------------------------------------------------------------------------- + * Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler to + * indicate what sorts of events are of interest: + */ + +#define TCL_READABLE (1<<1) +#define TCL_WRITABLE (1<<2) +#define TCL_EXCEPTION (1<<3) + +/* + * Flag values to pass to Tcl_OpenCommandChannel to indicate the disposition + * of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR, are also used in + * Tcl_GetStdChannel. + */ + +#define TCL_STDIN (1<<1) +#define TCL_STDOUT (1<<2) +#define TCL_STDERR (1<<3) +#define TCL_ENFORCE_MODE (1<<4) + +/* + * Bits passed to Tcl_DriverClose2Proc to indicate which side of a channel + * should be closed. + */ + +#define TCL_CLOSE_READ (1<<1) +#define TCL_CLOSE_WRITE (1<<2) + +/* + * Value to use as the closeProc for a channel that supports the close2Proc + * interface. + */ + +#define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *) 1) + +/* + * Channel version tag. This was introduced in 8.3.2/8.4. + */ + +#define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1) +#define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2) +#define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3) +#define TCL_CHANNEL_VERSION_4 ((Tcl_ChannelTypeVersion) 0x4) +#define TCL_CHANNEL_VERSION_5 ((Tcl_ChannelTypeVersion) 0x5) + +/* + * TIP #218: Channel Actions, Ids for Tcl_DriverThreadActionProc. + */ + +#define TCL_CHANNEL_THREAD_INSERT (0) +#define TCL_CHANNEL_THREAD_REMOVE (1) + +/* + * Typedefs for the various operations in a channel type: + */ + +typedef int (Tcl_DriverBlockModeProc) (ClientData instanceData, int mode); +typedef int (Tcl_DriverCloseProc) (ClientData instanceData, + Tcl_Interp *interp); +typedef int (Tcl_DriverClose2Proc) (ClientData instanceData, + Tcl_Interp *interp, int flags); +typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf, + int toRead, int *errorCodePtr); +typedef int (Tcl_DriverOutputProc) (ClientData instanceData, + CONST84 char *buf, int toWrite, int *errorCodePtr); +typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset, + int mode, int *errorCodePtr); +typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData, + Tcl_Interp *interp, const char *optionName, + const char *value); +typedef int (Tcl_DriverGetOptionProc) (ClientData instanceData, + Tcl_Interp *interp, CONST84 char *optionName, + Tcl_DString *dsPtr); +typedef void (Tcl_DriverWatchProc) (ClientData instanceData, int mask); +typedef int (Tcl_DriverGetHandleProc) (ClientData instanceData, + int direction, ClientData *handlePtr); +typedef int (Tcl_DriverFlushProc) (ClientData instanceData); +typedef int (Tcl_DriverHandlerProc) (ClientData instanceData, + int interestMask); +typedef Tcl_WideInt (Tcl_DriverWideSeekProc) (ClientData instanceData, + Tcl_WideInt offset, int mode, int *errorCodePtr); +/* + * TIP #218, Channel Thread Actions + */ +typedef void (Tcl_DriverThreadActionProc) (ClientData instanceData, + int action); +/* + * TIP #208, File Truncation (etc.) + */ +typedef int (Tcl_DriverTruncateProc) (ClientData instanceData, + Tcl_WideInt length); + +/* + * struct Tcl_ChannelType: + * + * One such structure exists for each type (kind) of channel. It collects + * together in one place all the functions that are part of the specific + * channel type. + * + * It is recommend that the Tcl_Channel* functions are used to access elements + * of this structure, instead of direct accessing. + */ + +typedef struct Tcl_ChannelType { + const char *typeName; /* The name of the channel type in Tcl + * commands. This storage is owned by channel + * type. */ + Tcl_ChannelTypeVersion version; + /* Version of the channel type. */ + Tcl_DriverCloseProc *closeProc; + /* Function to call to close the channel, or + * TCL_CLOSE2PROC if the close2Proc should be + * used instead. */ + Tcl_DriverInputProc *inputProc; + /* Function to call for input on channel. */ + Tcl_DriverOutputProc *outputProc; + /* Function to call for output on channel. */ + Tcl_DriverSeekProc *seekProc; + /* Function to call to seek on the channel. + * May be NULL. */ + Tcl_DriverSetOptionProc *setOptionProc; + /* Set an option on a channel. */ + Tcl_DriverGetOptionProc *getOptionProc; + /* Get an option from a channel. */ + Tcl_DriverWatchProc *watchProc; + /* Set up the notifier to watch for events on + * this channel. */ + Tcl_DriverGetHandleProc *getHandleProc; + /* Get an OS handle from the channel or NULL + * if not supported. */ + Tcl_DriverClose2Proc *close2Proc; + /* Function to call to close the channel if + * the device supports closing the read & + * write sides independently. */ + Tcl_DriverBlockModeProc *blockModeProc; + /* Set blocking mode for the raw channel. May + * be NULL. */ + /* + * Only valid in TCL_CHANNEL_VERSION_2 channels or later. + */ + Tcl_DriverFlushProc *flushProc; + /* Function to call to flush a channel. May be + * NULL. */ + Tcl_DriverHandlerProc *handlerProc; + /* Function to call to handle a channel event. + * This will be passed up the stacked channel + * chain. */ + /* + * Only valid in TCL_CHANNEL_VERSION_3 channels or later. + */ + Tcl_DriverWideSeekProc *wideSeekProc; + /* Function to call to seek on the channel + * which can handle 64-bit offsets. May be + * NULL, and must be NULL if seekProc is + * NULL. */ + /* + * Only valid in TCL_CHANNEL_VERSION_4 channels or later. + * TIP #218, Channel Thread Actions. + */ + Tcl_DriverThreadActionProc *threadActionProc; + /* Function to call to notify the driver of + * thread specific activity for a channel. May + * be NULL. */ + /* + * Only valid in TCL_CHANNEL_VERSION_5 channels or later. + * TIP #208, File Truncation. + */ + Tcl_DriverTruncateProc *truncateProc; + /* Function to call to truncate the underlying + * file to a particular length. May be NULL if + * the channel does not support truncation. */ +} Tcl_ChannelType; + +/* + * The following flags determine whether the blockModeProc above should set + * the channel into blocking or nonblocking mode. They are passed as arguments + * to the blockModeProc function in the above structure. + */ + +#define TCL_MODE_BLOCKING 0 /* Put channel into blocking mode. */ +#define TCL_MODE_NONBLOCKING 1 /* Put channel into nonblocking + * mode. */ + +/* + *---------------------------------------------------------------------------- + * Enum for different types of file paths. + */ + +typedef enum Tcl_PathType { + TCL_PATH_ABSOLUTE, + TCL_PATH_RELATIVE, + TCL_PATH_VOLUME_RELATIVE +} Tcl_PathType; + +/* + * The following structure is used to pass glob type data amongst the various + * glob routines and Tcl_FSMatchInDirectory. + */ + +typedef struct Tcl_GlobTypeData { + int type; /* Corresponds to bcdpfls as in 'find -t'. */ + int perm; /* Corresponds to file permissions. */ + Tcl_Obj *macType; /* Acceptable Mac type. */ + Tcl_Obj *macCreator; /* Acceptable Mac creator. */ +} Tcl_GlobTypeData; + +/* + * Type and permission definitions for glob command. + */ + +#define TCL_GLOB_TYPE_BLOCK (1<<0) +#define TCL_GLOB_TYPE_CHAR (1<<1) +#define TCL_GLOB_TYPE_DIR (1<<2) +#define TCL_GLOB_TYPE_PIPE (1<<3) +#define TCL_GLOB_TYPE_FILE (1<<4) +#define TCL_GLOB_TYPE_LINK (1<<5) +#define TCL_GLOB_TYPE_SOCK (1<<6) +#define TCL_GLOB_TYPE_MOUNT (1<<7) + +#define TCL_GLOB_PERM_RONLY (1<<0) +#define TCL_GLOB_PERM_HIDDEN (1<<1) +#define TCL_GLOB_PERM_R (1<<2) +#define TCL_GLOB_PERM_W (1<<3) +#define TCL_GLOB_PERM_X (1<<4) + +/* + * Flags for the unload callback function. + */ + +#define TCL_UNLOAD_DETACH_FROM_INTERPRETER (1<<0) +#define TCL_UNLOAD_DETACH_FROM_PROCESS (1<<1) + +/* + * Typedefs for the various filesystem operations: + */ + +typedef int (Tcl_FSStatProc) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); +typedef int (Tcl_FSAccessProc) (Tcl_Obj *pathPtr, int mode); +typedef Tcl_Channel (Tcl_FSOpenFileChannelProc) (Tcl_Interp *interp, + Tcl_Obj *pathPtr, int mode, int permissions); +typedef int (Tcl_FSMatchInDirectoryProc) (Tcl_Interp *interp, Tcl_Obj *result, + Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types); +typedef Tcl_Obj * (Tcl_FSGetCwdProc) (Tcl_Interp *interp); +typedef int (Tcl_FSChdirProc) (Tcl_Obj *pathPtr); +typedef int (Tcl_FSLstatProc) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); +typedef int (Tcl_FSCreateDirectoryProc) (Tcl_Obj *pathPtr); +typedef int (Tcl_FSDeleteFileProc) (Tcl_Obj *pathPtr); +typedef int (Tcl_FSCopyDirectoryProc) (Tcl_Obj *srcPathPtr, + Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr); +typedef int (Tcl_FSCopyFileProc) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr); +typedef int (Tcl_FSRemoveDirectoryProc) (Tcl_Obj *pathPtr, int recursive, + Tcl_Obj **errorPtr); +typedef int (Tcl_FSRenameFileProc) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr); +typedef void (Tcl_FSUnloadFileProc) (Tcl_LoadHandle loadHandle); +typedef Tcl_Obj * (Tcl_FSListVolumesProc) (void); +/* We have to declare the utime structure here. */ +struct utimbuf; +typedef int (Tcl_FSUtimeProc) (Tcl_Obj *pathPtr, struct utimbuf *tval); +typedef int (Tcl_FSNormalizePathProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr, + int nextCheckpoint); +typedef int (Tcl_FSFileAttrsGetProc) (Tcl_Interp *interp, int index, + Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); +typedef const char *CONST86 * (Tcl_FSFileAttrStringsProc) (Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef); +typedef int (Tcl_FSFileAttrsSetProc) (Tcl_Interp *interp, int index, + Tcl_Obj *pathPtr, Tcl_Obj *objPtr); +typedef Tcl_Obj * (Tcl_FSLinkProc) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr, + int linkType); +typedef int (Tcl_FSLoadFileProc) (Tcl_Interp *interp, Tcl_Obj *pathPtr, + Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr); +typedef int (Tcl_FSPathInFilesystemProc) (Tcl_Obj *pathPtr, + ClientData *clientDataPtr); +typedef Tcl_Obj * (Tcl_FSFilesystemPathTypeProc) (Tcl_Obj *pathPtr); +typedef Tcl_Obj * (Tcl_FSFilesystemSeparatorProc) (Tcl_Obj *pathPtr); +typedef void (Tcl_FSFreeInternalRepProc) (ClientData clientData); +typedef ClientData (Tcl_FSDupInternalRepProc) (ClientData clientData); +typedef Tcl_Obj * (Tcl_FSInternalToNormalizedProc) (ClientData clientData); +typedef ClientData (Tcl_FSCreateInternalRepProc) (Tcl_Obj *pathPtr); + +typedef struct Tcl_FSVersion_ *Tcl_FSVersion; + +/* + *---------------------------------------------------------------------------- + * Data structures related to hooking into the filesystem + */ + +/* + * Filesystem version tag. This was introduced in 8.4. + */ + +#define TCL_FILESYSTEM_VERSION_1 ((Tcl_FSVersion) 0x1) + +/* + * struct Tcl_Filesystem: + * + * One such structure exists for each type (kind) of filesystem. It collects + * together in one place all the functions that are part of the specific + * filesystem. Tcl always accesses the filesystem through one of these + * structures. + * + * Not all entries need be non-NULL; any which are NULL are simply ignored. + * However, a complete filesystem should provide all of these functions. The + * explanations in the structure show the importance of each function. + */ + +typedef struct Tcl_Filesystem { + const char *typeName; /* The name of the filesystem. */ + int structureLength; /* Length of this structure, so future binary + * compatibility can be assured. */ + Tcl_FSVersion version; /* Version of the filesystem type. */ + Tcl_FSPathInFilesystemProc *pathInFilesystemProc; + /* Function to check whether a path is in this + * filesystem. This is the most important + * filesystem function. */ + Tcl_FSDupInternalRepProc *dupInternalRepProc; + /* Function to duplicate internal fs rep. May + * be NULL (but then fs is less efficient). */ + Tcl_FSFreeInternalRepProc *freeInternalRepProc; + /* Function to free internal fs rep. Must be + * implemented if internal representations + * need freeing, otherwise it can be NULL. */ + Tcl_FSInternalToNormalizedProc *internalToNormalizedProc; + /* Function to convert internal representation + * to a normalized path. Only required if the + * fs creates pure path objects with no + * string/path representation. */ + Tcl_FSCreateInternalRepProc *createInternalRepProc; + /* Function to create a filesystem-specific + * internal representation. May be NULL if + * paths have no internal representation, or + * if the Tcl_FSPathInFilesystemProc for this + * filesystem always immediately creates an + * internal representation for paths it + * accepts. */ + Tcl_FSNormalizePathProc *normalizePathProc; + /* Function to normalize a path. Should be + * implemented for all filesystems which can + * have multiple string representations for + * the same path object. */ + Tcl_FSFilesystemPathTypeProc *filesystemPathTypeProc; + /* Function to determine the type of a path in + * this filesystem. May be NULL. */ + Tcl_FSFilesystemSeparatorProc *filesystemSeparatorProc; + /* Function to return the separator + * character(s) for this filesystem. Must be + * implemented. */ + Tcl_FSStatProc *statProc; /* Function to process a 'Tcl_FSStat()' call. + * Must be implemented for any reasonable + * filesystem. */ + Tcl_FSAccessProc *accessProc; + /* Function to process a 'Tcl_FSAccess()' + * call. Must be implemented for any + * reasonable filesystem. */ + Tcl_FSOpenFileChannelProc *openFileChannelProc; + /* Function to process a + * 'Tcl_FSOpenFileChannel()' call. Must be + * implemented for any reasonable + * filesystem. */ + Tcl_FSMatchInDirectoryProc *matchInDirectoryProc; + /* Function to process a + * 'Tcl_FSMatchInDirectory()'. If not + * implemented, then glob and recursive copy + * functionality will be lacking in the + * filesystem. */ + Tcl_FSUtimeProc *utimeProc; /* Function to process a 'Tcl_FSUtime()' call. + * Required to allow setting (not reading) of + * times with 'file mtime', 'file atime' and + * the open-r/open-w/fcopy implementation of + * 'file copy'. */ + Tcl_FSLinkProc *linkProc; /* Function to process a 'Tcl_FSLink()' call. + * Should be implemented only if the + * filesystem supports links (reading or + * creating). */ + Tcl_FSListVolumesProc *listVolumesProc; + /* Function to list any filesystem volumes + * added by this filesystem. Should be + * implemented only if the filesystem adds + * volumes at the head of the filesystem. */ + Tcl_FSFileAttrStringsProc *fileAttrStringsProc; + /* Function to list all attributes strings + * which are valid for this filesystem. If not + * implemented the filesystem will not support + * the 'file attributes' command. This allows + * arbitrary additional information to be + * attached to files in the filesystem. */ + Tcl_FSFileAttrsGetProc *fileAttrsGetProc; + /* Function to process a + * 'Tcl_FSFileAttrsGet()' call, used by 'file + * attributes'. */ + Tcl_FSFileAttrsSetProc *fileAttrsSetProc; + /* Function to process a + * 'Tcl_FSFileAttrsSet()' call, used by 'file + * attributes'. */ + Tcl_FSCreateDirectoryProc *createDirectoryProc; + /* Function to process a + * 'Tcl_FSCreateDirectory()' call. Should be + * implemented unless the FS is read-only. */ + Tcl_FSRemoveDirectoryProc *removeDirectoryProc; + /* Function to process a + * 'Tcl_FSRemoveDirectory()' call. Should be + * implemented unless the FS is read-only. */ + Tcl_FSDeleteFileProc *deleteFileProc; + /* Function to process a 'Tcl_FSDeleteFile()' + * call. Should be implemented unless the FS + * is read-only. */ + Tcl_FSCopyFileProc *copyFileProc; + /* Function to process a 'Tcl_FSCopyFile()' + * call. If not implemented Tcl will fall back + * on open-r, open-w and fcopy as a copying + * mechanism, for copying actions initiated in + * Tcl (not C). */ + Tcl_FSRenameFileProc *renameFileProc; + /* Function to process a 'Tcl_FSRenameFile()' + * call. If not implemented, Tcl will fall + * back on a copy and delete mechanism, for + * rename actions initiated in Tcl (not C). */ + Tcl_FSCopyDirectoryProc *copyDirectoryProc; + /* Function to process a + * 'Tcl_FSCopyDirectory()' call. If not + * implemented, Tcl will fall back on a + * recursive create-dir, file copy mechanism, + * for copying actions initiated in Tcl (not + * C). */ + Tcl_FSLstatProc *lstatProc; /* Function to process a 'Tcl_FSLstat()' call. + * If not implemented, Tcl will attempt to use + * the 'statProc' defined above instead. */ + Tcl_FSLoadFileProc *loadFileProc; + /* Function to process a 'Tcl_FSLoadFile()' + * call. If not implemented, Tcl will fall + * back on a copy to native-temp followed by a + * Tcl_FSLoadFile on that temporary copy. */ + Tcl_FSGetCwdProc *getCwdProc; + /* Function to process a 'Tcl_FSGetCwd()' + * call. Most filesystems need not implement + * this. It will usually only be called once, + * if 'getcwd' is called before 'chdir'. May + * be NULL. */ + Tcl_FSChdirProc *chdirProc; /* Function to process a 'Tcl_FSChdir()' call. + * If filesystems do not implement this, it + * will be emulated by a series of directory + * access checks. Otherwise, virtual + * filesystems which do implement it need only + * respond with a positive return result if + * the dirName is a valid directory in their + * filesystem. They need not remember the + * result, since that will be automatically + * remembered for use by GetCwd. Real + * filesystems should carry out the correct + * action (i.e. call the correct system + * 'chdir' api). If not implemented, then 'cd' + * and 'pwd' will fail inside the + * filesystem. */ +} Tcl_Filesystem; + +/* + * The following definitions are used as values for the 'linkAction' flag to + * Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can + * be given. For link creation, the linkProc should create a link which + * matches any of the types given. + * + * TCL_CREATE_SYMBOLIC_LINK - Create a symbolic or soft link. + * TCL_CREATE_HARD_LINK - Create a hard link. + */ + +#define TCL_CREATE_SYMBOLIC_LINK 0x01 +#define TCL_CREATE_HARD_LINK 0x02 + +/* + *---------------------------------------------------------------------------- + * The following structure represents the Notifier functions that you can + * override with the Tcl_SetNotifier call. + */ + +typedef struct Tcl_NotifierProcs { + Tcl_SetTimerProc *setTimerProc; + Tcl_WaitForEventProc *waitForEventProc; + Tcl_CreateFileHandlerProc *createFileHandlerProc; + Tcl_DeleteFileHandlerProc *deleteFileHandlerProc; + Tcl_InitNotifierProc *initNotifierProc; + Tcl_FinalizeNotifierProc *finalizeNotifierProc; + Tcl_AlertNotifierProc *alertNotifierProc; + Tcl_ServiceModeHookProc *serviceModeHookProc; +} Tcl_NotifierProcs; + +/* + *---------------------------------------------------------------------------- + * The following data structures and declarations are for the new Tcl parser. + * + * For each word of a command, and for each piece of a word such as a variable + * reference, one of the following structures is created to describe the + * token. + */ + +typedef struct Tcl_Token { + int type; /* Type of token, such as TCL_TOKEN_WORD; see + * below for valid types. */ + const char *start; /* First character in token. */ + int size; /* Number of bytes in token. */ + int numComponents; /* If this token is composed of other tokens, + * this field tells how many of them there are + * (including components of components, etc.). + * The component tokens immediately follow + * this one. */ +} Tcl_Token; + +/* + * Type values defined for Tcl_Token structures. These values are defined as + * mask bits so that it's easy to check for collections of types. + * + * TCL_TOKEN_WORD - The token describes one word of a command, + * from the first non-blank character of the word + * (which may be " or {) up to but not including + * the space, semicolon, or bracket that + * terminates the word. NumComponents counts the + * total number of sub-tokens that make up the + * word. This includes, for example, sub-tokens + * of TCL_TOKEN_VARIABLE tokens. + * TCL_TOKEN_SIMPLE_WORD - This token is just like TCL_TOKEN_WORD except + * that the word is guaranteed to consist of a + * single TCL_TOKEN_TEXT sub-token. + * TCL_TOKEN_TEXT - The token describes a range of literal text + * that is part of a word. NumComponents is + * always 0. + * TCL_TOKEN_BS - The token describes a backslash sequence that + * must be collapsed. NumComponents is always 0. + * TCL_TOKEN_COMMAND - The token describes a command whose result + * must be substituted into the word. The token + * includes the enclosing brackets. NumComponents + * is always 0. + * TCL_TOKEN_VARIABLE - The token describes a variable substitution, + * including the dollar sign, variable name, and + * array index (if there is one) up through the + * right parentheses. NumComponents tells how + * many additional tokens follow to represent the + * variable name. The first token will be a + * TCL_TOKEN_TEXT token that describes the + * variable name. If the variable is an array + * reference then there will be one or more + * additional tokens, of type TCL_TOKEN_TEXT, + * TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and + * TCL_TOKEN_VARIABLE, that describe the array + * index; numComponents counts the total number + * of nested tokens that make up the variable + * reference, including sub-tokens of + * TCL_TOKEN_VARIABLE tokens. + * TCL_TOKEN_SUB_EXPR - The token describes one subexpression of an + * expression, from the first non-blank character + * of the subexpression up to but not including + * the space, brace, or bracket that terminates + * the subexpression. NumComponents counts the + * total number of following subtokens that make + * up the subexpression; this includes all + * subtokens for any nested TCL_TOKEN_SUB_EXPR + * tokens. For example, a numeric value used as a + * primitive operand is described by a + * TCL_TOKEN_SUB_EXPR token followed by a + * TCL_TOKEN_TEXT token. A binary subexpression + * is described by a TCL_TOKEN_SUB_EXPR token + * followed by the TCL_TOKEN_OPERATOR token for + * the operator, then TCL_TOKEN_SUB_EXPR tokens + * for the left then the right operands. + * TCL_TOKEN_OPERATOR - The token describes one expression operator. + * An operator might be the name of a math + * function such as "abs". A TCL_TOKEN_OPERATOR + * token is always preceeded by one + * TCL_TOKEN_SUB_EXPR token for the operator's + * subexpression, and is followed by zero or more + * TCL_TOKEN_SUB_EXPR tokens for the operator's + * operands. NumComponents is always 0. + * TCL_TOKEN_EXPAND_WORD - This token is just like TCL_TOKEN_WORD except + * that it marks a word that began with the + * literal character prefix "{*}". This word is + * marked to be expanded - that is, broken into + * words after substitution is complete. + */ + +#define TCL_TOKEN_WORD 1 +#define TCL_TOKEN_SIMPLE_WORD 2 +#define TCL_TOKEN_TEXT 4 +#define TCL_TOKEN_BS 8 +#define TCL_TOKEN_COMMAND 16 +#define TCL_TOKEN_VARIABLE 32 +#define TCL_TOKEN_SUB_EXPR 64 +#define TCL_TOKEN_OPERATOR 128 +#define TCL_TOKEN_EXPAND_WORD 256 + +/* + * Parsing error types. On any parsing error, one of these values will be + * stored in the error field of the Tcl_Parse structure defined below. + */ + +#define TCL_PARSE_SUCCESS 0 +#define TCL_PARSE_QUOTE_EXTRA 1 +#define TCL_PARSE_BRACE_EXTRA 2 +#define TCL_PARSE_MISSING_BRACE 3 +#define TCL_PARSE_MISSING_BRACKET 4 +#define TCL_PARSE_MISSING_PAREN 5 +#define TCL_PARSE_MISSING_QUOTE 6 +#define TCL_PARSE_MISSING_VAR_BRACE 7 +#define TCL_PARSE_SYNTAX 8 +#define TCL_PARSE_BAD_NUMBER 9 + +/* + * A structure of the following type is filled in by Tcl_ParseCommand. It + * describes a single command parsed from an input string. + */ + +#define NUM_STATIC_TOKENS 20 + +typedef struct Tcl_Parse { + const char *commentStart; /* Pointer to # that begins the first of one + * or more comments preceding the command. */ + int commentSize; /* Number of bytes in comments (up through + * newline character that terminates the last + * comment). If there were no comments, this + * field is 0. */ + const char *commandStart; /* First character in first word of + * command. */ + int commandSize; /* Number of bytes in command, including first + * character of first word, up through the + * terminating newline, close bracket, or + * semicolon. */ + int numWords; /* Total number of words in command. May be + * 0. */ + Tcl_Token *tokenPtr; /* Pointer to first token representing the + * words of the command. Initially points to + * staticTokens, but may change to point to + * malloc-ed space if command exceeds space in + * staticTokens. */ + int numTokens; /* Total number of tokens in command. */ + int tokensAvailable; /* Total number of tokens available at + * *tokenPtr. */ + int errorType; /* One of the parsing error types defined + * above. */ + + /* + * The fields below are intended only for the private use of the parser. + * They should not be used by functions that invoke Tcl_ParseCommand. + */ + + const char *string; /* The original command string passed to + * Tcl_ParseCommand. */ + const char *end; /* Points to the character just after the last + * one in the command string. */ + Tcl_Interp *interp; /* Interpreter to use for error reporting, or + * NULL. */ + const char *term; /* Points to character in string that + * terminated most recent token. Filled in by + * ParseTokens. If an error occurs, points to + * beginning of region where the error + * occurred (e.g. the open brace if the close + * brace is missing). */ + int incomplete; /* This field is set to 1 by Tcl_ParseCommand + * if the command appears to be incomplete. + * This information is used by + * Tcl_CommandComplete. */ + Tcl_Token staticTokens[NUM_STATIC_TOKENS]; + /* Initial space for tokens for command. This + * space should be large enough to accommodate + * most commands; dynamic space is allocated + * for very large commands that don't fit + * here. */ +} Tcl_Parse; + +/* + *---------------------------------------------------------------------------- + * The following structure represents a user-defined encoding. It collects + * together all the functions that are used by the specific encoding. + */ + +typedef struct Tcl_EncodingType { + const char *encodingName; /* The name of the encoding, e.g. "euc-jp". + * This name is the unique key for this + * encoding type. */ + Tcl_EncodingConvertProc *toUtfProc; + /* Function to convert from external encoding + * into UTF-8. */ + Tcl_EncodingConvertProc *fromUtfProc; + /* Function to convert from UTF-8 into + * external encoding. */ + Tcl_EncodingFreeProc *freeProc; + /* If non-NULL, function to call when this + * encoding is deleted. */ + ClientData clientData; /* Arbitrary value associated with encoding + * type. Passed to conversion functions. */ + int nullSize; /* Number of zero bytes that signify + * end-of-string in this encoding. This number + * is used to determine the source string + * length when the srcLen argument is + * negative. Must be 1 or 2. */ +} Tcl_EncodingType; + +/* + * The following definitions are used as values for the conversion control + * flags argument when converting text from one character set to another: + * + * TCL_ENCODING_START - Signifies that the source buffer is the first + * block in a (potentially multi-block) input + * stream. Tells the conversion function to reset + * to an initial state and perform any + * initialization that needs to occur before the + * first byte is converted. If the source buffer + * contains the entire input stream to be + * converted, this flag should be set. + * TCL_ENCODING_END - Signifies that the source buffer is the last + * block in a (potentially multi-block) input + * stream. Tells the conversion routine to + * perform any finalization that needs to occur + * after the last byte is converted and then to + * reset to an initial state. If the source + * buffer contains the entire input stream to be + * converted, this flag should be set. + * TCL_ENCODING_STOPONERROR - If set, then the converter will return + * immediately upon encountering an invalid byte + * sequence or a source character that has no + * mapping in the target encoding. If clear, then + * the converter will skip the problem, + * substituting one or more "close" characters in + * the destination buffer and then continue to + * convert the source. + */ + +#define TCL_ENCODING_START 0x01 +#define TCL_ENCODING_END 0x02 +#define TCL_ENCODING_STOPONERROR 0x04 + +/* + * The following definitions are the error codes returned by the conversion + * routines: + * + * TCL_OK - All characters were converted. + * TCL_CONVERT_NOSPACE - The output buffer would not have been large + * enough for all of the converted data; as many + * characters as could fit were converted though. + * TCL_CONVERT_MULTIBYTE - The last few bytes in the source string were + * the beginning of a multibyte sequence, but + * more bytes were needed to complete this + * sequence. A subsequent call to the conversion + * routine should pass the beginning of this + * unconverted sequence plus additional bytes + * from the source stream to properly convert the + * formerly split-up multibyte sequence. + * TCL_CONVERT_SYNTAX - The source stream contained an invalid + * character sequence. This may occur if the + * input stream has been damaged or if the input + * encoding method was misidentified. This error + * is reported only if TCL_ENCODING_STOPONERROR + * was specified. + * TCL_CONVERT_UNKNOWN - The source string contained a character that + * could not be represented in the target + * encoding. This error is reported only if + * TCL_ENCODING_STOPONERROR was specified. + */ + +#define TCL_CONVERT_MULTIBYTE (-1) +#define TCL_CONVERT_SYNTAX (-2) +#define TCL_CONVERT_UNKNOWN (-3) +#define TCL_CONVERT_NOSPACE (-4) + +/* + * The maximum number of bytes that are necessary to represent a single + * Unicode character in UTF-8. The valid values should be 3, 4 or 6 + * (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or + * 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6, + * then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode + * is the default and recommended mode. UCS-4 is experimental and not + * recommended. It works for the core, but most extensions expect UCS-2. + */ + +#ifndef TCL_UTF_MAX +#define TCL_UTF_MAX 3 +#endif + +/* + * This represents a Unicode character. Any changes to this should also be + * reflected in regcustom.h. + */ + +#if TCL_UTF_MAX > 4 + /* + * unsigned int isn't 100% accurate as it should be a strict 4-byte value + * (perhaps wchar_t). 64-bit systems may have troubles. The size of this + * value must be reflected correctly in regcustom.h and + * in tclEncoding.c. + * XXX: Tcl is currently UCS-2 and planning UTF-16 for the Unicode + * XXX: string rep that Tcl_UniChar represents. Changing the size + * XXX: of Tcl_UniChar is /not/ supported. + */ +typedef unsigned int Tcl_UniChar; +#else +typedef unsigned short Tcl_UniChar; +#endif + +/* + *---------------------------------------------------------------------------- + * TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to + * provide the system with the embedded configuration data. + */ + +typedef struct Tcl_Config { + const char *key; /* Configuration key to register. ASCII + * encoded, thus UTF-8. */ + const char *value; /* The value associated with the key. System + * encoding. */ +} Tcl_Config; + +/* + *---------------------------------------------------------------------------- + * Flags for TIP#143 limits, detailing which limits are active in an + * interpreter. Used for Tcl_{Add,Remove}LimitHandler type argument. + */ + +#define TCL_LIMIT_COMMANDS 0x01 +#define TCL_LIMIT_TIME 0x02 + +/* + * Structure containing information about a limit handler to be called when a + * command- or time-limit is exceeded by an interpreter. + */ + +typedef void (Tcl_LimitHandlerProc) (ClientData clientData, Tcl_Interp *interp); +typedef void (Tcl_LimitHandlerDeleteProc) (ClientData clientData); + +/* + *---------------------------------------------------------------------------- + * Override definitions for libtommath. + */ + +typedef struct mp_int mp_int; +#define MP_INT_DECLARED +typedef unsigned int mp_digit; +#define MP_DIGIT_DECLARED + +/* + *---------------------------------------------------------------------------- + * Definitions needed for Tcl_ParseArgvObj routines. + * Based on tkArgv.c. + * Modifications from the original are copyright (c) Sam Bromley 2006 + */ + +typedef struct { + int type; /* Indicates the option type; see below. */ + const char *keyStr; /* The key string that flags the option in the + * argv array. */ + void *srcPtr; /* Value to be used in setting dst; usage + * depends on type.*/ + void *dstPtr; /* Address of value to be modified; usage + * depends on type.*/ + const char *helpStr; /* Documentation message describing this + * option. */ + ClientData clientData; /* Word to pass to function callbacks. */ +} Tcl_ArgvInfo; + +/* + * Legal values for the type field of a Tcl_ArgInfo: see the user + * documentation for details. + */ + +#define TCL_ARGV_CONSTANT 15 +#define TCL_ARGV_INT 16 +#define TCL_ARGV_STRING 17 +#define TCL_ARGV_REST 18 +#define TCL_ARGV_FLOAT 19 +#define TCL_ARGV_FUNC 20 +#define TCL_ARGV_GENFUNC 21 +#define TCL_ARGV_HELP 22 +#define TCL_ARGV_END 23 + +/* + * Types of callback functions for the TCL_ARGV_FUNC and TCL_ARGV_GENFUNC + * argument types: + */ + +typedef int (Tcl_ArgvFuncProc)(ClientData clientData, Tcl_Obj *objPtr, + void *dstPtr); +typedef int (Tcl_ArgvGenFuncProc)(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const *objv, void *dstPtr); + +/* + * Shorthand for commonly used argTable entries. + */ + +#define TCL_ARGV_AUTO_HELP \ + {TCL_ARGV_HELP, "-help", NULL, NULL, \ + "Print summary of command-line options and abort", NULL} +#define TCL_ARGV_AUTO_REST \ + {TCL_ARGV_REST, "--", NULL, NULL, \ + "Marks the end of the options", NULL} +#define TCL_ARGV_TABLE_END \ + {TCL_ARGV_END, NULL, NULL, NULL, NULL, NULL} + +/* + *---------------------------------------------------------------------------- + * Definitions needed for Tcl_Zlib routines. [TIP #234] + * + * Constants for the format flags describing what sort of data format is + * desired/expected for the Tcl_ZlibDeflate, Tcl_ZlibInflate and + * Tcl_ZlibStreamInit functions. + */ + +#define TCL_ZLIB_FORMAT_RAW 1 +#define TCL_ZLIB_FORMAT_ZLIB 2 +#define TCL_ZLIB_FORMAT_GZIP 4 +#define TCL_ZLIB_FORMAT_AUTO 8 + +/* + * Constants that describe whether the stream is to operate in compressing or + * decompressing mode. + */ + +#define TCL_ZLIB_STREAM_DEFLATE 16 +#define TCL_ZLIB_STREAM_INFLATE 32 + +/* + * Constants giving compression levels. Use of TCL_ZLIB_COMPRESS_DEFAULT is + * recommended. + */ + +#define TCL_ZLIB_COMPRESS_NONE 0 +#define TCL_ZLIB_COMPRESS_FAST 1 +#define TCL_ZLIB_COMPRESS_BEST 9 +#define TCL_ZLIB_COMPRESS_DEFAULT (-1) + +/* + * Constants for types of flushing, used with Tcl_ZlibFlush. + */ + +#define TCL_ZLIB_NO_FLUSH 0 +#define TCL_ZLIB_FLUSH 2 +#define TCL_ZLIB_FULLFLUSH 3 +#define TCL_ZLIB_FINALIZE 4 + +/* + *---------------------------------------------------------------------------- + * Definitions needed for the Tcl_LoadFile function. [TIP #416] + */ + +#define TCL_LOAD_GLOBAL 1 +#define TCL_LOAD_LAZY 2 + +/* + *---------------------------------------------------------------------------- + * Single public declaration for NRE. + */ + +typedef int (Tcl_NRPostProc) (ClientData data[], Tcl_Interp *interp, + int result); + +/* + *---------------------------------------------------------------------------- + * The following constant is used to test for older versions of Tcl in the + * stubs tables. + * + * Jan Nijtman's plus patch uses 0xFCA1BACF, so we need to pick a different + * value since the stubs tables don't match. + */ + +#define TCL_STUB_MAGIC ((int) 0xFCA3BACF) + +/* + * The following function is required to be defined in all stubs aware + * extensions. The function is actually implemented in the stub library, not + * the main Tcl library, although there is a trivial implementation in the + * main library in case an extension is statically linked into an application. + */ + +const char * Tcl_InitStubs(Tcl_Interp *interp, const char *version, + int exact); +const char * TclTomMathInitializeStubs(Tcl_Interp *interp, + const char *version, int epoch, int revision); + +/* + * When not using stubs, make it a macro. + */ + +#ifndef USE_TCL_STUBS +#define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, version, exact) +#endif + +/* + * TODO - tommath stubs export goes here! + */ + +/* + * Public functions that are not accessible via the stubs table. + * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] + */ + +#define Tcl_Main(argc, argv, proc) Tcl_MainEx(argc, argv, proc, \ + (Tcl_FindExecutable(argv[0]), (Tcl_CreateInterp)())) +EXTERN void Tcl_MainEx(int argc, char **argv, + Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); +EXTERN const char * Tcl_PkgInitStubsCheck(Tcl_Interp *interp, + const char *version, int exact); +#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC) +EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); +#endif + +/* + *---------------------------------------------------------------------------- + * Include the public function declarations that are accessible via the stubs + * table. + */ + +#include "tclDecls.h" + +/* + * Include platform specific public function declarations that are accessible + * via the stubs table. + */ + +#include "tclPlatDecls.h" + +/* + *---------------------------------------------------------------------------- + * The following declarations either map ckalloc and ckfree to malloc and + * free, or they map them to functions with all sorts of debugging hooks + * defined in tclCkalloc.c. + */ + +#ifdef TCL_MEM_DEBUG + +# define ckalloc(x) \ + ((VOID *) Tcl_DbCkalloc((unsigned)(x), __FILE__, __LINE__)) +# define ckfree(x) \ + Tcl_DbCkfree((char *)(x), __FILE__, __LINE__) +# define ckrealloc(x,y) \ + ((VOID *) Tcl_DbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__)) +# define attemptckalloc(x) \ + ((VOID *) Tcl_AttemptDbCkalloc((unsigned)(x), __FILE__, __LINE__)) +# define attemptckrealloc(x,y) \ + ((VOID *) Tcl_AttemptDbCkrealloc((char *)(x), (unsigned)(y), __FILE__, __LINE__)) + +#else /* !TCL_MEM_DEBUG */ + +/* + * If we are not using the debugging allocator, we should call the Tcl_Alloc, + * et al. routines in order to guarantee that every module is using the same + * memory allocator both inside and outside of the Tcl library. + */ + +# define ckalloc(x) \ + ((VOID *) Tcl_Alloc((unsigned)(x))) +# define ckfree(x) \ + Tcl_Free((char *)(x)) +# define ckrealloc(x,y) \ + ((VOID *) Tcl_Realloc((char *)(x), (unsigned)(y))) +# define attemptckalloc(x) \ + ((VOID *) Tcl_AttemptAlloc((unsigned)(x))) +# define attemptckrealloc(x,y) \ + ((VOID *) Tcl_AttemptRealloc((char *)(x), (unsigned)(y))) +# undef Tcl_InitMemory +# define Tcl_InitMemory(x) +# undef Tcl_DumpActiveMemory +# define Tcl_DumpActiveMemory(x) +# undef Tcl_ValidateAllMemory +# define Tcl_ValidateAllMemory(x,y) + +#endif /* !TCL_MEM_DEBUG */ + +#ifdef TCL_MEM_DEBUG +# define Tcl_IncrRefCount(objPtr) \ + Tcl_DbIncrRefCount(objPtr, __FILE__, __LINE__) +# define Tcl_DecrRefCount(objPtr) \ + Tcl_DbDecrRefCount(objPtr, __FILE__, __LINE__) +# define Tcl_IsShared(objPtr) \ + Tcl_DbIsShared(objPtr, __FILE__, __LINE__) +#else +# define Tcl_IncrRefCount(objPtr) \ + ++(objPtr)->refCount + /* + * Use do/while0 idiom for optimum correctness without compiler warnings. + * http://c2.com/cgi/wiki?TrivialDoWhileLoop + */ +# define Tcl_DecrRefCount(objPtr) \ + do { \ + Tcl_Obj *_objPtr = (objPtr); \ + if (--(_objPtr)->refCount <= 0) { \ + TclFreeObj(_objPtr); \ + } \ + } while(0) +# define Tcl_IsShared(objPtr) \ + ((objPtr)->refCount > 1) +#endif + +/* + * Macros and definitions that help to debug the use of Tcl objects. When + * TCL_MEM_DEBUG is defined, the Tcl_New declarations are overridden to call + * debugging versions of the object creation functions. + */ + +#ifdef TCL_MEM_DEBUG +# undef Tcl_NewBignumObj +# define Tcl_NewBignumObj(val) \ + Tcl_DbNewBignumObj(val, __FILE__, __LINE__) +# undef Tcl_NewBooleanObj +# define Tcl_NewBooleanObj(val) \ + Tcl_DbNewBooleanObj(val, __FILE__, __LINE__) +# undef Tcl_NewByteArrayObj +# define Tcl_NewByteArrayObj(bytes, len) \ + Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__) +# undef Tcl_NewDoubleObj +# define Tcl_NewDoubleObj(val) \ + Tcl_DbNewDoubleObj(val, __FILE__, __LINE__) +# undef Tcl_NewIntObj +# define Tcl_NewIntObj(val) \ + Tcl_DbNewLongObj(val, __FILE__, __LINE__) +# undef Tcl_NewListObj +# define Tcl_NewListObj(objc, objv) \ + Tcl_DbNewListObj(objc, objv, __FILE__, __LINE__) +# undef Tcl_NewLongObj +# define Tcl_NewLongObj(val) \ + Tcl_DbNewLongObj(val, __FILE__, __LINE__) +# undef Tcl_NewObj +# define Tcl_NewObj() \ + Tcl_DbNewObj(__FILE__, __LINE__) +# undef Tcl_NewStringObj +# define Tcl_NewStringObj(bytes, len) \ + Tcl_DbNewStringObj(bytes, len, __FILE__, __LINE__) +# undef Tcl_NewWideIntObj +# define Tcl_NewWideIntObj(val) \ + Tcl_DbNewWideIntObj(val, __FILE__, __LINE__) +#endif /* TCL_MEM_DEBUG */ + +/* + *---------------------------------------------------------------------------- + * Macros for clients to use to access fields of hash entries: + */ + +#define Tcl_GetHashValue(h) ((h)->clientData) +#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value)) +#define Tcl_GetHashKey(tablePtr, h) \ + ((void *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS || \ + (tablePtr)->keyType == TCL_CUSTOM_PTR_KEYS) \ + ? (h)->key.oneWordValue \ + : (h)->key.string)) + +/* + * Macros to use for clients to use to invoke find and create functions for + * hash tables: + */ + +#undef Tcl_FindHashEntry +#define Tcl_FindHashEntry(tablePtr, key) \ + (*((tablePtr)->findProc))(tablePtr, (const char *)(key)) +#undef Tcl_CreateHashEntry +#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \ + (*((tablePtr)->createProc))(tablePtr, (const char *)(key), newPtr) + +/* + *---------------------------------------------------------------------------- + * Macros that eliminate the overhead of the thread synchronization functions + * when compiling without thread support. + */ + +#ifndef TCL_THREADS +#undef Tcl_MutexLock +#define Tcl_MutexLock(mutexPtr) +#undef Tcl_MutexUnlock +#define Tcl_MutexUnlock(mutexPtr) +#undef Tcl_MutexFinalize +#define Tcl_MutexFinalize(mutexPtr) +#undef Tcl_ConditionNotify +#define Tcl_ConditionNotify(condPtr) +#undef Tcl_ConditionWait +#define Tcl_ConditionWait(condPtr, mutexPtr, timePtr) +#undef Tcl_ConditionFinalize +#define Tcl_ConditionFinalize(condPtr) +#endif /* TCL_THREADS */ + +/* + *---------------------------------------------------------------------------- + * Deprecated Tcl functions: + */ + +#ifndef TCL_NO_DEPRECATED +# undef Tcl_EvalObj +# define Tcl_EvalObj(interp,objPtr) \ + Tcl_EvalObjEx((interp),(objPtr),0) +# undef Tcl_GlobalEvalObj +# define Tcl_GlobalEvalObj(interp,objPtr) \ + Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL) + +/* + * These function have been renamed. The old names are deprecated, but we + * define these macros for backwards compatibilty. + */ + +# define Tcl_Ckalloc Tcl_Alloc +# define Tcl_Ckfree Tcl_Free +# define Tcl_Ckrealloc Tcl_Realloc +# define Tcl_Return Tcl_SetResult +# define Tcl_TildeSubst Tcl_TranslateFileName +# define panic Tcl_Panic +# define panicVA Tcl_PanicVA +#endif /* !TCL_NO_DEPRECATED */ + +/* + *---------------------------------------------------------------------------- + * Convenience declaration of Tcl_AppInit for backwards compatibility. This + * function is not *implemented* by the tcl library, so the storage class is + * neither DLLEXPORT nor DLLIMPORT. + */ + +extern Tcl_AppInitProc Tcl_AppInit; + +#endif /* RC_INVOKED */ + +/* + * end block for C++ + */ + +#ifdef __cplusplus +} +#endif + +#endif /* _TCL */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ ADDED compat/tcl-8.6/generic/tclDecls.h Index: compat/tcl-8.6/generic/tclDecls.h ================================================================== --- /dev/null +++ compat/tcl-8.6/generic/tclDecls.h @@ -0,0 +1,3806 @@ +/* + * tclDecls.h -- + * + * Declarations of functions in the platform independent public Tcl API. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLDECLS +#define _TCLDECLS + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +# define TCL_STORAGE_CLASS DLLEXPORT +#else +# ifdef USE_TCL_STUBS +# define TCL_STORAGE_CLASS +# else +# define TCL_STORAGE_CLASS DLLIMPORT +# endif +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tcl.decls script. + */ + +/* !BEGIN!: Do not edit below this line. */ + +/* + * Exported function declarations: + */ + +/* 0 */ +EXTERN int Tcl_PkgProvideEx(Tcl_Interp *interp, + const char *name, const char *version, + const void *clientData); +/* 1 */ +EXTERN CONST84_RETURN char * Tcl_PkgRequireEx(Tcl_Interp *interp, + const char *name, const char *version, + int exact, void *clientDataPtr); +/* 2 */ +EXTERN void Tcl_Panic(const char *format, ...) TCL_FORMAT_PRINTF(1, 2); +/* 3 */ +EXTERN char * Tcl_Alloc(unsigned int size); +/* 4 */ +EXTERN void Tcl_Free(char *ptr); +/* 5 */ +EXTERN char * Tcl_Realloc(char *ptr, unsigned int size); +/* 6 */ +EXTERN char * Tcl_DbCkalloc(unsigned int size, const char *file, + int line); +/* 7 */ +EXTERN void Tcl_DbCkfree(char *ptr, const char *file, int line); +/* 8 */ +EXTERN char * Tcl_DbCkrealloc(char *ptr, unsigned int size, + const char *file, int line); +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 9 */ +EXTERN void Tcl_CreateFileHandler(int fd, int mask, + Tcl_FileProc *proc, ClientData clientData); +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 9 */ +EXTERN void Tcl_CreateFileHandler(int fd, int mask, + Tcl_FileProc *proc, ClientData clientData); +#endif /* MACOSX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 10 */ +EXTERN void Tcl_DeleteFileHandler(int fd); +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 10 */ +EXTERN void Tcl_DeleteFileHandler(int fd); +#endif /* MACOSX */ +/* 11 */ +EXTERN void Tcl_SetTimer(const Tcl_Time *timePtr); +/* 12 */ +EXTERN void Tcl_Sleep(int ms); +/* 13 */ +EXTERN int Tcl_WaitForEvent(const Tcl_Time *timePtr); +/* 14 */ +EXTERN int Tcl_AppendAllObjTypes(Tcl_Interp *interp, + Tcl_Obj *objPtr); +/* 15 */ +EXTERN void Tcl_AppendStringsToObj(Tcl_Obj *objPtr, ...); +/* 16 */ +EXTERN void Tcl_AppendToObj(Tcl_Obj *objPtr, const char *bytes, + int length); +/* 17 */ +EXTERN Tcl_Obj * Tcl_ConcatObj(int objc, Tcl_Obj *const objv[]); +/* 18 */ +EXTERN int Tcl_ConvertToType(Tcl_Interp *interp, + Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); +/* 19 */ +EXTERN void Tcl_DbDecrRefCount(Tcl_Obj *objPtr, const char *file, + int line); +/* 20 */ +EXTERN void Tcl_DbIncrRefCount(Tcl_Obj *objPtr, const char *file, + int line); +/* 21 */ +EXTERN int Tcl_DbIsShared(Tcl_Obj *objPtr, const char *file, + int line); +/* 22 */ +EXTERN Tcl_Obj * Tcl_DbNewBooleanObj(int boolValue, const char *file, + int line); +/* 23 */ +EXTERN Tcl_Obj * Tcl_DbNewByteArrayObj(const unsigned char *bytes, + int length, const char *file, int line); +/* 24 */ +EXTERN Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue, + const char *file, int line); +/* 25 */ +EXTERN Tcl_Obj * Tcl_DbNewListObj(int objc, Tcl_Obj *const *objv, + const char *file, int line); +/* 26 */ +EXTERN Tcl_Obj * Tcl_DbNewLongObj(long longValue, const char *file, + int line); +/* 27 */ +EXTERN Tcl_Obj * Tcl_DbNewObj(const char *file, int line); +/* 28 */ +EXTERN Tcl_Obj * Tcl_DbNewStringObj(const char *bytes, int length, + const char *file, int line); +/* 29 */ +EXTERN Tcl_Obj * Tcl_DuplicateObj(Tcl_Obj *objPtr); +/* 30 */ +EXTERN void TclFreeObj(Tcl_Obj *objPtr); +/* 31 */ +EXTERN int Tcl_GetBoolean(Tcl_Interp *interp, const char *src, + int *boolPtr); +/* 32 */ +EXTERN int Tcl_GetBooleanFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, int *boolPtr); +/* 33 */ +EXTERN unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, + int *lengthPtr); +/* 34 */ +EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src, + double *doublePtr); +/* 35 */ +EXTERN int Tcl_GetDoubleFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, double *doublePtr); +/* 36 */ +EXTERN int Tcl_GetIndexFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, + CONST84 char *const *tablePtr, + const char *msg, int flags, int *indexPtr); +/* 37 */ +EXTERN int Tcl_GetInt(Tcl_Interp *interp, const char *src, + int *intPtr); +/* 38 */ +EXTERN int Tcl_GetIntFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, int *intPtr); +/* 39 */ +EXTERN int Tcl_GetLongFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, long *longPtr); +/* 40 */ +EXTERN CONST86 Tcl_ObjType * Tcl_GetObjType(const char *typeName); +/* 41 */ +EXTERN char * Tcl_GetStringFromObj(Tcl_Obj *objPtr, int *lengthPtr); +/* 42 */ +EXTERN void Tcl_InvalidateStringRep(Tcl_Obj *objPtr); +/* 43 */ +EXTERN int Tcl_ListObjAppendList(Tcl_Interp *interp, + Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); +/* 44 */ +EXTERN int Tcl_ListObjAppendElement(Tcl_Interp *interp, + Tcl_Obj *listPtr, Tcl_Obj *objPtr); +/* 45 */ +EXTERN int Tcl_ListObjGetElements(Tcl_Interp *interp, + Tcl_Obj *listPtr, int *objcPtr, + Tcl_Obj ***objvPtr); +/* 46 */ +EXTERN int Tcl_ListObjIndex(Tcl_Interp *interp, + Tcl_Obj *listPtr, int index, + Tcl_Obj **objPtrPtr); +/* 47 */ +EXTERN int Tcl_ListObjLength(Tcl_Interp *interp, + Tcl_Obj *listPtr, int *lengthPtr); +/* 48 */ +EXTERN int Tcl_ListObjReplace(Tcl_Interp *interp, + Tcl_Obj *listPtr, int first, int count, + int objc, Tcl_Obj *const objv[]); +/* 49 */ +EXTERN Tcl_Obj * Tcl_NewBooleanObj(int boolValue); +/* 50 */ +EXTERN Tcl_Obj * Tcl_NewByteArrayObj(const unsigned char *bytes, + int length); +/* 51 */ +EXTERN Tcl_Obj * Tcl_NewDoubleObj(double doubleValue); +/* 52 */ +EXTERN Tcl_Obj * Tcl_NewIntObj(int intValue); +/* 53 */ +EXTERN Tcl_Obj * Tcl_NewListObj(int objc, Tcl_Obj *const objv[]); +/* 54 */ +EXTERN Tcl_Obj * Tcl_NewLongObj(long longValue); +/* 55 */ +EXTERN Tcl_Obj * Tcl_NewObj(void); +/* 56 */ +EXTERN Tcl_Obj * Tcl_NewStringObj(const char *bytes, int length); +/* 57 */ +EXTERN void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue); +/* 58 */ +EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length); +/* 59 */ +EXTERN void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, + const unsigned char *bytes, int length); +/* 60 */ +EXTERN void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue); +/* 61 */ +EXTERN void Tcl_SetIntObj(Tcl_Obj *objPtr, int intValue); +/* 62 */ +EXTERN void Tcl_SetListObj(Tcl_Obj *objPtr, int objc, + Tcl_Obj *const objv[]); +/* 63 */ +EXTERN void Tcl_SetLongObj(Tcl_Obj *objPtr, long longValue); +/* 64 */ +EXTERN void Tcl_SetObjLength(Tcl_Obj *objPtr, int length); +/* 65 */ +EXTERN void Tcl_SetStringObj(Tcl_Obj *objPtr, const char *bytes, + int length); +/* 66 */ +EXTERN void Tcl_AddErrorInfo(Tcl_Interp *interp, + const char *message); +/* 67 */ +EXTERN void Tcl_AddObjErrorInfo(Tcl_Interp *interp, + const char *message, int length); +/* 68 */ +EXTERN void Tcl_AllowExceptions(Tcl_Interp *interp); +/* 69 */ +EXTERN void Tcl_AppendElement(Tcl_Interp *interp, + const char *element); +/* 70 */ +EXTERN void Tcl_AppendResult(Tcl_Interp *interp, ...); +/* 71 */ +EXTERN Tcl_AsyncHandler Tcl_AsyncCreate(Tcl_AsyncProc *proc, + ClientData clientData); +/* 72 */ +EXTERN void Tcl_AsyncDelete(Tcl_AsyncHandler async); +/* 73 */ +EXTERN int Tcl_AsyncInvoke(Tcl_Interp *interp, int code); +/* 74 */ +EXTERN void Tcl_AsyncMark(Tcl_AsyncHandler async); +/* 75 */ +EXTERN int Tcl_AsyncReady(void); +/* 76 */ +EXTERN void Tcl_BackgroundError(Tcl_Interp *interp); +/* 77 */ +EXTERN char Tcl_Backslash(const char *src, int *readPtr); +/* 78 */ +EXTERN int Tcl_BadChannelOption(Tcl_Interp *interp, + const char *optionName, + const char *optionList); +/* 79 */ +EXTERN void Tcl_CallWhenDeleted(Tcl_Interp *interp, + Tcl_InterpDeleteProc *proc, + ClientData clientData); +/* 80 */ +EXTERN void Tcl_CancelIdleCall(Tcl_IdleProc *idleProc, + ClientData clientData); +/* 81 */ +EXTERN int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan); +/* 82 */ +EXTERN int Tcl_CommandComplete(const char *cmd); +/* 83 */ +EXTERN char * Tcl_Concat(int argc, CONST84 char *const *argv); +/* 84 */ +EXTERN int Tcl_ConvertElement(const char *src, char *dst, + int flags); +/* 85 */ +EXTERN int Tcl_ConvertCountedElement(const char *src, + int length, char *dst, int flags); +/* 86 */ +EXTERN int Tcl_CreateAlias(Tcl_Interp *slave, + const char *slaveCmd, Tcl_Interp *target, + const char *targetCmd, int argc, + CONST84 char *const *argv); +/* 87 */ +EXTERN int Tcl_CreateAliasObj(Tcl_Interp *slave, + const char *slaveCmd, Tcl_Interp *target, + const char *targetCmd, int objc, + Tcl_Obj *const objv[]); +/* 88 */ +EXTERN Tcl_Channel Tcl_CreateChannel(const Tcl_ChannelType *typePtr, + const char *chanName, + ClientData instanceData, int mask); +/* 89 */ +EXTERN void Tcl_CreateChannelHandler(Tcl_Channel chan, int mask, + Tcl_ChannelProc *proc, ClientData clientData); +/* 90 */ +EXTERN void Tcl_CreateCloseHandler(Tcl_Channel chan, + Tcl_CloseProc *proc, ClientData clientData); +/* 91 */ +EXTERN Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, + const char *cmdName, Tcl_CmdProc *proc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc); +/* 92 */ +EXTERN void Tcl_CreateEventSource(Tcl_EventSetupProc *setupProc, + Tcl_EventCheckProc *checkProc, + ClientData clientData); +/* 93 */ +EXTERN void Tcl_CreateExitHandler(Tcl_ExitProc *proc, + ClientData clientData); +/* 94 */ +EXTERN Tcl_Interp * Tcl_CreateInterp(void); +/* 95 */ +EXTERN void Tcl_CreateMathFunc(Tcl_Interp *interp, + const char *name, int numArgs, + Tcl_ValueType *argTypes, Tcl_MathProc *proc, + ClientData clientData); +/* 96 */ +EXTERN Tcl_Command Tcl_CreateObjCommand(Tcl_Interp *interp, + const char *cmdName, Tcl_ObjCmdProc *proc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc); +/* 97 */ +EXTERN Tcl_Interp * Tcl_CreateSlave(Tcl_Interp *interp, + const char *slaveName, int isSafe); +/* 98 */ +EXTERN Tcl_TimerToken Tcl_CreateTimerHandler(int milliseconds, + Tcl_TimerProc *proc, ClientData clientData); +/* 99 */ +EXTERN Tcl_Trace Tcl_CreateTrace(Tcl_Interp *interp, int level, + Tcl_CmdTraceProc *proc, + ClientData clientData); +/* 100 */ +EXTERN void Tcl_DeleteAssocData(Tcl_Interp *interp, + const char *name); +/* 101 */ +EXTERN void Tcl_DeleteChannelHandler(Tcl_Channel chan, + Tcl_ChannelProc *proc, ClientData clientData); +/* 102 */ +EXTERN void Tcl_DeleteCloseHandler(Tcl_Channel chan, + Tcl_CloseProc *proc, ClientData clientData); +/* 103 */ +EXTERN int Tcl_DeleteCommand(Tcl_Interp *interp, + const char *cmdName); +/* 104 */ +EXTERN int Tcl_DeleteCommandFromToken(Tcl_Interp *interp, + Tcl_Command command); +/* 105 */ +EXTERN void Tcl_DeleteEvents(Tcl_EventDeleteProc *proc, + ClientData clientData); +/* 106 */ +EXTERN void Tcl_DeleteEventSource(Tcl_EventSetupProc *setupProc, + Tcl_EventCheckProc *checkProc, + ClientData clientData); +/* 107 */ +EXTERN void Tcl_DeleteExitHandler(Tcl_ExitProc *proc, + ClientData clientData); +/* 108 */ +EXTERN void Tcl_DeleteHashEntry(Tcl_HashEntry *entryPtr); +/* 109 */ +EXTERN void Tcl_DeleteHashTable(Tcl_HashTable *tablePtr); +/* 110 */ +EXTERN void Tcl_DeleteInterp(Tcl_Interp *interp); +/* 111 */ +EXTERN void Tcl_DetachPids(int numPids, Tcl_Pid *pidPtr); +/* 112 */ +EXTERN void Tcl_DeleteTimerHandler(Tcl_TimerToken token); +/* 113 */ +EXTERN void Tcl_DeleteTrace(Tcl_Interp *interp, Tcl_Trace trace); +/* 114 */ +EXTERN void Tcl_DontCallWhenDeleted(Tcl_Interp *interp, + Tcl_InterpDeleteProc *proc, + ClientData clientData); +/* 115 */ +EXTERN int Tcl_DoOneEvent(int flags); +/* 116 */ +EXTERN void Tcl_DoWhenIdle(Tcl_IdleProc *proc, + ClientData clientData); +/* 117 */ +EXTERN char * Tcl_DStringAppend(Tcl_DString *dsPtr, + const char *bytes, int length); +/* 118 */ +EXTERN char * Tcl_DStringAppendElement(Tcl_DString *dsPtr, + const char *element); +/* 119 */ +EXTERN void Tcl_DStringEndSublist(Tcl_DString *dsPtr); +/* 120 */ +EXTERN void Tcl_DStringFree(Tcl_DString *dsPtr); +/* 121 */ +EXTERN void Tcl_DStringGetResult(Tcl_Interp *interp, + Tcl_DString *dsPtr); +/* 122 */ +EXTERN void Tcl_DStringInit(Tcl_DString *dsPtr); +/* 123 */ +EXTERN void Tcl_DStringResult(Tcl_Interp *interp, + Tcl_DString *dsPtr); +/* 124 */ +EXTERN void Tcl_DStringSetLength(Tcl_DString *dsPtr, int length); +/* 125 */ +EXTERN void Tcl_DStringStartSublist(Tcl_DString *dsPtr); +/* 126 */ +EXTERN int Tcl_Eof(Tcl_Channel chan); +/* 127 */ +EXTERN CONST84_RETURN char * Tcl_ErrnoId(void); +/* 128 */ +EXTERN CONST84_RETURN char * Tcl_ErrnoMsg(int err); +/* 129 */ +EXTERN int Tcl_Eval(Tcl_Interp *interp, const char *script); +/* 130 */ +EXTERN int Tcl_EvalFile(Tcl_Interp *interp, + const char *fileName); +/* 131 */ +EXTERN int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr); +/* 132 */ +EXTERN void Tcl_EventuallyFree(ClientData clientData, + Tcl_FreeProc *freeProc); +/* 133 */ +EXTERN void Tcl_Exit(int status); +/* 134 */ +EXTERN int Tcl_ExposeCommand(Tcl_Interp *interp, + const char *hiddenCmdToken, + const char *cmdName); +/* 135 */ +EXTERN int Tcl_ExprBoolean(Tcl_Interp *interp, const char *expr, + int *ptr); +/* 136 */ +EXTERN int Tcl_ExprBooleanObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, int *ptr); +/* 137 */ +EXTERN int Tcl_ExprDouble(Tcl_Interp *interp, const char *expr, + double *ptr); +/* 138 */ +EXTERN int Tcl_ExprDoubleObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, double *ptr); +/* 139 */ +EXTERN int Tcl_ExprLong(Tcl_Interp *interp, const char *expr, + long *ptr); +/* 140 */ +EXTERN int Tcl_ExprLongObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + long *ptr); +/* 141 */ +EXTERN int Tcl_ExprObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + Tcl_Obj **resultPtrPtr); +/* 142 */ +EXTERN int Tcl_ExprString(Tcl_Interp *interp, const char *expr); +/* 143 */ +EXTERN void Tcl_Finalize(void); +/* 144 */ +EXTERN void Tcl_FindExecutable(const char *argv0); +/* 145 */ +EXTERN Tcl_HashEntry * Tcl_FirstHashEntry(Tcl_HashTable *tablePtr, + Tcl_HashSearch *searchPtr); +/* 146 */ +EXTERN int Tcl_Flush(Tcl_Channel chan); +/* 147 */ +EXTERN void Tcl_FreeResult(Tcl_Interp *interp); +/* 148 */ +EXTERN int Tcl_GetAlias(Tcl_Interp *interp, + const char *slaveCmd, + Tcl_Interp **targetInterpPtr, + CONST84 char **targetCmdPtr, int *argcPtr, + CONST84 char ***argvPtr); +/* 149 */ +EXTERN int Tcl_GetAliasObj(Tcl_Interp *interp, + const char *slaveCmd, + Tcl_Interp **targetInterpPtr, + CONST84 char **targetCmdPtr, int *objcPtr, + Tcl_Obj ***objv); +/* 150 */ +EXTERN ClientData Tcl_GetAssocData(Tcl_Interp *interp, + const char *name, + Tcl_InterpDeleteProc **procPtr); +/* 151 */ +EXTERN Tcl_Channel Tcl_GetChannel(Tcl_Interp *interp, + const char *chanName, int *modePtr); +/* 152 */ +EXTERN int Tcl_GetChannelBufferSize(Tcl_Channel chan); +/* 153 */ +EXTERN int Tcl_GetChannelHandle(Tcl_Channel chan, int direction, + ClientData *handlePtr); +/* 154 */ +EXTERN ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan); +/* 155 */ +EXTERN int Tcl_GetChannelMode(Tcl_Channel chan); +/* 156 */ +EXTERN CONST84_RETURN char * Tcl_GetChannelName(Tcl_Channel chan); +/* 157 */ +EXTERN int Tcl_GetChannelOption(Tcl_Interp *interp, + Tcl_Channel chan, const char *optionName, + Tcl_DString *dsPtr); +/* 158 */ +EXTERN CONST86 Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan); +/* 159 */ +EXTERN int Tcl_GetCommandInfo(Tcl_Interp *interp, + const char *cmdName, Tcl_CmdInfo *infoPtr); +/* 160 */ +EXTERN CONST84_RETURN char * Tcl_GetCommandName(Tcl_Interp *interp, + Tcl_Command command); +/* 161 */ +EXTERN int Tcl_GetErrno(void); +/* 162 */ +EXTERN CONST84_RETURN char * Tcl_GetHostName(void); +/* 163 */ +EXTERN int Tcl_GetInterpPath(Tcl_Interp *askInterp, + Tcl_Interp *slaveInterp); +/* 164 */ +EXTERN Tcl_Interp * Tcl_GetMaster(Tcl_Interp *interp); +/* 165 */ +EXTERN const char * Tcl_GetNameOfExecutable(void); +/* 166 */ +EXTERN Tcl_Obj * Tcl_GetObjResult(Tcl_Interp *interp); +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 167 */ +EXTERN int Tcl_GetOpenFile(Tcl_Interp *interp, + const char *chanID, int forWriting, + int checkUsage, ClientData *filePtr); +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 167 */ +EXTERN int Tcl_GetOpenFile(Tcl_Interp *interp, + const char *chanID, int forWriting, + int checkUsage, ClientData *filePtr); +#endif /* MACOSX */ +/* 168 */ +EXTERN Tcl_PathType Tcl_GetPathType(const char *path); +/* 169 */ +EXTERN int Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr); +/* 170 */ +EXTERN int Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr); +/* 171 */ +EXTERN int Tcl_GetServiceMode(void); +/* 172 */ +EXTERN Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp, + const char *slaveName); +/* 173 */ +EXTERN Tcl_Channel Tcl_GetStdChannel(int type); +/* 174 */ +EXTERN CONST84_RETURN char * Tcl_GetStringResult(Tcl_Interp *interp); +/* 175 */ +EXTERN CONST84_RETURN char * Tcl_GetVar(Tcl_Interp *interp, + const char *varName, int flags); +/* 176 */ +EXTERN CONST84_RETURN char * Tcl_GetVar2(Tcl_Interp *interp, + const char *part1, const char *part2, + int flags); +/* 177 */ +EXTERN int Tcl_GlobalEval(Tcl_Interp *interp, + const char *command); +/* 178 */ +EXTERN int Tcl_GlobalEvalObj(Tcl_Interp *interp, + Tcl_Obj *objPtr); +/* 179 */ +EXTERN int Tcl_HideCommand(Tcl_Interp *interp, + const char *cmdName, + const char *hiddenCmdToken); +/* 180 */ +EXTERN int Tcl_Init(Tcl_Interp *interp); +/* 181 */ +EXTERN void Tcl_InitHashTable(Tcl_HashTable *tablePtr, + int keyType); +/* 182 */ +EXTERN int Tcl_InputBlocked(Tcl_Channel chan); +/* 183 */ +EXTERN int Tcl_InputBuffered(Tcl_Channel chan); +/* 184 */ +EXTERN int Tcl_InterpDeleted(Tcl_Interp *interp); +/* 185 */ +EXTERN int Tcl_IsSafe(Tcl_Interp *interp); +/* 186 */ +EXTERN char * Tcl_JoinPath(int argc, CONST84 char *const *argv, + Tcl_DString *resultPtr); +/* 187 */ +EXTERN int Tcl_LinkVar(Tcl_Interp *interp, const char *varName, + char *addr, int type); +/* Slot 188 is reserved */ +/* 189 */ +EXTERN Tcl_Channel Tcl_MakeFileChannel(ClientData handle, int mode); +/* 190 */ +EXTERN int Tcl_MakeSafe(Tcl_Interp *interp); +/* 191 */ +EXTERN Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket); +/* 192 */ +EXTERN char * Tcl_Merge(int argc, CONST84 char *const *argv); +/* 193 */ +EXTERN Tcl_HashEntry * Tcl_NextHashEntry(Tcl_HashSearch *searchPtr); +/* 194 */ +EXTERN void Tcl_NotifyChannel(Tcl_Channel channel, int mask); +/* 195 */ +EXTERN Tcl_Obj * Tcl_ObjGetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, int flags); +/* 196 */ +EXTERN Tcl_Obj * Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, + int flags); +/* 197 */ +EXTERN Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, + CONST84 char **argv, int flags); +/* 198 */ +EXTERN Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, + const char *fileName, const char *modeString, + int permissions); +/* 199 */ +EXTERN Tcl_Channel Tcl_OpenTcpClient(Tcl_Interp *interp, int port, + const char *address, const char *myaddr, + int myport, int async); +/* 200 */ +EXTERN Tcl_Channel Tcl_OpenTcpServer(Tcl_Interp *interp, int port, + const char *host, + Tcl_TcpAcceptProc *acceptProc, + ClientData callbackData); +/* 201 */ +EXTERN void Tcl_Preserve(ClientData data); +/* 202 */ +EXTERN void Tcl_PrintDouble(Tcl_Interp *interp, double value, + char *dst); +/* 203 */ +EXTERN int Tcl_PutEnv(const char *assignment); +/* 204 */ +EXTERN CONST84_RETURN char * Tcl_PosixError(Tcl_Interp *interp); +/* 205 */ +EXTERN void Tcl_QueueEvent(Tcl_Event *evPtr, + Tcl_QueuePosition position); +/* 206 */ +EXTERN int Tcl_Read(Tcl_Channel chan, char *bufPtr, int toRead); +/* 207 */ +EXTERN void Tcl_ReapDetachedProcs(void); +/* 208 */ +EXTERN int Tcl_RecordAndEval(Tcl_Interp *interp, + const char *cmd, int flags); +/* 209 */ +EXTERN int Tcl_RecordAndEvalObj(Tcl_Interp *interp, + Tcl_Obj *cmdPtr, int flags); +/* 210 */ +EXTERN void Tcl_RegisterChannel(Tcl_Interp *interp, + Tcl_Channel chan); +/* 211 */ +EXTERN void Tcl_RegisterObjType(const Tcl_ObjType *typePtr); +/* 212 */ +EXTERN Tcl_RegExp Tcl_RegExpCompile(Tcl_Interp *interp, + const char *pattern); +/* 213 */ +EXTERN int Tcl_RegExpExec(Tcl_Interp *interp, Tcl_RegExp regexp, + const char *text, const char *start); +/* 214 */ +EXTERN int Tcl_RegExpMatch(Tcl_Interp *interp, const char *text, + const char *pattern); +/* 215 */ +EXTERN void Tcl_RegExpRange(Tcl_RegExp regexp, int index, + CONST84 char **startPtr, + CONST84 char **endPtr); +/* 216 */ +EXTERN void Tcl_Release(ClientData clientData); +/* 217 */ +EXTERN void Tcl_ResetResult(Tcl_Interp *interp); +/* 218 */ +EXTERN int Tcl_ScanElement(const char *src, int *flagPtr); +/* 219 */ +EXTERN int Tcl_ScanCountedElement(const char *src, int length, + int *flagPtr); +/* 220 */ +EXTERN int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode); +/* 221 */ +EXTERN int Tcl_ServiceAll(void); +/* 222 */ +EXTERN int Tcl_ServiceEvent(int flags); +/* 223 */ +EXTERN void Tcl_SetAssocData(Tcl_Interp *interp, + const char *name, Tcl_InterpDeleteProc *proc, + ClientData clientData); +/* 224 */ +EXTERN void Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz); +/* 225 */ +EXTERN int Tcl_SetChannelOption(Tcl_Interp *interp, + Tcl_Channel chan, const char *optionName, + const char *newValue); +/* 226 */ +EXTERN int Tcl_SetCommandInfo(Tcl_Interp *interp, + const char *cmdName, + const Tcl_CmdInfo *infoPtr); +/* 227 */ +EXTERN void Tcl_SetErrno(int err); +/* 228 */ +EXTERN void Tcl_SetErrorCode(Tcl_Interp *interp, ...); +/* 229 */ +EXTERN void Tcl_SetMaxBlockTime(const Tcl_Time *timePtr); +/* 230 */ +EXTERN void Tcl_SetPanicProc(Tcl_PanicProc *panicProc); +/* 231 */ +EXTERN int Tcl_SetRecursionLimit(Tcl_Interp *interp, int depth); +/* 232 */ +EXTERN void Tcl_SetResult(Tcl_Interp *interp, char *result, + Tcl_FreeProc *freeProc); +/* 233 */ +EXTERN int Tcl_SetServiceMode(int mode); +/* 234 */ +EXTERN void Tcl_SetObjErrorCode(Tcl_Interp *interp, + Tcl_Obj *errorObjPtr); +/* 235 */ +EXTERN void Tcl_SetObjResult(Tcl_Interp *interp, + Tcl_Obj *resultObjPtr); +/* 236 */ +EXTERN void Tcl_SetStdChannel(Tcl_Channel channel, int type); +/* 237 */ +EXTERN CONST84_RETURN char * Tcl_SetVar(Tcl_Interp *interp, + const char *varName, const char *newValue, + int flags); +/* 238 */ +EXTERN CONST84_RETURN char * Tcl_SetVar2(Tcl_Interp *interp, + const char *part1, const char *part2, + const char *newValue, int flags); +/* 239 */ +EXTERN CONST84_RETURN char * Tcl_SignalId(int sig); +/* 240 */ +EXTERN CONST84_RETURN char * Tcl_SignalMsg(int sig); +/* 241 */ +EXTERN void Tcl_SourceRCFile(Tcl_Interp *interp); +/* 242 */ +EXTERN int Tcl_SplitList(Tcl_Interp *interp, + const char *listStr, int *argcPtr, + CONST84 char ***argvPtr); +/* 243 */ +EXTERN void Tcl_SplitPath(const char *path, int *argcPtr, + CONST84 char ***argvPtr); +/* 244 */ +EXTERN void Tcl_StaticPackage(Tcl_Interp *interp, + const char *pkgName, + Tcl_PackageInitProc *initProc, + Tcl_PackageInitProc *safeInitProc); +/* 245 */ +EXTERN int Tcl_StringMatch(const char *str, const char *pattern); +/* 246 */ +EXTERN int Tcl_TellOld(Tcl_Channel chan); +/* 247 */ +EXTERN int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, + int flags, Tcl_VarTraceProc *proc, + ClientData clientData); +/* 248 */ +EXTERN int Tcl_TraceVar2(Tcl_Interp *interp, const char *part1, + const char *part2, int flags, + Tcl_VarTraceProc *proc, + ClientData clientData); +/* 249 */ +EXTERN char * Tcl_TranslateFileName(Tcl_Interp *interp, + const char *name, Tcl_DString *bufferPtr); +/* 250 */ +EXTERN int Tcl_Ungets(Tcl_Channel chan, const char *str, + int len, int atHead); +/* 251 */ +EXTERN void Tcl_UnlinkVar(Tcl_Interp *interp, + const char *varName); +/* 252 */ +EXTERN int Tcl_UnregisterChannel(Tcl_Interp *interp, + Tcl_Channel chan); +/* 253 */ +EXTERN int Tcl_UnsetVar(Tcl_Interp *interp, const char *varName, + int flags); +/* 254 */ +EXTERN int Tcl_UnsetVar2(Tcl_Interp *interp, const char *part1, + const char *part2, int flags); +/* 255 */ +EXTERN void Tcl_UntraceVar(Tcl_Interp *interp, + const char *varName, int flags, + Tcl_VarTraceProc *proc, + ClientData clientData); +/* 256 */ +EXTERN void Tcl_UntraceVar2(Tcl_Interp *interp, + const char *part1, const char *part2, + int flags, Tcl_VarTraceProc *proc, + ClientData clientData); +/* 257 */ +EXTERN void Tcl_UpdateLinkedVar(Tcl_Interp *interp, + const char *varName); +/* 258 */ +EXTERN int Tcl_UpVar(Tcl_Interp *interp, const char *frameName, + const char *varName, const char *localName, + int flags); +/* 259 */ +EXTERN int Tcl_UpVar2(Tcl_Interp *interp, const char *frameName, + const char *part1, const char *part2, + const char *localName, int flags); +/* 260 */ +EXTERN int Tcl_VarEval(Tcl_Interp *interp, ...); +/* 261 */ +EXTERN ClientData Tcl_VarTraceInfo(Tcl_Interp *interp, + const char *varName, int flags, + Tcl_VarTraceProc *procPtr, + ClientData prevClientData); +/* 262 */ +EXTERN ClientData Tcl_VarTraceInfo2(Tcl_Interp *interp, + const char *part1, const char *part2, + int flags, Tcl_VarTraceProc *procPtr, + ClientData prevClientData); +/* 263 */ +EXTERN int Tcl_Write(Tcl_Channel chan, const char *s, int slen); +/* 264 */ +EXTERN void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[], const char *message); +/* 265 */ +EXTERN int Tcl_DumpActiveMemory(const char *fileName); +/* 266 */ +EXTERN void Tcl_ValidateAllMemory(const char *file, int line); +/* 267 */ +EXTERN void Tcl_AppendResultVA(Tcl_Interp *interp, + va_list argList); +/* 268 */ +EXTERN void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, + va_list argList); +/* 269 */ +EXTERN char * Tcl_HashStats(Tcl_HashTable *tablePtr); +/* 270 */ +EXTERN CONST84_RETURN char * Tcl_ParseVar(Tcl_Interp *interp, + const char *start, CONST84 char **termPtr); +/* 271 */ +EXTERN CONST84_RETURN char * Tcl_PkgPresent(Tcl_Interp *interp, + const char *name, const char *version, + int exact); +/* 272 */ +EXTERN CONST84_RETURN char * Tcl_PkgPresentEx(Tcl_Interp *interp, + const char *name, const char *version, + int exact, void *clientDataPtr); +/* 273 */ +EXTERN int Tcl_PkgProvide(Tcl_Interp *interp, const char *name, + const char *version); +/* 274 */ +EXTERN CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp, + const char *name, const char *version, + int exact); +/* 275 */ +EXTERN void Tcl_SetErrorCodeVA(Tcl_Interp *interp, + va_list argList); +/* 276 */ +EXTERN int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList); +/* 277 */ +EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options); +/* 278 */ +EXTERN void Tcl_PanicVA(const char *format, va_list argList); +/* 279 */ +EXTERN void Tcl_GetVersion(int *major, int *minor, + int *patchLevel, int *type); +/* 280 */ +EXTERN void Tcl_InitMemory(Tcl_Interp *interp); +/* 281 */ +EXTERN Tcl_Channel Tcl_StackChannel(Tcl_Interp *interp, + const Tcl_ChannelType *typePtr, + ClientData instanceData, int mask, + Tcl_Channel prevChan); +/* 282 */ +EXTERN int Tcl_UnstackChannel(Tcl_Interp *interp, + Tcl_Channel chan); +/* 283 */ +EXTERN Tcl_Channel Tcl_GetStackedChannel(Tcl_Channel chan); +/* 284 */ +EXTERN void Tcl_SetMainLoop(Tcl_MainLoopProc *proc); +/* Slot 285 is reserved */ +/* 286 */ +EXTERN void Tcl_AppendObjToObj(Tcl_Obj *objPtr, + Tcl_Obj *appendObjPtr); +/* 287 */ +EXTERN Tcl_Encoding Tcl_CreateEncoding(const Tcl_EncodingType *typePtr); +/* 288 */ +EXTERN void Tcl_CreateThreadExitHandler(Tcl_ExitProc *proc, + ClientData clientData); +/* 289 */ +EXTERN void Tcl_DeleteThreadExitHandler(Tcl_ExitProc *proc, + ClientData clientData); +/* 290 */ +EXTERN void Tcl_DiscardResult(Tcl_SavedResult *statePtr); +/* 291 */ +EXTERN int Tcl_EvalEx(Tcl_Interp *interp, const char *script, + int numBytes, int flags); +/* 292 */ +EXTERN int Tcl_EvalObjv(Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[], int flags); +/* 293 */ +EXTERN int Tcl_EvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, + int flags); +/* 294 */ +EXTERN void Tcl_ExitThread(int status); +/* 295 */ +EXTERN int Tcl_ExternalToUtf(Tcl_Interp *interp, + Tcl_Encoding encoding, const char *src, + int srcLen, int flags, + Tcl_EncodingState *statePtr, char *dst, + int dstLen, int *srcReadPtr, + int *dstWrotePtr, int *dstCharsPtr); +/* 296 */ +EXTERN char * Tcl_ExternalToUtfDString(Tcl_Encoding encoding, + const char *src, int srcLen, + Tcl_DString *dsPtr); +/* 297 */ +EXTERN void Tcl_FinalizeThread(void); +/* 298 */ +EXTERN void Tcl_FinalizeNotifier(ClientData clientData); +/* 299 */ +EXTERN void Tcl_FreeEncoding(Tcl_Encoding encoding); +/* 300 */ +EXTERN Tcl_ThreadId Tcl_GetCurrentThread(void); +/* 301 */ +EXTERN Tcl_Encoding Tcl_GetEncoding(Tcl_Interp *interp, const char *name); +/* 302 */ +EXTERN CONST84_RETURN char * Tcl_GetEncodingName(Tcl_Encoding encoding); +/* 303 */ +EXTERN void Tcl_GetEncodingNames(Tcl_Interp *interp); +/* 304 */ +EXTERN int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, + Tcl_Obj *objPtr, const void *tablePtr, + int offset, const char *msg, int flags, + int *indexPtr); +/* 305 */ +EXTERN void * Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, + int size); +/* 306 */ +EXTERN Tcl_Obj * Tcl_GetVar2Ex(Tcl_Interp *interp, const char *part1, + const char *part2, int flags); +/* 307 */ +EXTERN ClientData Tcl_InitNotifier(void); +/* 308 */ +EXTERN void Tcl_MutexLock(Tcl_Mutex *mutexPtr); +/* 309 */ +EXTERN void Tcl_MutexUnlock(Tcl_Mutex *mutexPtr); +/* 310 */ +EXTERN void Tcl_ConditionNotify(Tcl_Condition *condPtr); +/* 311 */ +EXTERN void Tcl_ConditionWait(Tcl_Condition *condPtr, + Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr); +/* 312 */ +EXTERN int Tcl_NumUtfChars(const char *src, int length); +/* 313 */ +EXTERN int Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr, + int charsToRead, int appendFlag); +/* 314 */ +EXTERN void Tcl_RestoreResult(Tcl_Interp *interp, + Tcl_SavedResult *statePtr); +/* 315 */ +EXTERN void Tcl_SaveResult(Tcl_Interp *interp, + Tcl_SavedResult *statePtr); +/* 316 */ +EXTERN int Tcl_SetSystemEncoding(Tcl_Interp *interp, + const char *name); +/* 317 */ +EXTERN Tcl_Obj * Tcl_SetVar2Ex(Tcl_Interp *interp, const char *part1, + const char *part2, Tcl_Obj *newValuePtr, + int flags); +/* 318 */ +EXTERN void Tcl_ThreadAlert(Tcl_ThreadId threadId); +/* 319 */ +EXTERN void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, + Tcl_Event *evPtr, Tcl_QueuePosition position); +/* 320 */ +EXTERN Tcl_UniChar Tcl_UniCharAtIndex(const char *src, int index); +/* 321 */ +EXTERN Tcl_UniChar Tcl_UniCharToLower(int ch); +/* 322 */ +EXTERN Tcl_UniChar Tcl_UniCharToTitle(int ch); +/* 323 */ +EXTERN Tcl_UniChar Tcl_UniCharToUpper(int ch); +/* 324 */ +EXTERN int Tcl_UniCharToUtf(int ch, char *buf); +/* 325 */ +EXTERN CONST84_RETURN char * Tcl_UtfAtIndex(const char *src, int index); +/* 326 */ +EXTERN int Tcl_UtfCharComplete(const char *src, int length); +/* 327 */ +EXTERN int Tcl_UtfBackslash(const char *src, int *readPtr, + char *dst); +/* 328 */ +EXTERN CONST84_RETURN char * Tcl_UtfFindFirst(const char *src, int ch); +/* 329 */ +EXTERN CONST84_RETURN char * Tcl_UtfFindLast(const char *src, int ch); +/* 330 */ +EXTERN CONST84_RETURN char * Tcl_UtfNext(const char *src); +/* 331 */ +EXTERN CONST84_RETURN char * Tcl_UtfPrev(const char *src, const char *start); +/* 332 */ +EXTERN int Tcl_UtfToExternal(Tcl_Interp *interp, + Tcl_Encoding encoding, const char *src, + int srcLen, int flags, + Tcl_EncodingState *statePtr, char *dst, + int dstLen, int *srcReadPtr, + int *dstWrotePtr, int *dstCharsPtr); +/* 333 */ +EXTERN char * Tcl_UtfToExternalDString(Tcl_Encoding encoding, + const char *src, int srcLen, + Tcl_DString *dsPtr); +/* 334 */ +EXTERN int Tcl_UtfToLower(char *src); +/* 335 */ +EXTERN int Tcl_UtfToTitle(char *src); +/* 336 */ +EXTERN int Tcl_UtfToUniChar(const char *src, Tcl_UniChar *chPtr); +/* 337 */ +EXTERN int Tcl_UtfToUpper(char *src); +/* 338 */ +EXTERN int Tcl_WriteChars(Tcl_Channel chan, const char *src, + int srcLen); +/* 339 */ +EXTERN int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr); +/* 340 */ +EXTERN char * Tcl_GetString(Tcl_Obj *objPtr); +/* 341 */ +EXTERN CONST84_RETURN char * Tcl_GetDefaultEncodingDir(void); +/* 342 */ +EXTERN void Tcl_SetDefaultEncodingDir(const char *path); +/* 343 */ +EXTERN void Tcl_AlertNotifier(ClientData clientData); +/* 344 */ +EXTERN void Tcl_ServiceModeHook(int mode); +/* 345 */ +EXTERN int Tcl_UniCharIsAlnum(int ch); +/* 346 */ +EXTERN int Tcl_UniCharIsAlpha(int ch); +/* 347 */ +EXTERN int Tcl_UniCharIsDigit(int ch); +/* 348 */ +EXTERN int Tcl_UniCharIsLower(int ch); +/* 349 */ +EXTERN int Tcl_UniCharIsSpace(int ch); +/* 350 */ +EXTERN int Tcl_UniCharIsUpper(int ch); +/* 351 */ +EXTERN int Tcl_UniCharIsWordChar(int ch); +/* 352 */ +EXTERN int Tcl_UniCharLen(const Tcl_UniChar *uniStr); +/* 353 */ +EXTERN int Tcl_UniCharNcmp(const Tcl_UniChar *ucs, + const Tcl_UniChar *uct, + unsigned long numChars); +/* 354 */ +EXTERN char * Tcl_UniCharToUtfDString(const Tcl_UniChar *uniStr, + int uniLength, Tcl_DString *dsPtr); +/* 355 */ +EXTERN Tcl_UniChar * Tcl_UtfToUniCharDString(const char *src, int length, + Tcl_DString *dsPtr); +/* 356 */ +EXTERN Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, + Tcl_Obj *patObj, int flags); +/* 357 */ +EXTERN Tcl_Obj * Tcl_EvalTokens(Tcl_Interp *interp, + Tcl_Token *tokenPtr, int count); +/* 358 */ +EXTERN void Tcl_FreeParse(Tcl_Parse *parsePtr); +/* 359 */ +EXTERN void Tcl_LogCommandInfo(Tcl_Interp *interp, + const char *script, const char *command, + int length); +/* 360 */ +EXTERN int Tcl_ParseBraces(Tcl_Interp *interp, + const char *start, int numBytes, + Tcl_Parse *parsePtr, int append, + CONST84 char **termPtr); +/* 361 */ +EXTERN int Tcl_ParseCommand(Tcl_Interp *interp, + const char *start, int numBytes, int nested, + Tcl_Parse *parsePtr); +/* 362 */ +EXTERN int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, + int numBytes, Tcl_Parse *parsePtr); +/* 363 */ +EXTERN int Tcl_ParseQuotedString(Tcl_Interp *interp, + const char *start, int numBytes, + Tcl_Parse *parsePtr, int append, + CONST84 char **termPtr); +/* 364 */ +EXTERN int Tcl_ParseVarName(Tcl_Interp *interp, + const char *start, int numBytes, + Tcl_Parse *parsePtr, int append); +/* 365 */ +EXTERN char * Tcl_GetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr); +/* 366 */ +EXTERN int Tcl_Chdir(const char *dirName); +/* 367 */ +EXTERN int Tcl_Access(const char *path, int mode); +/* 368 */ +EXTERN int Tcl_Stat(const char *path, struct stat *bufPtr); +/* 369 */ +EXTERN int Tcl_UtfNcmp(const char *s1, const char *s2, + unsigned long n); +/* 370 */ +EXTERN int Tcl_UtfNcasecmp(const char *s1, const char *s2, + unsigned long n); +/* 371 */ +EXTERN int Tcl_StringCaseMatch(const char *str, + const char *pattern, int nocase); +/* 372 */ +EXTERN int Tcl_UniCharIsControl(int ch); +/* 373 */ +EXTERN int Tcl_UniCharIsGraph(int ch); +/* 374 */ +EXTERN int Tcl_UniCharIsPrint(int ch); +/* 375 */ +EXTERN int Tcl_UniCharIsPunct(int ch); +/* 376 */ +EXTERN int Tcl_RegExpExecObj(Tcl_Interp *interp, + Tcl_RegExp regexp, Tcl_Obj *textObj, + int offset, int nmatches, int flags); +/* 377 */ +EXTERN void Tcl_RegExpGetInfo(Tcl_RegExp regexp, + Tcl_RegExpInfo *infoPtr); +/* 378 */ +EXTERN Tcl_Obj * Tcl_NewUnicodeObj(const Tcl_UniChar *unicode, + int numChars); +/* 379 */ +EXTERN void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, + const Tcl_UniChar *unicode, int numChars); +/* 380 */ +EXTERN int Tcl_GetCharLength(Tcl_Obj *objPtr); +/* 381 */ +EXTERN Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, int index); +/* 382 */ +EXTERN Tcl_UniChar * Tcl_GetUnicode(Tcl_Obj *objPtr); +/* 383 */ +EXTERN Tcl_Obj * Tcl_GetRange(Tcl_Obj *objPtr, int first, int last); +/* 384 */ +EXTERN void Tcl_AppendUnicodeToObj(Tcl_Obj *objPtr, + const Tcl_UniChar *unicode, int length); +/* 385 */ +EXTERN int Tcl_RegExpMatchObj(Tcl_Interp *interp, + Tcl_Obj *textObj, Tcl_Obj *patternObj); +/* 386 */ +EXTERN void Tcl_SetNotifier(Tcl_NotifierProcs *notifierProcPtr); +/* 387 */ +EXTERN Tcl_Mutex * Tcl_GetAllocMutex(void); +/* 388 */ +EXTERN int Tcl_GetChannelNames(Tcl_Interp *interp); +/* 389 */ +EXTERN int Tcl_GetChannelNamesEx(Tcl_Interp *interp, + const char *pattern); +/* 390 */ +EXTERN int Tcl_ProcObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +/* 391 */ +EXTERN void Tcl_ConditionFinalize(Tcl_Condition *condPtr); +/* 392 */ +EXTERN void Tcl_MutexFinalize(Tcl_Mutex *mutex); +/* 393 */ +EXTERN int Tcl_CreateThread(Tcl_ThreadId *idPtr, + Tcl_ThreadCreateProc *proc, + ClientData clientData, int stackSize, + int flags); +/* 394 */ +EXTERN int Tcl_ReadRaw(Tcl_Channel chan, char *dst, + int bytesToRead); +/* 395 */ +EXTERN int Tcl_WriteRaw(Tcl_Channel chan, const char *src, + int srcLen); +/* 396 */ +EXTERN Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan); +/* 397 */ +EXTERN int Tcl_ChannelBuffered(Tcl_Channel chan); +/* 398 */ +EXTERN CONST84_RETURN char * Tcl_ChannelName( + const Tcl_ChannelType *chanTypePtr); +/* 399 */ +EXTERN Tcl_ChannelTypeVersion Tcl_ChannelVersion( + const Tcl_ChannelType *chanTypePtr); +/* 400 */ +EXTERN Tcl_DriverBlockModeProc * Tcl_ChannelBlockModeProc( + const Tcl_ChannelType *chanTypePtr); +/* 401 */ +EXTERN Tcl_DriverCloseProc * Tcl_ChannelCloseProc( + const Tcl_ChannelType *chanTypePtr); +/* 402 */ +EXTERN Tcl_DriverClose2Proc * Tcl_ChannelClose2Proc( + const Tcl_ChannelType *chanTypePtr); +/* 403 */ +EXTERN Tcl_DriverInputProc * Tcl_ChannelInputProc( + const Tcl_ChannelType *chanTypePtr); +/* 404 */ +EXTERN Tcl_DriverOutputProc * Tcl_ChannelOutputProc( + const Tcl_ChannelType *chanTypePtr); +/* 405 */ +EXTERN Tcl_DriverSeekProc * Tcl_ChannelSeekProc( + const Tcl_ChannelType *chanTypePtr); +/* 406 */ +EXTERN Tcl_DriverSetOptionProc * Tcl_ChannelSetOptionProc( + const Tcl_ChannelType *chanTypePtr); +/* 407 */ +EXTERN Tcl_DriverGetOptionProc * Tcl_ChannelGetOptionProc( + const Tcl_ChannelType *chanTypePtr); +/* 408 */ +EXTERN Tcl_DriverWatchProc * Tcl_ChannelWatchProc( + const Tcl_ChannelType *chanTypePtr); +/* 409 */ +EXTERN Tcl_DriverGetHandleProc * Tcl_ChannelGetHandleProc( + const Tcl_ChannelType *chanTypePtr); +/* 410 */ +EXTERN Tcl_DriverFlushProc * Tcl_ChannelFlushProc( + const Tcl_ChannelType *chanTypePtr); +/* 411 */ +EXTERN Tcl_DriverHandlerProc * Tcl_ChannelHandlerProc( + const Tcl_ChannelType *chanTypePtr); +/* 412 */ +EXTERN int Tcl_JoinThread(Tcl_ThreadId threadId, int *result); +/* 413 */ +EXTERN int Tcl_IsChannelShared(Tcl_Channel channel); +/* 414 */ +EXTERN int Tcl_IsChannelRegistered(Tcl_Interp *interp, + Tcl_Channel channel); +/* 415 */ +EXTERN void Tcl_CutChannel(Tcl_Channel channel); +/* 416 */ +EXTERN void Tcl_SpliceChannel(Tcl_Channel channel); +/* 417 */ +EXTERN void Tcl_ClearChannelHandlers(Tcl_Channel channel); +/* 418 */ +EXTERN int Tcl_IsChannelExisting(const char *channelName); +/* 419 */ +EXTERN int Tcl_UniCharNcasecmp(const Tcl_UniChar *ucs, + const Tcl_UniChar *uct, + unsigned long numChars); +/* 420 */ +EXTERN int Tcl_UniCharCaseMatch(const Tcl_UniChar *uniStr, + const Tcl_UniChar *uniPattern, int nocase); +/* 421 */ +EXTERN Tcl_HashEntry * Tcl_FindHashEntry(Tcl_HashTable *tablePtr, + const void *key); +/* 422 */ +EXTERN Tcl_HashEntry * Tcl_CreateHashEntry(Tcl_HashTable *tablePtr, + const void *key, int *newPtr); +/* 423 */ +EXTERN void Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr, + int keyType, const Tcl_HashKeyType *typePtr); +/* 424 */ +EXTERN void Tcl_InitObjHashTable(Tcl_HashTable *tablePtr); +/* 425 */ +EXTERN ClientData Tcl_CommandTraceInfo(Tcl_Interp *interp, + const char *varName, int flags, + Tcl_CommandTraceProc *procPtr, + ClientData prevClientData); +/* 426 */ +EXTERN int Tcl_TraceCommand(Tcl_Interp *interp, + const char *varName, int flags, + Tcl_CommandTraceProc *proc, + ClientData clientData); +/* 427 */ +EXTERN void Tcl_UntraceCommand(Tcl_Interp *interp, + const char *varName, int flags, + Tcl_CommandTraceProc *proc, + ClientData clientData); +/* 428 */ +EXTERN char * Tcl_AttemptAlloc(unsigned int size); +/* 429 */ +EXTERN char * Tcl_AttemptDbCkalloc(unsigned int size, + const char *file, int line); +/* 430 */ +EXTERN char * Tcl_AttemptRealloc(char *ptr, unsigned int size); +/* 431 */ +EXTERN char * Tcl_AttemptDbCkrealloc(char *ptr, unsigned int size, + const char *file, int line); +/* 432 */ +EXTERN int Tcl_AttemptSetObjLength(Tcl_Obj *objPtr, int length); +/* 433 */ +EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel); +/* 434 */ +EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, + int *lengthPtr); +/* 435 */ +EXTERN int Tcl_GetMathFuncInfo(Tcl_Interp *interp, + const char *name, int *numArgsPtr, + Tcl_ValueType **argTypesPtr, + Tcl_MathProc **procPtr, + ClientData *clientDataPtr); +/* 436 */ +EXTERN Tcl_Obj * Tcl_ListMathFuncs(Tcl_Interp *interp, + const char *pattern); +/* 437 */ +EXTERN Tcl_Obj * Tcl_SubstObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + int flags); +/* 438 */ +EXTERN int Tcl_DetachChannel(Tcl_Interp *interp, + Tcl_Channel channel); +/* 439 */ +EXTERN int Tcl_IsStandardChannel(Tcl_Channel channel); +/* 440 */ +EXTERN int Tcl_FSCopyFile(Tcl_Obj *srcPathPtr, + Tcl_Obj *destPathPtr); +/* 441 */ +EXTERN int Tcl_FSCopyDirectory(Tcl_Obj *srcPathPtr, + Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr); +/* 442 */ +EXTERN int Tcl_FSCreateDirectory(Tcl_Obj *pathPtr); +/* 443 */ +EXTERN int Tcl_FSDeleteFile(Tcl_Obj *pathPtr); +/* 444 */ +EXTERN int Tcl_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, + const char *sym1, const char *sym2, + Tcl_PackageInitProc **proc1Ptr, + Tcl_PackageInitProc **proc2Ptr, + Tcl_LoadHandle *handlePtr, + Tcl_FSUnloadFileProc **unloadProcPtr); +/* 445 */ +EXTERN int Tcl_FSMatchInDirectory(Tcl_Interp *interp, + Tcl_Obj *result, Tcl_Obj *pathPtr, + const char *pattern, Tcl_GlobTypeData *types); +/* 446 */ +EXTERN Tcl_Obj * Tcl_FSLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr, + int linkAction); +/* 447 */ +EXTERN int Tcl_FSRemoveDirectory(Tcl_Obj *pathPtr, + int recursive, Tcl_Obj **errorPtr); +/* 448 */ +EXTERN int Tcl_FSRenameFile(Tcl_Obj *srcPathPtr, + Tcl_Obj *destPathPtr); +/* 449 */ +EXTERN int Tcl_FSLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); +/* 450 */ +EXTERN int Tcl_FSUtime(Tcl_Obj *pathPtr, struct utimbuf *tval); +/* 451 */ +EXTERN int Tcl_FSFileAttrsGet(Tcl_Interp *interp, int index, + Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); +/* 452 */ +EXTERN int Tcl_FSFileAttrsSet(Tcl_Interp *interp, int index, + Tcl_Obj *pathPtr, Tcl_Obj *objPtr); +/* 453 */ +EXTERN const char *CONST86 * Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef); +/* 454 */ +EXTERN int Tcl_FSStat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); +/* 455 */ +EXTERN int Tcl_FSAccess(Tcl_Obj *pathPtr, int mode); +/* 456 */ +EXTERN Tcl_Channel Tcl_FSOpenFileChannel(Tcl_Interp *interp, + Tcl_Obj *pathPtr, const char *modeString, + int permissions); +/* 457 */ +EXTERN Tcl_Obj * Tcl_FSGetCwd(Tcl_Interp *interp); +/* 458 */ +EXTERN int Tcl_FSChdir(Tcl_Obj *pathPtr); +/* 459 */ +EXTERN int Tcl_FSConvertToPathType(Tcl_Interp *interp, + Tcl_Obj *pathPtr); +/* 460 */ +EXTERN Tcl_Obj * Tcl_FSJoinPath(Tcl_Obj *listObj, int elements); +/* 461 */ +EXTERN Tcl_Obj * Tcl_FSSplitPath(Tcl_Obj *pathPtr, int *lenPtr); +/* 462 */ +EXTERN int Tcl_FSEqualPaths(Tcl_Obj *firstPtr, + Tcl_Obj *secondPtr); +/* 463 */ +EXTERN Tcl_Obj * Tcl_FSGetNormalizedPath(Tcl_Interp *interp, + Tcl_Obj *pathPtr); +/* 464 */ +EXTERN Tcl_Obj * Tcl_FSJoinToPath(Tcl_Obj *pathPtr, int objc, + Tcl_Obj *const objv[]); +/* 465 */ +EXTERN ClientData Tcl_FSGetInternalRep(Tcl_Obj *pathPtr, + const Tcl_Filesystem *fsPtr); +/* 466 */ +EXTERN Tcl_Obj * Tcl_FSGetTranslatedPath(Tcl_Interp *interp, + Tcl_Obj *pathPtr); +/* 467 */ +EXTERN int Tcl_FSEvalFile(Tcl_Interp *interp, Tcl_Obj *fileName); +/* 468 */ +EXTERN Tcl_Obj * Tcl_FSNewNativePath( + const Tcl_Filesystem *fromFilesystem, + ClientData clientData); +/* 469 */ +EXTERN const void * Tcl_FSGetNativePath(Tcl_Obj *pathPtr); +/* 470 */ +EXTERN Tcl_Obj * Tcl_FSFileSystemInfo(Tcl_Obj *pathPtr); +/* 471 */ +EXTERN Tcl_Obj * Tcl_FSPathSeparator(Tcl_Obj *pathPtr); +/* 472 */ +EXTERN Tcl_Obj * Tcl_FSListVolumes(void); +/* 473 */ +EXTERN int Tcl_FSRegister(ClientData clientData, + const Tcl_Filesystem *fsPtr); +/* 474 */ +EXTERN int Tcl_FSUnregister(const Tcl_Filesystem *fsPtr); +/* 475 */ +EXTERN ClientData Tcl_FSData(const Tcl_Filesystem *fsPtr); +/* 476 */ +EXTERN const char * Tcl_FSGetTranslatedStringPath(Tcl_Interp *interp, + Tcl_Obj *pathPtr); +/* 477 */ +EXTERN CONST86 Tcl_Filesystem * Tcl_FSGetFileSystemForPath(Tcl_Obj *pathPtr); +/* 478 */ +EXTERN Tcl_PathType Tcl_FSGetPathType(Tcl_Obj *pathPtr); +/* 479 */ +EXTERN int Tcl_OutputBuffered(Tcl_Channel chan); +/* 480 */ +EXTERN void Tcl_FSMountsChanged(const Tcl_Filesystem *fsPtr); +/* 481 */ +EXTERN int Tcl_EvalTokensStandard(Tcl_Interp *interp, + Tcl_Token *tokenPtr, int count); +/* 482 */ +EXTERN void Tcl_GetTime(Tcl_Time *timeBuf); +/* 483 */ +EXTERN Tcl_Trace Tcl_CreateObjTrace(Tcl_Interp *interp, int level, + int flags, Tcl_CmdObjTraceProc *objProc, + ClientData clientData, + Tcl_CmdObjTraceDeleteProc *delProc); +/* 484 */ +EXTERN int Tcl_GetCommandInfoFromToken(Tcl_Command token, + Tcl_CmdInfo *infoPtr); +/* 485 */ +EXTERN int Tcl_SetCommandInfoFromToken(Tcl_Command token, + const Tcl_CmdInfo *infoPtr); +/* 486 */ +EXTERN Tcl_Obj * Tcl_DbNewWideIntObj(Tcl_WideInt wideValue, + const char *file, int line); +/* 487 */ +EXTERN int Tcl_GetWideIntFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, Tcl_WideInt *widePtr); +/* 488 */ +EXTERN Tcl_Obj * Tcl_NewWideIntObj(Tcl_WideInt wideValue); +/* 489 */ +EXTERN void Tcl_SetWideIntObj(Tcl_Obj *objPtr, + Tcl_WideInt wideValue); +/* 490 */ +EXTERN Tcl_StatBuf * Tcl_AllocStatBuf(void); +/* 491 */ +EXTERN Tcl_WideInt Tcl_Seek(Tcl_Channel chan, Tcl_WideInt offset, + int mode); +/* 492 */ +EXTERN Tcl_WideInt Tcl_Tell(Tcl_Channel chan); +/* 493 */ +EXTERN Tcl_DriverWideSeekProc * Tcl_ChannelWideSeekProc( + const Tcl_ChannelType *chanTypePtr); +/* 494 */ +EXTERN int Tcl_DictObjPut(Tcl_Interp *interp, Tcl_Obj *dictPtr, + Tcl_Obj *keyPtr, Tcl_Obj *valuePtr); +/* 495 */ +EXTERN int Tcl_DictObjGet(Tcl_Interp *interp, Tcl_Obj *dictPtr, + Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); +/* 496 */ +EXTERN int Tcl_DictObjRemove(Tcl_Interp *interp, + Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); +/* 497 */ +EXTERN int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, + int *sizePtr); +/* 498 */ +EXTERN int Tcl_DictObjFirst(Tcl_Interp *interp, + Tcl_Obj *dictPtr, Tcl_DictSearch *searchPtr, + Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, + int *donePtr); +/* 499 */ +EXTERN void Tcl_DictObjNext(Tcl_DictSearch *searchPtr, + Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, + int *donePtr); +/* 500 */ +EXTERN void Tcl_DictObjDone(Tcl_DictSearch *searchPtr); +/* 501 */ +EXTERN int Tcl_DictObjPutKeyList(Tcl_Interp *interp, + Tcl_Obj *dictPtr, int keyc, + Tcl_Obj *const *keyv, Tcl_Obj *valuePtr); +/* 502 */ +EXTERN int Tcl_DictObjRemoveKeyList(Tcl_Interp *interp, + Tcl_Obj *dictPtr, int keyc, + Tcl_Obj *const *keyv); +/* 503 */ +EXTERN Tcl_Obj * Tcl_NewDictObj(void); +/* 504 */ +EXTERN Tcl_Obj * Tcl_DbNewDictObj(const char *file, int line); +/* 505 */ +EXTERN void Tcl_RegisterConfig(Tcl_Interp *interp, + const char *pkgName, + const Tcl_Config *configuration, + const char *valEncoding); +/* 506 */ +EXTERN Tcl_Namespace * Tcl_CreateNamespace(Tcl_Interp *interp, + const char *name, ClientData clientData, + Tcl_NamespaceDeleteProc *deleteProc); +/* 507 */ +EXTERN void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr); +/* 508 */ +EXTERN int Tcl_AppendExportList(Tcl_Interp *interp, + Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); +/* 509 */ +EXTERN int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr, + const char *pattern, int resetListFirst); +/* 510 */ +EXTERN int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr, + const char *pattern, int allowOverwrite); +/* 511 */ +EXTERN int Tcl_ForgetImport(Tcl_Interp *interp, + Tcl_Namespace *nsPtr, const char *pattern); +/* 512 */ +EXTERN Tcl_Namespace * Tcl_GetCurrentNamespace(Tcl_Interp *interp); +/* 513 */ +EXTERN Tcl_Namespace * Tcl_GetGlobalNamespace(Tcl_Interp *interp); +/* 514 */ +EXTERN Tcl_Namespace * Tcl_FindNamespace(Tcl_Interp *interp, + const char *name, + Tcl_Namespace *contextNsPtr, int flags); +/* 515 */ +EXTERN Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, const char *name, + Tcl_Namespace *contextNsPtr, int flags); +/* 516 */ +EXTERN Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr); +/* 517 */ +EXTERN void Tcl_GetCommandFullName(Tcl_Interp *interp, + Tcl_Command command, Tcl_Obj *objPtr); +/* 518 */ +EXTERN int Tcl_FSEvalFileEx(Tcl_Interp *interp, + Tcl_Obj *fileName, const char *encodingName); +/* 519 */ +EXTERN Tcl_ExitProc * Tcl_SetExitProc(Tcl_ExitProc *proc); +/* 520 */ +EXTERN void Tcl_LimitAddHandler(Tcl_Interp *interp, int type, + Tcl_LimitHandlerProc *handlerProc, + ClientData clientData, + Tcl_LimitHandlerDeleteProc *deleteProc); +/* 521 */ +EXTERN void Tcl_LimitRemoveHandler(Tcl_Interp *interp, int type, + Tcl_LimitHandlerProc *handlerProc, + ClientData clientData); +/* 522 */ +EXTERN int Tcl_LimitReady(Tcl_Interp *interp); +/* 523 */ +EXTERN int Tcl_LimitCheck(Tcl_Interp *interp); +/* 524 */ +EXTERN int Tcl_LimitExceeded(Tcl_Interp *interp); +/* 525 */ +EXTERN void Tcl_LimitSetCommands(Tcl_Interp *interp, + int commandLimit); +/* 526 */ +EXTERN void Tcl_LimitSetTime(Tcl_Interp *interp, + Tcl_Time *timeLimitPtr); +/* 527 */ +EXTERN void Tcl_LimitSetGranularity(Tcl_Interp *interp, int type, + int granularity); +/* 528 */ +EXTERN int Tcl_LimitTypeEnabled(Tcl_Interp *interp, int type); +/* 529 */ +EXTERN int Tcl_LimitTypeExceeded(Tcl_Interp *interp, int type); +/* 530 */ +EXTERN void Tcl_LimitTypeSet(Tcl_Interp *interp, int type); +/* 531 */ +EXTERN void Tcl_LimitTypeReset(Tcl_Interp *interp, int type); +/* 532 */ +EXTERN int Tcl_LimitGetCommands(Tcl_Interp *interp); +/* 533 */ +EXTERN void Tcl_LimitGetTime(Tcl_Interp *interp, + Tcl_Time *timeLimitPtr); +/* 534 */ +EXTERN int Tcl_LimitGetGranularity(Tcl_Interp *interp, int type); +/* 535 */ +EXTERN Tcl_InterpState Tcl_SaveInterpState(Tcl_Interp *interp, int status); +/* 536 */ +EXTERN int Tcl_RestoreInterpState(Tcl_Interp *interp, + Tcl_InterpState state); +/* 537 */ +EXTERN void Tcl_DiscardInterpState(Tcl_InterpState state); +/* 538 */ +EXTERN int Tcl_SetReturnOptions(Tcl_Interp *interp, + Tcl_Obj *options); +/* 539 */ +EXTERN Tcl_Obj * Tcl_GetReturnOptions(Tcl_Interp *interp, int result); +/* 540 */ +EXTERN int Tcl_IsEnsemble(Tcl_Command token); +/* 541 */ +EXTERN Tcl_Command Tcl_CreateEnsemble(Tcl_Interp *interp, + const char *name, + Tcl_Namespace *namespacePtr, int flags); +/* 542 */ +EXTERN Tcl_Command Tcl_FindEnsemble(Tcl_Interp *interp, + Tcl_Obj *cmdNameObj, int flags); +/* 543 */ +EXTERN int Tcl_SetEnsembleSubcommandList(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj *subcmdList); +/* 544 */ +EXTERN int Tcl_SetEnsembleMappingDict(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj *mapDict); +/* 545 */ +EXTERN int Tcl_SetEnsembleUnknownHandler(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj *unknownList); +/* 546 */ +EXTERN int Tcl_SetEnsembleFlags(Tcl_Interp *interp, + Tcl_Command token, int flags); +/* 547 */ +EXTERN int Tcl_GetEnsembleSubcommandList(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj **subcmdListPtr); +/* 548 */ +EXTERN int Tcl_GetEnsembleMappingDict(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj **mapDictPtr); +/* 549 */ +EXTERN int Tcl_GetEnsembleUnknownHandler(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj **unknownListPtr); +/* 550 */ +EXTERN int Tcl_GetEnsembleFlags(Tcl_Interp *interp, + Tcl_Command token, int *flagsPtr); +/* 551 */ +EXTERN int Tcl_GetEnsembleNamespace(Tcl_Interp *interp, + Tcl_Command token, + Tcl_Namespace **namespacePtrPtr); +/* 552 */ +EXTERN void Tcl_SetTimeProc(Tcl_GetTimeProc *getProc, + Tcl_ScaleTimeProc *scaleProc, + ClientData clientData); +/* 553 */ +EXTERN void Tcl_QueryTimeProc(Tcl_GetTimeProc **getProc, + Tcl_ScaleTimeProc **scaleProc, + ClientData *clientData); +/* 554 */ +EXTERN Tcl_DriverThreadActionProc * Tcl_ChannelThreadActionProc( + const Tcl_ChannelType *chanTypePtr); +/* 555 */ +EXTERN Tcl_Obj * Tcl_NewBignumObj(mp_int *value); +/* 556 */ +EXTERN Tcl_Obj * Tcl_DbNewBignumObj(mp_int *value, const char *file, + int line); +/* 557 */ +EXTERN void Tcl_SetBignumObj(Tcl_Obj *obj, mp_int *value); +/* 558 */ +EXTERN int Tcl_GetBignumFromObj(Tcl_Interp *interp, + Tcl_Obj *obj, mp_int *value); +/* 559 */ +EXTERN int Tcl_TakeBignumFromObj(Tcl_Interp *interp, + Tcl_Obj *obj, mp_int *value); +/* 560 */ +EXTERN int Tcl_TruncateChannel(Tcl_Channel chan, + Tcl_WideInt length); +/* 561 */ +EXTERN Tcl_DriverTruncateProc * Tcl_ChannelTruncateProc( + const Tcl_ChannelType *chanTypePtr); +/* 562 */ +EXTERN void Tcl_SetChannelErrorInterp(Tcl_Interp *interp, + Tcl_Obj *msg); +/* 563 */ +EXTERN void Tcl_GetChannelErrorInterp(Tcl_Interp *interp, + Tcl_Obj **msg); +/* 564 */ +EXTERN void Tcl_SetChannelError(Tcl_Channel chan, Tcl_Obj *msg); +/* 565 */ +EXTERN void Tcl_GetChannelError(Tcl_Channel chan, Tcl_Obj **msg); +/* 566 */ +EXTERN int Tcl_InitBignumFromDouble(Tcl_Interp *interp, + double initval, mp_int *toInit); +/* 567 */ +EXTERN Tcl_Obj * Tcl_GetNamespaceUnknownHandler(Tcl_Interp *interp, + Tcl_Namespace *nsPtr); +/* 568 */ +EXTERN int Tcl_SetNamespaceUnknownHandler(Tcl_Interp *interp, + Tcl_Namespace *nsPtr, Tcl_Obj *handlerPtr); +/* 569 */ +EXTERN int Tcl_GetEncodingFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, Tcl_Encoding *encodingPtr); +/* 570 */ +EXTERN Tcl_Obj * Tcl_GetEncodingSearchPath(void); +/* 571 */ +EXTERN int Tcl_SetEncodingSearchPath(Tcl_Obj *searchPath); +/* 572 */ +EXTERN const char * Tcl_GetEncodingNameFromEnvironment( + Tcl_DString *bufPtr); +/* 573 */ +EXTERN int Tcl_PkgRequireProc(Tcl_Interp *interp, + const char *name, int objc, + Tcl_Obj *const objv[], void *clientDataPtr); +/* 574 */ +EXTERN void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp, + Tcl_Obj *objPtr); +/* 575 */ +EXTERN void Tcl_AppendLimitedToObj(Tcl_Obj *objPtr, + const char *bytes, int length, int limit, + const char *ellipsis); +/* 576 */ +EXTERN Tcl_Obj * Tcl_Format(Tcl_Interp *interp, const char *format, + int objc, Tcl_Obj *const objv[]); +/* 577 */ +EXTERN int Tcl_AppendFormatToObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, const char *format, + int objc, Tcl_Obj *const objv[]); +/* 578 */ +EXTERN Tcl_Obj * Tcl_ObjPrintf(const char *format, ...) TCL_FORMAT_PRINTF(1, 2); +/* 579 */ +EXTERN void Tcl_AppendPrintfToObj(Tcl_Obj *objPtr, + const char *format, ...) TCL_FORMAT_PRINTF(2, 3); +/* 580 */ +EXTERN int Tcl_CancelEval(Tcl_Interp *interp, + Tcl_Obj *resultObjPtr, ClientData clientData, + int flags); +/* 581 */ +EXTERN int Tcl_Canceled(Tcl_Interp *interp, int flags); +/* 582 */ +EXTERN int Tcl_CreatePipe(Tcl_Interp *interp, + Tcl_Channel *rchan, Tcl_Channel *wchan, + int flags); +/* 583 */ +EXTERN Tcl_Command Tcl_NRCreateCommand(Tcl_Interp *interp, + const char *cmdName, Tcl_ObjCmdProc *proc, + Tcl_ObjCmdProc *nreProc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc); +/* 584 */ +EXTERN int Tcl_NREvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + int flags); +/* 585 */ +EXTERN int Tcl_NREvalObjv(Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[], int flags); +/* 586 */ +EXTERN int Tcl_NRCmdSwap(Tcl_Interp *interp, Tcl_Command cmd, + int objc, Tcl_Obj *const objv[], int flags); +/* 587 */ +EXTERN void Tcl_NRAddCallback(Tcl_Interp *interp, + Tcl_NRPostProc *postProcPtr, + ClientData data0, ClientData data1, + ClientData data2, ClientData data3); +/* 588 */ +EXTERN int Tcl_NRCallObjProc(Tcl_Interp *interp, + Tcl_ObjCmdProc *objProc, + ClientData clientData, int objc, + Tcl_Obj *const objv[]); +/* 589 */ +EXTERN unsigned Tcl_GetFSDeviceFromStat(const Tcl_StatBuf *statPtr); +/* 590 */ +EXTERN unsigned Tcl_GetFSInodeFromStat(const Tcl_StatBuf *statPtr); +/* 591 */ +EXTERN unsigned Tcl_GetModeFromStat(const Tcl_StatBuf *statPtr); +/* 592 */ +EXTERN int Tcl_GetLinkCountFromStat(const Tcl_StatBuf *statPtr); +/* 593 */ +EXTERN int Tcl_GetUserIdFromStat(const Tcl_StatBuf *statPtr); +/* 594 */ +EXTERN int Tcl_GetGroupIdFromStat(const Tcl_StatBuf *statPtr); +/* 595 */ +EXTERN int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf *statPtr); +/* 596 */ +EXTERN Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr); +/* 597 */ +EXTERN Tcl_WideInt Tcl_GetModificationTimeFromStat( + const Tcl_StatBuf *statPtr); +/* 598 */ +EXTERN Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr); +/* 599 */ +EXTERN Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr); +/* 600 */ +EXTERN Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr); +/* 601 */ +EXTERN unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf *statPtr); +/* 602 */ +EXTERN int Tcl_SetEnsembleParameterList(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj *paramList); +/* 603 */ +EXTERN int Tcl_GetEnsembleParameterList(Tcl_Interp *interp, + Tcl_Command token, Tcl_Obj **paramListPtr); +/* 604 */ +EXTERN int Tcl_ParseArgsObjv(Tcl_Interp *interp, + const Tcl_ArgvInfo *argTable, int *objcPtr, + Tcl_Obj *const *objv, Tcl_Obj ***remObjv); +/* 605 */ +EXTERN int Tcl_GetErrorLine(Tcl_Interp *interp); +/* 606 */ +EXTERN void Tcl_SetErrorLine(Tcl_Interp *interp, int lineNum); +/* 607 */ +EXTERN void Tcl_TransferResult(Tcl_Interp *sourceInterp, + int result, Tcl_Interp *targetInterp); +/* 608 */ +EXTERN int Tcl_InterpActive(Tcl_Interp *interp); +/* 609 */ +EXTERN void Tcl_BackgroundException(Tcl_Interp *interp, int code); +/* 610 */ +EXTERN int Tcl_ZlibDeflate(Tcl_Interp *interp, int format, + Tcl_Obj *data, int level, + Tcl_Obj *gzipHeaderDictObj); +/* 611 */ +EXTERN int Tcl_ZlibInflate(Tcl_Interp *interp, int format, + Tcl_Obj *data, int buffersize, + Tcl_Obj *gzipHeaderDictObj); +/* 612 */ +EXTERN unsigned int Tcl_ZlibCRC32(unsigned int crc, + const unsigned char *buf, int len); +/* 613 */ +EXTERN unsigned int Tcl_ZlibAdler32(unsigned int adler, + const unsigned char *buf, int len); +/* 614 */ +EXTERN int Tcl_ZlibStreamInit(Tcl_Interp *interp, int mode, + int format, int level, Tcl_Obj *dictObj, + Tcl_ZlibStream *zshandle); +/* 615 */ +EXTERN Tcl_Obj * Tcl_ZlibStreamGetCommandName(Tcl_ZlibStream zshandle); +/* 616 */ +EXTERN int Tcl_ZlibStreamEof(Tcl_ZlibStream zshandle); +/* 617 */ +EXTERN int Tcl_ZlibStreamChecksum(Tcl_ZlibStream zshandle); +/* 618 */ +EXTERN int Tcl_ZlibStreamPut(Tcl_ZlibStream zshandle, + Tcl_Obj *data, int flush); +/* 619 */ +EXTERN int Tcl_ZlibStreamGet(Tcl_ZlibStream zshandle, + Tcl_Obj *data, int count); +/* 620 */ +EXTERN int Tcl_ZlibStreamClose(Tcl_ZlibStream zshandle); +/* 621 */ +EXTERN int Tcl_ZlibStreamReset(Tcl_ZlibStream zshandle); +/* 622 */ +EXTERN void Tcl_SetStartupScript(Tcl_Obj *path, + const char *encoding); +/* 623 */ +EXTERN Tcl_Obj * Tcl_GetStartupScript(const char **encodingPtr); +/* 624 */ +EXTERN int Tcl_CloseEx(Tcl_Interp *interp, Tcl_Channel chan, + int flags); +/* 625 */ +EXTERN int Tcl_NRExprObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + Tcl_Obj *resultPtr); +/* 626 */ +EXTERN int Tcl_NRSubstObj(Tcl_Interp *interp, Tcl_Obj *objPtr, + int flags); +/* 627 */ +EXTERN int Tcl_LoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, + const char *const symv[], int flags, + void *procPtrs, Tcl_LoadHandle *handlePtr); +/* 628 */ +EXTERN void * Tcl_FindSymbol(Tcl_Interp *interp, + Tcl_LoadHandle handle, const char *symbol); +/* 629 */ +EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp, + Tcl_LoadHandle handlePtr); +/* 630 */ +EXTERN void Tcl_ZlibStreamSetCompressionDictionary( + Tcl_ZlibStream zhandle, + Tcl_Obj *compressionDictionaryObj); + +typedef struct { + const struct TclPlatStubs *tclPlatStubs; + const struct TclIntStubs *tclIntStubs; + const struct TclIntPlatStubs *tclIntPlatStubs; +} TclStubHooks; + +typedef struct TclStubs { + int magic; + const TclStubHooks *hooks; + + int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */ + CONST84_RETURN char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */ + void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */ + char * (*tcl_Alloc) (unsigned int size); /* 3 */ + void (*tcl_Free) (char *ptr); /* 4 */ + char * (*tcl_Realloc) (char *ptr, unsigned int size); /* 5 */ + char * (*tcl_DbCkalloc) (unsigned int size, const char *file, int line); /* 6 */ + void (*tcl_DbCkfree) (char *ptr, const char *file, int line); /* 7 */ + char * (*tcl_DbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 8 */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ + void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */ +#endif /* UNIX */ +#if defined(__WIN32__) /* WIN */ + void (*reserved9)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + void (*tcl_CreateFileHandler) (int fd, int mask, Tcl_FileProc *proc, ClientData clientData); /* 9 */ +#endif /* MACOSX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ + void (*tcl_DeleteFileHandler) (int fd); /* 10 */ +#endif /* UNIX */ +#if defined(__WIN32__) /* WIN */ + void (*reserved10)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + void (*tcl_DeleteFileHandler) (int fd); /* 10 */ +#endif /* MACOSX */ + void (*tcl_SetTimer) (const Tcl_Time *timePtr); /* 11 */ + void (*tcl_Sleep) (int ms); /* 12 */ + int (*tcl_WaitForEvent) (const Tcl_Time *timePtr); /* 13 */ + int (*tcl_AppendAllObjTypes) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 14 */ + void (*tcl_AppendStringsToObj) (Tcl_Obj *objPtr, ...); /* 15 */ + void (*tcl_AppendToObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 16 */ + Tcl_Obj * (*tcl_ConcatObj) (int objc, Tcl_Obj *const objv[]); /* 17 */ + int (*tcl_ConvertToType) (Tcl_Interp *interp, Tcl_Obj *objPtr, const Tcl_ObjType *typePtr); /* 18 */ + void (*tcl_DbDecrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 19 */ + void (*tcl_DbIncrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 20 */ + int (*tcl_DbIsShared) (Tcl_Obj *objPtr, const char *file, int line); /* 21 */ + Tcl_Obj * (*tcl_DbNewBooleanObj) (int boolValue, const char *file, int line); /* 22 */ + Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int length, const char *file, int line); /* 23 */ + Tcl_Obj * (*tcl_DbNewDoubleObj) (double doubleValue, const char *file, int line); /* 24 */ + Tcl_Obj * (*tcl_DbNewListObj) (int objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */ + Tcl_Obj * (*tcl_DbNewLongObj) (long longValue, const char *file, int line); /* 26 */ + Tcl_Obj * (*tcl_DbNewObj) (const char *file, int line); /* 27 */ + Tcl_Obj * (*tcl_DbNewStringObj) (const char *bytes, int length, const char *file, int line); /* 28 */ + Tcl_Obj * (*tcl_DuplicateObj) (Tcl_Obj *objPtr); /* 29 */ + void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */ + int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *boolPtr); /* 31 */ + int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 32 */ + unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */ + int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */ + int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */ + int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, CONST84 char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */ + int (*tcl_GetInt) (Tcl_Interp *interp, const char *src, int *intPtr); /* 37 */ + int (*tcl_GetIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 38 */ + int (*tcl_GetLongFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr); /* 39 */ + CONST86 Tcl_ObjType * (*tcl_GetObjType) (const char *typeName); /* 40 */ + char * (*tcl_GetStringFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 41 */ + void (*tcl_InvalidateStringRep) (Tcl_Obj *objPtr); /* 42 */ + int (*tcl_ListObjAppendList) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *elemListPtr); /* 43 */ + int (*tcl_ListObjAppendElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *objPtr); /* 44 */ + int (*tcl_ListObjGetElements) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *objcPtr, Tcl_Obj ***objvPtr); /* 45 */ + int (*tcl_ListObjIndex) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj **objPtrPtr); /* 46 */ + int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */ + int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, int first, int count, int objc, Tcl_Obj *const objv[]); /* 48 */ + Tcl_Obj * (*tcl_NewBooleanObj) (int boolValue); /* 49 */ + Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int length); /* 50 */ + Tcl_Obj * (*tcl_NewDoubleObj) (double doubleValue); /* 51 */ + Tcl_Obj * (*tcl_NewIntObj) (int intValue); /* 52 */ + Tcl_Obj * (*tcl_NewListObj) (int objc, Tcl_Obj *const objv[]); /* 53 */ + Tcl_Obj * (*tcl_NewLongObj) (long longValue); /* 54 */ + Tcl_Obj * (*tcl_NewObj) (void); /* 55 */ + Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, int length); /* 56 */ + void (*tcl_SetBooleanObj) (Tcl_Obj *objPtr, int boolValue); /* 57 */ + unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int length); /* 58 */ + void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int length); /* 59 */ + void (*tcl_SetDoubleObj) (Tcl_Obj *objPtr, double doubleValue); /* 60 */ + void (*tcl_SetIntObj) (Tcl_Obj *objPtr, int intValue); /* 61 */ + void (*tcl_SetListObj) (Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]); /* 62 */ + void (*tcl_SetLongObj) (Tcl_Obj *objPtr, long longValue); /* 63 */ + void (*tcl_SetObjLength) (Tcl_Obj *objPtr, int length); /* 64 */ + void (*tcl_SetStringObj) (Tcl_Obj *objPtr, const char *bytes, int length); /* 65 */ + void (*tcl_AddErrorInfo) (Tcl_Interp *interp, const char *message); /* 66 */ + void (*tcl_AddObjErrorInfo) (Tcl_Interp *interp, const char *message, int length); /* 67 */ + void (*tcl_AllowExceptions) (Tcl_Interp *interp); /* 68 */ + void (*tcl_AppendElement) (Tcl_Interp *interp, const char *element); /* 69 */ + void (*tcl_AppendResult) (Tcl_Interp *interp, ...); /* 70 */ + Tcl_AsyncHandler (*tcl_AsyncCreate) (Tcl_AsyncProc *proc, ClientData clientData); /* 71 */ + void (*tcl_AsyncDelete) (Tcl_AsyncHandler async); /* 72 */ + int (*tcl_AsyncInvoke) (Tcl_Interp *interp, int code); /* 73 */ + void (*tcl_AsyncMark) (Tcl_AsyncHandler async); /* 74 */ + int (*tcl_AsyncReady) (void); /* 75 */ + void (*tcl_BackgroundError) (Tcl_Interp *interp); /* 76 */ + char (*tcl_Backslash) (const char *src, int *readPtr); /* 77 */ + int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */ + void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 79 */ + void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, ClientData clientData); /* 80 */ + int (*tcl_Close) (Tcl_Interp *interp, Tcl_Channel chan); /* 81 */ + int (*tcl_CommandComplete) (const char *cmd); /* 82 */ + char * (*tcl_Concat) (int argc, CONST84 char *const *argv); /* 83 */ + int (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */ + int (*tcl_ConvertCountedElement) (const char *src, int length, char *dst, int flags); /* 85 */ + int (*tcl_CreateAlias) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, CONST84 char *const *argv); /* 86 */ + int (*tcl_CreateAliasObj) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int objc, Tcl_Obj *const objv[]); /* 87 */ + Tcl_Channel (*tcl_CreateChannel) (const Tcl_ChannelType *typePtr, const char *chanName, ClientData instanceData, int mask); /* 88 */ + void (*tcl_CreateChannelHandler) (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, ClientData clientData); /* 89 */ + void (*tcl_CreateCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData); /* 90 */ + Tcl_Command (*tcl_CreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 91 */ + void (*tcl_CreateEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, ClientData clientData); /* 92 */ + void (*tcl_CreateExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 93 */ + Tcl_Interp * (*tcl_CreateInterp) (void); /* 94 */ + void (*tcl_CreateMathFunc) (Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData); /* 95 */ + Tcl_Command (*tcl_CreateObjCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 96 */ + Tcl_Interp * (*tcl_CreateSlave) (Tcl_Interp *interp, const char *slaveName, int isSafe); /* 97 */ + Tcl_TimerToken (*tcl_CreateTimerHandler) (int milliseconds, Tcl_TimerProc *proc, ClientData clientData); /* 98 */ + Tcl_Trace (*tcl_CreateTrace) (Tcl_Interp *interp, int level, Tcl_CmdTraceProc *proc, ClientData clientData); /* 99 */ + void (*tcl_DeleteAssocData) (Tcl_Interp *interp, const char *name); /* 100 */ + void (*tcl_DeleteChannelHandler) (Tcl_Channel chan, Tcl_ChannelProc *proc, ClientData clientData); /* 101 */ + void (*tcl_DeleteCloseHandler) (Tcl_Channel chan, Tcl_CloseProc *proc, ClientData clientData); /* 102 */ + int (*tcl_DeleteCommand) (Tcl_Interp *interp, const char *cmdName); /* 103 */ + int (*tcl_DeleteCommandFromToken) (Tcl_Interp *interp, Tcl_Command command); /* 104 */ + void (*tcl_DeleteEvents) (Tcl_EventDeleteProc *proc, ClientData clientData); /* 105 */ + void (*tcl_DeleteEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, ClientData clientData); /* 106 */ + void (*tcl_DeleteExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 107 */ + void (*tcl_DeleteHashEntry) (Tcl_HashEntry *entryPtr); /* 108 */ + void (*tcl_DeleteHashTable) (Tcl_HashTable *tablePtr); /* 109 */ + void (*tcl_DeleteInterp) (Tcl_Interp *interp); /* 110 */ + void (*tcl_DetachPids) (int numPids, Tcl_Pid *pidPtr); /* 111 */ + void (*tcl_DeleteTimerHandler) (Tcl_TimerToken token); /* 112 */ + void (*tcl_DeleteTrace) (Tcl_Interp *interp, Tcl_Trace trace); /* 113 */ + void (*tcl_DontCallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 114 */ + int (*tcl_DoOneEvent) (int flags); /* 115 */ + void (*tcl_DoWhenIdle) (Tcl_IdleProc *proc, ClientData clientData); /* 116 */ + char * (*tcl_DStringAppend) (Tcl_DString *dsPtr, const char *bytes, int length); /* 117 */ + char * (*tcl_DStringAppendElement) (Tcl_DString *dsPtr, const char *element); /* 118 */ + void (*tcl_DStringEndSublist) (Tcl_DString *dsPtr); /* 119 */ + void (*tcl_DStringFree) (Tcl_DString *dsPtr); /* 120 */ + void (*tcl_DStringGetResult) (Tcl_Interp *interp, Tcl_DString *dsPtr); /* 121 */ + void (*tcl_DStringInit) (Tcl_DString *dsPtr); /* 122 */ + void (*tcl_DStringResult) (Tcl_Interp *interp, Tcl_DString *dsPtr); /* 123 */ + void (*tcl_DStringSetLength) (Tcl_DString *dsPtr, int length); /* 124 */ + void (*tcl_DStringStartSublist) (Tcl_DString *dsPtr); /* 125 */ + int (*tcl_Eof) (Tcl_Channel chan); /* 126 */ + CONST84_RETURN char * (*tcl_ErrnoId) (void); /* 127 */ + CONST84_RETURN char * (*tcl_ErrnoMsg) (int err); /* 128 */ + int (*tcl_Eval) (Tcl_Interp *interp, const char *script); /* 129 */ + int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */ + int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */ + void (*tcl_EventuallyFree) (ClientData clientData, Tcl_FreeProc *freeProc); /* 132 */ + void (*tcl_Exit) (int status); /* 133 */ + int (*tcl_ExposeCommand) (Tcl_Interp *interp, const char *hiddenCmdToken, const char *cmdName); /* 134 */ + int (*tcl_ExprBoolean) (Tcl_Interp *interp, const char *expr, int *ptr); /* 135 */ + int (*tcl_ExprBooleanObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *ptr); /* 136 */ + int (*tcl_ExprDouble) (Tcl_Interp *interp, const char *expr, double *ptr); /* 137 */ + int (*tcl_ExprDoubleObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *ptr); /* 138 */ + int (*tcl_ExprLong) (Tcl_Interp *interp, const char *expr, long *ptr); /* 139 */ + int (*tcl_ExprLongObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *ptr); /* 140 */ + int (*tcl_ExprObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj **resultPtrPtr); /* 141 */ + int (*tcl_ExprString) (Tcl_Interp *interp, const char *expr); /* 142 */ + void (*tcl_Finalize) (void); /* 143 */ + void (*tcl_FindExecutable) (const char *argv0); /* 144 */ + Tcl_HashEntry * (*tcl_FirstHashEntry) (Tcl_HashTable *tablePtr, Tcl_HashSearch *searchPtr); /* 145 */ + int (*tcl_Flush) (Tcl_Channel chan); /* 146 */ + void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */ + int (*tcl_GetAlias) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr, int *argcPtr, CONST84 char ***argvPtr); /* 148 */ + int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */ + ClientData (*tcl_GetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc **procPtr); /* 150 */ + Tcl_Channel (*tcl_GetChannel) (Tcl_Interp *interp, const char *chanName, int *modePtr); /* 151 */ + int (*tcl_GetChannelBufferSize) (Tcl_Channel chan); /* 152 */ + int (*tcl_GetChannelHandle) (Tcl_Channel chan, int direction, ClientData *handlePtr); /* 153 */ + ClientData (*tcl_GetChannelInstanceData) (Tcl_Channel chan); /* 154 */ + int (*tcl_GetChannelMode) (Tcl_Channel chan); /* 155 */ + CONST84_RETURN char * (*tcl_GetChannelName) (Tcl_Channel chan); /* 156 */ + int (*tcl_GetChannelOption) (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, Tcl_DString *dsPtr); /* 157 */ + CONST86 Tcl_ChannelType * (*tcl_GetChannelType) (Tcl_Channel chan); /* 158 */ + int (*tcl_GetCommandInfo) (Tcl_Interp *interp, const char *cmdName, Tcl_CmdInfo *infoPtr); /* 159 */ + CONST84_RETURN char * (*tcl_GetCommandName) (Tcl_Interp *interp, Tcl_Command command); /* 160 */ + int (*tcl_GetErrno) (void); /* 161 */ + CONST84_RETURN char * (*tcl_GetHostName) (void); /* 162 */ + int (*tcl_GetInterpPath) (Tcl_Interp *askInterp, Tcl_Interp *slaveInterp); /* 163 */ + Tcl_Interp * (*tcl_GetMaster) (Tcl_Interp *interp); /* 164 */ + const char * (*tcl_GetNameOfExecutable) (void); /* 165 */ + Tcl_Obj * (*tcl_GetObjResult) (Tcl_Interp *interp); /* 166 */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ + int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */ +#endif /* UNIX */ +#if defined(__WIN32__) /* WIN */ + void (*reserved167)(void); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + int (*tcl_GetOpenFile) (Tcl_Interp *interp, const char *chanID, int forWriting, int checkUsage, ClientData *filePtr); /* 167 */ +#endif /* MACOSX */ + Tcl_PathType (*tcl_GetPathType) (const char *path); /* 168 */ + int (*tcl_Gets) (Tcl_Channel chan, Tcl_DString *dsPtr); /* 169 */ + int (*tcl_GetsObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 170 */ + int (*tcl_GetServiceMode) (void); /* 171 */ + Tcl_Interp * (*tcl_GetSlave) (Tcl_Interp *interp, const char *slaveName); /* 172 */ + Tcl_Channel (*tcl_GetStdChannel) (int type); /* 173 */ + CONST84_RETURN char * (*tcl_GetStringResult) (Tcl_Interp *interp); /* 174 */ + CONST84_RETURN char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */ + CONST84_RETURN char * (*tcl_GetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 176 */ + int (*tcl_GlobalEval) (Tcl_Interp *interp, const char *command); /* 177 */ + int (*tcl_GlobalEvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 178 */ + int (*tcl_HideCommand) (Tcl_Interp *interp, const char *cmdName, const char *hiddenCmdToken); /* 179 */ + int (*tcl_Init) (Tcl_Interp *interp); /* 180 */ + void (*tcl_InitHashTable) (Tcl_HashTable *tablePtr, int keyType); /* 181 */ + int (*tcl_InputBlocked) (Tcl_Channel chan); /* 182 */ + int (*tcl_InputBuffered) (Tcl_Channel chan); /* 183 */ + int (*tcl_InterpDeleted) (Tcl_Interp *interp); /* 184 */ + int (*tcl_IsSafe) (Tcl_Interp *interp); /* 185 */ + char * (*tcl_JoinPath) (int argc, CONST84 char *const *argv, Tcl_DString *resultPtr); /* 186 */ + int (*tcl_LinkVar) (Tcl_Interp *interp, const char *varName, char *addr, int type); /* 187 */ + void (*reserved188)(void); + Tcl_Channel (*tcl_MakeFileChannel) (ClientData handle, int mode); /* 189 */ + int (*tcl_MakeSafe) (Tcl_Interp *interp); /* 190 */ + Tcl_Channel (*tcl_MakeTcpClientChannel) (ClientData tcpSocket); /* 191 */ + char * (*tcl_Merge) (int argc, CONST84 char *const *argv); /* 192 */ + Tcl_HashEntry * (*tcl_NextHashEntry) (Tcl_HashSearch *searchPtr); /* 193 */ + void (*tcl_NotifyChannel) (Tcl_Channel channel, int mask); /* 194 */ + Tcl_Obj * (*tcl_ObjGetVar2) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags); /* 195 */ + Tcl_Obj * (*tcl_ObjSetVar2) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags); /* 196 */ + Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp *interp, int argc, CONST84 char **argv, int flags); /* 197 */ + Tcl_Channel (*tcl_OpenFileChannel) (Tcl_Interp *interp, const char *fileName, const char *modeString, int permissions); /* 198 */ + Tcl_Channel (*tcl_OpenTcpClient) (Tcl_Interp *interp, int port, const char *address, const char *myaddr, int myport, int async); /* 199 */ + Tcl_Channel (*tcl_OpenTcpServer) (Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 200 */ + void (*tcl_Preserve) (ClientData data); /* 201 */ + void (*tcl_PrintDouble) (Tcl_Interp *interp, double value, char *dst); /* 202 */ + int (*tcl_PutEnv) (const char *assignment); /* 203 */ + CONST84_RETURN char * (*tcl_PosixError) (Tcl_Interp *interp); /* 204 */ + void (*tcl_QueueEvent) (Tcl_Event *evPtr, Tcl_QueuePosition position); /* 205 */ + int (*tcl_Read) (Tcl_Channel chan, char *bufPtr, int toRead); /* 206 */ + void (*tcl_ReapDetachedProcs) (void); /* 207 */ + int (*tcl_RecordAndEval) (Tcl_Interp *interp, const char *cmd, int flags); /* 208 */ + int (*tcl_RecordAndEvalObj) (Tcl_Interp *interp, Tcl_Obj *cmdPtr, int flags); /* 209 */ + void (*tcl_RegisterChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 210 */ + void (*tcl_RegisterObjType) (const Tcl_ObjType *typePtr); /* 211 */ + Tcl_RegExp (*tcl_RegExpCompile) (Tcl_Interp *interp, const char *pattern); /* 212 */ + int (*tcl_RegExpExec) (Tcl_Interp *interp, Tcl_RegExp regexp, const char *text, const char *start); /* 213 */ + int (*tcl_RegExpMatch) (Tcl_Interp *interp, const char *text, const char *pattern); /* 214 */ + void (*tcl_RegExpRange) (Tcl_RegExp regexp, int index, CONST84 char **startPtr, CONST84 char **endPtr); /* 215 */ + void (*tcl_Release) (ClientData clientData); /* 216 */ + void (*tcl_ResetResult) (Tcl_Interp *interp); /* 217 */ + int (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */ + int (*tcl_ScanCountedElement) (const char *src, int length, int *flagPtr); /* 219 */ + int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */ + int (*tcl_ServiceAll) (void); /* 221 */ + int (*tcl_ServiceEvent) (int flags); /* 222 */ + void (*tcl_SetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 223 */ + void (*tcl_SetChannelBufferSize) (Tcl_Channel chan, int sz); /* 224 */ + int (*tcl_SetChannelOption) (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, const char *newValue); /* 225 */ + int (*tcl_SetCommandInfo) (Tcl_Interp *interp, const char *cmdName, const Tcl_CmdInfo *infoPtr); /* 226 */ + void (*tcl_SetErrno) (int err); /* 227 */ + void (*tcl_SetErrorCode) (Tcl_Interp *interp, ...); /* 228 */ + void (*tcl_SetMaxBlockTime) (const Tcl_Time *timePtr); /* 229 */ + void (*tcl_SetPanicProc) (Tcl_PanicProc *panicProc); /* 230 */ + int (*tcl_SetRecursionLimit) (Tcl_Interp *interp, int depth); /* 231 */ + void (*tcl_SetResult) (Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc); /* 232 */ + int (*tcl_SetServiceMode) (int mode); /* 233 */ + void (*tcl_SetObjErrorCode) (Tcl_Interp *interp, Tcl_Obj *errorObjPtr); /* 234 */ + void (*tcl_SetObjResult) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr); /* 235 */ + void (*tcl_SetStdChannel) (Tcl_Channel channel, int type); /* 236 */ + CONST84_RETURN char * (*tcl_SetVar) (Tcl_Interp *interp, const char *varName, const char *newValue, int flags); /* 237 */ + CONST84_RETURN char * (*tcl_SetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags); /* 238 */ + CONST84_RETURN char * (*tcl_SignalId) (int sig); /* 239 */ + CONST84_RETURN char * (*tcl_SignalMsg) (int sig); /* 240 */ + void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */ + int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, CONST84 char ***argvPtr); /* 242 */ + void (*tcl_SplitPath) (const char *path, int *argcPtr, CONST84 char ***argvPtr); /* 243 */ + void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */ + int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */ + int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */ + int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */ + int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 248 */ + char * (*tcl_TranslateFileName) (Tcl_Interp *interp, const char *name, Tcl_DString *bufferPtr); /* 249 */ + int (*tcl_Ungets) (Tcl_Channel chan, const char *str, int len, int atHead); /* 250 */ + void (*tcl_UnlinkVar) (Tcl_Interp *interp, const char *varName); /* 251 */ + int (*tcl_UnregisterChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 252 */ + int (*tcl_UnsetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 253 */ + int (*tcl_UnsetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 254 */ + void (*tcl_UntraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 255 */ + void (*tcl_UntraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 256 */ + void (*tcl_UpdateLinkedVar) (Tcl_Interp *interp, const char *varName); /* 257 */ + int (*tcl_UpVar) (Tcl_Interp *interp, const char *frameName, const char *varName, const char *localName, int flags); /* 258 */ + int (*tcl_UpVar2) (Tcl_Interp *interp, const char *frameName, const char *part1, const char *part2, const char *localName, int flags); /* 259 */ + int (*tcl_VarEval) (Tcl_Interp *interp, ...); /* 260 */ + ClientData (*tcl_VarTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 261 */ + ClientData (*tcl_VarTraceInfo2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *procPtr, ClientData prevClientData); /* 262 */ + int (*tcl_Write) (Tcl_Channel chan, const char *s, int slen); /* 263 */ + void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */ + int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */ + void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */ + void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */ + void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */ + char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */ + CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, CONST84 char **termPtr); /* 270 */ + CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */ + CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */ + int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */ + CONST84_RETURN char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */ + void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ + int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ + Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */ + void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */ + void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */ + void (*tcl_InitMemory) (Tcl_Interp *interp); /* 280 */ + Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan); /* 281 */ + int (*tcl_UnstackChannel) (Tcl_Interp *interp, Tcl_Channel chan); /* 282 */ + Tcl_Channel (*tcl_GetStackedChannel) (Tcl_Channel chan); /* 283 */ + void (*tcl_SetMainLoop) (Tcl_MainLoopProc *proc); /* 284 */ + void (*reserved285)(void); + void (*tcl_AppendObjToObj) (Tcl_Obj *objPtr, Tcl_Obj *appendObjPtr); /* 286 */ + Tcl_Encoding (*tcl_CreateEncoding) (const Tcl_EncodingType *typePtr); /* 287 */ + void (*tcl_CreateThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 288 */ + void (*tcl_DeleteThreadExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 289 */ + void (*tcl_DiscardResult) (Tcl_SavedResult *statePtr); /* 290 */ + int (*tcl_EvalEx) (Tcl_Interp *interp, const char *script, int numBytes, int flags); /* 291 */ + int (*tcl_EvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 292 */ + int (*tcl_EvalObjEx) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 293 */ + void (*tcl_ExitThread) (int status); /* 294 */ + int (*tcl_ExternalToUtf) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 295 */ + char * (*tcl_ExternalToUtfDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 296 */ + void (*tcl_FinalizeThread) (void); /* 297 */ + void (*tcl_FinalizeNotifier) (ClientData clientData); /* 298 */ + void (*tcl_FreeEncoding) (Tcl_Encoding encoding); /* 299 */ + Tcl_ThreadId (*tcl_GetCurrentThread) (void); /* 300 */ + Tcl_Encoding (*tcl_GetEncoding) (Tcl_Interp *interp, const char *name); /* 301 */ + CONST84_RETURN char * (*tcl_GetEncodingName) (Tcl_Encoding encoding); /* 302 */ + void (*tcl_GetEncodingNames) (Tcl_Interp *interp); /* 303 */ + int (*tcl_GetIndexFromObjStruct) (Tcl_Interp *interp, Tcl_Obj *objPtr, const void *tablePtr, int offset, const char *msg, int flags, int *indexPtr); /* 304 */ + void * (*tcl_GetThreadData) (Tcl_ThreadDataKey *keyPtr, int size); /* 305 */ + Tcl_Obj * (*tcl_GetVar2Ex) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 306 */ + ClientData (*tcl_InitNotifier) (void); /* 307 */ + void (*tcl_MutexLock) (Tcl_Mutex *mutexPtr); /* 308 */ + void (*tcl_MutexUnlock) (Tcl_Mutex *mutexPtr); /* 309 */ + void (*tcl_ConditionNotify) (Tcl_Condition *condPtr); /* 310 */ + void (*tcl_ConditionWait) (Tcl_Condition *condPtr, Tcl_Mutex *mutexPtr, const Tcl_Time *timePtr); /* 311 */ + int (*tcl_NumUtfChars) (const char *src, int length); /* 312 */ + int (*tcl_ReadChars) (Tcl_Channel channel, Tcl_Obj *objPtr, int charsToRead, int appendFlag); /* 313 */ + void (*tcl_RestoreResult) (Tcl_Interp *interp, Tcl_SavedResult *statePtr); /* 314 */ + void (*tcl_SaveResult) (Tcl_Interp *interp, Tcl_SavedResult *statePtr); /* 315 */ + int (*tcl_SetSystemEncoding) (Tcl_Interp *interp, const char *name); /* 316 */ + Tcl_Obj * (*tcl_SetVar2Ex) (Tcl_Interp *interp, const char *part1, const char *part2, Tcl_Obj *newValuePtr, int flags); /* 317 */ + void (*tcl_ThreadAlert) (Tcl_ThreadId threadId); /* 318 */ + void (*tcl_ThreadQueueEvent) (Tcl_ThreadId threadId, Tcl_Event *evPtr, Tcl_QueuePosition position); /* 319 */ + Tcl_UniChar (*tcl_UniCharAtIndex) (const char *src, int index); /* 320 */ + Tcl_UniChar (*tcl_UniCharToLower) (int ch); /* 321 */ + Tcl_UniChar (*tcl_UniCharToTitle) (int ch); /* 322 */ + Tcl_UniChar (*tcl_UniCharToUpper) (int ch); /* 323 */ + int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */ + CONST84_RETURN char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */ + int (*tcl_UtfCharComplete) (const char *src, int length); /* 326 */ + int (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */ + CONST84_RETURN char * (*tcl_UtfFindFirst) (const char *src, int ch); /* 328 */ + CONST84_RETURN char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */ + CONST84_RETURN char * (*tcl_UtfNext) (const char *src); /* 330 */ + CONST84_RETURN char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */ + int (*tcl_UtfToExternal) (Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, int srcLen, int flags, Tcl_EncodingState *statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* 332 */ + char * (*tcl_UtfToExternalDString) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 333 */ + int (*tcl_UtfToLower) (char *src); /* 334 */ + int (*tcl_UtfToTitle) (char *src); /* 335 */ + int (*tcl_UtfToUniChar) (const char *src, Tcl_UniChar *chPtr); /* 336 */ + int (*tcl_UtfToUpper) (char *src); /* 337 */ + int (*tcl_WriteChars) (Tcl_Channel chan, const char *src, int srcLen); /* 338 */ + int (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */ + char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */ + CONST84_RETURN char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */ + void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */ + void (*tcl_AlertNotifier) (ClientData clientData); /* 343 */ + void (*tcl_ServiceModeHook) (int mode); /* 344 */ + int (*tcl_UniCharIsAlnum) (int ch); /* 345 */ + int (*tcl_UniCharIsAlpha) (int ch); /* 346 */ + int (*tcl_UniCharIsDigit) (int ch); /* 347 */ + int (*tcl_UniCharIsLower) (int ch); /* 348 */ + int (*tcl_UniCharIsSpace) (int ch); /* 349 */ + int (*tcl_UniCharIsUpper) (int ch); /* 350 */ + int (*tcl_UniCharIsWordChar) (int ch); /* 351 */ + int (*tcl_UniCharLen) (const Tcl_UniChar *uniStr); /* 352 */ + int (*tcl_UniCharNcmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 353 */ + char * (*tcl_UniCharToUtfDString) (const Tcl_UniChar *uniStr, int uniLength, Tcl_DString *dsPtr); /* 354 */ + Tcl_UniChar * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 355 */ + Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */ + Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */ + void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */ + void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, int length); /* 359 */ + int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, CONST84 char **termPtr); /* 360 */ + int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, int numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */ + int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); /* 362 */ + int (*tcl_ParseQuotedString) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, CONST84 char **termPtr); /* 363 */ + int (*tcl_ParseVarName) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append); /* 364 */ + char * (*tcl_GetCwd) (Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 365 */ + int (*tcl_Chdir) (const char *dirName); /* 366 */ + int (*tcl_Access) (const char *path, int mode); /* 367 */ + int (*tcl_Stat) (const char *path, struct stat *bufPtr); /* 368 */ + int (*tcl_UtfNcmp) (const char *s1, const char *s2, unsigned long n); /* 369 */ + int (*tcl_UtfNcasecmp) (const char *s1, const char *s2, unsigned long n); /* 370 */ + int (*tcl_StringCaseMatch) (const char *str, const char *pattern, int nocase); /* 371 */ + int (*tcl_UniCharIsControl) (int ch); /* 372 */ + int (*tcl_UniCharIsGraph) (int ch); /* 373 */ + int (*tcl_UniCharIsPrint) (int ch); /* 374 */ + int (*tcl_UniCharIsPunct) (int ch); /* 375 */ + int (*tcl_RegExpExecObj) (Tcl_Interp *interp, Tcl_RegExp regexp, Tcl_Obj *textObj, int offset, int nmatches, int flags); /* 376 */ + void (*tcl_RegExpGetInfo) (Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr); /* 377 */ + Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */ + void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */ + int (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */ + Tcl_UniChar (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */ + Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */ + Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */ + void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */ + int (*tcl_RegExpMatchObj) (Tcl_Interp *interp, Tcl_Obj *textObj, Tcl_Obj *patternObj); /* 385 */ + void (*tcl_SetNotifier) (Tcl_NotifierProcs *notifierProcPtr); /* 386 */ + Tcl_Mutex * (*tcl_GetAllocMutex) (void); /* 387 */ + int (*tcl_GetChannelNames) (Tcl_Interp *interp); /* 388 */ + int (*tcl_GetChannelNamesEx) (Tcl_Interp *interp, const char *pattern); /* 389 */ + int (*tcl_ProcObjCmd) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 390 */ + void (*tcl_ConditionFinalize) (Tcl_Condition *condPtr); /* 391 */ + void (*tcl_MutexFinalize) (Tcl_Mutex *mutex); /* 392 */ + int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, ClientData clientData, int stackSize, int flags); /* 393 */ + int (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, int bytesToRead); /* 394 */ + int (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, int srcLen); /* 395 */ + Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */ + int (*tcl_ChannelBuffered) (Tcl_Channel chan); /* 397 */ + CONST84_RETURN char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */ + Tcl_ChannelTypeVersion (*tcl_ChannelVersion) (const Tcl_ChannelType *chanTypePtr); /* 399 */ + Tcl_DriverBlockModeProc * (*tcl_ChannelBlockModeProc) (const Tcl_ChannelType *chanTypePtr); /* 400 */ + Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */ + Tcl_DriverClose2Proc * (*tcl_ChannelClose2Proc) (const Tcl_ChannelType *chanTypePtr); /* 402 */ + Tcl_DriverInputProc * (*tcl_ChannelInputProc) (const Tcl_ChannelType *chanTypePtr); /* 403 */ + Tcl_DriverOutputProc * (*tcl_ChannelOutputProc) (const Tcl_ChannelType *chanTypePtr); /* 404 */ + Tcl_DriverSeekProc * (*tcl_ChannelSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 405 */ + Tcl_DriverSetOptionProc * (*tcl_ChannelSetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 406 */ + Tcl_DriverGetOptionProc * (*tcl_ChannelGetOptionProc) (const Tcl_ChannelType *chanTypePtr); /* 407 */ + Tcl_DriverWatchProc * (*tcl_ChannelWatchProc) (const Tcl_ChannelType *chanTypePtr); /* 408 */ + Tcl_DriverGetHandleProc * (*tcl_ChannelGetHandleProc) (const Tcl_ChannelType *chanTypePtr); /* 409 */ + Tcl_DriverFlushProc * (*tcl_ChannelFlushProc) (const Tcl_ChannelType *chanTypePtr); /* 410 */ + Tcl_DriverHandlerProc * (*tcl_ChannelHandlerProc) (const Tcl_ChannelType *chanTypePtr); /* 411 */ + int (*tcl_JoinThread) (Tcl_ThreadId threadId, int *result); /* 412 */ + int (*tcl_IsChannelShared) (Tcl_Channel channel); /* 413 */ + int (*tcl_IsChannelRegistered) (Tcl_Interp *interp, Tcl_Channel channel); /* 414 */ + void (*tcl_CutChannel) (Tcl_Channel channel); /* 415 */ + void (*tcl_SpliceChannel) (Tcl_Channel channel); /* 416 */ + void (*tcl_ClearChannelHandlers) (Tcl_Channel channel); /* 417 */ + int (*tcl_IsChannelExisting) (const char *channelName); /* 418 */ + int (*tcl_UniCharNcasecmp) (const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned long numChars); /* 419 */ + int (*tcl_UniCharCaseMatch) (const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); /* 420 */ + Tcl_HashEntry * (*tcl_FindHashEntry) (Tcl_HashTable *tablePtr, const void *key); /* 421 */ + Tcl_HashEntry * (*tcl_CreateHashEntry) (Tcl_HashTable *tablePtr, const void *key, int *newPtr); /* 422 */ + void (*tcl_InitCustomHashTable) (Tcl_HashTable *tablePtr, int keyType, const Tcl_HashKeyType *typePtr); /* 423 */ + void (*tcl_InitObjHashTable) (Tcl_HashTable *tablePtr); /* 424 */ + ClientData (*tcl_CommandTraceInfo) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *procPtr, ClientData prevClientData); /* 425 */ + int (*tcl_TraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 426 */ + void (*tcl_UntraceCommand) (Tcl_Interp *interp, const char *varName, int flags, Tcl_CommandTraceProc *proc, ClientData clientData); /* 427 */ + char * (*tcl_AttemptAlloc) (unsigned int size); /* 428 */ + char * (*tcl_AttemptDbCkalloc) (unsigned int size, const char *file, int line); /* 429 */ + char * (*tcl_AttemptRealloc) (char *ptr, unsigned int size); /* 430 */ + char * (*tcl_AttemptDbCkrealloc) (char *ptr, unsigned int size, const char *file, int line); /* 431 */ + int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, int length); /* 432 */ + Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */ + Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */ + int (*tcl_GetMathFuncInfo) (Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr); /* 435 */ + Tcl_Obj * (*tcl_ListMathFuncs) (Tcl_Interp *interp, const char *pattern); /* 436 */ + Tcl_Obj * (*tcl_SubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 437 */ + int (*tcl_DetachChannel) (Tcl_Interp *interp, Tcl_Channel channel); /* 438 */ + int (*tcl_IsStandardChannel) (Tcl_Channel channel); /* 439 */ + int (*tcl_FSCopyFile) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr); /* 440 */ + int (*tcl_FSCopyDirectory) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr); /* 441 */ + int (*tcl_FSCreateDirectory) (Tcl_Obj *pathPtr); /* 442 */ + int (*tcl_FSDeleteFile) (Tcl_Obj *pathPtr); /* 443 */ + int (*tcl_FSLoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *sym1, const char *sym2, Tcl_PackageInitProc **proc1Ptr, Tcl_PackageInitProc **proc2Ptr, Tcl_LoadHandle *handlePtr, Tcl_FSUnloadFileProc **unloadProcPtr); /* 444 */ + int (*tcl_FSMatchInDirectory) (Tcl_Interp *interp, Tcl_Obj *result, Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types); /* 445 */ + Tcl_Obj * (*tcl_FSLink) (Tcl_Obj *pathPtr, Tcl_Obj *toPtr, int linkAction); /* 446 */ + int (*tcl_FSRemoveDirectory) (Tcl_Obj *pathPtr, int recursive, Tcl_Obj **errorPtr); /* 447 */ + int (*tcl_FSRenameFile) (Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr); /* 448 */ + int (*tcl_FSLstat) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); /* 449 */ + int (*tcl_FSUtime) (Tcl_Obj *pathPtr, struct utimbuf *tval); /* 450 */ + int (*tcl_FSFileAttrsGet) (Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); /* 451 */ + int (*tcl_FSFileAttrsSet) (Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr); /* 452 */ + const char *CONST86 * (*tcl_FSFileAttrStrings) (Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef); /* 453 */ + int (*tcl_FSStat) (Tcl_Obj *pathPtr, Tcl_StatBuf *buf); /* 454 */ + int (*tcl_FSAccess) (Tcl_Obj *pathPtr, int mode); /* 455 */ + Tcl_Channel (*tcl_FSOpenFileChannel) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *modeString, int permissions); /* 456 */ + Tcl_Obj * (*tcl_FSGetCwd) (Tcl_Interp *interp); /* 457 */ + int (*tcl_FSChdir) (Tcl_Obj *pathPtr); /* 458 */ + int (*tcl_FSConvertToPathType) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 459 */ + Tcl_Obj * (*tcl_FSJoinPath) (Tcl_Obj *listObj, int elements); /* 460 */ + Tcl_Obj * (*tcl_FSSplitPath) (Tcl_Obj *pathPtr, int *lenPtr); /* 461 */ + int (*tcl_FSEqualPaths) (Tcl_Obj *firstPtr, Tcl_Obj *secondPtr); /* 462 */ + Tcl_Obj * (*tcl_FSGetNormalizedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 463 */ + Tcl_Obj * (*tcl_FSJoinToPath) (Tcl_Obj *pathPtr, int objc, Tcl_Obj *const objv[]); /* 464 */ + ClientData (*tcl_FSGetInternalRep) (Tcl_Obj *pathPtr, const Tcl_Filesystem *fsPtr); /* 465 */ + Tcl_Obj * (*tcl_FSGetTranslatedPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 466 */ + int (*tcl_FSEvalFile) (Tcl_Interp *interp, Tcl_Obj *fileName); /* 467 */ + Tcl_Obj * (*tcl_FSNewNativePath) (const Tcl_Filesystem *fromFilesystem, ClientData clientData); /* 468 */ + const void * (*tcl_FSGetNativePath) (Tcl_Obj *pathPtr); /* 469 */ + Tcl_Obj * (*tcl_FSFileSystemInfo) (Tcl_Obj *pathPtr); /* 470 */ + Tcl_Obj * (*tcl_FSPathSeparator) (Tcl_Obj *pathPtr); /* 471 */ + Tcl_Obj * (*tcl_FSListVolumes) (void); /* 472 */ + int (*tcl_FSRegister) (ClientData clientData, const Tcl_Filesystem *fsPtr); /* 473 */ + int (*tcl_FSUnregister) (const Tcl_Filesystem *fsPtr); /* 474 */ + ClientData (*tcl_FSData) (const Tcl_Filesystem *fsPtr); /* 475 */ + const char * (*tcl_FSGetTranslatedStringPath) (Tcl_Interp *interp, Tcl_Obj *pathPtr); /* 476 */ + CONST86 Tcl_Filesystem * (*tcl_FSGetFileSystemForPath) (Tcl_Obj *pathPtr); /* 477 */ + Tcl_PathType (*tcl_FSGetPathType) (Tcl_Obj *pathPtr); /* 478 */ + int (*tcl_OutputBuffered) (Tcl_Channel chan); /* 479 */ + void (*tcl_FSMountsChanged) (const Tcl_Filesystem *fsPtr); /* 480 */ + int (*tcl_EvalTokensStandard) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 481 */ + void (*tcl_GetTime) (Tcl_Time *timeBuf); /* 482 */ + Tcl_Trace (*tcl_CreateObjTrace) (Tcl_Interp *interp, int level, int flags, Tcl_CmdObjTraceProc *objProc, ClientData clientData, Tcl_CmdObjTraceDeleteProc *delProc); /* 483 */ + int (*tcl_GetCommandInfoFromToken) (Tcl_Command token, Tcl_CmdInfo *infoPtr); /* 484 */ + int (*tcl_SetCommandInfoFromToken) (Tcl_Command token, const Tcl_CmdInfo *infoPtr); /* 485 */ + Tcl_Obj * (*tcl_DbNewWideIntObj) (Tcl_WideInt wideValue, const char *file, int line); /* 486 */ + int (*tcl_GetWideIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_WideInt *widePtr); /* 487 */ + Tcl_Obj * (*tcl_NewWideIntObj) (Tcl_WideInt wideValue); /* 488 */ + void (*tcl_SetWideIntObj) (Tcl_Obj *objPtr, Tcl_WideInt wideValue); /* 489 */ + Tcl_StatBuf * (*tcl_AllocStatBuf) (void); /* 490 */ + Tcl_WideInt (*tcl_Seek) (Tcl_Channel chan, Tcl_WideInt offset, int mode); /* 491 */ + Tcl_WideInt (*tcl_Tell) (Tcl_Channel chan); /* 492 */ + Tcl_DriverWideSeekProc * (*tcl_ChannelWideSeekProc) (const Tcl_ChannelType *chanTypePtr); /* 493 */ + int (*tcl_DictObjPut) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj *valuePtr); /* 494 */ + int (*tcl_DictObjGet) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, Tcl_Obj **valuePtrPtr); /* 495 */ + int (*tcl_DictObjRemove) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr); /* 496 */ + int (*tcl_DictObjSize) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr); /* 497 */ + int (*tcl_DictObjFirst) (Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_DictSearch *searchPtr, Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr); /* 498 */ + void (*tcl_DictObjNext) (Tcl_DictSearch *searchPtr, Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr); /* 499 */ + void (*tcl_DictObjDone) (Tcl_DictSearch *searchPtr); /* 500 */ + int (*tcl_DictObjPutKeyList) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int keyc, Tcl_Obj *const *keyv, Tcl_Obj *valuePtr); /* 501 */ + int (*tcl_DictObjRemoveKeyList) (Tcl_Interp *interp, Tcl_Obj *dictPtr, int keyc, Tcl_Obj *const *keyv); /* 502 */ + Tcl_Obj * (*tcl_NewDictObj) (void); /* 503 */ + Tcl_Obj * (*tcl_DbNewDictObj) (const char *file, int line); /* 504 */ + void (*tcl_RegisterConfig) (Tcl_Interp *interp, const char *pkgName, const Tcl_Config *configuration, const char *valEncoding); /* 505 */ + Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 506 */ + void (*tcl_DeleteNamespace) (Tcl_Namespace *nsPtr); /* 507 */ + int (*tcl_AppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 508 */ + int (*tcl_Export) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 509 */ + int (*tcl_Import) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 510 */ + int (*tcl_ForgetImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 511 */ + Tcl_Namespace * (*tcl_GetCurrentNamespace) (Tcl_Interp *interp); /* 512 */ + Tcl_Namespace * (*tcl_GetGlobalNamespace) (Tcl_Interp *interp); /* 513 */ + Tcl_Namespace * (*tcl_FindNamespace) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 514 */ + Tcl_Command (*tcl_FindCommand) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 515 */ + Tcl_Command (*tcl_GetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 516 */ + void (*tcl_GetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 517 */ + int (*tcl_FSEvalFileEx) (Tcl_Interp *interp, Tcl_Obj *fileName, const char *encodingName); /* 518 */ + Tcl_ExitProc * (*tcl_SetExitProc) (Tcl_ExitProc *proc); /* 519 */ + void (*tcl_LimitAddHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, ClientData clientData, Tcl_LimitHandlerDeleteProc *deleteProc); /* 520 */ + void (*tcl_LimitRemoveHandler) (Tcl_Interp *interp, int type, Tcl_LimitHandlerProc *handlerProc, ClientData clientData); /* 521 */ + int (*tcl_LimitReady) (Tcl_Interp *interp); /* 522 */ + int (*tcl_LimitCheck) (Tcl_Interp *interp); /* 523 */ + int (*tcl_LimitExceeded) (Tcl_Interp *interp); /* 524 */ + void (*tcl_LimitSetCommands) (Tcl_Interp *interp, int commandLimit); /* 525 */ + void (*tcl_LimitSetTime) (Tcl_Interp *interp, Tcl_Time *timeLimitPtr); /* 526 */ + void (*tcl_LimitSetGranularity) (Tcl_Interp *interp, int type, int granularity); /* 527 */ + int (*tcl_LimitTypeEnabled) (Tcl_Interp *interp, int type); /* 528 */ + int (*tcl_LimitTypeExceeded) (Tcl_Interp *interp, int type); /* 529 */ + void (*tcl_LimitTypeSet) (Tcl_Interp *interp, int type); /* 530 */ + void (*tcl_LimitTypeReset) (Tcl_Interp *interp, int type); /* 531 */ + int (*tcl_LimitGetCommands) (Tcl_Interp *interp); /* 532 */ + void (*tcl_LimitGetTime) (Tcl_Interp *interp, Tcl_Time *timeLimitPtr); /* 533 */ + int (*tcl_LimitGetGranularity) (Tcl_Interp *interp, int type); /* 534 */ + Tcl_InterpState (*tcl_SaveInterpState) (Tcl_Interp *interp, int status); /* 535 */ + int (*tcl_RestoreInterpState) (Tcl_Interp *interp, Tcl_InterpState state); /* 536 */ + void (*tcl_DiscardInterpState) (Tcl_InterpState state); /* 537 */ + int (*tcl_SetReturnOptions) (Tcl_Interp *interp, Tcl_Obj *options); /* 538 */ + Tcl_Obj * (*tcl_GetReturnOptions) (Tcl_Interp *interp, int result); /* 539 */ + int (*tcl_IsEnsemble) (Tcl_Command token); /* 540 */ + Tcl_Command (*tcl_CreateEnsemble) (Tcl_Interp *interp, const char *name, Tcl_Namespace *namespacePtr, int flags); /* 541 */ + Tcl_Command (*tcl_FindEnsemble) (Tcl_Interp *interp, Tcl_Obj *cmdNameObj, int flags); /* 542 */ + int (*tcl_SetEnsembleSubcommandList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *subcmdList); /* 543 */ + int (*tcl_SetEnsembleMappingDict) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *mapDict); /* 544 */ + int (*tcl_SetEnsembleUnknownHandler) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *unknownList); /* 545 */ + int (*tcl_SetEnsembleFlags) (Tcl_Interp *interp, Tcl_Command token, int flags); /* 546 */ + int (*tcl_GetEnsembleSubcommandList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **subcmdListPtr); /* 547 */ + int (*tcl_GetEnsembleMappingDict) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **mapDictPtr); /* 548 */ + int (*tcl_GetEnsembleUnknownHandler) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **unknownListPtr); /* 549 */ + int (*tcl_GetEnsembleFlags) (Tcl_Interp *interp, Tcl_Command token, int *flagsPtr); /* 550 */ + int (*tcl_GetEnsembleNamespace) (Tcl_Interp *interp, Tcl_Command token, Tcl_Namespace **namespacePtrPtr); /* 551 */ + void (*tcl_SetTimeProc) (Tcl_GetTimeProc *getProc, Tcl_ScaleTimeProc *scaleProc, ClientData clientData); /* 552 */ + void (*tcl_QueryTimeProc) (Tcl_GetTimeProc **getProc, Tcl_ScaleTimeProc **scaleProc, ClientData *clientData); /* 553 */ + Tcl_DriverThreadActionProc * (*tcl_ChannelThreadActionProc) (const Tcl_ChannelType *chanTypePtr); /* 554 */ + Tcl_Obj * (*tcl_NewBignumObj) (mp_int *value); /* 555 */ + Tcl_Obj * (*tcl_DbNewBignumObj) (mp_int *value, const char *file, int line); /* 556 */ + void (*tcl_SetBignumObj) (Tcl_Obj *obj, mp_int *value); /* 557 */ + int (*tcl_GetBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, mp_int *value); /* 558 */ + int (*tcl_TakeBignumFromObj) (Tcl_Interp *interp, Tcl_Obj *obj, mp_int *value); /* 559 */ + int (*tcl_TruncateChannel) (Tcl_Channel chan, Tcl_WideInt length); /* 560 */ + Tcl_DriverTruncateProc * (*tcl_ChannelTruncateProc) (const Tcl_ChannelType *chanTypePtr); /* 561 */ + void (*tcl_SetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj *msg); /* 562 */ + void (*tcl_GetChannelErrorInterp) (Tcl_Interp *interp, Tcl_Obj **msg); /* 563 */ + void (*tcl_SetChannelError) (Tcl_Channel chan, Tcl_Obj *msg); /* 564 */ + void (*tcl_GetChannelError) (Tcl_Channel chan, Tcl_Obj **msg); /* 565 */ + int (*tcl_InitBignumFromDouble) (Tcl_Interp *interp, double initval, mp_int *toInit); /* 566 */ + Tcl_Obj * (*tcl_GetNamespaceUnknownHandler) (Tcl_Interp *interp, Tcl_Namespace *nsPtr); /* 567 */ + int (*tcl_SetNamespaceUnknownHandler) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *handlerPtr); /* 568 */ + int (*tcl_GetEncodingFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Encoding *encodingPtr); /* 569 */ + Tcl_Obj * (*tcl_GetEncodingSearchPath) (void); /* 570 */ + int (*tcl_SetEncodingSearchPath) (Tcl_Obj *searchPath); /* 571 */ + const char * (*tcl_GetEncodingNameFromEnvironment) (Tcl_DString *bufPtr); /* 572 */ + int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 573 */ + void (*tcl_AppendObjToErrorInfo) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 574 */ + void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, int length, int limit, const char *ellipsis); /* 575 */ + Tcl_Obj * (*tcl_Format) (Tcl_Interp *interp, const char *format, int objc, Tcl_Obj *const objv[]); /* 576 */ + int (*tcl_AppendFormatToObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *format, int objc, Tcl_Obj *const objv[]); /* 577 */ + Tcl_Obj * (*tcl_ObjPrintf) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 578 */ + void (*tcl_AppendPrintfToObj) (Tcl_Obj *objPtr, const char *format, ...) TCL_FORMAT_PRINTF(2, 3); /* 579 */ + int (*tcl_CancelEval) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr, ClientData clientData, int flags); /* 580 */ + int (*tcl_Canceled) (Tcl_Interp *interp, int flags); /* 581 */ + int (*tcl_CreatePipe) (Tcl_Interp *interp, Tcl_Channel *rchan, Tcl_Channel *wchan, int flags); /* 582 */ + Tcl_Command (*tcl_NRCreateCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 583 */ + int (*tcl_NREvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 584 */ + int (*tcl_NREvalObjv) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); /* 585 */ + int (*tcl_NRCmdSwap) (Tcl_Interp *interp, Tcl_Command cmd, int objc, Tcl_Obj *const objv[], int flags); /* 586 */ + void (*tcl_NRAddCallback) (Tcl_Interp *interp, Tcl_NRPostProc *postProcPtr, ClientData data0, ClientData data1, ClientData data2, ClientData data3); /* 587 */ + int (*tcl_NRCallObjProc) (Tcl_Interp *interp, Tcl_ObjCmdProc *objProc, ClientData clientData, int objc, Tcl_Obj *const objv[]); /* 588 */ + unsigned (*tcl_GetFSDeviceFromStat) (const Tcl_StatBuf *statPtr); /* 589 */ + unsigned (*tcl_GetFSInodeFromStat) (const Tcl_StatBuf *statPtr); /* 590 */ + unsigned (*tcl_GetModeFromStat) (const Tcl_StatBuf *statPtr); /* 591 */ + int (*tcl_GetLinkCountFromStat) (const Tcl_StatBuf *statPtr); /* 592 */ + int (*tcl_GetUserIdFromStat) (const Tcl_StatBuf *statPtr); /* 593 */ + int (*tcl_GetGroupIdFromStat) (const Tcl_StatBuf *statPtr); /* 594 */ + int (*tcl_GetDeviceTypeFromStat) (const Tcl_StatBuf *statPtr); /* 595 */ + Tcl_WideInt (*tcl_GetAccessTimeFromStat) (const Tcl_StatBuf *statPtr); /* 596 */ + Tcl_WideInt (*tcl_GetModificationTimeFromStat) (const Tcl_StatBuf *statPtr); /* 597 */ + Tcl_WideInt (*tcl_GetChangeTimeFromStat) (const Tcl_StatBuf *statPtr); /* 598 */ + Tcl_WideUInt (*tcl_GetSizeFromStat) (const Tcl_StatBuf *statPtr); /* 599 */ + Tcl_WideUInt (*tcl_GetBlocksFromStat) (const Tcl_StatBuf *statPtr); /* 600 */ + unsigned (*tcl_GetBlockSizeFromStat) (const Tcl_StatBuf *statPtr); /* 601 */ + int (*tcl_SetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj *paramList); /* 602 */ + int (*tcl_GetEnsembleParameterList) (Tcl_Interp *interp, Tcl_Command token, Tcl_Obj **paramListPtr); /* 603 */ + int (*tcl_ParseArgsObjv) (Tcl_Interp *interp, const Tcl_ArgvInfo *argTable, int *objcPtr, Tcl_Obj *const *objv, Tcl_Obj ***remObjv); /* 604 */ + int (*tcl_GetErrorLine) (Tcl_Interp *interp); /* 605 */ + void (*tcl_SetErrorLine) (Tcl_Interp *interp, int lineNum); /* 606 */ + void (*tcl_TransferResult) (Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp); /* 607 */ + int (*tcl_InterpActive) (Tcl_Interp *interp); /* 608 */ + void (*tcl_BackgroundException) (Tcl_Interp *interp, int code); /* 609 */ + int (*tcl_ZlibDeflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, int level, Tcl_Obj *gzipHeaderDictObj); /* 610 */ + int (*tcl_ZlibInflate) (Tcl_Interp *interp, int format, Tcl_Obj *data, int buffersize, Tcl_Obj *gzipHeaderDictObj); /* 611 */ + unsigned int (*tcl_ZlibCRC32) (unsigned int crc, const unsigned char *buf, int len); /* 612 */ + unsigned int (*tcl_ZlibAdler32) (unsigned int adler, const unsigned char *buf, int len); /* 613 */ + int (*tcl_ZlibStreamInit) (Tcl_Interp *interp, int mode, int format, int level, Tcl_Obj *dictObj, Tcl_ZlibStream *zshandle); /* 614 */ + Tcl_Obj * (*tcl_ZlibStreamGetCommandName) (Tcl_ZlibStream zshandle); /* 615 */ + int (*tcl_ZlibStreamEof) (Tcl_ZlibStream zshandle); /* 616 */ + int (*tcl_ZlibStreamChecksum) (Tcl_ZlibStream zshandle); /* 617 */ + int (*tcl_ZlibStreamPut) (Tcl_ZlibStream zshandle, Tcl_Obj *data, int flush); /* 618 */ + int (*tcl_ZlibStreamGet) (Tcl_ZlibStream zshandle, Tcl_Obj *data, int count); /* 619 */ + int (*tcl_ZlibStreamClose) (Tcl_ZlibStream zshandle); /* 620 */ + int (*tcl_ZlibStreamReset) (Tcl_ZlibStream zshandle); /* 621 */ + void (*tcl_SetStartupScript) (Tcl_Obj *path, const char *encoding); /* 622 */ + Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingPtr); /* 623 */ + int (*tcl_CloseEx) (Tcl_Interp *interp, Tcl_Channel chan, int flags); /* 624 */ + int (*tcl_NRExprObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Obj *resultPtr); /* 625 */ + int (*tcl_NRSubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 626 */ + int (*tcl_LoadFile) (Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *const symv[], int flags, void *procPtrs, Tcl_LoadHandle *handlePtr); /* 627 */ + void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ + int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ + void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ +} TclStubs; + +#ifdef __cplusplus +extern "C" { +#endif +extern const TclStubs *tclStubsPtr; +#ifdef __cplusplus +} +#endif + +#if defined(USE_TCL_STUBS) + +/* + * Inline function declarations: + */ + +#define Tcl_PkgProvideEx \ + (tclStubsPtr->tcl_PkgProvideEx) /* 0 */ +#define Tcl_PkgRequireEx \ + (tclStubsPtr->tcl_PkgRequireEx) /* 1 */ +#define Tcl_Panic \ + (tclStubsPtr->tcl_Panic) /* 2 */ +#define Tcl_Alloc \ + (tclStubsPtr->tcl_Alloc) /* 3 */ +#define Tcl_Free \ + (tclStubsPtr->tcl_Free) /* 4 */ +#define Tcl_Realloc \ + (tclStubsPtr->tcl_Realloc) /* 5 */ +#define Tcl_DbCkalloc \ + (tclStubsPtr->tcl_DbCkalloc) /* 6 */ +#define Tcl_DbCkfree \ + (tclStubsPtr->tcl_DbCkfree) /* 7 */ +#define Tcl_DbCkrealloc \ + (tclStubsPtr->tcl_DbCkrealloc) /* 8 */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#define Tcl_CreateFileHandler \ + (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_CreateFileHandler \ + (tclStubsPtr->tcl_CreateFileHandler) /* 9 */ +#endif /* MACOSX */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#define Tcl_DeleteFileHandler \ + (tclStubsPtr->tcl_DeleteFileHandler) /* 10 */ +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_DeleteFileHandler \ + (tclStubsPtr->tcl_DeleteFileHandler) /* 10 */ +#endif /* MACOSX */ +#define Tcl_SetTimer \ + (tclStubsPtr->tcl_SetTimer) /* 11 */ +#define Tcl_Sleep \ + (tclStubsPtr->tcl_Sleep) /* 12 */ +#define Tcl_WaitForEvent \ + (tclStubsPtr->tcl_WaitForEvent) /* 13 */ +#define Tcl_AppendAllObjTypes \ + (tclStubsPtr->tcl_AppendAllObjTypes) /* 14 */ +#define Tcl_AppendStringsToObj \ + (tclStubsPtr->tcl_AppendStringsToObj) /* 15 */ +#define Tcl_AppendToObj \ + (tclStubsPtr->tcl_AppendToObj) /* 16 */ +#define Tcl_ConcatObj \ + (tclStubsPtr->tcl_ConcatObj) /* 17 */ +#define Tcl_ConvertToType \ + (tclStubsPtr->tcl_ConvertToType) /* 18 */ +#define Tcl_DbDecrRefCount \ + (tclStubsPtr->tcl_DbDecrRefCount) /* 19 */ +#define Tcl_DbIncrRefCount \ + (tclStubsPtr->tcl_DbIncrRefCount) /* 20 */ +#define Tcl_DbIsShared \ + (tclStubsPtr->tcl_DbIsShared) /* 21 */ +#define Tcl_DbNewBooleanObj \ + (tclStubsPtr->tcl_DbNewBooleanObj) /* 22 */ +#define Tcl_DbNewByteArrayObj \ + (tclStubsPtr->tcl_DbNewByteArrayObj) /* 23 */ +#define Tcl_DbNewDoubleObj \ + (tclStubsPtr->tcl_DbNewDoubleObj) /* 24 */ +#define Tcl_DbNewListObj \ + (tclStubsPtr->tcl_DbNewListObj) /* 25 */ +#define Tcl_DbNewLongObj \ + (tclStubsPtr->tcl_DbNewLongObj) /* 26 */ +#define Tcl_DbNewObj \ + (tclStubsPtr->tcl_DbNewObj) /* 27 */ +#define Tcl_DbNewStringObj \ + (tclStubsPtr->tcl_DbNewStringObj) /* 28 */ +#define Tcl_DuplicateObj \ + (tclStubsPtr->tcl_DuplicateObj) /* 29 */ +#define TclFreeObj \ + (tclStubsPtr->tclFreeObj) /* 30 */ +#define Tcl_GetBoolean \ + (tclStubsPtr->tcl_GetBoolean) /* 31 */ +#define Tcl_GetBooleanFromObj \ + (tclStubsPtr->tcl_GetBooleanFromObj) /* 32 */ +#define Tcl_GetByteArrayFromObj \ + (tclStubsPtr->tcl_GetByteArrayFromObj) /* 33 */ +#define Tcl_GetDouble \ + (tclStubsPtr->tcl_GetDouble) /* 34 */ +#define Tcl_GetDoubleFromObj \ + (tclStubsPtr->tcl_GetDoubleFromObj) /* 35 */ +#define Tcl_GetIndexFromObj \ + (tclStubsPtr->tcl_GetIndexFromObj) /* 36 */ +#define Tcl_GetInt \ + (tclStubsPtr->tcl_GetInt) /* 37 */ +#define Tcl_GetIntFromObj \ + (tclStubsPtr->tcl_GetIntFromObj) /* 38 */ +#define Tcl_GetLongFromObj \ + (tclStubsPtr->tcl_GetLongFromObj) /* 39 */ +#define Tcl_GetObjType \ + (tclStubsPtr->tcl_GetObjType) /* 40 */ +#define Tcl_GetStringFromObj \ + (tclStubsPtr->tcl_GetStringFromObj) /* 41 */ +#define Tcl_InvalidateStringRep \ + (tclStubsPtr->tcl_InvalidateStringRep) /* 42 */ +#define Tcl_ListObjAppendList \ + (tclStubsPtr->tcl_ListObjAppendList) /* 43 */ +#define Tcl_ListObjAppendElement \ + (tclStubsPtr->tcl_ListObjAppendElement) /* 44 */ +#define Tcl_ListObjGetElements \ + (tclStubsPtr->tcl_ListObjGetElements) /* 45 */ +#define Tcl_ListObjIndex \ + (tclStubsPtr->tcl_ListObjIndex) /* 46 */ +#define Tcl_ListObjLength \ + (tclStubsPtr->tcl_ListObjLength) /* 47 */ +#define Tcl_ListObjReplace \ + (tclStubsPtr->tcl_ListObjReplace) /* 48 */ +#define Tcl_NewBooleanObj \ + (tclStubsPtr->tcl_NewBooleanObj) /* 49 */ +#define Tcl_NewByteArrayObj \ + (tclStubsPtr->tcl_NewByteArrayObj) /* 50 */ +#define Tcl_NewDoubleObj \ + (tclStubsPtr->tcl_NewDoubleObj) /* 51 */ +#define Tcl_NewIntObj \ + (tclStubsPtr->tcl_NewIntObj) /* 52 */ +#define Tcl_NewListObj \ + (tclStubsPtr->tcl_NewListObj) /* 53 */ +#define Tcl_NewLongObj \ + (tclStubsPtr->tcl_NewLongObj) /* 54 */ +#define Tcl_NewObj \ + (tclStubsPtr->tcl_NewObj) /* 55 */ +#define Tcl_NewStringObj \ + (tclStubsPtr->tcl_NewStringObj) /* 56 */ +#define Tcl_SetBooleanObj \ + (tclStubsPtr->tcl_SetBooleanObj) /* 57 */ +#define Tcl_SetByteArrayLength \ + (tclStubsPtr->tcl_SetByteArrayLength) /* 58 */ +#define Tcl_SetByteArrayObj \ + (tclStubsPtr->tcl_SetByteArrayObj) /* 59 */ +#define Tcl_SetDoubleObj \ + (tclStubsPtr->tcl_SetDoubleObj) /* 60 */ +#define Tcl_SetIntObj \ + (tclStubsPtr->tcl_SetIntObj) /* 61 */ +#define Tcl_SetListObj \ + (tclStubsPtr->tcl_SetListObj) /* 62 */ +#define Tcl_SetLongObj \ + (tclStubsPtr->tcl_SetLongObj) /* 63 */ +#define Tcl_SetObjLength \ + (tclStubsPtr->tcl_SetObjLength) /* 64 */ +#define Tcl_SetStringObj \ + (tclStubsPtr->tcl_SetStringObj) /* 65 */ +#define Tcl_AddErrorInfo \ + (tclStubsPtr->tcl_AddErrorInfo) /* 66 */ +#define Tcl_AddObjErrorInfo \ + (tclStubsPtr->tcl_AddObjErrorInfo) /* 67 */ +#define Tcl_AllowExceptions \ + (tclStubsPtr->tcl_AllowExceptions) /* 68 */ +#define Tcl_AppendElement \ + (tclStubsPtr->tcl_AppendElement) /* 69 */ +#define Tcl_AppendResult \ + (tclStubsPtr->tcl_AppendResult) /* 70 */ +#define Tcl_AsyncCreate \ + (tclStubsPtr->tcl_AsyncCreate) /* 71 */ +#define Tcl_AsyncDelete \ + (tclStubsPtr->tcl_AsyncDelete) /* 72 */ +#define Tcl_AsyncInvoke \ + (tclStubsPtr->tcl_AsyncInvoke) /* 73 */ +#define Tcl_AsyncMark \ + (tclStubsPtr->tcl_AsyncMark) /* 74 */ +#define Tcl_AsyncReady \ + (tclStubsPtr->tcl_AsyncReady) /* 75 */ +#define Tcl_BackgroundError \ + (tclStubsPtr->tcl_BackgroundError) /* 76 */ +#define Tcl_Backslash \ + (tclStubsPtr->tcl_Backslash) /* 77 */ +#define Tcl_BadChannelOption \ + (tclStubsPtr->tcl_BadChannelOption) /* 78 */ +#define Tcl_CallWhenDeleted \ + (tclStubsPtr->tcl_CallWhenDeleted) /* 79 */ +#define Tcl_CancelIdleCall \ + (tclStubsPtr->tcl_CancelIdleCall) /* 80 */ +#define Tcl_Close \ + (tclStubsPtr->tcl_Close) /* 81 */ +#define Tcl_CommandComplete \ + (tclStubsPtr->tcl_CommandComplete) /* 82 */ +#define Tcl_Concat \ + (tclStubsPtr->tcl_Concat) /* 83 */ +#define Tcl_ConvertElement \ + (tclStubsPtr->tcl_ConvertElement) /* 84 */ +#define Tcl_ConvertCountedElement \ + (tclStubsPtr->tcl_ConvertCountedElement) /* 85 */ +#define Tcl_CreateAlias \ + (tclStubsPtr->tcl_CreateAlias) /* 86 */ +#define Tcl_CreateAliasObj \ + (tclStubsPtr->tcl_CreateAliasObj) /* 87 */ +#define Tcl_CreateChannel \ + (tclStubsPtr->tcl_CreateChannel) /* 88 */ +#define Tcl_CreateChannelHandler \ + (tclStubsPtr->tcl_CreateChannelHandler) /* 89 */ +#define Tcl_CreateCloseHandler \ + (tclStubsPtr->tcl_CreateCloseHandler) /* 90 */ +#define Tcl_CreateCommand \ + (tclStubsPtr->tcl_CreateCommand) /* 91 */ +#define Tcl_CreateEventSource \ + (tclStubsPtr->tcl_CreateEventSource) /* 92 */ +#define Tcl_CreateExitHandler \ + (tclStubsPtr->tcl_CreateExitHandler) /* 93 */ +#define Tcl_CreateInterp \ + (tclStubsPtr->tcl_CreateInterp) /* 94 */ +#define Tcl_CreateMathFunc \ + (tclStubsPtr->tcl_CreateMathFunc) /* 95 */ +#define Tcl_CreateObjCommand \ + (tclStubsPtr->tcl_CreateObjCommand) /* 96 */ +#define Tcl_CreateSlave \ + (tclStubsPtr->tcl_CreateSlave) /* 97 */ +#define Tcl_CreateTimerHandler \ + (tclStubsPtr->tcl_CreateTimerHandler) /* 98 */ +#define Tcl_CreateTrace \ + (tclStubsPtr->tcl_CreateTrace) /* 99 */ +#define Tcl_DeleteAssocData \ + (tclStubsPtr->tcl_DeleteAssocData) /* 100 */ +#define Tcl_DeleteChannelHandler \ + (tclStubsPtr->tcl_DeleteChannelHandler) /* 101 */ +#define Tcl_DeleteCloseHandler \ + (tclStubsPtr->tcl_DeleteCloseHandler) /* 102 */ +#define Tcl_DeleteCommand \ + (tclStubsPtr->tcl_DeleteCommand) /* 103 */ +#define Tcl_DeleteCommandFromToken \ + (tclStubsPtr->tcl_DeleteCommandFromToken) /* 104 */ +#define Tcl_DeleteEvents \ + (tclStubsPtr->tcl_DeleteEvents) /* 105 */ +#define Tcl_DeleteEventSource \ + (tclStubsPtr->tcl_DeleteEventSource) /* 106 */ +#define Tcl_DeleteExitHandler \ + (tclStubsPtr->tcl_DeleteExitHandler) /* 107 */ +#define Tcl_DeleteHashEntry \ + (tclStubsPtr->tcl_DeleteHashEntry) /* 108 */ +#define Tcl_DeleteHashTable \ + (tclStubsPtr->tcl_DeleteHashTable) /* 109 */ +#define Tcl_DeleteInterp \ + (tclStubsPtr->tcl_DeleteInterp) /* 110 */ +#define Tcl_DetachPids \ + (tclStubsPtr->tcl_DetachPids) /* 111 */ +#define Tcl_DeleteTimerHandler \ + (tclStubsPtr->tcl_DeleteTimerHandler) /* 112 */ +#define Tcl_DeleteTrace \ + (tclStubsPtr->tcl_DeleteTrace) /* 113 */ +#define Tcl_DontCallWhenDeleted \ + (tclStubsPtr->tcl_DontCallWhenDeleted) /* 114 */ +#define Tcl_DoOneEvent \ + (tclStubsPtr->tcl_DoOneEvent) /* 115 */ +#define Tcl_DoWhenIdle \ + (tclStubsPtr->tcl_DoWhenIdle) /* 116 */ +#define Tcl_DStringAppend \ + (tclStubsPtr->tcl_DStringAppend) /* 117 */ +#define Tcl_DStringAppendElement \ + (tclStubsPtr->tcl_DStringAppendElement) /* 118 */ +#define Tcl_DStringEndSublist \ + (tclStubsPtr->tcl_DStringEndSublist) /* 119 */ +#define Tcl_DStringFree \ + (tclStubsPtr->tcl_DStringFree) /* 120 */ +#define Tcl_DStringGetResult \ + (tclStubsPtr->tcl_DStringGetResult) /* 121 */ +#define Tcl_DStringInit \ + (tclStubsPtr->tcl_DStringInit) /* 122 */ +#define Tcl_DStringResult \ + (tclStubsPtr->tcl_DStringResult) /* 123 */ +#define Tcl_DStringSetLength \ + (tclStubsPtr->tcl_DStringSetLength) /* 124 */ +#define Tcl_DStringStartSublist \ + (tclStubsPtr->tcl_DStringStartSublist) /* 125 */ +#define Tcl_Eof \ + (tclStubsPtr->tcl_Eof) /* 126 */ +#define Tcl_ErrnoId \ + (tclStubsPtr->tcl_ErrnoId) /* 127 */ +#define Tcl_ErrnoMsg \ + (tclStubsPtr->tcl_ErrnoMsg) /* 128 */ +#define Tcl_Eval \ + (tclStubsPtr->tcl_Eval) /* 129 */ +#define Tcl_EvalFile \ + (tclStubsPtr->tcl_EvalFile) /* 130 */ +#define Tcl_EvalObj \ + (tclStubsPtr->tcl_EvalObj) /* 131 */ +#define Tcl_EventuallyFree \ + (tclStubsPtr->tcl_EventuallyFree) /* 132 */ +#define Tcl_Exit \ + (tclStubsPtr->tcl_Exit) /* 133 */ +#define Tcl_ExposeCommand \ + (tclStubsPtr->tcl_ExposeCommand) /* 134 */ +#define Tcl_ExprBoolean \ + (tclStubsPtr->tcl_ExprBoolean) /* 135 */ +#define Tcl_ExprBooleanObj \ + (tclStubsPtr->tcl_ExprBooleanObj) /* 136 */ +#define Tcl_ExprDouble \ + (tclStubsPtr->tcl_ExprDouble) /* 137 */ +#define Tcl_ExprDoubleObj \ + (tclStubsPtr->tcl_ExprDoubleObj) /* 138 */ +#define Tcl_ExprLong \ + (tclStubsPtr->tcl_ExprLong) /* 139 */ +#define Tcl_ExprLongObj \ + (tclStubsPtr->tcl_ExprLongObj) /* 140 */ +#define Tcl_ExprObj \ + (tclStubsPtr->tcl_ExprObj) /* 141 */ +#define Tcl_ExprString \ + (tclStubsPtr->tcl_ExprString) /* 142 */ +#define Tcl_Finalize \ + (tclStubsPtr->tcl_Finalize) /* 143 */ +#define Tcl_FindExecutable \ + (tclStubsPtr->tcl_FindExecutable) /* 144 */ +#define Tcl_FirstHashEntry \ + (tclStubsPtr->tcl_FirstHashEntry) /* 145 */ +#define Tcl_Flush \ + (tclStubsPtr->tcl_Flush) /* 146 */ +#define Tcl_FreeResult \ + (tclStubsPtr->tcl_FreeResult) /* 147 */ +#define Tcl_GetAlias \ + (tclStubsPtr->tcl_GetAlias) /* 148 */ +#define Tcl_GetAliasObj \ + (tclStubsPtr->tcl_GetAliasObj) /* 149 */ +#define Tcl_GetAssocData \ + (tclStubsPtr->tcl_GetAssocData) /* 150 */ +#define Tcl_GetChannel \ + (tclStubsPtr->tcl_GetChannel) /* 151 */ +#define Tcl_GetChannelBufferSize \ + (tclStubsPtr->tcl_GetChannelBufferSize) /* 152 */ +#define Tcl_GetChannelHandle \ + (tclStubsPtr->tcl_GetChannelHandle) /* 153 */ +#define Tcl_GetChannelInstanceData \ + (tclStubsPtr->tcl_GetChannelInstanceData) /* 154 */ +#define Tcl_GetChannelMode \ + (tclStubsPtr->tcl_GetChannelMode) /* 155 */ +#define Tcl_GetChannelName \ + (tclStubsPtr->tcl_GetChannelName) /* 156 */ +#define Tcl_GetChannelOption \ + (tclStubsPtr->tcl_GetChannelOption) /* 157 */ +#define Tcl_GetChannelType \ + (tclStubsPtr->tcl_GetChannelType) /* 158 */ +#define Tcl_GetCommandInfo \ + (tclStubsPtr->tcl_GetCommandInfo) /* 159 */ +#define Tcl_GetCommandName \ + (tclStubsPtr->tcl_GetCommandName) /* 160 */ +#define Tcl_GetErrno \ + (tclStubsPtr->tcl_GetErrno) /* 161 */ +#define Tcl_GetHostName \ + (tclStubsPtr->tcl_GetHostName) /* 162 */ +#define Tcl_GetInterpPath \ + (tclStubsPtr->tcl_GetInterpPath) /* 163 */ +#define Tcl_GetMaster \ + (tclStubsPtr->tcl_GetMaster) /* 164 */ +#define Tcl_GetNameOfExecutable \ + (tclStubsPtr->tcl_GetNameOfExecutable) /* 165 */ +#define Tcl_GetObjResult \ + (tclStubsPtr->tcl_GetObjResult) /* 166 */ +#if !defined(__WIN32__) && !defined(MAC_OSX_TCL) /* UNIX */ +#define Tcl_GetOpenFile \ + (tclStubsPtr->tcl_GetOpenFile) /* 167 */ +#endif /* UNIX */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_GetOpenFile \ + (tclStubsPtr->tcl_GetOpenFile) /* 167 */ +#endif /* MACOSX */ +#define Tcl_GetPathType \ + (tclStubsPtr->tcl_GetPathType) /* 168 */ +#define Tcl_Gets \ + (tclStubsPtr->tcl_Gets) /* 169 */ +#define Tcl_GetsObj \ + (tclStubsPtr->tcl_GetsObj) /* 170 */ +#define Tcl_GetServiceMode \ + (tclStubsPtr->tcl_GetServiceMode) /* 171 */ +#define Tcl_GetSlave \ + (tclStubsPtr->tcl_GetSlave) /* 172 */ +#define Tcl_GetStdChannel \ + (tclStubsPtr->tcl_GetStdChannel) /* 173 */ +#define Tcl_GetStringResult \ + (tclStubsPtr->tcl_GetStringResult) /* 174 */ +#define Tcl_GetVar \ + (tclStubsPtr->tcl_GetVar) /* 175 */ +#define Tcl_GetVar2 \ + (tclStubsPtr->tcl_GetVar2) /* 176 */ +#define Tcl_GlobalEval \ + (tclStubsPtr->tcl_GlobalEval) /* 177 */ +#define Tcl_GlobalEvalObj \ + (tclStubsPtr->tcl_GlobalEvalObj) /* 178 */ +#define Tcl_HideCommand \ + (tclStubsPtr->tcl_HideCommand) /* 179 */ +#define Tcl_Init \ + (tclStubsPtr->tcl_Init) /* 180 */ +#define Tcl_InitHashTable \ + (tclStubsPtr->tcl_InitHashTable) /* 181 */ +#define Tcl_InputBlocked \ + (tclStubsPtr->tcl_InputBlocked) /* 182 */ +#define Tcl_InputBuffered \ + (tclStubsPtr->tcl_InputBuffered) /* 183 */ +#define Tcl_InterpDeleted \ + (tclStubsPtr->tcl_InterpDeleted) /* 184 */ +#define Tcl_IsSafe \ + (tclStubsPtr->tcl_IsSafe) /* 185 */ +#define Tcl_JoinPath \ + (tclStubsPtr->tcl_JoinPath) /* 186 */ +#define Tcl_LinkVar \ + (tclStubsPtr->tcl_LinkVar) /* 187 */ +/* Slot 188 is reserved */ +#define Tcl_MakeFileChannel \ + (tclStubsPtr->tcl_MakeFileChannel) /* 189 */ +#define Tcl_MakeSafe \ + (tclStubsPtr->tcl_MakeSafe) /* 190 */ +#define Tcl_MakeTcpClientChannel \ + (tclStubsPtr->tcl_MakeTcpClientChannel) /* 191 */ +#define Tcl_Merge \ + (tclStubsPtr->tcl_Merge) /* 192 */ +#define Tcl_NextHashEntry \ + (tclStubsPtr->tcl_NextHashEntry) /* 193 */ +#define Tcl_NotifyChannel \ + (tclStubsPtr->tcl_NotifyChannel) /* 194 */ +#define Tcl_ObjGetVar2 \ + (tclStubsPtr->tcl_ObjGetVar2) /* 195 */ +#define Tcl_ObjSetVar2 \ + (tclStubsPtr->tcl_ObjSetVar2) /* 196 */ +#define Tcl_OpenCommandChannel \ + (tclStubsPtr->tcl_OpenCommandChannel) /* 197 */ +#define Tcl_OpenFileChannel \ + (tclStubsPtr->tcl_OpenFileChannel) /* 198 */ +#define Tcl_OpenTcpClient \ + (tclStubsPtr->tcl_OpenTcpClient) /* 199 */ +#define Tcl_OpenTcpServer \ + (tclStubsPtr->tcl_OpenTcpServer) /* 200 */ +#define Tcl_Preserve \ + (tclStubsPtr->tcl_Preserve) /* 201 */ +#define Tcl_PrintDouble \ + (tclStubsPtr->tcl_PrintDouble) /* 202 */ +#define Tcl_PutEnv \ + (tclStubsPtr->tcl_PutEnv) /* 203 */ +#define Tcl_PosixError \ + (tclStubsPtr->tcl_PosixError) /* 204 */ +#define Tcl_QueueEvent \ + (tclStubsPtr->tcl_QueueEvent) /* 205 */ +#define Tcl_Read \ + (tclStubsPtr->tcl_Read) /* 206 */ +#define Tcl_ReapDetachedProcs \ + (tclStubsPtr->tcl_ReapDetachedProcs) /* 207 */ +#define Tcl_RecordAndEval \ + (tclStubsPtr->tcl_RecordAndEval) /* 208 */ +#define Tcl_RecordAndEvalObj \ + (tclStubsPtr->tcl_RecordAndEvalObj) /* 209 */ +#define Tcl_RegisterChannel \ + (tclStubsPtr->tcl_RegisterChannel) /* 210 */ +#define Tcl_RegisterObjType \ + (tclStubsPtr->tcl_RegisterObjType) /* 211 */ +#define Tcl_RegExpCompile \ + (tclStubsPtr->tcl_RegExpCompile) /* 212 */ +#define Tcl_RegExpExec \ + (tclStubsPtr->tcl_RegExpExec) /* 213 */ +#define Tcl_RegExpMatch \ + (tclStubsPtr->tcl_RegExpMatch) /* 214 */ +#define Tcl_RegExpRange \ + (tclStubsPtr->tcl_RegExpRange) /* 215 */ +#define Tcl_Release \ + (tclStubsPtr->tcl_Release) /* 216 */ +#define Tcl_ResetResult \ + (tclStubsPtr->tcl_ResetResult) /* 217 */ +#define Tcl_ScanElement \ + (tclStubsPtr->tcl_ScanElement) /* 218 */ +#define Tcl_ScanCountedElement \ + (tclStubsPtr->tcl_ScanCountedElement) /* 219 */ +#define Tcl_SeekOld \ + (tclStubsPtr->tcl_SeekOld) /* 220 */ +#define Tcl_ServiceAll \ + (tclStubsPtr->tcl_ServiceAll) /* 221 */ +#define Tcl_ServiceEvent \ + (tclStubsPtr->tcl_ServiceEvent) /* 222 */ +#define Tcl_SetAssocData \ + (tclStubsPtr->tcl_SetAssocData) /* 223 */ +#define Tcl_SetChannelBufferSize \ + (tclStubsPtr->tcl_SetChannelBufferSize) /* 224 */ +#define Tcl_SetChannelOption \ + (tclStubsPtr->tcl_SetChannelOption) /* 225 */ +#define Tcl_SetCommandInfo \ + (tclStubsPtr->tcl_SetCommandInfo) /* 226 */ +#define Tcl_SetErrno \ + (tclStubsPtr->tcl_SetErrno) /* 227 */ +#define Tcl_SetErrorCode \ + (tclStubsPtr->tcl_SetErrorCode) /* 228 */ +#define Tcl_SetMaxBlockTime \ + (tclStubsPtr->tcl_SetMaxBlockTime) /* 229 */ +#define Tcl_SetPanicProc \ + (tclStubsPtr->tcl_SetPanicProc) /* 230 */ +#define Tcl_SetRecursionLimit \ + (tclStubsPtr->tcl_SetRecursionLimit) /* 231 */ +#define Tcl_SetResult \ + (tclStubsPtr->tcl_SetResult) /* 232 */ +#define Tcl_SetServiceMode \ + (tclStubsPtr->tcl_SetServiceMode) /* 233 */ +#define Tcl_SetObjErrorCode \ + (tclStubsPtr->tcl_SetObjErrorCode) /* 234 */ +#define Tcl_SetObjResult \ + (tclStubsPtr->tcl_SetObjResult) /* 235 */ +#define Tcl_SetStdChannel \ + (tclStubsPtr->tcl_SetStdChannel) /* 236 */ +#define Tcl_SetVar \ + (tclStubsPtr->tcl_SetVar) /* 237 */ +#define Tcl_SetVar2 \ + (tclStubsPtr->tcl_SetVar2) /* 238 */ +#define Tcl_SignalId \ + (tclStubsPtr->tcl_SignalId) /* 239 */ +#define Tcl_SignalMsg \ + (tclStubsPtr->tcl_SignalMsg) /* 240 */ +#define Tcl_SourceRCFile \ + (tclStubsPtr->tcl_SourceRCFile) /* 241 */ +#define Tcl_SplitList \ + (tclStubsPtr->tcl_SplitList) /* 242 */ +#define Tcl_SplitPath \ + (tclStubsPtr->tcl_SplitPath) /* 243 */ +#define Tcl_StaticPackage \ + (tclStubsPtr->tcl_StaticPackage) /* 244 */ +#define Tcl_StringMatch \ + (tclStubsPtr->tcl_StringMatch) /* 245 */ +#define Tcl_TellOld \ + (tclStubsPtr->tcl_TellOld) /* 246 */ +#define Tcl_TraceVar \ + (tclStubsPtr->tcl_TraceVar) /* 247 */ +#define Tcl_TraceVar2 \ + (tclStubsPtr->tcl_TraceVar2) /* 248 */ +#define Tcl_TranslateFileName \ + (tclStubsPtr->tcl_TranslateFileName) /* 249 */ +#define Tcl_Ungets \ + (tclStubsPtr->tcl_Ungets) /* 250 */ +#define Tcl_UnlinkVar \ + (tclStubsPtr->tcl_UnlinkVar) /* 251 */ +#define Tcl_UnregisterChannel \ + (tclStubsPtr->tcl_UnregisterChannel) /* 252 */ +#define Tcl_UnsetVar \ + (tclStubsPtr->tcl_UnsetVar) /* 253 */ +#define Tcl_UnsetVar2 \ + (tclStubsPtr->tcl_UnsetVar2) /* 254 */ +#define Tcl_UntraceVar \ + (tclStubsPtr->tcl_UntraceVar) /* 255 */ +#define Tcl_UntraceVar2 \ + (tclStubsPtr->tcl_UntraceVar2) /* 256 */ +#define Tcl_UpdateLinkedVar \ + (tclStubsPtr->tcl_UpdateLinkedVar) /* 257 */ +#define Tcl_UpVar \ + (tclStubsPtr->tcl_UpVar) /* 258 */ +#define Tcl_UpVar2 \ + (tclStubsPtr->tcl_UpVar2) /* 259 */ +#define Tcl_VarEval \ + (tclStubsPtr->tcl_VarEval) /* 260 */ +#define Tcl_VarTraceInfo \ + (tclStubsPtr->tcl_VarTraceInfo) /* 261 */ +#define Tcl_VarTraceInfo2 \ + (tclStubsPtr->tcl_VarTraceInfo2) /* 262 */ +#define Tcl_Write \ + (tclStubsPtr->tcl_Write) /* 263 */ +#define Tcl_WrongNumArgs \ + (tclStubsPtr->tcl_WrongNumArgs) /* 264 */ +#define Tcl_DumpActiveMemory \ + (tclStubsPtr->tcl_DumpActiveMemory) /* 265 */ +#define Tcl_ValidateAllMemory \ + (tclStubsPtr->tcl_ValidateAllMemory) /* 266 */ +#define Tcl_AppendResultVA \ + (tclStubsPtr->tcl_AppendResultVA) /* 267 */ +#define Tcl_AppendStringsToObjVA \ + (tclStubsPtr->tcl_AppendStringsToObjVA) /* 268 */ +#define Tcl_HashStats \ + (tclStubsPtr->tcl_HashStats) /* 269 */ +#define Tcl_ParseVar \ + (tclStubsPtr->tcl_ParseVar) /* 270 */ +#define Tcl_PkgPresent \ + (tclStubsPtr->tcl_PkgPresent) /* 271 */ +#define Tcl_PkgPresentEx \ + (tclStubsPtr->tcl_PkgPresentEx) /* 272 */ +#define Tcl_PkgProvide \ + (tclStubsPtr->tcl_PkgProvide) /* 273 */ +#define Tcl_PkgRequire \ + (tclStubsPtr->tcl_PkgRequire) /* 274 */ +#define Tcl_SetErrorCodeVA \ + (tclStubsPtr->tcl_SetErrorCodeVA) /* 275 */ +#define Tcl_VarEvalVA \ + (tclStubsPtr->tcl_VarEvalVA) /* 276 */ +#define Tcl_WaitPid \ + (tclStubsPtr->tcl_WaitPid) /* 277 */ +#define Tcl_PanicVA \ + (tclStubsPtr->tcl_PanicVA) /* 278 */ +#define Tcl_GetVersion \ + (tclStubsPtr->tcl_GetVersion) /* 279 */ +#define Tcl_InitMemory \ + (tclStubsPtr->tcl_InitMemory) /* 280 */ +#define Tcl_StackChannel \ + (tclStubsPtr->tcl_StackChannel) /* 281 */ +#define Tcl_UnstackChannel \ + (tclStubsPtr->tcl_UnstackChannel) /* 282 */ +#define Tcl_GetStackedChannel \ + (tclStubsPtr->tcl_GetStackedChannel) /* 283 */ +#define Tcl_SetMainLoop \ + (tclStubsPtr->tcl_SetMainLoop) /* 284 */ +/* Slot 285 is reserved */ +#define Tcl_AppendObjToObj \ + (tclStubsPtr->tcl_AppendObjToObj) /* 286 */ +#define Tcl_CreateEncoding \ + (tclStubsPtr->tcl_CreateEncoding) /* 287 */ +#define Tcl_CreateThreadExitHandler \ + (tclStubsPtr->tcl_CreateThreadExitHandler) /* 288 */ +#define Tcl_DeleteThreadExitHandler \ + (tclStubsPtr->tcl_DeleteThreadExitHandler) /* 289 */ +#define Tcl_DiscardResult \ + (tclStubsPtr->tcl_DiscardResult) /* 290 */ +#define Tcl_EvalEx \ + (tclStubsPtr->tcl_EvalEx) /* 291 */ +#define Tcl_EvalObjv \ + (tclStubsPtr->tcl_EvalObjv) /* 292 */ +#define Tcl_EvalObjEx \ + (tclStubsPtr->tcl_EvalObjEx) /* 293 */ +#define Tcl_ExitThread \ + (tclStubsPtr->tcl_ExitThread) /* 294 */ +#define Tcl_ExternalToUtf \ + (tclStubsPtr->tcl_ExternalToUtf) /* 295 */ +#define Tcl_ExternalToUtfDString \ + (tclStubsPtr->tcl_ExternalToUtfDString) /* 296 */ +#define Tcl_FinalizeThread \ + (tclStubsPtr->tcl_FinalizeThread) /* 297 */ +#define Tcl_FinalizeNotifier \ + (tclStubsPtr->tcl_FinalizeNotifier) /* 298 */ +#define Tcl_FreeEncoding \ + (tclStubsPtr->tcl_FreeEncoding) /* 299 */ +#define Tcl_GetCurrentThread \ + (tclStubsPtr->tcl_GetCurrentThread) /* 300 */ +#define Tcl_GetEncoding \ + (tclStubsPtr->tcl_GetEncoding) /* 301 */ +#define Tcl_GetEncodingName \ + (tclStubsPtr->tcl_GetEncodingName) /* 302 */ +#define Tcl_GetEncodingNames \ + (tclStubsPtr->tcl_GetEncodingNames) /* 303 */ +#define Tcl_GetIndexFromObjStruct \ + (tclStubsPtr->tcl_GetIndexFromObjStruct) /* 304 */ +#define Tcl_GetThreadData \ + (tclStubsPtr->tcl_GetThreadData) /* 305 */ +#define Tcl_GetVar2Ex \ + (tclStubsPtr->tcl_GetVar2Ex) /* 306 */ +#define Tcl_InitNotifier \ + (tclStubsPtr->tcl_InitNotifier) /* 307 */ +#define Tcl_MutexLock \ + (tclStubsPtr->tcl_MutexLock) /* 308 */ +#define Tcl_MutexUnlock \ + (tclStubsPtr->tcl_MutexUnlock) /* 309 */ +#define Tcl_ConditionNotify \ + (tclStubsPtr->tcl_ConditionNotify) /* 310 */ +#define Tcl_ConditionWait \ + (tclStubsPtr->tcl_ConditionWait) /* 311 */ +#define Tcl_NumUtfChars \ + (tclStubsPtr->tcl_NumUtfChars) /* 312 */ +#define Tcl_ReadChars \ + (tclStubsPtr->tcl_ReadChars) /* 313 */ +#define Tcl_RestoreResult \ + (tclStubsPtr->tcl_RestoreResult) /* 314 */ +#define Tcl_SaveResult \ + (tclStubsPtr->tcl_SaveResult) /* 315 */ +#define Tcl_SetSystemEncoding \ + (tclStubsPtr->tcl_SetSystemEncoding) /* 316 */ +#define Tcl_SetVar2Ex \ + (tclStubsPtr->tcl_SetVar2Ex) /* 317 */ +#define Tcl_ThreadAlert \ + (tclStubsPtr->tcl_ThreadAlert) /* 318 */ +#define Tcl_ThreadQueueEvent \ + (tclStubsPtr->tcl_ThreadQueueEvent) /* 319 */ +#define Tcl_UniCharAtIndex \ + (tclStubsPtr->tcl_UniCharAtIndex) /* 320 */ +#define Tcl_UniCharToLower \ + (tclStubsPtr->tcl_UniCharToLower) /* 321 */ +#define Tcl_UniCharToTitle \ + (tclStubsPtr->tcl_UniCharToTitle) /* 322 */ +#define Tcl_UniCharToUpper \ + (tclStubsPtr->tcl_UniCharToUpper) /* 323 */ +#define Tcl_UniCharToUtf \ + (tclStubsPtr->tcl_UniCharToUtf) /* 324 */ +#define Tcl_UtfAtIndex \ + (tclStubsPtr->tcl_UtfAtIndex) /* 325 */ +#define Tcl_UtfCharComplete \ + (tclStubsPtr->tcl_UtfCharComplete) /* 326 */ +#define Tcl_UtfBackslash \ + (tclStubsPtr->tcl_UtfBackslash) /* 327 */ +#define Tcl_UtfFindFirst \ + (tclStubsPtr->tcl_UtfFindFirst) /* 328 */ +#define Tcl_UtfFindLast \ + (tclStubsPtr->tcl_UtfFindLast) /* 329 */ +#define Tcl_UtfNext \ + (tclStubsPtr->tcl_UtfNext) /* 330 */ +#define Tcl_UtfPrev \ + (tclStubsPtr->tcl_UtfPrev) /* 331 */ +#define Tcl_UtfToExternal \ + (tclStubsPtr->tcl_UtfToExternal) /* 332 */ +#define Tcl_UtfToExternalDString \ + (tclStubsPtr->tcl_UtfToExternalDString) /* 333 */ +#define Tcl_UtfToLower \ + (tclStubsPtr->tcl_UtfToLower) /* 334 */ +#define Tcl_UtfToTitle \ + (tclStubsPtr->tcl_UtfToTitle) /* 335 */ +#define Tcl_UtfToUniChar \ + (tclStubsPtr->tcl_UtfToUniChar) /* 336 */ +#define Tcl_UtfToUpper \ + (tclStubsPtr->tcl_UtfToUpper) /* 337 */ +#define Tcl_WriteChars \ + (tclStubsPtr->tcl_WriteChars) /* 338 */ +#define Tcl_WriteObj \ + (tclStubsPtr->tcl_WriteObj) /* 339 */ +#define Tcl_GetString \ + (tclStubsPtr->tcl_GetString) /* 340 */ +#define Tcl_GetDefaultEncodingDir \ + (tclStubsPtr->tcl_GetDefaultEncodingDir) /* 341 */ +#define Tcl_SetDefaultEncodingDir \ + (tclStubsPtr->tcl_SetDefaultEncodingDir) /* 342 */ +#define Tcl_AlertNotifier \ + (tclStubsPtr->tcl_AlertNotifier) /* 343 */ +#define Tcl_ServiceModeHook \ + (tclStubsPtr->tcl_ServiceModeHook) /* 344 */ +#define Tcl_UniCharIsAlnum \ + (tclStubsPtr->tcl_UniCharIsAlnum) /* 345 */ +#define Tcl_UniCharIsAlpha \ + (tclStubsPtr->tcl_UniCharIsAlpha) /* 346 */ +#define Tcl_UniCharIsDigit \ + (tclStubsPtr->tcl_UniCharIsDigit) /* 347 */ +#define Tcl_UniCharIsLower \ + (tclStubsPtr->tcl_UniCharIsLower) /* 348 */ +#define Tcl_UniCharIsSpace \ + (tclStubsPtr->tcl_UniCharIsSpace) /* 349 */ +#define Tcl_UniCharIsUpper \ + (tclStubsPtr->tcl_UniCharIsUpper) /* 350 */ +#define Tcl_UniCharIsWordChar \ + (tclStubsPtr->tcl_UniCharIsWordChar) /* 351 */ +#define Tcl_UniCharLen \ + (tclStubsPtr->tcl_UniCharLen) /* 352 */ +#define Tcl_UniCharNcmp \ + (tclStubsPtr->tcl_UniCharNcmp) /* 353 */ +#define Tcl_UniCharToUtfDString \ + (tclStubsPtr->tcl_UniCharToUtfDString) /* 354 */ +#define Tcl_UtfToUniCharDString \ + (tclStubsPtr->tcl_UtfToUniCharDString) /* 355 */ +#define Tcl_GetRegExpFromObj \ + (tclStubsPtr->tcl_GetRegExpFromObj) /* 356 */ +#define Tcl_EvalTokens \ + (tclStubsPtr->tcl_EvalTokens) /* 357 */ +#define Tcl_FreeParse \ + (tclStubsPtr->tcl_FreeParse) /* 358 */ +#define Tcl_LogCommandInfo \ + (tclStubsPtr->tcl_LogCommandInfo) /* 359 */ +#define Tcl_ParseBraces \ + (tclStubsPtr->tcl_ParseBraces) /* 360 */ +#define Tcl_ParseCommand \ + (tclStubsPtr->tcl_ParseCommand) /* 361 */ +#define Tcl_ParseExpr \ + (tclStubsPtr->tcl_ParseExpr) /* 362 */ +#define Tcl_ParseQuotedString \ + (tclStubsPtr->tcl_ParseQuotedString) /* 363 */ +#define Tcl_ParseVarName \ + (tclStubsPtr->tcl_ParseVarName) /* 364 */ +#define Tcl_GetCwd \ + (tclStubsPtr->tcl_GetCwd) /* 365 */ +#define Tcl_Chdir \ + (tclStubsPtr->tcl_Chdir) /* 366 */ +#define Tcl_Access \ + (tclStubsPtr->tcl_Access) /* 367 */ +#define Tcl_Stat \ + (tclStubsPtr->tcl_Stat) /* 368 */ +#define Tcl_UtfNcmp \ + (tclStubsPtr->tcl_UtfNcmp) /* 369 */ +#define Tcl_UtfNcasecmp \ + (tclStubsPtr->tcl_UtfNcasecmp) /* 370 */ +#define Tcl_StringCaseMatch \ + (tclStubsPtr->tcl_StringCaseMatch) /* 371 */ +#define Tcl_UniCharIsControl \ + (tclStubsPtr->tcl_UniCharIsControl) /* 372 */ +#define Tcl_UniCharIsGraph \ + (tclStubsPtr->tcl_UniCharIsGraph) /* 373 */ +#define Tcl_UniCharIsPrint \ + (tclStubsPtr->tcl_UniCharIsPrint) /* 374 */ +#define Tcl_UniCharIsPunct \ + (tclStubsPtr->tcl_UniCharIsPunct) /* 375 */ +#define Tcl_RegExpExecObj \ + (tclStubsPtr->tcl_RegExpExecObj) /* 376 */ +#define Tcl_RegExpGetInfo \ + (tclStubsPtr->tcl_RegExpGetInfo) /* 377 */ +#define Tcl_NewUnicodeObj \ + (tclStubsPtr->tcl_NewUnicodeObj) /* 378 */ +#define Tcl_SetUnicodeObj \ + (tclStubsPtr->tcl_SetUnicodeObj) /* 379 */ +#define Tcl_GetCharLength \ + (tclStubsPtr->tcl_GetCharLength) /* 380 */ +#define Tcl_GetUniChar \ + (tclStubsPtr->tcl_GetUniChar) /* 381 */ +#define Tcl_GetUnicode \ + (tclStubsPtr->tcl_GetUnicode) /* 382 */ +#define Tcl_GetRange \ + (tclStubsPtr->tcl_GetRange) /* 383 */ +#define Tcl_AppendUnicodeToObj \ + (tclStubsPtr->tcl_AppendUnicodeToObj) /* 384 */ +#define Tcl_RegExpMatchObj \ + (tclStubsPtr->tcl_RegExpMatchObj) /* 385 */ +#define Tcl_SetNotifier \ + (tclStubsPtr->tcl_SetNotifier) /* 386 */ +#define Tcl_GetAllocMutex \ + (tclStubsPtr->tcl_GetAllocMutex) /* 387 */ +#define Tcl_GetChannelNames \ + (tclStubsPtr->tcl_GetChannelNames) /* 388 */ +#define Tcl_GetChannelNamesEx \ + (tclStubsPtr->tcl_GetChannelNamesEx) /* 389 */ +#define Tcl_ProcObjCmd \ + (tclStubsPtr->tcl_ProcObjCmd) /* 390 */ +#define Tcl_ConditionFinalize \ + (tclStubsPtr->tcl_ConditionFinalize) /* 391 */ +#define Tcl_MutexFinalize \ + (tclStubsPtr->tcl_MutexFinalize) /* 392 */ +#define Tcl_CreateThread \ + (tclStubsPtr->tcl_CreateThread) /* 393 */ +#define Tcl_ReadRaw \ + (tclStubsPtr->tcl_ReadRaw) /* 394 */ +#define Tcl_WriteRaw \ + (tclStubsPtr->tcl_WriteRaw) /* 395 */ +#define Tcl_GetTopChannel \ + (tclStubsPtr->tcl_GetTopChannel) /* 396 */ +#define Tcl_ChannelBuffered \ + (tclStubsPtr->tcl_ChannelBuffered) /* 397 */ +#define Tcl_ChannelName \ + (tclStubsPtr->tcl_ChannelName) /* 398 */ +#define Tcl_ChannelVersion \ + (tclStubsPtr->tcl_ChannelVersion) /* 399 */ +#define Tcl_ChannelBlockModeProc \ + (tclStubsPtr->tcl_ChannelBlockModeProc) /* 400 */ +#define Tcl_ChannelCloseProc \ + (tclStubsPtr->tcl_ChannelCloseProc) /* 401 */ +#define Tcl_ChannelClose2Proc \ + (tclStubsPtr->tcl_ChannelClose2Proc) /* 402 */ +#define Tcl_ChannelInputProc \ + (tclStubsPtr->tcl_ChannelInputProc) /* 403 */ +#define Tcl_ChannelOutputProc \ + (tclStubsPtr->tcl_ChannelOutputProc) /* 404 */ +#define Tcl_ChannelSeekProc \ + (tclStubsPtr->tcl_ChannelSeekProc) /* 405 */ +#define Tcl_ChannelSetOptionProc \ + (tclStubsPtr->tcl_ChannelSetOptionProc) /* 406 */ +#define Tcl_ChannelGetOptionProc \ + (tclStubsPtr->tcl_ChannelGetOptionProc) /* 407 */ +#define Tcl_ChannelWatchProc \ + (tclStubsPtr->tcl_ChannelWatchProc) /* 408 */ +#define Tcl_ChannelGetHandleProc \ + (tclStubsPtr->tcl_ChannelGetHandleProc) /* 409 */ +#define Tcl_ChannelFlushProc \ + (tclStubsPtr->tcl_ChannelFlushProc) /* 410 */ +#define Tcl_ChannelHandlerProc \ + (tclStubsPtr->tcl_ChannelHandlerProc) /* 411 */ +#define Tcl_JoinThread \ + (tclStubsPtr->tcl_JoinThread) /* 412 */ +#define Tcl_IsChannelShared \ + (tclStubsPtr->tcl_IsChannelShared) /* 413 */ +#define Tcl_IsChannelRegistered \ + (tclStubsPtr->tcl_IsChannelRegistered) /* 414 */ +#define Tcl_CutChannel \ + (tclStubsPtr->tcl_CutChannel) /* 415 */ +#define Tcl_SpliceChannel \ + (tclStubsPtr->tcl_SpliceChannel) /* 416 */ +#define Tcl_ClearChannelHandlers \ + (tclStubsPtr->tcl_ClearChannelHandlers) /* 417 */ +#define Tcl_IsChannelExisting \ + (tclStubsPtr->tcl_IsChannelExisting) /* 418 */ +#define Tcl_UniCharNcasecmp \ + (tclStubsPtr->tcl_UniCharNcasecmp) /* 419 */ +#define Tcl_UniCharCaseMatch \ + (tclStubsPtr->tcl_UniCharCaseMatch) /* 420 */ +#define Tcl_FindHashEntry \ + (tclStubsPtr->tcl_FindHashEntry) /* 421 */ +#define Tcl_CreateHashEntry \ + (tclStubsPtr->tcl_CreateHashEntry) /* 422 */ +#define Tcl_InitCustomHashTable \ + (tclStubsPtr->tcl_InitCustomHashTable) /* 423 */ +#define Tcl_InitObjHashTable \ + (tclStubsPtr->tcl_InitObjHashTable) /* 424 */ +#define Tcl_CommandTraceInfo \ + (tclStubsPtr->tcl_CommandTraceInfo) /* 425 */ +#define Tcl_TraceCommand \ + (tclStubsPtr->tcl_TraceCommand) /* 426 */ +#define Tcl_UntraceCommand \ + (tclStubsPtr->tcl_UntraceCommand) /* 427 */ +#define Tcl_AttemptAlloc \ + (tclStubsPtr->tcl_AttemptAlloc) /* 428 */ +#define Tcl_AttemptDbCkalloc \ + (tclStubsPtr->tcl_AttemptDbCkalloc) /* 429 */ +#define Tcl_AttemptRealloc \ + (tclStubsPtr->tcl_AttemptRealloc) /* 430 */ +#define Tcl_AttemptDbCkrealloc \ + (tclStubsPtr->tcl_AttemptDbCkrealloc) /* 431 */ +#define Tcl_AttemptSetObjLength \ + (tclStubsPtr->tcl_AttemptSetObjLength) /* 432 */ +#define Tcl_GetChannelThread \ + (tclStubsPtr->tcl_GetChannelThread) /* 433 */ +#define Tcl_GetUnicodeFromObj \ + (tclStubsPtr->tcl_GetUnicodeFromObj) /* 434 */ +#define Tcl_GetMathFuncInfo \ + (tclStubsPtr->tcl_GetMathFuncInfo) /* 435 */ +#define Tcl_ListMathFuncs \ + (tclStubsPtr->tcl_ListMathFuncs) /* 436 */ +#define Tcl_SubstObj \ + (tclStubsPtr->tcl_SubstObj) /* 437 */ +#define Tcl_DetachChannel \ + (tclStubsPtr->tcl_DetachChannel) /* 438 */ +#define Tcl_IsStandardChannel \ + (tclStubsPtr->tcl_IsStandardChannel) /* 439 */ +#define Tcl_FSCopyFile \ + (tclStubsPtr->tcl_FSCopyFile) /* 440 */ +#define Tcl_FSCopyDirectory \ + (tclStubsPtr->tcl_FSCopyDirectory) /* 441 */ +#define Tcl_FSCreateDirectory \ + (tclStubsPtr->tcl_FSCreateDirectory) /* 442 */ +#define Tcl_FSDeleteFile \ + (tclStubsPtr->tcl_FSDeleteFile) /* 443 */ +#define Tcl_FSLoadFile \ + (tclStubsPtr->tcl_FSLoadFile) /* 444 */ +#define Tcl_FSMatchInDirectory \ + (tclStubsPtr->tcl_FSMatchInDirectory) /* 445 */ +#define Tcl_FSLink \ + (tclStubsPtr->tcl_FSLink) /* 446 */ +#define Tcl_FSRemoveDirectory \ + (tclStubsPtr->tcl_FSRemoveDirectory) /* 447 */ +#define Tcl_FSRenameFile \ + (tclStubsPtr->tcl_FSRenameFile) /* 448 */ +#define Tcl_FSLstat \ + (tclStubsPtr->tcl_FSLstat) /* 449 */ +#define Tcl_FSUtime \ + (tclStubsPtr->tcl_FSUtime) /* 450 */ +#define Tcl_FSFileAttrsGet \ + (tclStubsPtr->tcl_FSFileAttrsGet) /* 451 */ +#define Tcl_FSFileAttrsSet \ + (tclStubsPtr->tcl_FSFileAttrsSet) /* 452 */ +#define Tcl_FSFileAttrStrings \ + (tclStubsPtr->tcl_FSFileAttrStrings) /* 453 */ +#define Tcl_FSStat \ + (tclStubsPtr->tcl_FSStat) /* 454 */ +#define Tcl_FSAccess \ + (tclStubsPtr->tcl_FSAccess) /* 455 */ +#define Tcl_FSOpenFileChannel \ + (tclStubsPtr->tcl_FSOpenFileChannel) /* 456 */ +#define Tcl_FSGetCwd \ + (tclStubsPtr->tcl_FSGetCwd) /* 457 */ +#define Tcl_FSChdir \ + (tclStubsPtr->tcl_FSChdir) /* 458 */ +#define Tcl_FSConvertToPathType \ + (tclStubsPtr->tcl_FSConvertToPathType) /* 459 */ +#define Tcl_FSJoinPath \ + (tclStubsPtr->tcl_FSJoinPath) /* 460 */ +#define Tcl_FSSplitPath \ + (tclStubsPtr->tcl_FSSplitPath) /* 461 */ +#define Tcl_FSEqualPaths \ + (tclStubsPtr->tcl_FSEqualPaths) /* 462 */ +#define Tcl_FSGetNormalizedPath \ + (tclStubsPtr->tcl_FSGetNormalizedPath) /* 463 */ +#define Tcl_FSJoinToPath \ + (tclStubsPtr->tcl_FSJoinToPath) /* 464 */ +#define Tcl_FSGetInternalRep \ + (tclStubsPtr->tcl_FSGetInternalRep) /* 465 */ +#define Tcl_FSGetTranslatedPath \ + (tclStubsPtr->tcl_FSGetTranslatedPath) /* 466 */ +#define Tcl_FSEvalFile \ + (tclStubsPtr->tcl_FSEvalFile) /* 467 */ +#define Tcl_FSNewNativePath \ + (tclStubsPtr->tcl_FSNewNativePath) /* 468 */ +#define Tcl_FSGetNativePath \ + (tclStubsPtr->tcl_FSGetNativePath) /* 469 */ +#define Tcl_FSFileSystemInfo \ + (tclStubsPtr->tcl_FSFileSystemInfo) /* 470 */ +#define Tcl_FSPathSeparator \ + (tclStubsPtr->tcl_FSPathSeparator) /* 471 */ +#define Tcl_FSListVolumes \ + (tclStubsPtr->tcl_FSListVolumes) /* 472 */ +#define Tcl_FSRegister \ + (tclStubsPtr->tcl_FSRegister) /* 473 */ +#define Tcl_FSUnregister \ + (tclStubsPtr->tcl_FSUnregister) /* 474 */ +#define Tcl_FSData \ + (tclStubsPtr->tcl_FSData) /* 475 */ +#define Tcl_FSGetTranslatedStringPath \ + (tclStubsPtr->tcl_FSGetTranslatedStringPath) /* 476 */ +#define Tcl_FSGetFileSystemForPath \ + (tclStubsPtr->tcl_FSGetFileSystemForPath) /* 477 */ +#define Tcl_FSGetPathType \ + (tclStubsPtr->tcl_FSGetPathType) /* 478 */ +#define Tcl_OutputBuffered \ + (tclStubsPtr->tcl_OutputBuffered) /* 479 */ +#define Tcl_FSMountsChanged \ + (tclStubsPtr->tcl_FSMountsChanged) /* 480 */ +#define Tcl_EvalTokensStandard \ + (tclStubsPtr->tcl_EvalTokensStandard) /* 481 */ +#define Tcl_GetTime \ + (tclStubsPtr->tcl_GetTime) /* 482 */ +#define Tcl_CreateObjTrace \ + (tclStubsPtr->tcl_CreateObjTrace) /* 483 */ +#define Tcl_GetCommandInfoFromToken \ + (tclStubsPtr->tcl_GetCommandInfoFromToken) /* 484 */ +#define Tcl_SetCommandInfoFromToken \ + (tclStubsPtr->tcl_SetCommandInfoFromToken) /* 485 */ +#define Tcl_DbNewWideIntObj \ + (tclStubsPtr->tcl_DbNewWideIntObj) /* 486 */ +#define Tcl_GetWideIntFromObj \ + (tclStubsPtr->tcl_GetWideIntFromObj) /* 487 */ +#define Tcl_NewWideIntObj \ + (tclStubsPtr->tcl_NewWideIntObj) /* 488 */ +#define Tcl_SetWideIntObj \ + (tclStubsPtr->tcl_SetWideIntObj) /* 489 */ +#define Tcl_AllocStatBuf \ + (tclStubsPtr->tcl_AllocStatBuf) /* 490 */ +#define Tcl_Seek \ + (tclStubsPtr->tcl_Seek) /* 491 */ +#define Tcl_Tell \ + (tclStubsPtr->tcl_Tell) /* 492 */ +#define Tcl_ChannelWideSeekProc \ + (tclStubsPtr->tcl_ChannelWideSeekProc) /* 493 */ +#define Tcl_DictObjPut \ + (tclStubsPtr->tcl_DictObjPut) /* 494 */ +#define Tcl_DictObjGet \ + (tclStubsPtr->tcl_DictObjGet) /* 495 */ +#define Tcl_DictObjRemove \ + (tclStubsPtr->tcl_DictObjRemove) /* 496 */ +#define Tcl_DictObjSize \ + (tclStubsPtr->tcl_DictObjSize) /* 497 */ +#define Tcl_DictObjFirst \ + (tclStubsPtr->tcl_DictObjFirst) /* 498 */ +#define Tcl_DictObjNext \ + (tclStubsPtr->tcl_DictObjNext) /* 499 */ +#define Tcl_DictObjDone \ + (tclStubsPtr->tcl_DictObjDone) /* 500 */ +#define Tcl_DictObjPutKeyList \ + (tclStubsPtr->tcl_DictObjPutKeyList) /* 501 */ +#define Tcl_DictObjRemoveKeyList \ + (tclStubsPtr->tcl_DictObjRemoveKeyList) /* 502 */ +#define Tcl_NewDictObj \ + (tclStubsPtr->tcl_NewDictObj) /* 503 */ +#define Tcl_DbNewDictObj \ + (tclStubsPtr->tcl_DbNewDictObj) /* 504 */ +#define Tcl_RegisterConfig \ + (tclStubsPtr->tcl_RegisterConfig) /* 505 */ +#define Tcl_CreateNamespace \ + (tclStubsPtr->tcl_CreateNamespace) /* 506 */ +#define Tcl_DeleteNamespace \ + (tclStubsPtr->tcl_DeleteNamespace) /* 507 */ +#define Tcl_AppendExportList \ + (tclStubsPtr->tcl_AppendExportList) /* 508 */ +#define Tcl_Export \ + (tclStubsPtr->tcl_Export) /* 509 */ +#define Tcl_Import \ + (tclStubsPtr->tcl_Import) /* 510 */ +#define Tcl_ForgetImport \ + (tclStubsPtr->tcl_ForgetImport) /* 511 */ +#define Tcl_GetCurrentNamespace \ + (tclStubsPtr->tcl_GetCurrentNamespace) /* 512 */ +#define Tcl_GetGlobalNamespace \ + (tclStubsPtr->tcl_GetGlobalNamespace) /* 513 */ +#define Tcl_FindNamespace \ + (tclStubsPtr->tcl_FindNamespace) /* 514 */ +#define Tcl_FindCommand \ + (tclStubsPtr->tcl_FindCommand) /* 515 */ +#define Tcl_GetCommandFromObj \ + (tclStubsPtr->tcl_GetCommandFromObj) /* 516 */ +#define Tcl_GetCommandFullName \ + (tclStubsPtr->tcl_GetCommandFullName) /* 517 */ +#define Tcl_FSEvalFileEx \ + (tclStubsPtr->tcl_FSEvalFileEx) /* 518 */ +#define Tcl_SetExitProc \ + (tclStubsPtr->tcl_SetExitProc) /* 519 */ +#define Tcl_LimitAddHandler \ + (tclStubsPtr->tcl_LimitAddHandler) /* 520 */ +#define Tcl_LimitRemoveHandler \ + (tclStubsPtr->tcl_LimitRemoveHandler) /* 521 */ +#define Tcl_LimitReady \ + (tclStubsPtr->tcl_LimitReady) /* 522 */ +#define Tcl_LimitCheck \ + (tclStubsPtr->tcl_LimitCheck) /* 523 */ +#define Tcl_LimitExceeded \ + (tclStubsPtr->tcl_LimitExceeded) /* 524 */ +#define Tcl_LimitSetCommands \ + (tclStubsPtr->tcl_LimitSetCommands) /* 525 */ +#define Tcl_LimitSetTime \ + (tclStubsPtr->tcl_LimitSetTime) /* 526 */ +#define Tcl_LimitSetGranularity \ + (tclStubsPtr->tcl_LimitSetGranularity) /* 527 */ +#define Tcl_LimitTypeEnabled \ + (tclStubsPtr->tcl_LimitTypeEnabled) /* 528 */ +#define Tcl_LimitTypeExceeded \ + (tclStubsPtr->tcl_LimitTypeExceeded) /* 529 */ +#define Tcl_LimitTypeSet \ + (tclStubsPtr->tcl_LimitTypeSet) /* 530 */ +#define Tcl_LimitTypeReset \ + (tclStubsPtr->tcl_LimitTypeReset) /* 531 */ +#define Tcl_LimitGetCommands \ + (tclStubsPtr->tcl_LimitGetCommands) /* 532 */ +#define Tcl_LimitGetTime \ + (tclStubsPtr->tcl_LimitGetTime) /* 533 */ +#define Tcl_LimitGetGranularity \ + (tclStubsPtr->tcl_LimitGetGranularity) /* 534 */ +#define Tcl_SaveInterpState \ + (tclStubsPtr->tcl_SaveInterpState) /* 535 */ +#define Tcl_RestoreInterpState \ + (tclStubsPtr->tcl_RestoreInterpState) /* 536 */ +#define Tcl_DiscardInterpState \ + (tclStubsPtr->tcl_DiscardInterpState) /* 537 */ +#define Tcl_SetReturnOptions \ + (tclStubsPtr->tcl_SetReturnOptions) /* 538 */ +#define Tcl_GetReturnOptions \ + (tclStubsPtr->tcl_GetReturnOptions) /* 539 */ +#define Tcl_IsEnsemble \ + (tclStubsPtr->tcl_IsEnsemble) /* 540 */ +#define Tcl_CreateEnsemble \ + (tclStubsPtr->tcl_CreateEnsemble) /* 541 */ +#define Tcl_FindEnsemble \ + (tclStubsPtr->tcl_FindEnsemble) /* 542 */ +#define Tcl_SetEnsembleSubcommandList \ + (tclStubsPtr->tcl_SetEnsembleSubcommandList) /* 543 */ +#define Tcl_SetEnsembleMappingDict \ + (tclStubsPtr->tcl_SetEnsembleMappingDict) /* 544 */ +#define Tcl_SetEnsembleUnknownHandler \ + (tclStubsPtr->tcl_SetEnsembleUnknownHandler) /* 545 */ +#define Tcl_SetEnsembleFlags \ + (tclStubsPtr->tcl_SetEnsembleFlags) /* 546 */ +#define Tcl_GetEnsembleSubcommandList \ + (tclStubsPtr->tcl_GetEnsembleSubcommandList) /* 547 */ +#define Tcl_GetEnsembleMappingDict \ + (tclStubsPtr->tcl_GetEnsembleMappingDict) /* 548 */ +#define Tcl_GetEnsembleUnknownHandler \ + (tclStubsPtr->tcl_GetEnsembleUnknownHandler) /* 549 */ +#define Tcl_GetEnsembleFlags \ + (tclStubsPtr->tcl_GetEnsembleFlags) /* 550 */ +#define Tcl_GetEnsembleNamespace \ + (tclStubsPtr->tcl_GetEnsembleNamespace) /* 551 */ +#define Tcl_SetTimeProc \ + (tclStubsPtr->tcl_SetTimeProc) /* 552 */ +#define Tcl_QueryTimeProc \ + (tclStubsPtr->tcl_QueryTimeProc) /* 553 */ +#define Tcl_ChannelThreadActionProc \ + (tclStubsPtr->tcl_ChannelThreadActionProc) /* 554 */ +#define Tcl_NewBignumObj \ + (tclStubsPtr->tcl_NewBignumObj) /* 555 */ +#define Tcl_DbNewBignumObj \ + (tclStubsPtr->tcl_DbNewBignumObj) /* 556 */ +#define Tcl_SetBignumObj \ + (tclStubsPtr->tcl_SetBignumObj) /* 557 */ +#define Tcl_GetBignumFromObj \ + (tclStubsPtr->tcl_GetBignumFromObj) /* 558 */ +#define Tcl_TakeBignumFromObj \ + (tclStubsPtr->tcl_TakeBignumFromObj) /* 559 */ +#define Tcl_TruncateChannel \ + (tclStubsPtr->tcl_TruncateChannel) /* 560 */ +#define Tcl_ChannelTruncateProc \ + (tclStubsPtr->tcl_ChannelTruncateProc) /* 561 */ +#define Tcl_SetChannelErrorInterp \ + (tclStubsPtr->tcl_SetChannelErrorInterp) /* 562 */ +#define Tcl_GetChannelErrorInterp \ + (tclStubsPtr->tcl_GetChannelErrorInterp) /* 563 */ +#define Tcl_SetChannelError \ + (tclStubsPtr->tcl_SetChannelError) /* 564 */ +#define Tcl_GetChannelError \ + (tclStubsPtr->tcl_GetChannelError) /* 565 */ +#define Tcl_InitBignumFromDouble \ + (tclStubsPtr->tcl_InitBignumFromDouble) /* 566 */ +#define Tcl_GetNamespaceUnknownHandler \ + (tclStubsPtr->tcl_GetNamespaceUnknownHandler) /* 567 */ +#define Tcl_SetNamespaceUnknownHandler \ + (tclStubsPtr->tcl_SetNamespaceUnknownHandler) /* 568 */ +#define Tcl_GetEncodingFromObj \ + (tclStubsPtr->tcl_GetEncodingFromObj) /* 569 */ +#define Tcl_GetEncodingSearchPath \ + (tclStubsPtr->tcl_GetEncodingSearchPath) /* 570 */ +#define Tcl_SetEncodingSearchPath \ + (tclStubsPtr->tcl_SetEncodingSearchPath) /* 571 */ +#define Tcl_GetEncodingNameFromEnvironment \ + (tclStubsPtr->tcl_GetEncodingNameFromEnvironment) /* 572 */ +#define Tcl_PkgRequireProc \ + (tclStubsPtr->tcl_PkgRequireProc) /* 573 */ +#define Tcl_AppendObjToErrorInfo \ + (tclStubsPtr->tcl_AppendObjToErrorInfo) /* 574 */ +#define Tcl_AppendLimitedToObj \ + (tclStubsPtr->tcl_AppendLimitedToObj) /* 575 */ +#define Tcl_Format \ + (tclStubsPtr->tcl_Format) /* 576 */ +#define Tcl_AppendFormatToObj \ + (tclStubsPtr->tcl_AppendFormatToObj) /* 577 */ +#define Tcl_ObjPrintf \ + (tclStubsPtr->tcl_ObjPrintf) /* 578 */ +#define Tcl_AppendPrintfToObj \ + (tclStubsPtr->tcl_AppendPrintfToObj) /* 579 */ +#define Tcl_CancelEval \ + (tclStubsPtr->tcl_CancelEval) /* 580 */ +#define Tcl_Canceled \ + (tclStubsPtr->tcl_Canceled) /* 581 */ +#define Tcl_CreatePipe \ + (tclStubsPtr->tcl_CreatePipe) /* 582 */ +#define Tcl_NRCreateCommand \ + (tclStubsPtr->tcl_NRCreateCommand) /* 583 */ +#define Tcl_NREvalObj \ + (tclStubsPtr->tcl_NREvalObj) /* 584 */ +#define Tcl_NREvalObjv \ + (tclStubsPtr->tcl_NREvalObjv) /* 585 */ +#define Tcl_NRCmdSwap \ + (tclStubsPtr->tcl_NRCmdSwap) /* 586 */ +#define Tcl_NRAddCallback \ + (tclStubsPtr->tcl_NRAddCallback) /* 587 */ +#define Tcl_NRCallObjProc \ + (tclStubsPtr->tcl_NRCallObjProc) /* 588 */ +#define Tcl_GetFSDeviceFromStat \ + (tclStubsPtr->tcl_GetFSDeviceFromStat) /* 589 */ +#define Tcl_GetFSInodeFromStat \ + (tclStubsPtr->tcl_GetFSInodeFromStat) /* 590 */ +#define Tcl_GetModeFromStat \ + (tclStubsPtr->tcl_GetModeFromStat) /* 591 */ +#define Tcl_GetLinkCountFromStat \ + (tclStubsPtr->tcl_GetLinkCountFromStat) /* 592 */ +#define Tcl_GetUserIdFromStat \ + (tclStubsPtr->tcl_GetUserIdFromStat) /* 593 */ +#define Tcl_GetGroupIdFromStat \ + (tclStubsPtr->tcl_GetGroupIdFromStat) /* 594 */ +#define Tcl_GetDeviceTypeFromStat \ + (tclStubsPtr->tcl_GetDeviceTypeFromStat) /* 595 */ +#define Tcl_GetAccessTimeFromStat \ + (tclStubsPtr->tcl_GetAccessTimeFromStat) /* 596 */ +#define Tcl_GetModificationTimeFromStat \ + (tclStubsPtr->tcl_GetModificationTimeFromStat) /* 597 */ +#define Tcl_GetChangeTimeFromStat \ + (tclStubsPtr->tcl_GetChangeTimeFromStat) /* 598 */ +#define Tcl_GetSizeFromStat \ + (tclStubsPtr->tcl_GetSizeFromStat) /* 599 */ +#define Tcl_GetBlocksFromStat \ + (tclStubsPtr->tcl_GetBlocksFromStat) /* 600 */ +#define Tcl_GetBlockSizeFromStat \ + (tclStubsPtr->tcl_GetBlockSizeFromStat) /* 601 */ +#define Tcl_SetEnsembleParameterList \ + (tclStubsPtr->tcl_SetEnsembleParameterList) /* 602 */ +#define Tcl_GetEnsembleParameterList \ + (tclStubsPtr->tcl_GetEnsembleParameterList) /* 603 */ +#define Tcl_ParseArgsObjv \ + (tclStubsPtr->tcl_ParseArgsObjv) /* 604 */ +#define Tcl_GetErrorLine \ + (tclStubsPtr->tcl_GetErrorLine) /* 605 */ +#define Tcl_SetErrorLine \ + (tclStubsPtr->tcl_SetErrorLine) /* 606 */ +#define Tcl_TransferResult \ + (tclStubsPtr->tcl_TransferResult) /* 607 */ +#define Tcl_InterpActive \ + (tclStubsPtr->tcl_InterpActive) /* 608 */ +#define Tcl_BackgroundException \ + (tclStubsPtr->tcl_BackgroundException) /* 609 */ +#define Tcl_ZlibDeflate \ + (tclStubsPtr->tcl_ZlibDeflate) /* 610 */ +#define Tcl_ZlibInflate \ + (tclStubsPtr->tcl_ZlibInflate) /* 611 */ +#define Tcl_ZlibCRC32 \ + (tclStubsPtr->tcl_ZlibCRC32) /* 612 */ +#define Tcl_ZlibAdler32 \ + (tclStubsPtr->tcl_ZlibAdler32) /* 613 */ +#define Tcl_ZlibStreamInit \ + (tclStubsPtr->tcl_ZlibStreamInit) /* 614 */ +#define Tcl_ZlibStreamGetCommandName \ + (tclStubsPtr->tcl_ZlibStreamGetCommandName) /* 615 */ +#define Tcl_ZlibStreamEof \ + (tclStubsPtr->tcl_ZlibStreamEof) /* 616 */ +#define Tcl_ZlibStreamChecksum \ + (tclStubsPtr->tcl_ZlibStreamChecksum) /* 617 */ +#define Tcl_ZlibStreamPut \ + (tclStubsPtr->tcl_ZlibStreamPut) /* 618 */ +#define Tcl_ZlibStreamGet \ + (tclStubsPtr->tcl_ZlibStreamGet) /* 619 */ +#define Tcl_ZlibStreamClose \ + (tclStubsPtr->tcl_ZlibStreamClose) /* 620 */ +#define Tcl_ZlibStreamReset \ + (tclStubsPtr->tcl_ZlibStreamReset) /* 621 */ +#define Tcl_SetStartupScript \ + (tclStubsPtr->tcl_SetStartupScript) /* 622 */ +#define Tcl_GetStartupScript \ + (tclStubsPtr->tcl_GetStartupScript) /* 623 */ +#define Tcl_CloseEx \ + (tclStubsPtr->tcl_CloseEx) /* 624 */ +#define Tcl_NRExprObj \ + (tclStubsPtr->tcl_NRExprObj) /* 625 */ +#define Tcl_NRSubstObj \ + (tclStubsPtr->tcl_NRSubstObj) /* 626 */ +#define Tcl_LoadFile \ + (tclStubsPtr->tcl_LoadFile) /* 627 */ +#define Tcl_FindSymbol \ + (tclStubsPtr->tcl_FindSymbol) /* 628 */ +#define Tcl_FSUnloadFile \ + (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ +#define Tcl_ZlibStreamSetCompressionDictionary \ + (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ + +#endif /* defined(USE_TCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#if defined(USE_TCL_STUBS) +# undef Tcl_CreateInterp +# undef Tcl_FindExecutable +# undef Tcl_GetStringResult +# undef Tcl_Init +# undef Tcl_SetPanicProc +# undef Tcl_SetVar +# undef Tcl_StaticPackage +# undef TclFSGetNativePath +# define Tcl_CreateInterp() (tclStubsPtr->tcl_CreateInterp()) +# define Tcl_GetStringResult(interp) (tclStubsPtr->tcl_GetStringResult(interp)) +# define Tcl_Init(interp) (tclStubsPtr->tcl_Init(interp)) +# define Tcl_SetPanicProc(proc) (tclStubsPtr->tcl_SetPanicProc(proc)) +# define Tcl_SetVar(interp, varName, newValue, flags) \ + (tclStubsPtr->tcl_SetVar(interp, varName, newValue, flags)) +#endif + +#if defined(_WIN32) && defined(UNICODE) +# define Tcl_FindExecutable(arg) ((Tcl_FindExecutable)((const char *)(arg))) +# define Tcl_MainEx Tcl_MainExW + EXTERN void Tcl_MainExW(int argc, wchar_t **argv, + Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); +#endif + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TCLDECLS */ ADDED compat/tcl-8.6/generic/tclPlatDecls.h Index: compat/tcl-8.6/generic/tclPlatDecls.h ================================================================== --- /dev/null +++ compat/tcl-8.6/generic/tclPlatDecls.h @@ -0,0 +1,120 @@ +/* + * tclPlatDecls.h -- + * + * Declarations of platform specific Tcl APIs. + * + * Copyright (c) 1998-1999 by Scriptics Corporation. + * All rights reserved. + */ + +#ifndef _TCLPLATDECLS +#define _TCLPLATDECLS + +#undef TCL_STORAGE_CLASS +#ifdef BUILD_tcl +# define TCL_STORAGE_CLASS DLLEXPORT +#else +# ifdef USE_TCL_STUBS +# define TCL_STORAGE_CLASS +# else +# define TCL_STORAGE_CLASS DLLIMPORT +# endif +#endif + +/* + * WARNING: This file is automatically generated by the tools/genStubs.tcl + * script. Any modifications to the function declarations below should be made + * in the generic/tcl.decls script. + */ + +/* + * TCHAR is needed here for win32, so if it is not defined yet do it here. + * This way, we don't need to include just for one define. + */ +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(_TCHAR_DEFINED) +# if defined(_UNICODE) + typedef wchar_t TCHAR; +# else + typedef char TCHAR; +# endif +# define _TCHAR_DEFINED +#endif + +/* !BEGIN!: Do not edit below this line. */ + +/* + * Exported function declarations: + */ + +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +/* 0 */ +EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, int len, + Tcl_DString *dsPtr); +/* 1 */ +EXTERN char * Tcl_WinTCharToUtf(const TCHAR *str, int len, + Tcl_DString *dsPtr); +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ +/* 0 */ +EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, + const char *bundleName, int hasResourceFile, + int maxPathLen, char *libraryPath); +/* 1 */ +EXTERN int Tcl_MacOSXOpenVersionedBundleResources( + Tcl_Interp *interp, const char *bundleName, + const char *bundleVersion, + int hasResourceFile, int maxPathLen, + char *libraryPath); +#endif /* MACOSX */ + +typedef struct TclPlatStubs { + int magic; + void *hooks; + +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ + TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */ + char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */ +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ + int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */ + int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */ +#endif /* MACOSX */ +} TclPlatStubs; + +#ifdef __cplusplus +extern "C" { +#endif +extern const TclPlatStubs *tclPlatStubsPtr; +#ifdef __cplusplus +} +#endif + +#if defined(USE_TCL_STUBS) + +/* + * Inline function declarations: + */ + +#if defined(__WIN32__) || defined(__CYGWIN__) /* WIN */ +#define Tcl_WinUtfToTChar \ + (tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */ +#define Tcl_WinTCharToUtf \ + (tclPlatStubsPtr->tcl_WinTCharToUtf) /* 1 */ +#endif /* WIN */ +#ifdef MAC_OSX_TCL /* MACOSX */ +#define Tcl_MacOSXOpenBundleResources \ + (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */ +#define Tcl_MacOSXOpenVersionedBundleResources \ + (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ +#endif /* MACOSX */ + +#endif /* defined(USE_TCL_STUBS) */ + +/* !END!: Do not edit above this line. */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + +#endif /* _TCLPLATDECLS */ + + Index: compat/zlib/CMakeLists.txt ================================================================== --- compat/zlib/CMakeLists.txt +++ compat/zlib/CMakeLists.txt @@ -1,11 +1,14 @@ cmake_minimum_required(VERSION 2.4.4) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.2.7") +set(VERSION "1.2.8") + +option(ASM686 "Enable building i686 assembly implementation") +option(AMD64 "Enable building amd64 assembly implementation") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") @@ -119,38 +122,71 @@ uncompr.c zutil.c ) if(NOT MINGW) - set(ZLIB_SRCS ${ZLIB_SRCS} + set(ZLIB_DLL_SRCS win32/zlib1.rc # If present will override custom build rule below. ) endif() + +if(CMAKE_COMPILER_IS_GNUCC) + if(ASM686) + set(ZLIB_ASMS contrib/asm686/match.S) + elseif (AMD64) + set(ZLIB_ASMS contrib/amd64/amd64-match.S) + endif () + + if(ZLIB_ASMS) + add_definitions(-DASMV) + set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) + endif() +endif() + +if(MSVC) + if(ASM686) + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx86/inffas32.asm + contrib/masmx86/match686.asm + ) + elseif (AMD64) + ENABLE_LANGUAGE(ASM_MASM) + set(ZLIB_ASMS + contrib/masmx64/gvmat64.asm + contrib/masmx64/inffasx64.asm + ) + endif() + + if(ZLIB_ASMS) + add_definitions(-DASMV -DASMINF) + endif() +endif() # parse the full version number from zlib.h and include in ZLIB_FULL_VERSION file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) if(MINGW) # This gets us DLL resource information when compiling on MinGW. if(NOT CMAKE_RC_COMPILER) - SET(CMAKE_RC_COMPILER windres.exe) + set(CMAKE_RC_COMPILER windres.exe) endif() add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj COMMAND ${CMAKE_RC_COMPILER} -D GCC_WINDRES -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_CURRENT_BINARY_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_SRCS ${ZLIB_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version @@ -164,11 +200,13 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,${CMAKE_CURRENT_SOURCE_DIR}/zlib.map") + if(NOT APPLE) + set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + endif() elseif(BUILD_SHARED_LIBS AND WIN32) # Creates zlib1.dll when building shared library version set_target_properties(zlib PROPERTIES SUFFIX "1.dll") endif() Index: compat/zlib/ChangeLog ================================================================== --- compat/zlib/ChangeLog +++ compat/zlib/ChangeLog @@ -1,8 +1,71 @@ ChangeLog file for zlib +Changes in 1.2.8 (28 Apr 2013) +- Update contrib/minizip/iowin32.c for Windows RT [Vollant] +- Do not force Z_CONST for C++ +- Clean up contrib/vstudio [Ro§] +- Correct spelling error in zlib.h +- Fix mixed line endings in contrib/vstudio + +Changes in 1.2.7.3 (13 Apr 2013) +- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc + +Changes in 1.2.7.2 (13 Apr 2013) +- Change check for a four-byte type back to hexadecimal +- Fix typo in win32/Makefile.msc +- Add casts in gzwrite.c for pointer differences + +Changes in 1.2.7.1 (24 Mar 2013) +- Replace use of unsafe string functions with snprintf if available +- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink] +- Fix gzgetc undefine when Z_PREFIX set [Turk] +- Eliminate use of mktemp in Makefile (not always available) +- Fix bug in 'F' mode for gzopen() +- Add inflateGetDictionary() function +- Correct comment in deflate.h +- Use _snprintf for snprintf in Microsoft C +- On Darwin, only use /usr/bin/libtool if libtool is not Apple +- Delete "--version" file if created by "ar --version" [Richard G.] +- Fix configure check for veracity of compiler error return codes +- Fix CMake compilation of static lib for MSVC2010 x64 +- Remove unused variable in infback9.c +- Fix argument checks in gzlog_compress() and gzlog_write() +- Clean up the usage of z_const and respect const usage within zlib +- Clean up examples/gzlog.[ch] comparisons of different types +- Avoid shift equal to bits in type (caused endless loop) +- Fix unintialized value bug in gzputc() introduced by const patches +- Fix memory allocation error in examples/zran.c [Nor] +- Fix bug where gzopen(), gzclose() would write an empty file +- Fix bug in gzclose() when gzwrite() runs out of memory +- Check for input buffer malloc failure in examples/gzappend.c +- Add note to contrib/blast to use binary mode in stdio +- Fix comparisons of differently signed integers in contrib/blast +- Check for invalid code length codes in contrib/puff +- Fix serious but very rare decompression bug in inftrees.c +- Update inflateBack() comments, since inflate() can be faster +- Use underscored I/O function names for WINAPI_FAMILY +- Add _tr_flush_bits to the external symbols prefixed by --zprefix +- Add contrib/vstudio/vc10 pre-build step for static only +- Quote --version-script argument in CMakeLists.txt +- Don't specify --version-script on Apple platforms in CMakeLists.txt +- Fix casting error in contrib/testzlib/testzlib.c +- Fix types in contrib/minizip to match result of get_crc_table() +- Simplify contrib/vstudio/vc10 with 'd' suffix +- Add TOP support to win32/Makefile.msc +- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h +- Add vc11 and vc12 build files to contrib/vstudio +- Add gzvprintf() as an undocumented function in zlib +- Fix configure for Sun shell +- Remove runtime check in configure for four-byte integer type +- Add casts and consts to ease user conversion to C++ +- Add man pages for minizip and miniunzip +- In Makefile uninstall, don't rm if preceding cd fails +- Do not return Z_BUF_ERROR if deflateParam() has nothing to write + Changes in 1.2.7 (2 May 2012) - Replace use of memmove() with a simple copy for portability - Test for existence of strerror - Restore gzgetc_ for backward compatibility with 1.2.6 - Fix build with non-GNU make on Solaris Index: compat/zlib/Makefile.in ================================================================== --- compat/zlib/Makefile.in +++ compat/zlib/Makefile.in @@ -1,7 +1,7 @@ # Makefile for zlib -# Copyright (C) 1995-2011 Jean-loup Gailly. +# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: # ./configure; make test # Normally configure builds both a static and a shared library. @@ -30,11 +30,11 @@ LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.7 +SHAREDLIBV=libz.so.1.2.8 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) AR=ar ARFLAGS=rc @@ -81,11 +81,11 @@ check: test test: all teststatic testshared teststatic: static - @TMPST=`mktemp fooXXXXXX`; \ + @TMPST=tmpst_$$; \ if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ echo ' *** zlib test OK ***'; \ else \ echo ' *** zlib test FAILED ***'; false; \ fi; \ @@ -94,20 +94,20 @@ testshared: shared @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ - TMPSH=`mktemp fooXXXXXX`; \ + TMPSH=tmpsh_$$; \ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ echo ' *** zlib shared test OK ***'; \ else \ echo ' *** zlib shared test FAILED ***'; false; \ fi; \ rm -f $$TMPSH test64: all64 - @TMP64=`mktemp fooXXXXXX`; \ + @TMP64=tmp64_$$; \ if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ echo ' *** zlib 64-bit test OK ***'; \ else \ echo ' *** zlib 64-bit test FAILED ***'; false; \ fi; \ @@ -214,25 +214,25 @@ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi cp zlib.h zconf.h $(DESTDIR)$(includedir) chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h uninstall: - cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h - cd $(DESTDIR)$(libdir); rm -f libz.a; \ + cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h + cd $(DESTDIR)$(libdir) && rm -f libz.a; \ if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ fi - cd $(DESTDIR)$(man3dir); rm -f zlib.3 - cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc + cd $(DESTDIR)$(man3dir) && rm -f zlib.3 + cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc docs: zlib.3.pdf zlib.3.pdf: zlib.3 groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf zconf.h.cmakein: zconf.h.in - -@ TEMPFILE=`mktemp __XXXXXX`; \ + -@ TEMPFILE=zconfh_$$; \ echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ sed -f $$TEMPFILE zconf.h.in > zconf.h.cmakein &&\ touch -r zconf.h.in zconf.h.cmakein &&\ rm $$TEMPFILE Index: compat/zlib/README ================================================================== --- compat/zlib/README +++ compat/zlib/README @@ -1,8 +1,8 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.7 is a general purpose data compression library. All the code is +zlib 1.2.8 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). @@ -29,11 +29,11 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.7 are documented in the file ChangeLog. +The changes made in version 1.2.8 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . zlib is available in Java using the java.util.zip package, documented at http://java.sun.com/developer/technicalArticles/Programming/compression/ . @@ -82,11 +82,11 @@ people who reported problems and suggested various improvements in zlib; they are too numerous to cite here. Copyright notice: - (C) 1995-2012 Jean-loup Gailly and Mark Adler + (C) 1995-2013 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Index: compat/zlib/as400/bndsrc ================================================================== --- compat/zlib/as400/bndsrc +++ compat/zlib/as400/bndsrc @@ -199,7 +199,17 @@ /********************************************************************/ /* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ /********************************************************************/ EXPORT SYMBOL("inflateResetKeep") + +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ +/* Version 1.2.8 additional entry points. */ +/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ + +/********************************************************************/ +/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */ +/********************************************************************/ + + EXPORT SYMBOL("inflateGetDictionary") ENDPGMEXP Index: compat/zlib/as400/compile.clp ================================================================== --- compat/zlib/as400/compile.clp +++ compat/zlib/as400/compile.clp @@ -103,8 +103,8 @@ &MODLIB/INFBACK &MODLIB/INFFAST + &MODLIB/INFLATE &MODLIB/INFTREES + &MODLIB/TREES &MODLIB/UNCOMPR + &MODLIB/ZUTIL) + SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) + - TEXT('ZLIB 1.2.7') TGTRLS(&TGTRLS) + TEXT('ZLIB 1.2.8') TGTRLS(&TGTRLS) ENDPGM Index: compat/zlib/as400/readme.txt ================================================================== --- compat/zlib/as400/readme.txt +++ compat/zlib/as400/readme.txt @@ -1,6 +1,6 @@ - ZLIB version 1.2.7 for AS400 installation instructions + ZLIB version 1.2.8 for AS400 installation instructions I) From an AS400 *SAVF file: 1) Unpacking archive to an AS400 save file Index: compat/zlib/as400/zlib.inc ================================================================== --- compat/zlib/as400/zlib.inc +++ compat/zlib/as400/zlib.inc @@ -1,9 +1,9 @@ * ZLIB.INC - Interface to the general purpose compression library * * ILE RPG400 version by Patrick Monnerat, DATASPHERE. - * Version 1.2.7 + * Version 1.2.8 * * * WARNING: * Procedures inflateInit(), inflateInit2(), deflateInit(), * deflateInit2() and inflateBackInit() need to be called with @@ -20,16 +20,16 @@ * Constants ************************************************************************** * * Versioning information. * - D ZLIB_VERSION C '1.2.7' - D ZLIB_VERNUM C X'1270' + D ZLIB_VERSION C '1.2.8' + D ZLIB_VERNUM C X'1280' D ZLIB_VER_MAJOR C 1 D ZLIB_VER_MINOR C 2 D ZLIB_VER_REVISION... - D C 7 + D C 8 D ZLIB_VER_SUBREVISION... D C 0 * * Other equates. * @@ -357,10 +357,16 @@ D PR 10I 0 extproc('inflateSetDictionary') Init. dictionary D strm like(z_stream) Expansion stream D dictionary 65535 const options(*varsize) Dictionary bytes D dictLength 10U 0 value Dictionary length * + D inflateGetDictionary... + D PR 10I 0 extproc('inflateGetDictionary') Get dictionary + D strm like(z_stream) Expansion stream + D dictionary 65535 options(*varsize) Dictionary bytes + D dictLength 10U 0 Dictionary length + * D inflateSync PR 10I 0 extproc('inflateSync') Sync. expansion D strm like(z_stream) Expansion stream * D inflateCopy PR 10I 0 extproc('inflateCopy') D dest like(z_stream) Destination stream Index: compat/zlib/compress.c ================================================================== --- compat/zlib/compress.c +++ compat/zlib/compress.c @@ -27,11 +27,11 @@ int level; { z_stream stream; int err; - stream.next_in = (Bytef*)source; + stream.next_in = (z_const Bytef *)source; stream.avail_in = (uInt)sourceLen; #ifdef MAXSEG_64K /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; #endif Index: compat/zlib/configure ================================================================== --- compat/zlib/configure +++ compat/zlib/configure @@ -68,24 +68,38 @@ shared_ext='.so' shared=1 solo=0 cover=0 zprefix=0 +zconst=0 build64=0 gcc=0 old_cc="$CC" old_cflags="$CFLAGS" OBJC='$(OBJZ) $(OBJG)' PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' + +# leave this script, optionally in a bad way +leave() +{ + if test "$*" != "0"; then + echo "** $0 aborting." | tee -a configure.log + fi + rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version + echo -------------------- >> configure.log + echo >> configure.log + echo >> configure.log + exit $1 +} # process command line options while test $# -ge 1 do case "$1" in -h* | --help) echo 'usage:' | tee -a configure.log - echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log + echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log exit 0 ;; -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; @@ -104,17 +118,22 @@ -z* | --zprefix) zprefix=1; shift ;; -6* | --64) build64=1; shift ;; -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; - *) echo "unknown option: $1"; echo "$0 --help for help" | tee -a configure.log; exit 1 ;; + -c* | --const) zconst=1; shift ;; + *) + echo "unknown option: $1" | tee -a configure.log + echo "$0 --help for help" | tee -a configure.log + leave 1;; esac done -# define functions for testing compiler and library characteristics and logging the results +# temporary file name test=ztest$$ +# put arguments in log, also put test file in log if used in arguments show() { case "$*" in *$test.c*) echo === $test.c === >> configure.log @@ -122,47 +141,10 @@ echo === >> configure.log;; esac echo $* >> configure.log } -cat > $test.c </dev/null; then - try() - { - show $* - test "`( $* ) 2>&1 | tee -a configure.log`" = "" - } - echo - using any output from compiler to indicate an error >> configure.log -else - try() - { - show $* - ( $* ) >> configure.log 2>&1 - ret=$? - if test $ret -ne 0; then - echo "(exit code "$ret")" >> configure.log - fi - return $ret - } -fi - -tryboth() -{ - show $* - got=`( $* ) 2>&1` - ret=$? - printf %s "$got" >> configure.log - if test $ret -ne 0; then - return $ret - fi - test "$got" = "" -} - -echo >> configure.log - # check for gcc vs. cc and set compile and link flags based on the system identified by uname cat > $test.c <&1` in *gcc*) gcc=1 ;; esac -show $cc -c $cflags $test.c -if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then +show $cc -c $test.c +if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then echo ... using gcc >> configure.log CC="$cc" CFLAGS="${CFLAGS--O3} ${ARCHS}" SFLAGS="${CFLAGS--O3} -fPIC" LDFLAGS="${LDFLAGS} ${ARCHS}" @@ -189,11 +171,15 @@ if test $build64 -eq 1; then CFLAGS="${CFLAGS} -m64" SFLAGS="${SFLAGS} -m64" fi if test "${ZLIBGCCWARN}" = "YES"; then - CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + if test "$zconst" -eq 1; then + CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" + else + CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" + fi fi if test -z "$uname"; then uname=`(uname -s || echo unknown) 2>/dev/null` fi case "$uname" in @@ -206,11 +192,11 @@ EXE='.exe' ;; MINGW* | mingw*) # temporary bypass rm -f $test.[co] $test $test$shared_ext echo "Please use win32/Makefile.gcc instead." | tee -a configure.log - exit 1 + leave 1 LDSHARED=${LDSHARED-"$cc -shared"} LDSHAREDLIBC="" EXE='.exe' ;; QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 # (alain.bonnefoy@icbt.com) @@ -229,11 +215,15 @@ shared_ext='.dylib' SHAREDLIB=libz$shared_ext SHAREDLIBV=libz.$VER$shared_ext SHAREDLIBM=libz.$VER1$shared_ext LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} - AR="/usr/bin/libtool" + if libtool -V 2>&1 | grep Apple > /dev/null; then + AR="libtool" + else + AR="/usr/bin/libtool" + fi ARFLAGS="-o" ;; *) LDSHARED=${LDSHARED-"$cc -shared"} ;; esac else # find system name and corresponding cc options @@ -331,12 +321,66 @@ SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} echo >> configure.log + +# define functions for testing compiler and library characteristics and logging the results + +cat > $test.c </dev/null; then + try() + { + show $* + test "`( $* ) 2>&1 | tee -a configure.log`" = "" + } + echo - using any output from compiler to indicate an error >> configure.log +else +try() +{ + show $* + ( $* ) >> configure.log 2>&1 + ret=$? + if test $ret -ne 0; then + echo "(exit code "$ret")" >> configure.log + fi + return $ret +} +fi + +tryboth() +{ + show $* + got=`( $* ) 2>&1` + ret=$? + printf %s "$got" >> configure.log + if test $ret -ne 0; then + return $ret + fi + test "$got" = "" +} + +cat > $test.c << EOF +int foo() { return 0; } +EOF +echo "Checking for obsessive-compulsive compiler options..." >> configure.log +if try $CC -c $CFLAGS $test.c; then + : +else + echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log + leave 1 +fi + +echo >> configure.log # see if shared library build supported +cat > $test.c <> configure.log - # check for underscores in external names for use by assembler code CPP=${CPP-"$CC -E"} case $CFLAGS in *ASMV*) echo >> configure.log @@ -696,39 +738,10 @@ else echo "Checking for attribute(visibility) support... No." | tee -a configure.log fi fi -echo >> configure.log - -# find a four-byte unsiged integer type for crc calculations -cat > $test.c < -#define is32(n,t) for(n=1,k=0;n;n<<=1,k++);if(k==32){puts(t);return 0;} -int main() { - int k; - unsigned i; - unsigned long l; - unsigned short s; - is32(i, "unsigned") - is32(l, "unsigned long") - is32(s, "unsigned short") - return 1; -} -EOF -Z_U4="" -if try $CC $CFLAGS $test.c -o $test && Z_U4=`./$test` && test -n "$Z_U4"; then - sed < zconf.h "/#define Z_U4/s/\/\* \.\/configure may/#define Z_U4 $Z_U4 \/* .\/configure put the/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo "Looking for a four-byte integer type... Found." | tee -a configure.log -else - echo "Looking for a four-byte integer type... Not found." | tee -a configure.log -fi - -# clean up files produced by running the compiler and linker -rm -f $test.[co] $test $test$shared_ext $test.gcno - # show the results in the log echo >> configure.log echo ALL = $ALL >> configure.log echo AR = $AR >> configure.log echo ARFLAGS = $ARFLAGS >> configure.log @@ -756,13 +769,10 @@ echo libdir = $libdir >> configure.log echo mandir = $mandir >> configure.log echo prefix = $prefix >> configure.log echo sharedlibdir = $sharedlibdir >> configure.log echo uname = $uname >> configure.log -echo -------------------- >> configure.log -echo >> configure.log -echo >> configure.log # udpate Makefile with the configure results sed < Makefile.in " /^CC *=/s#=.*#=$CC# /^CFLAGS *=/s#=.*#=$CFLAGS# @@ -814,5 +824,8 @@ /^mandir *=/s#=.*#=$mandir# /^LDFLAGS *=/s#=.*#=$LDFLAGS# " | sed -e " s/\@VERSION\@/$VER/g; " > zlib.pc + +# done +leave 0 Index: compat/zlib/contrib/README.contrib ================================================================== --- compat/zlib/contrib/README.contrib +++ compat/zlib/contrib/README.contrib @@ -73,5 +73,6 @@ untgz/ by Pedro A. Aranda Gutierrez A very simple tar.gz file extractor using zlib vstudio/ by Gilles Vollant Building a minizip-enhanced zlib with Microsoft Visual Studio + Includes vc11 from kreuzerkrieg and vc12 from davispuh Index: compat/zlib/contrib/blast/blast.c ================================================================== --- compat/zlib/contrib/blast/blast.c +++ compat/zlib/contrib/blast/blast.c @@ -1,9 +1,9 @@ /* blast.c - * Copyright (C) 2003 Mark Adler + * Copyright (C) 2003, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in blast.h - * version 1.1, 16 Feb 2003 + * version 1.2, 24 Oct 2012 * * blast.c decompresses data compressed by the PKWare Compression Library. * This function provides functionality similar to the explode() function of * the PKWare library, hence the name "blast". * @@ -20,10 +20,12 @@ /* * Change history: * * 1.0 12 Feb 2003 - First version * 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data + * 1.2 24 Oct 2012 - Add note about using binary mode in stdio + * - Fix comparisons of differently signed integers */ #include /* for setjmp(), longjmp(), and jmp_buf */ #include "blast.h" /* prototype for blast() */ @@ -277,11 +279,11 @@ { int lit; /* true if literals are coded */ int dict; /* log2(dictionary size) - 6 */ int symbol; /* decoded symbol, extra bits for distance */ int len; /* length for copy */ - int dist; /* distance for copy */ + unsigned dist; /* distance for copy */ int copy; /* copy counter */ unsigned char *from, *to; /* copy pointers */ static int virgin = 1; /* build tables once */ static short litcnt[MAXBITS+1], litsym[256]; /* litcode memory */ static short lencnt[MAXBITS+1], lensym[16]; /* lencode memory */ Index: compat/zlib/contrib/blast/blast.h ================================================================== --- compat/zlib/contrib/blast/blast.h +++ compat/zlib/contrib/blast/blast.h @@ -1,8 +1,8 @@ /* blast.h -- interface for blast.c - Copyright (C) 2003 Mark Adler - version 1.1, 16 Feb 2003 + Copyright (C) 2003, 2012 Mark Adler + version 1.2, 24 Oct 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. @@ -26,10 +26,14 @@ * blast() decompresses the PKWare Data Compression Library (DCL) compressed * format. It provides the same functionality as the explode() function in * that library. (Note: PKWare overused the "implode" verb, and the format * used by their library implode() function is completely different and * incompatible with the implode compression method supported by PKZIP.) + * + * The binary mode for stdio functions should be used to assure that the + * compressed data is not corrupted when read or written. For example: + * fopen(..., "rb") and fopen(..., "wb"). */ typedef unsigned (*blast_in)(void *how, unsigned char **buf); typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len); Index: compat/zlib/contrib/delphi/ZLib.pas ================================================================== --- compat/zlib/contrib/delphi/ZLib.pas +++ compat/zlib/contrib/delphi/ZLib.pas @@ -150,11 +150,11 @@ BufSize = number of bytes in OutBuf } procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; const OutBuf: Pointer; BufSize: Integer); const - zlib_version = '1.2.7'; + zlib_version = '1.2.8'; type EZlibError = class(Exception); ECompressionError = class(EZlibError); EDecompressionError = class(EZlibError); Index: compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs ================================================================== --- compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +++ compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs @@ -1,7 +1,7 @@ // -// © Copyright Henrik Ravn 2004 +// © Copyright Henrik Ravn 2004 // // Use, modification and distribution are subject to the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -154,11 +154,11 @@ #region Info tests [Test] public void Info_Version() { Info info = new Info(); - Assert.AreEqual("1.2.7", Info.Version); + Assert.AreEqual("1.2.8", Info.Version); Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfPointer); Assert.AreEqual(32, info.SizeOfOffset); } Index: compat/zlib/contrib/infback9/infback9.c ================================================================== --- compat/zlib/contrib/infback9/infback9.c +++ compat/zlib/contrib/infback9/infback9.c @@ -220,18 +220,17 @@ void FAR *in_desc; out_func out; void FAR *out_desc; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have; /* available input */ unsigned long left; /* available output */ inflate_mode mode; /* current inflate mode */ int lastblock; /* true if processing last block */ int wrap; /* true if the window has wrapped */ - unsigned long write; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if needed */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned extra; /* extra bits needed */ unsigned long length; /* literal or length of data to copy */ @@ -257,11 +256,10 @@ /* Reset the state */ strm->msg = Z_NULL; mode = TYPE; lastblock = 0; - write = 0; wrap = 0; window = state->window; next = strm->next_in; have = next != Z_NULL ? strm->avail_in : 0; hold = 0; Index: compat/zlib/contrib/infback9/inftree9.c ================================================================== --- compat/zlib/contrib/infback9/inftree9.c +++ compat/zlib/contrib/infback9/inftree9.c @@ -1,17 +1,17 @@ /* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2012 Mark Adler + * Copyright (C) 1995-2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftree9.h" #define MAXBITS 15 const char inflate9_copyright[] = - " inflate9 1.2.7 Copyright 1995-2012 Mark Adler "; + " inflate9 1.2.8 Copyright 1995-2013 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. @@ -62,11 +62,11 @@ 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 78, 68}; + 133, 133, 133, 133, 144, 72, 78}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153}; static const unsigned short dext[32] = { /* Distance codes 0..31 extra */ Index: compat/zlib/contrib/minizip/configure.ac ================================================================== --- compat/zlib/contrib/minizip/configure.ac +++ compat/zlib/contrib/minizip/configure.ac @@ -1,9 +1,9 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([minizip], [1.2.7], [bugzilla.redhat.com]) +AC_INIT([minizip], [1.2.8], [bugzilla.redhat.com]) AC_CONFIG_SRCDIR([minizip.c]) AM_INIT_AUTOMAKE([foreign]) LT_INIT AC_MSG_CHECKING([whether to build example programs]) Index: compat/zlib/contrib/minizip/crypt.h ================================================================== --- compat/zlib/contrib/minizip/crypt.h +++ compat/zlib/contrib/minizip/crypt.h @@ -30,11 +30,11 @@ #define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) /*********************************************************************** * Return the next byte in the pseudo-random sequence */ -static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) +static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) { unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an * unpredictable manner on 16-bit systems; not a problem * with any known compiler so far, though */ @@ -43,11 +43,11 @@ } /*********************************************************************** * Update the encryption keys with the next byte of plain text */ -static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) +static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) { (*(pkeys+0)) = CRC32((*(pkeys+0)), c); (*(pkeys+1)) += (*(pkeys+0)) & 0xff; (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; { @@ -60,11 +60,11 @@ /*********************************************************************** * Initialize the encryption keys and the random header according to * the given password. */ -static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) +static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) { *(pkeys+0) = 305419896L; *(pkeys+1) = 591751049L; *(pkeys+2) = 878082192L; while (*passwd != '\0') { @@ -89,11 +89,11 @@ static int crypthead(const char* passwd, /* password string */ unsigned char* buf, /* where to write header */ int bufSize, unsigned long* pkeys, - const unsigned long* pcrc_32_tab, + const z_crc_t* pcrc_32_tab, unsigned long crcForCrypting) { int n; /* index in random header */ int t; /* temporary */ int c; /* random byte */ Index: compat/zlib/contrib/minizip/iowin32.c ================================================================== --- compat/zlib/contrib/minizip/iowin32.c +++ compat/zlib/contrib/minizip/iowin32.c @@ -23,10 +23,17 @@ #ifndef INVALID_SET_FILE_POINTER #define INVALID_SET_FILE_POINTER ((DWORD)-1) #endif + +#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define IOWIN32_USING_WINRT_API 1 +#endif +#endif + voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream)); long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); @@ -91,12 +98,26 @@ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API +#ifdef UNICODE + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + if ((filename!=NULL) && (dwDesiredAccess != 0)) + { + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); + } +#endif +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -106,12 +127,21 @@ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API + if ((filename!=NULL) && (dwDesiredAccess != 0)) + { + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); + } +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -121,12 +151,17 @@ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,NULL); +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -136,12 +171,26 @@ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; HANDLE hFile = NULL; win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); +#ifdef IOWIN32_USING_WINRT_API +#ifdef UNICODE + if ((filename!=NULL) && (dwDesiredAccess != 0)) + hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); +#else + if ((filename!=NULL) && (dwDesiredAccess != 0)) + { + WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; + MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); + hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); + } +#endif +#else if ((filename!=NULL) && (dwDesiredAccess != 0)) hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); +#endif return win32_build_iowin(hFile); } @@ -185,28 +234,50 @@ } } return ret; } + +static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) +{ +#ifdef IOWIN32_USING_WINRT_API + return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); +#else + LONG lHigh = pos.HighPart; + DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, FILE_CURRENT); + BOOL fOk = TRUE; + if (dwNewPos == 0xFFFFFFFF) + if (GetLastError() != NO_ERROR) + fOk = FALSE; + if ((newPos != NULL) && (fOk)) + { + newPos->LowPart = dwNewPos; + newPos->HighPart = lHigh; + } + return fOk; +#endif +} long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) { long ret=-1; HANDLE hFile = NULL; if (stream!=NULL) hFile = ((WIN32FILE_IOWIN*)stream) -> hf; if (hFile != NULL) { - DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); - if (dwSet == INVALID_SET_FILE_POINTER) + LARGE_INTEGER pos; + pos.QuadPart = 0; + + if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; ret = -1; } else - ret=(long)dwSet; + ret=(long)pos.LowPart; } return ret; } ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) @@ -216,21 +287,21 @@ if (stream!=NULL) hFile = ((WIN32FILE_IOWIN*)stream)->hf; if (hFile) { - LARGE_INTEGER li; - li.QuadPart = 0; - li.u.LowPart = SetFilePointer(hFile, li.u.LowPart, &li.u.HighPart, FILE_CURRENT); - if ( (li.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) + LARGE_INTEGER pos; + pos.QuadPart = 0; + + if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; ret = (ZPOS64_T)-1; } else - ret=li.QuadPart; + ret=pos.QuadPart; } return ret; } @@ -256,12 +327,13 @@ default: return -1; } if (hFile != NULL) { - DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod); - if (dwSet == INVALID_SET_FILE_POINTER) + LARGE_INTEGER pos; + pos.QuadPart = offset; + if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; ret = -1; } @@ -294,13 +366,13 @@ default: return -1; } if (hFile) { - LARGE_INTEGER* li = (LARGE_INTEGER*)&offset; - DWORD dwSet = SetFilePointer(hFile, li->u.LowPart, &li->u.HighPart, dwMoveMethod); - if (dwSet == INVALID_SET_FILE_POINTER) + LARGE_INTEGER pos; + pos.QuadPart = offset; + if (!MySetFilePointerEx(hFile, pos, NULL, FILE_CURRENT)) { DWORD dwErr = GetLastError(); ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; ret = -1; } ADDED compat/zlib/contrib/minizip/miniunzip.1 Index: compat/zlib/contrib/minizip/miniunzip.1 ================================================================== --- /dev/null +++ compat/zlib/contrib/minizip/miniunzip.1 @@ -0,0 +1,63 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH miniunzip 1 "Nov 7, 2001" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +miniunzip - uncompress and examine ZIP archives +.SH SYNOPSIS +.B miniunzip +.RI [ -exvlo ] +zipfile [ files_to_extract ] [-d tempdir] +.SH DESCRIPTION +.B minizip +is a simple tool which allows the extraction of compressed file +archives in the ZIP format used by the MS-DOS utility PKZIP. It was +written as a demonstration of the +.IR zlib (3) +library and therefore lack many of the features of the +.IR unzip (1) +program. +.SH OPTIONS +A number of options are supported. With the exception of +.BI \-d\ tempdir +these must be supplied before any +other arguments and are: +.TP +.BI \-l\ ,\ \-\-v +List the files in the archive without extracting them. +.TP +.B \-o +Overwrite files without prompting for confirmation. +.TP +.B \-x +Extract files (default). +.PP +The +.I zipfile +argument is the name of the archive to process. The next argument can be used +to specify a single file to extract from the archive. + +Lastly, the following option can be specified at the end of the command-line: +.TP +.BI \-d\ tempdir +Extract the archive in the directory +.I tempdir +rather than the current directory. +.SH SEE ALSO +.BR minizip (1), +.BR zlib (3), +.BR unzip (1). +.SH AUTHOR +This program was written by Gilles Vollant. This manual page was +written by Mark Brown . The -d tempdir option +was added by Dirk Eddelbuettel . ADDED compat/zlib/contrib/minizip/minizip.1 Index: compat/zlib/contrib/minizip/minizip.1 ================================================================== --- /dev/null +++ compat/zlib/contrib/minizip/minizip.1 @@ -0,0 +1,46 @@ +.\" Hey, EMACS: -*- nroff -*- +.TH minizip 1 "May 2, 2001" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +minizip - create ZIP archives +.SH SYNOPSIS +.B minizip +.RI [ -o ] +zipfile [ " files" ... ] +.SH DESCRIPTION +.B minizip +is a simple tool which allows the creation of compressed file archives +in the ZIP format used by the MS-DOS utility PKZIP. It was written as +a demonstration of the +.IR zlib (3) +library and therefore lack many of the features of the +.IR zip (1) +program. +.SH OPTIONS +The first argument supplied is the name of the ZIP archive to create or +.RI -o +in which case it is ignored and the second argument treated as the +name of the ZIP file. If the ZIP file already exists it will be +overwritten. +.PP +Subsequent arguments specify a list of files to place in the ZIP +archive. If none are specified then an empty archive will be created. +.SH SEE ALSO +.BR miniunzip (1), +.BR zlib (3), +.BR zip (1). +.SH AUTHOR +This program was written by Gilles Vollant. This manual page was +written by Mark Brown . + Index: compat/zlib/contrib/minizip/unzip.c ================================================================== --- compat/zlib/contrib/minizip/unzip.c +++ compat/zlib/contrib/minizip/unzip.c @@ -186,11 +186,11 @@ int isZip64; # ifndef NOUNCRYPT unsigned long keys[3]; /* keys defining the pseudo-random sequence */ - const unsigned long* pcrc_32_tab; + const z_crc_t* pcrc_32_tab; # endif } unz64_s; #ifndef NOUNCRYPT @@ -799,13 +799,13 @@ { return unzOpenInternal(path, NULL, 1); } /* - Close a ZipFile opened with unzipOpen. - If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + Close a ZipFile opened with unzOpen. + If there is files inside the .Zip opened with unzOpenCurrentFile (see later), + these files MUST be closed with unzCloseCurrentFile before call unzClose. return UNZ_OK if there is no problem. */ extern int ZEXPORT unzClose (unzFile file) { unz64_s* s; if (file==NULL) @@ -1221,11 +1221,11 @@ } /* Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzipStringFileNameCompare + For the iCaseSensitivity signification, see unzStringFileNameCompare return value : UNZ_OK if the file is found. It becomes the current file. UNZ_END_OF_LIST_OF_FILE if the file is not found */ @@ -1996,11 +1996,11 @@ return (int)read_now; } /* - Close the file in zip opened with unzipOpenCurrentFile + Close the file in zip opened with unzOpenCurrentFile Return UNZ_CRCERROR if all the file was read but the CRC is not good */ extern int ZEXPORT unzCloseCurrentFile (unzFile file) { int err=UNZ_OK; Index: compat/zlib/contrib/minizip/unzip.h ================================================================== --- compat/zlib/contrib/minizip/unzip.h +++ compat/zlib/contrib/minizip/unzip.h @@ -195,13 +195,13 @@ for read/write the zip file (see ioapi.h) */ extern int ZEXPORT unzClose OF((unzFile file)); /* - Close a ZipFile opened with unzipOpen. + Close a ZipFile opened with unzOpen. If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. + these files MUST be closed with unzCloseCurrentFile before call unzClose. return UNZ_OK if there is no problem. */ extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, unz_global_info *pglobal_info)); Index: compat/zlib/contrib/minizip/zip.c ================================================================== --- compat/zlib/contrib/minizip/zip.c +++ compat/zlib/contrib/minizip/zip.c @@ -155,11 +155,11 @@ ZPOS64_T pos_zip64extrainfo; ZPOS64_T totalCompressedData; ZPOS64_T totalUncompressedData; #ifndef NOCRYPT unsigned long keys[3]; /* keys defining the pseudo-random sequence */ - const unsigned long* pcrc_32_tab; + const z_crc_t* pcrc_32_tab; int crypt_header_size; #endif } curfile64_info; typedef struct Index: compat/zlib/contrib/pascal/zlibpas.pas ================================================================== --- compat/zlib/contrib/pascal/zlibpas.pas +++ compat/zlib/contrib/pascal/zlibpas.pas @@ -8,12 +8,12 @@ unit zlibpas; interface const - ZLIB_VERSION = '1.2.7'; - ZLIB_VERNUM = $1270; + ZLIB_VERSION = '1.2.8'; + ZLIB_VERNUM = $1280; type alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; cdecl; free_func = procedure(opaque, address: Pointer); Index: compat/zlib/contrib/puff/puff.c ================================================================== --- compat/zlib/contrib/puff/puff.c +++ compat/zlib/contrib/puff/puff.c @@ -1,10 +1,10 @@ /* * puff.c - * Copyright (C) 2002-2010 Mark Adler + * Copyright (C) 2002-2013 Mark Adler * For conditions of distribution and use, see copyright notice in puff.h - * version 2.2, 25 Apr 2010 + * version 2.3, 21 Jan 2013 * * puff.c is a simple inflate written to be an unambiguous way to specify the * deflate format. It is not written for speed but rather simplicity. As a * side benefit, this code might actually be useful when small code is more * important than speed, such as bootstrap applications. For typical deflate @@ -74,10 +74,11 @@ * - Split if's and ?'s for coverage testing * - Break out test code to separate file * - Move NIL to puff.h * - Allow incomplete code only if single code length is 1 * - Add full code coverage test to Makefile + * 2.3 21 Jan 2013 - Check for invalid code length codes in dynamic blocks */ #include /* for setjmp(), longjmp(), and jmp_buf */ #include "puff.h" /* prototype for puff() */ @@ -702,10 +703,12 @@ while (index < nlen + ndist) { int symbol; /* decoded value */ int len; /* last length to repeat */ symbol = decode(s, &lencode); + if (symbol < 0) + return symbol; /* invalid symbol */ if (symbol < 16) /* length in 0..15 */ lengths[index++] = symbol; else { /* repeat instruction */ len = 0; /* assume repeating zeros */ if (symbol == 16) { /* repeat last length 3..6 times */ Index: compat/zlib/contrib/puff/puff.h ================================================================== --- compat/zlib/contrib/puff/puff.h +++ compat/zlib/contrib/puff/puff.h @@ -1,8 +1,8 @@ /* puff.h - Copyright (C) 2002-2010 Mark Adler, all rights reserved - version 2.2, 25 Apr 2010 + Copyright (C) 2002-2013 Mark Adler, all rights reserved + version 2.3, 21 Jan 2013 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Index: compat/zlib/contrib/puff/pufftest.c ================================================================== --- compat/zlib/contrib/puff/pufftest.c +++ compat/zlib/contrib/puff/pufftest.c @@ -1,10 +1,10 @@ /* * pufftest.c - * Copyright (C) 2002-2010 Mark Adler + * Copyright (C) 2002-2013 Mark Adler * For conditions of distribution and use, see copyright notice in puff.h - * version 2.2, 25 Apr 2010 + * version 2.3, 21 Jan 2013 */ /* Example of how to use puff(). Usage: puff [-w] [-f] [-nnn] file Index: compat/zlib/contrib/testzlib/testzlib.c ================================================================== --- compat/zlib/contrib/testzlib/testzlib.c +++ compat/zlib/contrib/testzlib/testzlib.c @@ -114,14 +114,14 @@ dwRet *=1; } return dwRet; } -int ReadFileMemory(const char* filename,long* plFileSize,void** pFilePtr) +int ReadFileMemory(const char* filename,long* plFileSize,unsigned char** pFilePtr) { FILE* stream; - void* ptr; + unsigned char* ptr; int retVal=1; stream=fopen(filename, "rb"); if (stream==NULL) return 0; Index: compat/zlib/contrib/vstudio/readme.txt ================================================================== --- compat/zlib/contrib/vstudio/readme.txt +++ compat/zlib/contrib/vstudio/readme.txt @@ -1,6 +1,6 @@ -Building instructions for the DLL versions of Zlib 1.2.7 +Building instructions for the DLL versions of Zlib 1.2.8 ======================================================== This directory contains projects that build zlib and minizip using Microsoft Visual C++ 9.0/10.0. @@ -26,10 +26,15 @@ Build instructions for Visual Studio 2010 (32 bits or 64 bits) -------------------------------------------------------------- - Uncompress current zlib, including all contrib/* files - Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 +Build instructions for Visual Studio 2012 (32 bits or 64 bits) +-------------------------------------------------------------- +- Uncompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 + Important --------- - To use zlibwapi.dll in your application, you must define the macro ZLIB_WINAPI when compiling your application's source files. Index: compat/zlib/contrib/vstudio/vc10/zlib.rc ================================================================== --- compat/zlib/contrib/vstudio/vc10/zlib.rc +++ compat/zlib/contrib/vstudio/vc10/zlib.rc @@ -1,11 +1,11 @@ #include #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1.2.7,0 - PRODUCTVERSION 1.2.7,0 + FILEVERSION 1,2,8,0 + PRODUCTVERSION 1,2,8,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0 // not used @@ -15,18 +15,18 @@ BLOCK "040904E4" //language ID = U.S. English, char set = Windows, Multilingual BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.7\0" + VALUE "FileVersion", "1.2.8\0" VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlib.dll\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2012 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x0409, 1252 END END Index: compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj ================================================================== --- compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj +++ compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj @@ -180,10 +180,14 @@ /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) $(OutDir)zlibstat.lib true + + cd ..\..\masmx86 +bld_ml32.bat + OnlyExplicitInline ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) @@ -208,10 +212,14 @@ /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) $(OutDir)zlibstat.lib true + + cd ..\..\masmx86 +bld_ml32.bat + OnlyExplicitInline ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) @@ -264,10 +272,14 @@ /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) $(OutDir)zlibstat.lib true + + cd ..\..\masmx64 +bld_ml64.bat + Itanium @@ -324,10 +336,14 @@ /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) $(OutDir)zlibstat.lib true + + cd ..\..\masmx64 +bld_ml64.bat + Itanium Index: compat/zlib/contrib/vstudio/vc10/zlibvc.def ================================================================== --- compat/zlib/contrib/vstudio/vc10/zlibvc.def +++ compat/zlib/contrib/vstudio/vc10/zlibvc.def @@ -1,9 +1,9 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.2.7 +VERSION 1.2.8 EXPORTS adler32 @1 compress @2 crc32 @3 @@ -132,8 +132,12 @@ ; zlib1 v1.2.6 added: gzgetc_ @161 inflateResetKeep @163 deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 Index: compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj ================================================================== --- compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj +++ compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj @@ -178,14 +178,14 @@ AllRules.ruleset - zlibwapi + zlibwapid zlibwapi zlibwapi - zlibwapi + zlibwapid zlibwapi zlibwapi @@ -218,22 +218,18 @@ 0x040c /MACHINE:I386 %(AdditionalOptions) ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true .\zlibvc.def true - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows false - $(OutDir)zlibwapi.lib cd ..\..\masmx86 bld_ml32.bat @@ -270,22 +266,18 @@ NDEBUG;%(PreprocessorDefinitions) 0x040c /MACHINE:I386 %(AdditionalOptions) - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows false - $(OutDir)zlibwapi.lib NDEBUG;%(PreprocessorDefinitions) @@ -319,22 +311,18 @@ 0x040c /MACHINE:I386 %(AdditionalOptions) ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows false - $(OutDir)zlibwapi.lib cd ..\..\masmx86 bld_ml32.bat @@ -369,23 +357,19 @@ _DEBUG;%(PreprocessorDefinitions) 0x040c ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true .\zlibvc.def true - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows - $(OutDir)zlibwapi.lib MachineX64 - cd ..\..\contrib\masmx64 + cd ..\..\masmx64 bld_ml64.bat @@ -461,19 +445,15 @@ NDEBUG;%(PreprocessorDefinitions) 0x040c - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows - $(OutDir)zlibwapi.lib MachineX64 @@ -552,19 +532,15 @@ NDEBUG;%(PreprocessorDefinitions) 0x040c ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll true false .\zlibvc.def - $(OutDir)zlibwapi.pdb true - $(OutDir)zlibwapi.map Windows - $(OutDir)zlibwapi.lib MachineX64 cd ..\..\masmx64 bld_ml64.bat ADDED compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj Index: compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj @@ -0,0 +1,314 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694382A} + Win32Proj + + + + Application + MultiByte + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + true + false + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + true + false + ia64\MiniUnzip$(Configuration)\ + ia64\MiniUnzip$(Configuration)\Tmp\ + true + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + false + false + ia64\MiniUnzip$(Configuration)\ + ia64\MiniUnzip$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineX64 + + + + + Itanium + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineIA64 + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineX64 + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineIA64 + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + ADDED compat/zlib/contrib/vstudio/vc11/minizip.vcxproj Index: compat/zlib/contrib/vstudio/vc11/minizip.vcxproj ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/minizip.vcxproj @@ -0,0 +1,311 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} + Win32Proj + + + + Application + MultiByte + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + true + false + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + false + x64\$(Configuration)\ + x64\$(Configuration)\ + true + false + ia64\$(Configuration)\ + ia64\$(Configuration)\ + true + false + x64\$(Configuration)\ + x64\$(Configuration)\ + false + ia64\$(Configuration)\ + ia64\$(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineX64 + + + + + Itanium + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineIA64 + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineX64 + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineIA64 + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + ADDED compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj Index: compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj @@ -0,0 +1,426 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + Itanium + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} + testzlib + Win32Proj + + + + Application + MultiByte + true + v110 + + + Application + MultiByte + true + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + true + + + Application + MultiByte + true + + + Application + MultiByte + + + Application + true + v110 + + + Application + true + v110 + + + Application + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + true + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + ia64\TestZlib$(Configuration)\ + ia64\TestZlib$(Configuration)\Tmp\ + true + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + ia64\TestZlib$(Configuration)\ + ia64\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + ia64\TestZlib$(Configuration)\ + ia64\TestZlib$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + + + + + Itanium + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + MachineIA64 + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + MachineIA64 + + + + + ..\..\..;%(AdditionalIncludeDirectories) + ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + MachineIA64 + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + ADDED compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj Index: compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj @@ -0,0 +1,314 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694366A} + Win32Proj + + + + Application + MultiByte + v110 + + + Application + Unicode + v110 + + + Application + MultiByte + + + Application + MultiByte + + + Application + MultiByte + v110 + + + Application + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + true + false + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + true + false + ia64\TestZlibDll$(Configuration)\ + ia64\TestZlibDll$(Configuration)\Tmp\ + true + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + false + false + ia64\TestZlibDll$(Configuration)\ + ia64\TestZlibDll$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineX64 + + + + + Itanium + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineIA64 + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineX64 + + + + + Itanium + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineIA64 + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + ADDED compat/zlib/contrib/vstudio/vc11/zlib.rc Index: compat/zlib/contrib/vstudio/vc11/zlib.rc ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1,2,8,0 + PRODUCTVERSION 1,2,8,0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.2.8\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END ADDED compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj Index: compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj @@ -0,0 +1,464 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + Itanium + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + Unicode + + + StaticLibrary + false + + + StaticLibrary + false + + + StaticLibrary + false + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + + + StaticLibrary + false + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + ia64\ZlibStat$(Configuration)\ + ia64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + ia64\ZlibStat$(Configuration)\ + ia64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + ia64\ZlibStat$(Configuration)\ + ia64\ZlibStat$(Configuration)\Tmp\ + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + Itanium + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + Itanium + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + Itanium + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + ADDED compat/zlib/contrib/vstudio/vc11/zlibvc.def Index: compat/zlib/contrib/vstudio/vc11/zlibvc.def ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/zlibvc.def @@ -0,0 +1,143 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.2.8 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 ADDED compat/zlib/contrib/vstudio/vc11/zlibvc.sln Index: compat/zlib/contrib/vstudio/vc11/zlibvc.sln ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/zlibvc.sln @@ -0,0 +1,117 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Itanium = Debug|Itanium + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Itanium = Release|Itanium + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium + ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 + ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal ADDED compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj Index: compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj ================================================================== --- /dev/null +++ compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj @@ -0,0 +1,688 @@ + + + + + Debug + Itanium + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + Itanium + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + Itanium + + + Release + Win32 + + + Release + x64 + + + + {8FD826F8-3739-44E6-8CC8-997122E53B8D} + + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + v110 + Unicode + + + DynamicLibrary + false + true + + + DynamicLibrary + false + true + + + DynamicLibrary + false + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + true + v110 + + + DynamicLibrary + false + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + true + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + true + false + ia64\ZlibDll$(Configuration)\ + ia64\ZlibDll$(Configuration)\Tmp\ + true + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + ia64\ZlibDll$(Configuration)\ + ia64\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + ia64\ZlibDll$(Configuration)\ + ia64\ZlibDll$(Configuration)\Tmp\ + false + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + cd ..\..\masmx86 +bld_ml32.bat + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + cd ..\..\masmx86 +bld_ml32.bat + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + cd ..\..\contrib\masmx64 +bld_ml64.bat + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Itanium + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineIA64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Itanium + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineIA64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + cd ..\..\masmx64 +bld_ml64.bat + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Itanium + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineIA64 + + + + + + + + + + + + + + true + true + true + true + true + true + + + + + + + + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + Index: compat/zlib/contrib/vstudio/vc9/zlib.rc ================================================================== --- compat/zlib/contrib/vstudio/vc9/zlib.rc +++ compat/zlib/contrib/vstudio/vc9/zlib.rc @@ -1,11 +1,11 @@ #include #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1.2.7,0 - PRODUCTVERSION 1.2.7,0 + FILEVERSION 1,2,8,0 + PRODUCTVERSION 1,2,8,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0 // not used @@ -15,18 +15,18 @@ BLOCK "040904E4" //language ID = U.S. English, char set = Windows, Multilingual BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.7\0" + VALUE "FileVersion", "1.2.8\0" VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlib.dll\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2012 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x0409, 1252 END END Index: compat/zlib/contrib/vstudio/vc9/zlibvc.def ================================================================== --- compat/zlib/contrib/vstudio/vc9/zlibvc.def +++ compat/zlib/contrib/vstudio/vc9/zlibvc.def @@ -1,9 +1,9 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.2.7 +VERSION 1.2.8 EXPORTS adler32 @1 compress @2 crc32 @3 @@ -131,9 +131,13 @@ inflateUndermine @160 ; zlib1 v1.2.6 added: gzgetc_ @161 inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 Index: compat/zlib/deflate.c ================================================================== --- compat/zlib/deflate.c +++ compat/zlib/deflate.c @@ -1,7 +1,7 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM @@ -50,11 +50,11 @@ /* @(#) $Id$ */ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.7 Copyright 1995-2012 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. @@ -303,11 +303,11 @@ s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + strm->msg = ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; } s->d_buf = overlay + s->lit_bufsize/sizeof(ush); s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; @@ -327,11 +327,11 @@ { deflate_state *s; uInt str, n; int wrap; unsigned avail; - unsigned char *next; + z_const unsigned char *next; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) return Z_STREAM_ERROR; s = strm->state; wrap = s->wrap; @@ -357,11 +357,11 @@ /* insert dictionary into window and hash */ avail = strm->avail_in; next = strm->next_in; strm->avail_in = dictLength; - strm->next_in = (Bytef *)dictionary; + strm->next_in = (z_const Bytef *)dictionary; fill_window(s); while (s->lookahead >= MIN_MATCH) { str = s->strstart; n = s->lookahead - (MIN_MATCH-1); do { @@ -511,10 +511,12 @@ if ((strategy != s->strategy || func != configuration_table[level].func) && strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_BLOCK); + if (err == Z_BUF_ERROR && s->pending == 0) + err = Z_OK; } if (s->level != level) { s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; Index: compat/zlib/deflate.h ================================================================== --- compat/zlib/deflate.h +++ compat/zlib/deflate.h @@ -102,11 +102,11 @@ Bytef *pending_out; /* next pending byte to output to the stream */ uInt pending; /* nb of bytes in the pending buffer */ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ gz_headerp gzhead; /* gzip header information to write */ uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ + Byte method; /* can only be DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ /* used by deflate.c: */ uInt w_size; /* LZ77 window size (32K by default) */ Index: compat/zlib/examples/enough.c ================================================================== --- compat/zlib/examples/enough.c +++ compat/zlib/examples/enough.c @@ -1,9 +1,9 @@ /* enough.c -- determine the maximum size of inflate's Huffman code tables over * all possible valid and complete Huffman codes, subject to a length limit. - * Copyright (C) 2007, 2008 Mark Adler - * Version 1.3 17 February 2008 Mark Adler + * Copyright (C) 2007, 2008, 2012 Mark Adler + * Version 1.4 18 August 2012 Mark Adler */ /* Version history: 1.0 3 Jan 2007 First version (derived from codecount.c version 1.4) 1.1 4 Jan 2007 Use faster incremental table usage computation @@ -12,10 +12,13 @@ As inflate does, decrease root for short codes Refuse cases where inflate would increase root 1.3 17 Feb 2008 Add argument for initial root table size Fix bug for initial root table size == max - 1 Use a macro to compute the history index + 1.4 18 Aug 2012 Avoid shifts more than bits in type (caused endless loop!) + Clean up comparisons of different types + Clean up code indentation */ /* Examine all possible Huffman codes for a given number of symbols and a maximum code length in bits to determine the maximum table size for zilb's @@ -234,12 +237,12 @@ /* count all possible codes from this juncture and add them up */ sum = 0; for (use = least; use <= most; use++) { got = count(syms - use, len + 1, (left - use) << 1); sum += got; - if (got == -1 || sum < got) /* overflow */ - return -1; + if (got == (big_t)0 - 1 || sum < got) /* overflow */ + return (big_t)0 - 1; } /* verify that all recursive calls are productive */ assert(sum != 0); @@ -456,51 +459,51 @@ { int syms; /* total number of symbols to code */ int n; /* number of symbols to code for this run */ big_t got; /* return value of count() */ big_t sum; /* accumulated number of codes over n */ + code_t word; /* for counting bits in code_t */ /* set up globals for cleanup() */ code = NULL; num = NULL; done = NULL; /* get arguments -- default to the deflate literal/length code */ syms = 286; - root = 9; + root = 9; max = 15; if (argc > 1) { syms = atoi(argv[1]); if (argc > 2) { root = atoi(argv[2]); - if (argc > 3) - max = atoi(argv[3]); - } + if (argc > 3) + max = atoi(argv[3]); + } } if (argc > 4 || syms < 2 || root < 1 || max < 1) { fputs("invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\n", - stderr); + stderr); return 1; } /* if not restricting the code length, the longest is syms - 1 */ if (max > syms - 1) max = syms - 1; /* determine the number of bits in a code_t */ - n = 0; - while (((code_t)1 << n) != 0) - n++; + for (n = 0, word = 1; word; n++, word <<= 1) + ; /* make sure that the calculation of most will not overflow */ - if (max > n || syms - 2 >= (((code_t)0 - 1) >> (max - 1))) { + if (max > n || (code_t)(syms - 2) >= (((code_t)0 - 1) >> (max - 1))) { fputs("abort: code length too long for internal types\n", stderr); return 1; } /* reject impossible code requests */ - if (syms - 1 > ((code_t)1 << max) - 1) { + if ((code_t)(syms - 1) > ((code_t)1 << max) - 1) { fprintf(stderr, "%d symbols cannot be coded in %d bits\n", syms, max); return 1; } @@ -530,11 +533,11 @@ /* count possible codes for all numbers of symbols, add up counts */ sum = 0; for (n = 2; n <= syms; n++) { got = count(n, 1, 2); sum += got; - if (got == -1 || sum < got) { /* overflow */ + if (got == (big_t)0 - 1 || sum < got) { /* overflow */ fputs("abort: can't count that high!\n", stderr); cleanup(); return 1; } printf("%llu %d-codes\n", got, n); @@ -554,16 +557,16 @@ cleanup(); return 1; } /* find and show maximum inflate table usage */ - if (root > max) /* reduce root to max length */ - root = max; - if (syms < ((code_t)1 << (root + 1))) + if (root > max) /* reduce root to max length */ + root = max; + if ((code_t)syms < ((code_t)1 << (root + 1))) enough(syms); else puts("cannot handle minimum code lengths > root"); /* done */ cleanup(); return 0; } Index: compat/zlib/examples/gun.c ================================================================== --- compat/zlib/examples/gun.c +++ compat/zlib/examples/gun.c @@ -1,9 +1,9 @@ /* gun.c -- simple gunzip to give an example of the use of inflateBack() - * Copyright (C) 2003, 2005, 2008, 2010 Mark Adler + * Copyright (C) 2003, 2005, 2008, 2010, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.6 17 January 2010 Mark Adler */ + Version 1.7 12 August 2012 Mark Adler */ /* Version history: 1.0 16 Feb 2003 First version for testing of inflateBack() 1.1 21 Feb 2005 Decompress concatenated gzip streams Remove use of "this" variable (C++ keyword) @@ -16,10 +16,11 @@ Copy file attributes from input file to output file 1.3 12 Jun 2005 Add casts for error messages [Oberhumer] 1.4 8 Dec 2006 LZW decompression speed improvements 1.5 9 Feb 2008 Avoid warning in latest version of gcc 1.6 17 Jan 2010 Avoid signed/unsigned comparison warnings + 1.7 12 Aug 2012 Update for z_const usage in zlib 1.2.8 */ /* gun [ -t ] [ name ... ] @@ -83,11 +84,11 @@ }; /* Load input buffer, assumed to be empty, and return bytes loaded and a pointer to them. read() is called until the buffer is full, or until it returns end-of-file or error. Return 0 on error. */ -local unsigned in(void *in_desc, unsigned char **buf) +local unsigned in(void *in_desc, z_const unsigned char **buf) { int ret; unsigned len; unsigned char *next; struct ind *me = (struct ind *)in_desc; @@ -194,11 +195,11 @@ lunpipe() will return Z_OK on success, Z_BUF_ERROR for an unexpected end of file, read error, or write error (a write error indicated by strm->next_in not equal to Z_NULL), or Z_DATA_ERROR for invalid input. */ -local int lunpipe(unsigned have, unsigned char *next, struct ind *indp, +local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, int outfile, z_stream *strm) { int last; /* last byte read by NEXT(), or -1 if EOF */ unsigned chunk; /* bytes left in current chunk */ int left; /* bits left in rem */ @@ -381,11 +382,11 @@ */ local int gunpipe(z_stream *strm, int infile, int outfile) { int ret, first, last; unsigned have, flags, len; - unsigned char *next = NULL; + z_const unsigned char *next = NULL; struct ind ind, *indp; struct outd outd; /* setup input buffer */ ind.infile = infile; Index: compat/zlib/examples/gzappend.c ================================================================== --- compat/zlib/examples/gzappend.c +++ compat/zlib/examples/gzappend.c @@ -1,9 +1,9 @@ /* gzappend -- command to append to a gzip file - Copyright (C) 2003 Mark Adler, all rights reserved - version 1.1, 4 Nov 2003 + Copyright (C) 2003, 2012 Mark Adler, all rights reserved + version 1.2, 11 Oct 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. @@ -37,10 +37,12 @@ * - Finish off gzip file in gztack() * - Use deflatePrime() instead of adding empty blocks * - Keep gzip file clean on appended file read errors * - Use in-place rotate instead of auxiliary buffer * (Why you ask? Because it was fun to write!) + * 1.2 11 Oct 2012 - Fix for proper z_const usage + * - Check for input buffer malloc failure */ /* gzappend takes a gzip file and appends to it, compressing files from the command line or data from stdin. The gzip file is written to directly, to @@ -168,11 +170,11 @@ typedef struct { int fd; /* file descriptor */ int size; /* 1 << size is bytes in buf */ unsigned left; /* bytes available at next */ unsigned char *buf; /* buffer */ - unsigned char *next; /* next byte in buffer */ + z_const unsigned char *next; /* next byte in buffer */ char *name; /* file name for error messages */ } file; /* reload buffer */ local int readin(file *in) @@ -397,18 +399,18 @@ fprintf(stderr, "gzappend warning: %s not found, skipping ...\n", name); } /* allocate buffers */ - in = fd == -1 ? NULL : malloc(CHUNK); + in = malloc(CHUNK); out = malloc(CHUNK); - if (out == NULL) bye("out of memory", ""); + if (in == NULL || out == NULL) bye("out of memory", ""); /* compress input file and append to gzip file */ do { /* get more input */ - len = fd == -1 ? 0 : read(fd, in, CHUNK); + len = read(fd, in, CHUNK); if (len == -1) { fprintf(stderr, "gzappend warning: error reading %s, skipping rest ...\n", name); len = 0; @@ -451,11 +453,11 @@ close(gd); } /* clean up and return */ free(out); - if (in != NULL) free(in); + free(in); if (fd > 0) close(fd); } /* process the compression level option if present, scan the gzip file, and append the specified files, or append the data from stdin if no other file @@ -465,15 +467,17 @@ { int gd, level; z_stream strm; /* ignore command name */ - argv++; + argc--; argv++; /* provide usage if no arguments */ if (*argv == NULL) { - printf("gzappend 1.1 (4 Nov 2003) Copyright (C) 2003 Mark Adler\n"); + printf( + "gzappend 1.2 (11 Oct 2012) Copyright (C) 2003, 2012 Mark Adler\n" + ); printf( "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n"); return 0; } Index: compat/zlib/examples/gzjoin.c ================================================================== --- compat/zlib/examples/gzjoin.c +++ compat/zlib/examples/gzjoin.c @@ -1,9 +1,9 @@ /* gzjoin -- command to join gzip files into one gzip file - Copyright (C) 2004 Mark Adler, all rights reserved - version 1.0, 11 Dec 2004 + Copyright (C) 2004, 2005, 2012 Mark Adler, all rights reserved + version 1.2, 14 Aug 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. @@ -25,10 +25,11 @@ /* * Change history: * * 1.0 11 Dec 2004 - First version * 1.1 12 Jun 2005 - Changed ssize_t to long for portability + * 1.2 14 Aug 2012 - Clean up for z_const usage */ /* gzjoin takes one or more gzip files on the command line and writes out a single gzip file that will uncompress to the concatenation of the @@ -306,11 +307,11 @@ bail("out of memory", ""); /* inflate and copy compressed data, clear last-block bit if requested */ len = 0; zpull(&strm, in); - start = strm.next_in; + start = in->next; last = start[0] & 1; if (last && clr) start[0] &= ~1; strm.avail_out = 0; for (;;) { @@ -349,11 +350,11 @@ if (pos != 0) { /* next last-block bit is in last used byte */ pos = 0x100 >> pos; last = strm.next_in[-1] & pos; if (last && clr) - strm.next_in[-1] &= ~pos; + in->buf[strm.next_in - in->buf - 1] &= ~pos; } else { /* next last-block bit is in next unused byte */ if (strm.avail_in == 0) { /* don't have that byte yet -- get it */ @@ -362,18 +363,18 @@ in->left = 0; zpull(&strm, in); } last = strm.next_in[0] & 1; if (last && clr) - strm.next_in[0] &= ~1; + in->buf[strm.next_in - in->buf] &= ~1; } } } /* update buffer with unused input */ in->left = strm.avail_in; - in->next = strm.next_in; + in->next = in->buf + (strm.next_in - in->buf); /* copy used input, write empty blocks to get to byte boundary */ pos = strm.data_type & 7; fwrite(start, 1, in->next - start - 1, out); last = in->next[-1]; Index: compat/zlib/examples/gzlog.c ================================================================== --- compat/zlib/examples/gzlog.c +++ compat/zlib/examples/gzlog.c @@ -1,10 +1,10 @@ /* * gzlog.c - * Copyright (C) 2004, 2008 Mark Adler, all rights reserved + * Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved * For conditions of distribution and use, see copyright notice in gzlog.h - * version 2.0, 25 Apr 2008 + * version 2.2, 14 Aug 2012 */ /* gzlog provides a mechanism for frequently appending short strings to a gzip file that is efficient both in execution time and compression ratio. The @@ -748,19 +748,20 @@ /* load foo.add file if expected and present */ if (op == APPEND_OP || op == COMPRESS_OP) { strcpy(log->end, ".add"); if (stat(log->path, &st) == 0 && st.st_size) { len = (size_t)(st.st_size); - if (len != st.st_size || (data = malloc(st.st_size)) == NULL) { + if ((off_t)len != st.st_size || + (data = malloc(st.st_size)) == NULL) { log_log(log, op, "allocation failure"); return -2; } if ((fd = open(log->path, O_RDONLY, 0)) < 0) { log_log(log, op, ".add file read failure"); return -1; } - ret = read(fd, data, len) != len; + ret = (size_t)read(fd, data, len) != len; close(fd); if (ret) { log_log(log, op, ".add file read failure"); return -1; } @@ -911,11 +912,11 @@ size_t len, next; unsigned char *data, buf[5]; struct log *log = logd; /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID) || len < 0) + if (log == NULL || strcmp(log->id, LOGID)) return -3; /* see if we lost the lock -- if so get it again and reload the extra field information (it probably changed), recover last operation if necessary */ @@ -950,11 +951,11 @@ /* write the uncompressed data to the .add file */ strcpy(log->end, ".add"); fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) break; - ret = write(fd, data, len) != len; + ret = (size_t)write(fd, data, len) != len; if (ret | close(fd)) break; log_touch(log); /* write the dictionary for the next compress to the .temp file */ @@ -961,11 +962,11 @@ strcpy(log->end, ".temp"); fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) break; next = DICT > len ? len : DICT; - ret = write(fd, (char *)data + len - next, next) != next; + ret = (size_t)write(fd, (char *)data + len - next, next) != next; if (ret | close(fd)) break; log_touch(log); /* roll back to compressed data, mark the compress in progress */ @@ -995,13 +996,13 @@ { int fd, ret; struct log *log = logd; /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID) || len < 0) + if (log == NULL || strcmp(log->id, LOGID)) return -3; - if (data == NULL || len == 0) + if (data == NULL || len <= 0) return 0; /* see if we lost the lock -- if so get it again and reload the extra field information (it probably changed), recover last operation if necessary */ @@ -1011,11 +1012,11 @@ /* create and write .add file */ strcpy(log->end, ".add"); fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) return -1; - ret = write(fd, data, len) != len; + ret = (size_t)write(fd, data, len) != len; if (ret | close(fd)) return -1; log_touch(log); /* mark log file with append in progress */ Index: compat/zlib/examples/gzlog.h ================================================================== --- compat/zlib/examples/gzlog.h +++ compat/zlib/examples/gzlog.h @@ -1,8 +1,8 @@ /* gzlog.h - Copyright (C) 2004, 2008 Mark Adler, all rights reserved - version 2.0, 25 Apr 2008 + Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved + version 2.2, 14 Aug 2012 This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. @@ -25,10 +25,12 @@ 1.0 26 Nov 2004 First version 2.0 25 Apr 2008 Complete redesign for recovery of interrupted operations Interface changed slightly in that now path is a prefix Compression now occurs as needed during gzlog_write() gzlog_write() now always leaves the log file as valid gzip + 2.1 8 Jul 2012 Fix argument checks in gzlog_compress() and gzlog_write() + 2.2 14 Aug 2012 Clean up signed comparisons */ /* The gzlog object allows writing short messages to a gzipped log file, opening the log file locked for small bursts, and then closing it. The log Index: compat/zlib/examples/zran.c ================================================================== --- compat/zlib/examples/zran.c +++ compat/zlib/examples/zran.c @@ -1,9 +1,14 @@ /* zran.c -- example of zlib/gzip stream indexing and random access - * Copyright (C) 2005 Mark Adler + * Copyright (C) 2005, 2012 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.0 29 May 2005 Mark Adler */ + Version 1.1 29 Sep 2012 Mark Adler */ + +/* Version History: + 1.0 29 May 2005 First version + 1.1 29 Sep 2012 Fix memory reallocation error + */ /* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() for random access of a compressed file. A file containing a zlib or gzip stream is provided on the command line. The compressed stream is decoded in its entirety, and an index built with access points about every SPAN bytes @@ -219,11 +224,11 @@ } while (strm.avail_in != 0); } while (ret != Z_STREAM_END); /* clean up and return index (release unused entries in list) */ (void)inflateEnd(&strm); - index = realloc(index, sizeof(struct point) * index->have); + index->list = realloc(index->list, sizeof(struct point) * index->have); index->size = index->have; *built = index; return index->size; /* return error */ Index: compat/zlib/gzguts.h ================================================================== --- compat/zlib/gzguts.h +++ compat/zlib/gzguts.h @@ -1,7 +1,7 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #ifdef _LARGEFILE64_SOURCE # ifndef _LARGEFILE_SOURCE @@ -32,10 +32,17 @@ #endif #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) # include #endif + +#ifdef WINAPI_FAMILY +# define open _open +# define read _read +# define write _write +# define close _close +#endif #ifdef NO_DEFLATE /* for compatibility with old definition */ # define NO_GZCOMPRESS #endif @@ -58,11 +65,11 @@ #endif #ifndef HAVE_VSNPRINTF # ifdef MSDOS /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ + but for now we just assume it doesn't. */ # define NO_vsnprintf # endif # ifdef __TURBOC__ # define NO_vsnprintf # endif @@ -85,10 +92,18 @@ # endif # ifdef __MVS__ # define NO_vsnprintf # endif #endif + +/* unlike snprintf (which is required in C99, yet still not supported by + Microsoft more than a decade later!), _snprintf does not guarantee null + termination of the result -- however this is only used in gzlib.c where + the result is assured to fit in the space provided */ +#ifdef _MSC_VER +# define snprintf _snprintf +#endif #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ @@ -125,11 +140,12 @@ # define DEF_MEM_LEVEL 8 #else # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif -/* default i/o buffer size -- double this for output when reading */ +/* default i/o buffer size -- double this for output when reading (this and + twice this must be able to fit in an unsigned type) */ #define GZBUFSIZE 8192 /* gzip modes, also provide a little integrity check on the passed structure */ #define GZ_NONE 0 #define GZ_READ 7247 Index: compat/zlib/gzlib.c ================================================================== --- compat/zlib/gzlib.c +++ compat/zlib/gzlib.c @@ -1,7 +1,7 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" @@ -106,11 +106,11 @@ /* check input */ if (path == NULL) return NULL; /* allocate gzFile structure to return */ - state = malloc(sizeof(gz_state)); + state = (gz_statep)malloc(sizeof(gz_state)); if (state == NULL) return NULL; state->size = 0; /* no buffers allocated yet */ state->want = GZBUFSIZE; /* requested buffer size */ state->msg = NULL; /* no error message yet */ @@ -160,12 +160,14 @@ case 'R': state->strategy = Z_RLE; break; case 'F': state->strategy = Z_FIXED; + break; case 'T': state->direct = 1; + break; default: /* could consider as an error, but just ignore */ ; } mode++; } @@ -192,12 +194,12 @@ if (len == (size_t)-1) len = 0; } else #endif - len = strlen(path); - state->path = malloc(len + 1); + len = strlen((const char *)path); + state->path = (char *)malloc(len + 1); if (state->path == NULL) { free(state); return NULL; } #ifdef _WIN32 @@ -206,11 +208,15 @@ wcstombs(state->path, path, len + 1); else *(state->path) = 0; else #endif +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(state->path, len + 1, "%s", (const char *)path); +#else strcpy(state->path, path); +#endif /* compute the flags for open() */ oflag = #ifdef O_LARGEFILE O_LARGEFILE | @@ -234,11 +240,11 @@ /* open the file with the appropriate flags (or just use fd) */ state->fd = fd > -1 ? fd : ( #ifdef _WIN32 fd == -2 ? _wopen(path, oflag, 0666) : #endif - open(path, oflag, 0666)); + open((const char *)path, oflag, 0666)); if (state->fd == -1) { free(state->path); free(state); return NULL; } @@ -280,13 +286,17 @@ const char *mode; { char *path; /* identifier for error messages */ gzFile gz; - if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL) + if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) return NULL; +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(path, 7 + 3 * sizeof(int), "", fd); /* for debugging */ +#else sprintf(path, "", fd); /* for debugging */ +#endif gz = gz_open(path, fd, mode); free(path); return gz; } @@ -529,11 +539,12 @@ return NULL; /* return error information */ if (errnum != NULL) *errnum = state->err; - return state->msg == NULL ? "" : state->msg; + return state->err == Z_MEM_ERROR ? "out of memory" : + (state->msg == NULL ? "" : state->msg); } /* -- see zlib.h -- */ void ZEXPORT gzclearerr(file) gzFile file; @@ -580,25 +591,28 @@ /* set error code, and if no message, then done */ state->err = err; if (msg == NULL) return; - /* for an out of memory error, save as static string */ - if (err == Z_MEM_ERROR) { - state->msg = (char *)msg; + /* for an out of memory error, return literal string when requested */ + if (err == Z_MEM_ERROR) return; - } /* construct error message with path */ - if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { + if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == + NULL) { state->err = Z_MEM_ERROR; - state->msg = (char *)"out of memory"; return; } +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, + "%s%s%s", state->path, ": ", msg); +#else strcpy(state->msg, state->path); strcat(state->msg, ": "); strcat(state->msg, msg); +#endif return; } #ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not Index: compat/zlib/gzread.c ================================================================== --- compat/zlib/gzread.c +++ compat/zlib/gzread.c @@ -1,7 +1,7 @@ /* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" @@ -56,11 +56,12 @@ if (state->err != Z_OK && state->err != Z_BUF_ERROR) return -1; if (state->eof == 0) { if (strm->avail_in) { /* copy what's there to the start */ - unsigned char *p = state->in, *q = strm->next_in; + unsigned char *p = state->in; + unsigned const char *q = strm->next_in; unsigned n = strm->avail_in; do { *p++ = *q++; } while (--n); } @@ -88,12 +89,12 @@ z_streamp strm = &(state->strm); /* allocate read buffers and inflate memory */ if (state->size == 0) { /* allocate buffers */ - state->in = malloc(state->want); - state->out = malloc(state->want << 1); + state->in = (unsigned char *)malloc(state->want); + state->out = (unsigned char *)malloc(state->want << 1); if (state->in == NULL || state->out == NULL) { if (state->out != NULL) free(state->out); if (state->in != NULL) free(state->in); @@ -350,18 +351,18 @@ output buffer, allowing at least one gzungetc() to succeed */ } /* large len -- read directly into user buffer */ else if (state->how == COPY) { /* read directly */ - if (gz_load(state, buf, len, &n) == -1) + if (gz_load(state, (unsigned char *)buf, len, &n) == -1) return -1; } /* large len -- decompress directly into user buffer */ else { /* state->how == GZIP */ strm->avail_out = len; - strm->next_out = buf; + strm->next_out = (unsigned char *)buf; if (gz_decomp(state) == -1) return -1; n = state->x.have; state->x.have = 0; } @@ -376,11 +377,15 @@ /* return number of bytes read into user buffer (will fit in int) */ return (int)got; } /* -- see zlib.h -- */ -#undef gzgetc +#ifdef Z_PREFIX_SET +# undef z_gzgetc +#else +# undef gzgetc +#endif int ZEXPORT gzgetc(file) gzFile file; { int ret; unsigned char buf[1]; @@ -516,11 +521,11 @@ break; /* return what we have */ } /* look for end-of-line in current output buffer */ n = state->x.have > left ? left : state->x.have; - eol = memchr(state->x.next, '\n', n); + eol = (unsigned char *)memchr(state->x.next, '\n', n); if (eol != NULL) n = (unsigned)(eol - state->x.next) + 1; /* copy through end-of-line, or remainder if not found */ memcpy(buf, state->x.next, n); Index: compat/zlib/gzwrite.c ================================================================== --- compat/zlib/gzwrite.c +++ compat/zlib/gzwrite.c @@ -1,7 +1,7 @@ /* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "gzguts.h" @@ -17,20 +17,20 @@ { int ret; z_streamp strm = &(state->strm); /* allocate input buffer */ - state->in = malloc(state->want); + state->in = (unsigned char *)malloc(state->want); if (state->in == NULL) { gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } /* only need output buffer and deflate state if compressing */ if (!state->direct) { /* allocate output buffer */ - state->out = malloc(state->want); + state->out = (unsigned char *)malloc(state->want); if (state->out == NULL) { free(state->in); gz_error(state, Z_MEM_ERROR, "out of memory"); return -1; } @@ -166,11 +166,10 @@ gzFile file; voidpc buf; unsigned len; { unsigned put = len; - unsigned n; gz_statep state; z_streamp strm; /* get internal structure */ if (file == NULL) @@ -206,20 +205,23 @@ /* for small len, copy to input buffer, otherwise compress directly */ if (len < state->size) { /* copy to input buffer, compress when full */ do { + unsigned have, copy; + if (strm->avail_in == 0) strm->next_in = state->in; - n = state->size - strm->avail_in; - if (n > len) - n = len; - memcpy(strm->next_in + strm->avail_in, buf, n); - strm->avail_in += n; - state->x.pos += n; - buf = (char *)buf + n; - len -= n; + have = (unsigned)((strm->next_in + strm->avail_in) - state->in); + copy = state->size - have; + if (copy > len) + copy = len; + memcpy(state->in + have, buf, copy); + strm->avail_in += copy; + state->x.pos += copy; + buf = (const char *)buf + copy; + len -= copy; if (len && gz_comp(state, Z_NO_FLUSH) == -1) return 0; } while (len); } else { @@ -227,11 +229,11 @@ if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) return 0; /* directly compress user buffer to file */ strm->avail_in = len; - strm->next_in = (voidp)buf; + strm->next_in = (z_const Bytef *)buf; state->x.pos += len; if (gz_comp(state, Z_NO_FLUSH) == -1) return 0; } @@ -242,10 +244,11 @@ /* -- see zlib.h -- */ int ZEXPORT gzputc(file, c) gzFile file; int c; { + unsigned have; unsigned char buf[1]; gz_statep state; z_streamp strm; /* get internal structure */ @@ -265,16 +268,20 @@ return -1; } /* try writing to input buffer for speed (state->size == 0 if buffer not initialized) */ - if (strm->avail_in < state->size) { + if (state->size) { if (strm->avail_in == 0) strm->next_in = state->in; - strm->next_in[strm->avail_in++] = c; - state->x.pos++; - return c & 0xff; + have = (unsigned)((strm->next_in + strm->avail_in) - state->in); + if (have < state->size) { + state->in[have] = c; + strm->avail_in++; + state->x.pos++; + return c & 0xff; + } } /* no room in buffer or not initialized, use gz_write() */ buf[0] = c; if (gzwrite(file, buf, 1) != 1) @@ -298,16 +305,15 @@ #if defined(STDC) || defined(Z_HAVE_STDARG_H) #include /* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (gzFile file, const char *format, ...) +int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) { int size, len; gz_statep state; z_streamp strm; - va_list va; /* get internal structure */ if (file == NULL) return -1; state = (gz_statep)file; @@ -333,29 +339,24 @@ return 0; /* do the printf() into the input buffer, put length in len */ size = (int)(state->size); state->in[size - 1] = 0; - va_start(va, format); #ifdef NO_vsnprintf # ifdef HAS_vsprintf_void (void)vsprintf((char *)(state->in), format, va); - va_end(va); for (len = 0; len < size; len++) if (state->in[len] == 0) break; # else len = vsprintf((char *)(state->in), format, va); - va_end(va); # endif #else # ifdef HAS_vsnprintf_void (void)vsnprintf((char *)(state->in), size, format, va); - va_end(va); len = strlen((char *)(state->in)); # else len = vsnprintf((char *)(state->in), size, format, va); - va_end(va); # endif #endif /* check that printf() results fit in buffer */ if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) @@ -365,10 +366,21 @@ strm->avail_in = (unsigned)len; strm->next_in = state->in; state->x.pos += len; return len; } + +int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) +{ + va_list va; + int ret; + + va_start(va, format); + ret = gzvprintf(file, format, va); + va_end(va); + return ret; +} #else /* !STDC && !Z_HAVE_STDARG_H */ /* -- see zlib.h -- */ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, @@ -545,13 +557,13 @@ if (gz_zero(state, state->skip) == -1) ret = state->err; } /* flush, free memory, and close file */ + if (gz_comp(state, Z_FINISH) == -1) + ret = state->err; if (state->size) { - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; if (!state->direct) { (void)deflateEnd(&(state->strm)); free(state->out); } free(state->in); Index: compat/zlib/infback.c ================================================================== --- compat/zlib/infback.c +++ compat/zlib/infback.c @@ -253,11 +253,11 @@ void FAR *in_desc; out_func out; void FAR *out_desc; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned copy; /* number of stored or match bytes to copy */ Index: compat/zlib/inffast.c ================================================================== --- compat/zlib/inffast.c +++ compat/zlib/inffast.c @@ -1,7 +1,7 @@ /* inffast.c -- fast decoding - * Copyright (C) 1995-2008, 2010 Mark Adler + * Copyright (C) 1995-2008, 2010, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" @@ -67,12 +67,12 @@ void ZLIB_INTERNAL inflate_fast(strm, start) z_streamp strm; unsigned start; /* inflate()'s starting value for strm->avail_out */ { struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ + z_const unsigned char FAR *in; /* local strm->next_in */ + z_const unsigned char FAR *last; /* have enough input while in < last */ unsigned char FAR *out; /* local strm->next_out */ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ unsigned char FAR *end; /* while out < end, enough space available */ #ifdef INFLATE_STRICT unsigned dmax; /* maximum distance from zlib header */ Index: compat/zlib/inflate.c ================================================================== --- compat/zlib/inflate.c +++ compat/zlib/inflate.c @@ -91,15 +91,16 @@ # endif #endif /* function prototypes */ local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); +local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, + unsigned copy)); #ifdef BUILDFIXED void makefixed OF((void)); #endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, +local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateResetKeep(strm) z_streamp strm; { @@ -373,16 +374,17 @@ advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ -local int updatewindow(strm, out) +local int updatewindow(strm, end, copy) z_streamp strm; -unsigned out; +const Bytef *end; +unsigned copy; { struct inflate_state FAR *state; - unsigned copy, dist; + unsigned dist; state = (struct inflate_state FAR *)strm->state; /* if it hasn't been done already, allocate space for the window */ if (state->window == Z_NULL) { @@ -398,23 +400,22 @@ state->wnext = 0; state->whave = 0; } /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + zmemcpy(state->window, end - state->wsize, state->wsize); state->wnext = 0; state->whave = state->wsize; } else { dist = state->wsize - state->wnext; if (dist > copy) dist = copy; - zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); + zmemcpy(state->window + state->wnext, end - copy, dist); copy -= dist; if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); + zmemcpy(state->window, end - copy, copy); state->wnext = copy; state->whave = state->wsize; } else { state->wnext += dist; @@ -604,11 +605,11 @@ int ZEXPORT inflate(strm, flush) z_streamp strm; int flush; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + z_const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ unsigned bits; /* bits in bit buffer */ unsigned in, out; /* save starting available input and output */ @@ -918,11 +919,11 @@ DROPBITS(3); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; - state->lencode = (code const FAR *)(state->next); + state->lencode = (const code FAR *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid code lengths set"; @@ -992,20 +993,20 @@ /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state->next = state->codes; - state->lencode = (code const FAR *)(state->next); + state->lencode = (const code FAR *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid literal/lengths set"; state->mode = BAD; break; } - state->distcode = (code const FAR *)(state->next); + state->distcode = (const code FAR *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = (char *)"invalid distances set"; @@ -1228,11 +1229,11 @@ */ inf_leave: RESTORE(); if (state->wsize || (out != strm->avail_out && state->mode < BAD && (state->mode < CHECK || flush != Z_FINISH))) - if (updatewindow(strm, out)) { + if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { state->mode = MEM; return Z_MEM_ERROR; } in -= strm->avail_in; out -= strm->avail_out; @@ -1261,20 +1262,41 @@ ZFREE(strm, strm->state); strm->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } + +int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) +z_streamp strm; +Bytef *dictionary; +uInt *dictLength; +{ + struct inflate_state FAR *state; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* copy dictionary */ + if (state->whave && dictionary != Z_NULL) { + zmemcpy(dictionary, state->window + state->wnext, + state->whave - state->wnext); + zmemcpy(dictionary + state->whave - state->wnext, + state->window, state->wnext); + } + if (dictLength != Z_NULL) + *dictLength = state->whave; + return Z_OK; +} int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { struct inflate_state FAR *state; unsigned long dictid; - unsigned char *next; - unsigned avail; int ret; /* check state */ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; @@ -1289,17 +1311,11 @@ return Z_DATA_ERROR; } /* copy dictionary to window using updatewindow(), which will amend the existing dictionary if appropriate */ - next = strm->next_out; - avail = strm->avail_out; - strm->next_out = (Bytef *)dictionary + dictLength; - strm->avail_out = 0; - ret = updatewindow(strm, dictLength); - strm->avail_out = avail; - strm->next_out = next; + ret = updatewindow(strm, dictionary + dictLength, dictLength); if (ret) { state->mode = MEM; return Z_MEM_ERROR; } state->havedict = 1; @@ -1335,11 +1351,11 @@ called again with more data and the *have state. *have is initialized to zero for the first call. */ local unsigned syncsearch(have, buf, len) unsigned FAR *have; -unsigned char FAR *buf; +const unsigned char FAR *buf; unsigned len; { unsigned got; unsigned next; Index: compat/zlib/inftrees.c ================================================================== --- compat/zlib/inftrees.c +++ compat/zlib/inftrees.c @@ -1,17 +1,17 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2012 Mark Adler + * Copyright (C) 1995-2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.2.7 Copyright 1995-2012 Mark Adler "; + " inflate 1.2.8 Copyright 1995-2013 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. @@ -60,11 +60,11 @@ static const unsigned short lbase[31] = { /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 78, 68}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0}; static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ @@ -206,12 +206,12 @@ low = (unsigned)(-1); /* trigger new sub-table when len > root */ used = 1U << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) + if ((type == LENS && used > ENOUGH_LENS) || + (type == DISTS && used > ENOUGH_DISTS)) return 1; /* process all codes and make table entries */ for (;;) { /* create table entry */ @@ -275,12 +275,12 @@ left <<= 1; } /* check for enough space */ used += 1U << curr; - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) + if ((type == LENS && used > ENOUGH_LENS) || + (type == DISTS && used > ENOUGH_DISTS)) return 1; /* point entry in root table to sub-table */ low = huff & mask; (*table)[low].op = (unsigned char)curr; Index: compat/zlib/qnx/package.qpg ================================================================== --- compat/zlib/qnx/package.qpg +++ compat/zlib/qnx/package.qpg @@ -23,14 +23,14 @@ - - - - + + + + @@ -61,11 +61,11 @@ http://www.gzip.org/zlib - 1.2.7 + 1.2.8 Medium Stable Index: compat/zlib/test/example.c ================================================================== --- compat/zlib/test/example.c +++ compat/zlib/test/example.c @@ -24,11 +24,11 @@ fprintf(stderr, "%s error: %d\n", msg, err); \ exit(1); \ } \ } -const char hello[] = "hello, hello!"; +z_const char hello[] = "hello, hello!"; /* "hello world" would be more standard, but the repeated "hello" * stresses the compression code better, sorry... */ const char dictionary[] = "hello"; @@ -210,11 +210,11 @@ c_stream.opaque = (voidpf)0; err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, "deflateInit"); - c_stream.next_in = (Bytef*)hello; + c_stream.next_in = (z_const unsigned char *)hello; c_stream.next_out = compr; while (c_stream.total_in != len && c_stream.total_out < comprLen) { c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ err = deflate(&c_stream, Z_NO_FLUSH); @@ -385,11 +385,11 @@ c_stream.opaque = (voidpf)0; err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, "deflateInit"); - c_stream.next_in = (Bytef*)hello; + c_stream.next_in = (z_const unsigned char *)hello; c_stream.next_out = compr; c_stream.avail_in = 3; c_stream.avail_out = (uInt)*comprLen; err = deflate(&c_stream, Z_FULL_FLUSH); CHECK_ERR(err, "deflate"); @@ -474,11 +474,11 @@ dictId = c_stream.adler; c_stream.next_out = compr; c_stream.avail_out = (uInt)comprLen; - c_stream.next_in = (Bytef*)hello; + c_stream.next_in = (z_const unsigned char *)hello; c_stream.avail_in = (uInt)strlen(hello)+1; err = deflate(&c_stream, Z_FINISH); if (err != Z_STREAM_END) { fprintf(stderr, "deflate should report Z_STREAM_END\n"); Index: compat/zlib/test/minigzip.c ================================================================== --- compat/zlib/test/minigzip.c +++ compat/zlib/test/minigzip.c @@ -37,10 +37,14 @@ # endif # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) #else # define SET_BINARY_MODE(file) #endif + +#ifdef _MSC_VER +# define snprintf _snprintf +#endif #ifdef VMS # define unlink delete # define GZ_SUFFIX "-gz" #endif @@ -461,12 +465,16 @@ if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { fprintf(stderr, "%s: filename too long\n", prog); exit(1); } +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); +#else strcpy(outfile, file); strcat(outfile, GZ_SUFFIX); +#endif in = fopen(file, "rb"); if (in == NULL) { perror(file); exit(1); @@ -497,20 +505,28 @@ if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { fprintf(stderr, "%s: filename too long\n", prog); exit(1); } +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(buf, sizeof(buf), "%s", file); +#else strcpy(buf, file); +#endif if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { infile = file; outfile = buf; outfile[len-3] = '\0'; } else { outfile = file; infile = buf; +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX); +#else strcat(infile, GZ_SUFFIX); +#endif } in = gzopen(infile, "rb"); if (in == NULL) { fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); exit(1); @@ -544,11 +560,15 @@ int copyout = 0; int uncompr = 0; gzFile file; char *bname, outmode[20]; +#if !defined(NO_snprintf) && !defined(NO_vsnprintf) + snprintf(outmode, sizeof(outmode), "%s", "wb6 "); +#else strcpy(outmode, "wb6 "); +#endif prog = argv[0]; bname = strrchr(argv[0], '/'); if (bname) bname++; Index: compat/zlib/treebuild.xml ================================================================== --- compat/zlib/treebuild.xml +++ compat/zlib/treebuild.xml @@ -1,8 +1,8 @@ - - + + zip compression library Index: compat/zlib/trees.c ================================================================== --- compat/zlib/trees.c +++ compat/zlib/trees.c @@ -144,12 +144,12 @@ local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree OF((deflate_state *s)); local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); +local void compress_block OF((deflate_state *s, const ct_data *ltree, + const ct_data *dtree)); local int detect_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); local void copy_block OF((deflate_state *s, charf *buf, unsigned len, @@ -970,19 +970,21 @@ } else if (static_lenb >= 0) { /* force static trees */ #else } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+last, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); + compress_block(s, (const ct_data *)static_ltree, + (const ct_data *)static_dtree); #ifdef DEBUG s->compressed_len += 3 + s->static_len; #endif } else { send_bits(s, (DYN_TREES<<1)+last, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); + compress_block(s, (const ct_data *)s->dyn_ltree, + (const ct_data *)s->dyn_dtree); #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif } Assert (s->compressed_len == s->bits_sent, "bad compressed size"); @@ -1055,12 +1057,12 @@ /* =========================================================================== * Send the block data compressed using the given Huffman trees */ local void compress_block(s, ltree, dtree) deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ + const ct_data *ltree; /* literal tree */ + const ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ unsigned lx = 0; /* running index in l_buf */ unsigned code; /* the code to send */ Index: compat/zlib/uncompr.c ================================================================== --- compat/zlib/uncompr.c +++ compat/zlib/uncompr.c @@ -28,11 +28,11 @@ uLong sourceLen; { z_stream stream; int err; - stream.next_in = (Bytef*)source; + stream.next_in = (z_const Bytef *)source; stream.avail_in = (uInt)sourceLen; /* Check for source > 64K on 16-bit machine: */ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; stream.next_out = dest; Index: compat/zlib/win32/Makefile.msc ================================================================== --- compat/zlib/win32/Makefile.msc +++ compat/zlib/win32/Makefile.msc @@ -6,10 +6,14 @@ # nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) # nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \ # OBJA="inffas32.obj match686.obj" (use ASM code, x86) # nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \ # OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64) + +# The toplevel directory of the source tree. +# +TOP = . # optional build flags LOC = # variables @@ -41,12 +45,12 @@ $(STATICLIB): $(OBJS) $(OBJA) $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA) $(IMPLIB): $(SHAREDLIB) -$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res - $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \ +$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res + $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \ -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res if exist $@.manifest \ mt -nologo -manifest $@.manifest -outputresource:$@;2 example.exe: example.obj $(STATICLIB) @@ -67,76 +71,75 @@ minigzip_d.exe: minigzip.obj $(IMPLIB) $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB) if exist $@.manifest \ mt -nologo -manifest $@.manifest -outputresource:$@;1 -.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -{test}.c.obj: - $(CC) -c -I. $(WFLAGS) $(CFLAGS) $< - -{contrib/masmx64}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -{contrib/masmx64}.asm.obj: - $(AS) -c $(ASFLAGS) $< - -{contrib/masmx86}.asm.obj: - $(AS) -c $(ASFLAGS) $< - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -gvmat64.obj: contrib\masmx64\gvmat64.asm - -inffasx64.obj: contrib\masmx64\inffasx64.asm - -inffas8664.obj: contrib\masmx64\inffas8664.c zutil.h zlib.h zconf.h \ - inftrees.h inflate.h inffast.h - -inffas32.obj: contrib\masmx86\inffas32.asm - -match686.obj: contrib\masmx86\match686.asm - -example.obj: test/example.c zlib.h zconf.h - -minigzip.obj: test/minigzip.c zlib.h zconf.h - -zlib1.res: win32/zlib1.rc - $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc - +{$(TOP)}.c.obj: + $(CC) -c $(WFLAGS) $(CFLAGS) $< + +{$(TOP)/test}.c.obj: + $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< + +{$(TOP)/contrib/masmx64}.c.obj: + $(CC) -c $(WFLAGS) $(CFLAGS) $< + +{$(TOP)/contrib/masmx64}.asm.obj: + $(AS) -c $(ASFLAGS) $< + +{$(TOP)/contrib/masmx86}.asm.obj: + $(AS) -c $(ASFLAGS) $< + +adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h + +compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h + +crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h + +deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h + +gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h + +gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h + +gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h + +gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h + +infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ + $(TOP)/inffast.h $(TOP)/inffixed.h + +inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ + $(TOP)/inffast.h + +inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ + $(TOP)/inffast.h $(TOP)/inffixed.h + +inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h + +trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h + +uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h + +zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h + +gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm + +inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm + +inffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \ + $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h + +inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm + +match686.obj: $(TOP)/contrib\masmx86\match686.asm + +example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h + +minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h + +zlib1.res: $(TOP)/win32/zlib1.rc + $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc # testing test: example.exe minigzip.exe example echo hello world | minigzip | minigzip -d Index: compat/zlib/win32/README-WIN32.txt ================================================================== --- compat/zlib/win32/README-WIN32.txt +++ compat/zlib/win32/README-WIN32.txt @@ -1,8 +1,8 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.7 is a general purpose data compression library. All the code is +zlib 1.2.8 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). @@ -20,11 +20,11 @@ before asking for help. Manifest: -The package zlib-1.2.7-win32-x86.zip will contain the following files: +The package zlib-1.2.8-win32-x86.zip will contain the following files: README-WIN32.txt This document ChangeLog Changes since previous zlib packages DLL_FAQ.txt Frequently asked questions about zlib1.dll zlib.3.pdf Documentation of this library in Adobe Acrobat format Index: compat/zlib/win32/zlib.def ================================================================== --- compat/zlib/win32/zlib.def +++ compat/zlib/win32/zlib.def @@ -15,10 +15,11 @@ deflateBound deflatePending deflatePrime deflateSetHeader inflateSetDictionary + inflateGetDictionary inflateSync inflateCopy inflateReset inflateReset2 inflatePrime @@ -37,10 +38,11 @@ gzbuffer gzsetparams gzread gzwrite gzprintf + gzvprintf gzputs gzgets gzputc gzgetc gzungetc Index: compat/zlib/win32/zlib1.rc ================================================================== --- compat/zlib/win32/zlib1.rc +++ compat/zlib/win32/zlib1.rc @@ -24,11 +24,11 @@ //language ID = U.S. English, char set = Windows, Multilingual BEGIN VALUE "FileDescription", "zlib data compression library\0" VALUE "FileVersion", ZLIB_VERSION "\0" VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2006 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" VALUE "OriginalFilename", "zlib1.dll\0" VALUE "ProductName", "zlib\0" VALUE "ProductVersion", ZLIB_VERSION "\0" VALUE "Comments", "For more information visit http://www.zlib.net/\0" END Index: compat/zlib/zconf.h ================================================================== --- compat/zlib/zconf.h +++ compat/zlib/zconf.h @@ -1,7 +1,7 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -19,10 +19,11 @@ /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define _tr_tally z__tr_tally # define adler32 z_adler32 @@ -75,10 +76,11 @@ # define gzopen64 z_gzopen64 # ifdef _WIN32 # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread # define gzrewind z_gzrewind # define gzseek z_gzseek @@ -101,10 +103,11 @@ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflateResetKeep z_inflateResetKeep # define inflate_copyright z_inflate_copyright @@ -386,24 +389,18 @@ typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif -/* ./configure may #define Z_U4 here */ - #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned -# else -# if (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# else -# if (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -# endif +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short # endif #endif #ifdef Z_U4 typedef Z_U4 z_crc_t; @@ -422,30 +419,38 @@ #ifdef STDC # ifndef Z_SOLO # include /* for off_t */ # endif #endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif #ifdef _WIN32 -# include /* for wchar_t */ +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ # endif # ifndef z_off_t Index: compat/zlib/zconf.h.cmakein ================================================================== --- compat/zlib/zconf.h.cmakein +++ compat/zlib/zconf.h.cmakein @@ -1,7 +1,7 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -21,10 +21,11 @@ /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define _tr_tally z__tr_tally # define adler32 z_adler32 @@ -77,10 +78,11 @@ # define gzopen64 z_gzopen64 # ifdef _WIN32 # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread # define gzrewind z_gzrewind # define gzseek z_gzseek @@ -103,10 +105,11 @@ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflateResetKeep z_inflateResetKeep # define inflate_copyright z_inflate_copyright @@ -388,24 +391,18 @@ typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif -/* ./configure may #define Z_U4 here */ - #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned -# else -# if (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# else -# if (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -# endif +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short # endif #endif #ifdef Z_U4 typedef Z_U4 z_crc_t; @@ -424,30 +421,38 @@ #ifdef STDC # ifndef Z_SOLO # include /* for off_t */ # endif #endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif #ifdef _WIN32 -# include /* for wchar_t */ +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ # endif # ifndef z_off_t Index: compat/zlib/zconf.h.in ================================================================== --- compat/zlib/zconf.h.in +++ compat/zlib/zconf.h.in @@ -1,7 +1,7 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -19,10 +19,11 @@ /* all linked symbols */ # define _dist_code z__dist_code # define _length_code z__length_code # define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define _tr_tally z__tr_tally # define adler32 z_adler32 @@ -75,10 +76,11 @@ # define gzopen64 z_gzopen64 # ifdef _WIN32 # define gzopen_w z_gzopen_w # endif # define gzprintf z_gzprintf +# define gzvprintf z_gzvprintf # define gzputc z_gzputc # define gzputs z_gzputs # define gzread z_gzread # define gzrewind z_gzrewind # define gzseek z_gzseek @@ -101,10 +103,11 @@ # define inflateMark z_inflateMark # define inflatePrime z_inflatePrime # define inflateReset z_inflateReset # define inflateReset2 z_inflateReset2 # define inflateSetDictionary z_inflateSetDictionary +# define inflateGetDictionary z_inflateGetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateUndermine z_inflateUndermine # define inflateResetKeep z_inflateResetKeep # define inflate_copyright z_inflate_copyright @@ -386,24 +389,18 @@ typedef Byte const *voidpc; typedef Byte FAR *voidpf; typedef Byte *voidp; #endif -/* ./configure may #define Z_U4 here */ - #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) # include # if (UINT_MAX == 0xffffffffUL) # define Z_U4 unsigned -# else -# if (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# else -# if (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -# endif +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short # endif #endif #ifdef Z_U4 typedef Z_U4 z_crc_t; @@ -422,30 +419,38 @@ #ifdef STDC # ifndef Z_SOLO # include /* for off_t */ # endif #endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif #ifdef _WIN32 -# include /* for wchar_t */ +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif #endif /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as * equivalently requesting no 64-bit operations */ -#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 # undef _LARGEFILE64_SOURCE #endif #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif #ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE) +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) # include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ # ifdef VMS # include /* for off_t */ # endif # ifndef z_off_t Index: compat/zlib/zlib.3 ================================================================== --- compat/zlib/zlib.3 +++ compat/zlib/zlib.3 @@ -1,6 +1,6 @@ -.TH ZLIB 3 "2 May 2012" +.TH ZLIB 3 "28 Apr 2013" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS [see .I zlib.h @@ -123,12 +123,12 @@ .LP before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS -Version 1.2.7 -Copyright (C) 1995-2012 Jean-loup Gailly (jloup@gzip.org) +Version 1.2.8 +Copyright (C) 1995-2013 Jean-loup Gailly (jloup@gzip.org) and Mark Adler (madler@alumni.caltech.edu). .LP This software is provided "as-is," without any express or implied warranty. In no event will the authors be held liable for any damages Index: compat/zlib/zlib.3.pdf ================================================================== --- compat/zlib/zlib.3.pdf +++ compat/zlib/zlib.3.pdf cannot compute difference between binary files Index: compat/zlib/zlib.h ================================================================== --- compat/zlib/zlib.h +++ compat/zlib/zlib.h @@ -1,9 +1,9 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.7, May 2nd, 2012 + version 1.2.8, April 28th, 2013 - Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. @@ -35,15 +35,15 @@ #ifdef __cplusplus extern "C" { #endif -#define ZLIB_VERSION "1.2.7" -#define ZLIB_VERNUM 0x1270 +#define ZLIB_VERSION "1.2.8" +#define ZLIB_VERNUM 0x1280 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 7 +#define ZLIB_VER_REVISION 8 #define ZLIB_VER_SUBREVISION 0 /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. @@ -836,19 +836,34 @@ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ + +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a possible full flush point (see above for the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurences of this + All full flush points have this pattern, but not all occurrences of this pattern are full flush points. inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. @@ -1005,23 +1020,25 @@ the parameters are invalid, Z_MEM_ERROR if the internal state could not be allocated, or Z_VERSION_ERROR if the version of the library does not match the version of the header file. */ -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)); /* inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. inflateBackInit() must be called first to allocate the internal state and to initialize the state with the user-provided window buffer. inflateBack() may then be used multiple times to inflate a complete, raw deflate stream with each call. inflateBackEnd() is then called to free the @@ -1733,12 +1750,19 @@ ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); #if defined(_WIN32) && !defined(Z_SOLO) ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, const char *mode)); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + const char *format, + va_list va)); +# endif #endif #ifdef __cplusplus } #endif #endif /* ZLIB_H */ Index: compat/zlib/zlib.map ================================================================== --- compat/zlib/zlib.map +++ compat/zlib/zlib.map @@ -74,5 +74,10 @@ ZLIB_1.2.5.2 { deflateResetKeep; gzgetc_; inflateResetKeep; } ZLIB_1.2.5.1; + +ZLIB_1.2.7.1 { + inflateGetDictionary; + gzvprintf; +} ZLIB_1.2.5.2; Index: compat/zlib/zutil.c ================================================================== --- compat/zlib/zutil.c +++ compat/zlib/zutil.c @@ -12,11 +12,11 @@ #ifndef NO_DUMMY_DECL struct internal_state {int dummy;}; /* for buggy compilers */ #endif -const char * const z_errmsg[10] = { +z_const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ Index: compat/zlib/zutil.h ================================================================== --- compat/zlib/zutil.h +++ compat/zlib/zutil.h @@ -1,7 +1,7 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2012 Jean-loup Gailly. + * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is @@ -42,17 +42,17 @@ typedef uch FAR uchf; typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) + return (strm->msg = ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ #ifndef DEF_WBITS @@ -166,11 +166,12 @@ #pragma warn -8008 #pragma warn -8066 #endif /* provide prototypes for these when building zlib without LFS */ -#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) +#if !defined(_WIN32) && \ + (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); #endif /* common defaults */ Index: src/add.c ================================================================== --- src/add.c +++ src/add.c @@ -20,10 +20,11 @@ */ #include "config.h" #include "add.h" #include #include +#include "cygsup.h" /* ** This routine returns the names of files in a working checkout that ** are created by Fossil itself, and hence should not be added, deleted, ** or merge, and should be omitted from "clean" and "extra" lists. @@ -136,22 +137,20 @@ ** ** Omit any file whose name is pOmit. */ static int add_one_file( const char *zPath, /* Tree-name of file to add. */ - int vid, /* Add to this VFILE */ - int caseSensitive /* True if filenames are case sensitive */ + int vid /* Add to this VFILE */ ){ - const char *zCollate = caseSensitive ? "binary" : "nocase"; if( !file_is_simple_pathname(zPath, 1) ){ fossil_warning("filename contains illegal characters: %s", zPath); return 0; } if( db_exists("SELECT 1 FROM vfile" - " WHERE pathname=%Q COLLATE %s", zPath, zCollate) ){ + " WHERE pathname=%Q %s", zPath, filename_collation()) ){ db_multi_exec("UPDATE vfile SET deleted=0" - " WHERE pathname=%Q COLLATE %s", zPath, zCollate); + " WHERE pathname=%Q %s", zPath, filename_collation()); }else{ char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath); db_multi_exec( "INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink)" "VALUES(%d,0,0,0,%Q,%d,%d)", @@ -170,11 +169,11 @@ /* ** Add all files in the sfile temp table. ** ** Automatically exclude the repository file. */ -static int add_files_in_sfile(int vid, int caseSensitive){ +static int add_files_in_sfile(int vid){ const char *zRepo; /* Name of the repository database file */ int nAdd = 0; /* Number of files added */ int i; /* Loop counter */ const char *zReserved; /* Name of a reserved file */ Blob repoName; /* Treename of the repository */ @@ -185,28 +184,24 @@ blob_zero(&repoName); zRepo = ""; }else{ zRepo = blob_str(&repoName); } - if( caseSensitive ){ + if( filenames_are_case_sensitive() ){ xCmp = fossil_strcmp; }else{ xCmp = fossil_stricmp; - db_multi_exec( - "CREATE INDEX IF NOT EXISTS vfile_nocase" - " ON vfile(pathname COLLATE nocase)" - ); } db_prepare(&loop, "SELECT x FROM sfile ORDER BY x"); while( db_step(&loop)==SQLITE_ROW ){ const char *zToAdd = db_column_text(&loop, 0); if( fossil_strcmp(zToAdd, zRepo)==0 ) continue; for(i=0; (zReserved = fossil_reserved_name(i, 0))!=0; i++){ if( xCmp(zToAdd, zReserved)==0 ) break; } if( zReserved ) continue; - nAdd += add_one_file(zToAdd, vid, caseSensitive); + nAdd += add_one_file(zToAdd, vid); } db_finalize(&loop); blob_reset(&repoName); return nAdd; } @@ -221,14 +216,15 @@ ** ** When adding files or directories recursively, filenames that begin ** with "." are excluded by default. To include such files, add ** the "--dotfiles" option to the command-line. ** -** The --ignore option is a comma-separate list of glob patterns for files -** to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore option -** does not appear on the command line then the "ignore-glob" setting is -** used. +** The --ignore and --clean options are comma-separate lists of glob patterns +** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore +** option does not appear on the command line then the "ignore-glob" setting +** is used. If the --clean option does not appear on the command line then +** the "clean-glob" setting is used. ** ** The --case-sensitive option determines whether or not filenames should ** be treated case sensitive or not. If the option is not given, the default ** depends on the global setting, or the operating system default, if not set. ** @@ -236,42 +232,40 @@ ** ** --case-sensitive override case-sensitive setting ** --dotfiles include files beginning with a dot (".") ** --ignore ignore files matching patterns from the ** comma separated list of glob patterns. +** --clean also ignore files matching patterns from +** the comma separated list of glob patterns. ** ** See also: addremove, rm */ void add_cmd(void){ int i; /* Loop counter */ int vid; /* Currently checked out version */ int nRoot; /* Full path characters in g.zLocalRoot */ + const char *zCleanFlag; /* The --clean option or clean-glob setting */ const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */ - Glob *pIgnore; /* Ignore everything matching this glob pattern */ - int caseSensitive; /* True if filenames are case sensitive */ + Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */ unsigned scanFlags = 0; /* Flags passed to vfile_scan() */ + zCleanFlag = find_option("clean",0,1); zIgnoreFlag = find_option("ignore",0,1); if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; capture_case_sensitive_option(); db_must_be_within_tree(); - caseSensitive = filenames_are_case_sensitive(); + if( zCleanFlag==0 ){ + zCleanFlag = db_get("clean-glob", 0); + } if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } vid = db_lget_int("checkout",0); - if( vid==0 ){ - fossil_panic("no checkout to add to"); - } db_begin_transaction(); - db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); -#if defined(_WIN32) - db_multi_exec( - "CREATE INDEX IF NOT EXISTS vfile_pathname " - " ON vfile(pathname COLLATE nocase)" - ); -#endif + db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", + filename_collation()); + pClean = glob_create(zCleanFlag); pIgnore = glob_create(zIgnoreFlag); nRoot = strlen(g.zLocalRoot); /* Load the names of all files that are to be added into sfile temp table */ for(i=2; i override case-sensitive setting +** ** See also: addremove, add */ void delete_cmd(void){ int i; - int vid; Stmt loop; + capture_case_sensitive_option(); db_must_be_within_tree(); - vid = db_lget_int("checkout", 0); - if( vid==0 ){ - fossil_panic("no checkout to remove from"); - } db_begin_transaction(); - db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); + db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", + filename_collation()); for(i=2; i'%q/' AND pathname<'%q0'))" + " WHERE (pathname=%Q %s" + " OR (pathname>'%q/' %s AND pathname<'%q0' %s))" " AND NOT deleted", - zTreeName, zTreeName, zTreeName + zTreeName, filename_collation(), zTreeName, + filename_collation(), zTreeName, filename_collation() ); blob_reset(&treeName); } db_prepare(&loop, "SELECT x FROM sfile"); @@ -374,13 +370,15 @@ ** In other words, this routine determines if two filenames that ** differ only in case should be considered the same name or not. ** ** The case-sensitive setting determines the default value. If ** the case-sensitive setting is undefined, then case sensitivity -** defaults on for Mac and Windows and off for all other unix. +** defaults off for Cygwin, Mac and Windows and on for all other unix. +** If case-sensitivity is enabled in the windows kernel, the Cygwin port +** of fossil.exe can detect that, and modifies the default to 'on'. ** -** The --case-sensitive BOOLEAN command-line option overrides any +** The --case-sensitive command-line option overrides any ** setting. */ int filenames_are_case_sensitive(void){ static int caseSensitive; static int once = 1; @@ -388,16 +386,33 @@ if( once ){ once = 0; if( zCaseSensitive ){ caseSensitive = is_truth(zCaseSensitive); }else{ -#if !defined(_WIN32) && !defined(__DARWIN__) && !defined(__APPLE__) - caseSensitive = 1; /* Unix */ +#if defined(_WIN32) || defined(__DARWIN__) || defined(__APPLE__) + caseSensitive = 0; /* Mac and Windows */ +#elif defined(__CYGWIN__) + /* Cygwin can be configured to be case-sensitive, check this. */ + void *hKey; + int value = 1, length = sizeof(int); + caseSensitive = 0; /* Cygwin default */ + if( (RegOpenKeyExW((void *)0x80000002, L"SYSTEM\\CurrentControlSet\\" + "Control\\Session Manager\\kernel", 0, 1, (void *)&hKey) + == 0) && (RegQueryValueExW(hKey, L"obcaseinsensitive", + 0, NULL, (void *)&value, (void *)&length) == 0) && !value ){ + caseSensitive = 1; + } #else - caseSensitive = 0; /* Windows and Mac */ + caseSensitive = 1; /* Unix */ #endif caseSensitive = db_get_boolean("case-sensitive",caseSensitive); + } + if( !caseSensitive && g.localOpen ){ + db_multi_exec( + "CREATE INDEX IF NOT EXISTS vfile_nocase" + " ON vfile(pathname COLLATE nocase)" + ); } } return caseSensitive; } @@ -410,22 +425,10 @@ */ const char *filename_collation(void){ return filenames_are_case_sensitive() ? "" : "COLLATE nocase"; } -/* -** Do a strncmp() operation which is either case-sensitive or not -** depending on the setting of filenames_are_case_sensitive(). -*/ -int filenames_strncmp(const char *zA, const char *zB, int nByte){ - if( filenames_are_case_sensitive() ){ - return fossil_strncmp(zA,zB,nByte); - }else{ - return fossil_strnicmp(zA,zB,nByte); - } -} - /* ** COMMAND: addremove ** ** Usage: %fossil addremove ?OPTIONS? ** @@ -444,66 +447,74 @@ ** as a separate step. ** ** Files and directories whose names begin with "." are ignored unless ** the --dotfiles option is used. ** -** The --ignore option overrides the "ignore-glob" setting, as does the -** --case-sensitive option with the "case-sensitive" setting. See the -** documentation on the "settings" command for further information. +** The --ignore option overrides the "ignore-glob" setting, as do the +** --case-sensitive option with the "case-sensitive" setting and the +** --clean option with the "clean-glob" setting. See the documentation +** on the "settings" command for further information. ** -** The --test option shows what would happen without actually doing anything. +** The -n|--dry-run option shows what would happen without actually doing anything. ** ** This command can be used to track third party software. ** ** Options: ** --case-sensitive override case-sensitive setting -** --dotfiles include files beginning with a dot (".") -** --ignore ignore files matching patterns from the +** --dotfiles include files beginning with a dot (".") +** --ignore ignore files matching patterns from the ** comma separated list of glob patterns. -** --test If given, display instead of run actions +** --clean also ignore files matching patterns from +** the comma separated list of glob patterns. +** -n|--dry-run If given, display instead of run actions ** ** See also: add, rm */ void addremove_cmd(void){ Blob path; + const char *zCleanFlag = find_option("clean",0,1); const char *zIgnoreFlag = find_option("ignore",0,1); unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; - int isTest = find_option("test",0,0)!=0; - int caseSensitive; + int dryRunFlag = find_option("dry-run","n",0)!=0; int n; Stmt q; int vid; int nAdd = 0; int nDelete = 0; - Glob *pIgnore; + Glob *pIgnore, *pClean; + if( !dryRunFlag ){ + dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ + } capture_case_sensitive_option(); db_must_be_within_tree(); - caseSensitive = filenames_are_case_sensitive(); + if( zCleanFlag==0 ){ + zCleanFlag = db_get("clean-glob", 0); + } if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } vid = db_lget_int("checkout",0); - if( vid==0 ){ - fossil_panic("no checkout to add to"); - } db_begin_transaction(); /* step 1: ** Populate the temp table "sfile" with the names of all unmanaged ** files currently in the check-out, except for files that match the ** --ignore or ignore-glob patterns and dot-files. Then add all of ** the files in the sfile temp table to the set of managed files. */ - db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); + db_multi_exec("CREATE TEMP TABLE sfile(x 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, pIgnore); + vfile_scan(&path, blob_size(&path), scanFlags, pClean, pIgnore); glob_free(pIgnore); - nAdd = add_files_in_sfile(vid, caseSensitive); + 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" " WHERE NOT deleted" @@ -515,11 +526,11 @@ const char * zPath; zFile = db_column_text(&q, 0); zPath = db_column_text(&q, 1); if( !file_wd_isfile_or_link(zPath) ){ - if( !isTest ){ + if( !dryRunFlag ){ db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); } fossil_print("DELETED %s\n", zFile); nDelete++; } @@ -526,21 +537,22 @@ } db_finalize(&q); /* show command summary */ fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); - db_end_transaction(isTest); + db_end_transaction(dryRunFlag); } /* ** Rename a single file. ** ** The original name of the file is zOrig. The new filename is zNew. */ static void mv_one_file(int vid, const char *zOrig, const char *zNew){ - int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q", zNew); + int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q %s", + zNew, filename_collation()); if( x>=0 ){ if( x==0 ){ fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'" " is currently under management", zOrig, zNew, zNew); }else{ @@ -548,12 +560,12 @@ "not yet been committed", zOrig, zNew, zNew); } } fossil_print("RENAME %s %s\n", zOrig, zNew); db_multi_exec( - "UPDATE vfile SET pathname='%q' WHERE pathname='%q' AND vid=%d", - zNew, zOrig, vid + "UPDATE vfile SET pathname='%q' WHERE pathname='%q' %s AND vid=%d", + zNew, zOrig, filename_collation(), vid ); } /* ** COMMAND: mv @@ -567,23 +579,27 @@ ** ** This command does NOT rename or move the files on disk. This command merely ** records the fact that filenames have changed so that appropriate notations ** can be made at the next commit/checkin. ** +** Options: +** --case-sensitive override case-sensitive setting +** ** See also: changes, status */ void mv_cmd(void){ int i; int vid; char *zDest; Blob dest; Stmt q; + capture_case_sensitive_option(); db_must_be_within_tree(); vid = db_lget_int("checkout", 0); if( vid==0 ){ - fossil_panic("no checkout rename files in"); + fossil_fatal("no checkout rename files in"); } if( g.argc<4 ){ usage("OLDNAME NEWNAME"); } zDest = g.argv[g.argc-1]; @@ -618,13 +634,14 @@ zOrig = blob_str(&orig); nOrig = blob_size(&orig); db_prepare(&q, "SELECT pathname FROM vfile" " WHERE vid=%d" - " AND (pathname='%q' OR (pathname>'%q/' AND pathname<'%q0'))" + " AND (pathname='%q' %s OR (pathname>'%q/' %s AND pathname<'%q0' %s))" " ORDER BY 1", - vid, zOrig, zOrig, zOrig + 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); const char *zTail; Index: src/allrepo.c ================================================================== --- src/allrepo.c +++ src/allrepo.c @@ -50,27 +50,31 @@ /* ** Build a string that contains all of the command-line options ** specified as arguments. If the option name begins with "+" then ** it takes an argument. Without the "+" it does not. */ -static void collect_argument(Blob *pExtra, const char *zArg){ - if( find_option(zArg, 0, 0)!=0 ){ +static void collect_argument(Blob *pExtra, const char *zArg, const char *zShort){ + if( find_option(zArg, zShort, 0)!=0 ){ blob_appendf(pExtra, " --%s", zArg); } } static void collect_argument_value(Blob *pExtra, const char *zArg){ const char *zValue = find_option(zArg, 0, 1); if( zValue ){ - blob_appendf(pExtra, " --%s %s", zArg, zValue); + if( zValue[0] ){ + blob_appendf(pExtra, " --%s %s", zArg, zValue); + }else{ + blob_appendf(pExtra, " --%s \"\"", zArg); + } } } /* ** COMMAND: all ** -** Usage: %fossil all (list|ls|pull|push|rebuild|sync) +** Usage: %fossil all (changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync) ** ** The ~/.fossil file records the location of all repositories for a ** user. This command performs certain operations on all repositories ** that can be useful before or after a period of disconnected operation. ** @@ -77,31 +81,56 @@ ** On Win32 systems, the file is named "_fossil" and is located in ** %LOCALAPPDATA%, %APPDATA% or %HOMEPATH%. ** ** Available operations are: ** -** ignore Arguments are repositories that should be ignored -** by subsequent list, pull, push, rebuild, and sync. -** -** list | ls Display the location of all repositories. -** The --ckout option causes all local checkouts to be -** list instead. -** -** changes Shows all local checkouts that have uncommitted changes -** -** pull Run a "pull" operation on all repositories -** -** push Run a "push" on all repositories -** -** rebuild Rebuild on all repositories -** -** sync Run a "sync" on all repositories +** changes Shows all local checkouts that have uncommitted changes. +** This operation has no additional options. +** +** clean Delete all "extra" files in all local checkouts. Extreme +** caution should be exercised with this command because its +** effects cannot be undone. Use of the --dry-run option to +** carefully review the local checkouts to be operated upon +** and the --whatif option to carefully review the files to +** be deleted beforehand is highly recommended. The command +** line options supported by the clean command itself, if any +** are present, are passed along verbatim. +** +** extra Shows extra files from all local checkouts. The command +** line options supported by the extra command itself, if any +** are present, are passed along verbatim. +** +** ignore Arguments are repositories that should be ignored by +** subsequent clean, extra, list, pull, push, rebuild, and +** sync operations. The -c|--ckout option causes the listed +** local checkouts to be ignored instead. +** +** list | ls Display the location of all repositories. The -c|--ckout +** option causes all local checkouts to be listed instead. +** +** pull Run a "pull" operation on all repositories. Only the +** --verbose option is supported. +** +** push Run a "push" on all repositories. Only the --verbose +** option is supported. +** +** rebuild Rebuild on all repositories. The command line options +** supported by the rebuild command itself, if any are +** present, are passed along verbatim. The --force and +** --randomize options are not supported. +** +** sync Run a "sync" on all repositories. Only the --verbose +** option is supported. ** ** Repositories are automatically added to the set of known repositories -** when one of the following commands are run against the repository: clone, -** info, pull, push, or sync. Even previously ignored repositories are -** added back to the list of repositories by these commands. +** when one of the following commands are run against the repository: +** clone, info, pull, push, or sync. Even previously ignored repositories +** are added back to the list of repositories by these commands. +** +** Options: +** --dontstop Continue with other repositories even after an error. +** --dry-run If given, display instead of run actions. */ void all_cmd(void){ int n; Stmt q; const char *zCmd; @@ -109,71 +138,99 @@ char *zFossil; char *zQFilename; Blob extra; int useCheckouts = 0; int quiet = 0; - int testRun = 0; + int dryRunFlag = 0; int stopOnError = find_option("dontstop",0,0)==0; int rc; - Bag outOfDate; + int nToDel = 0; - /* The undocumented --test option causes no changes to occur to any - ** repository, but instead show what would have happened. Intended for - ** test and debugging use. - */ - testRun = find_option("test",0,0)!=0; + dryRunFlag = find_option("dry-run","n",0)!=0; + if( !dryRunFlag ){ + dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ + } if( g.argc<3 ){ - usage("changes|list|ls|pull|push|rebuild|sync"); + usage("changes|clean|extra|ignore|list|ls|pull|push|rebuild|sync"); } n = strlen(g.argv[2]); db_open_config(1); blob_zero(&extra); zCmd = g.argv[2]; + if( g.zLogin ) blob_appendf(&extra, " -U %s", g.zLogin); if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ zCmd = "list"; useCheckouts = find_option("ckout","c",0)!=0; + }else if( strncmp(zCmd, "clean", n)==0 ){ + zCmd = "clean --chdir"; + collect_argument(&extra, "allckouts",0); + collect_argument_value(&extra, "case-sensitive"); + collect_argument_value(&extra, "clean"); + collect_argument(&extra, "dirsonly",0); + collect_argument(&extra, "dotfiles",0); + collect_argument(&extra, "emptydirs",0); + collect_argument(&extra, "force","f"); + collect_argument_value(&extra, "ignore"); + collect_argument_value(&extra, "keep"); + collect_argument(&extra, "temp",0); + collect_argument(&extra, "verbose","v"); + collect_argument(&extra, "whatif",0); + useCheckouts = 1; + }else if( strncmp(zCmd, "extra", n)==0 ){ + zCmd = "extra --chdir"; + collect_argument(&extra, "abs-paths",0); + collect_argument_value(&extra, "case-sensitive"); + collect_argument(&extra, "dotfiles",0); + collect_argument_value(&extra, "ignore"); + collect_argument(&extra, "rel-paths",0); + useCheckouts = 1; + stopOnError = 0; + quiet = 1; }else if( strncmp(zCmd, "push", n)==0 ){ zCmd = "push -autourl -R"; - collect_argument(&extra, "verbose"); + collect_argument(&extra, "verbose","v"); }else if( strncmp(zCmd, "pull", n)==0 ){ zCmd = "pull -autourl -R"; - collect_argument(&extra, "verbose"); + collect_argument(&extra, "verbose","v"); }else if( strncmp(zCmd, "rebuild", n)==0 ){ zCmd = "rebuild"; - collect_argument(&extra, "cluster"); - collect_argument(&extra, "compress"); - collect_argument(&extra, "noverify"); + collect_argument(&extra, "cluster",0); + collect_argument(&extra, "compress",0); + collect_argument(&extra, "noverify",0); collect_argument_value(&extra, "pagesize"); - collect_argument(&extra, "vacuum"); - collect_argument(&extra, "deanalyze"); - collect_argument(&extra, "analyze"); - collect_argument(&extra, "wal"); - collect_argument(&extra, "stat"); + collect_argument(&extra, "vacuum",0); + collect_argument(&extra, "deanalyze",0); + collect_argument(&extra, "analyze",0); + collect_argument(&extra, "wal",0); + collect_argument(&extra, "stats",0); }else if( strncmp(zCmd, "sync", n)==0 ){ zCmd = "sync -autourl -R"; - collect_argument(&extra, "verbose"); + collect_argument(&extra, "verbose","v"); }else if( strncmp(zCmd, "test-integrity", n)==0 ){ + collect_argument(&extra, "parse", 0); zCmd = "test-integrity"; }else if( strncmp(zCmd, "test-orphans", n)==0 ){ zCmd = "test-orphans -R"; }else if( strncmp(zCmd, "test-missing", n)==0 ){ zCmd = "test-missing -q -R"; - collect_argument(&extra, "notshunned"); + collect_argument(&extra, "notshunned",0); }else if( strncmp(zCmd, "changes", n)==0 ){ zCmd = "changes --quiet --header --chdir"; useCheckouts = 1; stopOnError = 0; quiet = 1; }else if( strncmp(zCmd, "ignore", n)==0 ){ int j; + useCheckouts = find_option("ckout","c",0)!=0; verify_all_options(); db_begin_transaction(); for(j=3; j0 ){ - Blob sql; - char *zSep = "("; - int rowid; - blob_zero(&sql); - blob_appendf(&sql, "DELETE FROM global_config WHERE rowid IN "); - for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){ - blob_appendf(&sql, "%s%d", zSep, rowid); - zSep = ","; - } - blob_appendf(&sql, ")"); - if( testRun ){ - fossil_print("%s\n", blob_str(&sql)); + if( nToDel>0 ){ + const char *zSql = "DELETE FROM global_config WHERE name IN toDel"; + if( dryRunFlag ){ + fossil_print("%s\n", zSql); }else{ - db_multi_exec(blob_str(&sql)); + db_multi_exec(zSql); } - blob_reset(&sql); } } Index: src/attach.c ================================================================== --- src/attach.c +++ src/attach.c @@ -94,11 +94,11 @@ } @
%h(zFilename) @ [download]
if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++; if( zComment && zComment[0] ){ - @ %w(zComment)
+ @ %!w(zComment)
} if( zPage==0 && zTkt==0 ){ if( zSrc==0 || zSrc[0]==0 ){ zSrc = "Deleted from"; }else { @@ -305,11 +305,11 @@ zComment = PD("comment", ""); while( fossil_isspace(zComment[0]) ) zComment++; n = strlen(zComment); while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; } if( n>0 ){ - blob_appendf(&manifest, "C %F\n", zComment); + blob_appendf(&manifest, "C %#F\n", n, zComment); } zDate = date_in_standard_format("now"); blob_appendf(&manifest, "D %s\n", zDate); blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody"); md5sum_blob(&manifest, &cksum); @@ -337,11 +337,11 @@ } @ @ @ @ - captcha_generate(); + captcha_generate(0); @ style_footer(); } /* @@ -384,11 +384,11 @@ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } #endif - pAttach = manifest_get(rid, CFTYPE_ATTACHMENT); + pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0); if( pAttach==0 ) fossil_redirect_home(); zTarget = pAttach->zAttachTarget; zSrc = pAttach->zAttachSrc; ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%s'", zSrc); zName = pAttach->zAttachName; @@ -445,11 +445,13 @@ @

Confirm you want to delete the attachment shown below. @ @ } - isModerator = (zTktUuid && g.perm.ModTkt) || (zWikiName && g.perm.ModWiki); + isModerator = g.perm.Admin || + (zTktUuid && g.perm.ModTkt) || + (zWikiName && g.perm.ModWiki); if( isModerator && (zModAction = P("modaction"))!=0 ){ if( strcmp(zModAction,"delete")==0 ){ moderation_disapprove(rid); if( zTktUuid ){ cgi_redirectf("%R/tktview/%s", zTktUuid); @@ -484,11 +486,10 @@ @ Wiki Page: @ %z(href("%R/wiki?name=%t",zWikiName))%h(zWikiName) } @ Date: hyperlink_to_date(zDate, ""); - free(zDate); @ User: hyperlink_to_user(pAttach->zUser, zDate, ""); @ Artifact Attached: @ %z(href("%R/artifact/%s",zSrc))%s(zSrc) if( g.perm.Setup ){ Index: src/bisect.c ================================================================== --- src/bisect.c +++ src/bisect.c @@ -35,23 +35,25 @@ ** Find the shortest path between bad and good. */ void bisect_path(void){ PathNode *p; bisect.bad = db_lget_int("bisect-bad", 0); - if( bisect.bad==0 ){ - fossil_fatal("no \"bad\" version has been identified"); - } bisect.good = db_lget_int("bisect-good", 0); - if( bisect.good==0 ){ - fossil_fatal("no \"good\" version has been identified"); - } - p = path_shortest(bisect.good, bisect.bad, bisect_option("direct-only"), 0); - if( p==0 ){ - char *zBad = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", bisect.bad); - char *zGood = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", bisect.good); - fossil_fatal("no path from good ([%S]) to bad ([%S]) or back", - zGood, zBad); + if( bisect.good>0 && bisect.bad==0 ){ + path_shortest(bisect.good, bisect.good, 0, 0); + }else if( bisect.bad>0 && bisect.good==0 ){ + path_shortest(bisect.bad, bisect.bad, 0, 0); + }else if( bisect.bad==0 && bisect.good==0 ){ + fossil_fatal("neither \"good\" nor \"bad\" versions have been identified"); + }else{ + p = path_shortest(bisect.good, bisect.bad, bisect_option("direct-only"), 0); + if( p==0 ){ + char *zBad = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",bisect.bad); + char *zGood = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",bisect.good); + fossil_fatal("no path from good ([%S]) to bad ([%S]) or back", + zGood, zBad); + } } } /* ** The set of all bisect options. @@ -63,10 +65,12 @@ } aBisectOption[] = { { "auto-next", "on", "Automatically run \"bisect next\" after each " "\"bisect good\" or \"bisect bad\"" }, { "direct-only", "on", "Follow only primary parent-child links, not " "merges\n" }, + { "display", "chart", "Command to run after \"next\". \"chart\", " + "\"log\", \"status\", or \"none\"" }, }; /* ** Return the value of a boolean bisect option. */ @@ -141,10 +145,83 @@ } db_reset(&s); } db_finalize(&s); } + +/* +** Append a new entry to the bisect log. Update the bisect-good or +** bisect-bad values as appropriate. +** +** The bisect-log consists of a list of token. Each token is an +** integer RID of a check-in. The RID is negative for "bad" check-ins +** and positive for "good" check-ins. +*/ +static void bisect_append_log(int rid){ + if( rid<0 ){ + if( db_lget_int("bisect-bad",0)==(-rid) ) return; + db_lset_int("bisect-bad", -rid); + }else{ + if( db_lget_int("bisect-good",0)==rid ) return; + db_lset_int("bisect-good", rid); + } + db_multi_exec( + "REPLACE INTO vvar(name,value) VALUES('bisect-log'," + "COALESCE((SELECT value||' ' FROM vvar WHERE name='bisect-log'),'')" + " || '%d')", rid); +} + +/* +** 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){ + char *zLog = db_lget("bisect-log",""); + Blob log, id; + Stmt q; + int cnt = 0; + 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" /* Check-in number */ + ");" + ); + db_prepare(&q, "INSERT OR IGNORE INTO bilog(seq,stat,rid)" + " VALUES(:seq,:stat,:rid)"); + while( blob_token(&log, &id) ){ + int rid = atoi(blob_str(&id)); + db_bind_int(&q, ":seq", ++cnt); + db_bind_text(&q, ":stat", rid>0 ? "GOOD" : "BAD"); + db_bind_int(&q, ":rid", rid>=0 ? rid : -rid); + db_step(&q); + db_reset(&q); + } + db_bind_int(&q, ":seq", ++cnt); + db_bind_text(&q, ":stat", "CURRENT"); + db_bind_int(&q, ":rid", db_lget_int("checkout", 0)); + db_step(&q); + db_finalize(&q); + db_prepare(&q, + "SELECT bilog.seq, bilog.stat," + " substr(blob.uuid,1,16), datetime(event.mtime)" + " FROM bilog, blob, event" + " WHERE blob.rid=bilog.rid AND event.objid=bilog.rid" + " AND event.type='ci'" + " ORDER BY %s", + (sortByCkinTime ? "event.mtime DESC" : "bilog.rowid ASC") + ); + while( db_step(&q)==SQLITE_ROW ){ + fossil_print("%3d %-7s %s %s\n", + db_column_int(&q, 0), + db_column_text(&q, 1), + db_column_text(&q, 3), + db_column_text(&q, 2)); + } + db_finalize(&q); +} /* ** COMMAND: bisect ** ** Usage: %fossil bisect SUBCOMMAND ... @@ -159,10 +236,17 @@ ** fossil bisect good ?VERSION? ** ** Identify version VERSION as working. If VERSION is omitted, ** the current checkout is marked as working. ** +** fossil bisect log +** fossil bisect chart +** +** Show a log of "good" and "bad" versions. "bisect log" shows the +** events in the order that they were tested. "bisect chart" shows +** them in order of check-in. +** ** fossil bisect next ** ** Update to the next version that is halfway between the working and ** non-working versions. ** @@ -174,73 +258,135 @@ ** fossil bisect reset ** ** Reinitialize a bisect session. This cancels prior bisect history ** and allows a bisect session to start over from the beginning. ** -** fossil bisect vlist|ls ?--all? +** fossil bisect vlist|ls|status ?-a|--all? ** ** List the versions in between "bad" and "good". +** +** fossil bisect undo +** +** Undo the most recent "good" or "bad" command. +** +** Summary: +** +** fossil bisect bad ?VERSION? +** fossil bisect good ?VERSION? +** fossil bisect log +** fossil bisect chart +** fossil bisect next +** fossil bisect options +** fossil bisect reset +** fossil bisect status +** fossil bisect undo */ void bisect_cmd(void){ int n; const char *zCmd; + int foundCmd = 0; db_must_be_within_tree(); if( g.argc<3 ){ - usage("bisect SUBCOMMAND ARGS..."); + usage("bad|good|log|next|options|reset|status|undo"); } zCmd = g.argv[2]; n = strlen(zCmd); if( n==0 ) zCmd = "-"; - if( memcmp(zCmd, "bad", n)==0 ){ + if( strncmp(zCmd, "bad", n)==0 ){ int ridBad; + foundCmd = 1; if( g.argc==3 ){ ridBad = db_lget_int("checkout",0); }else{ ridBad = name_to_typed_rid(g.argv[3], "ci"); } - db_lset_int("bisect-bad", ridBad); - if( ridBad>0 - && bisect_option("auto-next") - && db_lget_int("bisect-good",0)>0 - ){ - zCmd = "next"; - n = 4; - }else{ - return; - } - }else if( memcmp(zCmd, "good", n)==0 ){ + if( ridBad>0 ){ + bisect_append_log(-ridBad); + if( bisect_option("auto-next") && db_lget_int("bisect-good",0)>0 ){ + zCmd = "next"; + n = 4; + } + } + }else if( strncmp(zCmd, "good", n)==0 ){ int ridGood; + foundCmd = 1; if( g.argc==3 ){ ridGood = db_lget_int("checkout",0); }else{ ridGood = name_to_typed_rid(g.argv[3], "ci"); } + if( ridGood>0 ){ + bisect_append_log(ridGood); + if( bisect_option("auto-next") && db_lget_int("bisect-bad",0)>0 ){ + zCmd = "next"; + n = 4; + } + } + }else if( strncmp(zCmd, "undo", n)==0 ){ + char *zLog; + Blob log, id; + int ridBad = 0; + int ridGood = 0; + int cnt = 0, i; + foundCmd = 1; + db_begin_transaction(); + zLog = db_lget("bisect-log",""); + blob_init(&log, zLog, -1); + while( blob_token(&log, &id) ){ cnt++; } + if( cnt==0 ){ + fossil_fatal("no previous bisect steps to undo"); + } + blob_rewind(&log); + for(i=0; i0 - && bisect_option("auto-next") - && db_lget_int("bisect-bad",0)>0 - ){ + db_end_transaction(0); + if( ridBad && ridGood ){ zCmd = "next"; n = 4; - }else{ - return; } } - if( memcmp(zCmd, "next", n)==0 ){ + /* No else here so that the above commands can morph themselves into + ** a "next" command */ + if( strncmp(zCmd, "next", n)==0 ){ PathNode *pMid; + char *zDisplay = db_lget("bisect-display","chart"); + int m = (int)strlen(zDisplay); bisect_path(); pMid = path_midpoint(); if( pMid==0 ){ - fossil_fatal("bisect is done - there are no more intermediate versions"); - } - 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(); - bisect_list(1); - }else if( memcmp(zCmd, "options", n)==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 ){ + bisect_list(1); + } + }else if( strncmp(zCmd, "log", n)==0 ){ + bisect_chart(0); + }else if( strncmp(zCmd, "chart", n)==0 ){ + bisect_chart(1); + }else if( strncmp(zCmd, "options", n)==0 ){ if( g.argc==3 ){ unsigned int i; for(i=0; iaData[newSize] = 0; } /* ** Make sure a blob is nul-terminated and is not a pointer to unmanaged -** space. Return a pointer to the +** space. Return a pointer to the data. */ char *blob_materialize(Blob *pBlob){ blob_resize(pBlob, pBlob->nUsed); return pBlob->aData; } @@ -700,11 +700,11 @@ ** Initialize a blob to be the content of a file. If the filename ** is blank or "-" then read from standard input. ** ** Any prior content of the blob is discarded, not freed. ** -** Return the number of bytes read. Calls fossil_panic() error (i.e. +** Return the number of bytes read. Calls fossil_fatal() error (i.e. ** it exit()s and does not return). */ int blob_read_from_file(Blob *pBlob, const char *zFilename){ int size, got; FILE *in; @@ -721,11 +721,11 @@ return 0; } blob_resize(pBlob, size); in = fossil_fopen(zFilename, "rb"); if( in==0 ){ - fossil_panic("cannot open %s for reading", zFilename); + fossil_fatal("cannot open %s for reading", zFilename); } got = fread(blob_buffer(pBlob), 1, size, in); fclose(in); if( got= 0 ){ - return n; + if( fossil_utf8_to_console(blob_buffer(pBlob), nWrote, 0) >= 0 ){ + return nWrote; } #endif - fwrite(blob_buffer(pBlob), 1, n, stdout); - return n; + fwrite(blob_buffer(pBlob), 1, nWrote, stdout); }else{ int i, nName; char *zName, zBuf[1000]; nName = strlen(zFilename); @@ -792,11 +791,11 @@ } nName = file_simplify_name(zName, nName, 0); for(i=1; iaData; @@ -1014,19 +1013,19 @@ } } #endif /* -** Remove every \r character from the given blob. +** Remove every \r character from the given blob, replacing each one with +** a \n character if it was not already part of a \r\n pair. */ -void blob_remove_cr(Blob *p){ +void blob_to_lf_only(Blob *p){ int i, j; - char *z; - blob_materialize(p); - z = p->aData; + char *z = blob_materialize(p); for(i=j=0; z[i]; i++){ if( z[i]!='\r' ) z[j++] = z[i]; + else if( z[i+1]!='\n' ) z[j++] = '\n'; } z[j] = 0; p->nUsed = j; } @@ -1096,45 +1095,45 @@ ** to be UTF-8 already, so no conversion is done. */ void blob_to_utf8_no_bom(Blob *pBlob, int useMbcs){ char *zUtf8; int bomSize = 0; +#if defined(_WIN32) || defined(__CYGWIN__) + int bomReverse = 0; +#endif if( starts_with_utf8_bom(pBlob, &bomSize) ){ struct Blob temp; zUtf8 = blob_str(pBlob) + bomSize; blob_zero(&temp); blob_append(&temp, zUtf8, -1); blob_swap(pBlob, &temp); blob_reset(&temp); -#ifdef _WIN32 - }else if( starts_with_utf16le_bom(pBlob, &bomSize) ){ - /* Make sure the blob contains two terminating 0-bytes */ - blob_append(pBlob, "", 1); - zUtf8 = blob_str(pBlob) + bomSize; - zUtf8 = fossil_unicode_to_utf8(zUtf8); - blob_zero(pBlob); - blob_append(pBlob, zUtf8, -1); - fossil_unicode_free(zUtf8); - }else if( starts_with_utf16be_bom(pBlob, &bomSize) ){ - unsigned int i = blob_size(pBlob); +#if defined(_WIN32) || defined(__CYGWIN__) + }else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){ zUtf8 = blob_buffer(pBlob); - while( i > 0 ){ - /* swap bytes of unicode representation */ - char zTemp = zUtf8[--i]; - zUtf8[i] = zUtf8[i-1]; - zUtf8[--i] = zTemp; + if( bomReverse ){ + /* Found BOM, but with reversed bytes */ + unsigned int i = blob_size(pBlob); + while( i>0 ){ + /* 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, "", 1); zUtf8 = blob_str(pBlob) + bomSize; zUtf8 = fossil_unicode_to_utf8(zUtf8); blob_zero(pBlob); blob_append(pBlob, zUtf8, -1); fossil_unicode_free(zUtf8); +#endif /* _WIN32 || __CYGWIN__ */ +#if defined(_WIN32) }else if( useMbcs ){ zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); blob_reset(pBlob); blob_append(pBlob, zUtf8, -1); fossil_mbcs_free(zUtf8); #endif /* _WIN32 */ } } Index: src/branch.c ================================================================== --- src/branch.c +++ src/branch.c @@ -56,11 +56,11 @@ noSign = db_get_int("omitsign", 0)|noSign; /* fossil branch new name */ zBranch = g.argv[3]; if( zBranch==0 || zBranch[0]==0 ){ - fossil_panic("branch name cannot be empty"); + fossil_fatal("branch name cannot be empty"); } if( db_exists( "SELECT 1 FROM tagxref" " WHERE tagtype>0" " AND tagid=(SELECT tagid FROM tag WHERE tagname='sym-%q')", @@ -73,11 +73,11 @@ rootid = name_to_typed_rid(g.argv[4], "ci"); if( rootid==0 ){ fossil_fatal("unable to locate check-in off of which to branch"); } - pParent = manifest_get(rootid, CFTYPE_MANIFEST); + pParent = manifest_get(rootid, CFTYPE_MANIFEST, 0); if( pParent==0 ){ fossil_fatal("%s is not a valid check-in", g.argv[4]); } /* Create a manifest for the new branch */ @@ -150,15 +150,15 @@ } } brid = content_put_ex(&branch, 0, 0, 0, isPrivate); if( brid==0 ){ - fossil_panic("trouble committing manifest: %s", g.zErrMsg); + fossil_fatal("trouble committing manifest: %s", g.zErrMsg); } db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid); if( manifest_crosslink(brid, &branch)==0 ){ - fossil_panic("unable to install new manifest"); + fossil_fatal("unable to install new manifest"); } assert( blob_is_reset(&branch) ); content_deltify(rootid, brid, 0); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid); fossil_print("New branch: %s\n", zUuid); @@ -238,15 +238,16 @@ ** --bgcolor COLOR use COLOR instead of automatic background ** --nosign do not sign contents on this branch ** --date-override DATE DATE to use instead of 'now' ** --user-override USER USER to use instead of the current default ** -** %fossil branch list ?--all | --closed? -** %fossil branch ls ?--all | --closed? +** %fossil branch list ?-a|--all|-c|--closed? +** %fossil branch ls ?-a|--all|-c|--closed? ** -** List all branches. Use --all or --closed to list all branches -** or closed branches. The default is to show only open branches. +** List all branches. Use -a or --all to list all branches and +** -c or --closed to list all closed branches. The default is to +** show only open branches. ** ** Options: ** -R|--repository FILE Run commands on repository FILE */ void branch_cmd(void){ @@ -262,12 +263,12 @@ branch_new(); }else if( (strncmp(zCmd,"list",n)==0)||(strncmp(zCmd, "ls", n)==0) ){ Stmt q; int vid; char *zCurrent = 0; - int showAll = find_option("all",0,0)!=0; - int showClosed = find_option("closed",0,0)!=0; + int showAll = find_option("all","a",0)!=0; + int showClosed = find_option("closed","c",0)!=0; 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); @@ -278,11 +279,11 @@ int isCur = zCurrent!=0 && fossil_strcmp(zCurrent,zBr)==0; fossil_print("%s%s\n", (isCur ? "* " : " "), zBr); } db_finalize(&q); }else{ - fossil_panic("branch subcommand should be one of: " + fossil_fatal("branch subcommand should be one of: " "new list ls"); } } /* @@ -324,12 +325,12 @@ } login_anonymous_available(); style_sidebox_begin("Nomenclature:", "33%"); @

    @
  1. An
    %z(href("brlist")) - @ open branch
    is a branch that has one or - @ more %z(href("leaves"))open leaves. + @ open branch is a branch that has one or more + @
    %z(href("leaves"))open leaves.
    @ The presence of open leaves presumably means @ that the branch is still being extended with new check-ins.
  2. @
  3. A
    %z(href("brlist?closed")) @ closed branch
    is a branch with only @
    %z(href("leaves?closed")) Index: src/browse.c ================================================================== --- src/browse.c +++ src/browse.c @@ -80,15 +80,15 @@ for(i=0; zPath[i]; i=j){ for(j=i; zPath[j] && zPath[j]!='/'; j++){} if( zPath[j] && g.perm.Hyperlink ){ if( zCI ){ char *zLink = href("%R/dir?ci=%S&name=%#T", zCI, j, zPath); - blob_appendf(pOut, "%s%z%#h", + blob_appendf(pOut, "%s%z%#h", zSep, zLink, j-i, &zPath[i]); }else{ char *zLink = href("%R/dir?name=%#T", j, zPath); - blob_appendf(pOut, "%s%z%#h", + blob_appendf(pOut, "%s%z%#h", zSep, zLink, j-i, &zPath[i]); } }else{ blob_appendf(pOut, "%s%#h", zSep, j-i, &zPath[i]); } @@ -118,10 +118,11 @@ int rid = 0; char *zUuid = 0; Blob dirname; Manifest *pM = 0; const char *zSubdirLink; + int linkTrunk = 1, linkTip = 1; login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } style_header("File List"); @@ -136,26 +137,41 @@ ** files from all check-ins to be displayed. */ if( zCI ){ pM = manifest_get_by_name(zCI, &rid); if( pM ){ + int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); + linkTrunk = trunkRid && rid != trunkRid; + linkTip = rid != symbolic_name_to_rid("tip", "ci"); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); }else{ zCI = 0; } } - - /* Compute the title of the page */ + /* Compute the title of the page */ blob_zero(&dirname); if( zD ){ blob_append(&dirname, "in directory ", -1); hyperlinked_path(zD, &dirname, zCI); zPrefix = mprintf("%s/", zD); + if( linkTrunk ){ + style_submenu_element("Trunk", "Trunk", "%R/dir?name=%t&ci=trunk", + zD); + } + if ( linkTip ){ + style_submenu_element("Tip", "Tip", "%R/dir?name=%t&ci=tip", zD); + } }else{ blob_append(&dirname, "in the top-level directory", -1); zPrefix = ""; + if( linkTrunk ){ + style_submenu_element("Trunk", "Trunk", "%R/dir?ci=trunk"); + } + if ( linkTip ){ + style_submenu_element("Tip", "Tip", "%R/dir?ci=tip"); + } } if( zCI ){ char zShort[20]; memcpy(zShort, zUuid, 10); zShort[10] = 0; @@ -169,42 +185,24 @@ style_submenu_element("All", "All", "%R/dir"); style_submenu_element("File Ages", "File Ages", "%R/fileage?name=%S", zUuid); } }else{ - int hasTrunk; @

    The union of all files from all check-ins @ %s(blob_str(&dirname))

    - hasTrunk = db_exists( - "SELECT 1 FROM tagxref WHERE tagid=%d AND value='trunk'", - TAG_BRANCH); zSubdirLink = mprintf("%R/dir?name=%T", zPrefix); - if( zD ){ - style_submenu_element("Top", "Top", "%R/dir"); - style_submenu_element("Tip", "Tip", "%R/dir?name=%t&ci=tip", zD); - if( hasTrunk ){ - style_submenu_element("Trunk", "Trunk", "%R/dir?name=%t&ci=trunk", - zD); - } - }else{ - style_submenu_element("Tip", "Tip", "%R/dir?ci=tip"); - if( hasTrunk ){ - style_submenu_element("Trunk", "Trunk", "%R/dir?ci=trunk"); - } - } } /* Compute the temporary table "localfiles" containing the names - ** of all files and subdirectories in the zD[] directory. + ** of all files and subdirectories in the zD[] directory. ** ** Subdirectory names begin with "/". This causes them to sort ** first and it also gives us an easy way to distinguish files ** from directories in the loop that follows. */ db_multi_exec( - "CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL %s, u);", - filename_collation() + "CREATE TEMP TABLE localfiles(x UNIQUE NOT NULL, u);" ); if( zCI ){ Stmt ins; ManifestFile *pFile; ManifestFile *pPrev = 0; @@ -214,18 +212,18 @@ db_prepare(&ins, "INSERT OR IGNORE INTO localfiles VALUES(pathelement(:x,0), :u)" ); manifest_file_rewind(pM); while( (pFile = manifest_file_next(pM,0))!=0 ){ - if( nD>0 - && (filenames_strncmp(pFile->zName, zD, nD-1)!=0 + if( nD>0 + && (fossil_strncmp(pFile->zName, zD, nD-1)!=0 || pFile->zName[nD-1]!='/') ){ continue; } if( pPrev - && filenames_strncmp(&pFile->zName[nD],&pPrev->zName[nD],nPrev)==0 + && fossil_strncmp(&pFile->zName[nD],&pPrev->zName[nD],nPrev)==0 && (pFile->zName[nD+nPrev]==0 || pFile->zName[nD+nPrev]=='/') ){ continue; } db_bind_text(&ins, ":x", &pFile->zName[nD]); @@ -236,25 +234,16 @@ for(nPrev=0; (c=pPrev->zName[nD+nPrev]) && c!='/'; nPrev++){} if( c=='/' ) nPrev++; } db_finalize(&ins); }else if( zD ){ - if( filenames_are_case_sensitive() ){ - db_multi_exec( - "INSERT OR IGNORE INTO localfiles" - " SELECT pathelement(name,%d), NULL FROM filename" - " WHERE name GLOB '%q/*'", - nD, zD - ); - }else{ - db_multi_exec( - "INSERT OR IGNORE INTO localfiles" - " SELECT pathelement(name,%d), NULL FROM filename" - " WHERE name LIKE '%q/%%'", - nD, zD - ); - } + db_multi_exec( + "INSERT OR IGNORE INTO localfiles" + " SELECT pathelement(name,%d), NULL FROM filename" + " WHERE name GLOB '%q/*'", + nD, zD + ); }else{ db_multi_exec( "INSERT OR IGNORE INTO localfiles" " SELECT pathelement(name,0), NULL FROM filename" ); @@ -281,24 +270,46 @@ } i++; zFN = db_column_text(&q, 0); if( zFN[0]=='/' ){ zFN++; - @
  4. %z(href("%s%T",zSubdirLink,zFN))%h(zFN)
  5. - }else if( zCI ){ - const char *zUuid = db_column_text(&q, 1); - @
  6. %z(href("%R/artifact/%s",zUuid))%h(zFN)
  7. + @
  8. %z(href("%s%T",zSubdirLink,zFN))%h(zFN)
  9. }else{ - @
  10. %z(href("%R/finfo?name=%T%T",zPrefix,zFN))%h(zFN) - @
  11. + const char *zLink; + if( zCI ){ + const char *zUuid = db_column_text(&q, 1); + zLink = href("%R/artifact/%s",zUuid); + }else{ + zLink = href("%R/finfo?name=%T%T",zPrefix,zFN); + } + @
  12. %z(zLink)%h(zFN)
  13. } } db_finalize(&q); manifest_destroy(pM); @ style_footer(); } + +/* +** Return a CSS class name based on the given filename's extension. +** Result must be freed by the caller. +**/ +const char *fileext_class(const char *zFilename){ + char *zClass; + const char *zExt = strrchr(zFilename, '.'); + int isExt = zExt && zExt!=zFilename && zExt[1]; + int i; + for( i=1; isExt && zExt[i]; i++ ) isExt &= fossil_isalnum(zExt[i]); + if( isExt ){ + zClass = mprintf("file-%s", zExt+1); + for ( i=5; zClass[i]; i++ ) zClass[i] = fossil_tolower(zClass[i]); + }else{ + zClass = mprintf("file"); + } + return zClass; +} /* ** Look at all file containing in the version "vid". Construct a ** temporary table named "fileage" that contains the file-id for each ** files, the pathname, the check-in where the file was added, and the @@ -320,14 +331,14 @@ " mtime DATETIME," " pathname TEXT" ");" "CREATE INDEX fileage_fid ON fileage(fid);" ); - pManifest = manifest_get(vid, CFTYPE_MANIFEST); + pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0); if( pManifest==0 ) return 1; manifest_file_rewind(pManifest); - db_prepare(&ins, + db_prepare(&ins, "INSERT INTO temp.fileage(fid, pathname)" " SELECT rid, :path FROM blob WHERE uuid=:uuid" ); while( (pFile = manifest_file_next(pManifest, 0))!=0 ){ db_bind_text(&ins, ":uuid", pFile->zUuid); @@ -400,13 +411,13 @@ baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); zBaseTime = db_text("","SELECT datetime(%.20g,'localtime')", baseTime); @

    File Ages For Check-in @ %z(href("%R/info?name=%T",zName))%h(zName)

    @ - @

    The times given are relative + @

    The times given are relative to @ %z(href("%R/timeline?c=%T",zBaseTime))%s(zBaseTime), which is the - @ check-in time for + @ check-in time for @ %z(href("%R/info?name=%T",zName))%h(zName)

    @ @ db_prepare(&q, "SELECT mtime, (SELECT uuid FROM blob WHERE rid=fid), mid, pathname" @@ -443,7 +454,7 @@ @ } @ @

    db_finalize(&q); - style_footer(); + style_footer(); } Index: src/captcha.c ================================================================== --- src/captcha.c +++ src/captcha.c @@ -17,12 +17,12 @@ ** ** This file contains code to a simple text-based CAPTCHA. Though easily ** defeated by a sophisticated attacker, this CAPTCHA does at least make ** scripting attacks more difficult. */ -#include #include "config.h" +#include #include "captcha.h" #if INTERFACE #define CAPTCHA 3 /* Which captcha rendering to use */ #endif @@ -69,16 +69,16 @@ ** Render an 8-character hexadecimal string as ascii art. ** Space to hold the result is obtained from malloc() and should be freed ** by the caller. */ char *captcha_render(const char *zPw){ - char *z = fossil_malloc( 500 ); + char *z = fossil_malloc( 9*6*strlen(zPw) + 7 ); int i, j, k, m; k = 0; for(i=0; i<6; i++){ - for(j=0; j<8; j++){ + for(j=0; zPw[j]; j++){ unsigned char v = hexValue(zPw[j]); v = (aFont1[v] >> ((5-i)*4)) & 0xf; for(m=8; m>=1; m = m>>1){ if( v & m ){ z[k++] = 'X'; @@ -202,17 +202,17 @@ ** Render an 8-digit hexadecimal string as ascii arg. ** Space to hold the result is obtained from malloc() and should be freed ** by the caller. */ char *captcha_render(const char *zPw){ - char *z = fossil_malloc( 300 ); + char *z = fossil_malloc( 7*4*strlen(zPw) + 5 ); int i, j, k, m; const char *zChar; k = 0; for(i=0; i<4; i++){ - for(j=0; j<8; j++){ + for(j=0; zPw[j]; j++){ unsigned char v = hexValue(zPw[j]); zChar = azFont2[4*v + i]; for(m=0; zChar[m]; m++){ z[k++] = zChar[m]; } @@ -359,19 +359,52 @@ ** Render an 8-digit hexadecimal string as ascii arg. ** Space to hold the result is obtained from malloc() and should be freed ** by the caller. */ char *captcha_render(const char *zPw){ - char *z = fossil_malloc( 600 ); + char *z = fossil_malloc( 10*6*strlen(zPw) + 7 ); int i, j, k, m; const char *zChar; + unsigned char x; + int y; k = 0; for(i=0; i<6; i++){ - for(j=0; j<8; j++){ + x = 0; + for(j=0; zPw[j]; j++){ unsigned char v = hexValue(zPw[j]); + x = (x<<4) + v; + switch( x ){ + case 0x7a: + case 0xfa: + y = 3; + break; + case 0x47: + y = 2; + break; + case 0xf6: + case 0xa9: + case 0xa4: + case 0xa1: + case 0x9a: + case 0x76: + case 0x61: + case 0x67: + case 0x69: + case 0x41: + case 0x42: + case 0x43: + case 0x4a: + y = 1; + break; + default: + y = 0; + break; + } zChar = azFont3[6*v + i]; + while( y && zChar[0]==' ' ){ y--; zChar++; } + while( y && z[k-1]==' ' ){ y--; k--; } for(m=0; zChar[m]; m++){ z[k++] = zChar[m]; } } z[k++] = '\n'; @@ -496,11 +529,11 @@ ** for the seed and the entry box into which the user will type the text of ** the captcha. This is typically done at the very bottom of a form. ** ** This routine is a no-op if no captcha is required. */ -void captcha_generate(void){ +void captcha_generate(int showButton){ unsigned int uSeed; const char *zDecoded; char *zCaptcha; if( !captcha_needed() ) return; @@ -511,7 +544,65 @@ @ %h(zCaptcha) @ @ Enter security code shown above: @ @ + if( showButton ){ + @ + } @ } + +/* +** WEBPAGE: test-captcha +*/ +void captcha_test(void){ + const char *zPw = P("name"); + if( zPw==0 || zPw[0]==0 ){ + u64 x; + sqlite3_randomness(sizeof(x), &x); + zPw = mprintf("%016llx", x); + } + style_header("Captcha Test"); + @
    +  @ %s(captcha_render(zPw))
    +  @ 
    + style_footer(); +} + +/* +** Check to see if the current request is coming from an agent that might +** be a spider. If the agent is not a spider, then return 0 without doing +** anything. But if the user agent appears to be a spider, offer +** a captcha challenge to allow the user agent to prove that it is human +** and return non-zero. +*/ +int exclude_spiders(const char *zPage){ + const char *zCookieValue; + char *zCookieName; + if( g.isHuman ) return 0; +#if 0 + { + const char *zReferer = P("HTTP_REFERER"); + if( zReferer && strncmp(g.zBaseURL, zReferer, strlen(g.zBaseURL))==0 ){ + return 0; + } + } +#endif + zCookieName = mprintf("fossil-cc-%.10s", db_get("project-code","x")); + zCookieValue = P(zCookieName); + if( zCookieValue && atoi(zCookieValue)==1 ) return 0; + if( captcha_is_correct() ){ + cgi_set_cookie(zCookieName, "1", login_cookie_path(), 8*3600); + return 0; + } + + /* This appears to be a spider. Offer the captcha */ + style_header("Verification"); + form_begin(0, "%s", zPage); + cgi_query_parameters_to_hidden(); + @

    Please demonstrate that you are human, not a spider or robot

    + captcha_generate(1); + @ + style_footer(); + return 1; +} Index: src/cgi.c ================================================================== --- src/cgi.c +++ src/cgi.c @@ -40,10 +40,11 @@ #include #include #include #include #include "cgi.h" +#include "cygsup.h" #if INTERFACE /* ** Shortcuts for cgi_parameter. P("x") returns the value of query parameter ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") @@ -59,10 +60,17 @@ ** Destinations for output text. */ #define CGI_HEADER 0 #define CGI_BODY 1 +/* +** Flags for SSH HTTP clients +*/ +#define CGI_SSH_CLIENT 0x0001 /* Client is SSH */ +#define CGI_SSH_COMPAT 0x0002 /* Compat for old SSH transport */ +#define CGI_SSH_FOSSIL 0x0004 /* Use new Fossil SSH transport */ + #endif /* INTERFACE */ /* ** The HTTP reply is generated in two pieces: the header and the body. ** These pieces are generated separately because they are not necessary @@ -404,10 +412,11 @@ static int seqQP = 0; /* Sequence numbers */ static struct QParam { /* One entry for each query parameter or cookie */ const char *zName; /* Parameter or cookie name */ const char *zValue; /* Value of the query parameter or cookie */ int seq; /* Order of insertion */ + int isQP; /* True for query parameters */ } *aParamQP; /* An array of all parameters and cookies */ /* ** Add another query parameter or cookie to the parameter set. ** zName is the name of the query parameter or cookie and zValue @@ -414,11 +423,11 @@ ** is its fully decoded value. ** ** zName and zValue are not copied and must not change or be ** deallocated after this routine returns. */ -void cgi_set_parameter_nocopy(const char *zName, const char *zValue){ +void cgi_set_parameter_nocopy(const char *zName, const char *zValue, int isQP){ if( nAllocQP<=nUsedQP ){ nAllocQP = nAllocQP*2 + 10; if( nAllocQP>1000 ){ /* Prevent a DOS service attack against the framework */ fossil_fatal("Too many query parameters"); @@ -429,10 +438,11 @@ aParamQP[nUsedQP].zValue = zValue; if( g.fHttpTrace ){ fprintf(stderr, "# cgi: %s = [%s]\n", zName, zValue); } aParamQP[nUsedQP].seq = seqQP++; + aParamQP[nUsedQP].isQP = isQP; nUsedQP++; sortQP = 1; } /* @@ -441,11 +451,11 @@ ** 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)); + cgi_set_parameter_nocopy(mprintf("%s",zName), mprintf("%s",zValue), 0); } /* ** Replace a parameter with a new value. */ @@ -455,19 +465,19 @@ if( fossil_strcmp(aParamQP[i].zName,zName)==0 ){ aParamQP[i].zValue = zValue; return; } } - cgi_set_parameter_nocopy(zName, zValue); + cgi_set_parameter_nocopy(zName, zValue, 0); } /* ** 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)); + cgi_set_parameter_nocopy(zName, mprintf("%s",zValue), 0); } /* ** Add a list of query parameters or cookies to the parameter set. @@ -493,10 +503,11 @@ ** The input string "z" is modified but no copies is made. "z" ** should not be deallocated or changed again after this routine ** returns or it will corrupt the parameter table. */ static void add_param_list(char *z, int terminator){ + int isQP = terminator=='&'; while( *z ){ char *zName; char *zValue; while( fossil_isspace(*z) ){ z++; } zName = z; @@ -514,11 +525,11 @@ }else{ if( *z ){ *z++ = 0; } zValue = ""; } if( fossil_islower(zName[0]) ){ - cgi_set_parameter_nocopy(zName, zValue); + cgi_set_parameter_nocopy(zName, zValue, isQP); } #ifdef FOSSIL_ENABLE_JSON json_setenv( zName, cson_value_new_string(zValue,strlen(zValue)) ); #endif /* FOSSIL_ENABLE_JSON */ } @@ -658,14 +669,14 @@ 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 && fossil_islower(zName[0]) ){ - cgi_set_parameter_nocopy(zName, zValue); + cgi_set_parameter_nocopy(zName, zValue, 1); if( showBytes ){ cgi_set_parameter_nocopy(mprintf("%s:bytes", zName), - mprintf("%d",nContent)); + mprintf("%d",nContent), 1); } } zName = 0; showBytes = 0; }else{ @@ -678,17 +689,17 @@ }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 && fossil_islower(zName[0]) ){ - cgi_set_parameter_nocopy(mprintf("%s:filename",zName), z); + cgi_set_parameter_nocopy(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 && fossil_islower(zName[0]) ){ - cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z); + cgi_set_parameter_nocopy(mprintf("%s:mimetype",zName), z, 1); } } } } } @@ -812,25 +823,62 @@ } } fputs(z, pLog); } +/* Forward declaration */ +static NORETURN void malformed_request(const char *zMsg); /* ** Initialize the query parameter database. Information is pulled from ** the QUERY_STRING environment variable (if it exists), from standard ** input if there is POST data, and from HTTP_COOKIE. +** +** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows: +** +** REQUEST_URI == SCRIPT_NAME + PATH_INFO +** +** Where "+" means concatenate. Fossil requires SCRIPT_NAME. If +** REQUEST_URI is provided but PATH_INFO is not, then PATH_INFO is +** computed from REQUEST_URI and SCRIPT_NAME. If PATH_INFO is provided +** but REQUEST_URI is not, then compute REQUEST_URI from PATH_INFO and +** SCRIPT_NAME. If neither REQUEST_URI nor PATH_INFO are provided, then +** assume that PATH_INFO is an empty string and set REQUEST_URI equal +** to PATH_INFO. +** +** 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",""); + #ifdef FOSSIL_ENABLE_JSON json_main_bootstrap(); #endif g.isHTTP = 1; cgi_destination(CGI_BODY); + if( zScriptName==0 ) malformed_request("missing SCRIPT_NAME"); + 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); + cgi_set_parameter("REQUEST_URI", zRequestUri); + } + if( zPathInfo==0 ){ + int i, j; + for(i=0; zRequestUri[i]==zScriptName[i] && zRequestUri[i]; i++){} + for(j=i; zRequestUri[j] && zRequestUri[j]!='?'; j++){} + cgi_set_parameter("PATH_INFO", mprintf("%.*s", j-i, zRequestUri+i)); + } z = (char*)P("HTTP_COOKIE"); if( z ){ z = mprintf("%s",z); add_param_list(z, ';'); @@ -847,12 +895,12 @@ g.zIpAddr = mprintf("%s", z); } len = atoi(PD("CONTENT_LENGTH", "0")); g.zContentType = zType = P("CONTENT_TYPE"); + blob_zero(&g.cgiIn); if( len>0 && zType ){ - blob_zero(&g.cgiIn); if( fossil_strcmp(zType,"application/x-www-form-urlencoded")==0 || strncmp(zType,"multipart/form-data",19)==0 ){ z = fossil_malloc( len+1 ); len = fread(z, 1, len, g.httpIn); z[len] = 0; @@ -967,11 +1015,11 @@ ** with the given name. */ if( fossil_isupper(zName[0]) ){ const char *zValue = fossil_getenv(zName); if( zValue ){ - cgi_set_parameter_nocopy(zName, zValue); + cgi_set_parameter_nocopy(zName, zValue, 0); CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue)); return zValue; } } CGIDEBUG(("no-match [%s]\n", zName)); @@ -1068,10 +1116,25 @@ if( fossil_strnicmp("fossil-",zName,7)==0 ) continue; } cgi_printf("%h = %h
    \n", zName, aParamQP[i].zValue); } } + +/* +** Export all query parameters (but not cookies or environment variables) +** as hidden values of a form. +*/ +void cgi_query_parameters_to_hidden(void){ + int i; + const char *zN, *zV; + for(i=0; i + } +} /* ** This routine works like "printf" except that it has the ** extra formatting capabilities such as %h and %t. */ @@ -1092,14 +1155,14 @@ /* ** Send a reply indicating that the HTTP request was malformed */ -static NORETURN void malformed_request(void){ +static NORETURN void malformed_request(const char *zMsg){ cgi_set_status(501, "Not Implemented"); cgi_printf( - "Unrecognized HTTP Request\n" + "

    Bad Request: %s

    \n", zMsg ); cgi_reply(); fossil_exit(0); } @@ -1131,10 +1194,24 @@ va_end(ap); cgi_reply(); fossil_exit(1); } } + +/* z[] is the value of an X-FORWARDED-FOR: line in an HTTP header. +** Return a pointer to a string containing the real IP address, or a +** NULL pointer to stick with the IP address previously computed and +** loaded into g.zIpAddr. +*/ +static const char *cgi_accept_forwarded_for(const char *z){ + int i; + if( fossil_strcmp(g.zIpAddr, "127.0.0.1")!=0 ) return 0; + + i = strlen(z)-1; + while( i>=0 && z[i]!=',' && !fossil_isspace(z[i]) ) i--; + return &z[++i]; +} /* ** Remove the first space-delimited token from a string and return ** a pointer to it. Add a NULL to the string to terminate the token. ** Make *zLeftOver point to the start of the next token. @@ -1173,28 +1250,30 @@ struct sockaddr_in remoteName; socklen_t size = sizeof(struct sockaddr_in); char zLine[2000]; /* A single line of input. */ g.fullHttpReply = 1; if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ - malformed_request(); + malformed_request("missing HTTP header"); } + blob_append(&g.httpHeader, zLine, -1); cgi_trace(zLine); zToken = extract_token(zLine, &z); if( zToken==0 ){ - malformed_request(); + malformed_request("malformed HTTP header"); } if( fossil_strcmp(zToken,"GET")!=0 && fossil_strcmp(zToken,"POST")!=0 && fossil_strcmp(zToken,"HEAD")!=0 ){ - malformed_request(); + malformed_request("unsupported HTTP method"); } cgi_setenv("GATEWAY_INTERFACE","CGI/1.0"); cgi_setenv("REQUEST_METHOD",zToken); zToken = extract_token(z, &z); if( zToken==0 ){ - malformed_request(); + malformed_request("malformed URL in HTTP header"); } cgi_setenv("REQUEST_URI", zToken); + cgi_setenv("SCRIPT_NAME", ""); for(i=0; zToken[i] && zToken[i]!='?'; i++){} if( zToken[i] ) zToken[i++] = 0; cgi_setenv("PATH_INFO", zToken); cgi_setenv("QUERY_STRING", &zToken[i]); if( zIpAddr==0 && @@ -1213,10 +1292,11 @@ while( fgets(zLine,sizeof(zLine),g.httpIn) ){ char *zFieldName; char *zVal; cgi_trace(zLine); + blob_append(&g.httpHeader, zLine, -1); zFieldName = extract_token(zLine,&zVal); if( zFieldName==0 || *zFieldName==0 ) break; while( fossil_isspace(*zVal) ){ zVal++; } i = strlen(zVal); while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; } @@ -1242,9 +1322,164 @@ }else if( fossil_strcmp(zFieldName,"referer:")==0 ){ cgi_setenv("HTTP_REFERER", zVal); #endif }else if( fossil_strcmp(zFieldName,"user-agent:")==0 ){ cgi_setenv("HTTP_USER_AGENT", zVal); + }else if( fossil_strcmp(zFieldName,"x-forwarded-for:")==0 ){ + const char *zIpAddr = cgi_accept_forwarded_for(zVal); + if( zIpAddr!=0 ){ + g.zIpAddr = mprintf("%s", zIpAddr); + cgi_replace_parameter("REMOTE_ADDR", g.zIpAddr); + } } } cgi_init(); cgi_trace(0); +} + +/* +** This routine handles a single HTTP request from an SSH client which is +** coming in on g.httpIn and which replies on g.httpOut +** +** Once all the setup is finished, this procedure returns +** and subsequent code handles the actual generation of the webpage. +** +** It is called in a loop so some variables will need to be replaced +*/ +void cgi_handle_ssh_http_request(const char *zIpAddr){ + static int nCycles = 0; + static char *zCmd = 0; + char *z, *zToken; + const char *zType = 0; + int i, content_length = 0; + char zLine[2000]; /* A single line of input. */ + + if( zIpAddr ){ + if( nCycles==0 ){ + cgi_setenv("REMOTE_ADDR", zIpAddr); + g.zIpAddr = mprintf("%s", zIpAddr); + } + }else{ + fossil_panic("missing SSH IP address"); + } + if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ + malformed_request("missing HTTP header"); + } + cgi_trace(zLine); + zToken = extract_token(zLine, &z); + if( zToken==0 ){ + malformed_request("malformed HTTP header"); + } + + if( fossil_strcmp(zToken, "echo")==0 ){ + /* start looking for probes to complete transport_open */ + zCmd = cgi_handle_ssh_probes(zLine, sizeof(zLine), z, zToken); + if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ + malformed_request("missing HTTP header"); + } + cgi_trace(zLine); + zToken = extract_token(zLine, &z); + if( zToken==0 ){ + malformed_request("malformed HTTP header"); + } + }else if( zToken && strlen(zToken)==0 && zCmd ){ + /* transport_flip request and continued transport_open */ + cgi_handle_ssh_transport(zCmd); + if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ + malformed_request("missing HTTP header"); + } + cgi_trace(zLine); + zToken = extract_token(zLine, &z); + if( zToken==0 ){ + malformed_request("malformed HTTP header"); + } + } + + if( fossil_strcmp(zToken,"GET")!=0 && fossil_strcmp(zToken,"POST")!=0 + && fossil_strcmp(zToken,"HEAD")!=0 ){ + malformed_request("unsupported HTTP method"); + } + + if( nCycles==0 ){ + cgi_setenv("GATEWAY_INTERFACE","CGI/1.0"); + cgi_setenv("REQUEST_METHOD",zToken); + } + + zToken = extract_token(z, &z); + if( zToken==0 ){ + malformed_request("malformed URL in HTTP header"); + } + if( nCycles==0 ){ + cgi_setenv("REQUEST_URI", zToken); + cgi_setenv("SCRIPT_NAME", ""); + } + + for(i=0; zToken[i] && zToken[i]!='?'; i++){} + if( zToken[i] ) zToken[i++] = 0; + if( nCycles==0 ){ + cgi_setenv("PATH_INFO", zToken); + }else{ + cgi_replace_parameter("PATH_INFO", mprintf("%s",zToken)); + } + + /* Get all the optional fields that follow the first line. + */ + while( fgets(zLine,sizeof(zLine),g.httpIn) ){ + char *zFieldName; + char *zVal; + + cgi_trace(zLine); + zFieldName = extract_token(zLine,&zVal); + if( zFieldName==0 || *zFieldName==0 ) break; + while( fossil_isspace(*zVal) ){ zVal++; } + i = strlen(zVal); + while( i>0 && fossil_isspace(zVal[i-1]) ){ i--; } + zVal[i] = 0; + for(i=0; zFieldName[i]; i++){ + zFieldName[i] = fossil_tolower(zFieldName[i]); + } + if( fossil_strcmp(zFieldName,"content-length:")==0 ){ + content_length = atoi(zVal); + }else if( fossil_strcmp(zFieldName,"content-type:")==0 ){ + g.zContentType = zType = mprintf("%s", zVal); + }else if( fossil_strcmp(zFieldName,"host:")==0 ){ + if( nCycles==0 ){ + cgi_setenv("HTTP_HOST", zVal); + } + }else if( fossil_strcmp(zFieldName,"user-agent:")==0 ){ + if( nCycles==0 ){ + cgi_setenv("HTTP_USER_AGENT", zVal); + } + }else if( fossil_strcmp(zFieldName,"x-fossil-transport:")==0 ){ + if( fossil_strnicmp(zVal, "ssh", 3)==0 ){ + if( nCycles==0 ){ + g.fSshClient |= CGI_SSH_FOSSIL; + g.fullHttpReply = 0; + } + } + } + } + + if( nCycles==0 ){ + if( ! ( g.fSshClient & CGI_SSH_FOSSIL ) ){ + /* did not find new fossil ssh transport */ + g.fSshClient &= ~CGI_SSH_CLIENT; + g.fullHttpReply = 1; + cgi_replace_parameter("REMOTE_ADDR", "127.0.0.1"); + } + } + + cgi_reset_content(); + cgi_destination(CGI_BODY); + + if( content_length>0 && zType ){ + blob_zero(&g.cgiIn); + if( fossil_strcmp(zType, "application/x-fossil")==0 ){ + blob_read_from_channel(&g.cgiIn, g.httpIn, content_length); + blob_uncompress(&g.cgiIn, &g.cgiIn); + }else if( fossil_strcmp(zType, "application/x-fossil-debug")==0 ){ + blob_read_from_channel(&g.cgiIn, g.httpIn, content_length); + }else if( fossil_strcmp(zType, "application/x-fossil-uncompressed")==0 ){ + blob_read_from_channel(&g.cgiIn, g.httpIn, content_length); + } + } + cgi_trace(0); @@ -1251,12 +1486,128 @@ + nCycles++; +} + +/* +** This routine handles the old fossil SSH probes +*/ +char *cgi_handle_ssh_probes(char *zLine, int zSize, char *z, char *zToken){ + /* Start looking for probes */ + while( fossil_strcmp(zToken, "echo")==0 ){ + zToken = extract_token(z, &z); + if( zToken==0 ){ + malformed_request("malformed probe"); + } + if( fossil_strncmp(zToken, "test", 4)==0 || + fossil_strncmp(zToken, "probe-", 6)==0 ){ + fprintf(g.httpOut, "%s\n", zToken); + fflush(g.httpOut); + }else{ + malformed_request("malformed probe"); + } + if( fgets(zLine, zSize, g.httpIn)==0 ){ + malformed_request("malformed probe"); + } + cgi_trace(zLine); + zToken = extract_token(zLine, &z); + if( zToken==0 ){ + malformed_request("malformed probe"); + } + } + + /* Got all probes now first transport_open is completed + ** so return the command that was requested + */ + g.fSshClient |= CGI_SSH_COMPAT; + return mprintf("%s", zToken); +} + +/* +** This routine handles the old fossil SSH transport_flip +** and transport_open communications if detected. +*/ +void cgi_handle_ssh_transport(const char *zCmd){ + char *z, *zToken; + char zLine[2000]; /* A single line of input. */ + + /* look for second newline of transport_flip */ + if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ + malformed_request("incorrect transport_flip"); + } + cgi_trace(zLine); + zToken = extract_token(zLine, &z); + if( zToken && strlen(zToken)==0 ){ + /* look for path to fossil */ + if( fgets(zLine, sizeof(zLine),g.httpIn)==0 ){ + if ( zCmd==0 ){ + malformed_request("missing fossil command"); + }else{ + /* no new command so exit */ + fossil_exit(0); + } + } + cgi_trace(zLine); + zToken = extract_token(zLine, &z); + if( zToken==0 ){ + malformed_request("malformed fossil command"); + } + /* see if we've seen the command */ + if( zCmd && zCmd[0] && fossil_strcmp(zToken, zCmd)==0 ){ + return; + }else{ + malformed_request("transport_open failed"); + } + }else{ + malformed_request("transport_flip failed"); + } +} + +/* +** This routine handles a single SCGI request which is coming in on +** g.httpIn and which replies on g.httpOut +** +** The SCGI request is read from g.httpIn and is used to initialize +** entries in the cgi_parameter() hash, as if those entries were +** environment variables. A call to cgi_init() completes +** the setup. Once all the setup is finished, this procedure returns +** and subsequent code handles the actual generation of the webpage. +*/ +void cgi_handle_scgi_request(void){ + char *zHdr; + char *zToFree; + int nHdr = 0; + int nRead; + int n, m; + char c; + + while( (c = fgetc(g.httpIn))!=EOF && fossil_isdigit(c) ){ + nHdr = nHdr*10 + c - '0'; + } + if( nHdr<16 ) malformed_request("SCGI header too short"); + zToFree = zHdr = fossil_malloc(nHdr); + nRead = (int)fread(zHdr, 1, nHdr, g.httpIn); + if( nRead=nHdr ) malformed_request("SCGI header formatting error"); + cgi_set_parameter(zHdr, zHdr+n+1); + zHdr += m+1; + nHdr -= m+1; + } + fossil_free(zToFree); + fgetc(g.httpIn); /* Read past the "," separating header from content */ + cgi_init(); } + #if INTERFACE /* ** Bitmap values for the flags parameter to cgi_http_server(). */ #define HTTP_SERVER_LOCALHOST 0x0001 /* Bind to 127.0.0.1 only */ +#define HTTP_SERVER_SCGI 0x0002 /* SCGI instead of HTTP */ #endif /* INTERFACE */ /* ** Maximum number of child processes that we can have running @@ -1272,11 +1623,16 @@ ** The parent never returns from this procedure. ** ** Return 0 to each child as it runs. If unable to establish a ** listening socket, return non-zero. */ -int cgi_http_server(int mnPort, int mxPort, char *zBrowser, int flags){ +int cgi_http_server( + int mnPort, int mxPort, /* Range of TCP ports to try */ + const char *zBrowser, /* Run this browser, if not NULL */ + const char *zIpAddr, /* Bind to this IP address, if not null */ + int flags /* HTTP_SERVER_* flags */ +){ #if defined(_WIN32) /* Use win32_http_server() instead */ fossil_exit(1); #else int listener = -1; /* The server socket */ @@ -1291,11 +1647,16 @@ int iPort = mnPort; while( iPort<=mxPort ){ memset(&inaddr, 0, sizeof(inaddr)); inaddr.sin_family = AF_INET; - if( flags & HTTP_SERVER_LOCALHOST ){ + if( zIpAddr ){ + inaddr.sin_addr.s_addr = inet_addr(zIpAddr); + if( inaddr.sin_addr.s_addr == (-1) ){ + fossil_fatal("not a valid IP address: %s", zIpAddr); + } + }else if( flags & HTTP_SERVER_LOCALHOST ){ inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); }else{ inaddr.sin_addr.s_addr = htonl(INADDR_ANY); } inaddr.sin_port = htons(iPort); @@ -1324,15 +1685,26 @@ } } if( iPort>mxPort ) return 1; listen(listener,10); if( iPort>mnPort ){ - fossil_print("Listening for HTTP requests on TCP port %d\n", iPort); + fossil_print("Listening for %s requests on TCP port %d\n", + (flags & HTTP_SERVER_SCGI)!=0?"SCGI":"HTTP", iPort); fflush(stdout); } if( zBrowser ){ zBrowser = mprintf(zBrowser, iPort); +#if defined(__CYGWIN__) + /* On Cygwin, we can do better than "echo" */ + if( memcmp(zBrowser, "echo ", 5)==0 ){ + wchar_t *wUrl = fossil_utf8_to_unicode(zBrowser+5); + wUrl[wcslen(wUrl)-2] = 0; /* Strip terminating " &" */ + if( (size_t)ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ + fossil_warning("cannot start browser\n"); + } + }else +#endif if( system(zBrowser)<0 ){ fossil_warning("cannot start browser: %s\n", zBrowser); } } while( 1 ){ @@ -1483,5 +1855,23 @@ cgi_set_status(304,"Not Modified"); cgi_reset_content(); cgi_reply(); fossil_exit(0); } + +/* +** Check to see if the remote client is SSH and return +** its IP or return default +*/ +const char *cgi_ssh_remote_addr(const char *zDefault){ + char *zIndex; + const char *zSshConn = fossil_getenv("SSH_CONNECTION"); + + if( zSshConn && zSshConn[0] ){ + char *zSshClient = mprintf("%s",zSshConn); + if( (zIndex = strchr(zSshClient,' '))!=0 ){ + zSshClient[zIndex-zSshClient] = '\0'; + return zSshClient; + } + } + return zDefault; +} Index: src/checkin.c ================================================================== --- src/checkin.c +++ src/checkin.c @@ -39,15 +39,36 @@ ){ Stmt q; int nPrefix = strlen(zPrefix); int nErr = 0; Blob rewrittenPathname; + Blob where; + const char *zName; + int i; + + blob_zero(&where); + for(i=2; i'%q/' %s AND pathname<'%q0' %s)", + (blob_size(&where)>0) ? "OR" : "AND", zName, + filename_collation(), zName, filename_collation(), + zName, filename_collation()); + } + db_prepare(&q, "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)" " FROM vfile " - " WHERE is_selected(id)" - " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" + " WHERE is_selected(id) %s" + " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1", + blob_str(&where) ); blob_zero(&rewrittenPathname); while( db_step(&q)==SQLITE_ROW ){ const char *zPathname = db_column_text(&q,0); const char *zDisplayName = zPathname; @@ -82,22 +103,28 @@ } }else if( isNew ){ blob_appendf(report, "ADDED %s\n", zDisplayName); }else if( isDeleted ){ blob_appendf(report, "DELETED %s\n", zDisplayName); - }else if( isChnged==2 ){ - blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); - }else if( isChnged==3 ){ - blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); - }else if( isChnged==1 ){ - if( file_contains_merge_marker(zFullName) ){ + }else if( isChnged ){ + if( isChnged==2 ){ + blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName); + }else if( isChnged==3 ){ + blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName); + }else if( isChnged==4 ){ + blob_appendf(report, "UPDATED_BY_INTEGRATE %s\n", zDisplayName); + }else if( isChnged==5 ){ + blob_appendf(report, "ADDED_BY_INTEGRATE %s\n", zDisplayName); + }else if( file_contains_merge_marker(zFullName) ){ blob_appendf(report, "CONFLICT %s\n", zDisplayName); }else{ blob_appendf(report, "EDITED %s\n", zDisplayName); } }else if( isRenamed ){ blob_appendf(report, "RENAMED %s\n", zDisplayName); + }else{ + report->nUsed -= nPrefix; } free(zFullName); } blob_reset(&rewrittenPathname); db_finalize(&q); @@ -106,10 +133,11 @@ 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; } blob_append(report, zPrefix, nPrefix); blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0)); } db_finalize(&q); @@ -149,35 +177,36 @@ ** --rel-paths Display pathnames relative to the current working ** directory. ** --sha1sum Verify file status using SHA1 hashing rather ** than relying on file mtimes. ** --header Identify the repository if there are changes -** -v Say "no changes" if there are none +** -v|--verbose Say "(none)" if there are no changes ** ** See also: extra, ls, status */ void changes_cmd(void){ Blob report; int vid; int useSha1sum = find_option("sha1sum", 0, 0)!=0; int showHdr = find_option("header",0,0)!=0; - int verbose = find_option("verbose","v",0)!=0; + int verboseFlag = find_option("verbose","v",0)!=0; int cwdRelative = 0; db_must_be_within_tree(); cwdRelative = determine_cwd_relative_option(); blob_zero(&report); vid = db_lget_int("checkout", 0); vfile_check_signature(vid, useSha1sum ? CKSIG_SHA1 : 0); status_report(&report, "", 0, cwdRelative); - if( verbose && blob_size(&report)==0 ){ + if( verboseFlag && blob_size(&report)==0 ){ blob_append(&report, " (none)\n", -1); } if( showHdr && blob_size(&report)>0 ){ fossil_print("Changes for %s at %s:\n", db_get("project-name","???"), g.zLocalRoot); } blob_write_to_file(&report, "-"); + blob_reset(&report); } /* ** COMMAND: status ** @@ -202,45 +231,50 @@ int vid; db_must_be_within_tree(); /* 012345678901234 */ fossil_print("repository: %s\n", db_repository_filename()); fossil_print("local-root: %s\n", g.zLocalRoot); + if( g.zConfigDbName ){ + fossil_print("config-db: %s\n", g.zConfigDbName); + } vid = db_lget_int("checkout", 0); if( vid ){ show_common_info(vid, "checkout:", 1, 1); } db_record_repository_filename(0); changes_cmd(); } - -/* -** Implementation of the checkin_mtime SQL function -*/ - /* ** COMMAND: ls ** -** Usage: %fossil ls ?OPTIONS? ?VERSION? +** Usage: %fossil ls ?OPTIONS? ?VERSION? ?FILENAMES? ** -** Show the names of all files in the current checkout. The -l provides -** extra information about each file. +** Show the names of all files in the current checkout. The -v provides +** extra information about each file. If FILENAMES are included, only +** the files listed (or their children if they are directories) are shown. ** ** Options: -** -l Provide extra information about each file. ** --age Show when each file was committed +** -v|--verbose Provide extra information about each file. ** ** See also: changes, extra, status */ void ls_cmd(void){ int vid; Stmt q; - int isBrief; + int verboseFlag; int showAge; char *zOrderBy = "pathname"; + Blob where; + int i; + const char *zName; - isBrief = find_option("l","l", 0)==0; + verboseFlag = find_option("verbose","v", 0)!=0; + if( !verboseFlag ){ + verboseFlag = find_option("l","l", 0)!=0; /* deprecated */ + } showAge = find_option("age",0,0)!=0; db_must_be_within_tree(); vid = db_lget_int("checkout", 0); if( find_option("t","t",0)!=0 ){ if( showAge ){ @@ -248,64 +282,146 @@ }else{ zOrderBy = "mtime DESC"; } } verify_all_options(); + blob_zero(&where); + for(i=2; i'%q/' %s AND pathname<'%q0' %s)", + (blob_size(&where)>0) ? "OR" : "WHERE", zName, + filename_collation(), zName, filename_collation(), + zName, filename_collation()); + } vfile_check_signature(vid, 0); if( showAge ){ db_prepare(&q, "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)," " datetime(checkin_mtime(%d,rid),'unixepoch','localtime')" - " FROM vfile" - " ORDER BY %s", vid, zOrderBy + " FROM vfile %s" + " ORDER BY %s", vid, blob_str(&where), zOrderBy ); }else{ db_prepare(&q, "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" - " FROM vfile" - " ORDER BY %s", zOrderBy + " FROM vfile %s" + " ORDER BY %s", blob_str(&where), zOrderBy ); } + blob_reset(&where); while( db_step(&q)==SQLITE_ROW ){ const char *zPathname = db_column_text(&q,0); int isDeleted = db_column_int(&q, 1); int isNew = db_column_int(&q,2)==0; int chnged = db_column_int(&q,3); int renamed = db_column_int(&q,4); char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); + const char *type = ""; + if( verboseFlag ){ + if( isNew ){ + type = "ADDED "; + }else if( isDeleted ){ + type = "DELETED "; + }else if( !file_wd_isfile_or_link(zFullName) ){ + if( file_access(zFullName, 0)==0 ){ + type = "NOT_A_FILE "; + }else{ + type = "MISSING "; + } + }else if( chnged ){ + if( chnged==2 ){ + type = "UPDATED_BY_MERGE "; + }else if( chnged==3 ){ + type = "ADDED_BY_MERGE "; + }else if( chnged==4 ){ + type = "UPDATED_BY_INTEGRATE "; + }else if( chnged==5 ){ + type = "ADDED_BY_INTEGRATE "; + }else if( file_contains_merge_marker(zFullName) ){ + type = "CONFLICT "; + }else{ + type = "EDITED "; + } + }else if( renamed ){ + type = "RENAMED "; + }else{ + type = "UNCHANGED "; + } + } if( showAge ){ - fossil_print("%s %s\n", db_column_text(&q, 5), zPathname); - }else if( isBrief ){ - fossil_print("%s\n", zPathname); - }else if( isNew ){ - fossil_print("ADDED %s\n", zPathname); - }else if( isDeleted ){ - fossil_print("DELETED %s\n", zPathname); - }else if( !file_wd_isfile_or_link(zFullName) ){ - if( file_access(zFullName, 0)==0 ){ - fossil_print("NOT_A_FILE %s\n", zPathname); - }else{ - fossil_print("MISSING %s\n", zPathname); - } - }else if( chnged ){ - fossil_print("EDITED %s\n", zPathname); - }else if( renamed ){ - fossil_print("RENAMED %s\n", zPathname); - }else{ - fossil_print("UNCHANGED %s\n", zPathname); + fossil_print("%s%s %s\n", type, db_column_text(&q, 5), zPathname); + }else{ + fossil_print("%s%s\n", type, zPathname); } free(zFullName); } db_finalize(&q); } + +/* +** Create a TEMP table named SFILE and add all unmanaged files named on +** the command-line to that table. If directories are named, then add +** all unmanaged files contained underneath those directories. If there +** are no files or directories named on the command-line, then add all +** unmanaged files anywhere in the checkout. +*/ +static void locate_unmanaged_files( + int argc, /* Number of command-line arguments to examine */ + char **argv, /* values of command-line arguments */ + 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 */ +){ + Blob name; /* Name of a candidate file or directory */ + char *zName; /* Name of a candidate file or directory */ + int isDir; /* 1 for a directory, 0 if doesn't exist, 2 for anything else */ + int i; /* Loop counter */ + int nRoot; /* length of g.zLocalRoot */ + + db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", + filename_collation()); + nRoot = (int)strlen(g.zLocalRoot); + if( argc==0 ){ + blob_init(&name, g.zLocalRoot, nRoot - 1); + vfile_scan(&name, blob_size(&name), scanFlags, pIgnore1, pIgnore2); + blob_reset(&name); + }else{ + for(i=0; i override case-sensitive setting ** --dotfiles include files beginning with a dot (".") ** --ignore ignore files matching patterns from the argument ** --rel-paths Display pathnames relative to the current working ** directory. ** ** See also: changes, clean, status */ void extra_cmd(void){ - Blob path; Stmt q; - int n; const char *zIgnoreFlag = find_option("ignore",0,1); unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; int cwdRelative = 0; Glob *pIgnore; Blob rewrittenPathname; const char *zPathname, *zDisplayName; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; + capture_case_sensitive_option(); db_must_be_within_tree(); cwdRelative = determine_cwd_relative_option(); - db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", - filename_collation()); - n = strlen(g.zLocalRoot); - blob_init(&path, g.zLocalRoot, n-1); if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } pIgnore = glob_create(zIgnoreFlag); - vfile_scan(&path, blob_size(&path), scanFlags, pIgnore); + locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, 0); glob_free(pIgnore); db_prepare(&q, "SELECT x FROM sfile" " WHERE x NOT IN (%s)" " ORDER BY 1", @@ -373,92 +485,192 @@ db_finalize(&q); } /* ** COMMAND: clean -** Usage: %fossil clean ?OPTIONS? +** Usage: %fossil clean ?OPTIONS? ?PATH1 ...? ** ** Delete all "extra" files in the source tree. "Extra" files are ** files that are not officially part of the checkout. This operation -** cannot be undone. +** cannot be undone. If paths are specified, only the directories or +** files specified will be considered for cleaning. ** -** You will be prompted before removing each file. If you are -** sure you wish to remove all "extra" files you can specify the -** optional --force flag and no prompts will be issued. +** You will be prompted before removing each eligible file unless the +** --force flag is in use or it matches the --clean option. The +** GLOBPATTERN specified by the "ignore-glob" setting is used if the +** --ignore option is omitted, the same with "clean-glob" and --clean +** as well as "keep-glob" and --keep. If you are sure you wish to +** remove all "extra" files except the ones specified with --ignore +** and --keep, you can specify the optional -f|--force flag and no +** prompts will be issued. If a file matches both --keep and --clean, +** --keep takes precedence. ** ** Files and subdirectories whose names begin with "." are -** normally ignored. They are included if the "--dotfiles" option +** normally kept. They are handled if the "--dotfiles" option ** is used. ** -** The GLOBPATTERN is a comma-separated list of GLOB expressions for -** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" -** is used if the --ignore option is omitted. -** ** Options: -** --dotfiles include files beginning with a dot (".") -** --force Remove files without prompting -** --ignore ignore files matching patterns from the +** --allckouts Check for empty directories within any checkouts +** that may be nested within the current one. This +** option should be used with great care because the +** empty-dirs setting (and other applicable settings) +** belonging to the other repositories, if any, will +** not be checked. +** --case-sensitive override case-sensitive setting +** --dirsonly Only remove empty directories. No files will +** be removed. Using this option will automatically +** enable the --emptydirs option as well. +** --dotfiles Include files beginning with a dot ("."). +** --emptydirs Remove any empty directories that are not +** explicitly exempted via the empty-dirs setting +** or another applicable setting or command line +** argument. Matching files, if any, are removed +** prior to checking for any empty directories; +** therefore, directories that contain only files +** that were removed will be removed as well. +** -f|--force Remove files without prompting. +** --clean Never prompt for files matching this +** comma separated list of glob patterns. +** --ignore Ignore files matching patterns from the ** comma separated list of glob patterns. -** --temp Remove only Fossil-generated temporary files +** --keep Keep files matching this comma separated +** list of glob patterns. +** -n|--dry-run If given, display instead of run actions. +** --temp Remove only Fossil-generated temporary files. +** -v|--verbose Show all files as they are removed. ** ** See also: addremove, extra, status */ void clean_cmd(void){ - int allFlag; + int allFileFlag, allDirFlag, dryRunFlag, verboseFlag; + int emptyDirsFlag, dirsOnlyFlag; unsigned scanFlags = 0; - const char *zIgnoreFlag; - Blob path, repo; - Stmt q; - int n; - Glob *pIgnore; - int testFlag = 0; - - allFlag = find_option("force","f",0)!=0; + const char *zIgnoreFlag, *zKeepFlag, *zCleanFlag; + Glob *pIgnore, *pKeep, *pClean; + int nRoot; + + dryRunFlag = find_option("dry-run","n",0)!=0; + if( !dryRunFlag ){ + dryRunFlag = find_option("test",0,0)!=0; /* deprecated */ + } + if( !dryRunFlag ){ + dryRunFlag = find_option("whatif",0,0)!=0; + } + allFileFlag = allDirFlag = find_option("force","f",0)!=0; + dirsOnlyFlag = find_option("dirsonly",0,0)!=0; + emptyDirsFlag = find_option("emptydirs","d",0)!=0 || dirsOnlyFlag; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; + if( find_option("allckouts",0,0)!=0 ) scanFlags |= SCAN_NESTED; zIgnoreFlag = find_option("ignore",0,1); - testFlag = find_option("test",0,0)!=0; + verboseFlag = find_option("verbose","v",0)!=0; + zKeepFlag = find_option("keep",0,1); + zCleanFlag = find_option("clean",0,1); + capture_case_sensitive_option(); db_must_be_within_tree(); if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } - db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY %s)", - filename_collation()); - n = strlen(g.zLocalRoot); - blob_init(&path, g.zLocalRoot, n-1); + if( zKeepFlag==0 ){ + zKeepFlag = db_get("keep-glob", 0); + } + if( zCleanFlag==0 ){ + zCleanFlag = db_get("clean-glob", 0); + } + verify_all_options(); pIgnore = glob_create(zIgnoreFlag); - vfile_scan(&path, blob_size(&path), scanFlags, pIgnore); - glob_free(pIgnore); - db_prepare(&q, - "SELECT %Q || x FROM sfile" - " WHERE x NOT IN (%s)" - " ORDER BY 1", - g.zLocalRoot, fossil_all_reserved_names(0) - ); - if( file_tree_name(g.zRepositoryName, &repo, 0) ){ - db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); - } - db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); - while( db_step(&q)==SQLITE_ROW ){ - if( testFlag ){ - fossil_print("%s\n", db_column_text(&q,0)); - }else if( allFlag ){ - file_delete(db_column_text(&q, 0)); - }else{ - Blob ans; - char cReply; - char *prompt = mprintf("remove unmanaged file \"%s\" (y/N)? ", - db_column_text(&q, 0)); - blob_zero(&ans); - prompt_user(prompt, &ans); - cReply = blob_str(&ans)[0]; - if( cReply=='y' || cReply=='Y' ){ - file_delete(db_column_text(&q, 0)); - } - } - } - db_finalize(&q); + pKeep = glob_create(zKeepFlag); + pClean = glob_create(zCleanFlag); + nRoot = (int)strlen(g.zLocalRoot); + if( !dirsOnlyFlag ){ + Stmt q; + Blob repo; + locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore, pKeep); + db_prepare(&q, + "SELECT %Q || x FROM sfile" + " WHERE x NOT IN (%s)" + " ORDER BY 1", + g.zLocalRoot, fossil_all_reserved_names(0) + ); + if( file_tree_name(g.zRepositoryName, &repo, 0) ){ + db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); + } + db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); + while( db_step(&q)==SQLITE_ROW ){ + const char *zName = db_column_text(&q, 0); + if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ + Blob ans; + char cReply; + char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ", + zName+nRoot); + blob_zero(&ans); + prompt_user(prompt, &ans); + cReply = blob_str(&ans)[0]; + if( cReply=='a' || cReply=='A' ){ + allFileFlag = 1; + }else if( cReply!='y' && cReply!='Y' ){ + blob_reset(&ans); + continue; + } + blob_reset(&ans); + } + if ( dryRunFlag || file_delete(zName)==0 ){ + if( verboseFlag || dryRunFlag ){ + fossil_print("Removed unmanaged file: %s\n", zName+nRoot); + } + }else if( verboseFlag ){ + fossil_print("Could not remove file: %s\n", zName+nRoot); + } + } + db_finalize(&q); + } + 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, pKeep, + pEmptyDirs); + 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) + ); + while( db_step(&q)==SQLITE_ROW ){ + const char *zName = db_column_text(&q, 0); + if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){ + Blob ans; + char cReply; + char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ", + zName+nRoot); + blob_zero(&ans); + prompt_user(prompt, &ans); + cReply = blob_str(&ans)[0]; + if( cReply=='a' || cReply=='A' ){ + allDirFlag = 1; + }else if( cReply!='y' && cReply!='Y' ){ + blob_reset(&ans); + continue; + } + blob_reset(&ans); + } + if ( dryRunFlag || file_rmdir(zName)==0 ){ + if( verboseFlag || dryRunFlag ){ + fossil_print("Removed unmanaged directory: %s\n", zName+nRoot); + } + }else if( verboseFlag ){ + fossil_print("Could not remove directory: %s\n", zName+nRoot); + } + } + db_finalize(&q); + glob_free(pEmptyDirs); + } + glob_free(pClean); + glob_free(pKeep); + glob_free(pIgnore); } /* ** Prompt the user for a check-in or stash comment (given in pPrompt), ** gather the response, then return the response in pComment. @@ -481,13 +693,17 @@ zEditor = fossil_getenv("VISUAL"); } if( zEditor==0 ){ zEditor = fossil_getenv("EDITOR"); } -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) if( zEditor==0 ){ - zEditor = mprintf("%s\\notepad.exe", fossil_getenv("SystemRoot")); + zEditor = mprintf("%s\\notepad.exe", fossil_getenv("SYSTEMROOT")); +#if defined(__CYGWIN__) + zEditor = fossil_utf8_to_filename(zEditor); + blob_add_cr(pPrompt); +#endif } #endif if( zEditor==0 ){ blob_append(pPrompt, "#\n" @@ -496,12 +712,16 @@ "# and because no comment was specified using the \"-m\" or \"-M\"\n" "# command-line options, you will need to enter the comment below.\n" "# Type \".\" on a line by itself when you are done:\n", -1); zFile = mprintf("-"); }else{ + Blob fname; + blob_zero(&fname); + file_relative_name(g.zLocalRoot, &fname, 1); zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", - g.zLocalRoot); + blob_str(&fname)); + blob_reset(&fname); } #if defined(_WIN32) blob_add_cr(pPrompt); #endif blob_write_to_file(pPrompt, zFile); @@ -522,11 +742,11 @@ } blob_append(&reply, zIn, -1); } } blob_to_utf8_no_bom(&reply, 1); - blob_remove_cr(&reply); + blob_to_lf_only(&reply); file_delete(zFile); free(zFile); blob_zero(pComment); while( blob_line(&reply, &line) ){ int i, n; @@ -564,16 +784,15 @@ ** parent_rid is the recordid of the parent check-in. */ static void prepare_commit_comment( Blob *pComment, char *zInit, - const char *zBranch, - int parent_rid, - const char *zUserOvrd + CheckinInfo *p, + int parent_rid ){ Blob prompt; -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) int bomSize; const unsigned char *bom = get_utf8_bom(&bomSize); blob_init(&prompt, (const char *) bom, bomSize); if( zInit && zInit[0]) { blob_append(&prompt, zInit, -1); @@ -581,16 +800,16 @@ #else blob_init(&prompt, zInit, -1); #endif blob_append(&prompt, "\n" - "# Enter comments on this check-in. Lines beginning with # are ignored.\n" + "# Enter commit message for this check-in. Lines beginning with # are ignored.\n" "#\n", -1 ); - blob_appendf(&prompt, "# user: %s\n", zUserOvrd ? zUserOvrd : g.zLogin); - if( zBranch && zBranch[0] ){ - blob_appendf(&prompt, "# tags: %s\n#\n", zBranch); + blob_appendf(&prompt, "# user: %s\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); + if( p->zBranch && p->zBranch[0] ){ + blob_appendf(&prompt, "# tags: %s\n#\n", p->zBranch); }else{ char *zTags = info_tags_of_checkin(parent_rid, 1); if( zTags ) blob_appendf(&prompt, "# tags: %z\n#\n", zTags); } status_report(&prompt, "# ", 1, 0); @@ -616,30 +835,57 @@ ** of the array. ** ** If there were no arguments passed to [commit], aCommitFile is not ** allocated and remains NULL. Other parts of the code interpret this ** to mean "all files". +** +** Returns 1 if there was a warning, 0 otherwise. */ -void select_commit_files(void){ +int select_commit_files(void){ + int result = 0; + assert( g.aCommitFile==0 ); if( g.argc>2 ){ - int ii; - Blob b; - blob_zero(&b); - g.aCommitFile = fossil_malloc(sizeof(int)*(g.argc-1)); + int ii, jj=0; + Blob fname; + Stmt q; + const char *zCollate; + Bag toCommit; + zCollate = filename_collation(); + blob_zero(&fname); + bag_init(&toCommit); for(ii=2; ii'%q/' %s AND pathname<'%q0' %s)", + blob_str(&fname), zCollate, blob_str(&fname), + zCollate, blob_str(&fname), zCollate); + while( db_step(&q)==SQLITE_ROW ){ + cnt++; + bag_insert(&toCommit, db_column_int(&q, 0)); + } + db_finalize(&q); + if( cnt==0 ){ + fossil_warning("fossil knows nothing about: %s", g.argv[ii]); + result = 1; + } + blob_reset(&fname); + } + g.aCommitFile = fossil_malloc( (bag_count(&toCommit)+1) * sizeof(g.aCommitFile[0]) ); + for(ii=bag_first(&toCommit); ii>0; ii=bag_next(&toCommit, ii)){ + g.aCommitFile[jj++] = ii; + } + g.aCommitFile[jj] = 0; + bag_clear(&toCommit); + } + return result; } /* ** Make sure the current check-in with timestamp zDate is younger than its ** ancestor identified rid and zUuid. Throw a fatal error if not. @@ -699,54 +945,78 @@ for(i=2; i %s\n", g.argv[i], date_in_standard_format(g.argv[i])); } } +#if INTERFACE +/* +** The following structure holds some of the information needed to construct a +** check-in manifest. +*/ +struct CheckinInfo { + Blob *pComment; /* Check-in comment text */ + const char *zMimetype; /* Mimetype of check-in command. May be NULL */ + int verifyDate; /* Verify that child is younger */ + int closeFlag; /* Close the branch being committed */ + Blob *pCksum; /* Repository checksum. May be 0 */ + const char *zDateOvrd; /* Date override. If 0 then use 'now' */ + const char *zUserOvrd; /* User override. If 0 then use g.zLogin */ + const char *zBranch; /* Branch name. May be 0 */ + const char *zColor; /* One-time background color. May be 0 */ + const char *zBrClr; /* Persistent branch color. May be 0 */ + const char **azTag; /* Tags to apply to this check-in */ +}; +#endif /* INTERFACE */ + /* ** Create a manifest. */ static void create_manifest( Blob *pOut, /* Write the manifest here */ const char *zBaselineUuid, /* UUID of baseline, or zero */ Manifest *pBaseline, /* Make it a delta manifest if not zero */ - Blob *pComment, /* Check-in comment text */ - int vid, /* blob-id of the parent manifest */ - int verifyDate, /* Verify that child is younger */ - Blob *pCksum, /* Repository checksum. May be 0 */ - const char *zDateOvrd, /* Date override. If 0 then use 'now' */ - const char *zUserOvrd, /* User override. If 0 then use g.zLogin */ - const char *zBranch, /* Branch name. May be 0 */ - const char *zColor, /* One-time background color. May be 0 */ - const char *zBrClr, /* Persistent branch color. May be 0 */ - const char **azTag, /* Tags to apply to this check-in */ - int *pnFBcard /* Number of generated B- and F-cards */ + int vid, /* BLOB.id for the parent check-in */ + CheckinInfo *p, /* Information about the check-in */ + int *pnFBcard /* OUT: Number of generated B- and F-cards */ ){ char *zDate; /* Date of the check-in */ - char *zParentUuid; /* UUID of parent check-in */ + char *zParentUuid = 0; /* UUID of parent check-in */ Blob filename; /* A single filename */ int nBasename; /* Size of base filename */ - Stmt q; /* Query of files changed */ - Stmt q2; /* Query of merge parents */ + Stmt q; /* Various queries */ Blob mcksum; /* Manifest checksum */ ManifestFile *pFile; /* File from the baseline */ int nFBcard = 0; /* Number of B-cards and F-cards */ int i; /* Loop counter */ + const char *zColor; /* Modified value of p->zColor */ assert( pBaseline==0 || pBaseline->zBaseline==0 ); assert( pBaseline==0 || zBaselineUuid!=0 ); blob_zero(pOut); - zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); + if( vid ){ + zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d AND " + "EXISTS(SELECT 1 FROM event WHERE event.type='ci' and event.objid=%d)", + vid, vid); + if( !zParentUuid ){ + fossil_fatal("Could not find a valid check-in for RID %d. " + "Possible checkout/repo mismatch.", vid); + } + } if( pBaseline ){ blob_appendf(pOut, "B %s\n", zBaselineUuid); manifest_file_rewind(pBaseline); pFile = manifest_file_next(pBaseline, 0); nFBcard++; }else{ pFile = 0; } - blob_appendf(pOut, "C %F\n", blob_str(pComment)); - zDate = date_in_standard_format(zDateOvrd ? zDateOvrd : "now"); + if( blob_size(p->pComment)!=0 ){ + blob_appendf(pOut, "C %F\n", blob_str(p->pComment)); + }else{ + blob_append(pOut, "C (no\\scomment)\n", 16); + } + zDate = date_in_standard_format(p->zDateOvrd ? p->zDateOvrd : "now"); blob_appendf(pOut, "D %s\n", zDate); zDate[10] = ' '; db_prepare(&q, "SELECT pathname, uuid, origname, blob.rid, isexe, islink," " is_selected(vfile.id)" @@ -820,67 +1090,103 @@ while( pFile ){ blob_appendf(pOut, "F %F\n", pFile->zName); pFile = manifest_file_next(pBaseline, 0); nFBcard++; } - blob_appendf(pOut, "P %s", zParentUuid); - if( verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate); - free(zParentUuid); - db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=0"); - while( db_step(&q2)==SQLITE_ROW ){ - char *zMergeUuid; - int mid = db_column_int(&q2, 0); - if( !g.markPrivate && content_is_private(mid) ) continue; - zMergeUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid); - if( zMergeUuid ){ - blob_appendf(pOut, " %s", zMergeUuid); - if( verifyDate ) checkin_verify_younger(mid, zMergeUuid, zDate); - free(zMergeUuid); - } - } - db_finalize(&q2); + if( p->zMimetype && p->zMimetype[0] ){ + blob_appendf(pOut, "N %F\n", p->zMimetype); + } + if( vid ){ + blob_appendf(pOut, "P %s", zParentUuid); + if( p->verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate); + free(zParentUuid); + db_prepare(&q, "SELECT merge FROM vmerge WHERE id=0 OR id<-2"); + while( db_step(&q)==SQLITE_ROW ){ + char *zMergeUuid; + int mid = db_column_int(&q, 0); + if( (!g.markPrivate && content_is_private(mid)) || (mid == vid) ) continue; + zMergeUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid); + if( zMergeUuid ){ + blob_appendf(pOut, " %s", zMergeUuid); + if( p->verifyDate ) checkin_verify_younger(mid, zMergeUuid, zDate); + free(zMergeUuid); + } + } + db_finalize(&q); + blob_appendf(pOut, "\n"); + } free(zDate); - blob_appendf(pOut, "\n"); - if( pCksum ) blob_appendf(pOut, "R %b\n", pCksum); - if( zBranch && zBranch[0] ){ + db_prepare(&q, + "SELECT CASE vmerge.id WHEN -1 THEN '+' ELSE '-' END || blob.uuid, merge" + " FROM vmerge, blob" + " WHERE (vmerge.id=-1 OR vmerge.id=-2)" + " AND blob.rid=vmerge.merge" + " 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); + } + } + db_finalize(&q); + + if( p->pCksum ) blob_appendf(pOut, "R %b\n", p->pCksum); + zColor = p->zColor; + if( p->zBranch && p->zBranch[0] ){ /* Set tags for the new branch */ - if( zBrClr && zBrClr[0] ){ + if( p->zBrClr && p->zBrClr[0] ){ zColor = 0; - blob_appendf(pOut, "T *bgcolor * %F\n", zBrClr); + blob_appendf(pOut, "T *bgcolor * %F\n", p->zBrClr); } - blob_appendf(pOut, "T *branch * %F\n", zBranch); - blob_appendf(pOut, "T *sym-%F *\n", zBranch); + blob_appendf(pOut, "T *branch * %F\n", p->zBranch); + blob_appendf(pOut, "T *sym-%F *\n", p->zBranch); } if( zColor && zColor[0] ){ /* One-time background color */ blob_appendf(pOut, "T +bgcolor * %F\n", zColor); } - if( azTag ){ - for(i=0; azTag[i]; i++){ + if( p->closeFlag ){ + blob_appendf(pOut, "T +closed *\n"); + } + db_prepare(&q, "SELECT uuid,merge FROM vmerge JOIN blob ON merge=rid" + " WHERE id=-4 ORDER BY 1"); + 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)){ + blob_appendf(pOut, "T +closed %s\n", zIntegrateUuid); + } + } + db_finalize(&q); + + if( p->azTag ){ + for(i=0; p->azTag[i]; i++){ /* Add a symbolic tag to this check-in. The tag names have already ** been sorted and converted using the %F format */ - blob_appendf(pOut, "T +sym-%s *\n", azTag[i]); + assert( i==0 || strcmp(p->azTag[i-1], p->azTag[i])<=0 ); + blob_appendf(pOut, "T +sym-%s *\n", p->azTag[i]); } } - if( zBranch && zBranch[0] ){ + if( p->zBranch && p->zBranch[0] ){ /* For a new branch, cancel all prior propagating tags */ - Stmt q; db_prepare(&q, "SELECT tagname FROM tagxref, tag" " WHERE tagxref.rid=%d AND tagxref.tagid=tag.tagid" " AND tagtype==2 AND tagname GLOB 'sym-*'" " AND tagname!='sym-'||%Q" " ORDER BY tagname", - vid, zBranch); + vid, p->zBranch); while( db_step(&q)==SQLITE_ROW ){ const char *zBrTag = db_column_text(&q, 0); blob_appendf(pOut, "T -%F *\n", zBrTag); } db_finalize(&q); } - blob_appendf(pOut, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin); + blob_appendf(pOut, "U %F\n", p->zUserOvrd ? p->zUserOvrd : g.zLogin); md5sum_blob(pOut, &mcksum); blob_appendf(pOut, "Z %b\n", &mcksum); if( pnFBcard ) *pnFBcard = nFBcard; } @@ -895,63 +1201,95 @@ */ static int commit_warning( Blob *p, /* The content of the file being committed. */ int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ int binOk, /* Non-zero if binary warnings should be disabled. */ - int encodingOk, /* Non-zero if encoding warnings should be disabled. */ + int encodingOk, /* Non-zero if encoding warnings should be disabled. */ const char *zFilename /* The full name of the file being committed. */ ){ - int eType; /* return value of looks_like_utf8/utf16() */ - int fUnicode; /* return value of starts_with_utf16_bom() */ + int bReverse; /* UTF-16 byte order is reversed? */ + int fUnicode; /* return value of could_be_utf16() */ + int fBinary; /* does the blob content appear to be binary? */ + int lookFlags; /* output flags from looks_like_utf8/utf16() */ + int fHasAnyCr; /* the blob contains one or more CR chars */ + int fHasLoneCrOnly; /* all detected line endings are CR only */ + int fHasCrLfOnly; /* all detected line endings are CR/LF pairs */ char *zMsg; /* Warning message */ Blob fname; /* Relative pathname of the file */ static int allOk = 0; /* Set to true to disable this routine */ if( allOk ) return 0; - fUnicode = starts_with_utf16_bom(p, 0); - eType = fUnicode ? looks_like_utf16(p) : looks_like_utf8(p); - if( eType==0 || eType==-1 || fUnicode ){ + fUnicode = could_be_utf16(p, &bReverse); + if( fUnicode ){ + lookFlags = looks_like_utf16(p, bReverse, LOOK_NUL); + }else{ + lookFlags = looks_like_utf8(p, LOOK_NUL); + } + fHasAnyCr = (lookFlags & LOOK_CR); + fBinary = (lookFlags & LOOK_BINARY); + fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR); + fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF); + if( fUnicode || fHasAnyCr || fBinary ){ const char *zWarning; const char *zDisable; const char *zConvert = "c=convert/"; Blob ans; char cReply; - if( eType==-1 && fUnicode ){ - if ( crnlOk && encodingOk ){ - return 0; /* We don't want CR/NL and Unicode warnings for this file. */ - } - zWarning = "CR/NL line endings and Unicode"; - zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; - }else if( eType==-1 ){ - if( crnlOk ){ - return 0; /* We don't want CR/NL warnings for this file. */ - } - zWarning = "CR/NL line endings"; - zDisable = "\"crnl-glob\" setting"; - }else if( eType==0 ){ + if( fBinary ){ + int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */ + int fHasLong = (lookFlags & LOOK_LONG); /* overly long line? */ if( binOk ){ return 0; /* We don't want binary warnings for this file. */ } - zWarning = "binary data"; + if( !fHasNul && fHasLong ){ + zWarning = "long lines"; + zConvert = ""; /* We cannot convert binary files. */ + }else{ + zWarning = "binary data"; + zConvert = ""; /* We cannot convert binary files. */ + } zDisable = "\"binary-glob\" setting"; - zConvert = ""; /* We cannot convert binary files. */ + }else if( fUnicode && fHasAnyCr ){ + if( crnlOk && encodingOk ){ + return 0; /* We don't want CR/NL and Unicode warnings for this file. */ + } + if( fHasLoneCrOnly ){ + zWarning = "CR line endings and Unicode"; + }else if( fHasCrLfOnly ){ + zWarning = "CR/NL line endings and Unicode"; + }else{ + zWarning = "mixed line endings and Unicode"; + } + zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; + }else if( fHasAnyCr ){ + if( crnlOk ){ + return 0; /* We don't want CR/NL warnings for this file. */ + } + if( fHasLoneCrOnly ){ + zWarning = "CR line endings"; + }else if( fHasCrLfOnly ){ + zWarning = "CR/NL line endings"; + }else{ + zWarning = "mixed line endings"; + } + zDisable = "\"crnl-glob\" setting"; }else{ - if ( encodingOk ){ + if( encodingOk ){ return 0; /* We don't want encoding warnings for this file. */ } zWarning = "Unicode"; - zDisable = "\"encoding-glob\" setting"; -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__CYGWIN__) zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */ #endif + zDisable = "\"encoding-glob\" setting"; } file_relative_name(zFilename, &fname, 0); blob_zero(&ans); zMsg = mprintf( "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" - "Commit anyhow (a=all/%sy/N)? ", + "Commit anyhow (a=all/%sy/N)? ", blob_str(&fname), zWarning, zDisable, zConvert); prompt_user(zMsg, &ans); fossil_free(zMsg); cReply = blob_str(&ans)[0]; if( cReply=='a' || cReply=='A' ){ @@ -966,11 +1304,13 @@ int bomSize; const unsigned char *bom = get_utf8_bom(&bomSize); fwrite(bom, 1, bomSize, f); blob_to_utf8_no_bom(p, 0); } - blob_remove_cr(p); + if( fHasAnyCr ){ + blob_to_lf_only(p); + } fwrite(blob_buffer(p), 1, blob_size(p), f); fclose(f); return 1; }else if( cReply!='y' && cReply!='Y' ){ fossil_fatal("Abandoning commit due to %s in %s", @@ -1048,13 +1388,16 @@ ** --allow-older allow a commit older than its ancestor ** --baseline use a baseline manifest in the commit process ** --bgcolor COLOR apply COLOR to this one check-in only ** --branch NEW-BRANCH-NAME check in to this new branch ** --branchcolor COLOR apply given COLOR to the branch -** --comment|-m COMMENT-TEXT use COMMENT-TEXT as commit comment +** --close close the branch being committed ** --delta use a delta manifest in the commit process -** --message-file|-M FILE read the commit comment from given file +** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment +** -M|--message-file FILE read the commit comment from given file +** --mimetype MIMETYPE mimetype of check-in comment +** -n|--dry-run If given, display instead of run actions ** --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 ** --tag TAG-NAME assign given tag TAG-NAME to the checkin ** @@ -1065,11 +1408,11 @@ int vid; /* blob-id of parent version */ int nrid; /* blob-id of a modified file */ int nvid; /* Blob-id of the new check-in */ Blob comment; /* Check-in comment */ const char *zComment; /* Check-in comment */ - Stmt q; /* Query to find files that have been modified */ + Stmt q; /* Various queries */ char *zUuid; /* UUID of the new check-in */ int noSign = 0; /* True to omit signing the manifest using GPG */ int isAMerge = 0; /* True if checking in a merge */ int noWarningFlag = 0; /* True if skipping all warnings */ int forceFlag = 0; /* Undocumented: Disables all checks */ @@ -1080,20 +1423,15 @@ int allowFork = 0; /* Allow the commit to fork */ int allowOlder = 0; /* Allow a commit older than its ancestor */ char *zManifestFile; /* Name of the manifest file */ int useCksum; /* True if checksums should be computed and verified */ int outputManifest; /* True to output "manifest" and "manifest.uuid" */ - int testRun; /* True for a test run. Debugging only */ - const char *zBranch; /* Create a new branch with this name */ - const char *zBrClr; /* Set background color when branching */ - const char *zColor; /* One-time check-in color */ - const char *zDateOvrd; /* Override date string */ - const char *zUserOvrd; /* Override user name */ + int dryRunFlag; /* True for a test run. Debugging only */ + CheckinInfo sCiInfo; /* Information about this check-in */ const char *zComFile; /* Read commit message from this file */ int nTag = 0; /* Number of --tag arguments */ const char *zTag; /* A single --tag argument */ - const char **azTag = 0;/* Array of all --tag arguments */ 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 */ @@ -1101,42 +1439,50 @@ int nConflict = 0; /* Number of unresolved merge conflicts */ int abortCommit = 0; Blob ans; char cReply; + memset(&sCiInfo, 0, sizeof(sCiInfo)); url_proxy_options(); 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"); } - testRun = find_option("test",0,0)!=0; + 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; allowOlder = find_option("allow-older",0,0)!=0; noWarningFlag = find_option("no-warnings", 0, 0)!=0; - zBranch = find_option("branch","b",1); - zColor = find_option("bgcolor",0,1); - zBrClr = find_option("branchcolor",0,1); + 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; + sCiInfo.zMimetype = find_option("mimetype",0,1); while( (zTag = find_option("tag",0,1))!=0 ){ if( zTag[0]==0 ) continue; - azTag = fossil_realloc((void *)azTag, sizeof(char*)*(nTag+2)); - azTag[nTag++] = zTag; - azTag[nTag] = 0; + sCiInfo.azTag = fossil_realloc((void*)sCiInfo.azTag, sizeof(char*)*(nTag+2)); + sCiInfo.azTag[nTag++] = zTag; + sCiInfo.azTag[nTag] = 0; } zComFile = find_option("message-file", "M", 1); if( find_option("private",0,0) ){ g.markPrivate = 1; - if( zBranch==0 ) zBranch = "private"; - if( zBrClr==0 && zColor==0 ) zBrClr = "#fec084"; /* Orange */ + if( sCiInfo.zBranch==0 ) sCiInfo.zBranch = "private"; + if( sCiInfo.zBrClr==0 && sCiInfo.zColor==0 ){ + sCiInfo.zBrClr = "#fec084"; /* Orange */ + } } - zDateOvrd = find_option("date-override",0,1); - zUserOvrd = find_option("user-override",0,1); + sCiInfo.zDateOvrd = find_option("date-override",0,1); + 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_boolean("manifest", 0); @@ -1143,12 +1489,12 @@ verify_all_options(); /* Escape special characters in tags and put all tags in sorted order */ if( nTag ){ int i; - for(i=0; izBaseline ){ zBaselineUuid = pParent->zBaseline; pBaseline = manifest_get_by_name(zBaselineUuid, 0); }else{ zBaselineUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); pBaseline = pParent; } if( pBaseline ){ Blob delta; - create_manifest(&delta, zBaselineUuid, pBaseline, &comment, vid, - !allowOlder && !forceFlag, useCksum ? &cksum1 : 0, - zDateOvrd, zUserOvrd, zBranch, zColor, zBrClr, - azTag, &szD); + create_manifest(&delta, zBaselineUuid, pBaseline, vid, &sCiInfo, &szD); /* ** At this point, two manifests have been constructed, either of ** which would work for this checkin. The first manifest (held ** in the "manifest" variable) is a baseline manifest and the second ** (held in variable named "delta") is a delta manifest. The @@ -1432,11 +1785,11 @@ manifest = delta; }else{ blob_reset(&delta); } }else if( forceDelta ){ - fossil_panic("unable to find a baseline-manifest for the delta"); + fossil_fatal("unable to find a baseline-manifest for the delta"); } } if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ blob_zero(&ans); prompt_user("unable to sign manifest. continue (y/N)? ", &ans); @@ -1444,33 +1797,46 @@ if( cReply!='y' && cReply!='Y' ){ fossil_exit(1); } } - /* If the --test option is specified, output the manifest file + /* If the -n|--dry-run option is specified, output the manifest file ** and rollback the transaction. */ - if( testRun ){ + if( dryRunFlag ){ blob_write_to_file(&manifest, ""); } - if( outputManifest ){ zManifestFile = mprintf("%smanifest", g.zLocalRoot); blob_write_to_file(&manifest, zManifestFile); blob_reset(&manifest); blob_read_from_file(&manifest, zManifestFile); free(zManifestFile); } + nvid = content_put(&manifest); if( nvid==0 ){ - fossil_panic("trouble committing manifest: %s", g.zErrMsg); + fossil_fatal("trouble committing manifest: %s", g.zErrMsg); } db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid); manifest_crosslink(nvid, &manifest); assert( blob_is_reset(&manifest) ); content_deltify(vid, nvid, 0); zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid); + + db_prepare(&q, "SELECT uuid,merge FROM vmerge JOIN blob ON merge=rid" + " 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); + } + } + db_finalize(&q); + fossil_print("New_Version: %s\n", zUuid); if( outputManifest ){ zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); blob_zero(&muuid); blob_appendf(&muuid, "%s\n", zUuid); @@ -1526,11 +1892,13 @@ /* Clear the undo/redo stack */ undo_reset(); /* Commit */ db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'"); - if( testRun ){ + db_multi_exec("PRAGMA %s.application_id=252006673;", db_name("repository")); + db_multi_exec("PRAGMA %s.application_id=252006674;", db_name("localdb")); + if( dryRunFlag ){ db_end_transaction(1); exit(1); } db_end_transaction(0); Index: src/checkout.c ================================================================== --- src/checkout.c +++ src/checkout.c @@ -61,11 +61,11 @@ Blob uuid; int vid; blob_init(&uuid, zName, -1); if( name_to_uuid(&uuid, 1, "ci") ){ - fossil_panic(g.zErrMsg); + fossil_fatal(g.zErrMsg); } vid = db_int(0, "SELECT rid FROM blob WHERE uuid=%B", &uuid); if( vid==0 ){ fossil_fatal("no such check-in: %s", g.argv[2]); } @@ -103,11 +103,11 @@ Manifest *pManifest; ManifestFile *pFile; /* Check the EXE permission status of all files */ - pManifest = manifest_get(vid, CFTYPE_MANIFEST); + pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0); if( pManifest==0 ) return; blob_zero(&filename); blob_appendf(&filename, "%s", g.zLocalRoot); baseLen = blob_size(&filename); manifest_file_rewind(pManifest); @@ -220,11 +220,11 @@ 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 ){ - fossil_fatal("cannot locate \"latest\" checkout"); + return; } }else{ zVers = g.argv[2]; } vid = load_vfile(zVers); @@ -278,11 +278,11 @@ ** ** Usage: %fossil close ?OPTIONS? ** ** The opposite of "open". Close the current database connection. ** Require a -f or --force flag if there are unsaved changed in the -** current check-out. +** current check-out or if there is non-empty stash. ** ** Options: ** --force|-f necessary to close a check out with uncommitted changes ** ** See also: open @@ -291,12 +291,19 @@ int forceFlag = find_option("force","f",0)!=0; db_must_be_within_tree(); if( !forceFlag && unsaved_changes()==1 ){ fossil_fatal("there are unsaved changes in the current checkout"); } + if( !forceFlag + && db_exists("SELECT 1 FROM %s.sqlite_master WHERE name='stash'", + db_name("localdb")) + && db_exists("SELECT 1 FROM %s.stash", db_name("localdb")) + ){ + fossil_fatal("closing the checkout will delete your stash"); + } if( db_is_writeable("repository") ){ db_multi_exec("DELETE FROM config WHERE name='ckout:%q'", g.zLocalRoot); } unlink_local_database(1); db_close(1); unlink_local_database(0); } Index: src/clone.c ================================================================== --- src/clone.c +++ src/clone.c @@ -84,54 +84,66 @@ ** ** Usage: %fossil clone ?OPTIONS? URL FILENAME ** ** Make a clone of a repository specified by URL in the local ** file named FILENAME. +** +** URL must be in one of the following form: ([...] mean optional) +** HTTP/HTTPS protocol: +** http[s]://[userid[:password]@]host[:port][/path] +** +** SSH protocol: +** ssh://[userid[:password]@]host[:port]/path/to/repo.fossil\\ +** [?fossil=path/to/fossil.exe] +** +** Filesystem: +** [file://]path/to/repo.fossil +** +** Note: For ssh and filesystem, path must have an extra leading +** '/' to use an absolute path. ** ** 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 +** --once Don't save url. ** --private Also clone private branches ** --ssl-identity=filename Use the SSL identity if requested by the server +** --ssh-command|-c 'command' Use this SSH command ** ** See also: init */ void clone_cmd(void){ char *zPassword; const char *zDefaultUser; /* Optional name of the default user */ - const char *zPw; /* The user clone password */ int nErr = 0; int bPrivate = 0; /* Also clone private branches */ + int urlFlags = URL_PROMPT_PW | URL_REMEMBER; if( find_option("private",0,0)!=0 ) bPrivate = SYNC_PRIVATE; + if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER; + zDefaultUser = find_option("admin-user","A",1); + clone_ssh_find_options(); url_proxy_options(); if( g.argc < 4 ){ usage("?OPTIONS? FILE-OR-URL NEW-REPOSITORY"); } db_open_config(0); if( file_size(g.argv[3])>0 ){ - fossil_panic("file already exists: %s", g.argv[3]); + fossil_fatal("file already exists: %s", g.argv[3]); } - zDefaultUser = find_option("admin-user","A",1); - - url_parse(g.argv[2]); + url_parse(g.argv[2], urlFlags); + if( zDefaultUser==0 && g.urlUser!=0 ) zDefaultUser = g.urlUser; if( g.urlIsFile ){ file_copy(g.urlName, g.argv[3]); db_close(1); db_open_repository(g.argv[3]); db_record_repository_filename(g.argv[3]); - db_multi_exec( - "REPLACE INTO config(name,value,mtime)" - " VALUES('server-code', lower(hex(randomblob(20))),now());" - "REPLACE INTO config(name,value,mtime)" - " VALUES('last-sync-url', '%q',now());", - g.urlCanonical - ); + url_remember(); if( !bPrivate ) delete_private_content(); shun_artifacts(); db_create_default_users(1, zDefaultUser); if( zDefaultUser ){ g.zLogin = zDefaultUser; @@ -146,11 +158,12 @@ db_record_repository_filename(g.argv[3]); db_initial_setup(0, 0, zDefaultUser, 0); user_select(); db_set("content-schema", CONTENT_SCHEMA, 0); db_set("aux-schema", AUX_SCHEMA, 0); - db_set("last-sync-url", g.argv[2], 0); + db_set("rebuilt", get_version(), 0); + url_remember(); if( g.zSSLIdentity!=0 ){ /* If the --ssl-identity option was specified, store it as a setting */ Blob fn; blob_zero(&fn); file_canonical_name(g.zSSLIdentity, &fn, 0); @@ -160,10 +173,11 @@ db_multi_exec( "REPLACE INTO config(name,value,mtime)" " VALUES('server-code', lower(hex(randomblob(20))), now());" ); url_enable_proxy(0); + clone_ssh_db_set_options(); url_get_password_if_needed(); g.xlinkClusterOnly = 1; nErr = client_sync(SYNC_CLONE | bPrivate,CONFIGSET_ALL,0); g.xlinkClusterOnly = 0; verify_cancel(); @@ -177,12 +191,31 @@ } db_begin_transaction(); fossil_print("Rebuilding repository meta-data...\n"); rebuild_db(0, 1, 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 (password is \"%s\")\n", g.zLogin, zPassword); - zPw = g.urlPasswd; - if( !g.dontKeepUrl && zPw) db_set("last-sync-pw", obscure(zPw), 0); db_end_transaction(0); } + +/* +** Look for SSH clone command line options and setup in globals. +*/ +void clone_ssh_find_options(void){ + const char *zSshCmd; /* SSH command string */ + + zSshCmd = find_option("ssh-command","c",1); + if( zSshCmd && zSshCmd[0] ){ + g.zSshCmd = mprintf("%s", zSshCmd); + } +} + +/* +** Set SSH options discovered in global variables (set from command line +** options). +*/ +void clone_ssh_db_set_options(void){ + if( g.zSshCmd && g.zSshCmd[0] ){ + db_set("ssh-command", g.zSshCmd, 0); + } +} Index: src/comformat.c ================================================================== --- src/comformat.c +++ src/comformat.c @@ -26,28 +26,36 @@ ** Given a comment string zText, format that string for printing ** on a TTY. Assume that the output cursors is indent spaces from ** the left margin and that a single line can contain no more than ** lineLength characters. Indent all subsequent lines by indent. ** -** lineLength must be less than 400. -** ** Return the number of newlines that are output. */ int comment_print(const char *zText, int indent, int lineLength){ int tlen = lineLength - indent; int si, sk, i, k; int doIndent = 0; - char zBuf[400]; + char *zBuf; + char zBuffer[400]; int lineCnt = 0; + if( tlen<=0 ){ + tlen = strlen(zText); + } + if( tlen >= (sizeof(zBuffer)) ){ + zBuf = fossil_malloc(tlen+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=0; zText[i] && k0 && zText[i] ){ zText += si; - zBuf[sk++] = '\n'; zBuf[sk] = 0; - fossil_print("%s", zBuf); }else{ zText += i; - zBuf[k++] = '\n'; zBuf[k] = 0; - fossil_print("%s", zBuf); } + fossil_print("%s\n", zBuf); lineCnt++; } } /* Index: src/config.h ================================================================== --- src/config.h +++ src/config.h @@ -24,10 +24,15 @@ #define _LARGE_FILE 1 #ifndef _FILE_OFFSET_BITS # define _FILE_OFFSET_BITS 64 #endif #define _LARGEFILE_SOURCE 1 + +/* Make sure that in Win32 MinGW builds, _USE_32BIT_TIME_T is always defined. */ +#if defined(_WIN32) && !defined(_WIN64) && !defined(_MSC_VER) && !defined(_USE_32BIT_TIME_T) +# define _USE_32BIT_TIME_T +#endif #ifdef HAVE_AUTOCONFIG_H #include "autoconfig.h" #endif @@ -82,11 +87,11 @@ # else # define COMPILER_NAME "unknown" # endif #endif -#ifndef _RC_COMPILE_ +#if !defined(_RC_COMPILE_) && !defined(SQLITE_AMALGAMATION) #include "sqlite3.h" /* ** On Solaris, getpass() will only return up to 8 characters. getpassphrase() returns up to 257. Index: src/configure.c ================================================================== --- src/configure.c +++ src/configure.c @@ -41,10 +41,17 @@ #define CONFIGSET_ALL 0x0000ff /* Everything */ #define CONFIGSET_OVERWRITE 0x100000 /* Causes overwrite instead of merge */ #define CONFIGSET_OLDFORMAT 0x200000 /* Use the legacy format */ +/* +** This mask is used for the common TH1 configuration settings (i.e. those +** that are not specific to one particular subsystem, such as the transfer +** subsystem). +*/ +#define CONFIGSET_TH1 (CONFIGSET_SKIN|CONFIGSET_TKT|CONFIGSET_XFER) + #endif /* INTERFACE */ /* ** Names of the configuration sets */ @@ -90,22 +97,25 @@ { "timeline-max-comment", CONFIGSET_SKIN }, { "timeline-plaintext", CONFIGSET_SKIN }, { "adunit", CONFIGSET_SKIN }, { "adunit-omit-if-admin", CONFIGSET_SKIN }, { "adunit-omit-if-user", CONFIGSET_SKIN }, - { "th1-setup", CONFIGSET_ALL }, + { "th1-setup", CONFIGSET_TH1 }, #ifdef FOSSIL_ENABLE_TCL - { "tcl", CONFIGSET_SKIN|CONFIGSET_TKT|CONFIGSET_XFER }, - { "tcl-setup", CONFIGSET_SKIN|CONFIGSET_TKT|CONFIGSET_XFER }, + { "tcl", CONFIGSET_TH1 }, + { "tcl-setup", CONFIGSET_TH1 }, #endif { "project-name", CONFIGSET_PROJ }, + { "short-project-name", CONFIGSET_PROJ }, { "project-description", CONFIGSET_PROJ }, { "manifest", CONFIGSET_PROJ }, { "binary-glob", CONFIGSET_PROJ }, + { "clean-glob", CONFIGSET_PROJ }, { "ignore-glob", CONFIGSET_PROJ }, + { "keep-glob", CONFIGSET_PROJ }, { "crnl-glob", CONFIGSET_PROJ }, { "encoding-glob", CONFIGSET_PROJ }, { "empty-dirs", CONFIGSET_PROJ }, { "allow-symlinks", CONFIGSET_PROJ }, @@ -390,10 +400,25 @@ @ DROP TABLE _xfer_user; @ DROP TABLE _xfer_reportfmt; ; db_multi_exec(zSQL); } + +/* +** Mask of modified configuration sets +*/ +static int rebuildMask = 0; + +/* +** Rebuild auxiliary tables as required by configuration changes. +*/ +void configure_rebuild(void){ + if( rebuildMask & CONFIGSET_TKT ){ + ticket_rebuild(); + } + rebuildMask = 0; +} /* ** Return true if z[] is not a "safe" SQL token. A safe token is one of: ** ** * A string literal @@ -556,10 +581,11 @@ blob_appendf(&sql, " WHERE %s=%s AND mtime<%s", aType[ii].zPrimKey, azToken[1], azToken[0]); db_multi_exec("%s", blob_str(&sql)); } blob_reset(&sql); + rebuildMask |= thisMask; }else{ /* Otherwise, the old format */ if( (configure_is_exportable(zName) & groupMask)==0 ) return; if( fossil_strcmp(zName, "logo-image")==0 ){ Stmt ins; @@ -878,36 +904,28 @@ if( strncmp(zMethod, "pull", n)==0 || strncmp(zMethod, "push", n)==0 || strncmp(zMethod, "sync", n)==0 ){ int mask; - const char *zServer; - const char *zPw; + const char *zServer = 0; int legacyFlag = 0; int overwriteFlag = 0; + if( zMethod[0]!='s' ) legacyFlag = find_option("legacy",0,0)!=0; if( strncmp(zMethod,"pull",n)==0 ){ overwriteFlag = find_option("overwrite",0,0)!=0; } url_proxy_options(); if( g.argc!=4 && g.argc!=5 ){ - usage("pull AREA ?URL?"); + usage(mprintf("%s AREA ?URL?", zMethod)); } mask = configure_name_to_mask(g.argv[3], 1); if( g.argc==5 ){ zServer = g.argv[4]; - zPw = 0; - g.dontKeepUrl = 1; - }else{ - zServer = db_get("last-sync-url", 0); - if( zServer==0 ){ - fossil_fatal("no server specified"); - } - zPw = unobscure(db_get("last-sync-pw", 0)); - } - url_parse(zServer); - if( g.urlPasswd==0 && zPw ) g.urlPasswd = mprintf("%s", zPw); + } + url_parse(zServer, URL_PROMPT_PW); + if( g.urlProtocol==0 ) fossil_fatal("no server URL specified"); user_select(); url_enable_proxy("via proxy: "); if( legacyFlag ) mask |= CONFIGSET_OLDFORMAT; if( overwriteFlag ) mask |= CONFIGSET_OVERWRITE; if( strncmp(zMethod, "push", n)==0 ){ @@ -939,17 +957,20 @@ db_multi_exec("DELETE FROM concealed"); }else if( fossil_strcmp(zName,"@shun")==0 ){ db_multi_exec("DELETE FROM shun"); }else if( fossil_strcmp(zName,"@reportfmt")==0 ){ db_multi_exec("DELETE FROM reportfmt"); + db_multi_exec(zRepositorySchemaDefaultReports); } } db_end_transaction(0); fossil_print("Configuration reset to factory defaults.\n"); fossil_print("To recover, use: %s %s import %s\n", g.argv[0], g.argv[1], zBackup); + rebuildMask |= mask; }else { fossil_fatal("METHOD should be one of:" " export import merge pull push reset"); } + configure_rebuild(); } Index: src/content.c ================================================================== --- src/content.c +++ src/content.c @@ -27,11 +27,10 @@ static struct { i64 szTotal; /* Total size of all entries in the cache */ int n; /* Current number of cache entries */ int nAlloc; /* Number of slots allocated in a[] */ int nextAge; /* Age counter for implementing LRU */ - int skipCnt; /* Used to limit entries expelled from cache */ struct cacheLine { /* One instance of this for each cache entry */ int rid; /* Artifact id */ int age; /* Age. Newer is larger */ Blob content; /* Content of the artifact */ } *a; /* The positive cache */ @@ -492,11 +491,10 @@ assert( g.repositoryOpen ); assert( pBlob!=0 ); assert( srcId==0 || zUuid!=0 ); if( zUuid==0 ){ - assert( pBlob!=0 ); assert( nBlob==0 ); sha1sum_blob(pBlob, &hash); }else{ blob_init(&hash, zUuid, -1); } @@ -827,25 +825,47 @@ db_must_be_within_tree(); content_deltify(atoi(g.argv[2]), atoi(g.argv[3]), atoi(g.argv[4])); } /* -** COMMAND: test-integrity +** Return true if Blob p looks like it might be a parsable control artifact. +*/ +static int looks_like_control_artifact(Blob *p){ + const char *z = blob_buffer(p); + int n = blob_size(p); + if( n<10 ) return 0; + if( strncmp(z, "-----BEGIN PGP SIGNED MESSAGE-----", 34)==0 ) return 1; + if( z[0]<'A' || z[0]>'Z' || z[1]!=' ' || z[0]=='I' ) return 0; + if( z[n-1]!='\n' ) return 0; + return 1; +} + +/* +** COMMAND: test-integrity ?OPTIONS? ** ** Verify that all content can be extracted from the BLOB table correctly. ** If the BLOB table is correct, then the repository can always be ** successfully reconstructed using "fossil rebuild". +** +** Options: +** +** --parse Parse all manifests, wikis, tickets, events, and +** so forth, reporting any errors found. */ void test_integrity(void){ Stmt q; Blob content; Blob cksum; int n1 = 0; int n2 = 0; int nErr = 0; int total; + int nCA = 0; + int anCA[10]; + int bParse = find_option("parse",0,0)!=0; db_find_and_open_repository(OPEN_ANY_SCHEMA, 2); + memset(anCA, 0, sizeof(anCA)); /* Make sure no public artifact is a delta from a private artifact */ db_prepare(&q, "SELECT " " rid, (SELECT uuid FROM blob WHERE rid=delta.rid)," @@ -889,17 +909,54 @@ if( fossil_strcmp(blob_str(&cksum), zUuid)!=0 ){ fossil_print("checksum mismatch on artifact %d: wanted %s but got %s\n", rid, zUuid, blob_str(&cksum)); nErr++; } + if( bParse && looks_like_control_artifact(&content) ){ + Blob err; + int i, n; + char *z; + Manifest *p; + char zFirstLine[400]; + blob_zero(&err); + + z = blob_buffer(&content); + n = blob_size(&content); + for(i=0; itype]++; + manifest_destroy(p); + nCA++; + } + blob_reset(&err); + }else{ + blob_reset(&content); + } blob_reset(&cksum); - blob_reset(&content); n2++; } db_finalize(&q); fossil_print("%d non-phantom blobs (out of %d total) checked: %d errors\n", n2, n1, nErr); + if( bParse ){ + const char *azType[] = { 0, "manifest", "cluster", "control", "wiki", + "ticket", "attachment", "event" }; + int i; + fossil_print("%d total control artifacts\n", nCA); + for(i=1; i= 199901L || HAVE_LONG_LONG == 1 +#ifdef _WIN32 +typedef __int64 JSON_int_t; +#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%I64d" +#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%I64d" +#elif __STDC_VERSION__ >= 199901L || HAVE_LONG_LONG == 1 typedef long long JSON_int_t; #define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld" #define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld" #else typedef long JSON_int_t; @@ -99,11 +103,11 @@ JSON_T_NULL, JSON_T_TRUE, and JSON_T_FALSE. String values are always returned as zero-terminated C strings. \return Non-zero if parsing should continue, else zero. */ -typedef int (*JSON_parser_callback)(void* ctx, int type, const struct JSON_value_struct* value); +typedef int (*JSON_parser_callback)(void* ctx, int type, const JSON_value* value); /** A typedef for allocator functions semantically compatible with malloc(). */ @@ -229,11 +233,11 @@ #endif /* JSON_PARSER_H */ /* end file parser/JSON_parser.h */ /* begin file parser/JSON_parser.c */ /* -Copyright (c) 2005 JSON.org +Copyright (c) 2007-2013 Jean Gressmann (jean@0x42.de) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -241,12 +245,10 @@ furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The Software shall be used for Good, not Evil. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, @@ -253,49 +255,52 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* - Callbacks, comments, Unicode handling by Jean Gressmann (jean@0x42.de), 2007-2010. - - Changelog: + 2013-09-08 + Updated license to to be compatible with Debian license requirements. + + 2012-06-06 + Fix for invalid UTF16 characters and some comment fixex (thomas.h.moog@intel.com). + 2010-11-25 Support for custom memory allocation (sgbeal@googlemail.com). - + 2010-05-07 - Added error handling for memory allocation failure (sgbeal@googlemail.com). + Added error handling for memory allocation failure (sgbeal@googlemail.com). Added diagnosis errors for invalid JSON. - + 2010-03-25 Fixed buffer overrun in grow_parse_buffer & cleaned up code. - + 2009-10-19 - Replaced long double in JSON_value_struct with double after reports + Replaced long double in JSON_value_struct with double after reports of strtold being broken on some platforms (charles@transmissionbt.com). - - 2009-05-17 + + 2009-05-17 Incorporated benrudiak@googlemail.com fix for UTF16 decoding. - - 2009-05-14 + + 2009-05-14 Fixed float parsing bug related to a locale being set that didn't use '.' as decimal point character (charles@transmissionbt.com). - - 2008-10-14 + + 2008-10-14 Renamed states.IN to states.IT to avoid name clash which IN macro defined in windef.h (alexey.pelykh@gmail.com) - - 2008-07-19 + + 2008-07-19 Removed some duplicate code & debugging variable (charles@transmissionbt.com) - - 2008-05-28 - Made JSON_value structure ansi C compliant. This bug was report by + + 2008-05-28 + Made JSON_value structure ansi C compliant. This bug was report by trisk@acm.jhu.edu - - 2008-05-20 - Fixed bug reported by charles@transmissionbt.com where the switching - from static to dynamic parse buffer did not copy the static parse + + 2008-05-20 + Fixed bug reported by charles@transmissionbt.com where the switching + from static to dynamic parse buffer did not copy the static parse buffer's content. */ @@ -358,11 +363,11 @@ char static_parse_buffer[JSON_PARSER_PARSE_BUFFER_SIZE]; JSON_malloc_t malloc; JSON_free_t free; }; -#define COUNTOF(x) (sizeof(x)/sizeof(x[0])) +#define COUNTOF(x) (sizeof(x)/sizeof(x[0])) /* Characters are mapped into these character classes. This allows for a significant reduction in the size of the state transition table. */ @@ -399,11 +404,11 @@ C_LOW_T, /* t */ C_LOW_U, /* u */ C_ABCDF, /* ABCDF */ C_E, /* E */ C_ETC, /* everything else */ - C_STAR, /* * */ + C_STAR, /* * */ NR_CLASSES }; static const signed char ascii_class[128] = { /* @@ -415,11 +420,11 @@ __, C_WHITE, C_WHITE, __, __, C_WHITE, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, C_SPACE, C_ETC, C_QUOTE, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, - C_ETC, C_ETC, C_STAR, C_PLUS, C_COMMA, C_MINUS, C_POINT, C_SLASH, + C_ETC, C_ETC, C_STAR, C_PLUS, C_COMMA, C_MINUS, C_POINT, C_SLASH, C_ZERO, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_DIGIT, C_COLON, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ABCDF, C_ABCDF, C_ABCDF, C_ABCDF, C_E, C_ABCDF, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, C_ETC, @@ -532,11 +537,11 @@ /*false F4*/ {__,__,__,__,__,__,__,__,__,__,CB,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__,__,__}, /*nu N1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N2,__,__,__,__}, /*nul N2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,N3,__,__,__,__,__,__,__,__,__}, /*null N3*/ {__,__,__,__,__,__,__,__,__,__,CB,__,__,__,__,__,__,__,__,__,__,__,OK,__,__,__,__,__,__,__,__,__}, /*/ C1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,C2}, -/*/* C2*/ {C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C3}, +/*/star C2*/ {C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C3}, /** C3*/ {C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,CE,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C2,C3}, /*_. FX*/ {OK,OK,__,-8,__,-7,__,-3,__,__,__,__,__,__,FR,FR,__,__,__,__,E1,__,__,__,__,__,__,__,__,E1,__,__}, /*\ D1*/ {__,__,__,__,__,__,__,__,__,D2,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__}, /*\ D2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,U1,__,__,__,__}, }; @@ -544,27 +549,27 @@ /* These modes can be pushed on the stack. */ enum modes { - MODE_ARRAY = 1, - MODE_DONE = 2, - MODE_KEY = 3, + MODE_ARRAY = 1, + MODE_DONE = 2, + MODE_KEY = 3, MODE_OBJECT = 4 }; static void set_error(JSON_parser jc) { switch (jc->state) { case GO: switch (jc->current_char) { - case '{': case '}': case '[': case ']': + case '{': case '}': case '[': case ']': jc->error = JSON_E_UNBALANCED_COLLECTION; break; default: jc->error = JSON_E_INVALID_CHAR; - break; + break; } break; case OB: jc->error = JSON_E_EXPECTED_KEY; break; @@ -600,11 +605,11 @@ { /* Push a mode onto the stack. Return false if there is overflow. */ assert(jc->top <= jc->stack_capacity); - + if (jc->depth < 0) { if (jc->top == jc->stack_capacity) { const size_t bytes_to_copy = jc->stack_capacity * sizeof(jc->stack[0]); const size_t new_capacity = jc->stack_capacity * 2; const size_t bytes_to_allocate = new_capacity * sizeof(jc->stack[0]); @@ -649,17 +654,17 @@ #define parse_buffer_clear(jc) \ do {\ jc->parse_buffer_count = 0;\ jc->parse_buffer[0] = 0;\ } while (0) - + #define parse_buffer_pop_back_char(jc)\ do {\ assert(jc->parse_buffer_count >= 1);\ --jc->parse_buffer_count;\ jc->parse_buffer[jc->parse_buffer_count] = 0;\ - } while (0) + } while (0) void delete_JSON_parser(JSON_parser jc) { @@ -669,25 +674,25 @@ } if (jc->parse_buffer != &jc->static_parse_buffer[0]) { jc->free((void*)jc->parse_buffer); } jc->free((void*)jc); - } + } } int JSON_parser_reset(JSON_parser jc) { if (NULL == jc) { return false; } - + jc->state = GO; jc->top = -1; /* parser has been used previously? */ if (NULL == jc->parse_buffer) { - + /* Do we want non-bound stack? */ if (jc->depth > 0) { jc->stack_capacity = jc->depth; if (jc->depth <= (int)COUNTOF(jc->static_stack)) { jc->stack = &jc->static_stack[0]; @@ -701,20 +706,20 @@ } else { jc->stack_capacity = (int)COUNTOF(jc->static_stack); jc->depth = -1; jc->stack = &jc->static_stack[0]; } - + /* set up the parse buffer */ jc->parse_buffer = &jc->static_parse_buffer[0]; jc->parse_buffer_capacity = COUNTOF(jc->static_parse_buffer); } - + /* set parser to start */ push(jc, MODE_DONE); parse_buffer_clear(jc); - + return true; } JSON_parser new_JSON_parser(JSON_config const * config) @@ -731,29 +736,29 @@ int use_std_malloc = false; JSON_config default_config; JSON_parser jc; JSON_malloc_t alloc; - + /* set to default configuration if none was provided */ if (NULL == config) { /* initialize configuration */ init_JSON_config(&default_config); config = &default_config; } - + /* use std malloc if either the allocator or deallocator function isn't set */ use_std_malloc = NULL == config->malloc || NULL == config->free; - + alloc = use_std_malloc ? malloc : config->malloc; - - jc = JSON_parser_malloc(alloc, sizeof(*jc), "parser"); - + + jc = (JSON_parser)JSON_parser_malloc(alloc, sizeof(*jc), "parser"); + if (NULL == jc) { return NULL; } - + /* configure the parser */ memset(jc, 0, sizeof(*jc)); jc->malloc = alloc; jc->free = use_std_malloc ? free : config->free; jc->callback = config->callback; @@ -761,42 +766,42 @@ jc->allow_comments = (signed char)(config->allow_comments != 0); jc->handle_floats_manually = (signed char)(config->handle_floats_manually != 0); jc->decimal_point = *localeconv()->decimal_point; /* We need to be able to push at least one object */ jc->depth = config->depth == 0 ? 1 : config->depth; - + /* reset the parser */ if (!JSON_parser_reset(jc)) { jc->free(jc); return NULL; } - + return jc; } static int parse_buffer_grow(JSON_parser jc) { const size_t bytes_to_copy = jc->parse_buffer_count * sizeof(jc->parse_buffer[0]); const size_t new_capacity = jc->parse_buffer_capacity * 2; const size_t bytes_to_allocate = new_capacity * sizeof(jc->parse_buffer[0]); void* mem = JSON_parser_malloc(jc->malloc, bytes_to_allocate, "parse buffer"); - + if (mem == NULL) { jc->error = JSON_E_OUT_OF_MEMORY; return false; } - + assert(new_capacity > 0); memcpy(mem, jc->parse_buffer, bytes_to_copy); - + if (jc->parse_buffer != &jc->static_parse_buffer[0]) { jc->free(jc->parse_buffer); } - + jc->parse_buffer = (char*)mem; jc->parse_buffer_capacity = new_capacity; - + return true; } static int parse_buffer_reserve_for(JSON_parser jc, unsigned chars) { @@ -804,11 +809,11 @@ if (!parse_buffer_grow(jc)) { assert(jc->error == JSON_E_OUT_OF_MEMORY); return false; } } - + return true; } #define parse_buffer_has_space_for(jc, count) \ (jc->parse_buffer_count + (count) + 1 <= jc->parse_buffer_capacity) @@ -826,27 +831,27 @@ jc->type == JSON_T_FALSE || \ jc->type == JSON_T_TRUE || \ jc->type == JSON_T_FLOAT || \ jc->type == JSON_T_INTEGER || \ jc->type == JSON_T_STRING) - + static int parse_parse_buffer(JSON_parser jc) { if (jc->callback) { JSON_value value, *arg = NULL; - + if (jc->type != JSON_T_NONE) { assert_is_non_container_type(jc); - + switch(jc->type) { case JSON_T_FLOAT: arg = &value; if (jc->handle_floats_manually) { value.vu.str.value = jc->parse_buffer; value.vu.str.length = jc->parse_buffer_count; - } else { + } else { /* not checking with end pointer b/c there may be trailing ws */ value.vu.float_value = strtod(jc->parse_buffer, NULL); } break; case JSON_T_INTEGER: @@ -857,19 +862,19 @@ arg = &value; value.vu.str.value = jc->parse_buffer; value.vu.str.length = jc->parse_buffer_count; break; } - + if (!(*jc->callback)(jc->ctx, jc->type, arg)) { return false; } } } - + parse_buffer_clear(jc); - + return true; } #define IS_HIGH_SURROGATE(uc) (((uc) & 0xFC00) == 0xD800) #define IS_LOW_SURROGATE(uc) (((uc) & 0xFC00) == 0xDC00) @@ -880,35 +885,39 @@ { int i; unsigned uc = 0; char* p; int trail_bytes; - + assert(jc->parse_buffer_count >= 6); - + p = &jc->parse_buffer[jc->parse_buffer_count - 4]; - + for (i = 12; i >= 0; i -= 4, ++p) { unsigned x = *p; - + if (x >= 'a') { x -= ('a' - 10); } else if (x >= 'A') { x -= ('A' - 10); } else { x &= ~0x30u; } - + assert(x < 16); - + uc |= x << i; } - + /* clear UTF-16 char from buffer */ jc->parse_buffer_count -= 6; jc->parse_buffer[jc->parse_buffer_count] = 0; - + + if (uc == 0xffff || uc == 0xfffe) { + return false; + } + /* attempt decoding ... */ if (jc->utf16_high_surrogate) { if (IS_LOW_SURROGATE(uc)) { uc = DECODE_SURROGATE_PAIR(jc->utf16_high_surrogate, uc); trail_bytes = 3; @@ -931,26 +940,26 @@ return false; } else { trail_bytes = 2; } } - + jc->parse_buffer[jc->parse_buffer_count++] = (char) ((uc >> (trail_bytes * 6)) | utf8_lead_bits[trail_bytes]); - + for (i = trail_bytes * 6 - 6; i >= 0; i -= 6) { jc->parse_buffer[jc->parse_buffer_count++] = (char) (((uc >> i) & 0x3F) | 0x80); } jc->parse_buffer[jc->parse_buffer_count] = 0; - + return true; } static int add_escaped_char_to_parse_buffer(JSON_parser jc, int next_char) { assert(parse_buffer_has_space_for(jc, 1)); - + jc->escaped = 0; /* remove the backslash */ parse_buffer_pop_back_char(jc); switch(next_char) { case 'b': @@ -992,22 +1001,22 @@ { if (!parse_buffer_reserve_for(jc, 1)) { assert(JSON_E_OUT_OF_MEMORY == jc->error); return false; } - + if (jc->escaped) { if (!add_escaped_char_to_parse_buffer(jc, next_char)) { jc->error = JSON_E_INVALID_ESCAPE_SEQUENCE; - return false; + return false; } } else if (!jc->comment) { if ((jc->type != JSON_T_NONE) | !((next_class == C_SPACE) | (next_class == C_WHITE)) /* non-white-space */) { parse_buffer_push_back_char(jc, (char)next_char); } } - + return true; } #define assert_type_isnt_string_null_or_bool(jc) \ assert(jc->type != JSON_T_FALSE); \ @@ -1027,13 +1036,13 @@ */ int next_class, next_state; /* Store the current char for error handling -*/ +*/ jc->current_char = next_char; - + /* Determine the character's class. */ if (next_char < 0) { jc->error = JSON_E_INVALID_CHAR; @@ -1046,15 +1055,15 @@ if (next_class <= __) { set_error(jc); return false; } } - + if (!add_char_to_parse_buffer(jc, next_char, next_class)) { return false; } - + /* Get the next state from the state transition table. */ next_state = state_transition_table[jc->state][next_class]; if (next_state >= 0) { @@ -1065,11 +1074,11 @@ } else { /* Or perform one of the actions. */ switch (next_state) { -/* Unicode character */ +/* Unicode character */ case UC: if(!decode_unicode_char(jc)) { jc->error = JSON_E_INVALID_UNICODE_SEQUENCE; return false; } @@ -1087,78 +1096,78 @@ break; /* integer detected by minus */ case MX: jc->type = JSON_T_INTEGER; jc->state = MI; - break; -/* integer detected by zero */ + break; +/* integer detected by zero */ case ZX: jc->type = JSON_T_INTEGER; jc->state = ZE; - break; -/* integer detected by 1-9 */ + break; +/* integer detected by 1-9 */ case IX: jc->type = JSON_T_INTEGER; jc->state = IT; - break; - + break; + /* floating point number detected by exponent*/ case DE: assert_type_isnt_string_null_or_bool(jc); jc->type = JSON_T_FLOAT; jc->state = E1; - break; - + break; + /* floating point number detected by fraction */ case DF: assert_type_isnt_string_null_or_bool(jc); if (!jc->handle_floats_manually) { /* - Some versions of strtod (which underlies sscanf) don't support converting + Some versions of strtod (which underlies sscanf) don't support converting C-locale formated floating point values. -*/ +*/ assert(jc->parse_buffer[jc->parse_buffer_count-1] == '.'); jc->parse_buffer[jc->parse_buffer_count-1] = jc->decimal_point; - } + } jc->type = JSON_T_FLOAT; jc->state = FX; - break; + break; /* string begin " */ case SB: parse_buffer_clear(jc); assert(jc->type == JSON_T_NONE); jc->type = JSON_T_STRING; jc->state = ST; - break; - + break; + /* n */ case NU: assert(jc->type == JSON_T_NONE); jc->type = JSON_T_NULL; jc->state = N1; - break; + break; /* f */ case FA: assert(jc->type == JSON_T_NONE); jc->type = JSON_T_FALSE; jc->state = F1; - break; + break; /* t */ case TR: assert(jc->type == JSON_T_NONE); jc->type = JSON_T_TRUE; jc->state = T1; - break; - + break; + /* closing comment */ case CE: jc->comment = 0; assert(jc->parse_buffer_count == 0); assert(jc->type == JSON_T_NONE); jc->state = jc->before_comment_state; - break; - + break; + /* opening comment */ case CB: if (!jc->allow_comments) { return false; } @@ -1168,11 +1177,11 @@ } assert(jc->parse_buffer_count == 0); assert(jc->type != JSON_T_STRING); switch (jc->stack[jc->top]) { case MODE_ARRAY: - case MODE_OBJECT: + case MODE_OBJECT: switch(jc->state) { case VA: case AR: jc->before_comment_state = jc->state; break; @@ -1188,11 +1197,11 @@ jc->type = JSON_T_NONE; jc->state = C1; jc->comment = 1; break; /* empty } */ - case -9: + case -9: parse_buffer_clear(jc); if (jc->callback && !(*jc->callback)(jc->ctx, JSON_T_OBJECT_END, NULL)) { return false; } if (!pop(jc, MODE_KEY)) { @@ -1227,11 +1236,11 @@ } if (!pop(jc, MODE_ARRAY)) { jc->error = JSON_E_UNBALANCED_COLLECTION; return false; } - + jc->type = JSON_T_NONE; jc->state = OK; break; /* { */ case -6: @@ -1263,11 +1272,11 @@ switch (jc->stack[jc->top]) { case MODE_KEY: assert(jc->type == JSON_T_STRING); jc->type = JSON_T_NONE; jc->state = CO; - + if (jc->callback) { JSON_value value; value.vu.str.value = jc->parse_buffer; value.vu.str.length = jc->parse_buffer_count; if (!(*jc->callback)(jc->ctx, JSON_T_KEY, &value)) { @@ -1353,29 +1362,29 @@ int JSON_parser_is_legal_white_space_string(const char* s) { int c, char_class; - + if (s == NULL) { return false; } - - for (; *s; ++s) { + + for (; *s; ++s) { c = *s; - + if (c < 0 || c >= 128) { return false; } - + char_class = ascii_class[c]; - + if (char_class != C_SPACE && char_class != C_WHITE) { return false; } } - + return true; } int JSON_parser_get_last_error(JSON_parser jc) { @@ -1385,16 +1394,17 @@ void init_JSON_config(JSON_config* config) { if (config) { memset(config, 0, sizeof(*config)); - + config->depth = JSON_PARSER_STACK_SIZE - 1; config->malloc = malloc; config->free = free; } } + /* end file parser/JSON_parser.c */ /* begin file ./cson.c */ #include #include /* malloc()/free() */ #include @@ -1572,14 +1582,29 @@ }; #define cson_string_empty_m {0/*length*/} static const cson_string cson_string_empty = cson_string_empty_m; - +/** + Assumes V is a (cson_value*) ans V->value is a (T*). Returns + V->value cast to a (T*). +*/ #define CSON_CAST(T,V) ((T*)((V)->value)) +/** + Assumes V is a pointer to memory which is allocated as part of a + cson_value instance (the bytes immediately after that part). + Returns a pointer a a cson_value by subtracting sizeof(cson_value) + from that address and casting it to a (cson_value*) +*/ #define CSON_VCAST(V) ((cson_value *)(((unsigned char *)(V))-sizeof(cson_value))) +/** + CSON_INT(V) assumes that V is a (cson_value*) of type + CSON_TYPE_INTEGER. This macro returns a (cson_int_t*) representing + its value (how that is stored depends on whether we are running in + 32- or 64-bit mode). + */ #if CSON_VOID_PTR_IS_BIG # define CSON_INT(V) ((cson_int_t*)(&((V)->value))) #else # define CSON_INT(V) ((cson_int_t*)(V)->value) #endif @@ -1588,14 +1613,12 @@ #define CSON_STR(V) CSON_CAST(cson_string,(V)) #define CSON_OBJ(V) CSON_CAST(cson_object,(V)) #define CSON_ARRAY(V) CSON_CAST(cson_array,(V)) /** - Holds special shared "constant" (though they are non-const) - values. - + values. */ static struct CSON_EMPTY_HOLDER_ { char trueValue; cson_string stringValue; @@ -1805,11 +1828,11 @@ Frees any resources owned by val, but does not free val itself (which may be stack-allocated). If !val or val->api or val->api->cleanup are NULL then this is a no-op. If v is a container type (object or array) its children are also - cleaned up (BUT NOT FREED), recursively. + cleaned up, recursively. After calling this, val will have the special "undefined" type. */ static void cson_value_clean( cson_value * val ); @@ -1885,11 +1908,11 @@ /** Fetches v's string value as a non-const string. - cson_strings are supposed to be immutable, but this form provides + cson_strings are intended to be immutable, but this form provides access to the immutable bits, which are v->length bytes long. A length-0 string is returned as NULL from here, as opposed to "". (This is a side-effect of the string allocation mechanism.) Returns NULL if !v or if v is the internal empty-string singleton. */ @@ -3777,11 +3800,31 @@ assert( next > pos ); clen = next - pos; assert( clen ); if( 1 == clen ) { /* ASCII */ - assert( *pos == ch ); +#if defined(CSON_FOSSIL_MODE) + /* Workaround for fossil repo artifact + f460839cff85d4e4f1360b366bb2858cef1411ea, + which has what appears to be latin1-encoded + text. file(1) thinks it's a FORTRAN program. + */ + if(0xfffd==ch){ + assert(*pos != ch); + /* MARKER("ch=%04x, *pos=%04x\n", ch, *pos); */ + ch = *pos + /* We should arguably translate to '?', and + will if this problem ever comes up with a + non-latin1 encoding. For latin1 this + workaround incidentally corrects the output + to proper UTF8-escaped characters, and only + for that reason is it being kept around. + */; + goto assume_latin1; + } +#endif + assert( (*pos == ch) && "Invalid UTF8" ); escChar[1] = 0; switch(ch) { case '\t': escChar[1] = 't'; break; case '\r': escChar[1] = 'r'; break; @@ -3832,10 +3875,13 @@ } continue; } else { /* UTF: transform it to \uXXXX */ +#if defined(CSON_FOSSIL_MODE) + assume_latin1: +#endif memset(ubuf,0,UBLen); rc = sprintf(ubuf, "\\u%04x",ch); if( rc != 6 ) { rc = cson_rc.RangeError; @@ -4101,11 +4147,11 @@ rc = f(state, ",", 1); if( 0 == rc ) { rc = doIndent ? cson_output_indent( f, state, fmt->indentation, level ) - : f( state, " ", 1 ); + : 0 /*f( state, " ", 1 )*/; } } } } --level; @@ -4179,11 +4225,11 @@ rc = f(state, ",", 1); if( 0 == rc ) { rc = doIndent ? cson_output_indent( f, state, fmt->indentation, level ) - : f( state, " ", 1 ); + : 0 /*f( state, " ", 1 )*/; } } } } --level; @@ -4349,11 +4395,11 @@ { return 0; } else { - unsigned char * x = (unsigned char *)realloc( buf->mem, n ); + unsigned char * x = (unsigned char *)cson_realloc( buf->mem, n, "cson_buffer::mem" ); if( ! x ) return cson_rc.AllocError; memset( x + buf->used, 0, n - buf->used ); buf->mem = x; buf->capacity = n; ++buf->timesExpanded; @@ -4392,11 +4438,11 @@ const cson_size_t oldCap = sb->capacity; const cson_size_t asz = npos * 2; if( asz < npos ) return cson_rc.ArgError; /* overflow */ else if( 0 != cson_buffer_reserve( sb, asz ) ) return cson_rc.AllocError; assert( (sb->capacity > oldCap) && "Internal error in memory buffer management!" ); - /* make sure it gets NULL terminated. */ + /* make sure it gets NUL terminated. */ memset( sb->mem + oldCap, 0, (sb->capacity - oldCap) ); } for( i = 0; i < n; ++i, ++sb->used ) { sb->mem[sb->used] = data[i]; Index: src/cson_amalgamation.h ================================================================== --- src/cson_amalgamation.h +++ src/cson_amalgamation.h @@ -51,11 +51,15 @@ /** @typedef some_long_int_type cson_int_t Typedef for JSON-like integer types. This is (long long) where feasible, otherwise (long). */ -#if (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1) +#ifdef _WIN32 +typedef __int64 cson_int_t; +#define CSON_INT_T_SFMT "I64d" +#define CSON_INT_T_PFMT "I64d" +#elif (__STDC_VERSION__ >= 199901L) || (HAVE_LONG_LONG == 1) typedef long long cson_int_t; #define CSON_INT_T_SFMT "lld" #define CSON_INT_T_PFMT "lld" #else typedef long cson_int_t; ADDED src/cygsup.h Index: src/cygsup.h ================================================================== --- /dev/null +++ src/cygsup.h @@ -0,0 +1,124 @@ +/* +** 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/ +** +******************************************************************************* +** +** This file contains preprocessor directives used to help integrate with the +** Cygwin runtime and build environment. The intent of this file is to keep +** the Cygwin-specific preprocessor directives together. +*/ + +#if defined(__CYGWIN__) && !defined(CYGSUP_H) +#define CYGSUP_H + +/* +******************************************************************************* +** Include any Cygwin-specific headers here. ** +******************************************************************************* +*/ + +#include +#include + +/* +******************************************************************************* +** Define any Cygwin-specific preprocessor macros here. All macros defined in +** this section should be wrapped with #ifndef, in order to allow them to be +** externally overridden. +******************************************************************************* +*/ + +#ifndef CP_UTF8 +# define CP_UTF8 65001 +#endif + +#ifndef WINBASEAPI +# define WINBASEAPI __declspec(dllimport) +#endif + +#ifndef WINADVAPI +# define WINADVAPI __declspec(dllimport) +#endif + +#ifndef SHSTDAPI +# define SHSTDAPI __declspec(dllimport) +#endif + +#ifndef STDAPI +# define STDAPI __stdcall +#endif + +#ifndef WINAPI +# define WINAPI __stdcall +#endif + +/* +******************************************************************************* +** Declare any Cygwin-specific Win32 or other APIs here. Functions declared in +** this section should use the built-in ANSI C types in order to make sure this +** header file continues to work as a self-contained unit. +** +** On Cygwin64, "long" is 64-bit but in Win64 it's 32-bit. That's why in the +** signatures below "long" should not be used. They now use "int" instead. +******************************************************************************* +*/ + +WINADVAPI extern WINAPI int RegOpenKeyExW( + void *, /* HKEY */ + const wchar_t *, /* LPCWSTR */ + unsigned int, /* DWORD */ + unsigned int, /* REGSAM */ + void * /* PHKEY */ + ); + +WINADVAPI extern WINAPI int RegQueryValueExW( + void *, /* HKEY */ + const wchar_t *, /* LPCWSTR */ + unsigned int *, /* LPDWORD */ + unsigned int *, /* LPDWORD */ + unsigned char *, /* LPBYTE */ + unsigned int * /* LPDWORD */ + ); + +SHSTDAPI extern STDAPI void *ShellExecuteW( + void *, /* HWND */ + const wchar_t *, /* LPCWSTR */ + const wchar_t *, /* LPCWSTR */ + const wchar_t *, /* LPCWSTR */ + const wchar_t *, /* LPCWSTR */ + int /* INT */ + ); + +WINBASEAPI extern WINAPI int WideCharToMultiByte( + unsigned int, /* UINT */ + unsigned int, /* DWORD */ + const wchar_t *, /* LPCWSTR */ + int, /* int */ + char *, /* LPSTR */ + int, /* int */ + const char *, /* LPCSTR */ + int * /* LPBOOL */ + ); + +WINBASEAPI extern WINAPI int MultiByteToWideChar( + unsigned int, /* UINT */ + unsigned int, /* DWORD */ + const char *, /* LPCSTR */ + int, /* int */ + wchar_t *, /* LPWSTR */ + int /* int */ + ); + +#endif /* defined(__CYGWIN__) && !defined(CYGSUP_H) */ Index: src/db.c ================================================================== --- src/db.c +++ src/db.c @@ -221,11 +221,11 @@ ** rolls back rather than commit. It is the responsibility of the ** hooks themselves to issue any error messages. */ void db_commit_hook(int (*x)(void), int sequence){ int i; - assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) ); + assert( db.nCommitHook < count(db.aHook) ); for(i=0; isequence ){ int s = sequence; int (*xS)(void) = x; @@ -399,12 +399,16 @@ } /* ** Return the rowid of the most recent insert */ -i64 db_last_insert_rowid(void){ - return sqlite3_last_insert_rowid(g.db); +int db_last_insert_rowid(void){ + i64 x = sqlite3_last_insert_rowid(g.db); + if( x<0 || x>(i64)2147483647 ){ + fossil_fatal("rowid out of range (0..2147483647)"); + } + return (int)x; } /* ** Return the number of rows that were changed by the most recent ** INSERT, UPDATE, or DELETE. Auxiliary changes caused by triggers @@ -705,19 +709,20 @@ ** Open a database file. Return a pointer to the new database ** connection. An error results in process abort. */ LOCAL sqlite3 *db_open(const char *zDbName){ int rc; - const char *zVfs; sqlite3 *db; +#if defined(__CYGWIN__) + zDbName = fossil_utf8_to_filename(zDbName); +#endif if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName); - zVfs = fossil_getenv("FOSSIL_VFS"); rc = sqlite3_open_v2( zDbName, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, - zVfs + g.zVfsName ); if( rc!=SQLITE_OK ){ db_err("[%s]: %s", zDbName, sqlite3_errmsg(db)); } sqlite3_busy_timeout(db, 5000); @@ -769,15 +774,15 @@ ){ if( !g.db ){ assert( g.zMainDbType==0 ); g.db = db_open(zDbName); g.zMainDbType = zLabel; - if ( pWasAttached ) *pWasAttached = 0; + if( pWasAttached ) *pWasAttached = 0; }else{ assert( g.zMainDbType!=0 ); db_attach(zDbName, zLabel); - if ( pWasAttached ) *pWasAttached = 1; + if( pWasAttached ) *pWasAttached = 1; } } /* ** Open the user database in "~/.fossil". Create the database anew if @@ -791,13 +796,13 @@ ** connection so that we can join between the various databases. In that ** case, invoke this routine with useAttach as 1. */ void db_open_config(int useAttach){ char *zDbName; - const char *zHome; - if( g.configOpen ) return; -#if defined(_WIN32) + char *zHome; + if( g.zConfigDbName ) return; +#if defined(_WIN32) || defined(__CYGWIN__) zHome = fossil_getenv("LOCALAPPDATA"); if( zHome==0 ){ zHome = fossil_getenv("APPDATA"); if( zHome==0 ){ char *zDrive = fossil_getenv("HOMEDRIVE"); @@ -818,36 +823,37 @@ } #endif if( file_isdir(zHome)!=1 ){ fossil_fatal("invalid home directory: %s", zHome); } -#ifndef _WIN32 - if( access(zHome, W_OK) ){ - fossil_fatal("home directory %s must be writeable", zHome); - } -#endif - g.zHome = mprintf("%/", zHome); -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) /* . filenames give some window systems problems and many apps problems */ zDbName = mprintf("%//_fossil", zHome); #else + if( file_access(zHome, W_OK) ){ + fossil_fatal("home directory %s must be writeable", zHome); + } zDbName = mprintf("%s/.fossil", zHome); #endif if( file_size(zDbName)<1024*3 ){ db_init_database(zDbName, zConfigSchema, (char*)0); } +#if defined(_WIN32) || defined(__CYGWIN__) + if( file_access(zDbName, W_OK) ){ + fossil_fatal("configuration file %s must be writeable", zDbName); + } +#endif if( useAttach ){ db_open_or_attach(zDbName, "configdb", &g.useAttach); g.dbConfig = 0; g.zConfigDbType = 0; }else{ g.useAttach = 0; g.dbConfig = db_open(zDbName); g.zConfigDbType = "configdb"; } - g.configOpen = 1; - free(zDbName); + g.zConfigDbName = zDbName; } /* ** Returns TRUE if zTable exists in the local database but lacks column @@ -882,10 +888,11 @@ lsize = file_size(zDbName); if( lsize%1024!=0 || lsize<4096 ) return 0; db_open_or_attach(zDbName, "localdb", 0); zVFileDef = db_text(0, "SELECT sql FROM %s.sqlite_master" " WHERE name=='vfile'", db_name("localdb")); + if( zVFileDef==0 ) return 0; /* 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. */ @@ -918,32 +925,31 @@ ** that contains a valid repository database. ** ** For legacy, also look for ".fos". The use of ".fos" is deprecated ** since "fos" has negative connotations in Hungarian, we are told. ** -** If no valid _FOSSIL_ or .fos file is found, we move up one level and +** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and ** try again. Once the file is found, the g.zLocalRoot variable is set ** to the root of the repository tree and this routine returns 1. If ** no database is found, then this routine return 0. ** ** This routine always opens the user database regardless of whether or -** not the repository database is found. If the _FOSSIL_ or .fos file +** not the repository database is found. If the _FOSSIL_ or .fslckout file ** is found, it is attached to the open database connection too. */ -int db_open_local(void){ +int db_open_local(const char *zDbName){ int i, n; char zPwd[2000]; - static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" }; + static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; if( g.localOpen) return 1; file_getcwd(zPwd, sizeof(zPwd)-20); n = strlen(zPwd); if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; while( n>0 ){ - if( file_access(zPwd, W_OK) ) break; - for(i=0; i1 && zPwd[n-1]=='/' ){ n--; @@ -950,11 +956,11 @@ zPwd[n] = 0; } g.zLocalRoot = mprintf("%s/", zPwd); g.localOpen = 1; db_open_config(0); - db_open_repository(0); + db_open_repository(zDbName); return 1; } } n--; while( n>0 && zPwd[n]!='/' ){ n--; } @@ -1015,13 +1021,17 @@ g.json.resultCode = FSL_JSON_E_DB_NOT_VALID; #endif fossil_panic("not a valid repository: %s", zDbName); } } - db_open_or_attach(zDbName, "repository", 0); - g.repositoryOpen = 1; +#if defined(__CYGWIN__) + g.zRepositoryName = fossil_utf8_to_filename(zDbName); +#else g.zRepositoryName = mprintf("%s", zDbName); +#endif + db_open_or_attach(g.zRepositoryName, "repository", 0); + g.repositoryOpen = 1; /* Cache "allow-symlinks" option, because we'll need it on every stat call */ g.allowSymlinks = db_get_boolean("allow-symlinks", 0); } /* @@ -1043,11 +1053,11 @@ const char *zRep = find_option("repository", "R", 1); if( zRep==0 && nArgUsed && g.argc==nArgUsed+1 ){ zRep = g.argv[nArgUsed]; } if( zRep==0 ){ - if( db_open_local()==0 ){ + if( db_open_local(0)==0 ){ goto rep_not_found; } zRep = db_repository_filename(); if( zRep==0 ){ goto rep_not_found; @@ -1129,18 +1139,18 @@ Blob repo; char *zRepo; if( g.argc!=3 ){ usage("PATHNAME"); } - if( db_open_local()==0 ){ - fossil_fatal("not in a local checkout"); - return; - } file_canonical_name(g.argv[2], &repo, 0); zRepo = blob_str(&repo); if( file_access(zRepo, 0) ){ fossil_fatal("no such file: %s", zRepo); + } + if( db_open_local(zRepo)==0 ){ + fossil_fatal("not in a local checkout"); + return; } db_open_or_attach(zRepo, "test_repo", 0); db_lset("repository", blob_str(&repo)); db_close(1); } @@ -1148,11 +1158,11 @@ /* ** Open the local database. If unable, exit with an error. */ void db_must_be_within_tree(void){ - if( db_open_local()==0 ){ + if( db_open_local(0)==0 ){ fossil_fatal("current directory is not within an open checkout"); } db_open_repository(0); db_verify_schema(); } @@ -1202,11 +1212,11 @@ fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); } } g.repositoryOpen = 0; g.localOpen = 0; - g.configOpen = 0; + g.zConfigDbName = NULL; sqlite3_wal_checkpoint(g.db, 0); sqlite3_close(g.db); g.db = 0; g.zMainDbType = 0; if( g.dbConfig ){ @@ -1226,10 +1236,11 @@ */ void db_create_repository(const char *zFilename){ db_init_database( zFilename, zRepositorySchema1, + zRepositorySchemaDefaultReports, zRepositorySchema2, (char*)0 ); db_delete_on_failure(zFilename); } @@ -1248,10 +1259,13 @@ if( zUser==0 ){ #if defined(_WIN32) zUser = fossil_getenv("USERNAME"); #else zUser = fossil_getenv("USER"); + if( zUser==0 ){ + zUser = fossil_getenv("LOGNAME"); + } #endif } if( zUser==0 ){ zUser = "root"; } @@ -1262,17 +1276,17 @@ "UPDATE user SET cap='s', pw=lower(hex(randomblob(3)))" " WHERE login=%Q", zUser ); if( !setupUserOnly ){ db_multi_exec( - "INSERT INTO user(login,pw,cap,info)" + "INSERT OR IGNORE INTO user(login,pw,cap,info)" " VALUES('anonymous',hex(randomblob(8)),'hmncz','Anon');" - "INSERT INTO user(login,pw,cap,info)" + "INSERT OR IGNORE INTO user(login,pw,cap,info)" " VALUES('nobody','','gjor','Nobody');" - "INSERT INTO user(login,pw,cap,info)" + "INSERT OR IGNORE INTO user(login,pw,cap,info)" " VALUES('developer','','dei','Dev');" - "INSERT INTO user(login,pw,cap,info)" + "INSERT OR IGNORE INTO user(login,pw,cap,info)" " VALUES('reader','','kptw','Reader');" ); } } @@ -1324,10 +1338,11 @@ Blob hash; Blob manifest; db_set("content-schema", CONTENT_SCHEMA, 0); db_set("aux-schema", AUX_SCHEMA, 0); + db_set("rebuilt", get_version(), 0); if( makeServerCodes ){ db_multi_exec( "INSERT INTO config(name,value,mtime)" " VALUES('server-code', lower(hex(randomblob(20))),now());" "INSERT INTO config(name,value,mtime)" @@ -1349,11 +1364,12 @@ */ db_multi_exec( "INSERT OR REPLACE INTO config" " SELECT name,value,mtime FROM settingSrc.config" " WHERE (name IN %s OR name IN %s)" - " AND name NOT GLOB 'project-*';", + " AND name NOT GLOB 'project-*'" + " AND name NOT GLOB 'short-project-*';", configure_inop_rhs(CONFIGSET_ALL), db_setting_inop_rhs() ); db_multi_exec( "REPLACE INTO reportfmt SELECT * FROM settingSrc.reportfmt;" @@ -1384,12 +1400,14 @@ int rid; blob_zero(&manifest); blob_appendf(&manifest, "C initial\\sempty\\scheck-in\n"); zDate = date_in_standard_format(zInitialDate); blob_appendf(&manifest, "D %s\n", zDate); - blob_appendf(&manifest, "P\n"); md5sum_init(); + /* The R-card is necessary here because without it + * fossil versions earlier than versions 1.27 would + * interpret this artifact as a "control". */ blob_appendf(&manifest, "R %s\n", md5sum_finish(0)); blob_appendf(&manifest, "T *branch * trunk\n"); blob_appendf(&manifest, "T *sym-trunk *\n"); blob_appendf(&manifest, "U %F\n", g.zLogin); md5sum_blob(&manifest, &hash); @@ -1626,19 +1644,19 @@ ** Return true if the string zVal represents "true" (or "false"). */ int is_truth(const char *zVal){ static const char *const azOn[] = { "on", "yes", "true", "1" }; int i; - for(i=0; i , and emits warnings if necessary. ** Returns the non-versioned value without modification if there is no ** versioned value. */ -static char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){ +char *db_get_do_versionable(const char *zName, char *zNonVersionedSetting){ char *zVersionedSetting = 0; int noWarn = 0; struct _cacheEntry { struct _cacheEntry *next; const char *zName, *zValue; } *cacheEntry = 0; static struct _cacheEntry *cache = 0; + if( !g.localOpen) return zNonVersionedSetting; /* Look up name in cache */ cacheEntry = cache; while( cacheEntry!=0 ){ if( fossil_strcmp(cacheEntry->zName, zName)==0 ){ zVersionedSetting = fossil_strdup(cacheEntry->zValue); @@ -1765,23 +1784,36 @@ } } if( g.repositoryOpen ){ z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); } - if( z==0 && g.configOpen ){ + if( z==0 && g.zConfigDbName ){ db_swap_connections(); z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); db_swap_connections(); } - if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ - /* This is a versionable setting, try and get the info from a checked out file */ + if( ctrlSetting!=0 && ctrlSetting->versionable ){ + /* This is a versionable setting, try and get the info from a + ** checked out file */ z = db_get_do_versionable(zName, z); } if( z==0 ){ z = zDefault; } return z; +} +char *db_get_mtime(const char *zName, char *zFormat, char *zDefault){ + char *z = 0; + if( g.repositoryOpen ){ + z = db_text(0, "SELECT mtime FROM config WHERE name=%Q", zName); + } + if( z==0 ){ + z = zDefault; + }else if( zFormat!=0 ){ + z = db_text(0, "SELECT strftime(%Q,%Q,'unixepoch');", zFormat, z); + } + return z; } void db_set(const char *zName, const char *zValue, int globalFlag){ db_begin_transaction(); if( globalFlag ){ db_swap_connections(); @@ -1811,11 +1843,11 @@ } db_end_transaction(0); } int db_is_global(const char *zName){ int rc = 0; - if( g.configOpen ){ + if( g.zConfigDbName ){ db_swap_connections(); rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); db_swap_connections(); } return rc; @@ -1832,11 +1864,11 @@ } db_finalize(&q); }else{ rc = SQLITE_DONE; } - if( rc==SQLITE_DONE && g.configOpen ){ + if( rc==SQLITE_DONE && g.zConfigDbName ){ db_swap_connections(); v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); db_swap_connections(); } return v; @@ -1872,10 +1904,31 @@ return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName); } void db_lset_int(const char *zName, int value){ db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value); } + +/* +** Returns non-0 if the database (which must be open) table identified +** by zTableName has a column named zColName (case-sensitive), else +** returns 0. +*/ +int db_table_has_column( char const *zTableName, char const *zColName ){ + Stmt q = empty_Stmt; + int rc = 0; + db_prepare( &q, "PRAGMA table_info(%Q)", zTableName ); + while(SQLITE_ROW == db_step(&q)){ + /* Columns: (cid, name, type, notnull, dflt_value, pk) */ + char const * zCol = db_column_text(&q, 1); + if(0==fossil_strcmp(zColName, zCol)){ + rc = 1; + break; + } + } + db_finalize(&q); + return rc; +} /* ** Record the name of a local repository in the global_config() database. ** The repository filename %s is recorded as an entry with a "name" field ** of the following form: @@ -1941,66 +1994,68 @@ ** --nested Allow opening a repository inside an opened checkout ** ** See also: close */ void cmd_open(void){ - Blob path; - int vid; int keepFlag; int allowNested; + char **oldArgv; + int oldArgc; static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; url_proxy_options(); keepFlag = find_option("keep",0,0)!=0; allowNested = find_option("nested",0,0)!=0; if( g.argc!=3 && g.argc!=4 ){ usage("REPOSITORY-FILENAME ?VERSION?"); } - if( !allowNested && db_open_local() ){ - fossil_panic("already within an open tree rooted at %s", g.zLocalRoot); + if( !allowNested && db_open_local(0) ){ + fossil_fatal("already within an open tree rooted at %s", g.zLocalRoot); } - file_canonical_name(g.argv[2], &path, 0); - db_open_repository(blob_str(&path)); -#if defined(_WIN32) + db_open_repository(g.argv[2]); +#if defined(_WIN32) || defined(__CYGWIN__) # define LOCALDB_NAME "./_FOSSIL_" #else # define LOCALDB_NAME "./.fslckout" #endif - db_init_database(LOCALDB_NAME, zLocalSchema, (char*)0); + db_init_database(LOCALDB_NAME, zLocalSchema, +#ifdef FOSSIL_LOCAL_WAL + "COMMIT; PRAGMA journal_mode=WAL; BEGIN;", +#endif + (char*)0); db_delete_on_failure(LOCALDB_NAME); - db_open_local(); + db_open_local(0); db_lset("repository", g.argv[2]); - db_record_repository_filename(blob_str(&path)); - vid = db_int(0, "SELECT pid FROM plink y" - " WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)"); - if( vid==0 ){ - db_lset_int("checkout", 1); - }else{ - char **oldArgv = g.argv; - int oldArgc = g.argc; - db_lset_int("checkout", vid); - azNewArgv[0] = g.argv[0]; - g.argv = azNewArgv; - g.argc = 3; - if( oldArgc==4 ){ - azNewArgv[g.argc-1] = oldArgv[3]; - }else{ - azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); - } - if( keepFlag ){ - azNewArgv[g.argc++] = "--keep"; - } - checkout_cmd(); - g.argc = 2; - info_cmd(); - } + db_record_repository_filename(g.argv[2]); + db_lset_int("checkout", 0); + oldArgv = g.argv; + oldArgc = g.argc; + azNewArgv[0] = g.argv[0]; + g.argv = azNewArgv; + g.argc = 3; + if( oldArgc==4 ){ + azNewArgv[g.argc-1] = oldArgv[3]; + }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ + azNewArgv[g.argc-1] = "--latest"; + }else{ + azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); + } + if( keepFlag ){ + azNewArgv[g.argc++] = "--keep"; + } + checkout_cmd(); + g.argc = 2; + info_cmd(); } /* ** Print the value of a setting named zName */ -static void print_setting(const struct stControlSettings *ctrlSetting, int localOpen){ +static void print_setting( + const struct stControlSettings *ctrlSetting, + int localOpen +){ Stmt q; if( g.repositoryOpen ){ db_prepare(&q, "SELECT '(local)', value FROM config WHERE name=%Q" " UNION ALL " @@ -2021,13 +2076,15 @@ } if( ctrlSetting->versionable && localOpen ){ /* Check to see if this is overridden by a versionable settings file */ Blob versionedPathname; blob_zero(&versionedPathname); - blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", g.zLocalRoot, ctrlSetting->name); + blob_appendf(&versionedPathname, "%s/.fossil-settings/%s", + g.zLocalRoot, ctrlSetting->name); if( file_size(blob_str(&versionedPathname))>=0 ){ - fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", ctrlSetting->name); + fossil_print(" (overridden by contents of file .fossil-settings/%s)\n", + ctrlSetting->name); } } db_finalize(&q); } @@ -2057,11 +2114,16 @@ { "auto-hyperlink",0, 0, 0, "on", }, { "auto-shun", 0, 0, 0, "on" }, { "autosync", 0, 0, 0, "on" }, { "binary-glob", 0, 40, 1, "" }, { "clearsign", 0, 0, 0, "off" }, +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || defined(__APPLE__) + { "case-sensitive",0, 0, 0, "off" }, +#else { "case-sensitive",0, 0, 0, "on" }, +#endif + { "clean-glob", 0, 40, 1, "" }, { "crnl-glob", 0, 40, 1, "" }, { "default-perms", 0, 16, 0, "u" }, { "diff-binary", 0, 0, 0, "on" }, { "diff-command", 0, 40, 0, "" }, { "dont-push", 0, 0, 0, "off" }, @@ -2071,16 +2133,14 @@ { "gdiff-command", 0, 40, 0, "gdiff" }, { "gmerge-command",0, 40, 0, "" }, { "http-port", 0, 16, 0, "8080" }, { "https-login", 0, 0, 0, "off" }, { "ignore-glob", 0, 40, 1, "" }, + { "keep-glob", 0, 40, 1, "" }, { "localauth", 0, 0, 0, "off" }, { "main-branch", 0, 40, 0, "trunk" }, { "manifest", 0, 0, 1, "off" }, -#ifdef FOSSIL_ENABLE_MARKDOWN - { "markdown", 0, 0, 0, "off" }, -#endif { "max-upload", 0, 25, 0, "250000" }, { "mtime-changes", 0, 0, 0, "on" }, { "pgp-command", 0, 40, 0, "gpg --clearsign -o " }, { "proxy", 0, 32, 0, "off" }, { "relative-paths",0, 0, 0, "on" }, @@ -2147,21 +2207,26 @@ ** binary-glob The VALUE is a comma or newline-separated list of ** (versionable) GLOB patterns that should be treated as binary files ** for committing and merging purposes. Example: *.jpg ** ** case-sensitive If TRUE, the files whose names differ only in case -** care considered distinct. If FALSE files whose names +** are considered distinct. If FALSE files whose names ** differ only in case are the same file. Defaults to -** TRUE for unix and FALSE for windows and mac. +** TRUE for unix and FALSE for Cygwin, Mac and Windows. +** +** clean-glob The VALUE is a comma or newline-separated list of GLOB +** (versionable) patterns specifying files that the "clean" command will +** delete without prompting even when the -force flag has +** not been used. Example: *.a *.lib *.o ** ** clearsign When enabled, fossil will attempt to sign all commits ** with gpg. When disabled (the default), commits will ** be unsigned. Default: off ** ** crnl-glob A comma or newline-separated list of GLOB patterns for -** (versionable) text files in which it is ok to have CR+NL line endings. -** Set to "*" to disable CR+NL checking. +** (versionable) text files in which it is ok to have CR, CR+NL or mixed +** line endings. Set to "*" to disable CR+NL checking. ** ** default-perms Permissions given automatically to new users. For more ** information on permissions see Users page in Server ** Administration of the HTTP UI. Default: u. ** @@ -2202,12 +2267,17 @@ ** ** https-login Send login credentials using HTTPS instead of HTTP ** even if the login page request came via HTTP. ** ** ignore-glob The VALUE is a comma or newline-separated list of GLOB -** (versionable) patterns specifying files that the "extra" command will -** ignore. Example: *.o,*.obj,*.exe +** (versionable) patterns specifying files that the "add", "addremove", +** "clean", and "extra" commands will ignore. +** Example: *.log customCode.c notes.txt +** +** keep-glob The VALUE is a comma or newline-separated list of GLOB +** (versionable) patterns specifying files that the "clean" command will +** keep. ** ** localauth If enabled, require that HTTP connections from ** 127.0.0.1 be authenticated by password. If ** false, all HTTP requests from localhost have ** unrestricted access to the repository. @@ -2216,15 +2286,10 @@ ** ** manifest If enabled, automatically create files "manifest" and ** (versionable) "manifest.uuid" in every checkout. The SQLite and ** Fossil repositories both require this. Default: off. ** -** markdown If enabled (and Fossil was compiled with markdown -** support), the markdown engine will be used to render -** embedded documentation conforming to the appropriate -** content types (e.g. "text/x-markdown"). Default: off. -** ** max-upload A limit on the size of uplink HTTP requests. The ** default is 250000 bytes. ** ** mtime-changes Use file modification times (mtimes) to detect when ** files have been modified. (Default "on".) @@ -2310,11 +2375,11 @@ } if( unsetFlag && g.argc!=3 ){ usage("PROPERTY ?-global?"); } if( g.argc==2 ){ - int openLocal = db_open_local(); + int openLocal = db_open_local(0); for(i=0; ctrlSettings[i].name; i++){ print_setting(&ctrlSettings[i], openLocal); } }else if( g.argc==3 || g.argc==4 ){ const char *zName = g.argv[2]; @@ -2334,17 +2399,17 @@ db_unset(ctrlSettings[i].name, globalFlag); }else if( g.argc==4 ){ db_set(ctrlSettings[i].name, g.argv[3], globalFlag); }else{ isManifest = 0; - print_setting(&ctrlSettings[i], db_open_local()); + print_setting(&ctrlSettings[i], db_open_local(0)); } if( isManifest && g.localOpen ){ manifest_to_disk(db_lget_int("checkout", 0)); } }else{ - usage("?PROPERTY? ?VALUE?"); + usage("?PROPERTY? ?VALUE? ?-global?"); } } /* ** The input in a timespan measured in days. Return a string which @@ -2386,5 +2451,71 @@ rDiff = db_double(0.0, "SELECT julianday('now') - julianday(%Q)", g.argv[2]); fossil_print("Time differences: %s\n", db_timespan_name(rDiff)); sqlite3_close(g.db); g.db = 0; } + +/* +** COMMAND: test-without-rowid +** %fossil test-without-rowid FILENAME... +** +** Change the Fossil repository FILENAME to make use of the WITHOUT ROWID +** optimization. FILENAME can also be the ~/.fossil file or a local +** .fslckout or _FOSSIL_ file. +** +** The purpose of this command is for testing the WITHOUT ROWID capabilities +** of SQLite. There is no big advantage to using WITHOUT ROWID in Fossil. +** +** Options: +** --dryrun | -n No changes. Just print what would happen. +*/ +void test_without_rowid(void){ + int i, j; + Stmt q; + Blob allSql; + int dryRun = find_option("dry-run", "n", 0)!=0; + for(i=2; i #include #include #include #include "delta.h" Index: src/deltacmd.c ================================================================== --- src/deltacmd.c +++ src/deltacmd.c @@ -144,9 +144,9 @@ blob_delta_create(&f1, &f2, &d12); blob_delta_create(&f2, &f1, &d21); blob_delta_apply(&f1, &d12, &a2); blob_delta_apply(&f2, &d21, &a1); if( blob_compare(&f1,&a1) || blob_compare(&f2, &a2) ){ - fossil_panic("delta test failed"); + fossil_fatal("delta test failed"); } fossil_print("ok\n"); } Index: src/descendants.c ================================================================== --- src/descendants.c +++ src/descendants.c @@ -71,11 +71,11 @@ bag_init(&pending); bag_insert(&pending, iBase); /* This query returns all non-branch-merge children of check-in :rid. ** - ** If a child is a merge of a fork within the same branch, it is + ** If a child is a merge of a fork within the same branch, it is ** returned. Only merge children in different branches are excluded. */ db_prepare(&q1, "SELECT cid FROM plink" " WHERE pid=:rid" @@ -84,25 +84,25 @@ " WHERE tagid=%d AND rid=plink.pid), 'trunk')" "=coalesce((SELECT value FROM tagxref" " WHERE tagid=%d AND rid=plink.cid), 'trunk'))", TAG_BRANCH, TAG_BRANCH ); - + /* This query returns a single row if check-in :rid is the first ** check-in of a new branch. */ - db_prepare(&isBr, + db_prepare(&isBr, "SELECT 1 FROM tagxref" " WHERE rid=:rid AND tagid=%d AND tagtype=2" " AND srcid>0", TAG_BRANCH ); - + /* This statement inserts check-in :rid into the LEAVES table. */ db_prepare(&ins, "INSERT OR IGNORE INTO leaves VALUES(:rid)"); - + while( bag_count(&pending) ){ int rid = bag_first(&pending); int cnt = 0; bag_remove(&pending, rid); db_bind_int(&q1, ":rid", rid); @@ -203,17 +203,17 @@ void compute_direct_ancestors(int rid, int N){ Stmt ins; Stmt q; int gen = 0; db_multi_exec( - "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER," + "CREATE TEMP TABLE IF NOT EXISTS ancestor(rid INTEGER UNIQUE NOT NULL," " generation INTEGER PRIMARY KEY);" "DELETE FROM ancestor;" "INSERT INTO ancestor VALUES(%d, 0);", rid ); db_prepare(&ins, "INSERT INTO ancestor VALUES(:rid, :gen)"); - db_prepare(&q, + db_prepare(&q, "SELECT pid FROM plink" " WHERE cid=:rid AND isprim" ); while( (N--)>0 ){ db_bind_int(&q, ":rid", rid); @@ -329,39 +329,39 @@ "%s" " AND event.objid IN (SELECT rid FROM leaves)" " ORDER BY event.mtime DESC", timeline_query_for_tty() ); - print_timeline(&q, 20, 0); + print_timeline(&q, -20, 79, 0); db_finalize(&q); } /* ** COMMAND: leaves* ** ** Usage: %fossil leaves ?OPTIONS? ** ** Find leaves of all branches. By default show only open leaves. -** The --all flag causes all leaves (closed and open) to be shown. -** The --closed flag shows only closed leaves. +** The -a|--all flag causes all leaves (closed and open) to be shown. +** The -c|--closed flag shows only closed leaves. ** ** The --recompute flag causes the content of the "leaf" table in the ** repository database to be recomputed. ** ** Options: -** --all show ALL leaves -** --closed show only closed leaves +** -a|--all show ALL leaves +** -c|--closed show only closed leaves ** --bybranch order output by branch name ** --recompute recompute the "leaf" table in the repository DB ** ** See also: descendants, finfo, info, branch */ void leaves_cmd(void){ Stmt q; Blob sql; - int showAll = find_option("all", 0, 0)!=0; - int showClosed = find_option("closed", 0, 0)!=0; + int showAll = find_option("all", "a", 0)!=0; + int showClosed = find_option("closed", "c", 0)!=0; int recomputeFlag = find_option("recompute",0,0)!=0; int byBranch = find_option("bybranch",0,0)!=0; char *zLastBr = 0; int n; char zLineNo[10]; @@ -504,11 +504,11 @@ db_bind_int(&ins, ":rid", mid); db_step(&ins); db_reset(&ins); } db_finalize(&q); - + db_prepare(&q, "SELECT mid FROM mlink WHERE pid=%d", fid); while( db_step(&q)==SQLITE_ROW ){ int mid = db_column_int(&q, 0); bag_insert(&seen, mid); if( usesFlags & USESFILE_DELETE ){ Index: src/diff.c ================================================================== --- src/diff.c +++ src/diff.c @@ -30,19 +30,20 @@ */ #define DIFF_CONTEXT_MASK ((u64)0x0000ffff) /* Lines of context. Default if 0 */ #define DIFF_WIDTH_MASK ((u64)0x00ff0000) /* side-by-side column width */ #define DIFF_IGNORE_EOLWS ((u64)0x01000000) /* Ignore end-of-line whitespace */ #define DIFF_SIDEBYSIDE ((u64)0x02000000) /* Generate a side-by-side diff */ -#define DIFF_NEWFILE ((u64)0x04000000) /* Missing shown as empty files */ +#define DIFF_VERBOSE ((u64)0x04000000) /* Missing shown as empty files */ #define DIFF_BRIEF ((u64)0x08000000) /* Show filenames only */ #define DIFF_INLINE ((u64)0x00000000) /* Inline (not side-by-side) diff */ #define DIFF_HTML ((u64)0x10000000) /* Render for HTML */ #define DIFF_LINENO ((u64)0x20000000) /* Show line numbers */ #define DIFF_WS_WARNING ((u64)0x40000000) /* Warn about whitespace */ #define DIFF_NOOPT (((u64)0x01)<<32) /* Suppress optimizations (debug) */ #define DIFF_INVERT (((u64)0x02)<<32) /* Invert the diff (debug) */ #define DIFF_CONTEXT_EX (((u64)0x04)<<32) /* Use context even if zero */ +#define DIFF_NOTTOOBIG (((u64)0x08)<<32) /* Only display if not too big */ /* ** These error messages are shared in multiple locations. They are defined ** here for consistency. */ @@ -50,18 +51,20 @@ "cannot compute difference between binary files\n" #define DIFF_CANNOT_COMPUTE_SYMLINK \ "cannot compute difference between symlink and regular file\n" -#define looks_like_binary(blob) (looks_like_utf8((blob)) == 0) -#endif /* INTERFACE */ +#define DIFF_TOO_MANY_CHANGES \ + "more than 10,000 changes\n" /* ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) */ #define LENGTH_MASK_SZ 13 #define LENGTH_MASK ((1< text */ - c = *z; - if( c==0 ) return 0; /* Zero byte in a file -> binary */ - j = (c!='\n'); - while( --n>0 ){ - c = *++z; ++j; - if( c==0 ) return 0; /* Zero byte in a file -> binary */ - if( c=='\n' ){ - int c2 = z[-1]; - if( c2=='\r' ){ - result = -1; /* Contains CR/NL, continue */ - } - if( j>LENGTH_MASK ){ - return 0; /* Very long line -> binary */ - } - j = 0; - } - } - if( j>LENGTH_MASK ){ - return 0; /* Very long line -> binary */ - } - return result; /* No problems seen -> not binary */ -} - -/* -** Define the type needed to represent a Unicode (UTF-16) character. -*/ -#ifndef WCHAR_T -# ifdef _WIN32 -# define WCHAR_T wchar_t -# else -# define WCHAR_T unsigned short -# endif -#endif - -/* -** Maximum length of a line in a text file, in UTF-16 characters. (4096) -** The number of bytes represented by this value cannot exceed LENGTH_MASK -** bytes, because that is the line buffer size used by the diff engine. -*/ -#define UTF16_LENGTH_MASK_SZ (LENGTH_MASK_SZ-(sizeof(WCHAR_T)-sizeof(char))) -#define UTF16_LENGTH_MASK ((1< text */ - if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ - c = *z; - if( c==0 ) return 0; /* NUL character in a file -> binary */ - j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); - while( (n-=2)>0 ){ - c = *++z; ++j; - if( c==0 ) return 0; /* NUL character in a file -> binary */ - if( c==UTF16BE_LF || c==UTF16LE_LF ){ - int c2 = z[-1]; - if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ - result = -1; /* Contains CR/NL, continue */ - } - if( j>UTF16_LENGTH_MASK ){ - return 0; /* Very long line -> binary */ - } - j = 0; - } - } - if( j>UTF16_LENGTH_MASK ){ - return 0; /* Very long line -> binary */ - } - return result; /* No problems seen -> not binary */ -} - -/* -** This function returns an array of bytes representing the byte-order-mark -** for UTF-8. -*/ -const unsigned char *get_utf8_bom(int *pnByte){ - static const unsigned char bom[] = { - 0xEF, 0xBB, 0xBF, 0x00, 0x00, 0x00 - }; - if( pnByte ) *pnByte = 3; - return bom; -} - -/* -** This function returns non-zero if the blob starts with a UTF-8 -** byte-order-mark (BOM). -*/ -int starts_with_utf8_bom(const Blob *pContent, int *pnByte){ - const char *z = blob_buffer(pContent); - int bomSize = 0; - const unsigned char *bom = get_utf8_bom(&bomSize); - - if( pnByte ) *pnByte = bomSize; - if( blob_size(pContent)h==pB->h && memcmp(pA->z,pB->z,pA->h & LENGTH_MASK)==0; @@ -443,21 +214,18 @@ int html, /* True if generating HTML. False for plain text */ ReCompiled *pRe /* Colorize only if line matches this Regex */ ){ blob_append(pOut, &cPrefix, 1); if( html ){ - char *zHtml; if( pRe && re_dline_match(pRe, pLine, 1)==0 ){ cPrefix = ' '; }else if( cPrefix=='+' ){ blob_append(pOut, "", -1); }else if( cPrefix=='-' ){ blob_append(pOut, "", -1); } - zHtml = htmlize(pLine->z, (pLine->h & LENGTH_MASK)); - blob_append(pOut, zHtml, -1); - fossil_free(zHtml); + htmlize_to_blob(pOut, pLine->z, (pLine->h & LENGTH_MASK)); if( cPrefix!=' ' ){ blob_append(pOut, "", -1); } }else{ blob_append(pOut, pLine->z, pLine->h & LENGTH_MASK); @@ -506,11 +274,11 @@ int mxr; /* Maximum value for r */ int na, nb; /* Number of lines shown from A and B */ int i, j; /* Loop counters */ int m; /* Number of lines to output */ int skip; /* Number of lines to skip */ - int nChunk = 0; /* Number of diff chunks seen so far */ + static int nChunk = 0; /* Number of diff chunks seen so far */ int nContext; /* Number of lines of context */ int showLn; /* Show line numbers */ int html; /* Render as HTML */ int showDivider = 0; /* True to show the divider between diff blocks */ @@ -549,11 +317,11 @@ a = xa; b = xb; continue; } } - + /* For the current block comprising nr triples, figure out ** how many lines of A and B are to be displayed */ if( R[r]>nContext ){ na = nb = nContext; @@ -587,14 +355,14 @@ if( !showDivider ){ /* Do not show a top divider */ showDivider = 1; }else if( html ){ blob_appendf(pOut, "%.80c\n", '.'); - blob_appendf(pOut, "\n", nChunk); }else{ blob_appendf(pOut, "%.80c\n", '.'); } + if( html ) blob_appendf(pOut, "", nChunk); }else{ if( html ) blob_appendf(pOut, ""); /* * 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. @@ -657,12 +425,11 @@ /* ** Status of a single output line */ typedef struct SbsLine SbsLine; struct SbsLine { - char *zLine; /* The output line under construction */ - int n; /* Index of next unused slot in the zLine[] */ + Blob *apCols[5]; /* Array of pointers to output columns */ int width; /* Maximum width of a column in the output */ unsigned char escHtml; /* True to escape html characters */ int iStart; /* Write zStart prior to character iStart */ const char *zStart; /* A tag */ int iEnd; /* Write prior to character iEnd */ @@ -671,125 +438,155 @@ int iEnd2; /* Write prior to character iEnd2 */ ReCompiled *pRe; /* Only colorize matching lines, if not NULL */ }; /* -** Flags for sbsWriteText() +** Column indices for SbsLine.apCols[] +*/ +#define SBS_LNA 0 /* Left line number */ +#define SBS_TXTA 1 /* Left text */ +#define SBS_MKR 2 /* Middle separator column */ +#define SBS_LNB 3 /* Right line number */ +#define SBS_TXTB 4 /* Right text */ + +/* +** Append newlines to all columns. +*/ +static void sbsWriteNewlines(SbsLine *p){ + int i; + for( i=p->escHtml ? SBS_LNA : SBS_TXTB; i<=SBS_TXTB; i++ ){ + blob_append(p->apCols[i], "\n", 1); + } +} + +/* +** Append n spaces to the column. */ -#define SBS_NEWLINE 0x0001 /* End with \n\000 */ -#define SBS_PAD 0x0002 /* Pad output to width spaces */ +static void sbsWriteSpace(SbsLine *p, int n, int col){ + blob_appendf(p->apCols[col], "%*s", n, ""); +} /* -** Write up to width characters of pLine into p->zLine[]. Translate tabs into -** spaces. Add a newline if SBS_NEWLINE is set. Translate HTML characters -** if SBS_HTML is set. Pad the rendering out width bytes if SBS_PAD is set. +** Write the text of pLine into column iCol of p. +** +** If outputting HTML, write the full line. Otherwise, only write the +** width characters. Translate tabs into spaces. Add newlines if col +** is SBS_TXTB. Translate HTML characters if escHtml is true. Pad the +** rendering to width bytes if col is SBS_TXTA and escHtml is false. ** ** This comment contains multibyte unicode characters (ü, Æ, ð) in order ** to test the ability of the diff code to handle such characters. */ -static void sbsWriteText(SbsLine *p, DLine *pLine, unsigned flags){ +static void sbsWriteText(SbsLine *p, DLine *pLine, int col){ + Blob *pCol = p->apCols[col]; int n = pLine->h & LENGTH_MASK; int i; /* Number of input characters consumed */ - int j; /* Number of output characters generated */ int k; /* Cursor position */ int needEndSpan = 0; const char *zIn = pLine->z; - char *z = &p->zLine[p->n]; int w = p->width; int colorize = p->escHtml; if( colorize && p->pRe && re_dline_match(p->pRe, pLine, 1)==0 ){ colorize = 0; } - for(i=j=k=0; kescHtml || kiStart ){ int x = strlen(p->zStart); - memcpy(z+j, p->zStart, x); - j += x; + blob_append(pCol, p->zStart, x); needEndSpan = 1; if( p->iStart2 ){ p->iStart = p->iStart2; p->zStart = p->zStart2; p->iStart2 = 0; } }else if( i==p->iEnd ){ - memcpy(z+j, "", 7); - j += 7; + blob_append(pCol, "", 7); needEndSpan = 0; if( p->iEnd2 ){ p->iEnd = p->iEnd2; p->iEnd2 = 0; } } } - if( c=='\t' ){ - z[j++] = ' '; - while( (k&7)!=7 && kescHtml ){ + blob_append(pCol, " ", 1); + while( (k&7)!=7 && (p->escHtml || kescHtml ){ - memcpy(&z[j], "<", 4); - j += 4; + blob_append(pCol, "<", 4); }else if( c=='&' && p->escHtml ){ - memcpy(&z[j], "&", 5); - j += 5; + blob_append(pCol, "&", 5); }else if( c=='>' && p->escHtml ){ - memcpy(&z[j], ">", 4); - j += 4; + blob_append(pCol, ">", 4); }else if( c=='"' && p->escHtml ){ - memcpy(&z[j], """, 6); - j += 6; + blob_append(pCol, """, 6); }else{ - z[j++] = c; + blob_append(pCol, &zIn[i], 1); if( (c&0xc0)==0x80 ) k--; } } if( needEndSpan ){ - memcpy(&z[j], "", 7); - j += 7; - } - if( (flags & SBS_PAD)!=0 ){ - while( kn += j; -} - -/* -** Append a string to an SbSLine without coding, interpretation, or padding. -*/ -static void sbsWrite(SbsLine *p, const char *zIn, int nIn){ - memcpy(p->zLine+p->n, zIn, nIn); - p->n += nIn; -} - -/* -** Append n spaces to the string. -*/ -static void sbsWriteSpace(SbsLine *p, int n){ - while( n-- ) p->zLine[p->n++] = ' '; -} - -/* -** Append a string to the output only if we are rendering HTML. -*/ -static void sbsWriteHtml(SbsLine *p, const char *zIn){ - if( p->escHtml ) sbsWrite(p, zIn, strlen(zIn)); -} - -/* -** Write a 6-digit line number followed by a single space onto the line. -*/ -static void sbsWriteLineno(SbsLine *p, int ln){ - sbsWriteHtml(p, ""); - sqlite3_snprintf(7, &p->zLine[p->n], "%5d ", ln+1); - p->n += 6; - sbsWriteHtml(p, ""); - p->zLine[p->n++] = ' '; + blob_append(pCol, "", 7); + } + if( col==SBS_TXTB ){ + sbsWriteNewlines(p); + }else if( !p->escHtml ){ + sbsWriteSpace(p, w-k, SBS_TXTA); + } +} + +/* +** Append a column to the final output blob. +*/ +static void sbsWriteColumn(Blob *pOut, Blob *pCol, int col){ + blob_appendf(pOut, + "
    \n" + "
    \n"
    +    "%s"
    +    "
    \n" + "
    \n", + col % 3 ? (col == SBS_MKR ? "mkr" : "txt") : "ln", + blob_str(pCol) + ); +} + +/* +** Append a separator line to column iCol +*/ +static void sbsWriteSep(SbsLine *p, int len, int col){ + char ch = '.'; + if( len<1 ){ + len = 1; + ch = ' '; + } + blob_appendf(p->apCols[col], "%.*c\n", len, ch); +} + +/* +** Append the appropriate marker into the center column of the diff. +*/ +static void sbsWriteMarker(SbsLine *p, const char *zTxt, const char *zHtml){ + blob_append(p->apCols[SBS_MKR], p->escHtml ? zHtml : zTxt, -1); +} + +/* +** Append a line number to the column. +*/ +static void sbsWriteLineno(SbsLine *p, int ln, int col){ + if( p->escHtml ){ + blob_appendf(p->apCols[col], "%d", ln+1); + }else{ + char zLn[7]; + sqlite3_snprintf(7, zLn, "%5d ", ln+1); + blob_appendf(p->apCols[col], "%s ", zLn); + } } /* ** The two text segments zLeft and zRight are known to be different on ** both ends, but they might have a common segment in the middle. If @@ -873,21 +670,33 @@ /* ** Simplify iStart and iStart2: ** ** * If iStart is a null-change then move iStart2 into iStart ** * Make sure any null-changes are in canonoical form. +** * Make sure all changes are at character boundaries for +** multi-byte characters. */ -static void sbsSimplifyLine(SbsLine *p){ - if( p->iStart2==p->iEnd2 ) p->iStart2 = p->iEnd2 = 0; +static void sbsSimplifyLine(SbsLine *p, const char *z){ + if( p->iStart2==p->iEnd2 ){ + p->iStart2 = p->iEnd2 = 0; + }else if( p->iStart2 ){ + while( p->iStart2>0 && (z[p->iStart2]&0xc0)==0x80 ) p->iStart2--; + while( (z[p->iEnd2]&0xc0)==0x80 ) p->iEnd2++; + } if( p->iStart==p->iEnd ){ p->iStart = p->iStart2; p->iEnd = p->iEnd2; p->zStart = p->zStart2; p->iStart2 = 0; p->iEnd2 = 0; } - if( p->iStart==p->iEnd ) p->iStart = p->iEnd = -1; + if( p->iStart==p->iEnd ){ + p->iStart = p->iEnd = -1; + }else if( p->iStart>0 ){ + while( p->iStart>0 && (z[p->iStart]&0xc0)==0x80 ) p->iStart--; + while( (z[p->iEnd]&0xc0)==0x80 ) p->iEnd++; + } } /* ** Write out lines that have been edited. Adjust the highlight to cover ** only those parts of the line that actually changed. @@ -899,10 +708,11 @@ DLine *pRight, /* Right line of the change */ int lnRight /* Line number of the right line */ ){ int nLeft; /* Length of left line in bytes */ int nRight; /* Length of right line in bytes */ + int nShort; /* Shortest of left and right */ int nPrefix; /* Length of common prefix */ int nSuffix; /* Length of common suffix */ const char *zLeft; /* Text of the left line */ const char *zRight; /* Text of the right line */ int nLeftDiff; /* nLeft - nPrefix - nSuffix */ @@ -914,58 +724,63 @@ nLeft = pLeft->h & LENGTH_MASK; zLeft = pLeft->z; nRight = pRight->h & LENGTH_MASK; zRight = pRight->z; + nShort = nLeft0 && (zLeft[nPrefix]&0xc0)==0x80 ) nPrefix--; + } nSuffix = 0; - if( nPrefix0 && (zLeft[nLeft-nSuffix]&0xc0)==0x80 ) nSuffix--; + } if( nSuffix==nLeft || nSuffix==nRight ) nPrefix = 0; } - if( nPrefix+nSuffix > nLeft ) nSuffix = nLeft - nPrefix; - if( nPrefix+nSuffix > nRight ) nSuffix = nRight - nPrefix; + if( nPrefix+nSuffix > nShort ) nPrefix = nShort - nSuffix; /* A single chunk of text inserted on the right */ if( nPrefix+nSuffix==nLeft ){ - sbsWriteLineno(p, lnLeft); + sbsWriteLineno(p, lnLeft, SBS_LNA); p->iStart2 = p->iEnd2 = 0; p->iStart = p->iEnd = -1; - sbsWriteText(p, pLeft, SBS_PAD); + sbsWriteText(p, pLeft, SBS_TXTA); if( nLeft==nRight && zLeft[nLeft]==zRight[nRight] ){ - sbsWrite(p, " ", 3); + sbsWriteMarker(p, " ", ""); }else{ - sbsWrite(p, " | ", 3); + sbsWriteMarker(p, " | ", "|"); } - sbsWriteLineno(p, lnRight); + sbsWriteLineno(p, lnRight, SBS_LNB); p->iStart = nPrefix; p->iEnd = nRight - nSuffix; p->zStart = zClassAdd; - sbsWriteText(p, pRight, SBS_NEWLINE); + sbsWriteText(p, pRight, SBS_TXTB); return; } /* A single chunk of text deleted from the left */ if( nPrefix+nSuffix==nRight ){ /* Text deleted from the left */ - sbsWriteLineno(p, lnLeft); + sbsWriteLineno(p, lnLeft, SBS_LNA); p->iStart2 = p->iEnd2 = 0; p->iStart = nPrefix; p->iEnd = nLeft - nSuffix; p->zStart = zClassRm; - sbsWriteText(p, pLeft, SBS_PAD); - sbsWrite(p, " | ", 3); - sbsWriteLineno(p, lnRight); + sbsWriteText(p, pLeft, SBS_TXTA); + sbsWriteMarker(p, " | ", "|"); + sbsWriteLineno(p, lnRight, SBS_LNB); p->iStart = p->iEnd = -1; - sbsWriteText(p, pRight, SBS_NEWLINE); + sbsWriteText(p, pRight, SBS_TXTB); return; } /* At this point we know that there is a chunk of text that has ** changed between the left and the right. Check to see if there @@ -976,11 +791,11 @@ if( p->escHtml && nLeftDiff >= 6 && nRightDiff >= 6 && textLCS(&zLeft[nPrefix], nLeftDiff, &zRight[nPrefix], nRightDiff, aLCS) ){ - sbsWriteLineno(p, lnLeft); + sbsWriteLineno(p, lnLeft, SBS_LNA); p->iStart = nPrefix; p->iEnd = nPrefix + aLCS[0]; if( aLCS[2]==0 ){ sbsShiftLeft(p, pLeft->z); p->zStart = zClassRm; @@ -988,14 +803,14 @@ p->zStart = zClassChng; } p->iStart2 = nPrefix + aLCS[1]; p->iEnd2 = nLeft - nSuffix; p->zStart2 = aLCS[3]==nRightDiff ? zClassRm : zClassChng; - sbsSimplifyLine(p); - sbsWriteText(p, pLeft, SBS_PAD); - sbsWrite(p, " | ", 3); - sbsWriteLineno(p, lnRight); + sbsSimplifyLine(p, zLeft+nPrefix); + sbsWriteText(p, pLeft, SBS_TXTA); + sbsWriteMarker(p, " | ", "|"); + sbsWriteLineno(p, lnRight, SBS_LNB); p->iStart = nPrefix; p->iEnd = nPrefix + aLCS[2]; if( aLCS[0]==0 ){ sbsShiftLeft(p, pRight->z); p->zStart = zClassAdd; @@ -1003,26 +818,26 @@ p->zStart = zClassChng; } p->iStart2 = nPrefix + aLCS[3]; p->iEnd2 = nRight - nSuffix; p->zStart2 = aLCS[1]==nLeftDiff ? zClassAdd : zClassChng; - sbsSimplifyLine(p); - sbsWriteText(p, pRight, SBS_NEWLINE); + sbsSimplifyLine(p, zRight+nPrefix); + sbsWriteText(p, pRight, SBS_TXTB); return; } /* If all else fails, show a single big change between left and right */ - sbsWriteLineno(p, lnLeft); + sbsWriteLineno(p, lnLeft, SBS_LNA); p->iStart2 = p->iEnd2 = 0; p->iStart = nPrefix; p->iEnd = nLeft - nSuffix; p->zStart = zClassChng; - sbsWriteText(p, pLeft, SBS_PAD); - sbsWrite(p, " | ", 3); - sbsWriteLineno(p, lnRight); + sbsWriteText(p, pLeft, SBS_TXTA); + sbsWriteMarker(p, " | ", "|"); + sbsWriteLineno(p, lnRight, SBS_LNB); p->iEnd = nRight - nSuffix; - sbsWriteText(p, pRight, SBS_NEWLINE); + sbsWriteText(p, pRight, SBS_TXTB); } /* ** Minimum of two values */ @@ -1222,11 +1037,11 @@ ** Then this is probably an alignment that will be difficult for humans ** to read. So instead, just show all of the right side inserted followed ** by all of the left side deleted. ** ** The coefficients for conditions (1) and (2) above are determined by - ** experimentation. + ** experimentation. */ mxLen = nLeft>nRight ? nLeft : nRight; if( i*4>mxLen*5 && (nMatch==0 || iMatch/nMatch>15) ){ memset(aM, 4, mnLen); if( nLeft>mnLen ) memset(aM+mnLen, 1, nLeft-mnLen); @@ -1268,30 +1083,40 @@ int mxr; /* Maximum value for r */ int na, nb; /* Number of lines shown from A and B */ int i, j; /* Loop counters */ int m, ma, mb;/* Number of lines to output */ int skip; /* Number of lines to skip */ - int nChunk = 0; /* Number of chunks of diff output seen so far */ + static int nChunk = 0; /* Number of chunks of diff output seen so far */ SbsLine s; /* Output line buffer */ int nContext; /* Lines of context above and below each change */ int showDivider = 0; /* True to show the divider */ + Blob aCols[5]; /* Array of column blobs */ memset(&s, 0, sizeof(s)); s.width = diff_width(diffFlags); - s.zLine = fossil_malloc( 15*s.width + 200 ); - if( s.zLine==0 ) return; nContext = diff_context_lines(diffFlags); s.escHtml = (diffFlags & DIFF_HTML)!=0; + if( s.escHtml ){ + for(i=SBS_LNA; i<=SBS_TXTB; i++){ + blob_zero(&aCols[i]); + s.apCols[i] = &aCols[i]; + } + }else{ + for(i=SBS_LNA; i<=SBS_TXTB; i++){ + s.apCols[i] = pOut; + } + } s.pRe = pRe; s.iStart = -1; s.iStart2 = 0; s.iEnd = -1; A = p->aFrom; B = p->aTo; R = p->aEdit; mxr = p->nEdit; while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; } + for(r=0; r0 && R[r+nr*3]%.*c\n", - s.width*2+16, '.'); + char zLn[10]; + sqlite3_snprintf(sizeof(zLn), zLn, "%d", a+skip+1); + sbsWriteSep(&s, strlen(zLn), SBS_LNA); + sbsWriteSep(&s, s.width, SBS_TXTA); + sbsWriteSep(&s, 0, SBS_MKR); + sqlite3_snprintf(sizeof(zLn), zLn, "%d", b+skip+1); + sbsWriteSep(&s, strlen(zLn), SBS_LNB); + sbsWriteSep(&s, s.width, SBS_TXTB); }else{ blob_appendf(pOut, "%.*c\n", s.width*2+16, '.'); } } showDivider = 1; nChunk++; if( s.escHtml ){ - blob_appendf(pOut, "\n", nChunk); + blob_appendf(s.apCols[SBS_LNA], "", nChunk); } /* Show the initial common area */ a += skip; b += skip; m = R[r] - skip; for(j=0; j0; j++){ if( alignment[j]==1 ){ /* Delete one line from the left */ - s.n = 0; - sbsWriteLineno(&s, a); + sbsWriteLineno(&s, a, SBS_LNA); s.iStart = 0; s.zStart = ""; - s.iEnd = s.width; - sbsWriteText(&s, &A[a], SBS_PAD); - if( s.escHtml ){ - sbsWrite(&s, " <\n", 6); - }else{ - sbsWrite(&s, " <\n", 3); - } - blob_append(pOut, s.zLine, s.n); + s.iEnd = LENGTH(&A[a]); + sbsWriteText(&s, &A[a], SBS_TXTA); + sbsWriteMarker(&s, " <", "<"); + sbsWriteNewlines(&s); assert( ma>0 ); ma--; a++; }else if( alignment[j]==3 ){ /* The left line is changed into the right line */ - s.n = 0; sbsWriteLineChange(&s, &A[a], a, &B[b], b); - blob_append(pOut, s.zLine, s.n); assert( ma>0 && mb>0 ); ma--; mb--; a++; b++; }else if( alignment[j]==2 ){ /* Insert one line on the right */ - s.n = 0; - sbsWriteSpace(&s, s.width + 7); - if( s.escHtml ){ - sbsWrite(&s, " > ", 6); - }else{ - sbsWrite(&s, " > ", 3); - } - sbsWriteLineno(&s, b); + if( !s.escHtml ){ + sbsWriteSpace(&s, s.width + 7, SBS_TXTA); + } + sbsWriteMarker(&s, " > ", ">"); + sbsWriteLineno(&s, b, SBS_LNB); s.iStart = 0; s.zStart = ""; - s.iEnd = s.width; - sbsWriteText(&s, &B[b], SBS_NEWLINE); - blob_append(pOut, s.zLine, s.n); + s.iEnd = LENGTH(&B[b]); + sbsWriteText(&s, &B[b], SBS_TXTB); assert( mb>0 ); mb--; b++; }else{ /* Delete from the left and insert on the right */ - s.n = 0; - sbsWriteLineno(&s, a); + sbsWriteLineno(&s, a, SBS_LNA); s.iStart = 0; s.zStart = ""; - s.iEnd = s.width; - sbsWriteText(&s, &A[a], SBS_PAD); - sbsWrite(&s, " | ", 3); - sbsWriteLineno(&s, b); + s.iEnd = LENGTH(&A[a]); + sbsWriteText(&s, &A[a], SBS_TXTA); + sbsWriteMarker(&s, " | ", "|"); + sbsWriteLineno(&s, b, SBS_LNB); s.iStart = 0; s.zStart = ""; - s.iEnd = s.width; - sbsWriteText(&s, &B[b], SBS_NEWLINE); - blob_append(pOut, s.zLine, s.n); + s.iEnd = LENGTH(&B[b]); + sbsWriteText(&s, &B[b], SBS_TXTB); ma--; mb--; a++; b++; } - } fossil_free(alignment); if( inContext ) m = nContext; for(j=0; j0 ){ + blob_append(pOut, "\n", -1); + for(i=SBS_LNA; i<=SBS_TXTB; i++){ + sbsWriteColumn(pOut, s.apCols[i], i); + blob_reset(s.apCols[i]); + } + blob_append(pOut, "
    \n", -1); + } } /* ** Compute the optimal longest common subsequence (LCS) using an ** exhaustive search. This version of the LCS is only used for @@ -1564,23 +1383,26 @@ int iS1, int iE1, /* Range of lines in p->aFrom[] */ int iS2, int iE2, /* Range of lines in p->aTo[] */ int *piSX, int *piEX, /* Write p->aFrom[] common segment here */ int *piSY, int *piEY /* Write p->aTo[] common segment here */ ){ - double bestScore = -1e30; /* Best score seen so far */ int i, j, k; /* Loop counters */ int n; /* Loop limit */ DLine *pA, *pB; /* Pointers to lines */ int iSX, iSY, iEX, iEY; /* Current match */ - double score; /* Current score */ - int skew; /* How lopsided is the match */ - int dist; /* Distance of match from center */ + int skew = 0; /* How lopsided is the match */ + int dist = 0; /* Distance of match from center */ int mid; /* Center of the span */ int iSXb, iSYb, iEXb, iEYb; /* Best match so far */ int iSXp, iSYp, iEXp, iEYp; /* Previous match */ - + sqlite3_int64 bestScore; /* Best score so far */ + sqlite3_int64 score; /* Score for current candidate LCS */ + int span; /* combined width of the input sequences */ + span = (iE1 - iS1) + (iE2 - iS2); + bestScore = -10000; + score = 0; iSXb = iSXp = iS1; iEXb = iEXp = iS1; iSYb = iSYp = iS2; iEYb = iEYp = iS2; mid = (iE1 + iS1)/2; @@ -1618,11 +1440,11 @@ iEY += k; skew = (iSX-iS1) - (iSY-iS2); if( skew<0 ) skew = -skew; dist = (iSX+iEX)/2 - mid; if( dist<0 ) dist = -dist; - score = (iEX - iSX) - 0.05*skew - 0.05*dist; + score = (iEX - iSX)*(sqlite3_int64)span - (skew + dist); if( score>bestScore ){ bestScore = score; iSXb = iSX; iSYb = iSY; iEXb = iEX; @@ -1642,12 +1464,10 @@ *piSX = iSXb; *piSY = iSYb; *piEX = iEXb; *piEY = iEYb; } - /* printf("LCS(%d..%d/%d..%d) = %d..%d/%d..%d\n", - iS1, iE1, iS2, iE2, *piSX, *piEX, *piSY, *piEY); */ } /* ** Expand the size of aEdit[] array to hold at least nEdit elements. */ @@ -1900,10 +1720,21 @@ int diff_width(u64 diffFlags){ int w = (diffFlags & DIFF_WIDTH_MASK)/(DIFF_CONTEXT_MASK+1); if( w==0 ) w = 80; return w; } + +/* +** Append the error message to pOut. +*/ +void diff_errmsg(Blob *pOut, const char *msg, int diffFlags){ + if( diffFlags & DIFF_HTML ){ + blob_appendf(pOut, "

    %s

    ", msg); + }else{ + blob_append(pOut, msg, -1); + } +} /* ** Generate a report of the differences between files pA and pB. ** If pOut is not NULL then a unified diff is appended there. It ** is assumed that pOut has already been initialized. If pOut is @@ -1942,18 +1773,33 @@ &c.nTo, ignoreEolWs); if( c.aFrom==0 || c.aTo==0 ){ fossil_free(c.aFrom); fossil_free(c.aTo); if( pOut ){ - blob_appendf(pOut, DIFF_CANNOT_COMPUTE_BINARY); + diff_errmsg(pOut, DIFF_CANNOT_COMPUTE_BINARY, diffFlags); } return 0; } /* Compute the difference */ diff_all(&c); - if( (diffFlags & DIFF_NOOPT)==0 ) diff_optimize(&c); + if( (diffFlags & DIFF_NOTTOOBIG)!=0 ){ + int i, m, n; + int *a = c.aEdit; + int mx = c.nEdit; + for(i=m=n=0; i10000 ){ + fossil_free(c.aFrom); + fossil_free(c.aTo); + fossil_free(c.aEdit); + diff_errmsg(pOut, DIFF_TOO_MANY_CHANGES, diffFlags); + return 0; + } + } + if( (diffFlags & DIFF_NOOPT)==0 ){ + diff_optimize(&c); + } if( pOut ){ /* Compute a context or side-by-side diff into pOut */ if( diffFlags & DIFF_SIDEBYSIDE ){ sbsDiff(&c, pOut, pRe, diffFlags); @@ -2050,10 +1896,11 @@ if( find_option("tk",0,0)!=0 ){ diff_tk("test-diff", 2); return; } find_option("i",0,0); + find_option("v",0,0); zRe = find_option("regexp","e",1); if( zRe ){ const char *zErr = re_compile(&pRe, zRe, 0); if( zErr ) fossil_fatal("regex error: %s", zErr); } @@ -2082,17 +1929,23 @@ struct Annotator { DContext c; /* The diff-engine context */ struct AnnLine { /* Lines of the original files... */ const char *z; /* The text of the line */ short int n; /* Number of bytes (omitting trailing space and \n) */ - short int iLevel; /* Level at which tag was set */ - const char *zSrc; /* Tag showing origin of this line */ + short int iVers; /* Level at which tag was set */ } *aOrig; int nOrig; /* Number of elements in aOrig[] */ - int nNoSrc; /* Number of entries where aOrig[].zSrc==NULL */ - int iLevel; /* Current level */ int nVers; /* Number of versions analyzed */ + int bLimit; /* True if the iLimit was reached */ + struct AnnVers { + const char *zFUuid; /* File being analyzed */ + const char *zMUuid; /* Check-in containing the file */ + const char *zDate; /* Date of the check-in */ + const char *zBgColor; /* Suggested background color */ + const char *zUser; /* Name of user who did the check-in */ + unsigned cnt; /* Number of lines contributed by this check-in */ + } *aVers; /* For each check-in analyzed */ char **azVers; /* Names of versions analyzed */ }; /* ** Initialize the annotation process by specifying the file that is @@ -2109,11 +1962,11 @@ } p->aOrig = fossil_malloc( sizeof(p->aOrig[0])*p->c.nTo ); for(i=0; ic.nTo; i++){ p->aOrig[i].z = p->c.aTo[i].z; p->aOrig[i].n = p->c.aTo[i].h & LENGTH_MASK; - p->aOrig[i].zSrc = 0; + p->aOrig[i].iVers = -1; } p->nOrig = p->c.nTo; return 0; } @@ -2122,15 +1975,13 @@ ** being annotated. Do another step of the annotation. Return true ** if additional annotation is required. zPName is the tag to insert ** on each line of the file being annotated that was contributed by ** pParent. Memory to hold zPName is leaked. */ -static int annotation_step(Annotator *p, Blob *pParent, char *zPName){ +static int annotation_step(Annotator *p, Blob *pParent, int iVers){ int i, j; int lnTo; - int iPrevLevel; - int iThisLevel; /* Prepare the parent file to be diffed */ p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent), &p->c.nFrom, 1); if( p->c.aFrom==0 ){ @@ -2140,24 +1991,21 @@ /* Compute the differences going from pParent to the file being ** annotated. */ diff_all(&p->c); /* Where new lines are inserted on this difference, record the - ** zPName as the source of the new line. + ** iVers as the source of the new line. */ - iPrevLevel = p->iLevel; - p->iLevel++; - iThisLevel = p->iLevel; for(i=lnTo=0; ic.nEdit; i+=3){ - struct AnnLine *x = &p->aOrig[lnTo]; - for(j=0; jc.aEdit[i]; j++, lnTo++, x++){ - if( x->zSrc==0 || x->iLevel==iPrevLevel ){ - x->zSrc = zPName; - x->iLevel = iThisLevel; + int nCopy = p->c.aEdit[i]; + int nIns = p->c.aEdit[i+2]; + lnTo += nCopy; + for(j=0; jaOrig[lnTo].iVers<0 ){ + p->aOrig[lnTo].iVers = iVers; } } - lnTo += p->c.aEdit[i+2]; } /* Clear out the diff results */ fossil_free(p->c.aEdit); p->c.aEdit = 0; @@ -2170,41 +2018,13 @@ /* Return no errors */ return 0; } -/* -** COMMAND: test-annotate-step -*/ -void test_annotate_step_cmd(void){ - Blob orig, b; - Annotator x; - int i; - - if( g.argc<4 ) usage("RID1 RID2 ..."); - db_must_be_within_tree(); - blob_zero(&b); - content_get(name_to_rid(g.argv[2]), &orig); - if( annotation_start(&x, &orig) ){ - fossil_fatal("binary file"); - } - for(i=3; icnt && db_step(&q)==SQLITE_ROW ){ - const char *zUuid = db_column_text(&q, 0); - const char *zDate = db_column_text(&q, 1); - const char *zUser = db_column_text(&q, 2); - int prevId = db_column_int(&q, 3); - if( webLabel ){ - zLabel = mprintf( - "%.10s %s %13.13s", - zUuid, zUuid, zDate, zUser - ); - }else{ - zLabel = mprintf("%.10s %s %13.13s", zUuid, zDate, zUser); + int prevId = db_column_int(&q, 4); + p->aVers = fossil_realloc(p->aVers, (p->nVers+1)*sizeof(p->aVers[0])); + p->aVers[p->nVers].zFUuid = fossil_strdup(db_column_text(&q, 0)); + p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); + p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); + p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); + if( p->nVers ){ + content_get(rid, &step); + annotation_step(p, &step, p->nVers-1); + blob_reset(&step); } p->nVers++; - p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) ); - p->azVers[p->nVers-1] = zLabel; - content_get(rid, &step); - annotation_step(p, &step, zLabel); - blob_reset(&step); + db_bind_int(&ins, ":rid", rid); + db_step(&ins); + db_reset(&ins); db_reset(&q); rid = prevId; db_bind_int(&q, ":rid", prevId); cnt++; } + p->bLimit = iLimit==cnt; db_finalize(&q); + db_finalize(&ins); + db_end_transaction(0); +} + +/* +** Return a color from a gradient. +*/ +unsigned gradient_color(unsigned c1, unsigned c2, int n, int i){ + unsigned c; /* Result color */ + unsigned x1, x2; + if( i==0 || n==0 ) return c1; + x1 = (c1>>16)&0xff; + x2 = (c2>>16)&0xff; + c = (x1*(n-i) + x2*i)/n<<16 & 0xff0000; + x1 = (c1>>8)&0xff; + x2 = (c2>>8)&0xff; + c |= (x1*(n-i) + x2*i)/n<<8 & 0xff00; + x1 = c1&0xff; + x2 = c2&0xff; + c |= (x1*(n-i) + x2*i)/n & 0xff; + return c; } /* ** WEBPAGE: annotate +** WEBPAGE: blame ** ** Query parameters: ** ** checkin=ID The manifest ID at which to start the annotation ** filename=FILENAME The filename. +** filevers Show file versions rather than check-in versions +** log=BOOLEAN Show a log of versions analyzed +** limit=N Limit the search depth to N ancestors */ void annotation_page(void){ int mid; int fnid; int i; - int iLimit; - int annFlags = 0; - int showLn = 0; /* True if line numbers should be shown */ - char zLn[10]; /* Line number buffer */ - char zFormat[10]; /* Format string for line numbers */ + int iLimit; /* Depth limit */ + int annFlags = ANN_FILE_ANCEST; + int showLog = 0; /* True to display the log */ + const char *zFilename; /* Name of file to annotate */ + const char *zCI; /* The check-in containing zFilename */ Annotator ann; + HQuery url; + struct AnnVers *p; + unsigned clr1, clr2, clr; + int bBlame = g.zPath[0]=='b';/* True for BLAME output. False for ANNOTATE. */ - showLn = P("ln")!=0; + /* Gather query parameters */ + showLog = atoi(PD("log","1")); login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } + if( exclude_spiders("annotate") ) return; mid = name_to_typed_rid(PD("checkin","0"),"ci"); - fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename")); + zFilename = P("filename"); + fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); if( mid==0 || fnid==0 ){ fossil_redirect_home(); } - iLimit = atoi(PD("limit","-1")); + iLimit = atoi(PD("limit","20")); + if( P("filevers") ) annFlags |= ANN_FILE_VERS; if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ fossil_redirect_home(); } - style_header("File Annotation"); - if( P("filevers") ) annFlags |= ANN_FILE_VERS; - annotate_file(&ann, fnid, mid, g.perm.Hyperlink, iLimit, annFlags); - if( P("log") ){ - int i; - @

    Versions analyzed:

    + + /* compute the annotation */ + compute_direct_ancestors(mid, 10000000); + annotate_file(&ann, fnid, mid, iLimit, annFlags); + zCI = ann.aVers[0].zMUuid; + + /* generate the web page */ + style_header("Annotation For %h", zFilename); + url_initialize(&url, "annotate"); + url_add_parameter(&url, "checkin", P("checkin")); + url_add_parameter(&url, "filename", zFilename); + if( iLimit!=20 ){ + url_add_parameter(&url, "limit", sqlite3_mprintf("%d", iLimit)); + } + url_add_parameter(&url, "log", showLog ? "1" : "0"); + if( showLog ){ + style_submenu_element("Hide Log", "Hide Log", + url_render(&url, "log", "0", 0, 0)); + }else{ + style_submenu_element("Show Log", "Show Log", + url_render(&url, "log", "1", 0, 0)); + } + if( ann.bLimit ){ + char *z1, *z2; + style_submenu_element("All Ancestors", "All Ancestors", + url_render(&url, "limit", "-1", 0, 0)); + z1 = sqlite3_mprintf("%d Ancestors", iLimit+20); + z2 = sqlite3_mprintf("%d", iLimit+20); + style_submenu_element(z1, z1, url_render(&url, "limit", z2, 0, 0)); + } + if( iLimit>20 ){ + style_submenu_element("20 Ancestors", "20 Ancestors", + url_render(&url, "limit", "20", 0, 0)); + } + if( db_get_boolean("white-foreground", 0) ){ + clr1 = 0xa04040; + clr2 = 0x4059a0; + }else{ + clr1 = 0xffb5b5; /* Recent changes: red (hot) */ + clr2 = 0xb5e0ff; /* Older changes: blue (cold) */ + } + for(p=ann.aVers, i=0; iAncestors of %z(zLink)%h(zFilename) analyzed: @
      - for(i=0; i%s(ann.azVers[i]) + for(p=ann.aVers, i=0; i%s(p->zDate) + @ check-in %z(href("%R/info/%S",p->zMUuid))%.10s(p->zMUuid) + @ artifact %z(href("%R/artifact/%S",p->zFUuid))%.10s(p->zFUuid) + @ +#if 0 + if( i>0 ){ + char *zLink = xhref("target='infowindow'", + "%R/fdiff?v1=%S&v2=%S&sbs=1", + p->zFUuid,ann.aVers[0].zFUuid); + @ %z(zLink)[diff-to-top] + if( i>1 ){ + zLink = xhref("target='infowindow'", + "%R/fdiff?v1=%S&v2=%S&sbs=1", + p->zFUuid,p[-1].zFUuid); + @ %z(zLink)[diff-to-previous] + } + } +#endif } @
    @
    - @

    Annotation:

    } - if( showLn ){ - sqlite3_snprintf(sizeof(zLn), zLn, "%d", ann.nOrig+1); - sqlite3_snprintf(sizeof(zFormat), zFormat, "%%%dd:", strlen(zLn)); + if( !ann.bLimit ){ + @

    Origin for each line in + @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename) + @ from check-in %z(href("%R/info/%S",zCI))%S(zCI):

    + iLimit = ann.nVers+10; }else{ - zLn[0] = 0; + @

    Lines added by the %d(iLimit) most recent ancestors of + @ %z(href("%R/finfo?name=%h&ci=%S", zFilename, zCI))%h(zFilename) + @ from check-in %z(href("%R/info/%S",zCI))%S(zCI):

    } @
       for(i=0; iann.nVers && iVers<0 ) iVers = ann.nVers-1;
    +
    +    if( bBlame ){
    +      if( iVers>=0 ){
    +        struct AnnVers *p = ann.aVers+iVers;
    +        char *zLink = xhref("target='infowindow'", "%R/info/%S", p->zMUuid);
    +        sqlite3_snprintf(sizeof(zPrefix), zPrefix,
    +             ""
    +             "%s%.10s %s %13.13s:",
    +             p->zBgColor, zLink, p->zMUuid, p->zDate, p->zUser);
    +        fossil_free(zLink);
    +      }else{
    +        sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%36s", "");
    +      }
    +    }else{
    +      if( iVers>=0 ){
    +        struct AnnVers *p = ann.aVers+iVers;
    +        char *zLink = xhref("target='infowindow'", "%R/info/%S", p->zMUuid);
    +        sqlite3_snprintf(sizeof(zPrefix), zPrefix,
    +             ""
    +             "%s%.10s %s %4d:",
    +             p->zBgColor, zLink, p->zMUuid, p->zDate, i+1);
    +        fossil_free(zLink);
    +      }else{
    +        sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%22s%4d:", "", i+1);
    +      }
    +    }
    +    @ %s(zPrefix) %h(z)
    +
       }
       @ 
    style_footer(); } /* ** COMMAND: annotate +** COMMAND: blame ** -** %fossil annotate ?OPTIONS? FILENAME +** %fossil (annotate|blame) ?OPTIONS? FILENAME ** ** Output the text of a file with markings to show when each line of -** the file was last modified. +** the file was last modified. The "annotate" command shows line numbers +** and omits the username. The "blame" command shows the user who made each +** checkin and omits the line number. ** ** Options: -** --limit N Only look backwards in time by N versions -** --log List all versions analyzed ** --filevers Show file version numbers rather than check-in versions +** -l|--log List all versions analyzed +** -n|--limit N Only look backwards in time by N versions ** ** See also: info, finfo, timeline */ void annotate_cmd(void){ int fnid; /* Filename ID */ @@ -2357,23 +2313,25 @@ int cid; /* Checkout ID */ Blob treename; /* FILENAME translated to canonical form */ char *zFilename; /* Canonical filename */ Annotator ann; /* The annotation of the file */ int i; /* Loop counter */ - const char *zLimit; /* The value to the --limit option */ + const char *zLimit; /* The value to the -n|--limit option */ int iLimit; /* How far back in time to look */ int showLog; /* True to show the log */ int fileVers; /* Show file version instead of check-in versions */ int annFlags = 0; /* Flags to control annotation properties */ + int bBlame = 0; /* True for BLAME output. False for ANNOTATE. */ - zLimit = find_option("limit",0,1); + bBlame = g.argv[1][0]=='b'; + zLimit = find_option("limit","n",1); if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; iLimit = atoi(zLimit); - showLog = find_option("log",0,0)!=0; + showLog = find_option("log","l",0)!=0; fileVers = find_option("filevers",0,0)!=0; db_must_be_within_tree(); - if (g.argc<3) { + if( g.argc<3 ) { usage("FILENAME"); } file_tree_name(g.argv[2], &treename, 1); zFilename = blob_str(&treename); fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename); @@ -2383,30 +2341,52 @@ fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename); if( fid==0 ){ fossil_fatal("not part of current checkout: %s", zFilename); } cid = db_lget_int("checkout", 0); - if (cid == 0){ + if( cid == 0 ){ fossil_fatal("Not in a checkout"); } if( iLimit<=0 ) iLimit = 1000000000; - compute_direct_ancestors(cid, iLimit); + compute_direct_ancestors(cid, 1000000); mid = db_int(0, "SELECT mlink.mid FROM mlink, ancestor " " WHERE mlink.fid=%d AND mlink.fnid=%d AND mlink.mid=ancestor.rid" " ORDER BY ancestor.generation ASC LIMIT 1", fid, fnid); if( mid==0 ){ - fossil_panic("unable to find manifest"); + fossil_fatal("unable to find manifest"); } - if( fileVers ) annFlags |= ANN_FILE_VERS; - annotate_file(&ann, fnid, mid, 0, iLimit, annFlags); + annFlags |= ANN_FILE_ANCEST; + annotate_file(&ann, fnid, mid, iLimit, annFlags); if( showLog ){ - for(i=0; izDate, p->zMUuid, p->zFUuid); } - printf("---------------------------------------------------\n"); + fossil_print("---------------------------------------------------\n"); } for(i=0; iann.nVers && iVers<0 ) iVers = ann.nVers-1; + p = ann.aVers + iVers; + if( bBlame ){ + if( iVers>=0 ){ + fossil_print("%.10s %s %13.13s: %.*s\n", + fileVers ? p->zFUuid : p->zMUuid, p->zDate, p->zUser, n, z); + }else{ + fossil_print("%35s %.*s\n", "", n, z); + } + }else{ + if( iVers>=0 ){ + fossil_print("%.10s %s %5d: %.*s\n", + fileVers ? p->zFUuid : p->zMUuid, p->zDate, i+1, n, z); + }else{ + fossil_print("%21s %5d: %.*s\n", + "", i+1, n, z); + } + } } } Index: src/diffcmd.c ================================================================== --- src/diffcmd.c +++ src/diffcmd.c @@ -320,11 +320,11 @@ int vid; Blob sql; Stmt q; int asNewFile; /* Treat non-existant files as empty files */ - asNewFile = (diffFlags & DIFF_NEWFILE)!=0; + asNewFile = (diffFlags & DIFF_VERBOSE)!=0; vid = db_lget_int("checkout", 0); vfile_check_signature(vid, CKSIG_ENOTFILE); blob_zero(&sql); db_begin_transaction(); if( zFrom ){ @@ -522,11 +522,11 @@ int fIncludeBinary, u64 diffFlags ){ Manifest *pFrom, *pTo; ManifestFile *pFromFile, *pToFile; - int asNewFlag = (diffFlags & DIFF_NEWFILE)!=0 ? 1 : 0; + int asNewFlag = (diffFlags & DIFF_VERBOSE)!=0 ? 1 : 0; pFrom = manifest_get_by_name(zFrom, 0); manifest_file_rewind(pFrom); pFromFile = manifest_file_next(pFrom,0); pTo = manifest_get_by_name(zTo, 0); @@ -597,51 +597,313 @@ return db_get(zName, zDefault); } /* A Tcl/Tk script used to render diff output. */ -static const char zDiffScript[] = +static const char zDiffScript[] = @ package require Tk -@ wm withdraw . -@ wm title . {Fossil Diff} -@ wm iconname . {Fossil Diff} -@ set body {} -@ set mx 80 ;# Length of the longest line of text -@ set nLine 0 ;# Number of lines of text -@ text .t -width 180 -yscroll {.sb set} -@ if {$tcl_platform(platform)=="windows"} {.t config -font {courier 9}} -@ .t tag config ln -foreground gray -@ .t tag config chng -background {#d0d0ff} -@ .t tag config add -background {#c0ffc0} -@ .t tag config rm -background {#ffc0c0} +@ +@ array set CFG { +@ TITLE {Fossil Diff} +@ LN_COL_BG #dddddd +@ LN_COL_FG #444444 +@ TXT_COL_BG #ffffff +@ TXT_COL_FG #000000 +@ MKR_COL_BG #444444 +@ MKR_COL_FG #dddddd +@ CHNG_BG #d0d0ff +@ ADD_BG #c0ffc0 +@ RM_BG #ffc0c0 +@ HR_FG #888888 +@ HR_PAD_TOP 4 +@ HR_PAD_BTM 8 +@ FN_BG #444444 +@ FN_FG #ffffff +@ FN_PAD 5 +@ PADX 5 +@ WIDTH 80 +@ HEIGHT 45 +@ LB_HEIGHT 25 +@ } +@ +@ if {![namespace exists ttk]} { +@ interp alias {} ::ttk::scrollbar {} ::scrollbar +@ interp alias {} ::ttk::menubutton {} ::menubutton +@ } +@ @ proc dehtml {x} { +@ set x [regsub -all {<[^>]*>} $x {}] @ return [string map {& & < < > > ' ' " \"} $x] @ } -@ # puts $cmd -@ set in [open $cmd r] -@ while {![eof $in]} { -@ set line [gets $in] -@ if {[regexp {^} $line]} continue -@ if {[regexp {^===} $line]} { -@ set n [string length $line] -@ if {$n>$mx} {set mx $n} -@ } -@ incr nLine -@ while {[regexp {^(.*?)(.*?)(.*)$} $line \ -@ all pre class mid tail]} { -@ .t insert end [dehtml $pre] {} [dehtml $mid] $class -@ set line $tail -@ } -@ .t insert end [dehtml $line]\n {} -@ } -@ close $in -@ if {$mx>250} {set mx 250} ;# Limit window width to 200 characters -@ if {$nLine>55} {set nLine 55} ;# Limit window height to 55 lines -@ .t config -height $nLine -width $mx -@ pack .t -side left -fill both -expand 1 -@ scrollbar .sb -command {.t yview} -orient vertical -@ pack .sb -side left -fill y +@ +@ proc cols {} { +@ return [list .lnA .txtA .mkr .lnB .txtB] +@ } +@ +@ proc colType {c} { +@ regexp {[a-z]+} $c type +@ return $type +@ } +@ +@ proc readDiffs {fossilcmd} { +@ set in [open $fossilcmd r] +@ fconfigure $in -encoding utf-8 +@ set nDiffs 0 +@ array set widths {txt 0 ln 0 mkr 0} +@ while {[gets $in line] != -1} { +@ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} { +@ continue +@ } +@ if {[string compare -length 6 [gets $in] " 1 ? [.txtA index end] : "1.0"}] +@ .wfiles.lb insert end $fn +@ +@ foreach c [cols] { +@ while {[gets $in] ne "
    "} continue
    +@       
    +@       if {$nDiffs > 1} {
    +@         $c insert end \n -
    +@       }
    +@       if {[colType $c] eq "txt"} {
    +@         $c insert end $fn\n fn
    +@       } else {
    +@         $c insert end \n fn
    +@       }
    +@       $c insert end \n -
    +@        
    +@       set type [colType $c]
    +@       set str {}
    +@       while {[set line [gets $in]] ne "
    "} { +@ set len [string length [dehtml $line]] +@ if {$len > $widths($type)} { +@ set widths($type) $len +@ } +@ append str $line\n +@ } +@ +@ set re {([^<]*)} +@ # Use \r as separator since it can't appear in the diff output (it gets +@ # converted to a space). +@ set str [regsub -all $re $str "\r\\1\r\\2\r"] +@ foreach {pre class mid} [split $str \r] { +@ if {$class ne ""} { +@ $c insert end [dehtml $pre] - [dehtml $mid] [list $class -] +@ } else { +@ $c insert end [dehtml $pre] - +@ } +@ } +@ } +@ } +@ close $in +@ +@ foreach c [cols] { +@ set type [colType $c] +@ if {$type ne "txt"} { +@ $c config -width $widths($type) +@ } +@ $c config -state disabled +@ } +@ if {$nDiffs <= [.wfiles.lb cget -height]} { +@ .wfiles.lb config -height $nDiffs +@ grid remove .wfiles.sb +@ } +@ +@ return $nDiffs +@ } +@ +@ proc viewDiff {idx} { +@ .txtA yview $idx +@ .txtA xview moveto 0 +@ } +@ +@ proc cycleDiffs {{reverse 0}} { +@ if {$reverse} { +@ set range [.txtA tag prevrange fn @0,0 1.0] +@ if {$range eq ""} { +@ viewDiff {fn.last -1c} +@ } else { +@ viewDiff [lindex $range 0] +@ } +@ } else { +@ set range [.txtA tag nextrange fn {@0,0 +1c} end] +@ if {$range eq "" || [lindex [.txtA yview] 1] == 1} { +@ viewDiff fn.first +@ } else { +@ viewDiff [lindex $range 0] +@ } +@ } +@ } +@ +@ proc xvis {col} { +@ set view [$col xview] +@ return [expr {[lindex $view 1]-[lindex $view 0]}] +@ } +@ +@ proc scroll-x {args} { +@ set c .txt[expr {[xvis .txtA] < [xvis .txtB] ? "A" : "B"}] +@ eval $c xview $args +@ } +@ +@ interp alias {} scroll-y {} .txtA yview +@ +@ proc noop {args} {} +@ +@ proc enableSync {axis} { +@ update idletasks +@ interp alias {} sync-$axis {} +@ rename _sync-$axis sync-$axis +@ } +@ +@ proc disableSync {axis} { +@ rename sync-$axis _sync-$axis +@ interp alias {} sync-$axis {} noop +@ } +@ +@ proc sync-x {col first last} { +@ disableSync x +@ $col xview moveto [expr {$first*[xvis $col]/($last-$first)}] +@ foreach side {A B} { +@ set sb .sbx$side +@ set xview [.txt$side xview] +@ if {[lindex $xview 0] > 0 || [lindex $xview 1] < 1} { +@ grid $sb +@ eval $sb set $xview +@ } else { +@ grid remove $sb +@ } +@ } +@ enableSync x +@ } +@ +@ proc sync-y {first last} { +@ disableSync y +@ foreach c [cols] { +@ $c yview moveto $first +@ } +@ if {$first > 0 || $last < 1} { +@ grid .sby +@ .sby set $first $last +@ } else { +@ grid remove .sby +@ } +@ enableSync y +@ } +@ +@ wm withdraw . +@ wm title . $CFG(TITLE) +@ wm iconname . $CFG(TITLE) +@ bind . exit +@ bind . {cycleDiffs; break} +@ bind . <> {cycleDiffs 1; break} +@ bind . { +@ event generate .files <1> +@ event generate .files +@ break +@ } +@ foreach {key axis args} { +@ Up y {scroll -5 units} +@ Down y {scroll 5 units} +@ Left x {scroll -5 units} +@ Right x {scroll 5 units} +@ Prior y {scroll -1 page} +@ Next y {scroll 1 page} +@ Home y {moveto 0} +@ End y {moveto 1} +@ } { +@ bind . <$key> "scroll-$axis $args; break" +@ bind . continue +@ } +@ +@ ::ttk::menubutton .files -text "Files" +@ toplevel .wfiles +@ wm withdraw .wfiles +@ update idletasks +@ wm transient .wfiles . +@ wm overrideredirect .wfiles 1 +@ listbox .wfiles.lb -width 0 -height $CFG(LB_HEIGHT) -activestyle none \ +@ -yscroll {.wfiles.sb set} +@ ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} +@ grid .wfiles.lb .wfiles.sb -sticky ns +@ bind .files <1> { +@ set x [winfo rootx %W] +@ set y [expr {[winfo rooty %W]+[winfo height %W]}] +@ wm geometry .wfiles +$x+$y +@ wm deiconify .wfiles +@ focus .wfiles.lb +@ } +@ bind .wfiles {wm withdraw .wfiles} +@ bind .wfiles {focus .} +@ foreach evt {1 Return} { +@ bind .wfiles.lb <$evt> { +@ catch { +@ set idx [lindex [.txtA tag ranges fn] [expr {[%W curselection]*2}]] +@ viewDiff $idx +@ } +@ focus . +@ break +@ } +@ } +@ bind .wfiles.lb { +@ %W selection clear 0 end +@ %W selection set @%x,%y +@ } +@ +@ foreach {side syncCol} {A .txtB B .txtA} { +@ set ln .ln$side +@ text $ln +@ $ln tag config - -justify right +@ +@ set txt .txt$side +@ text $txt -width $CFG(WIDTH) -height $CFG(HEIGHT) -wrap none \ +@ -xscroll "sync-x $syncCol" +@ catch {$txt config -tabstyle wordprocessor} ;# Required for Tk>=8.5 +@ foreach tag {add rm chng} { +@ $txt tag config $tag -background $CFG([string toupper $tag]_BG) +@ $txt tag lower $tag +@ } +@ $txt tag config fn -background $CFG(FN_BG) -foreground $CFG(FN_FG) \ +@ -justify center +@ } +@ text .mkr +@ +@ foreach c [cols] { +@ set keyPrefix [string toupper [colType $c]]_COL_ +@ if {[tk windowingsystem] eq "win32"} {$c config -font {courier 9}} +@ $c config -bg $CFG(${keyPrefix}BG) -fg $CFG(${keyPrefix}FG) -borderwidth 0 \ +@ -padx $CFG(PADX) -yscroll sync-y +@ $c tag config hr -spacing1 $CFG(HR_PAD_TOP) -spacing3 $CFG(HR_PAD_BTM) \ +@ -foreground $CFG(HR_FG) +@ $c tag config fn -spacing1 $CFG(FN_PAD) -spacing3 $CFG(FN_PAD) +@ bindtags $c ". $c Text all" +@ bind $c <1> {focus %W} +@ } +@ +@ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical +@ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal +@ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal +@ frame .spacer +@ +@ if {[readDiffs $fossilcmd] == 0} { +@ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" +@ exit +@ } +@ update idletasks +@ +@ grid rowconfigure . 1 -weight 1 +@ grid columnconfigure . 1 -weight 1 +@ grid columnconfigure . 4 -weight 1 +@ grid .files -row 0 -columnspan 6 +@ eval grid [cols] -row 1 -sticky nsew +@ grid .sby -row 1 -column 5 -sticky ns +@ grid .sbxA -row 2 -columnspan 2 -sticky ew +@ grid .spacer -row 2 -column 2 +@ grid .sbxB -row 2 -column 3 -columnspan 2 -sticky ew +@ +@ .spacer config -height [winfo height .sbxA] @ wm deiconify . ; /* ** Show diff output in a Tcl/Tk window, in response to the --tk option @@ -653,31 +915,45 @@ ** (3) Delete the temp file. */ void diff_tk(const char *zSubCmd, int firstArg){ int i; Blob script; - char *zTempFile; + char *zTempFile = 0; char *zCmd; blob_zero(&script); - blob_appendf(&script, "set cmd {| \"%/\" %s --html -y -i", + blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", g.nameOfExe, zSubCmd); for(i=firstArg; i10000 ){ db_multi_exec("DELETE FROM vcache"); } - pM = manifest_get(vid, CFTYPE_MANIFEST); + pM = manifest_get(vid, CFTYPE_MANIFEST, 0); if( pM==0 ){ goto doc_not_found; } db_prepare(&s, "INSERT INTO vcache(vid,fname,rid)" @@ -494,23 +496,21 @@ Th_Store("doc_name", zName); 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)); - if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ + if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ Blob title, tail; if( wiki_find_title(&filebody, &title, &tail) ){ style_header(blob_str(&title)); wiki_convert(&tail, 0, WIKI_BUTTONS); }else{ style_header("Documentation"); wiki_convert(&filebody, 0, WIKI_BUTTONS); } style_footer(); -#ifdef FOSSIL_ENABLE_MARKDOWN - }else if( fossil_strcmp(zMime, "text/x-markdown")==0 - && db_get_boolean("markdown", 0) ){ + }else if( fossil_strcmp(zMime, "text/x-markdown")==0 ){ Blob title = BLOB_INITIALIZER; Blob tail = BLOB_INITIALIZER; markdown_to_html(&filebody, &title, &tail); if( blob_size(&title)>0 ){ style_header(blob_str(&title)); @@ -517,11 +517,10 @@ }else{ style_header("Documentation"); } blob_append(cgi_output_blob(), blob_buffer(&tail), blob_size(&tail)); style_footer(); -#endif }else if( fossil_strcmp(zMime, "text/plain")==0 ){ style_header("Documentation"); @
         @ %h(blob_str(&filebody))
         @ 
    Index: src/encode.c ================================================================== --- src/encode.c +++ src/encode.c @@ -161,10 +161,11 @@ zOut[i++] = "0123456789ABCDEF"[c&0xf]; } zIn++; } zOut[i] = 0; +#undef IsSafeChar return zOut; } /* ** Convert the input string into a form that is suitable for use as Index: src/event.c ================================================================== --- src/event.c +++ src/event.c @@ -21,13 +21,13 @@ ** Blog posts ** New articles ** Process checkpoints ** Announcements */ +#include "config.h" #include #include -#include "config.h" #include "event.h" /* ** Output a hyperlink to an event given its tagid. */ @@ -43,29 +43,30 @@ ** WEBPAGE: event ** URL: /event ** PARAMETERS: ** ** name=EVENTID // Identify the event to display EVENTID must be complete -** detail=BOOLEAN // Show details if TRUE. Default is FALSE. Optional. ** aid=ARTIFACTID // Which specific version of the event. Optional. +** v=BOOLEAN // Show details if TRUE. Default is FALSE. Optional. ** ** Display an existing event identified by EVENTID */ void event_page(void){ int rid = 0; /* rid of the event artifact */ char *zUuid; /* UUID corresponding to rid */ const char *zEventId; /* Event identifier */ + const char *zVerbose; /* Value of verbose option */ char *zETime; /* Time of the event */ char *zATime; /* Time the artifact was created */ int specRid; /* rid specified by aid= parameter */ int prevRid, nextRid; /* Previous or next edits of this event */ Manifest *pEvent; /* Parsed event artifact */ Blob fullbody; /* Complete content of the event body */ Blob title; /* Title extracted from the event body */ Blob tail; /* Event body that comes after the title */ Stmt q1; /* Query to search for the event */ - int showDetail; /* True to show details */ + int verboseFlag; /* True to show details */ /* wiki-read privilege is needed in order to read events. */ login_check_credentials(); @@ -101,17 +102,24 @@ @ Cannot locate specified event style_footer(); return; } zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); - showDetail = atoi(PD("detail","0")); + zVerbose = P("v"); + if( !zVerbose ){ + zVerbose = P("verbose"); + } + if( !zVerbose ){ + zVerbose = P("detail"); /* deprecated */ + } + verboseFlag = (zVerbose!=0) && !is_false(zVerbose); /* Extract the event content. */ - pEvent = manifest_get(rid, CFTYPE_EVENT); + pEvent = manifest_get(rid, CFTYPE_EVENT, 0); if( pEvent==0 ){ - fossil_panic("Object #%d is not an event", rid); + fossil_fatal("Object #%d is not an event", rid); } blob_init(&fullbody, pEvent->zWiki, -1); if( wiki_find_title(&fullbody, &title, &tail) ){ style_header(blob_str(&title)); }else{ @@ -124,37 +132,37 @@ } zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate); style_submenu_element("Context", "Context", "%s/timeline?c=%T", g.zTop, zETime); if( g.perm.Hyperlink ){ - if( showDetail ){ + if( verboseFlag ){ style_submenu_element("Plain", "Plain", "%s/event?name=%s&aid=%s", g.zTop, zEventId, zUuid); if( nextRid ){ char *zNext; zNext = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nextRid); style_submenu_element("Next", "Next", - "%s/event?name=%s&aid=%s&detail=1", + "%s/event?name=%s&aid=%s&v", g.zTop, zEventId, zNext); free(zNext); } if( prevRid ){ char *zPrev; zPrev = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", prevRid); style_submenu_element("Prev", "Prev", - "%s/event?name=%s&aid=%s&detail=1", + "%s/event?name=%s&aid=%s&v", g.zTop, zEventId, zPrev); free(zPrev); } }else{ style_submenu_element("Detail", "Detail", - "%s/event?name=%s&aid=%s&detail=1", + "%s/event?name=%s&aid=%s&v", g.zTop, zEventId, zUuid); } } - if( showDetail && g.perm.Hyperlink ){ + if( verboseFlag && g.perm.Hyperlink ){ int i; const char *zClr = 0; Blob comment; zATime = db_text(0, "SELECT datetime(%.17g)", pEvent->rDate); @@ -249,11 +257,11 @@ /* If editing an existing event, extract the key fields to use as ** a starting point for the edit. */ if( rid && (zBody==0 || zETime==0 || zComment==0 || zTags==0) ){ Manifest *pEvent; - pEvent = manifest_get(rid, CFTYPE_EVENT); + pEvent = manifest_get(rid, CFTYPE_EVENT, 0); if( pEvent && pEvent->type==CFTYPE_EVENT ){ if( zBody==0 ) zBody = pEvent->zWiki; if( zETime==0 ){ zETime = db_text(0, "SELECT datetime(%.17g)", pEvent->rEventDate); } @@ -272,15 +280,20 @@ } zETime = db_text(0, "SELECT coalesce(datetime(%Q),datetime('now'))", zETime); if( P("submit")!=0 && (zBody!=0 && zComment!=0) ){ char *zDate; Blob cksum; - int nrid; + int nrid, n; blob_zero(&event); db_begin_transaction(); login_verify_csrf_secret(); - blob_appendf(&event, "C %F\n", zComment); + while( fossil_isspace(zComment[0]) ) zComment++; + n = strlen(zComment); + while( n>0 && fossil_isspace(zComment[n-1]) ){ n--; } + if( n>0 ){ + blob_appendf(&event, "C %#F\n", n, zComment); + } zDate = date_in_standard_format("now"); blob_appendf(&event, "D %s\n", zDate); free(zDate); zETime[10] = 'T'; blob_appendf(&event, "E %s %s\n", zETime, zEventId); @@ -391,32 +404,32 @@ @
    login_insert_csrf_secret(); @ @ - @ + @ @ - @ + @ @ - @ + @ @ - @ + @ @ - @ + @ @ Index: src/export.c ================================================================== --- src/export.c +++ src/export.c @@ -138,11 +138,11 @@ char line[100]; FILE *f; f = fossil_fopen(markfile_in, "r"); if( f==0 ){ - fossil_panic("cannot open %s for reading", markfile_in); + fossil_fatal("cannot open %s for reading", markfile_in); } db_prepare(&qb, "INSERT OR IGNORE INTO oldblob VALUES (:rid)"); db_prepare(&qc, "INSERT OR IGNORE INTO oldcommit VALUES (:rid)"); while( fgets(line, sizeof(line), f)!=0 ){ if( *line == 'b' ){ @@ -154,11 +154,11 @@ db_bind_text(&qc, ":rid", line + 1); db_step(&qc); db_reset(&qc); bag_insert(&vers, atoi(line + 1)); }else{ - fossil_panic("bad input from %s: %s", markfile_in, line); + fossil_fatal("bad input from %s: %s", markfile_in, line); } } db_finalize(&qb); db_finalize(&qc); fclose(f); @@ -335,11 +335,11 @@ if( markfile_out!=0 ){ FILE *f; f = fossil_fopen(markfile_out, "w"); if( f == 0 ){ - fossil_panic("cannot open %s for writing", markfile_out); + fossil_fatal("cannot open %s for writing", markfile_out); } db_prepare(&q, "SELECT rid FROM oldblob"); while( db_step(&q)==SQLITE_ROW ){ fprintf(f, "b%d\n", db_column_int(&q, 0)); } @@ -348,9 +348,9 @@ while( db_step(&q)==SQLITE_ROW ){ fprintf(f, "c%d\n", db_column_int(&q, 0)); } db_finalize(&q); if( ferror(f)!=0 || fclose(f)!=0 ) { - fossil_panic("error while writing %s", markfile_out); + fossil_fatal("error while writing %s", markfile_out); } } } Index: src/file.c ================================================================== --- src/file.c +++ src/file.c @@ -39,47 +39,62 @@ # include #else # include #endif -/* -** The file status information from the most recent stat() call. -** -** Use _stati64 rather than stat on windows, in order to handle files -** larger than 2GB. -*/ +#if INTERFACE + +#include +#if defined(_WIN32) +# define DIR _WDIR +# define dirent _wdirent +# define opendir _wopendir +# define readdir _wreaddir +# define closedir _wclosedir +#endif /* _WIN32 */ + #if defined(_WIN32) && (defined(__MSVCRT__) || defined(_MSC_VER)) -# undef stat -# define stat _stati64 +struct fossilStat { + i64 st_size; + i64 st_mtime; + int st_mode; +}; +#endif + +#endif /* INTERFACE */ + +#if !defined(_WIN32) || !(defined(__MSVCRT__) || defined(_MSC_VER)) +# define fossilStat stat #endif + /* ** On Windows S_ISLNK always returns FALSE. */ #if !defined(S_ISLNK) # define S_ISLNK(x) (0) #endif static int fileStatValid = 0; -static struct stat fileStat; +static struct fossilStat fileStat; /* ** Fill stat buf with information received from stat() or lstat(). ** lstat() is called on Unix if isWd is TRUE and allow-symlinks setting is on. ** */ -static int fossil_stat(const char *zFilename, struct stat *buf, int isWd){ +static int fossil_stat(const char *zFilename, struct fossilStat *buf, int isWd){ #if !defined(_WIN32) + int rc; + char *zMbcs = fossil_utf8_to_filename(zFilename); if( isWd && g.allowSymlinks ){ - return lstat(zFilename, buf); + rc = lstat(zMbcs, buf); }else{ - return stat(zFilename, buf); + rc = stat(zMbcs, buf); } + fossil_filename_free(zMbcs); + return rc; #else - int rc = 0; - wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename); - rc = _wstati64(zMbcs, buf); - fossil_unicode_free(zMbcs); - return rc; + return win32_stat(zFilename, buf, isWd); #endif } /* ** Fill in the fileStat variable for the file named zFilename. @@ -191,15 +206,14 @@ return; } zName[i] = '/'; } } - if( zName!=zBuf ) free(zName); - if( symlink(zTargetFile, zName)!=0 ){ fossil_fatal_recursive("unable to create symlink \"%s\"", zName); } + if( zName!=zBuf ) free(zName); }else #endif { Blob content; blob_set(&content, zTargetFile); @@ -303,17 +317,37 @@ /* ** Wrapper around the access() system call. */ int file_access(const char *zFilename, int flags){ #ifdef _WIN32 - wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename); - int rc = _waccess(zMbcs, flags); - fossil_unicode_free(zMbcs); + return win32_access(zFilename, flags); +#else + char *zMbcs = fossil_utf8_to_filename(zFilename); + int rc = access(zMbcs, flags); + fossil_filename_free(zMbcs); + return rc; +#endif +} + +/* +** Wrapper around the chdir() system call. +** If bChroot=1, do a chroot to this dir as well +** (UNIX only) +*/ +int file_chdir(const char *zChDir, int bChroot){ +#ifdef _WIN32 + return win32_chdir(zChDir, bChroot); #else - int rc = access(zFilename, flags); -#endif + char *zPath = fossil_utf8_to_filename(zChDir); + int rc = chdir(zPath); + if( !rc && bChroot ){ + rc = chroot(zPath); + if( !rc ) rc = chdir("/"); + } + fossil_filename_free(zPath); return rc; +#endif } /* ** Find an unused filename similar to zBase with zSuffix appended. ** @@ -398,23 +432,25 @@ /* ** Set the mtime for a file. */ void file_set_mtime(const char *zFilename, i64 newMTime){ #if !defined(_WIN32) + char *zMbcs; struct timeval tv[2]; memset(tv, 0, sizeof(tv[0])*2); tv[0].tv_sec = newMTime; tv[1].tv_sec = newMTime; - utimes(zFilename, tv); + zMbcs = fossil_utf8_to_filename(zFilename); + utimes(zMbcs, tv); #else struct _utimbuf tb; - wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename); + wchar_t *zMbcs = fossil_utf8_to_filename(zFilename); tb.actime = newMTime; tb.modtime = newMTime; _wutime(zMbcs, &tb); - fossil_unicode_free(zMbcs); #endif + fossil_filename_free(zMbcs); } /* ** COMMAND: test-set-mtime ** @@ -438,19 +474,24 @@ fossil_print("Set mtime of \"%s\" to %s (%lld)\n", zFile, zDate, iMTime); } /* ** Delete a file. +** +** Returns zero upon success. */ -void file_delete(const char *zFilename){ +int file_delete(const char *zFilename){ + int rc; #ifdef _WIN32 - wchar_t *z = fossil_utf8_to_unicode(zFilename); - _wunlink(z); - fossil_unicode_free(z); + wchar_t *z = fossil_utf8_to_filename(zFilename); + rc = _wunlink(z); #else - unlink(zFilename); + char *z = fossil_utf8_to_filename(zFilename); + rc = unlink(zFilename); #endif + fossil_filename_free(z); + return rc; } /* ** Create the directory named in the argument, if it does not already ** exist. If forceFlag is 1, delete any prior non-directory object @@ -464,18 +505,41 @@ if( !forceFlag ) return 1; file_delete(zName); } if( rc!=1 ){ #if defined(_WIN32) - int rc; - wchar_t *zMbcs = fossil_utf8_to_unicode(zName); + wchar_t *zMbcs = fossil_utf8_to_filename(zName); rc = _wmkdir(zMbcs); - fossil_unicode_free(zMbcs); +#else + char *zMbcs = fossil_utf8_to_filename(zName); + rc = mkdir(zName, 0755); +#endif + fossil_filename_free(zMbcs); return rc; + } + return 0; +} + +/* +** 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_wd_isdir(zName); + if( rc==2 ) return 1; /* cannot remove normal file */ + if( rc==1 ){ +#if defined(_WIN32) + wchar_t *zMbcs = fossil_utf8_to_filename(zName); + rc = _wrmdir(zMbcs); #else - return mkdir(zName, 0755); + char *zMbcs = fossil_utf8_to_filename(zName); + rc = rmdir(zName); #endif + fossil_filename_free(zMbcs); + return rc; } return 0; } /* @@ -580,11 +644,11 @@ } /* ** Simplify a filename by ** -** * Convert all \ into / on windows +** * Convert all \ into / on windows and cygwin ** * removing any trailing and duplicate / ** * removing /./ ** * removing /A/../ ** ** Changes are made in-place. Return the new name length. @@ -593,12 +657,12 @@ */ int file_simplify_name(char *z, int n, int slash){ int i, j; if( n<0 ) n = strlen(z); - /* On windows convert all \ characters to / */ -#if defined(_WIN32) + /* On windows and cygwin convert all \ characters to / */ +#if defined(_WIN32) || defined(__CYGWIN__) for(i=0; i nBuf-1 ){ - fossil_fatal("pwd too big: max %d\n", nBuf-1); - } - for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/'; - memcpy(zBuf, zPwdUtf8, nPwd+1); - fossil_filename_free(zPwdUtf8); + win32_getcwd(zBuf, nBuf); #else if( getcwd(zBuf, nBuf-1)==0 ){ if( errno==ERANGE ){ fossil_fatal("pwd too big: max %d\n", nBuf-1); }else{ @@ -705,13 +755,13 @@ ** Return true if zPath is an absolute pathname. Return false ** if it is relative. */ int file_is_absolute_path(const char *zPath){ if( zPath[0]=='/' -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) || zPath[0]=='\\' - || (strlen(zPath)>3 && zPath[1]==':' + || (fossil_isalpha(zPath[0]) && zPath[1]==':' && (zPath[2]=='\\' || zPath[2]=='/')) #endif ){ return 1; }else{ @@ -728,21 +778,21 @@ ** If the slash parameter is non-zero, the trailing slash, if any, ** is retained. */ void file_canonical_name(const char *zOrigName, Blob *pOut, int slash){ if( file_is_absolute_path(zOrigName) ){ -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) char *zOut; #endif blob_set(pOut, zOrigName); blob_materialize(pOut); -#if defined(_WIN32) +#if defined(_WIN32) || defined(__CYGWIN__) /* - ** On Windows, normalize the drive letter to upper case. + ** On Windows/cygwin, normalize the drive letter to upper case. */ zOut = blob_str(pOut); - if( fossil_isalpha(zOut[0]) && zOut[1]==':' ){ + if( fossil_islower(zOut[0]) && zOut[1]==':' ){ zOut[0] = fossil_toupper(zOut[0]); } #endif }else{ char zPwd[2000]; @@ -749,11 +799,11 @@ file_getcwd(zPwd, sizeof(zPwd)-strlen(zOrigName)); #if defined(_WIN32) /* ** On Windows, normalize the drive letter to upper case. */ - if( fossil_isalpha(zPwd[0]) && zPwd[1]==':' ){ + if( fossil_islower(zPwd[0]) && zPwd[1]==':' ){ zPwd[0] = fossil_toupper(zPwd[0]); } #endif blob_zero(pOut); blob_appendf(pOut, "%//%/", zPwd, zOrigName); @@ -770,15 +820,16 @@ ** Also test Fossil's ability to measure attributes of a file. */ void cmd_test_canonical_name(void){ int i; Blob x; + int slashFlag = find_option("slash",0,0)!=0; blob_zero(&x); for(i=2; i [%s]\n", zName, blob_buffer(&x)); blob_reset(&x); sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName)); fossil_print(" file_size = %s\n", zBuf); sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName)); @@ -798,12 +849,12 @@ ** contain no "/./" or "/../" terms. */ int file_is_canonical(const char *z){ int i; if( z[0]!='/' -#if defined(_WIN32) - && (z[0]==0 || z[1]!=':' || z[2]!='/') +#if defined(_WIN32) || defined(__CYGWIN__) + && (!fossil_isupper(z[0]) || z[1]!=':' || z[2]!='/') #endif ) return 0; for(i=0; z[i]; i++){ if( z[i]=='\\' ) return 0; @@ -846,27 +897,31 @@ char zBuf[2000]; zPwd = zBuf; file_getcwd(zBuf, sizeof(zBuf)-20); zPwd = file_without_drive_letter(zBuf); i = 1; -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++; #else while( zPath[i] && zPwd[i]==zPath[i] ) i++; #endif if( zPath[i]==0 ){ - blob_reset(pOut); + memcpy(&tmp, pOut, sizeof(tmp)); if( zPwd[i]==0 ){ - blob_append(pOut, ".", 1); + blob_set(pOut, "."); }else{ - blob_append(pOut, "..", 2); + blob_set(pOut, ".."); for(j=i+1; zPwd[j]; j++){ if( zPwd[j]=='/' ){ blob_append(pOut, "/..", 3); } } } + if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){ + blob_append(pOut, "/", 1); + } + blob_reset(&tmp); return; } if( zPwd[i]==0 && zPath[i]=='/' ){ memcpy(&tmp, pOut, sizeof(tmp)); blob_set(pOut, "./"); @@ -893,13 +948,14 @@ ** Test the operation of the relative name generator. */ void cmd_test_relative_name(void){ int i; Blob x; + int slashFlag = find_option("slash",0,0)!=0; blob_zero(&x); for(i=2; i0 && zLocalRoot[nLocalRoot-1]=='/' ); file_canonical_name(zOrigName, &full, 0); nFull = blob_size(&full); zFull = blob_buffer(&full); + if( filenames_are_case_sensitive() ){ + xCmp = fossil_strncmp; + }else{ + xCmp = fossil_strnicmp; + } /* Special case. zOrigName refers to g.zLocalRoot directory. */ - if( nFull==nLocalRoot-1 && memcmp(zLocalRoot, zFull, nFull)==0 ){ + if( nFull==nLocalRoot-1 && xCmp(zLocalRoot, zFull, nFull)==0 ){ blob_append(pOut, ".", 1); blob_reset(&localRoot); blob_reset(&full); return 1; } - if( nFull<=nLocalRoot || memcmp(zLocalRoot, zFull, nLocalRoot) ){ + if( nFull<=nLocalRoot || xCmp(zLocalRoot, zFull, nLocalRoot) ){ blob_reset(&localRoot); blob_reset(&full); if( errFatal ){ fossil_fatal("file outside of checkout tree: %s", zOrigName); } @@ -953,15 +1015,20 @@ /* ** COMMAND: test-tree-name ** ** Test the operation of the tree name generator. +** +** Options: +** --case-sensitive B Enable or disable case-sensitive filenames. B is +** a boolean: "yes", "no", "true", "false", etc. */ void cmd_test_tree_name(void){ int i; Blob x; blob_zero(&x); + capture_case_sensitive_option(); for(i=2; i=0 ); #if defined(_WIN32) - fossil_unicode_free((char *)azDirs[1]); - fossil_unicode_free((char *)azDirs[2]); + fossil_filename_free((char *)azDirs[0]); + fossil_filename_free((char *)azDirs[1]); + fossil_filename_free((char *)azDirs[2]); #endif } /* @@ -1099,26 +1170,10 @@ rc = blob_compare(&onDisk, pContent); blob_reset(&onDisk); return rc==0; } -/* -** Portable unicode implementation of opendir() -*/ -#if INTERFACE - -#include -#if defined(_WIN32) -# define DIR _WDIR -# define dirent _wdirent -# define opendir _wopendir -# define readdir _wreaddir -# define closedir _wclosedir -#endif /* _WIN32 */ - -#endif /* INTERFACE */ - /* ** Return the value of an environment variable as UTF8. ** Use fossil_filename_free() to release resources. */ char *fossil_getenv(const char *zName){ @@ -1137,14 +1192,14 @@ ** Like fopen() but always takes a UTF8 argument. */ FILE *fossil_fopen(const char *zName, const char *zMode){ #ifdef _WIN32 wchar_t *uMode = fossil_utf8_to_unicode(zMode); - wchar_t *uName = fossil_utf8_to_unicode(zName); + wchar_t *uName = fossil_utf8_to_filename(zName); FILE *f = _wfopen(uName, uMode); - fossil_unicode_free(uName); + fossil_filename_free(uName); fossil_unicode_free(uMode); #else FILE *f = fopen(zName, zMode); #endif return f; } Index: src/finfo.c ================================================================== --- src/finfo.c +++ src/finfo.c @@ -20,18 +20,18 @@ #include "config.h" #include "finfo.h" /* ** COMMAND: finfo -** +** ** Usage: %fossil finfo ?OPTIONS? FILENAME ** ** Print the complete change history for a single file going backwards ** in time. The default mode is -l. ** ** For the -l|--log mode: If "-b|--brief" is specified one line per revision -** is printed, otherwise the full comment is printed. The "--limit N" +** is printed, otherwise the full comment is printed. The "-n|--limit N" ** and "--offset P" options limits the output to the first N changes ** after skipping P changes. ** ** In the -s mode prints the status as . This is ** a quick status and does not check for up-to-date-ness of the file. @@ -39,45 +39,47 @@ ** In the -p mode, there's an optional flag "-r|--revision REVISION". ** The specified version (or the latest checked out version) is printed ** to stdout. The -p mode is another form of the "cat" command. ** ** Options: -** --brief|-b display a brief (one line / revision) summary -** --limit N display the first N changes -** --log|-l select log mode (the default) -** --offset P skip P changes -** -p select print mode -** --revision|-r R print the given revision (or ckout, if none is given) -** to stdout (only in print mode) -** -s select status mode (print a status indicator for FILE) +** -b|--brief display a brief (one line / revision) summary ** --case-sensitive B Enable or disable case-sensitive filenames. B is a ** boolean: "yes", "no", "true", "false", etc. +** -l|--log select log mode (the default) +** -n|--limit N display the first N changes. N=0 means no limit. +** --offset P skip P changes +** -p|--print select print mode +** -r|--revision R print the given revision (or ckout, if none is given) +** to stdout (only in print mode) +** -s|--status select status mode (print a status indicator for FILE) +** -W|--width With of lines (default 79). Must be >22 or 0 +** (= no limit, resulting in a single line per entry). ** ** See also: artifact, cat, descendants, info, leaves */ void finfo_cmd(void){ capture_case_sensitive_option(); db_must_be_within_tree(); - if (find_option("status","s",0)) { + if( find_option("status","s",0) ){ Stmt q; Blob line; Blob fname; int vid; if( g.argc!=3 ) usage("-s|--status FILENAME"); vid = db_lget_int("checkout", 0); if( vid==0 ){ - fossil_panic("no checkout to finfo files in"); + fossil_fatal("no checkout to finfo files in"); } vfile_check_signature(vid, CKSIG_ENOTFILE); file_tree_name(g.argv[2], &fname, 1); db_prepare(&q, "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" " FROM vfile WHERE vfile.pathname=%B %s", &fname, filename_collation()); blob_zero(&line); - if ( db_step(&q)==SQLITE_ROW ) { + if( db_step(&q)==SQLITE_ROW ) { Blob uuid; int isDeleted = db_column_int(&q, 1); int isNew = db_column_int(&q,2) == 0; int chnged = db_column_int(&q,3); int renamed = db_column_int(&q,4); @@ -134,21 +136,27 @@ Stmt q; Blob fname; int rid; const char *zFilename; const char *zLimit; + const char *zWidth; const char *zOffset; - int iLimit, iOffset, iBrief; + int iLimit, iOffset, iBrief, iWidth; if( find_option("log","l",0) ){ /* this is the default, no-op */ } - zLimit = find_option("limit",0,1); + zLimit = find_option("limit","n",1); + zWidth = find_option("width","W",1); iLimit = zLimit ? atoi(zLimit) : -1; + iWidth = zWidth ? atoi(zWidth) : 79; zOffset = find_option("offset",0,1); iOffset = zOffset ? atoi(zOffset) : 0; iBrief = (find_option("brief","b",0) == 0); + if( (iWidth!=0) && (iWidth<=22) ){ + fossil_fatal("--width|-W value must be >22 or 0"); + } if( g.argc!=3 ){ usage("?-l|--log? ?-b|--brief? FILENAME"); } file_tree_name(g.argv[2], &fname, 1); rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B %s", @@ -188,20 +196,20 @@ if( iBrief ){ fossil_print("%s ", zDate); zOut = sqlite3_mprintf( "[%.10s] %s (user: %s, artifact: [%.10s], branch: %s)", zCiUuid, zCom, zUser, zFileUuid, zBr); - comment_print(zOut, 11, 79); + comment_print(zOut, 11, iWidth); sqlite3_free(zOut); }else{ blob_reset(&line); blob_appendf(&line, "%.10s ", zCiUuid); blob_appendf(&line, "%.10s ", zDate); blob_appendf(&line, "%8.8s ", zUser); blob_appendf(&line, "%8.8s ", zBr); - blob_appendf(&line,"%-40.40s\n", zCom ); - comment_print(blob_str(&line), 0, 79); + blob_appendf(&line,"%-39.39s", zCom ); + comment_print(blob_str(&line), 0, iWidth); } } db_finalize(&q); blob_reset(&fname); } @@ -247,29 +255,31 @@ /* ** WEBPAGE: finfo ** URL: /finfo?name=FILENAME ** -** Show the change history for a single file. +** Show the change history for a single file. ** ** Additional query parameters: ** ** a=DATE Only show changes after DATE ** b=DATE Only show changes before DATE ** n=NUM Show the first NUM changes only ** brbg Background color by branch name ** ubg Background color by user name +** ci=UUID Ancestors of a particular check-in ** fco=BOOL Show only first occurrence of each version if true (default) */ void finfo_page(void){ Stmt q; const char *zFilename; char zPrevDate[20]; const char *zA; const char *zB; int n; - + int baseCheckin; + Blob title; Blob sql; HQuery url; GraphContext *pGraph; int brBg = P("brbg")!=0; @@ -282,22 +292,24 @@ style_header("File History"); login_anonymous_available(); 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"); + if( baseCheckin ) firstChngOnly = 1; if( firstChngOnly ) url_add_parameter(&url, "fco", "0"); zPrevDate[0] = 0; zFilename = PD("name",""); url_add_parameter(&url, "name", zFilename); blob_zero(&sql); - blob_appendf(&sql, + blob_appendf(&sql, "SELECT" " datetime(event.mtime,'localtime')," /* Date of change */ " coalesce(event.ecomment, event.comment)," /* Check-in comment */ " coalesce(event.euser, event.user)," /* User who made chng */ - " mlink.pid," /* Parent rid */ + " mlink.pid," /* Parent file rid */ " mlink.fid," /* File rid */ " (SELECT uuid FROM blob WHERE rid=mlink.pid)," /* Parent file uuid */ " (SELECT uuid FROM blob WHERE rid=mlink.fid)," /* Current file uuid */ " (SELECT uuid FROM blob WHERE rid=mlink.mid)," /* Check-in uuid */ " event.bgcolor," /* Background color */ @@ -306,18 +318,31 @@ " mlink.mid," /* check-in ID */ " mlink.pfnid", /* Previous filename */ TAG_BRANCH ); if( firstChngOnly ){ +#if 0 blob_appendf(&sql, ", min(event.mtime)"); +#else + blob_appendf(&sql, + ", min(CASE (SELECT value FROM tagxref" + " WHERE tagtype>0 AND tagid=%d" + " AND tagxref.rid=mlink.mid)" + " WHEN 'trunk' THEN event.mtime-10000 ELSE event.mtime END)", + TAG_BRANCH); +#endif } blob_appendf(&sql, " FROM mlink, event" - " WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q %s)" + " WHERE mlink.fnid IN (SELECT fnid FROM filename WHERE name=%Q)" " AND event.objid=mlink.mid", - zFilename, filename_collation() + zFilename ); + if( baseCheckin ){ + compute_direct_ancestors(baseCheckin, 10000000); + blob_appendf(&sql," AND mlink.mid IN (SELECT rid FROM ancestor)"); + } if( (zA = P("a"))!=0 ){ blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zA); url_add_parameter(&url, "a", zA); } if( (zB = P("b"))!=0 ){ @@ -330,22 +355,37 @@ blob_appendf(&sql," ORDER BY event.mtime DESC /*sort*/"); if( (n = atoi(PD("n","0")))>0 ){ blob_appendf(&sql, " LIMIT %d", n); url_add_parameter(&url, "n", P("n")); } - if( firstChngOnly ){ - style_submenu_element("Full", "Show all changes","%s", - url_render(&url, "fco", "0", 0, 0)); - }else{ - style_submenu_element("Simplified", "Show only first use of a change","%s", - url_render(&url, "fco", "1", 0, 0)); + if( baseCheckin==0 ){ + if( firstChngOnly ){ + style_submenu_element("Full", "Show all changes","%s", + url_render(&url, "fco", "0", 0, 0)); + }else{ + style_submenu_element("Simplified", + "Show only first use of a change","%s", + url_render(&url, "fco", "1", 0, 0)); + } } db_prepare(&q, blob_str(&sql)); + if( P("showsql")!=0 ){ + @

    SQL: %h(blob_str(&sql))

    + } blob_reset(&sql); blob_zero(&title); - blob_appendf(&title, "History of "); - hyperlinked_path(zFilename, &title, 0); + if( baseCheckin ){ + char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", baseCheckin); + char *zLink = href("%R/info/%S", zUuid); + blob_appendf(&title, "Ancestors of file "); + hyperlinked_path(zFilename, &title, zUuid); + blob_appendf(&title, " from check-in %z%.10s", zLink, zUuid); + fossil_free(zUuid); + }else{ + blob_appendf(&title, "History of files named "); + hyperlinked_path(zFilename, &title, 0); + } @

    %b(&title)

    blob_reset(&title); pGraph = graph_init(); @
    @@ -403,39 +443,46 @@ @ %z(href("%R/finfo?name=%t", zPrevName))%h(zPrevName) } @ %z(href("%R/artifact/%s",zUuid))[%S(zUuid)] part of check-in }else{ char *zNewName; - zNewName = db_text(0, + zNewName = db_text(0, "SELECT name FROM filename WHERE fnid = " " (SELECT fnid FROM mlink" " WHERE mid=%d" - " AND pfnid IN (SELECT fnid FROM filename WHERE name=%Q %s))", - fmid, zFilename, filename_collation()); + " AND pfnid IN (SELECT fnid FROM filename WHERE name=%Q))", + fmid, zFilename); if( zNewName ){ @ Renamed to @ %z(href("%R/finfo?name=%t",zNewName))%h(zNewName) by check-in fossil_free(zNewName); }else{ @ Deleted by check-in } } hyperlink_to_uuid(zShortCkin); - @ %h(zCom) (user: + @ %w(zCom) (user: hyperlink_to_user(zUser, zDate, ""); @ branch: %h(zBr)) if( g.perm.Hyperlink && zUuid ){ const char *z = zFilename; - if( fpid ){ - @ %z(href("%R/fdiff?v1=%S&v2=%S",zPUuid,zUuid))[diff] - } @ %z(href("%R/annotate?checkin=%S&filename=%h",zCkin,z)) @ [annotate] + @ %z(href("%R/blame?checkin=%S&filename=%h",zCkin,z)) + @ [blame] @ %z(href("%R/timeline?n=200&uf=%S",zUuid))[checkins using] + if( fpid ){ + @ %z(href("%R/fdiff?v1=%S&v2=%S&sbs=1",zPUuid,zUuid))[diff] + } } if( fDebug & FINFO_DEBUG_MLINK ){ - @ fid=%d(frid), pid=%d(fpid), mid=%d(fmid) + int srcid = db_int(0, "SELECT srcid FROM delta WHERE rid=%d", frid); + int sz = db_int(0, "SELECT length(content) FROM blob WHERE rid=%d", frid); + @
    fid=%d(frid) pid=%d(fpid) mid=%d(fmid) sz=%d(sz) + if( srcid ){ + @ srcid=%d(srcid) + } } @ } db_finalize(&q); if( pGraph ){ Index: src/glob.c ================================================================== --- src/glob.c +++ src/glob.c @@ -29,16 +29,17 @@ ** zVal: "x" ** zGlobList: "*.o,*.obj" ** ** Result: "(x GLOB '*.o' OR x GLOB '*.obj')" ** -** Each element of the GLOB list may optionally be enclosed in either '...' -** or "...". This allows commas in the expression. Whitespace at the -** beginning and end of each GLOB pattern is ignored, except when enclosed -** within '...' or "...". +** Commas and whitespace are considered to be element delimters. Each +** element of the GLOB list may optionally be enclosed in either '...' or +** "...". This allows commas and/or whitespace to be used in the elements +** themselves. ** -** This routine makes no effort to free the memory space it uses. +** This routine makes no effort to free the memory space it uses, which +** currently consists of a blob object and its contents. */ char *glob_expr(const char *zVal, const char *zGlobList){ Blob expr; char *zSep = "("; int nTerm = 0; @@ -46,21 +47,24 @@ int cTerm; if( zGlobList==0 || zGlobList[0]==0 ) return "0"; blob_zero(&expr); while( zGlobList[0] ){ - while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ) zGlobList++; + while( fossil_isspace(zGlobList[0]) || zGlobList[0]==',' ){ + zGlobList++; /* Skip leading commas, spaces, and newlines */ + } if( zGlobList[0]==0 ) break; if( zGlobList[0]=='\'' || zGlobList[0]=='"' ){ cTerm = zGlobList[0]; zGlobList++; }else{ cTerm = ','; } - for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){} - if( cTerm==',' ){ - while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; } + /* Find the next delimter (or the end of the string). */ + for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){ + if( cTerm!=',' ) continue; /* If quoted, keep going. */ + if( fossil_isspace(zGlobList[i]) ) break; /* If space, stop. */ } blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList); zSep = " OR "; if( cTerm!=',' && zGlobList[i] ) i++; zGlobList += i; @@ -85,24 +89,24 @@ char **azPattern; /* Array of pointers to patterns */ }; #endif /* INTERFACE */ /* -** zPatternList is a comma-separate list of glob patterns. Parse up +** zPatternList is a comma-separated list of glob patterns. Parse up ** that list and use it to create a new Glob object. ** ** Elements of the glob list may be optionally enclosed in single our -** double-quotes. This allows a comma to be part of a glob. +** double-quotes. This allows a comma to be part of a glob pattern. ** ** Leading and trailing spaces on unquoted glob patterns are ignored. ** ** An empty or null pattern list results in a null glob, which will ** match nothing. */ Glob *glob_create(const char *zPatternList){ int nList; /* Size of zPatternList in bytes */ - int i, j; /* Loop counters */ + int i; /* Loop counters */ Glob *p; /* The glob being created */ char *z; /* Copy of the pattern list */ char delimiter; /* '\'' or '\"' or 0 */ if( zPatternList==0 || zPatternList[0]==0 ) return 0; @@ -110,27 +114,26 @@ p = fossil_malloc( sizeof(*p) + nList+1 ); memset(p, 0, sizeof(*p)); z = (char*)&p[1]; memcpy(z, zPatternList, nList+1); while( z[0] ){ - while( z[0]==',' || z[0]==' ' || z[0]=='\n' || z[0]=='\r' ){ - z++; /* Skip leading spaces and newlines */ + while( fossil_isspace(z[0]) || z[0]==',' ){ + z++; /* Skip leading commas, spaces, and newlines */ } + if( z[0]==0 ) break; if( z[0]=='\'' || z[0]=='"' ){ delimiter = z[0]; z++; }else{ delimiter = ','; } - if( z[0]==0 ) break; p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) ); p->azPattern[p->nPattern++] = z; - for(i=0; z[i] && z[i]!=delimiter && z[i]!='\n' && z[i]!='\r'; i++){} - if( delimiter==',' ){ - /* Remove trailing spaces / newlines on a comma-delimited pattern */ - for(j=i; j>1 && (z[j-1]==' ' || z[j-1]=='\n' || z[j-1]=='\r'); j--){} - if( jnPattern; i++){ fossil_print("pattern[%d] = [%s]\n", i, pGlob->azPattern[i]); } for(i=3; izBranch = 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[0]==0 ) zBgClr = "white"; + if( zBgClr==0 ) zBgClr = ""; pRow->zBgClr = persistBranchName(p, zBgClr); memcpy(pRow->aParent, aParent, sizeof(aParent[0])*nParent); if( p->pFirst==0 ){ p->pFirst = pRow; }else{ Index: src/gzip.c ================================================================== --- src/gzip.c +++ src/gzip.c @@ -19,13 +19,13 @@ ** file. The GZIP format is described in RFC-1952. ** ** State information is stored in static variables, so this implementation ** can only be building up a single GZIP file at a time. */ +#include "config.h" #include #include -#include "config.h" #include "gzip.h" /* ** State information for the GZIP file under construction. */ Index: src/http.c ================================================================== --- src/http.c +++ src/http.c @@ -60,11 +60,10 @@ zPw = 0; }else{ /* Password failure while doing a sync from the command-line interface */ url_prompt_for_password(); zPw = g.urlPasswd; - if( !g.dontKeepUrl ) db_set("last-sync-pw", obscure(zPw), 0); } /* If the first character of the password is "#", then that character is ** not really part of the password - it is an indicator that we should ** use Basic Authentication. So skip that character. @@ -72,10 +71,11 @@ if( zPw && zPw[0]=='#' ) zPw++; /* The login card wants the SHA1 hash of the password, so convert the ** password to its SHA1 hash it it isn't already a SHA1 hash. */ + /* fossil_print("\nzPw=[%s]\n", zPw); // TESTING ONLY */ if( zPw && zPw[0] ) zPw = sha1_shared_secret(zPw, zLogin, 0); blob_append(&pw, zPw, -1); sha1sum_blob(&pw, &sig); blob_appendf(pLogin, "login %F %b %b\n", zLogin, &nonce, &sig); @@ -112,10 +112,11 @@ fossil_free(zCredentials); } blob_appendf(pHdr, "Host: %s\r\n", g.urlHostname); blob_appendf(pHdr, "User-Agent: Fossil/" RELEASE_VERSION " (" MANIFEST_DATE " " MANIFEST_VERSION ")\r\n"); + if( g.urlIsSsh ) blob_appendf(pHdr, "X-Fossil-Transport: SSH\r\n"); 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"); } @@ -130,11 +131,11 @@ ** ** 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, Blob *pReply, int useLogin){ +int http_exchange(Blob *pSend, Blob *pReply, int useLogin, int maxRedirect){ 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; /* Length of the reply payload */ @@ -217,10 +218,20 @@ if( iHttpVersion==0 ){ closeConnection = 1; }else{ closeConnection = 0; } + }else if( g.urlIsSsh && fossil_strnicmp(zLine, "status:", 7)==0 ){ + if( sscanf(zLine, "Status: %d", &rc)!=1 ) goto write_err; + if( rc!=200 && rc!=302 ){ + 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; @@ -231,21 +242,25 @@ }else if( c=='k' || c=='K' ){ closeConnection = 0; } }else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){ int i, j; + + if ( --maxRedirect == 0){ + fossil_fatal("redirect limit exceeded"); + } for(i=9; zLine[i] && zLine[i]==' '; i++){} if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine); j = strlen(zLine) - 1; while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){ j -= 4; zLine[j] = 0; } fossil_print("redirect to %s\n", &zLine[i]); - url_parse(&zLine[i]); + url_parse(&zLine[i], 0); transport_close(); - return http_exchange(pSend, pReply, useLogin); + return http_exchange(pSend, pReply, useLogin, maxRedirect); }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 ){ @@ -291,12 +306,14 @@ ** Close the connection to the server if appropriate. ** ** FIXME: There is some bug in the lower layers that prevents the ** connection from remaining open. The easiest fix for now is to ** simply close and restart the connection for each round-trip. + ** + ** For SSH we will leave the connection open. */ - closeConnection = 1; /* FIX ME */ + if( ! g.urlIsSsh ) closeConnection = 1; /* FIX ME */ if( closeConnection ){ transport_close(); }else{ transport_rewind(); } Index: src/http_socket.c ================================================================== --- src/http_socket.c +++ src/http_socket.c @@ -200,13 +200,31 @@ */ size_t socket_receive(void *NotUsed, void *pContent, size_t N){ ssize_t got; size_t total = 0; while( N>0 ){ - got = recv(iSocket, pContent, N, 0); + /* WinXP fails for large values of N. So limit it to 64KiB. */ + got = recv(iSocket, pContent, N>65536 ? 65536 : N, 0); if( got<=0 ) break; total += (size_t)got; N -= (size_t)got; pContent = (void*)&((char*)pContent)[got]; } return total; } + +/* +** Attempt to resolve g.urlName to IP and setup g.zIpAddr so rcvfrom gets +** populated. For hostnames with more than one IP (or if overridden in +** ~/.ssh/config) the rcvfrom may not match the host to which we connect. +*/ +void socket_ssh_resolve_addr(void){ + struct hostent *pHost; /* Used to make best effort for rcvfrom */ + struct sockaddr_in addr; + + memset(&addr, 0, sizeof(addr)); + pHost = gethostbyname(g.urlName); + if( pHost!=0 ){ + memcpy(&addr.sin_addr,pHost->h_addr_list[0],pHost->h_length); + g.zIpAddr = mprintf("%s", inet_ntoa(addr.sin_addr)); + } +} Index: src/http_transport.c ================================================================== --- src/http_transport.c +++ src/http_transport.c @@ -37,11 +37,11 @@ FILE *pFile; /* File I/O for FILE: */ char *zOutFile; /* Name of outbound file for FILE: */ char *zInFile; /* Name of inbound file for FILE: */ FILE *pLog; /* Log output here */ } transport = { - 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* ** Information about the connection to the SSH subprocess when ** using the ssh:// sync method. @@ -74,25 +74,10 @@ transport.nSent = 0; transport.nRcvd = 0; } } -/* -** Read text from sshIn. Zero-terminate and remove trailing -** whitespace. -*/ -static void sshin_read(char *zBuf, int szBuf){ - int got; - zBuf[0] = 0; - got = read(sshIn, zBuf, szBuf-1); - while( got>=0 ){ - zBuf[got] = 0; - if( got==0 || !fossil_isspace(zBuf[got-1]) ) break; - got--; - } -} - /* ** Default SSH command */ #ifdef __MINGW32__ static char zDefaultSshCmd[] = "ssh -T"; @@ -99,141 +84,60 @@ #else static char zDefaultSshCmd[] = "ssh -e none -T"; #endif /* -** Generate a random SSH link problem keyword -*/ -static int random_probe(char *zProbe, int nProbe){ - unsigned r[4]; - sqlite3_randomness(sizeof(r), r); - sqlite3_snprintf(nProbe, zProbe, "probe-%08x%08x%08x%08x", - r[0], r[1], r[2], r[3]); - return (int)strlen(zProbe); -} - -/* -** Bring up an SSH link. This involves sending some "echo" commands and -** get back appropriate responses. The point is to move past the MOTD and -** verify that the link is working. -*/ -static void transport_ssh_startup(void){ - char *zIn; /* An input line received back from remote */ - int nWait; /* Number of times waiting for the MOTD */ - char zProbe[40]; /* Text of the random probe */ - int nProbe; /* Size of probe message */ - int nIn; /* Size of input */ - static const int nBuf = 10000; /* Size of input buffer */ - - zIn = fossil_malloc(nBuf); - nProbe = random_probe(zProbe, sizeof(zProbe)); - fprintf(sshOut, "echo %s\n", zProbe); - fflush(sshOut); - if( g.fSshTrace ){ - printf("Sent: [echo %s]\n", zProbe); - fflush(stdout); - } - memset(zIn, '*', nProbe); - for(nWait=1; nWait<=10; nWait++){ - sshin_read(zIn+nProbe, nBuf-nProbe); - if( g.fSshTrace ){ - printf("Got back-----------------------------------------------\n" - "%s\n" - "-------------------------------------------------------\n", - zIn+nProbe); - } - if( strstr(zIn, zProbe) ) break; - sqlite3_sleep(100*nWait); - nIn = (int)strlen(zIn); - memcpy(zIn, zIn+(nIn-nProbe), nProbe); - if( g.fSshTrace ){ - printf("Fetching more text. Looking for [%s]...\n", zProbe); - fflush(stdout); - } - } - nProbe = random_probe(zProbe, sizeof(zProbe)); - fprintf(sshOut, "echo %s\n", zProbe); - fflush(sshOut); - if( g.fSshTrace ){ - printf("Sent: [echo %s]\n", zProbe); - fflush(stdout); - } - sshin_read(zIn, nBuf); - if( zIn[0]==0 ){ - sqlite3_sleep(250); - sshin_read(zIn, nBuf); - } - if( g.fSshTrace ){ - printf("Got back-----------------------------------------------\n" - "%s\n" - "-------------------------------------------------------\n", zIn); - } - if( memcmp(zIn, zProbe, nProbe)!=0 ){ - pclose2(sshIn, sshOut, sshPid); - fossil_fatal("ssh connection failed: [%s]", zIn); - } - fossil_free(zIn); -} - -/* -** Global initialization of the transport layer -*/ -void transport_global_startup(void){ - if( g.urlIsSsh ){ - /* Only SSH requires a global initialization. For SSH we need to create - ** and run an SSH command to talk to the remote machine. - */ - const char *zSsh; /* The base SSH command */ - Blob zCmd; /* The SSH command */ - char *zHost; /* The host name to contact */ - - zSsh = db_get("ssh-command", zDefaultSshCmd); - blob_init(&zCmd, zSsh, -1); - if( g.urlPort!=g.urlDfltPort ){ -#ifdef __MINGW32__ - blob_appendf(&zCmd, " -P %d", g.urlPort); -#else - blob_appendf(&zCmd, " -p %d", g.urlPort); -#endif - } - fossil_force_newline(); - fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ - if( g.urlUser && g.urlUser[0] ){ - zHost = mprintf("%s@%s", g.urlUser, g.urlName); -#ifdef __MINGW32__ - /* Only win32 (and specifically PLINK.EXE) support the -pw option */ - if( g.urlPasswd && g.urlPasswd[0] ){ - Blob pw; - blob_zero(&pw); - if( g.urlPasswd[0]=='*' ){ - char *zPrompt; - zPrompt = mprintf("Password for [%s]: ", zHost); - prompt_for_password(zPrompt, &pw, 0); - free(zPrompt); - }else{ - blob_init(&pw, g.urlPasswd, -1); - } - blob_append(&zCmd, " -pw ", -1); - shell_escape(&zCmd, blob_str(&pw)); - blob_reset(&pw); - fossil_print(" -pw ********"); /* Do not show the password text */ - } -#endif - }else{ - zHost = mprintf("%s", g.urlName); - } - blob_append(&zCmd, " ", 1); - shell_escape(&zCmd, zHost); - fossil_print(" %s\n", zHost); /* Show the conclusion of the SSH command */ - free(zHost); - popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); - if( sshPid==0 ){ - fossil_fatal("cannot start ssh tunnel using [%b]", &zCmd); - } - blob_reset(&zCmd); - transport_ssh_startup(); - } +** SSH initialization of the transport layer +*/ +int transport_ssh_open(void){ + /* For SSH we need to create and run SSH fossil http + ** to talk to the remote machine. + */ + const char *zSsh; /* The base SSH command */ + Blob zCmd; /* The SSH command */ + char *zHost; /* The host name to contact */ + int n; /* Size of prefix string */ + + socket_ssh_resolve_addr(); + zSsh = db_get("ssh-command", zDefaultSshCmd); + blob_init(&zCmd, zSsh, -1); + if( g.urlPort!=g.urlDfltPort && g.urlPort ){ +#ifdef __MINGW32__ + blob_appendf(&zCmd, " -P %d", g.urlPort); +#else + blob_appendf(&zCmd, " -p %d", g.urlPort); +#endif + } + if( g.fSshTrace ){ + fossil_force_newline(); + fossil_print("%s", blob_str(&zCmd)); /* Show the base of the SSH command */ + } + if( g.urlUser && g.urlUser[0] ){ + zHost = mprintf("%s@%s", g.urlUser, g.urlName); + }else{ + zHost = mprintf("%s", g.urlName); + } + n = blob_size(&zCmd); + blob_append(&zCmd, " ", 1); + shell_escape(&zCmd, zHost); + blob_append(&zCmd, " ", 1); + shell_escape(&zCmd, mprintf("%s", g.urlFossil)); + blob_append(&zCmd, " test-http", 10); + if( g.urlPath && g.urlPath[0] ){ + blob_append(&zCmd, " ", 1); + shell_escape(&zCmd, mprintf("%s", g.urlPath)); + } + if( g.fSshTrace ){ + fossil_print("%s\n", blob_str(&zCmd)+n); /* Show tail of SSH command */ + } + free(zHost); + popen2(blob_str(&zCmd), &sshIn, &sshOut, &sshPid); + if( sshPid==0 ){ + socket_set_errmsg("cannot start ssh tunnel using [%b]", &zCmd); + } + blob_reset(&zCmd); + return sshPid==0; } /* ** Open a connection to the server. The server is defined by the following ** global variables: @@ -246,19 +150,12 @@ */ int transport_open(void){ int rc = 0; if( transport.isOpen==0 ){ if( g.urlIsSsh ){ - Blob cmd; - blob_zero(&cmd); - shell_escape(&cmd, g.urlFossil); - blob_append(&cmd, " test-http ", -1); - shell_escape(&cmd, g.urlPath); - /* printf("%s\n", blob_str(&cmd)); fflush(stdout); */ - fprintf(sshOut, "%s\n", blob_str(&cmd)); - fflush(sshOut); - blob_reset(&cmd); + rc = transport_ssh_open(); + if( rc==0 ) transport.isOpen = 1; }else if( g.urlIsHttps ){ #ifdef FOSSIL_ENABLE_SSL rc = ssl_open(); if( rc==0 ) transport.isOpen = 1; #else @@ -266,15 +163,15 @@ rc = 1; #endif }else if( g.urlIsFile ){ sqlite3_uint64 iRandId; sqlite3_randomness(sizeof(iRandId), &iRandId); - transport.zOutFile = mprintf("%s-%llu-out.http", + transport.zOutFile = mprintf("%s-%llu-out.http", g.zRepositoryName, iRandId); - transport.zInFile = mprintf("%s-%llu-in.http", + transport.zInFile = mprintf("%s-%llu-in.http", g.zRepositoryName, iRandId); - transport.pFile = fopen(transport.zOutFile, "wb"); + transport.pFile = fossil_fopen(transport.zOutFile, "wb"); if( transport.pFile==0 ){ fossil_fatal("cannot output temporary file: %s", transport.zOutFile); } transport.isOpen = 1; }else{ @@ -298,17 +195,17 @@ if( transport.pLog ){ fclose(transport.pLog); transport.pLog = 0; } if( g.urlIsSsh ){ - /* No-op */ + transport_ssh_close(); }else if( g.urlIsHttps ){ #ifdef FOSSIL_ENABLE_SSL ssl_close(); #endif }else if( g.urlIsFile ){ - if( transport.pFile ){ + if( transport.pFile ){ fclose(transport.pFile); transport.pFile = 0; } file_delete(transport.zInFile); file_delete(transport.zOutFile); @@ -337,11 +234,11 @@ 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( g.urlIsFile ){ fwrite(z, 1, n, transport.pFile); }else{ int sent; @@ -357,21 +254,19 @@ /* ** This routine is called when the outbound message is complete and ** it is time to being receiving a reply. */ void transport_flip(void){ - if( g.urlIsSsh ){ - fprintf(sshOut, "\n\n"); - }else if( g.urlIsFile ){ + if( g.urlIsFile ){ char *zCmd; fclose(transport.pFile); zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1 --localauth", g.nameOfExe, g.urlName, transport.zOutFile, transport.zInFile ); fossil_system(zCmd); free(zCmd); - transport.pFile = fopen(transport.zInFile, "rb"); + transport.pFile = fossil_fopen(transport.zInFile, "rb"); } } /* ** Log all input to a file. The transport layer will take responsibility @@ -403,11 +298,10 @@ int got; if( sshIn ){ int x; int wanted = N; got = 0; - /* printf("want %d bytes...\n", wanted); fflush(stdout); */ while( wanted>0 ){ x = read(sshIn, &zBuf[got], wanted); if( x<=0 ) break; got += x; wanted -= x; @@ -438,11 +332,14 @@ int transport_receive(char *zBuf, int N){ int onHand; /* Bytes current held in the transport buffer */ int nByte = 0; /* Bytes of content received */ onHand = transport.nUsed - transport.iCursor; - /* printf("request %d with %d on hand\n", N, onHand); fflush(stdout); */ + if( g.fSshTrace){ + printf("Reading %d bytes with %d on hand... ", N, onHand); + fflush(stdout); + } if( onHand>0 ){ int toMove = onHand; if( toMove>N ) toMove = N; /* printf("bytes on hand: %d of %d\n", toMove, N); fflush(stdout); */ memcpy(zBuf, &transport.pBuf[transport.iCursor], toMove); @@ -460,10 +357,11 @@ if( got>0 ){ nByte += got; transport.nRcvd += got; } } + if( g.fSshTrace ) printf("Got %d bytes\n", nByte); return nByte; } /* ** Load up to N new bytes of content into the transport.pBuf buffer. @@ -532,24 +430,36 @@ } break; } i++; } - /* printf("Got line: [%s]\n", &transport.pBuf[iStart]); */ + if( g.fSshTrace ) printf("Got line: [%s]\n", &transport.pBuf[iStart]); return &transport.pBuf[iStart]; } +/* +** Global transport shutdown +*/ void transport_global_shutdown(void){ - if( g.urlIsSsh && sshPid ){ - /*printf("Closing SSH tunnel: ");*/ - fflush(stdout); - pclose2(sshIn, sshOut, sshPid); - sshPid = 0; + if( g.urlIsSsh ){ + transport_ssh_close(); } if( g.urlIsHttps ){ #ifdef FOSSIL_ENABLE_SSL ssl_global_shutdown(); #endif }else{ socket_global_shutdown(); } } + +/* +** Close SSH transport. +*/ +void transport_ssh_close(void){ + if( sshPid ){ + /*printf("Closing SSH tunnel: ");*/ + fflush(stdout); + pclose2(sshIn, sshOut, sshPid); + sshPid = 0; + } +} Index: src/import.c ================================================================== --- src/import.c +++ src/import.c @@ -419,11 +419,11 @@ gg.zPrevCheckin = 0; } if( gg.zFrom==0 ) return; rid = fast_uuid_to_rid(gg.zFrom); if( rid==0 ) return; - p = manifest_get(rid, CFTYPE_MANIFEST); + p = manifest_get(rid, CFTYPE_MANIFEST, 0); if( p==0 ) return; manifest_file_rewind(p); while( (pOld = manifest_file_next(p, 0))!=0 ){ pNew = import_add_file(); pNew->zName = fossil_strdup(pOld->zName); Index: src/info.c ================================================================== --- src/info.c +++ src/info.c @@ -171,17 +171,20 @@ ** file in a checkout. ** ** Options: ** ** -R|--repository FILE Extract info from repository FILE -** -l|--detail Show extra information +** -v|--verbose Show extra information ** ** See also: annotate, artifact, finfo, timeline */ void info_cmd(void){ i64 fsize; - int bDetail = find_option("detail","l",0)!=0; + 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]))>0 && (fsize&0x1ff)==0 ){ db_open_config(0); db_record_repository_filename(g.argv[2]); db_open_repository(g.argv[2]); fossil_print("project-name: %s\n", db_get("project-name", "")); @@ -197,28 +200,26 @@ fossil_print("project-name: %s\n", db_get("project-name", "")); if( g.localOpen ){ fossil_print("repository: %s\n", db_repository_filename()); fossil_print("local-root: %s\n", g.zLocalRoot); } - if( bDetail ) extraRepoInfo(); -#if defined(_WIN32) - if( g.zHome ){ - fossil_print("user-home: %s\n", g.zHome); + if( verboseFlag ) extraRepoInfo(); + if( g.zConfigDbName ){ + fossil_print("config-db: %s\n", g.zConfigDbName); } -#endif fossil_print("project-code: %s\n", db_get("project-code", "")); vid = g.localOpen ? db_lget_int("checkout", 0) : 0; if( vid ){ show_common_info(vid, "checkout:", 1, 1); } fossil_print("checkins: %d\n", - db_int(-1, "SELECT count(distinct mid) FROM mlink /*scan*/")); + db_int(-1, "SELECT count(*) FROM event WHERE type='ci' /*scan*/")); }else{ int rid; rid = name_to_rid(g.argv[2]); if( rid==0 ){ - fossil_panic("no such object: %s\n", g.argv[2]); + fossil_fatal("no such object: %s\n", g.argv[2]); } show_common_info(rid, "uuid:", 1, 1); } } @@ -314,25 +315,23 @@ }else{ blob_zero(&to); } blob_zero(&out); if( diffFlags & DIFF_SIDEBYSIDE ){ - text_diff(&from, &to, &out, pRe, diffFlags | DIFF_HTML); - @
    - @ %s(blob_str(&out)) - @
    - }else{ - text_diff(&from, &to, &out, pRe, diffFlags | DIFF_LINENO | DIFF_HTML); - @
    - @ %s(blob_str(&out)) - @
    + text_diff(&from, &to, &out, pRe, diffFlags | DIFF_HTML | DIFF_NOTTOOBIG); + @ %s(blob_str(&out)) + }else{ + text_diff(&from, &to, &out, pRe, + diffFlags | DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG); + @
    +    @ %s(blob_str(&out))
    +    @ 
    } blob_reset(&from); blob_reset(&to); blob_reset(&out); } - /* ** Write a line of web-page output that shows changes that have occurred ** to a file between two check-ins. */ @@ -357,13 +356,11 @@ @ for %h(zName)

    }else{ @

    Changes to %h(zName)

    } if( diffFlags ){ - @
           append_diff(zOld, zNew, diffFlags, pRe);
    -      @ 
    } }else{ if( zOld && zNew ){ if( fossil_strcmp(zOld, zNew)!=0 ){ @

    Modified %z(href("%R/finfo?name=%T",zName))%h(zName) @@ -383,28 +380,59 @@ }else{ @

    Added %z(href("%R/finfo?name=%T",zName))%h(zName) @ version %z(href("%R/artifact/%s",zNew))[%S(zNew)] } if( diffFlags ){ - @

           append_diff(zOld, zNew, diffFlags, pRe);
    -      @ 
    }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){ @    - @ %z(href("%R/fdiff?v1=%S&v2=%S",zOld,zNew))[diff] + @ %z(href("%R/fdiff?v1=%S&v2=%S&sbs=1",zOld,zNew))[diff] } - @

    } } + +/* +** Generate javascript to enhance HTML diffs. +*/ +void append_diff_javascript(int sideBySide){ + if( !sideBySide ) return; + @ +} /* ** Construct an appropriate diffFlag for text_diff() based on query ** parameters and the to boolean arguments. */ -u64 construct_diff_flags(int showDiff, int sideBySide){ +u64 construct_diff_flags(int verboseFlag, int sideBySide){ u64 diffFlags; - if( showDiff==0 ){ + if( verboseFlag==0 ){ diffFlags = 0; /* Zero means do not show any diff */ }else{ int x; if( sideBySide ){ diffFlags = DIFF_SIDEBYSIDE | DIFF_IGNORE_EOLWS; @@ -443,14 +471,14 @@ ** With /vinfo and /info, only a list of the changed files are ** shown, without diffs. This behavior is inverted if the ** "show-version-diffs" setting is turned on. */ void ci_page(void){ - Stmt q; + Stmt q1, q2, q3; int rid; int isLeaf; - int showDiff; /* True to show diffs */ + int verboseFlag; /* True to show diffs */ int sideBySide; /* True for side-by-side diffs */ u64 diffFlags; /* Flag parameter for text_diff() */ const char *zName; /* Name of the checkin to be displayed */ const char *zUuid; /* UUID of zName */ const char *zParent; /* UUID of the parent checkin (if any) */ @@ -474,32 +502,27 @@ "SELECT uuid FROM plink, blob" " WHERE plink.cid=%d AND blob.rid=plink.pid AND plink.isprim", rid ); isLeaf = is_a_leaf(rid); - db_prepare(&q, + db_prepare(&q1, "SELECT uuid, datetime(mtime, 'localtime'), user, comment," " datetime(omtime, 'localtime'), mtime" " FROM blob, event" " WHERE blob.rid=%d" " AND event.objid=%d", rid, rid ); - sideBySide = atoi(PD("sbs","1")); - if( db_step(&q)==SQLITE_ROW ){ - const char *zUuid = db_column_text(&q, 0); + sideBySide = !is_false(PD("sbs","1")); + if( db_step(&q1)==SQLITE_ROW ){ + const char *zUuid = db_column_text(&q1, 0); char *zTitle = mprintf("Check-in [%.10s]", zUuid); char *zEUser, *zEComment; const char *zUser; const char *zComment; const char *zDate; const char *zOrigDate; -#if 0 - char *zThisBranch; - double thisMtime; - int seenDiffTitle = 0; -#endif style_header(zTitle); login_anonymous_available(); free(zTitle); zEUser = db_text(0, @@ -506,17 +529,14 @@ "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", TAG_USER, rid); zEComment = db_text(0, "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", TAG_COMMENT, rid); - zUser = db_column_text(&q, 2); - zComment = db_column_text(&q, 3); - zDate = db_column_text(&q,1); - zOrigDate = db_column_text(&q, 4); -#if 0 - thisMtime = db_column_double(&q, 5); -#endif + zUser = db_column_text(&q1, 2); + zComment = db_column_text(&q1, 3); + zDate = db_column_text(&q1,1); + zOrigDate = db_column_text(&q1, 4); @
    Overview
    @
    Event Time:
    Event Time (UTC): @ @
    Timeline Comment:
    Timeline Comment: @ @
    Background Color:
    Background Color: render_color_chooser(0, zClr, 0, "clr", "cclr"); @
    Tags:
    Tags: @ @
    Page Content:
    Page Content: @ @
    @ "); } if( zEComment ){ - @ - @ + @ + @ }else{ - @ + @ } if( g.perm.Admin ){ - db_prepare(&q, + db_prepare(&q2, "SELECT rcvfrom.ipaddr, user.login, datetime(rcvfrom.mtime)" " FROM blob JOIN rcvfrom USING(rcvid) LEFT JOIN user USING(uid)" " WHERE blob.rid=%d", rid ); - if( db_step(&q)==SQLITE_ROW ){ - const char *zIpAddr = db_column_text(&q, 0); - const char *zUser = db_column_text(&q, 1); - const char *zDate = db_column_text(&q, 2); + 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); if( zUser==0 || zUser[0]==0 ) zUser = "unknown"; @ @ } - db_finalize(&q); + db_finalize(&q2); } if( g.perm.Hyperlink ){ - const char *zProjName = db_get("project-name", "unnamed"); + char *zPJ = db_get("short-project-name", 0); + Blob projName; + int jj; + if( zPJ==0 ) zPJ = db_get("project-name", "unnamed"); + blob_zero(&projName); + blob_append(&projName, zPJ, -1); + blob_trim(&projName); + zPJ = blob_str(&projName); + for(jj=0; zPJ[jj]; jj++){ + if( (zPJ[jj]>0 && zPJ[jj]<' ') || strchr("\"*/:<>?\\|", zPJ[jj]) ){ + zPJ[jj] = '_'; + } + } @ - } -#endif + db_finalize(&q2); + /* The Download: line */ if( g.perm.Zip ){ char *zUrl = mprintf("%R/tarball/%t-%S.tar.gz?uuid=%s", - zProjName, zUuid, zUuid); + zPJ, zUuid, zUuid); @ @ @ @@ -655,25 +636,26 @@ if( g.perm.Write ){ @ | %z(href("%R/ci_edit?r=%S",zUuid))edit } @ @ + blob_reset(&projName); } @
    SHA1 Hash:%s(zUuid) if( g.perm.Setup ){ @ (Record ID: %d(rid)) @@ -536,34 +556,46 @@ }else{ @
    User: hyperlink_to_user(zUser,zDate,"
    Edited Comment:%w(zEComment)
    Original Comment:%w(zComment)
    Edited Comment:%!w(zEComment)
    Original Comment:%!w(zComment)
    Comment:%w(zComment)
    Comment:%!w(zComment)
    Received From:%h(zUser) @ %h(zIpAddr) on %s(zDate)
    Timelines: @ %z(href("%R/timeline?f=%S",zUuid))family if( zParent ){ @ | %z(href("%R/timeline?p=%S",zUuid))ancestors } @@ -571,80 +603,29 @@ @ | %z(href("%R/timeline?d=%S",zUuid))descendants } if( zParent && !isLeaf ){ @ | %z(href("%R/timeline?dp=%S",zUuid))both } - db_prepare(&q, "SELECT substr(tag.tagname,5) FROM tagxref, tag " + 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(&q)==SQLITE_ROW ){ - const char *zTagName = db_column_text(&q, 0); + while( db_step(&q2)==SQLITE_ROW ){ + const char *zTagName = db_column_text(&q2, 0); @ | %z(href("%R/timeline?r=%T",zTagName))%h(zTagName) } - db_finalize(&q); - -#if 0 - /* Select a few other branches to diff against */ - zThisBranch = db_text("trunk", "SELECT value FROM tagxref" - " WHERE tagid=%d AND tagtype>0" - " AND rid=%d", - TAG_BRANCH, rid); - - /* Find nearby leaves to offer to diff against */ - db_prepare(&q, - "SELECT tagxref.value, blob.uuid, min(%.17g-event.mtime)" - " FROM leaf, event, tagxref, blob" - " WHERE event.mtime BETWEEN %.17g AND %.17g" - " AND event.type='ci'" - " AND event.objid=leaf.rid" - " AND NOT %z" - " AND tagxref.rid=event.objid" - " AND tagxref.tagid=%d AND tagxref.tagtype>0" - " AND tagxref.value!=%Q" - " AND blob.rid=tagxref.rid" - " GROUP BY 1 ORDER BY 3", - thisMtime, thisMtime-7, thisMtime+7, - leaf_is_closed_sql("leaf.rid"), - TAG_BRANCH, zThisBranch - ); - while( db_step(&q)==SQLITE_ROW ){ - const char *zBr = db_column_text(&q, 0); - const char *zId = db_column_text(&q, 1); - if( !seenDiffTitle ){ - @
    Diffs: - seenDiffTitle = 1; - }else{ - @ | - } - @ %z(href("%R/vdiff?from=%S&to=%S",zId, zUuid))%h(zBr) - } - db_finalize(&q); - - if( fossil_strcmp(zThisBranch,"trunk")!=0 ){ - if( !seenDiffTitle ){ - @
    Diffs: - seenDiffTitle = 1; - }else{ - @ | - } - @ %z(href("%R/vdiff?from=root:%S&to=%S",zUuid,zUuid))root of - @ this branch - } - if( seenDiffTitle ){ - @
    Downloads: @ %z(href("%s",zUrl))Tarball - @ | %z(href("%R/zip/%t-%S.zip?uuid=%s",zProjName,zUuid,zUuid)) + @ | %z(href("%R/zip/%t-%S.zip?uuid=%s",zPJ,zUuid,zUuid)) @ ZIP archive fossil_free(zUrl); } @
    Other Links:
    }else{ style_header("Check-in Information"); login_anonymous_available(); } - db_finalize(&q); + db_finalize(&q1); showTags(rid, ""); if( zParent ){ @
    Changes
    @
    - showDiff = g.zPath[0]!='c'; + verboseFlag = g.zPath[0]!='c'; if( db_get_boolean("show-version-diffs", 0)==0 ){ - showDiff = !showDiff; - if( showDiff ){ + verboseFlag = !verboseFlag; + if( verboseFlag ){ @ %z(xhref("class='button'","%R/vinfo/%T",zName)) @ hide diffs if( sideBySide ){ @ %z(xhref("class='button'","%R/ci/%T?sbs=0",zName)) @ unified diffs @@ -686,11 +668,11 @@ @ show unified diffs @ %z(xhref("class='button'","%R/ci/%T?sbs=1",zName)) @ show side-by-side diffs } }else{ - if( showDiff ){ + if( verboseFlag ){ @ %z(xhref("class='button'","%R/ci/%T",zName))hide diffs if( sideBySide ){ @ %z(xhref("class='button'","%R/info/%T?sbs=0",zName)) @ unified diffs }else{ @@ -708,11 +690,11 @@ @ patch
    if( pRe ){ @

    Only differences that match regular expression "%h(zRe)" @ are shown.

    } - db_prepare(&q, + db_prepare(&q3, "SELECT name," " mperm," " (SELECT uuid FROM blob WHERE rid=mlink.pid)," " (SELECT uuid FROM blob WHERE rid=mlink.fid)," " (SELECT name FROM filename WHERE filename.fnid=mlink.pfnid)" @@ -721,21 +703,22 @@ " AND (mlink.fid>0" " OR mlink.fnid NOT IN (SELECT pfnid FROM mlink WHERE mid=%d))" " ORDER BY name /*sort*/", rid, rid ); - diffFlags = construct_diff_flags(showDiff, sideBySide); - while( db_step(&q)==SQLITE_ROW ){ - const char *zName = db_column_text(&q,0); - int mperm = db_column_int(&q, 1); - const char *zOld = db_column_text(&q,2); - const char *zNew = db_column_text(&q,3); - const char *zOldName = db_column_text(&q, 4); + diffFlags = construct_diff_flags(verboseFlag, sideBySide); + while( db_step(&q3)==SQLITE_ROW ){ + const char *zName = db_column_text(&q3,0); + int mperm = db_column_int(&q3, 1); + const char *zOld = db_column_text(&q3,2); + const char *zNew = db_column_text(&q3,3); + const char *zOldName = db_column_text(&q3, 4); append_file_change_line(zName, zOld, zNew, zOldName, diffFlags,pRe,mperm); } - db_finalize(&q); + db_finalize(&q3); } + append_diff_javascript(sideBySide); style_footer(); } /* ** WEBPAGE: winfo @@ -753,11 +736,11 @@ const char *zModAction; login_check_credentials(); if( !g.perm.RdWiki ){ login_needed(); return; } rid = name_to_rid_www("name"); - if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI))==0 ){ + if( rid==0 || (pWiki = manifest_get(rid, CFTYPE_WIKI, 0))==0 ){ style_header("Wiki Page Information Error"); @ No such object: %h(P("name")) style_footer(); return; } @@ -864,11 +847,11 @@ } if( !is_a_version(rid) ){ webpage_error("Artifact %s is not a checkin.", P(zParam)); return 0; } - return manifest_get(rid, CFTYPE_MANIFEST); + return manifest_get(rid, CFTYPE_MANIFEST, 0); } /* ** Output a description of a check-in */ @@ -935,27 +918,28 @@ ** Query parameters: ** ** from=TAG ** to=TAG ** branch=TAG -** detail=BOOLEAN +** v=BOOLEAN ** sbs=BOOLEAN ** ** ** Show all differences between two checkins. */ void vdiff_page(void){ int ridFrom, ridTo; - int showDetail = 0; + int verboseFlag = 0; int sideBySide = 0; u64 diffFlags = 0; Manifest *pFrom, *pTo; ManifestFile *pFileFrom, *pFileTo; const char *zBranch; const char *zFrom; const char *zTo; const char *zRe; + const char *zVerbose; ReCompiled *pRe = 0; login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } login_anonymous_available(); @@ -969,27 +953,40 @@ } pTo = vdiff_parse_manifest("to", &ridTo); if( pTo==0 ) return; pFrom = vdiff_parse_manifest("from", &ridFrom); if( pFrom==0 ) return; - sideBySide = atoi(PD("sbs","1")); - showDetail = atoi(PD("detail","0")); - if( !showDetail && sideBySide ) showDetail = 1; + sideBySide = !is_false(PD("sbs","1")); + zVerbose = P("v"); + if( !zVerbose ){ + zVerbose = P("verbose"); + } + if( !zVerbose ){ + zVerbose = P("detail"); /* deprecated */ + } + verboseFlag = (zVerbose!=0) && !is_false(zVerbose); + if( !verboseFlag && sideBySide ) verboseFlag = 1; zFrom = P("from"); zTo = P("to"); + if( sideBySide || verboseFlag ){ + style_submenu_element("Hide Diff", "hidediff", + "%R/vdiff?from=%T&to=%T&sbs=0", + zFrom, zTo); + } if( !sideBySide ){ style_submenu_element("Side-by-side Diff", "sbsdiff", - "%R/vdiff?from=%T&to=%T&detail=%d&sbs=1", - zFrom, zTo, showDetail); - }else{ + "%R/vdiff?from=%T&to=%T&sbs=1", + zFrom, zTo); + } + if( sideBySide || !verboseFlag ) { style_submenu_element("Unified Diff", "udiff", - "%R/vdiff?from=%T&to=%T&detail=%d&sbs=0", - zFrom, zTo, showDetail); + "%R/vdiff?from=%T&to=%T&sbs=0&v", + zFrom, zTo); } style_submenu_element("Invert", "invert", - "%R/vdiff?from=%T&to=%T&detail=%d&sbs=%d", - zTo, zFrom, showDetail, sideBySide); + "%R/vdiff?from=%T&to=%T&sbs=%d%s", zTo, zFrom, + sideBySide, (verboseFlag && !sideBySide)?"&v":""); style_header("Check-in Differences"); @

    Difference From:

    checkin_description(ridFrom); @

    To:

    checkin_description(ridTo); @@ -1002,11 +999,11 @@ manifest_file_rewind(pFrom); pFileFrom = manifest_file_next(pFrom, 0); manifest_file_rewind(pTo); pFileTo = manifest_file_next(pTo, 0); - diffFlags = construct_diff_flags(showDetail, sideBySide); + diffFlags = construct_diff_flags(verboseFlag, sideBySide); while( pFileFrom || pFileTo ){ int cmp; if( pFileFrom==0 ){ cmp = +1; }else if( pFileTo==0 ){ @@ -1036,11 +1033,11 @@ pFileTo = manifest_file_next(pTo, 0); } } manifest_destroy(pFrom); manifest_destroy(pTo); - + append_diff_javascript(sideBySide); style_footer(); } #if INTERFACE /* @@ -1133,15 +1130,18 @@ @ - part of checkin hyperlink_to_uuid(zVers); if( zBr && zBr[0] ){ @ on branch %z(href("%R/timeline?r=%T",zBr))%h(zBr) } - @ - %w(zCom) (user: + @ - %!w(zCom) (user: hyperlink_to_user(zUser,zDate,")"); if( g.perm.Hyperlink ){ + @ %z(href("%R/finfo?name=%T&ci=%S",zName,zVers))[ancestry] @ %z(href("%R/annotate?checkin=%S&filename=%T",zVers,zName)) @ [annotate] + @ %z(href("%R/blame?checkin=%S&filename=%T",zVers,zName)) + @ [blame] } cnt++; if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_append(pDownloadName, zName, -1); } @@ -1216,11 +1216,11 @@ @ Control file referencing } if( zType[0]!='e' ){ hyperlink_to_uuid(zUuid); } - @ - %w(zCom) by + @ - %!w(zCom) by hyperlink_to_user(zUser,zDate," on"); hyperlink_to_date(zDate, "."); if( pDownloadName && blob_size(pDownloadName)==0 ){ blob_appendf(pDownloadName, "%.10s.txt", zUuid); } @@ -1291,85 +1291,74 @@ */ void diff_page(void){ int v1, v2; int isPatch; int sideBySide; - Blob c1, c2, diff, *pOut; char *zV1; char *zV2; const char *zRe; ReCompiled *pRe = 0; u64 diffFlags; - const char *zStyle = "sbsdiff"; login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } v1 = name_to_rid_www("v1"); v2 = name_to_rid_www("v2"); if( v1==0 || v2==0 ) fossil_redirect_home(); - sideBySide = atoi(PD("sbs","1")); - zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); - zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); + zRe = P("regex"); + if( zRe ) re_compile(&pRe, zRe, 0); isPatch = P("patch")!=0; if( isPatch ){ + Blob c1, c2, *pOut; pOut = cgi_output_blob(); cgi_set_content_type("text/plain"); diffFlags = 4; - }else{ - blob_zero(&diff); - pOut = &diff; - diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; - if( sideBySide ){ - zStyle = "sbsdiff"; - }else{ - diffFlags |= DIFF_LINENO; - zStyle = "udiff"; - } - } - zRe = P("regex"); - if( zRe ) re_compile(&pRe, zRe, 0); - content_get(v1, &c1); - content_get(v2, &c2); - text_diff(&c1, &c2, pOut, pRe, diffFlags); - blob_reset(&c1); - blob_reset(&c2); - if( !isPatch ){ - style_header("Diff"); - style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", - g.zTop, P("v1"), P("v2")); - if( !sideBySide ){ - style_submenu_element("Side-by-side Diff", "sbsdiff", - "%s/fdiff?v1=%T&v2=%T&sbs=1", - g.zTop, P("v1"), P("v2")); - }else{ - style_submenu_element("Unified Diff", "udiff", - "%s/fdiff?v1=%T&v2=%T&sbs=0", - g.zTop, P("v1"), P("v2")); - } - - if( P("smhdr")!=0 ){ - @

    Differences From Artifact - @ %z(href("%R/artifact/%S",zV1))[%S(zV1)] To - @ %z(href("%R/artifact/%S",zV2))[%S(zV2)].

    - }else{ - @

    Differences From - @ Artifact %z(href("%R/artifact/%S",zV1))[%S(zV1)]:

    - object_description(v1, 0, 0); - @

    To Artifact %z(href("%R/artifact/%S",zV2))[%S(zV2)]:

    - object_description(v2, 0, 0); - } - if( pRe ){ - @ Only differences that match regular expression "%h(zRe)" - @ are shown. - } - @
    - @
    - @ %s(blob_str(&diff)) - @
    - blob_reset(&diff); - style_footer(); - } + content_get(v1, &c1); + content_get(v2, &c2); + text_diff(&c1, &c2, pOut, pRe, diffFlags); + blob_reset(&c1); + blob_reset(&c2); + return; + } + + sideBySide = !is_false(PD("sbs","1")); + zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); + zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); + diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; + + style_header("Diff"); + style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch", + g.zTop, P("v1"), P("v2")); + if( !sideBySide ){ + style_submenu_element("Side-by-side Diff", "sbsdiff", + "%s/fdiff?v1=%T&v2=%T&sbs=1", + g.zTop, P("v1"), P("v2")); + }else{ + style_submenu_element("Unified Diff", "udiff", + "%s/fdiff?v1=%T&v2=%T&sbs=0", + g.zTop, P("v1"), P("v2")); + } + + if( P("smhdr")!=0 ){ + @

    Differences From Artifact + @ %z(href("%R/artifact/%S",zV1))[%S(zV1)] To + @ %z(href("%R/artifact/%S",zV2))[%S(zV2)].

    + }else{ + @

    Differences From + @ Artifact %z(href("%R/artifact/%S",zV1))[%S(zV1)]:

    + object_description(v1, 0, 0); + @

    To Artifact %z(href("%R/artifact/%S",zV2))[%S(zV2)]:

    + object_description(v2, 0, 0); + } + if( pRe ){ + @ Only differences that match regular expression "%h(zRe)" + @ are shown. + } + @
    + append_diff(zV1, zV2, diffFlags, pRe); + append_diff_javascript(sideBySide); + style_footer(); } /* ** WEBPAGE: raw ** URL: /raw?name=ARTIFACTID&m=TYPE @@ -1474,11 +1463,11 @@ if( !g.perm.Read ){ login_needed(); return; } if( rid==0 ) fossil_redirect_home(); if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ - style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", + style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#delshun", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } @@ -1516,11 +1505,11 @@ zCI = P("ci"); if( zCI==0 ) return 0; zFilename = P("filename"); if( zFilename==0 ) return 0; cirid = name_to_rid_www("ci"); - pManifest = manifest_get(cirid, CFTYPE_MANIFEST); + pManifest = manifest_get(cirid, CFTYPE_MANIFEST, 0); if( pManifest==0 ) return 0; manifest_file_rewind(pManifest); while( (pFile = manifest_file_next(pManifest,0))!=0 ){ if( fossil_strcmp(zFilename, pFile->zName)==0 ){ int rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", pFile->zUuid); @@ -1624,11 +1613,11 @@ if( !g.perm.Read ){ login_needed(); return; } if( rid==0 ) fossil_redirect_home(); if( g.perm.Admin ){ const char *zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ - style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", + style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#accshun", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } @@ -1658,11 +1647,11 @@ }else{ renderAsHtml = 1; style_submenu_element("Text", "Text", "%s/artifact/%s?txt=1", g.zTop, zUuid); } - }else if( fossil_strcmp(zMime, "application/x-fossil-wiki")==0 ){ + }else if( fossil_strcmp(zMime, "text/x-fossil-wiki")==0 ){ if( asText ){ style_submenu_element("Wiki", "Wiki", "%s/artifact/%s", g.zTop, zUuid); }else{ renderAsWiki = 1; @@ -1677,14 +1666,15 @@ @
    content_get(rid, &content); if( renderAsWiki ){ wiki_convert(&content, 0, 0); }else if( renderAsHtml ){ - @
    - blob_to_utf8_no_bom(&content, 0); - cgi_append_content(blob_buffer(&content), blob_size(&content)); - @
    + @ }else{ style_submenu_element("Hex","Hex", "%s/hexdump?name=%s", g.zTop, zUuid); zMime = mimetype_from_content(&content); @
    if( zMime==0 ){ @@ -1723,26 +1713,26 @@ const char *zUuid; char zTktName[UUID_SIZE+1]; Manifest *pTktChng; int modPending; const char *zModAction; - + char *zTktTitle; login_check_credentials(); if( !g.perm.RdTkt ){ login_needed(); return; } rid = name_to_rid_www("name"); if( rid==0 ){ fossil_redirect_home(); } zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); if( g.perm.Admin ){ if( db_exists("SELECT 1 FROM shun WHERE uuid='%s'", zUuid) ){ - style_submenu_element("Unshun","Unshun", "%s/shun?uuid=%s&sub=1", + style_submenu_element("Unshun","Unshun", "%s/shun?accept=%s&sub=1#accshun", g.zTop, zUuid); }else{ style_submenu_element("Shun","Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); } } - pTktChng = manifest_get(rid, CFTYPE_TICKET); + pTktChng = manifest_get(rid, CFTYPE_TICKET, 0); if( pTktChng==0 ) fossil_redirect_home(); zDate = db_text(0, "SELECT datetime(%.12f)", pTktChng->rDate); memcpy(zTktName, pTktChng->zTicketUuid, UUID_SIZE+1); if( g.perm.ModTkt && (zModAction = P("modaction"))!=0 ){ if( strcmp(zModAction,"delete")==0 ){ @@ -1752,10 +1742,13 @@ } if( strcmp(zModAction,"approve")==0 ){ moderation_approve(rid); } } + zTktTitle = db_table_has_column( "ticket", "title" ) + ? db_text("(No title)", "SELECT title FROM ticket WHERE tkt_uuid=%Q", zTktName) + : 0; style_header("Ticket Change Details"); style_submenu_element("Raw", "Raw", "%R/artifact/%S", zUuid); style_submenu_element("History", "History", "%R/tkthistory/%s", zTktName); style_submenu_element("Page", "Page", "%R/tktview/%t", zTktName); style_submenu_element("Timeline", "Timeline", "%R/tkttimeline/%t", zTktName); @@ -1776,18 +1769,23 @@ modPending = moderation_pending(rid); if( modPending ){ @ *** Awaiting Moderator Approval *** } @ Ticket: - @ %z(href("%R/tktview/%s",zTktName))%s(zTktName) + @ %z(href("%R/tktview/%s",zTktName))%s(zTktName) + if( zTktTitle ){ + @
    %h(zTktTitle) + } + @ @ Date: hyperlink_to_date(zDate, ""); @ User: hyperlink_to_user(pTktChng->zUser, zDate, ""); @ free(zDate); - + free(zTktTitle); + if( g.perm.ModTkt && modPending ){ @
    Moderation
    @
    @ @