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

This document is a instruction on how to build, test and install HDF5 libary on 
Cygwin.  See detailed information in hdf5/INSTALL. 

NOTE: hdf5 can be built with CMake, see the INSTALL_CMake.txt file for more guidance.

Preconditions:
--------------

1. Installed Cygwin 1.7.25 or higher

   To install the Cygwin net release, go to http://www.cygwin.com and 
   click on "setup-x86.exe" (32-bit installation) under the heading
    "Current Cygwin DLL version". This will download a GUI 
   installer called setup-x86.exe which can be run to download a complete 
   Cygwin installation via the internet. Then follow the instructions 
   on each screen to install Cygwin.

   Cygwin uses packages to manage installing various software. Users can 
   choose to install or uninstall certain packages by running setup.exe.
   http://www.cygwin.com/packages/ provides detailed information about 
   Cygwin packages.

   Most required dependencies can be satisfied by installing all packages in
   the "Devel" category.  However, please verify that you have installed all
   packages listed below.

2. Compilers, Libraries and Utilities Installed

   2.1 Compilers Supported
    
    The following compilers are supported by HDF5 and included in the Cygwin
    package system:
       gcc (4.7.3 and 4.9.2), which includes:
            gcc4-core    : C compiler
            gcc4-g++     : C++ compiler
            gcc4-fortran : fortran compiler
            

   2.1.1 Using Compilers Not Supported
       
       By default the current configuration uses vendor compilers; to use
        another compiler run the following commands before running
        configure: 
 
        setenv CC   "foo -flags"
        setenv FC  "fffoo -flags"

       For example, if users want to use pgf90 as fortran compiler, then 

            setenv FC pgf90

        See the configure help page (configure --help) for a list of
        environment variables that have an affect on building the
        library.
        
    2.2 HDF5 External Library Dependencies

    2.2.1 Zlib

         zlib-1.2.5 or later is supported and tested on Cygwin.

    2.2.2 Szip
       The HDF5 library has a predefined compression filter that uses
       the extended-Rice lossless compression algorithm for chunked
       datatsets. For more information about Szip compression and 
       license terms see 
       http://hdfgroup.org/HDF5/doc_resource/SZIP/index.html.
      
       The latest supported public release of SZIP is available from
       ftp://ftp.hdfgroup.org/lib-external/szip/2.1.
    
    2.3 Additional Utilities
    
    The following standard utilities are also required to build and test HDF5:
        
        bison           : yacc implementation
        flex            : flex utility
        make            : make utility
    
    2.4 Alternate Build Process
    
    Download the CMake package and follow the notes in the "INSTALL_CMake.txt" 
    file to build HDF5 with the CMake utilities.
        
        
        
Build, Test and Install HDF5 on Cygwin
--------------------------------------

1. Get HDF5 source code package
   Users can download HDF5 source code package from HDF website
   (http://hdfgroup.org). 
     
2. Unpacking the distribution

   The HDF5 source code is distributed in a variety of formats which
   can be unpacked with the following commands, each of which creates 
   an `hdf5-1.10.x' directory.

   2.1 Non-compressed tar archive (*.tar)

            $ tar xf hdf5-1.10.x.tar

   2.2 Gzip'd tar archive (*.tar.gz)

            $ gunzip < hdf5-1.10.x.tar.gz | tar xf -

   2.3 Bzip'd tar archive (*.tar.bz2)

            $ bunzip2 < hdf5-1.10.x.tar.bz2 | tar xf - 

2. Setup Environment

    In Cygwin, most compilers and setting are automatically detected during
    the configure script.  However, if you are building Fortran we recommend 
    that you explicitly set the "FC" variable in your environment to use the 
    gfortran compiler.  For example, issue the command:
    
            $ export FC=gfortran
            
4. Configuring 
     
   Notes: See detailed information in hdf5/release_docs/INSTALL, 
          part 5. Full installation instructions for source 
          distributions

   The host configuration file for cygwin i686-pc-cygwin is located 
   in the `config' directory and are based on architecture name, 
   vendor name, and operating system which are displayed near the 
   beginning of the `configure' output. The host config file influences
   the behavior of configure by setting or augmenting shell variables. 
     
   In short,
     
   To configure HDF5 C Library, using 
            
            $ ./configure
                   
   To configure HDF5 C/C++ Library, using

            $ ./configure --enable-cxx
                   
   To configure HDF5 C/Fortran Library, using

            $ ./configure --enable-fortran
                   
   To configure HDF5 C with Szip library, using

            $ ./configure  --with-szlib="path to szlib"
           
       For example, if szip library was installed in the directory 
       /cygdrive/c/szip, which is parent directory of "include" and
       "lib", then the following command will configure HDF5 C library 
       with szip enabled:
           
            $ ./configure --with-szlib=/cygdrive/c/szip
                   
   To configure HDF5 C without Zlib,
     
       To disable zlib, using

           $ ./configure --without-zlib
           
   Two ways to configure HDF5 C with specified Zlib
     
      Using

           $ ./configure --with-zlib=INCDIR,LIBDIR

       For example, if the zlib library is installed in
       /cygdrive/c/usr, which is the parent directory of directories
       "include" and "lib", 

 $ ./configure --with-zlib=/cygdrive/c/usr/include,/cygdrive/c/usr/lib

      Through the CPPFLAGS and LDFLAGS Variables
           
       For example, if zlib was installed in the directory 
       /cygdrive/c/usr then using the following command to configure 
       HDF5 with zib

           $ CPPFLAGS=-I/cygdrive/c/usr/include \
           $ LDFLAGS=-L/cygdrive/c/usr/lib \
           $ ./configure

    To specify the installation directories, using 

            $ ./configure --prefix="path for installation"
                 
       By default, HDF5 library, header files, examples, and 
       support programs will be installed in /usr/local/lib,
       /usr/local/include, /usr/local/doc/hdf5/examples, and
       /usr/local/bin. To use a path other than /usr/local specify 
       the path with the `--prefix=PATH' switch as in the above
       command.

    Combination of Switches 

       All of the above switches can be combined together. For 
       example, if users want to configure HDF5 C/C++/Fortran 
       library with szip library enabled, with zlib library at 
       /cygdrive/c/usr/, and install HDF5 into directory 
       /cygdrive/c/hdf5 using gcc/g++ as C/C++ compiler and gfortran
       as fortran compiler
     
           $ ./configure
             --with-szlib=/cygdrive/c/szip
             --with-zlib=/cygdrive/c/usr/include,/cygdrive/c/usr/lib
             --prefix=/cygdrive/c/hdf5
             --enable-cxx
             --enable-fortran 
             <"If no more switches, then hit Enter">

       Notes: The command format above is for readilibity. In practice,
              please type in the command above with at least one
              space between each line, No "Enter" until users finish 
              the switches and want to run the configure. 

 
     or do it through CPPFLAGS and LDFLAGS variables:
     
           $ CPPFLAGS=-I/cygdrive/c/usr/include \
           $ LDFLAGS=-L/cygdrive/c/usr/lib \

           $ ./configure
             --with-szlib=/cygdrive/c/szip
             --prefix=/cygdrive/c/hdf5
             --enable-cxx
             --enable-fortran 
             <"If no more switches, then hit Enter">
                          
5. Make and Make Check

   After configuration is done successfully, run the following series of
   commands to build, test and install HDF5
    
            $ make          > "output file name"
            $ make check    > "output file name"
            
   Before run "make install", check output file for "make check", there
   should be no failures at all.

6. Make Install

            $ make install  > "output file name"
   
     
7. Check installed HDF5 library

   After step 6, go to your installation directory, there should be 
   three subdirectories: "bin" "include" and "lib".

8. Known Problems 
   
   dt_arith tests may fail due to the use of fork. This is a known issue
   with cygwin on Windows.

   "make check" fails when building shared lib files is enabled.  The default
   on Cygwin has been changed to disable shared.  It can be enabled with
   the --enable-shared configure option but is likely to fail "make check" 
   with GCC compilers.

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

Need Further assistance, email help@hdfgroup.org
tion> Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c6
-rw-r--r--generic/tclCmdAH.c4
-rw-r--r--generic/tclCompCmds.c4
-rw-r--r--generic/tclCompCmdsSZ.c3
-rw-r--r--generic/tclCompExpr.c2
-rw-r--r--generic/tclCompile.c19
-rw-r--r--generic/tclCompile.h10
-rw-r--r--generic/tclConfig.c4
-rw-r--r--generic/tclEncoding.c4
-rw-r--r--generic/tclEnsemble.c16
-rw-r--r--generic/tclFileName.c32
-rw-r--r--generic/tclIO.c8
-rw-r--r--generic/tclIORChan.c11
-rw-r--r--generic/tclIOUtil.c2
-rw-r--r--generic/tclInt.h19
-rw-r--r--generic/tclLoad.c30
-rw-r--r--generic/tclNamesp.c13
-rw-r--r--generic/tclOO.c6
-rw-r--r--generic/tclOOBasic.c2
-rw-r--r--generic/tclPkg.c6
-rw-r--r--generic/tclProc.c2
-rw-r--r--generic/tclTrace.c22
-rw-r--r--generic/tclUtil.c37
-rw-r--r--generic/tclZlib.c12
24 files changed, 158 insertions, 116 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 216e667..537750e 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -2612,7 +2612,7 @@ TclRenameCommand(
Tcl_DStringInit(&newFullName);
Tcl_DStringAppend(&newFullName, newNsPtr->fullName, -1);
if (newNsPtr != iPtr->globalNsPtr) {
- Tcl_DStringAppend(&newFullName, "::", 2);
+ TclDStringAppendLiteral(&newFullName, "::");
}
Tcl_DStringAppend(&newFullName, newTail, -1);
cmdPtr->refCount++;
@@ -3470,7 +3470,7 @@ Tcl_CreateMathFunc(
data->clientData = clientData;
Tcl_DStringInit(&bigName);
- Tcl_DStringAppend(&bigName, "::tcl::mathfunc::", -1);
+ TclDStringAppendLiteral(&bigName, "::tcl::mathfunc::");
Tcl_DStringAppend(&bigName, name, -1);
Tcl_CreateObjCommand(interp, Tcl_DStringValue(&bigName),
@@ -8973,7 +8973,7 @@ TclNRCoroutineObjCmd(
Tcl_DStringInit(&ds);
if (nsPtr != iPtr->globalNsPtr) {
Tcl_DStringAppend(&ds, nsPtr->fullName, -1);
- Tcl_DStringAppend(&ds, "::", 2);
+ TclDStringAppendLiteral(&ds, "::");
}
Tcl_DStringAppend(&ds, procName, -1);
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 6dfc705..f09ee70 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -1045,9 +1045,9 @@ TclMakeFileCommandSafe(
Tcl_DString oldBuf, newBuf;
Tcl_DStringInit(&oldBuf);
- Tcl_DStringAppend(&oldBuf, "::tcl::file::", -1);
+ TclDStringAppendLiteral(&oldBuf, "::tcl::file::");
Tcl_DStringInit(&newBuf);
- Tcl_DStringAppend(&newBuf, "tcl:file:", -1);
+ TclDStringAppendLiteral(&newBuf, "tcl:file:");
for (i=0 ; unsafeInfo[i].cmdName != NULL ; i++) {
if (unsafeInfo[i].unsafe) {
const char *oldName, *newName;
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 5b7e0a5..3540716 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -820,7 +820,7 @@ TclCompileDictForCmd(
*/
Tcl_DStringInit(&buffer);
- Tcl_DStringAppend(&buffer, varsTokenPtr[1].start, varsTokenPtr[1].size);
+ TclDStringAppendToken(&buffer, &varsTokenPtr[1]);
if (Tcl_SplitList(NULL, Tcl_DStringValue(&buffer), &numVars,
&argv) != TCL_OK) {
Tcl_DStringFree(&buffer);
@@ -1961,7 +1961,7 @@ TclCompileForeachCmd(
*/
Tcl_DStringInit(&varList);
- Tcl_DStringAppend(&varList, tokenPtr[1].start, tokenPtr[1].size);
+ TclDStringAppendToken(&varList, &tokenPtr[1]);
code = Tcl_SplitList(interp, Tcl_DStringValue(&varList),
&varcList[loopIndex], &varvList[loopIndex]);
Tcl_DStringFree(&varList);
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c
index b950e21..8ed3a95 100644
--- a/generic/tclCompCmdsSZ.c
+++ b/generic/tclCompCmdsSZ.c
@@ -1558,8 +1558,7 @@ IssueSwitchJumpTable(
*/
Tcl_DStringInit(&buffer);
- Tcl_DStringAppend(&buffer, bodyToken[i]->start,
- bodyToken[i]->size);
+ TclDStringAppendToken(&buffer, bodyToken[i]);
hPtr = Tcl_CreateHashEntry(&jtPtr->hashTable,
Tcl_DStringValue(&buffer), &isNew);
if (isNew) {
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 4212b6d..890d518 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2296,7 +2296,7 @@ CompileExprTree(
int length;
Tcl_DStringInit(&cmdName);
- Tcl_DStringAppend(&cmdName, "tcl::mathfunc::", -1);
+ TclDStringAppendLiteral(&cmdName, "tcl::mathfunc::");
p = TclGetStringFromObj(*funcObjv, &length);
funcObjv++;
Tcl_DStringAppend(&cmdName, p, length);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 1d88e11..d4ca284 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1661,8 +1661,8 @@ TclCompileScript(
* have side effects that rely on the unmodified string.
*/
- Tcl_DStringSetLength(&ds, 0);
- Tcl_DStringAppend(&ds, tokenPtr[1].start,tokenPtr[1].size);
+ TclDStringClear(&ds);
+ TclDStringAppendToken(&ds, &tokenPtr[1]);
cmdPtr = (Command *) Tcl_FindCommand(interp,
Tcl_DStringValue(&ds),
@@ -2044,7 +2044,7 @@ TclCompileTokens(
for ( ; count > 0; count--, tokenPtr++) {
switch (tokenPtr->type) {
case TCL_TOKEN_TEXT:
- Tcl_DStringAppend(&textBuffer, tokenPtr->start, tokenPtr->size);
+ TclDStringAppendToken(&textBuffer, tokenPtr);
TclAdvanceLines(&envPtr->line, tokenPtr->start,
tokenPtr->start + tokenPtr->size);
break;
@@ -2091,9 +2091,7 @@ TclCompileTokens(
*/
if (Tcl_DStringLength(&textBuffer) > 0) {
- int literal = TclRegisterNewLiteral(envPtr,
- Tcl_DStringValue(&textBuffer),
- Tcl_DStringLength(&textBuffer));
+ int literal = TclRegisterDStringLiteral(envPtr, &textBuffer);
TclEmitPush(literal, envPtr);
numObjsToConcat++;
@@ -2120,9 +2118,7 @@ TclCompileTokens(
if (Tcl_DStringLength(&textBuffer) > 0) {
int literal;
- literal = TclRegisterNewLiteral(envPtr,
- Tcl_DStringValue(&textBuffer),
- Tcl_DStringLength(&textBuffer));
+ literal = TclRegisterDStringLiteral(envPtr, &textBuffer);
TclEmitPush(literal, envPtr);
numObjsToConcat++;
Tcl_DStringFree(&textBuffer);
@@ -2145,13 +2141,10 @@ TclCompileTokens(
*/
if (Tcl_DStringLength(&textBuffer) > 0) {
- int literal;
+ int literal = TclRegisterDStringLiteral(envPtr, &textBuffer);
- literal = TclRegisterNewLiteral(envPtr, Tcl_DStringValue(&textBuffer),
- Tcl_DStringLength(&textBuffer));
TclEmitPush(literal, envPtr);
numObjsToConcat++;
-
if (numCL) {
TclContinuationsEnter(envPtr->literalArrayPtr[literal].objPtr,
numCL, clPosition);
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index e74da0a..ba78c36 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -1364,6 +1364,16 @@ MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst);
(envPtr->procPtr || envPtr->iPtr->varFramePtr->localCachePtr)
/*
+ * Macros for making it easier to deal with tokens and DStrings.
+ */
+
+#define TclDStringAppendToken(dsPtr, tokenPtr) \
+ Tcl_DStringAppend((dsPtr), (tokenPtr)->start, (tokenPtr)->size)
+#define TclRegisterDStringLiteral(envPtr, dsPtr) \
+ TclRegisterLiteral(envPtr, Tcl_DStringValue(dsPtr), \
+ Tcl_DStringLength(dsPtr), /*flags*/ 0)
+
+/*
* DTrace probe macros (NOPs if DTrace support is not enabled).
*/
diff --git a/generic/tclConfig.c b/generic/tclConfig.c
index b4735e8..dea487a 100644
--- a/generic/tclConfig.c
+++ b/generic/tclConfig.c
@@ -155,7 +155,7 @@ Tcl_RegisterConfig(
*/
Tcl_DStringInit(&cmdName);
- Tcl_DStringAppend(&cmdName, "::", -1);
+ TclDStringAppendLiteral(&cmdName, "::");
Tcl_DStringAppend(&cmdName, pkgName, -1);
/*
@@ -173,7 +173,7 @@ Tcl_RegisterConfig(
}
}
- Tcl_DStringAppend(&cmdName, "::pkgconfig", -1);
+ TclDStringAppendLiteral(&cmdName, "::pkgconfig");
if (Tcl_CreateObjCommand(interp, Tcl_DStringValue(&cmdName),
QueryConfigObjCmd, cdPtr, QueryConfigDelete) == NULL) {
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 49418c9..0fa6661 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1872,9 +1872,9 @@ LoadTableEncoding(
* Read lines from the encoding until EOF.
*/
- for (Tcl_DStringSetLength(&lineString, 0);
+ for (TclDStringClear(&lineString);
(len = Tcl_Gets(chan, &lineString)) >= 0;
- Tcl_DStringSetLength(&lineString, 0)) {
+ TclDStringClear(&lineString)) {
const unsigned char *p;
int to, from;
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 1e1a901..754e480 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -1425,9 +1425,9 @@ TclMakeEnsemble(
Tcl_DStringInit(&buf);
Tcl_DStringInit(&hiddenBuf);
- Tcl_DStringAppend(&hiddenBuf, "tcl:", -1);
+ TclDStringAppendLiteral(&hiddenBuf, "tcl:");
Tcl_DStringAppend(&hiddenBuf, name, -1);
- Tcl_DStringAppend(&hiddenBuf, ":", -1);
+ TclDStringAppendLiteral(&hiddenBuf, ":");
hiddenLen = Tcl_DStringLength(&hiddenBuf);
if (name[0] == ':' && name[1] == ':') {
/*
@@ -1443,14 +1443,14 @@ TclMakeEnsemble(
* multi-word list differently to a single word.
*/
- Tcl_DStringAppend(&buf, "::tcl", -1);
+ TclDStringAppendLiteral(&buf, "::tcl");
if (Tcl_SplitList(NULL, name, &nameCount, &nameParts) != TCL_OK) {
Tcl_Panic("invalid ensemble name '%s'", name);
}
for (i = 0; i < nameCount; ++i) {
- Tcl_DStringAppend(&buf, "::", 2);
+ TclDStringAppendLiteral(&buf, "::");
Tcl_DStringAppend(&buf, nameParts[i], -1);
}
}
@@ -1485,7 +1485,7 @@ TclMakeEnsemble(
Tcl_Obj *mapDict, *fromObj, *toObj;
Command *cmdPtr;
- Tcl_DStringAppend(&buf, "::", 2);
+ TclDStringAppendLiteral(&buf, "::");
TclNewObj(mapDict);
for (i=0 ; map[i].name != NULL ; i++) {
fromObj = Tcl_NewStringObj(map[i].name, -1);
@@ -1615,10 +1615,10 @@ NsEnsembleImplementationCmdNR(
Tcl_Panic("List of ensemble parameters is not a list");
}
for (; len>0; len--,elemPtrs++) {
- Tcl_DStringAppend(&buf, Tcl_GetString(*elemPtrs), -1);
- Tcl_DStringAppend(&buf, " ", -1);
+ TclDStringAppendObj(&buf, *elemPtrs);
+ TclDStringAppendLiteral(&buf, " ");
}
- Tcl_DStringAppend(&buf, "subcommand ?arg ...?", -1);
+ TclDStringAppendLiteral(&buf, "subcommand ?arg ...?");
Tcl_WrongNumArgs(interp, 1, objv, Tcl_DStringValue(&buf));
Tcl_DStringFree(&buf);
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 48c5454..63faa6d 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -72,9 +72,9 @@ SetResultLength(
{
Tcl_DStringSetLength(resultPtr, offset);
if (extended == 2) {
- Tcl_DStringAppend(resultPtr, "//?/UNC/", 8);
+ TclDStringAppendLiteral(resultPtr, "//?/UNC/");
} else if (extended == 1) {
- Tcl_DStringAppend(resultPtr, "//?/", 4);
+ TclDStringAppendLiteral(resultPtr, "//?/");
}
}
@@ -131,7 +131,7 @@ ExtractWinRoot(
if (path[1] != '/' && path[1] != '\\') {
SetResultLength(resultPtr, offset, extended);
*typePtr = TCL_PATH_VOLUME_RELATIVE;
- Tcl_DStringAppend(resultPtr, "/", 1);
+ TclDStringAppendLiteral(resultPtr, "/");
return &path[1];
}
host = &path[2];
@@ -161,7 +161,7 @@ ExtractWinRoot(
*/
*typePtr = TCL_PATH_VOLUME_RELATIVE;
- Tcl_DStringAppend(resultPtr, "/", 1);
+ TclDStringAppendLiteral(resultPtr, "/");
return &path[2];
}
SetResultLength(resultPtr, offset, extended);
@@ -180,9 +180,9 @@ ExtractWinRoot(
break;
}
}
- Tcl_DStringAppend(resultPtr, "//", 2);
+ TclDStringAppendLiteral(resultPtr, "//");
Tcl_DStringAppend(resultPtr, host, hlen);
- Tcl_DStringAppend(resultPtr, "/", 1);
+ TclDStringAppendLiteral(resultPtr, "/");
Tcl_DStringAppend(resultPtr, share, slen);
tail = &share[slen];
@@ -221,7 +221,7 @@ ExtractWinRoot(
*typePtr = TCL_PATH_ABSOLUTE;
Tcl_DStringAppend(resultPtr, path, 2);
- Tcl_DStringAppend(resultPtr, "/", 1);
+ TclDStringAppendLiteral(resultPtr, "/");
return tail;
}
@@ -1057,7 +1057,7 @@ Tcl_TranslateFileName(
}
Tcl_DStringInit(bufferPtr);
- Tcl_DStringAppend(bufferPtr, Tcl_GetString(transPtr), -1);
+ TclDStringAppendObj(bufferPtr, transPtr);
Tcl_DecrRefCount(path);
Tcl_DecrRefCount(transPtr);
@@ -1413,7 +1413,7 @@ Tcl_GlobObjCmd(
search = Tcl_DStringValue(&pref);
while ((find = (strpbrk(search, "\\[]*?{}"))) != NULL) {
Tcl_DStringAppend(&prefix, search, find-search);
- Tcl_DStringAppend(&prefix, "\\", 1);
+ TclDStringAppendLiteral(&prefix, "\\");
Tcl_DStringAppend(&prefix, find, 1);
search = find+1;
if (*search == '\0') {
@@ -1592,11 +1592,9 @@ Tcl_GlobObjCmd(
for (i = 0; i < objc; i++) {
Tcl_DStringInit(&str);
if (dir == PATH_GENERAL) {
- Tcl_DStringAppend(&str, Tcl_DStringValue(&prefix),
- Tcl_DStringLength(&prefix));
+ TclDStringAppendDString(&str, &prefix);
}
- string = Tcl_GetStringFromObj(objv[i], &length);
- Tcl_DStringAppend(&str, string, length);
+ TclDStringAppendObj(&str, objv[i]);
if (TclGlob(interp, Tcl_DStringValue(&str), pathOrDir, globFlags,
globTypes) != TCL_OK) {
result = TCL_ERROR;
@@ -2401,9 +2399,9 @@ DoGlob(
if (length == 0 && (Tcl_DStringLength(&append) == 0)) {
if (((*name == '\\') && (name[1] == '/' ||
name[1] == '\\')) || (*name == '/')) {
- Tcl_DStringAppend(&append, "/", 1);
+ TclDStringAppendLiteral(&append, "/");
} else {
- Tcl_DStringAppend(&append, ".", 1);
+ TclDStringAppendLiteral(&append, ".");
}
}
@@ -2412,9 +2410,9 @@ DoGlob(
case TCL_PLATFORM_UNIX:
if (length == 0 && (Tcl_DStringLength(&append) == 0)) {
if ((*name == '\\' && name[1] == '/') || (*name == '/')) {
- Tcl_DStringAppend(&append, "/", 1);
+ TclDStringAppendLiteral(&append, "/");
} else {
- Tcl_DStringAppend(&append, ".", 1);
+ TclDStringAppendLiteral(&append, ".");
}
}
break;
diff --git a/generic/tclIO.c b/generic/tclIO.c
index a76aba3..ea6c2d7 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4431,14 +4431,12 @@ Tcl_Gets(
* for managing the storage. */
{
Tcl_Obj *objPtr;
- int charsStored, length;
- const char *string;
+ int charsStored;
TclNewObj(objPtr);
charsStored = Tcl_GetsObj(chan, objPtr);
if (charsStored > 0) {
- string = TclGetStringFromObj(objPtr, &length);
- Tcl_DStringAppend(lineRead, string, length);
+ TclDStringAppendObj(lineRead, objPtr);
}
TclDecrRefCount(objPtr);
return charsStored;
@@ -7550,7 +7548,7 @@ Tcl_BadChannelOption(
Tcl_DStringInit(&ds);
Tcl_DStringAppend(&ds, genericopt, -1);
if (optionList && (*optionList)) {
- Tcl_DStringAppend(&ds, " ", 1);
+ TclDStringAppendLiteral(&ds, " ");
Tcl_DStringAppend(&ds, optionList, -1);
}
if (Tcl_SplitList(interp, Tcl_DStringValue(&ds),
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index 938def2..6fec40a 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -1947,7 +1947,7 @@ ReflectGetOption(
*/
if (optionObj != NULL) {
- Tcl_DStringAppend(dsPtr, TclGetString(resObj), -1);
+ TclDStringAppendObj(dsPtr, resObj);
goto ok;
}
@@ -1982,7 +1982,7 @@ ReflectGetOption(
const char *str = Tcl_GetStringFromObj(resObj, &len);
if (len) {
- Tcl_DStringAppend(dsPtr, " ", 1);
+ TclDStringAppendLiteral(dsPtr, " ");
Tcl_DStringAppend(dsPtr, str, len);
}
goto ok;
@@ -3207,8 +3207,7 @@ ForwardProc(
if (InvokeTclMethod(rcPtr, "cget", optionObj, NULL, &resObj)!=TCL_OK){
ForwardSetObjError(paramPtr, resObj);
} else {
- Tcl_DStringAppend(paramPtr->getOpt.value,
- TclGetString(resObj), -1);
+ TclDStringAppendObj(paramPtr->getOpt.value, resObj);
}
Tcl_Release(rcPtr);
Tcl_DecrRefCount(optionObj);
@@ -3233,7 +3232,7 @@ ForwardProc(
Tcl_Obj **listv;
if (Tcl_ListObjGetElements(interp, resObj, &listc,
- &listv) != TCL_OK) {
+ &listv) != TCL_OK) {
Tcl_DecrRefCount(resObj);
resObj = MarshallError(interp);
ForwardSetObjError(paramPtr, resObj);
@@ -3253,7 +3252,7 @@ ForwardProc(
const char *str = Tcl_GetStringFromObj(resObj, &len);
if (len) {
- Tcl_DStringAppend(paramPtr->getOpt.value, " ", 1);
+ TclDStringAppendLiteral(paramPtr->getOpt.value, " ");
Tcl_DStringAppend(paramPtr->getOpt.value, str, len);
}
}
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index bea1897..41a5aac 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -405,7 +405,7 @@ Tcl_GetCwd(
return NULL;
}
Tcl_DStringInit(cwdPtr);
- Tcl_DStringAppend(cwdPtr, Tcl_GetString(cwd), -1);
+ TclDStringAppendObj(cwdPtr, cwd);
Tcl_DecrRefCount(cwd);
return Tcl_DStringValue(cwdPtr);
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 9068dfb..53a88d6 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2920,6 +2920,10 @@ MODULE_SCOPE void TclCreateLateExitHandler(Tcl_ExitProc *proc,
ClientData clientData);
MODULE_SCOPE void TclDeleteLateExitHandler(Tcl_ExitProc *proc,
ClientData clientData);
+MODULE_SCOPE char * TclDStringAppendObj(Tcl_DString *dsPtr,
+ Tcl_Obj *objPtr);
+MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr,
+ Tcl_DString *toAppendPtr);
MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr);
MODULE_SCOPE void TclFinalizeAllocSubsystem(void);
MODULE_SCOPE void TclFinalizeAsync(void);
@@ -4452,6 +4456,21 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
/*
*----------------------------------------------------------------
+ * Convenience macros for DStrings.
+ * The ANSI C "prototypes" for these macros are:
+ *
+ * MODULE_SCOPE char * TclDStringAppendLiteral(Tcl_DString *dsPtr,
+ * const char *sLiteral);
+ * MODULE_SCOPE void TclDStringClear(Tcl_DString *dsPtr);
+ */
+
+#define TclDStringAppendLiteral(dsPtr, sLiteral) \
+ Tcl_DStringAppend((dsPtr), (sLiteral), (int) (sizeof(sLiteral "") - 1))
+#define TclDStringClear(dsPtr) \
+ Tcl_DStringSetLength((dsPtr), 0)
+
+/*
+ *----------------------------------------------------------------
* Macros used by the Tcl core to test for some special double values.
* The ANSI C "prototypes" for these macros are:
*
diff --git a/generic/tclLoad.c b/generic/tclLoad.c