未验证 提交 b0bb0e49 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2986 from taosdata/feature/os

Feature/os
...@@ -121,6 +121,7 @@ IF (TD_WINDOWS) ...@@ -121,6 +121,7 @@ IF (TD_WINDOWS)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/wepoll/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/wepoll/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MsvcLibX/include)
ENDIF () ENDIF ()
IF (TD_WINDOWS_64) IF (TD_WINDOWS_64)
......
...@@ -27,7 +27,7 @@ ELSEIF (TD_WINDOWS_64) ...@@ -27,7 +27,7 @@ ELSEIF (TD_WINDOWS_64)
#INSTALL(TARGETS taos RUNTIME DESTINATION driver) #INSTALL(TARGETS taos RUNTIME DESTINATION driver)
#INSTALL(TARGETS shell RUNTIME DESTINATION .) #INSTALL(TARGETS shell RUNTIME DESTINATION .)
IF (TD_MVN_INSTALLED) IF (TD_MVN_INSTALLED)
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-1.0.2-dist.jar DESTINATION connector/jdbc) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.0-dist.jar DESTINATION connector/jdbc)
ENDIF () ENDIF ()
ELSE () ELSE ()
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libtaos.dll DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libtaos.dll DESTINATION driver)
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine) PROJECT(TDengine)
IF (TD_WINDOWS_64) IF (TD_WINDOWS)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(FindWindowsSDK)
get_mywindowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIR)
get_ucrt_include_dirs(${WINDOWSSDK_PREFERRED_DIR} UCRT_INCLUDE_DIR)
Add_Definitions("-DWSDKINCLUDE=${WINSDK_INCLUDE_DIR}")
include(FindMSVC)
Add_Definitions("-DMSVCINCLUDE=${VC_INCLUDE_DIR}")
IF ((NOT DEFINED UCRT_INCLUDE_DIR) OR (UCRT_INCLUDE_DIR STREQUAL "NOTFOUND"))
Message(STATUS "UCRT_INCLUDE_DIR notu found, set it to vc incude dir")
SET(UCRT_INCLUDE_DIR "${VC_INCLUDE_DIR}")
Add_Definitions("-DUCRTINCLUDE=${VC_INCLUDE_DIR}")
ELSE ()
Add_Definitions("-DUCRTINCLUDE=${UCRT_INCLUDE_DIR}")
ENDIF ()
Message(STATUS "WINSDK_INCLUDE_DIR: ${WINSDK_INCLUDE_DIR}")
Message(STATUS "UCRT_INCLUDE_DIR: ${UCRT_INCLUDE_DIR}")
Message(STATUS "VC_INCLUDE_DIR: ${VC_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(include) INCLUDE_DIRECTORIES(include)
AUX_SOURCE_DIRECTORY(src SRC) AUX_SOURCE_DIRECTORY(src SRC)
ADD_LIBRARY(MsvcLibXw64 ${SRC}) ADD_LIBRARY(MsvcLibXw64 ${SRC})
......
MsvcLibX - A set of MSVC Library eXtensions
===========================================
Introduction
------------
The MsvcLibX library is built upon 30 years of work.
It exists because the Microsoft Visual C/C++ library is only a subset of the
standard C library, and I wanted to port to DOS and Windows programs using some
of the missing parts.
Initially Microsoft C compilers for MS-DOS tried to be as compliant as possible
with the standard C library. Then Microsoft rewrote their library for Windows.
But when the WIN32 API became prevalent, Microsoft apparently lost interest,
and stopped porting to MS-DOS and Windows the new C include files and library
routines that got standardized over the years.
To the point that's it's now impossible to rebuild any recent Posix/Unix/Linux
program using the MSVC library.
MsvcLibX adds a number of standard include files and library routines that I've
needed over the years. For example the directory access routines defined in
dirent.h, or the symbolic link support in unistd.h.
It also includes a number of useful routines and macros, either needed
internally to implement and debug the above, or made necessary by irresolvable
incompatibilities between Unix and Windows.
Other major features of the MsvcLibX library are:
* A powerful make system, based on Microsoft nmake files, that allow building
multiple versions of the same program (Ex: DOS/WIN32/WIN64) with one simple
command. And in most cases without having to write any dedicated make file.
* Support for UTF-8 sources, allowing to build programs working in any code page.
* Support for NTFS symlinks and junctions.
* Support for DOS, and Windows 95 targets, for targeting old computers.
* Support for bound DOS+Windows programs, for truly universal executables that
work in *all* versions of DOS and Windows.
An obvious alternative exists for building Windows programs: MinGW.
But I started all this before MinGW even existed. And, surprisingly, even MinGW
still has holes in 2014, where MsvcLibX in significantly more advanced.
Another alternative is CygWin. This one is more complete, but also much more
heavyweight. Using programs built with CygWin requires installing CygWin DLLs.
Copying the program .exe from one system to the next is not sufficient. In that
sense, MinGW or MsvcLibX are much better.
Contrary to MinGW and CygWin, MsvcLibX does not attempt to be complete, and is
unlikely to ever be. But any contribution of improvements is welcome.
Likewise, any help at contributing unique MsvcLibX features to MinGW is welcome.
Jean-François Larvoire
2016-09-29
Building the MsvcLibX library
-----------------------------
On a recent Windows PC, with Microsoft Visual C++ compilers installed:
- Select a base work directory. I'll call it %BASEDIR% in the examples below:
set "HOME=%HOMEDRIVE%%HOMEPATH%"
set "BASEDIR=%HOME%\Documents\SRC"
md "%BASEDIR%"
cd "%BASEDIR%"
- Extract the MsvcLibX archive into a work subdirectory. Ex: %BASEDIR%\MsvcLibX\
This will put files in several subdirectories: include, src
- Open a cmd window, and run:
cd "%BASEDIR%\MsvcLibX\src"
configure
make
The configure.bat script will locate your MSVC tools, and generate a config
file. It needs to be run once initially, then again if new MSVC tool versions
are installed.
The make.bat script should take care of everything, and rebuild normal and debug
versions of the MsvcLibX.lib library for all operating systems your tools support.
In the end, it defines system environment variable MSVCLIBX, necessary for
building programs using the MsvcLibX.lib library.
Requirements:
- Microsoft Visual C++ compiler and linker for Windows 32 and 64 bits targets.
- Microsoft Windows SDK. (May be installed along with Visual C++)
As of 2015-12-10, I've tested the make.bat script and make files with Visual C++
2005, 2008, 2012, and 2015, and Windows SDK 5.2, 8.1, and 10.
Support for older versions is still built-in, but I've not tested it for long.
Support for newer versions will require minor tweaks in configure.bat.
Note that configure.bat does not depend on MSVC's vcvars.bat. It will attempt
to locate and use the latest usable version of MSVC it finds in Program Files.
Optional:
- Microsoft Visual C++ 1.52 compiler and linker for MS-DOS targets.
If present in C:\MSVC, make.bat will also generate libraries for DOS.
Note that generating DOS versions is still more useful than it looks:
Experience has shown that the severe memory constraints under DOS are a very
good revelator of memory leaks, and other bad pointer issues. Build your
programs for DOS too if you can, and test them in a VM with Windows XP.
This takes a very small extra build time. And it'll be very much worth the time
if the Windows version appears to work, but the DOS version does not.
Visual C++ 1.52 is available on the Visual Studio 2005 CD.
- The Visual C++ 8 compiler and tools from Microsoft Visual Studio 2005.
This is the last version that allowed building programs for Windows 95/NT4.
The MsvcLibX.lib libraries are generated in subdirectories of src, then copied
into the %BASEDIR%\MsvcLibX\lib directory, and renamed as shown in this table:
Subdirectory | Description | Renamed as
---------------- | -------------------------------------- | ----------------
DOS\BIN\T\ | DOS normal version, tiny memory model | MsvcLibXdt.lib
DOS\DEBUG\BIN\T\ | DOS debug version, tiny memory model | MsvcLibXdtd.lib
DOS\BIN\S\ | DOS normal version, small memory model | MsvcLibXds.lib
DOS\DEBUG\BIN\S\ | DOS debug version, small memory model | MsvcLibXdsd.lib
DOS\BIN\L\ | DOS normal version, large memory model | MsvcLibXdl.lib
DOS\DEBUG\BIN\L\ | DOS debug version, large memory model | MsvcLibXdld.lib
WIN95\ | WIN32 normal version for Windows 95 | MsvcLibXw32.lib
WIN95\DEBUG\ | WIN32 debug version for Windows 95 | MsvcLibXw32d.lib
WIN32\ | WIN32 (X86) normal version | MsvcLibXw32.lib
WIN32\DEBUG\ | WIN32 (X86) debug version | MsvcLibXw32d.lib
WIN64\ | WIN64 (AMD64) normal version | MsvcLibXw64.lib
WIN64\DEBUG\ | WIN64 (AMD64) debug version | MsvcLibXw64d.lib
Building programs using the MsvcLibX library
--------------------------------------------
Create a work directory, distinct from the MsvcLibX directories. Ex:
set "HOME=%HOMEDRIVE%%HOMEPATH%"
set "BASEDIR=%HOME%\Documents\SRC"
md "%BASEDIR%\MyTools"
cd "%BASEDIR%\MyTools"
:# Define a variable giving the location of the MsvcLibX base directory
:# (Automatically defined if you built the library already on that same system.)
set "MSVCLIBX=%BASEDIR%\MsvcLibX"
:# Get batch files and make files from MsvcLibX sources
copy "%MSVCLIBX%\src\*.bat"
copy "%MSVCLIBX%\src\*.mak"
:# Create the configuration file (To be done just once)
configure
:# Compile and link your C or C++ program.
:# Ex, for the dirc.c sample, to create all dirc.exe versions, type:
make dirc.exe
:# If there is any error, the dirc.log file will pop up.
:# If there's no error, it's possible to check for warnings by reading dirc.log:
notepad dirc.log
:# All generated object files, listings, executables, etc, are in
:# target-OS-specific subdirectories, like for the MsvcLibX builds above.
:# They're automatically linked with the corresponding (renamed) MsvcLibX*.lib.
make.bat will generate WIN32 (X86) and WIN64 (AMD64) versions by default,
and put them respectively in the WIN32\ and WIN64\ subdirectories.
It will also generate a DOS version in DOS\ if MSVC 1.52 is installed.
It will also generate a WIN95 version in WIN95\ if MSVC 8 (aka. 2005) is installed.
Run `make -?` get a help screen for make.bat.
Note that the configure.bat and make.bat scripts are actually independent of the
rest of the MsvcLibX library. They can be used to easily build any console
programs for DOS and Windows, without loading the Visual Studio GUI.
An exe.bat script is a front-end to make.bat, saving a few characters to type:
`exe dirc` <==> `make dirc.exe`
Building Linux versions of the same programs
--------------------------------------------
Install virtual machines with Linux, and give them access to the host's file
system, for example in the /c directory.
Then execute the following commands, adapting the paths as needed:
# Go to the work directory
BASEDIR=/c/Users/YOURNAME/Documents/SRC
mkdir $BASEDIR/MyTools
cd $BASEDIR/MyTools
# Get a bash script to build Linux versions using similar directory outputs
cp $BASEDIR/MsvcLibX/src/exe .
# Make sure the Linux C compiler finds MsvcLibX debug macros, but not other MsvcLibX include files.
# Important: Do not point C_INCLUDE_PATH at MsvcLibX/include, as this directory
# contains duplicates for standard include files (Ex: stdio.h), that will fail
# to compile in Linux.
mkdir ~/include
cp $BASEDIR/MsvcLibX/include/debugm.h ~/include
export C_INCLUDE_PATH=~/include
# Make sure that variable is defined in all future sessions
echo "export C_INCLUDE_PATH=~/include" >>~/.bashrc
# Compile your sample dirc.c program (which uses MsvcLibX debug macros)
./exe dirc
# The output will be in subdirectories such as Linux.i686/ or Linux.x86_64/.
# (The exact name depends on `echo "$(uname -s).$(uname -m)"` output)
Adding new files to the library
-------------------------------
All new files should have headers and comments similar to the existing ones.
To add a new source file (let's call it newfile.c) into the library:
- Put newfile.c in the %MSVCLIBX%\src directory.
- Add a +newfile.obj entry to the OBJECTS list in %MSVCLIBX%\src\Files.mak
- Also add a rule with newfile.c include files dependencies in src\Files.mak.
- Rebuild the library, and make sure there are no errors nor warnings.
To add a new include file into the library:
- All new include file names should be standard C library include files names!
- Put it in the include or include\sys subdirectory.
To add an include file overriding an homonym one in the MSVC library:
- The trick is to make it include MSVC's one, then define its own extensions.
As MSVC compilers do not support the #include_next directive, I've implemented
a mechanism for including MSVC include files using their full pathname.
As an example, see include/direct.h or include/sys/stat.h.
The make file system
--------------------
Microsoft Visual Studio tools contain a build tool called nmake, very similar
to, but slightly incompatible with, Unix make.
MsvcLibX's make.bat is designed to give a similar feel to Unix make.
It uses internally a number of make files:
Make file | Description
----------- | ----------------------------------------------------------------
NMakefile | Default make file to use, if none is specified.
DOS.mak | Generic rules for building MS-DOS programs into the DOS subdir.
WIN32.mak | Generic rules for building 32-bits Windows programs into WIN32.
WIN64.mak | Generic rules for building 64-bits Windows programs into WIN64.
WIN95.mak | Generic rules for building Windows 95 programs into WIN95.
All.mak | Generic rules for building one or more of the above.
Files.mak | Application-specific source file dependancy rules. Intended to be includable from both Windows' nmakefile and Linux' makefile.
DOS.mak, WIN32.mak, WIN64.mak, and All.mak are pretty stable, and should not
be changed. The only likely case where a change is needed would be to add extra
libraries to link with _all_ programs.
To add a library for one particular program, it'd be better to add a specific
rule in its own make file, as described below.
In all cases, see the detailed notes in each make file header.
Specific make files:
To build a target called program.exe, the 5 make files with generic rules
(DOS.mak, WIN32.mak, WIN64.mak, WIN95.mak, and All.mak) first look for a
specific make file called program.mak. They include it if present. This allows
defining application-specific rules.
These rules should use macros defined in the 4 make files to specify the
build environment and parameters. Here's a list of the most useful ones:
Macro | Description
--------- | ----------------------------------------------------------------
T | Target OS. One of DOS, WIN32, WIN64, WIN95.
S | Path of the source files
O | Path where to put the object files
B | Path where to put the binary executable files
L | Path where to put the listings
CFLAGS | Flags for Microsoft C compiler
INCLUDE | List of C include file paths, serarated by ';'
LFLAGS | Flags for Microsoft linker
PROGRAM | The program base name, infered from the target name.
SOURCES | The list of sources for the program. Default: PROGRAM.c or .cpp
OBJECTS | The list of objects to link. Default: PROGRAM.obj
Scripts:
Script | Description
--------------------- | --------------------------------------------------------
make.bat | The main build tool. Invokes nmake.
config.%HOSTNAME%.bat | Defines paths to all tools used by make. Do not edit.
configure.bat | Analyses your system, and generates a config.%HOSTNAME%.bat file.
configure.*.bat | Define user or task-specific extensions to configure.bat.
exe.bat | Front end to make.bat, generating multiple goals.
exe | Linux shell script, invoking cc with multiple goals.
src2objs.bat | Internal script used by make files to convert SOURCES to OBJECTS
configure.bat with search for configure.*.bat scripts in %windir%, then in %HOME%,
then in the current directory.
Put configuration scripts with your global preferences in %windir% for example.
Within each directory, the files are called in the alphabetic order, allowing
to manage predictable dependancies.
Example 1: The 2clip program has no MS-DOS version. To prevent the make system
from attempting to build a DOS version (Only necessary if you DO have MSVC 1.52
installed), create a 2clip.mak file with this content:
!IF "$(T)"=="DOS"
complain:
@echo>con There's no DOS version of this program.
dirs $(O)\2clip.obj $(B)\2clip.exe: complain
@rem Do nothing
!ENDIF
Example 2: Porting to Windows a resize.c program manipulating jpeg images,
and using the libjpeg library. Create a resize.mak file with lines like these:
INCLUDE=$(INCLUDE);C:\JFL\SRC\Libs\libjpeg;C:\JFL\SRC\Libs\libjpeg\jpeg-8d
LFLAGS=$(LFLAGS) C:\JFL\SRC\Libs\libjpeg\$(B)\libjpeg.lib
Example 3: Some Windows programs need to include additional resources, defined
in a .rc file. Ex: The update program uses a manifest to control its rights.
Create an update.mak file with directives like this:
!IF "$(T)"=="WIN32" || "$(T)"=="WIN64"
SOURCES=update.c update.rc
LFLAGS=$(LFLAGS) /MANIFEST
!ENDIF
The debug system
----------------
The MsvcLibX library makes it easy to build two versions of each program:
- A release version, small lean and fast.
- A debug version, with additional code to help developers debug the program.
It follows Microsoft's convention of defining the macro _DEBUG when compiling
a C/C++ source for a debug build.
But it goes much further, by providing in debugm.h a set of macros to assist
debugging.
The general principle is that by default, the debug version operates exactly
like the release version. (Except possibly for performance)
Then, if the "debug mode" is enabled, it outputs debug messages on stdout.
A major property of the MsvcLibX debugging output is that is is intended by
function call depth. This makes it considerably easier to read the debug output.
The MsvcLibX library itself is built in debug and release versions.
The make.bat system will link the release version of your program with the
release version of the MsvcLibX library, and likewise for the debug versions.
To use it, include debugm.h in your main module, and add to your main() routine
a command-line option (-d or --debug maybe?) that calls DEBUG_ON().
There's also an "extra debug mode", displaying even more details than the
debug mode. It is enabled by calling DEBUG_ON() twice. ==> Invoke with -d -d.
Debug macros:
Macro | Description
--------------------------- | ------------------------------------------------
DEBUG_ON() | Enable the debug mode.
DEBUG_CODE(...) | The code within parentheses is only compiled in the debug version
DEBUG_PRINTF((format, ...)) | Generates a printf instruction in the debug version only, that prints only if debug mode is enabled, with the output indented by call depth.
DEBUG_ENTER((format, ...)) | Like DEBUG_PRINTF, but for use at the beginning of a function. Increases the indent level.
DEBUG_LEAVE((format, ...)) | Like DEBUG_PRINTF, but for use before returning from a function. Decreases the indent level.
Note that every use of DEBUG_ENTER must be matched by one DEBUG_LEAVE. So if a
function has several return instructions, every return must be preceded by a
DEBUG_LEAVE.
DEBUG_LEAVE alternatives:
To further simplify the source, a pair DEBUG_LEAVE()/return can be replaced by
one of the following macros:
Macro | Simplified description
----------------------------- | ------------------------------------------------
RETURN_INT(i) | DEBUG_LEAVE(("return %d\n", i)); return i;
RETURN_INT_COMMENT(i, (args)) | Idem, plus prints a comment behind the return
RETURN_BOOL(b) | DEBUG_LEAVE(("return %s\n", b?"TRUE":"FALSE")); return b;
RETURN_BOOL_COMMENT(b, (...)) | Idem, plus prints a comment behind the return
RETURN_CHAR(c) | DEBUG_LEAVE(("return %c\n", c)); return c;
RETURN_STRING(s) | DEBUG_LEAVE(("return %s\n", s)); return s;
For all the above, the release version just does return retValue;
Example for a recursive function factorial:
int fact(int n) {
DEBUG_ENTER((__FUNCTION__ "(%d);\n", n));
if (n) n *= fact(n-1); else n = 1;
RETURN_INT(n);
}
The debug version, in debug mode, invoked with argument 4, prints:
fact(4);
fact(3);
fact(2);
fact(1);
fact(0);
return 1;
return 1;
return 2;
return 6;
return 24;
Support for UTF-8 sources
-------------------------
The MsvcLibX library supports writing C programs using 8-bit characters,
with strings encoded as UTF-8, and that will work for any cmd.exe code page.
This makes the sources much more simple and readable that using full-fledged
Unicode, with 16-bits wchar_t or WCHAR and L"strings" or _T("strings").
Note: The cmd.exe code page can be read and changed with the CHCP command.
The most common code pages are:
CP | Description
----- | ----------------------------------------------------------------------------
437 | MS-DOS OEM code page, still used by cmd.exe in US and west-European systems.
1252 | Windows "ANSI" code page, used by most GUI programs, like notepad.exe.
65001 | UTF-8 code page. Allows display any Unicode character.
Important: Changing the code page will only work correctly if cmd.exe is using
a TrueType font. The default "Raster" font supports code page 437 only.
To enable that UTF-8 support:
1. Set the C or C++ source encoding to UTF-8 with BOM. (BOM = Byte-Order Mark)
Having a BOM is important, as without it some Windows editors will incorrectly
detect the encoding, and then sometimes corrupt the source.
2. Define one of the following constants in the .c source, _before_ including
any .h include files:
#define _BSD_SOURCE 1 /* Defined by many standard BSD-Unix programs */
#define _GNU_SOURCE 1 /* Defined by many standard GNU-Unix/Linux programs */
#define _UTF8_SOURCE 1 /* MsvcLibX-specific */
Note that most modern Linux compilers do expect C sources encoded as UTF-8,
and will silently ignore the UTF-8 BOM if present.
Internally, MsvcLibX extends Microsoft's convention of having two ANSI and Wide
versions of each routine, respectively with an 'A' and a 'W' suffix. Ex:
FindFirstFile() being an alias to either FindFirstFileA() or FindFirstFileW().
MsvcLibX uses two additional suffixes: 'U' for the UTF-8 version, and 'M' for
the common MultiByte subroutine used by both the 'A' and 'U' versions. Ex:
Function | Description
---------- | ---------------------------------------------------------------
readlinkW | Posix routine readlink - Wide char version
readlinkM | MultiByte char sub-routine, used by the next two routines.
readlinkA | Posix routine readlink - ANSI version
readlinkU | Posix routine readlink - UTF-8 version
readlink | Posix routine readlink - Alias to either readlinkA or readlinkU
Note that the M version has one additional argument: The code page to use for
converting strings to and from Unicode. In that sense, it's not Posix-compliant.
Gotcha: As of 2014-03-25, most file I/O and enumeration routines have been
restructured this way, but a few have not yet been:
scandir() and lstat() only support UTF-8 file names, not ANSI names.
Gotcha: As of 2014-03-25, there's a potential issue with the C main() routine:
Supporting UTF-8 file names is not just supporting UTF-8 strings in library
functions. It's also necessary to process the command line, so that command line
arguments are passed in to the main() routine as UTF-8 strings.
Currently this is implemented as a macro that redefines the main token, so
that it generates a main() routine just calling a _mainU0() routine from
MsvcLibX.lib, followed by another local _mainU() routine with the body intended
for your main routine. Ex:
int main(int argc, char *argv[]) { /* your main body */ }
Becomes:
int main(int argc, char *argv[]) {return _mainU0()}
int _mainU(int argc, char *argv[]) { /* your main body */ }
The _mainU0() routine from MsvcLibX.lib reprocesses the Win32 command line as
UTF-8 argv[] arguments, then calls _mainU(argc, argv[]).
This works well and transparently, except in one case:
If one of your sources or include files contain a prototype for the main()
routine, then MsvcLibX' main macro will break that prototype, and cause
compilation and/or link errors.
If this happens, simply remove the main() prototype, which is useless anyway.
Support for NTFS symlinks and junctions
---------------------------------------
Posix defines only a single kind of symbolic links, usable for any kind of
targets, whether they're files, directories, or further symbolic links.
The standard C library defines functions for managing symbolic links:
Function | Description
---------- | ----------------------------------------------------------------
readlink() | Read a link target
symlink() | Create a link, or change its target
lstat() | Read the metadata (timestamp, access rights) for the link itself
lchmod() | Change the link access rights
lchown() | Change the link owner
realpath() | Generate an absolute path, with all links resolved
Windows defines three types of links:
Type | Description
--------- | ---------------------------------------------------------------
SYMLINK | Symbolic link to a file
SYMLINKD | Symbolic link to a directory
JUNCTION | Mount point, often used as a symbolic link to another directory
All three types can be created in Vista and later by the mklink command.
JUNCTIONS can also be created in 2000 and later by Microsoft's SysInternal's
junction command.
One important difference is that JUNCTIONs can be created with normal user
rights, whereas SYMLINKs and SYMLINKDs require administrator rights in an
elevated command window.
A second important difference is that on networks, SYMLINKs and SYMLINKDs are
interpreted on the client side, whereas JUNCTIONs are interpreted on the server
side (despite having their target readable from the client side).
The MsvcLibcX library tries to hide that complexity, and implements the standard
functions as if there were only one kind of link.
It also provides non-standard functions symlinkd() and junction() to
specifically create SYMLINKDs and JUNCTIONs respectively.
Notes about readlink():
For SYMLINKs and SYMLINKDs, the case is straightforward.
For JUNCTIONs, there are two problems:
- The target is stored as an absolute path, even when the JUNCTION was created
with a relative path. readlink() tries to convert the absolute path to a
relative path, so that file copying utilities can clone trees with internal
JUNCTIONs.
- When the JUNCTION is on a network drive, the target refers to the absolute
path on the server. This may not be accessible from the client through the
existing mounted shares. Even when this is accessible, it's not always easy
to map the server path to a valid client path.
readlink() uses heuristics which always work for drives shared at the drive
level. Ex: a C: drive shared as C$, a D: drive shared as D$, etc.
The heuristic also very likely works for drives shared at the root or first
directory level. Ex: C:\ shared as CROOT, or C:\Public shared as PUBLIC.
As of 2014-03-25, it'll fail in any other case. Ex:
C:\Users\YOURNAME shared as YOURHOME,
or a C:\Public share mounted through its subdirectory C:\Public\Temp
Notes about symlink():
symlink() will attempt to create a SYMLINK or a SYMLINKD, depending on the type
of the target. This works well when the target exists. But when it does not
(which is legal), it will create a SYMLINK by default, or a SYMLINKD if the
target ends with a '/' or a '\'. Posix allows, but does not require, providing
a trailing '/', so the link type may possibly be incorrect.
junction() will have the same issues as readlink() above.
Notes about junction():
The problem for junction() is to convert a client-side target pathname provided
by the program running on the client, to a server-side pathname, necessary for
junctions to work.
For full-drive shares (i.e. any share named like D$), this is easy.
For non-full-drive shares (i.e. anything else), it will assume this is a
first level shared directory on the C: drive. Ex: A link on share PUBLIC
will be targeted at C:\PUBLIC.
Problem: The junction will not work if the share actually resides anywhere else
on the server. But, surprisingly, there's an easy workaround:
Simply create manually on the server itself, a junction called C:\PUBLIC,
pointing at the actual directory shared as PUBLIC.
This way the junctions created from the client side will work correctly, both
on the client and on the server side, after being resolved on the server side
through that second junction.
Support for Windows 95/98
-------------------------
The configure.bat script searches for old versions of the Visual C++ compiler,
which can build WIN32 programs that can run in Windows 95/98/ME/NT4.
The most recent of these is Visual C++ 8, from Visual Studio 2005.
The make.bat script can then use rules in win95.mak to builds WIN32 programs
that will run in any version of Windows from Windown 95 to Windows 10.
Note however that Windows 95/98/ME only have a very limited support for Unicode
built in. The rest of this section mentions 95, but applies to 98 & ME as well.
The MsvcLibX library uses a number of Unicode functions not available in default
installations of Windows 95. This includes all file management functions.
Thus most of our WIN95 executables will not work by default in Windows 95.
To allow them to work, it is necessary to download from Microsoft a "Microsoft
Layer for Unicode on Windows 95/98/ME Systems" (MSLU for short), and install it
on the Windows 95 system. See the following links for details:
https://en.wikipedia.org/wiki/Microsoft_Layer_for_Unicode
https://msdn.microsoft.com/en-us/goglobal/bb688166.aspx
MSLU installation procedure:
- Download the MSLU redistributable setup (unicows.exe) from:
http://go.microsoft.com/fwlink/?LinkId=14851
- Extract unicows.dll from the unicows.exe archive.
- Copy that unicows.dll to the Windows 95 system, into %windir%\System.
Testing WIN95 executables in a Windows 95 VM
VMWare Player does not have Windows 95 drivers for the HGFS file system.
This prevents accessing the host's files directly as network files, as is
usually done for Windows XP and later versions of Windows.
It is not possible to use network shares either, as Windows 95 only supports
the SMB 1 protocol, which is actively blocked by Windows Vista and later hosts.
It is possible, but inconvenient, to transit through a web server, and download
the files in the Windows 95 VM using Internet Explorer 4.
The best solution probably is to transit through a floppy or CD image, and
mount that image in the VM Player. Many tools, including our own HpMkIso.exe
can create CD images. A very convenient shareware called WinImage allows to
create floppy images.
Another solution is to install a Web server on the host PC, and use Internet
Explorer 4 in Windows 95 to download the executable files into the VM.
Support for DOS, and bound DOS+Windows programs
-----------------------------------------------
- If Visual C++ 1.52 is installed, configure.bat will setup the make system
for building the MS-DOS version of your programs. (Output in the DOS directory)
- If Visual C++ 8 is installed, configure.bat will setup the make system
for building 32-bits versions of your programs compatible with Windows 95
and all later versions, including 64-bits ones. (Output in the WIN95 directory)
Both are available as part of the Visual Studio 2005 CD, still available for
download for MSDN subscribers from the MSDN web site.
Win32 programs have an "MS-DOS stub", that runs when the Windows program is
executed under MS-DOS.
The default stub used by the Win32 linker if a tiny DOS program that displays
an error message such as: "This program can only run in Windows"
When it builds the WIN95 or WIN32 version of a program, and when it has built
the DOS version already, the MsvcLibX make system uses that DOS version as the
stub for the Windows version.
This allows building executables that work in *all* versions of DOS and Windows!
- When run in MS-DOS, it's the DOS stub of the exe that runs.
- When run in Windows (even 64-bits versions), it's the Win32 part that runs.
Note that the make system will build such bound executables for any WIN32
build made with more recent compilers. But these recent compilers generate
executables that cannot run in old versions of Windows. For example, the
Visual C++ 14 compiler can only target Windows Vista and later systems.
Having an executable that can run in DOS and Windows 7, but not in Windows XP,
is not very useful. Make sure to install the Visual C++ 8 compiler in parallel
with Visual C++ 1.52, and the latest compiler (Visual C++ 14 at the time of
this writing), to generate truly universal WIN95 builds, that run in
DOS/95/98/ME/2000/XP/Vista/7/8/10.
History
-------
**1986**
I (Jean-François Larvoire) started writing command-line tools for MS-DOS.
Some were enumerating files, using inline assembly language to make MS-DOS
interrupt 21h system calls: update, dirsize, redo, backnum, which, dirc...
To make it simple I factored these out in subroutines srch1st and srchnext,
that I manually copied from one program to the next.
Things got a bit tricky to support recursion, which was not straightforward
in MS-DOS.
**1992**
We got an OS/2 server, and I started porting the above programs to OS/2.
MS-DOS was still important, so I used conditional compilation to support
both operating systems with the same source.
I wrote a second version of srch1st and srchnext for OS/2, and had to
include a new routine srchdone due to OS/2 API constraints.
dirc was the first program I ported, then I slowly duplicated the code into
the other programs. Synchronizing bug fixes became more difficult.
A nice trick was the OS/2 supported dual-mode EXEs, with both the DOS and
OS/2 version bound in the same .exe file.
**1995**
We ditched the OS/2 server, and got a new one running Windows NT.
Again, I created a third conditionally compiled version of srch1st/srchnext/
srchdone for WIN32, for use in dirc.
Manually back porting the updates and bug fixes to all programs became
really painful, and took several years.
Like OS/2, Windows supported dual-mode EXEs, and I updated my make files
to include both the DOS and Windows version in the same file.
**2005**
I started working on Linux projects. Despite the bonanza of command-line
tools available, I couldn't find one equivalent to dirc.
So, yet another time, I created a fourth conditionally compiled version of
srch1st/srchnext/srchdone for Linux, and obtained a Linux version of dirc.
I also ported it and a couple of other programs to Tru64, which was the
first 64-bits OS I worked with. This exposed a few unsuspected bugs.
The thing became so complex than porting the changes and updates to the
other programs was a nightmare. I did it for a few of them, but never
got the time to port them all.
**2010**
Building WIN64 versions was relatively easier due to the Tru64 precedent,
but added yet another set of conditional compilations.
The porting nightmare worsened.
**2012**
I tried porting some unrelated Linux programs to Windows, and hit a wall:
Many include files and standard C library routines were missing in MSVC.
I then tried using MinGW, but it too was missing many required features!
I considered contributing updates to MinGW, but that project was too
complex and ill-documented at that time, and I eventually gave up.
Instead, I started writing my own "libc-ext" library of include files and
routines to supplement MSVC.
Ex: stdint.h, inttypes.h, fnmatch.h/fnmatch.c, ...
Also it became obvious that multiplying conditional compilations and
duplicating directory access code everywhere was wrong. Instead I had to
write standard dirent.h/dirent.c routines for DOS/OS2/Windows, and
rewrite all my programs around these standard routines.
I did it for DOS and Windows versions, and left stubs of the OS/2 versions,
for the unlikely case where somebody wants to revive them.
**2013**
The restructuration was over for dirc, dirsize, which, backnum, update.
The library got its final name, "MsvcLibX", to better match it purpose:
An extension of the Microsoft Visual C library, not of the standard libc.
As the library grew, debugging it became more difficult, and I decided to
use my debugm.h within the library: This file contains a set of debugging
macros I had developed for other programs.
I started thinking about sorely needed improvements:
- There was no support for Windows symlinks and junctions.
- The Windows versions of the programs output ANSI file names into a
cmd.exe window using the OEM character set. This caused all files with
French names to be shown as garbage.
- Worse still, I had a few files and directories with non-ANSI names
(In Russian and Chinese), that caused the programs to fail!
The Linux version of the program did not have these issues, as all recent
versions of Linux use the UTF-8 encoding, and this works transparently
even for old programs using 8-bits characters like mine.
**2014**
I got a bit more time, and started working on a redesign of MsvcLibX's
dirent.c/dirent.h, and added lstat.c, symlink.c, readlink.c, etc, to
support symlinks, junctions, and UTF-8 file names.
This proved to be much more work than I initially thought, but the result
was worth the effort: dirc, update got easily adapted, with remarkably
few changes to their source. Adding recursion to update was easy.
I'm now able to use update to backup all files on my system, including
symbolic links, and junctions used as poor man's links. And the programs
now display names correctly in any code page with the right font.
A seventh program, truename, joined the collection using dirent.h routines.
Later in the year, I made significant other changes:
- Split make.bat into a generic make.bat/configure.bat pair of scripts.
configure.bat needs to be run once, plus everytime the environment
changes. (Such as if a new MSVC version is installed.)
Project-specific definitions are moved to new files, such as our
configure.MsvcLibX.bat.
- Added a general mechanism for defining extensions to existing MSVC
include files. This allowed defining our own homonym include files,
containing just the missing definitions. Which in turn allowed to move
many such definitions, that were initially stored in unistd.h for lack
of an alternative, to their standard location.
- Updated all file functions to support WIN32 pathnames > 260 characters.
(The basic WIN32 functions that I used until then had that limitation;
I'm now using extended functions supporting path lengths up to 64K.)
All tools like dirc, dirsize, which, backnum, update, truename, redo
benefit from that last change.
**2015**
A major improvement was the addition of support for new operating systems
and processor targets. This required redesigning several things:
The OS-specific definition macros have been renamed to more generic names.
The DosWin.mak file has been replaced by a more generic All.mak,
supporting the old dos.mak, win32.mak, and win64.mak, plus the new...
- bios.mak Allows building 16-bits programs that can run in BIOS option
ROMs. These programs are based on the BiosLib library,
documented separately.
- win95.mak Allows building win32 programs that run in Windows 95.
- ia64.mak Allows building 64-bits programs that run in IA64 versions
of Windows. Not tested.
- arm.mak Allows building win32 programs for Windows RT.
Tests failed so far, due to a missing "ARM Desktop SDK".
All.mak also skips building versions for which no tools are available;
This prevents problems in the normal case when people only have the latest
version of MSVC. In this case, it just builds the WIN32 and WIN64 versions.
The support for Windows 95 required fixing numerous issues with old
Microsoft tools and Windows SDKs.
Conversely, the support for Visual Studio 15 also required fixing lots of
issues, as the MSVC library has been completely redesigned, and split into
two parts:
- A compiler-specific part, part of the compiler tree as before.
- A generic part, called Universal C runtime (UCRT) that's now part of
the windows SDK.
And of course there were also issues with MsvcLibX recent improvements,
like Unicode support and symlink support, which had never been tested,
and of course did not work, in Windows 95 and XP.
**2016**
Many significant changes and improvements this year:
- Changed the UTF-8 C source support to require a UTF-8 BOM.
This is to prevent problems with Windows tools that tend to corrupt files
without a UTF-8 BOM, but with other UTF-8 characters.
This required changing all C/C++ compilation rules to first remove the
UTF-8 BOM, as MS compilers do not react correctly when they find one.
- Added a windows.h extension.
Just like Standard C library APIs, windows 8-bit APIs can be overriden to
refer to custom routines that support UTF-8 strings.
The MsvcLibX library was beginning to use a significant number of these
custom routines internally. They're now accessible directly to outside
UTF-8 programs targeting only Windows.
- Finished implementing support for the OUTDIR variable. (Started in 2015.)
All make files now optionally create output files in an %OUTDIR% directory.
This is intended for testing builds in VMs, with shared sources on the
host, but the output locally in the VM, avoiding to overwrite the main
version on the host. IF %OUTDIR% is not defined, the default output
still goes below the source directory as before.
:# config.DESKTOP-U79TD6T.bat generated by configure.bat on 2020/05/19 ܶ 7:49:05.47
:#
:# If changes are needeed, do not edit this file, but instead create a new script
:# called configure.YOURCHOICE.bat. This new script will be invoked automatically
:# by configure.bat while creating this file. Then your script can write extra
:# definitions, or change some of the variables before configure.bat writes them.
:#
:# Invoke configure.bat manually if anything changes in the tools config, such as
:# installing a Visual Studio update, or updating a configure.XXX.bat script.
set "HAS_STINCLUDE=1" &:# Found the System Tools global C includes
set "STINCLUDE=C:\Users\admin\Desktop\temp\MyGitHub\C\include" &:# System Tools global C includes
set "HAS_SDK_FLAGS=/DHAS_STINCLUDE=1" &:# SDK detection flags for the C compiler
SET "PF32=C:\Program Files (x86)" &:# 32-bits Program Files
SET "PF64=C:\Program Files" &:# 64-bits Program Files
SET "ARCH=AMD64" &:# PROCESSOR_ARCHITECTURE
SET "MASM=" &:# Microsoft 16-bits Assembler base path
SET "MSVC=" &:# Microsoft 16-bits Visual C++ base path
SET "MAPSYM=" &:# 16-bits debugging symbols generator
SET "VSTUDIOLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0" &:# Microsoft Visual Studio (Long path)
SET "VSTUDIO=C:\PROGRA~2\MICROS~2.0" &:# Microsoft Visual Studio (Short path)
SET "VSCOMMONLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7" &:# Microsoft Visual Studio Common Files (Long path)
SET "VSCOMMON=C:\PROGRA~2\MICROS~2.0\Common7" &:# Microsoft Visual Studio Common Files (Short path)
SET "VSIDELONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE" &:# Microsoft Visual Studio IDE Files (Long path)
SET "VSIDE=C:\PROGRA~2\MICROS~2.0\Common7\IDE" &:# Microsoft Visual Studio IDE Files (Short path)
SET "VSTOOLSLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools" &:# Microsoft Visual Studio Tools (Long paths)
SET "VSTOOLS=C:\PROGRA~2\MICROS~2.0\Common7\Tools" &:# Microsoft Visual Studio Tools (Short paths)
SET "MSVC32LONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" &:# Microsoft Visual C++ 32/64 bits (Long path)
SET "MSVC32=C:\PROGRA~2\MICROS~2.0\VC" &:# Microsoft Visual C++ 32/64 bits (Short path)
SET "WIN_CP=936" &:# Windows Code Page
SET "WIN_CS=gb2312" &:# Windows Character Set
SET "DOS_CP=936" &:# DOS Code Page
SET "DOS_CS=gb2312" &:# DOS Character Set
SET "AS=" &:# Assembler
SET "CC=" &:# C compiler
SET "INCLUDE=C:\Users\admin\Desktop\temp\MyGitHub\C\include" &:# Include paths. Define USER_INCLUDE if needed.
SET "LK=" &:# Linker
SET "LIB=" &:# Libraries paths. Define USER_LIBS if needed.
SET "LB=" &:# Library manager
SET "RC=" &:# Resource compiler
SET "MT=" &:# Manifest tool
SET "DOS_CC=" &:# Microsoft Visual C++ 16-bits compiler
SET "DOS_AS=" &:# Microsoft 16-bits assembler
SET "DOS_LK=" &:# Microsoft 16-bits linker
SET "DOS_LB=" &:# Microsoft 16-bits librarian
SET "DOS_RC=" &:# Microsoft 16-bits resource compiler
SET "DOS_MT=" &:# Microsoft 16-bits manifest tool
SET "DOS_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for 16-bits compilation
SET "DOS_VCINC=" &:# Visual C++ 16-bits compiler include dir for MsvcLibX include_next
SET "DOS_CRTINC=" &:# Visual C++ 16-bits CRT library include dir for MsvcLibX include_next
SET "DOS_INCPATH=" &:# Include paths for 16-bits compilation
SET "DOS_LIBPATH=" &:# Libraries paths for 16-bits linking
SET "DOS_WINSDK=" &:# Microsoft Windows 16-bits SDK
SET "DOS_WINSDKINC=" &:# Microsoft Windows 16-bits SDK Include directory
SET "WIN95_CC=" &:# Microsoft Visual C++ 32-bits compiler
SET "WIN95_AS=" &:# Microsoft 32-bits assembler
SET "WIN95_LK=" &:# Microsoft 32-bits linker
SET "WIN95_LB=" &:# Microsoft 32-bits librarian
SET "WIN95_RC=" &:# Microsoft 32-bits resource compiler
SET "WIN95_MT=" &:# Microsoft 32-bits manifest tool
SET "WIN95_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for 32-bits compilation
SET "WIN95_VCINC=" &:# Visual C++ 32-bits compiler include dir for MsvcLibX include_next
SET "WIN95_CRTINC=" &:# Visual C++ 32-bits CRT library include dir for MsvcLibX include_next
SET "WIN95_INCPATH=" &:# Include paths for 32-bits compilation
SET "WIN95_LIBPATH=" &:# Libraries paths for 32-bits linking
SET "WIN95_WINSDK=" &:# Microsoft Windows 32-bits SDK
SET "WIN95_WINSDKINC=" &:# Microsoft Windows 32-bits SDK Include directory
SET "WIN32_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.EXE"" &:# Microsoft Visual C++ 32-bits compiler
SET "WIN32_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ML.EXE"" &:# Microsoft 32-bits assembler
SET "WIN32_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\LINK.EXE"" &:# Microsoft 32-bits linker
SET "WIN32_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\LIB.EXE"" &:# Microsoft 32-bits librarian
SET "WIN32_RC=" &:# Microsoft 32-bits resource compiler
SET "WIN32_MT=" &:# Microsoft 32-bits manifest tool
SET "WIN32_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for 32-bits compilation
SET "WIN32_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ 32-bits compiler include dir for MsvcLibX include_next
SET "WIN32_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ 32-bits CRT library include dir for MsvcLibX include_next
SET "WIN32_INCPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for 32-bits compilation
SET "WIN32_LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86" &:# Libraries paths for 32-bits linking
SET "WIN32_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows 32-bits SDK
SET "WIN32_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows 32-bits SDK Include directory
SET "IA64_CC=" &:# Microsoft Visual C++ IA64 compiler
SET "IA64_AS=" &:# Microsoft IA64 assembler
SET "IA64_LK=" &:# Microsoft IA64 linker
SET "IA64_LB=" &:# Microsoft IA64 librarian
SET "IA64_RC=" &:# Microsoft IA64 resource compiler
SET "IA64_MT=" &:# Microsoft IA64 manifest tool
SET "IA64_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for IA64 compilation
SET "IA64_VCINC=" &:# Visual C++ IA64 compiler include dir for MsvcLibX include_next
SET "IA64_CRTINC=" &:# Visual C++ IA64 CRT library include dir for MsvcLibX include_next
SET "IA64_INCPATH=" &:# Include paths for IA64 compilation
SET "IA64_LIBPATH=" &:# Libraries paths for IA64 linking
SET "IA64_WINSDK=" &:# Microsoft Windows IA64 SDK
SET "IA64_WINSDKINC=" &:# Microsoft Windows IA64 SDK Include directory
SET "WIN64_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.EXE"" &:# Microsoft Visual C++ 64-bits compiler
SET "WIN64_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\ML64.EXE"" &:# Microsoft 64-bits assembler
SET "WIN64_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\LINK.EXE"" &:# Microsoft 64-bits linker
SET "WIN64_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\LIB.EXE"" &:# Microsoft 64-bits librarian
SET "WIN64_RC=" &:# Microsoft 64-bits resource compiler
SET "WIN64_MT=" &:# Microsoft 64-bits manifest tool
SET "WIN64_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for 64-bits compilation
SET "WIN64_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ 64-bits compiler include dir for MsvcLibX include_next
SET "WIN64_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ 64-bits CRT library include dir for MsvcLibX include_next
SET "WIN64_INCPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for 64-bits compilation
SET "WIN64_LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" &:# Libraries paths for 64-bits linking
SET "WIN64_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows 64-bits SDK
SET "WIN64_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows 64-bits SDK Include directory
SET "ARM_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\CL.EXE"" &:# Microsoft Visual C++ ARM compiler
SET "ARM_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\ARMASM.EXE"" &:# Microsoft ARM assembler
SET "ARM_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\LINK.EXE"" &:# Microsoft ARM linker
SET "ARM_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\LIB.EXE"" &:# Microsoft ARM librarian
SET "ARM_RC=" &:# Microsoft ARM resource compiler
SET "ARM_MT=" &:# Microsoft ARM manifest tool
SET "ARM_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for ARM compilation
SET "ARM_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ ARM compiler include dir for MsvcLibX include_next
SET "ARM_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ ARM CRT library include dir for MsvcLibX include_next
SET "ARM_INCPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for ARM compilation
SET "ARM_LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm" &:# Libraries paths for ARM linking
SET "ARM_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows ARM SDK
SET "ARM_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows ARM SDK Include directory
SET "ARM64_CC=" &:# Microsoft Visual C++ ARM64 compiler
SET "ARM64_AS=" &:# Microsoft ARM64 assembler
SET "ARM64_LK=" &:# Microsoft ARM64 linker
SET "ARM64_LB=" &:# Microsoft ARM64 librarian
SET "ARM64_RC=" &:# Microsoft ARM64 resource compiler
SET "ARM64_MT=" &:# Microsoft ARM64 manifest tool
SET "ARM64_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for ARM64 compilation
SET "ARM64_VCINC=" &:# Visual C++ ARM64 compiler include dir for MsvcLibX include_next
SET "ARM64_CRTINC=" &:# Visual C++ ARM64 CRT library include dir for MsvcLibX include_next
SET "ARM64_INCPATH=" &:# Include paths for ARM64 compilation
SET "ARM64_LIBPATH=" &:# Libraries paths for ARM64 linking
SET "ARM64_WINSDK=" &:# Microsoft Windows ARM64 SDK
SET "ARM64_WINSDKINC=" &:# Microsoft Windows ARM64 SDK Include directory
exit /b 0 &:# Configuration done successfully
@echo off
:#*****************************************************************************
:# *
:# Filename: configure.bat *
:# *
:# Description: Detect system-specific settings and create config.*.bat *
:# *
:# Notes: Proxy script for %STINCLUDE%\configure.bat. *
:# *
:# Make any change needed in %STINCLUDE%\configure.bat. *
:# *
:# History: *
:# 2016-10-10 JFL jf.larvoire@hpe.com created this file. *
:# 2016-12-15 JFL Search for the real make.bat in [.|..|../..]\include. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the STINCLUDE library directory
if defined STINCLUDE if not exist "%STINCLUDE%\make.bat" set "STINCLUDE=" &:# Allow overriding with another alias name, but ignore invalid overrides
for %%p in (. .. ..\..) do if not defined STINCLUDE if exist %%p\include\make.bat ( :# Default: Search it the current directory, and 2 levels above.
for /f "delims=" %%d in ('"pushd %%p\include & cd & popd"') do SET "STINCLUDE=%%d"
)
if not defined STINCLUDE ( :# Try getting the copy in the master environment
for /f "tokens=3" %%v in ('reg query "HKCU\Environment" /v STINCLUDE 2^>NUL') do set "STINCLUDE=%%v"
)
if not exist %STINCLUDE%\make.bat (
>&2 echo %0 Error: Cannot find SysToolsLib's global C include directory. Please define variable STINCLUDE.
exit /b 1
)
if [%1]==[-d] echo "%STINCLUDE%\configure.bat" %*
"%STINCLUDE%\configure.bat" %*
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: debugm.h * * Filename: debugm.h *
* * * *
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
* 2016-10-04 JFL Added macros DEBUG_OFF(), DEBUG_MORE(), DEBUG_LESS(). * * 2016-10-04 JFL Added macros DEBUG_OFF(), DEBUG_MORE(), DEBUG_LESS(). *
* Allow using DEBUG_ON()/MORE()/LESS()/OFF() in release mode. * Allow using DEBUG_ON()/MORE()/LESS()/OFF() in release mode.
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: direct.h * * Filename: direct.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-03-24 JFL Created this file, with content moved from unistd.h. * * 2014-03-24 JFL Created this file, with content moved from unistd.h. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT. * 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include UCRT_INCLUDE_FILE(direct.h) /* Include MSVC's own <direct.h> file */ #include <direct.h> /* Include MSVC's own <direct.h> file */
#undef mkdir /* This MSVC macro is incompatible with mkdir() function in unistd.h */ #undef mkdir /* This MSVC macro is incompatible with mkdir() function in unistd.h */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: dirent.h * * Filename: dirent.h *
* * * *
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* 2015-12-07 JFL Added the conditional definition of symlink constants, so * * 2015-12-07 JFL Added the conditional definition of symlink constants, so *
* that our code builds even in XP and older Windows SDKs. * * that our code builds even in XP and older Windows SDKs. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: error.h * * Filename: error.h *
* * * *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* History: * * History: *
* 2012-10-21 JFL Created this file. * * 2012-10-21 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: fadvise.h * * Filename: fadvise.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* History: * * History: *
* 2012-10-17 JFL Created this file. * * 2012-10-17 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: fcntl.h * * Filename: fcntl.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2017-02-16 JFL Created this file. * * 2017-02-16 JFL Created this file. *
* * * *
* Copyright 2017 Hewlett Packard Enterprise Development LP * * Copyright 2017 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include UCRT_INCLUDE_FILE(fcntl.h) /* Include MSVC's own <fcntl.h> file */ #include <fcntl.h> /* Include MSVC's own <fcntl.h> file */
/* Microsoft defines _open() in io.h */ /* Microsoft defines _open() in io.h */
#include <io.h> #include <io.h>
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: fnmatch.h * * Filename: fnmatch.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* History: * * History: *
* 2012-01-17 JFL Created this file. * * 2012-01-17 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename iconv.h * * Filename iconv.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* History: * * History: *
* 2014-02-27 JFL Created this file. * * 2014-02-27 JFL Created this file. *
* * * *
* © Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename inttypes.h * * Filename inttypes.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-02-07 JFL Added definitions for PRIdMAX and PRIiMAX. * * 2014-02-07 JFL Added definitions for PRIdMAX and PRIiMAX. *
* 2016-01-07 JFL Restructured and improved support for MS-DOS. * * 2016-01-07 JFL Restructured and improved support for MS-DOS. *
* * * *
* © Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: libgen.h * * Filename: libgen.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2016-09-08 JFL Created this file. * * 2016-09-08 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: limits.h * * Filename: limits.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-06-30 JFL Created this file. * * 2014-06-30 JFL Created this file. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include MSVC_INCLUDE_FILE(limits.h) /* Include MSVC's own <limits.h> file */ #include <limits.h> /* Include MSVC's own <limits.h> file */
/************************ MS-DOS-specific definitions ************************/ /************************ MS-DOS-specific definitions ************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: netdb.h * * Filename: netdb.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2012-01-24 JFL Created this file. * * 2012-01-24 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: process.h * * Filename: process.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-03-27 JFL Created this file. * * 2014-03-27 JFL Created this file. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT. * 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include UCRT_INCLUDE_FILE(process.h) /* Include MSVC's own <process.h> file */ #include <process.h> /* Include MSVC's own <process.h> file */
#if defined(_WIN32) #if defined(_WIN32)
extern intptr_t _spawnvpU(int iMode, const char *pszCommand, char *const *argv); extern intptr_t _spawnvpU(int iMode, const char *pszCommand, char *const *argv);
......
#ifndef _HSREGEX_H_ #ifndef _HSREGEX_H_
#define _HSREGEX_H_ #define _HSREGEX_H_
#ifndef _HSREGEX_H #ifndef _HSREGEX_H
#define _HSREGEX_H /* never again */ #define _HSREGEX_H /* never again */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: reparsept.h * * Filename: reparsept.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-28 JFL Created this file. * * 2014-02-28 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: stdbool.h * * Filename: stdbool.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2012-10-17 JFL Created this file. * * 2012-10-17 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename stdint.h * * Filename stdint.h *
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: stdio.h * * Filename: stdio.h *
* * * *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT. * 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* 2015-12-09 JFL Alias fputs to fputsU, and vfprintf to vfprintfU. * * 2015-12-09 JFL Alias fputs to fputsU, and vfprintf to vfprintfU. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include UCRT_INCLUDE_FILE(stdio.h) /* Include MSVC's own <stdio.h> file */ #include <stdio.h> /* Include MSVC's own <stdio.h> file */
#include <sys/types.h> #include <sys/types.h>
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: stdlib.h * * Filename: stdlib.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2016-09-13 JFL Created this file. * * 2016-09-13 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include UCRT_INCLUDE_FILE(stdlib.h) /* Include MSVC's own <stdlib.h> file */ #include <stdlib.h> /* Include MSVC's own <stdlib.h> file */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
/* CoreUtils global system configuration definitions */
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: time.h * * Filename: time.h *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-06-04 JFL Created this file. * * 2014-06-04 JFL Created this file. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT. * 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include "msvclibx.h" #include "msvclibx.h"
#include WINSDK_INCLUDE_FILE(winsock2.h) #include <winsock2.h>
#include UCRT_INCLUDE_FILE(time.h) /* Include MSVC's own <time.h> file */ #include <time.h> /* Include MSVC's own <time.h> file */
#ifdef _MSDOS #ifdef _MSDOS
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "sys\time.h" /* for struct timespec */ #include "sys\msvcTime.h" /* for struct timespec */
typedef int clockid_t; typedef int clockid_t;
/* Supported values for clockid_t */ /* Supported values for clockid_t */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: unistd.h * * Filename: unistd.h *
* * * *
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* 2014-06-30 JFL Moved PATH_MAX definition to limits.h. * * 2014-06-30 JFL Moved PATH_MAX definition to limits.h. *
* 2016-08-25 JFL Implemented ResolveLinksA(). * * 2016-08-25 JFL Implemented ResolveLinksA(). *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#endif #endif
#include "msvclibx.h" /* Generate a library search record to load MsvcLibX.lib. */ #include "msvclibx.h" /* Generate a library search record to load MsvcLibX.lib. */
#include "sys/types.h" /* Define pid_t and getppid(). */ #include "sys/msvcTypes.h" /* Define pid_t and getppid(). */
#include "dirent.h" /* Define pid_t and getppid(). */ #include "msvcDirent.h" /* Define pid_t and getppid(). */
#include <direct.h> /* For functions like _chdir() and _getcwd() */ #include <direct.h> /* For functions like _chdir() and _getcwd() */
#include <process.h> /* For _getpid() */ #include <process.h> /* For _getpid() */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: utime.h * * Filename: utime.h *
* * * *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* History: * * History: *
* 2014-12-13 JFL Created this file. * * 2014-12-13 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: windows.h * * Filename: windows.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2016-09-12 JFL Created this file. * * 2016-09-12 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include WINSDK_INCLUDE_FILE(windows.h) /* Include Windows SDK's own windows.h */ #include <windows.h> /* Include Windows SDK's own windows.h */
/****************** Define UTF-8 versions of WIN32 routines ******************/ /****************** Define UTF-8 versions of WIN32 routines ******************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: error.h * * Filename: error.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-10 JFL Created this file. * * 2014-02-10 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename MsvcLibX.h * * Filename MsvcLibX.h *
* * * *
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* 2016-09-28 JFL Can also be included by MS' Resource Compiler. * * 2016-09-28 JFL Can also be included by MS' Resource Compiler. *
* 2017-02-05 JFL Changed the UTF-8 programs initialization method. * * 2017-02-05 JFL Changed the UTF-8 programs initialization method. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
/* Generate the OS-and-debug-mode-specific library name */ /* Generate the OS-and-debug-mode-specific library name */
#define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib" #define _MSVCLIBX_LIB "MsvcLibX" _MSVCLIBX_LIB_OS_SUFFIX _MSVCLIBX_LIB_DBG_SUFFIX ".lib"
#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")") //#pragma message("Adding pragma comment(lib, \"" _MSVCLIBX_LIB "\")")
#pragma comment(lib, _MSVCLIBX_LIB) #pragma comment(lib, _MSVCLIBX_LIB)
/* Library-specific routine used internally by many standard routines */ /* Library-specific routine used internally by many standard routines */
......
/*****************************************************************************\
* *
* Filename: stdio--.h *
* *
* Description: front-end to stdio.h that redefines some unsafe functions *
* *
* Notes: This header is part of the GNU CoreUtils library. *
* msvclibx: Pass through to the standard stdio.h. *
* *
* History: *
* 2012-10-17 JFL Created this file. *
* *
* © Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/
#include <stdio.h>
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename sys/param.h * * Filename sys/param.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History * * History *
* 2014-06-10 JFL Created this file. * * 2014-06-10 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: stat.h * * Filename: stat.h *
* * * *
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT. * 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* 2016-09-15 JFL Fixed a warning in Visual Studio 2015. * * 2016-09-15 JFL Fixed a warning in Visual Studio 2015. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -28,11 +28,11 @@ ...@@ -28,11 +28,11 @@
#include "msvclibx.h" #include "msvclibx.h"
#include <sys/types.h> #include "sys/msvcTypes.h"
#include UCRT_INCLUDE_FILE(sys\stat.h) /* Include MSVC's own <sys/stat.h> file */ #include <sys/stat.h> /* Include MSVC's own <sys/stat.h> file */
#include <dirent.h> /* For dirent2stat() arguments definitions */ #include "msvcDirent.h" /* For dirent2stat() arguments definitions */
#include <time.h> /* for time_t definition */ #include "msvcTime.h" /* for time_t definition */
#include <sys/time.h> /* for timespec definition */ #include "sys/msvcTime.h" /* for timespec definition */
/* Include MsvcLibX's <direct.h> override, to avoid conflict with the standard mkdir defined here, /* Include MsvcLibX's <direct.h> override, to avoid conflict with the standard mkdir defined here,
should <direct.h> be manually included later on in the C source */ should <direct.h> be manually included later on in the C source */
#include <direct.h> #include <direct.h>
...@@ -154,7 +154,7 @@ extern char *Filetime2String(uint16_t date, uint16_t time, char *pBuf, size_t nB ...@@ -154,7 +154,7 @@ extern char *Filetime2String(uint16_t date, uint16_t time, char *pBuf, size_t nB
if we were to use MsvcLibX extended stat structures and routines */ if we were to use MsvcLibX extended stat structures and routines */
#define _LIBX_stat _CONCAT(_MSVC_stat,_ns) #define _LIBX_stat _CONCAT(_MSVC_stat,_ns)
#define _LIBX_stat64 _CONCAT(_MSVC_stat64,_ns) #define _LIBX_stat64 _CONCAT(_MSVC_stat64,_ns)
#include "debugm.h" #include "msvcDebugm.h"
#pragma message("Defining type struct " VALUEIZE(_LIBX_stat)) #pragma message("Defining type struct " VALUEIZE(_LIBX_stat))
struct _LIBX_stat { struct _LIBX_stat {
/* MSVC standard stat structure fields */ /* MSVC standard stat structure fields */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename sys/time.h * * Filename sys/time.h *
* * * *
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* Added macros TIMEVAL_TO_TIMESPEC & TIMESPEC_TO_TIMEVAL. * * Added macros TIMEVAL_TO_TIMESPEC & TIMESPEC_TO_TIMEVAL. *
* 2016-07-06 JFL Avoid error if winsocks2.h has been previously included. * * 2016-07-06 JFL Avoid error if winsocks2.h has been previously included. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: sys/utsname.h * * Filename: sys/utsname.h *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-05-30 JFL Created this file. * * 2014-05-30 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: sys/types.h * * Filename: sys/types.h *
* * * *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* 2014-06-06 JFL Moved mode_t & off*_t definitions here, from sys\stat.h. * * 2014-06-06 JFL Moved mode_t & off*_t definitions here, from sys\stat.h. *
* 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT. * 2015-11-15 JFL Visual Studio 2015 moved this file to the Windows Kit UCRT.
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "msvclibx.h" #include "msvclibx.h"
#include UCRT_INCLUDE_FILE(sys\types.h) /* Include MSVC's own <sys/types.h> file */ #include <sys\types.h> /* Include MSVC's own <sys/types.h> file */
/************************ MS-DOS-specific definitions ************************/ /************************ MS-DOS-specific definitions ************************/
...@@ -90,6 +90,7 @@ typedef int uid_t; ...@@ -90,6 +90,7 @@ typedef int uid_t;
/* MsvcLibX uses mode_t in sys/stat.h */ /* MsvcLibX uses mode_t in sys/stat.h */
typedef int mode_t; typedef int mode_t;
#define HAVE_MODE_T
/* File link counts type (not used by MsvcLibX so far) */ /* File link counts type (not used by MsvcLibX so far) */
typedef int nlink_t; /* Is short in some Unix versions */ typedef int nlink_t; /* Is short in some Unix versions */
......
/* CoreUtils global system configuration definitions */
@echo off
:#*****************************************************************************
:# *
:# Filename: make.bat *
:# *
:# Description: Build DOS and Windows targets *
:# *
:# Notes: Proxy script for %STINCLUDE%\make.bat. *
:# *
:# If any change is needed, put it in %STINCLUDE%\make.bat. *
:# *
:# History: *
:# 2016-10-10 JFL jf.larvoire@hpe.com created this file. *
:# 2016-12-15 JFL Search for the real make.bat in [.|..|../..]\include. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the STINCLUDE library directory
if defined STINCLUDE if not exist "%STINCLUDE%\make.bat" set "STINCLUDE=" &:# Allow overriding with another alias name, but ignore invalid overrides
for %%p in (. .. ..\..) do if not defined STINCLUDE if exist %%p\include\make.bat ( :# Default: Search it the current directory, and 2 levels above.
for /f "delims=" %%d in ('"pushd %%p\include & cd & popd"') do SET "STINCLUDE=%%d"
)
if not defined STINCLUDE ( :# Try getting the copy in the master environment
for /f "tokens=3" %%v in ('reg query "HKCU\Environment" /v STINCLUDE 2^>NUL') do set "STINCLUDE=%%v"
)
if not exist %STINCLUDE%\make.bat (
>&2 echo %0 Error: Cannot find SysToolsLib's global C include directory. Please define variable STINCLUDE.
exit /b 1
)
if [%1]==[-d] echo "%STINCLUDE%\make.bat" %*
"%STINCLUDE%\make.bat" %*
###############################################################################
# #
# File name Files.mak #
# #
# Description MsvcLibX Specific file dependancies #
# #
# Notes #
# #
# History #
# 2012-10-21 JFL Initial version #
# 2013-03-27 JFL Added debugv.obj and getppid.obj. #
# 2014-02-03 JFL Added readlink.obj. #
# 2014-02-05 JFL Added symlink.obj. #
# 2014-02-06 JFL Added lstat*.obj. #
# 2014-02-10 JFL Added realpath.obj. #
# 2014-02-17 JFL Added err2errno.obj. #
# 2014-02-26 JFL Added filetime.obj. #
# 2014-02-27 JFL Added iconv.obj. #
# 2014-02-28 JFL Added chdir.obj and getcwd.obj. #
# 2014-03-04 JFL Added fopen.obj. #
# 2014-03-06 JFL Added strerror.obj. #
# 2014-03-24 JFL Added access.obj. #
# 2014-03-27 JFL Added spawn.obj. #
# 2014-05-30 JFL Moved here the OBJECTS macro definition from NMakeFile. #
# Added uname.obj and utimes.obj. #
# 2014-06-04 JFL Added clock_gettime.obj and gettimeofday.obj. #
# 2014-06-24 JFL Added fstat64.obj and fstat64i32.obj. #
# 2014-07-01 JFL Added mb2wpath.obj. #
# 2016-09-08 JFL Added basename.obj and dirname.obj. #
# 2016-09-12 JFL Added WIN32_OBJECTS, and several WIN32 UTF-8 routines. #
# 2016-10-11 JFL moved debugm.h to SysToolsLib global C include dir. #
# 2017-02-16 JFL Added open.obj. #
# #
# Copyright 2016 Hewlett Packard Enterprise Development LP #
# Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 #
###############################################################################
# List of object files to build and include in the MsvcLibX library
# IMPORTANT NOTE: Every time you add an object file in the list here, also
# store its specific source file dependancies below.
OBJECTS = \
+access.obj \
+basename.obj \
+chdir.obj \
+clock_gettime.obj \
+debugv.obj \
+dirent.obj \
+dirname.obj \
+err2errno.obj \
+filetime.obj \
+fnmatch.obj \
+fopen.obj \
+fstat64i32.obj \
+fstat64.obj \
+getcwd.obj \
+getopt.obj \
+getppid.obj \
+gettimeofday.obj \
+iconv.obj \
+lstat64i32.obj \
+lstat64.obj \
+main.obj \
+mb2wpath.obj \
+mkdir.obj \
+mkdtemp.obj \
+mkstemp.obj \
+open.obj \
+readlink.obj \
+realpath.obj \
+spawn.obj \
+strerror.obj \
+strndup.obj \
+strptime.obj \
+symlink.obj \
+uname.obj \
+utime.obj \
+utimes.obj \
+xfreopen.obj \
# +lstat32.obj \
# +lstat32i64.obj \
# WIN32 UTF-8 extension routines, used for implementing UTF-8 support for WIN32 libc.
WIN32_OBJECTS = \
+GetFileAttributes.obj \
+GetFileAttributesEx.obj \
+GetFullPathName.obj \
+GetLongPathName.obj \
+fullpath.obj \
# GnuLib routines that I mistakenly defined here
REMOVED_OBJECTS = \
+error.obj \
+initmain.obj \
+xnmalloc.obj \
###############################################################################
# Include files dependancies #
###############################################################################
I=..\include
CI=$(STINCLUDE)
$(I)\chdir.h: $(I)\unistd.h $(I)\iconv.h $(CI)\debugm.h
$(I)\config.h: $(I)\msvclibx.h $(I)\stdbool.h $(I)\unistd.h
$(I)\direct.h: $(I)\msvclibx.h
$(I)\dirent.h: $(I)\inttypes.h $(I)\sys\stat.h
$(I)\error.h: $(I)\msvclibx.h
# $(I)\fadvise.h:
$(I)\fcntl.h: $(I)\msvclibx.h
$(I)\fnmatch.h: $(I)\msvclibx.h
$(I)\getcwd.h: $(I)\unistd.h $(CI)\debugm.h
# $(I)\getopt.h:
$(I)\grp.h: $(I)\msvclibx.h
# $(I)\inttypes.h:
# $(I)\msvclibx.h:
# $(I)\netdb.h:
$(I)\process.h: $(I)\msvclibx.h
$(I)\pwd.h: $(I)\msvclibx.h
# $(I)\regex.h:
$(I)\sys\stat.h: $(I)\msvclibx.h $(I)\sys\types.h
# $(I)\stdbool.h:
# $(I)\stdint.h:
$(I)\stdio.h: $(I)\msvclibx.h
# $(I)\stdio--.h:
$(I)\stdlib.h: $(I)\msvclibx.h
# $(I)\system.h:
$(I)\unistd.h: $(I)\msvclibx.h $(I)\dirent.h
# $(I)\utime.h:
$(I)\windowsU.h: $(I)\msvclibx.h
$(I)\xfreopen.h: $(I)\msvclibx.h
$(I)\sys\types.h: $(I)\msvclibx.h
###############################################################################
# Source files dependancies #
###############################################################################
access.c: $(I)\MsvcLibX.h $(CI)\debugm.h
basename.c: $(I)\libgen.h
chdir.c: $(CI)\debugm.h $(I)\iconv.h $(I)\unistd.h
clock_gettime.c: $(I)\MsvcLibX.h $(I)\time.h $(I)\sys\stat.h
debugv.c: $(CI)\debugm.h
dirent.c: $(CI)\debugm.h $(I)\dirent.h $(I)\sys\stat.h $(I)\unistd.h
dirname.c: $(I)\libgen.h
err2errno.c: $(I)\MsvcLibX.h $(CI)\debugm.h
error.c: $(I)\config.h $(I)\error.h
filetime.c: $(I)\sys\stat.h
fnmatch.c: $(CI)\debugm.h $(I)\fnmatch.h
fopen.c: $(I)\MsvcLibX.h
fstat64.c: fstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h
fstat64i32.c: fstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h
fullpath.c: $(I)\stdlib.h $(I)\limits.h
getcwd.c: $(CI)\debugm.h $(I)\unistd.h
GetFileAttributesU.c: $(I)\windowsU.h $(I)\limits.h
GetFileAttributesExU.c: $(I)\windowsU.h $(I)\limits.h
GetFullPathNameU.c: $(I)\windowsU.h $(I)\limits.h
GetLongPathNameU.c: $(I)\windowsU.h $(I)\limits.h
getopt.c: $(I)\getopt.h
# getppid.c:
gettimeofday.c: $(I)\MsvcLibX.h $(I)\time.h $(I)\sys\time.h
grp.c: $(I)\grp.h
iconv.c: $(I)\iconv.h
initmain.c: $(I)\config.h
lstat32.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
lstat32i64.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
lstat64.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
lstat64i32.c: lstat.c $(CI)\debugm.h $(I)\dirent.h $(I)\MsvcLibX.h $(I)\sys\stat.h $(I)\stdint.h $(I)\unistd.h
main.c: $(I)\MsvcLibX.h
mb2wpath.c: $(I)\MsvcLibX.h $(CI)\debugm.h
mkdir.c: $(I)\MsvcLibX.h $(I)\sys\stat.h
mkdtemp.c: $(I)\unistd.h
mkstemp.c: $(I)\unistd.h
open.c: $(I)\MsvcLibX.h $(I)\fcntl.h $(CI)\debugm.h
pwd.c: $(I)\pwd.h
readlink.c: $(CI)\debugm.h $(I)\unistd.h $(I)\reparsept.h
realpath.c: $(CI)\debugm.h $(I)\unistd.h
spawm.c: $(CI)\debugm.h $(I)\MsvcLibX.h $(I)\process.h
strerror.c: $(I)\MsvcLibX.h
# strndup.c:
# strptime.c:
symlink.c: $(CI)\debugm.h $(I)\reparsept.h $(I)\unistd.h
uname.c: $(I)\MsvcLibX.h $(I)\sys\utsname.h
utime.c: $(CI)\debugm.h $(I)\unistd.h $(I)\utime.h $(I)\sys\time.h
xfreopen.c: $(I)\xfreopen.h
xnmalloc.c: $(I)\config.h
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename GetFileAttributes.c * * Filename GetFileAttributes.c *
* * * *
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
* History: * * History: *
* 2016-09-12 JFL Created this file. * * 2016-09-12 JFL Created this file. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */ #ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */ #include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h> #include "msvcLimits.h"
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename GetFileAttributesEx.c * * Filename GetFileAttributesEx.c *
* * * *
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
* History: * * History: *
* 2016-09-12 JFL Created this file. * * 2016-09-12 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */ #ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */ #include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h> #include "msvcLimits.h"
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename GetFullPathName.c * * Filename GetFullPathName.c *
* * * *
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
* History: * * History: *
* 2016-09-12 JFL Created this file, from the routine in truename.c. * * 2016-09-12 JFL Created this file, from the routine in truename.c. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */ #ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */ #include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h> #include "msvcLimits.h"
#include "debugm.h" /* MsvcLibX debugging macros */ #include "msvcDebugm.h" /* MsvcLibX debugging macros */
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename GetLongPathName.c * * Filename GetLongPathName.c *
* * * *
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
* History: * * History: *
* 2016-09-12 JFL Created this file, from the routine in truename.c. * * 2016-09-12 JFL Created this file, from the routine in truename.c. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */ #ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */ #include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
#include <limits.h> #include "msvcLimits.h"
#include "debugm.h" /* MsvcLibX debugging macros */ #include "msvcDebugm.h" /* MsvcLibX debugging macros */
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
###############################################################################
# #
# File name NMakefile #
# #
# Description An NMake file for making all MsvcLibX library versions #
# #
# Notes make.bat looks for a default nmake file called nmakefile. #
# #
# History #
# 2012-10-21 JFL Initial version #
# 2014-03-05 JFL Generate the DOS version only if DOS tools are present. #
# 2014-04-22 JFL Fixed the clean target to work even without 16-bits tools.#
# 2014-05-30 JFL Moved the OBJECTS macro definition to Files.mak. #
# 2014-12-03 JFL Fixed the zip target creation. #
# 2015-11-06 JFL Added support for a Win95 version. #
# 2016-01-11 JFL Added a rule to create the common ..\lib directory. #
# 2016-07-05 JFL Fixed a typo preventing the build of DOS S Debug version. #
# 2016-09-26 JFL Added macro LIBDIR, depending on OUTDIR. #
# Copy the include files to $(OUTDIR). #
# 2016-10-04 JFL Make sure nothing is displayed when doing a make clean. #
# 2016-10-06 JFL Added targets mostlyclean & distclean. #
# 2016-10-11 JFL Adapted for use with make files in the global include dir.#
# 2016-10-13 JFL Added target cleanenv. #
# 2016-11-03 JFL Added target config. #
# Updated the cleanenv: script to display the reg command #
# it uses to delete the global environment variable. #
# 2016-11-07 JFL Place LIBDIR in the parent directory even if OUTDIR defnd.#
# Do not copy include files to OUTDIR anymore. #
# 2016-11-16 JFL Removed the rule for copying INCDIR, not used anymore. #
# 2017-02-16 JFL Default goals now depend on the existence of their #
# corresponding make file. #
# #
# Copyright 2016 Hewlett Packard Enterprise Development LP #
# Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 #
###############################################################################
!IF DEFINED(MESSAGES)
!MESSAGE Started MsvcLibX/src/NMakefile in $(MAKEDIR) # Display this make file name
!ENDIF
!IF DEFINED(OUTDIR)
OD=$(OUTDIR)^\
!IF "$(OUTDIR:\=)"=="$(OUTDIR)"
LIBDIR=..\$(OUTDIR)\lib # If OUTDIR is relative, put it in MsvcLibX top directory
!ELSE
LIBDIR=$(OUTDIR)\lib # If OUTDIR is absolute, use it as is
!ENDIF
!ELSE
OD=
LIBDIR=..\lib
!ENDIF
MSG=>con echo # Command for writing a progress message on the console
HEADLINE=$(MSG).&$(MSG) # Output a blank line, then a message
# Default goal: Generate all versions
all: headline \
!IF DEFINED(DOS_CC) && EXIST("$(STINCLUDE)\DOS.mak")
$(OD)DOS\MsvcLibX.lib \
!ENDIF
!IF DEFINED(WIN95_CC) && EXIST("$(STINCLUDE)\WIN95.mak")
$(OD)WIN95\MsvcLibX.lib \
!ENDIF
!IF DEFINED(WIN32_CC) && EXIST("$(STINCLUDE)\WIN32.mak")
$(OD)WIN32\MsvcLibX.lib \
!ENDIF
!IF DEFINED(WIN64_CC) && EXIST("$(STINCLUDE)\WIN64.mak")
$(OD)WIN64\MsvcLibX.lib \
!ENDIF
!IF DEFINED(DOS_CC) && EXIST("$(STINCLUDE)\DOS.mak")
$(OD)DOS\DEBUG\MsvcLibX.lib \
!ENDIF
!IF DEFINED(WIN95_CC) && EXIST("$(STINCLUDE)\WIN95.mak")
$(OD)WIN95\DEBUG\MsvcLibX.lib \
!ENDIF
!IF DEFINED(WIN32_CC) && EXIST("$(STINCLUDE)\WIN32.mak")
$(OD)WIN32\DEBUG\MsvcLibX.lib \
!ENDIF
!IF DEFINED(WIN64_CC) && EXIST("$(STINCLUDE)\WIN64.mak")
$(OD)WIN64\DEBUG\MsvcLibX.lib \
!ENDIF
headline:
$(HEADLINE) Building all MsvcLibX library versions
# Define the OBJECTS macro = the list of object files to include in the library
!INCLUDE "Files.mak"
# Create the common libs directory
$(LIBDIR):
$(HEADLINE) Creating directory $(LIBDIR:..=MsvcLibX)
md $(LIBDIR)
# Rules for building specific versions of the MsvcLibX library
$(OD)DOS\MsvcLibX.lib: $(OD)DOS\BIN\T\MsvcLibX.lib $(OD)DOS\BIN\S\MsvcLibX.lib $(OD)DOS\BIN\L\MsvcLibX.lib
@echo Done building all DOS release libraries
$(OD)DOS\DEBUG\MsvcLibX.lib: $(OD)DOS\DEBUG\BIN\T\MsvcLibX.lib $(OD)DOS\DEBUG\BIN\S\MsvcLibX.lib $(OD)DOS\DEBUG\BIN\L\MsvcLibX.lib
@echo Done building all DOS debug libraries
$(OD)DOS\BIN\T\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library DOS tiny release version
set OBJECTS=$(OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak "DEBUG=0" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)DOS\OBJ\T\%" "MEM=T" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXdt.lib
$(OD)DOS\BIN\S\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library DOS small release version
set OBJECTS=$(OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak "DEBUG=0" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)DOS\OBJ\S\%" "MEM=S" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXds.lib
$(OD)DOS\BIN\L\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library DOS large release version
set OBJECTS=$(OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak "DEBUG=0" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)DOS\OBJ\L\%" "MEM=L" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXdl.lib
$(OD)WIN95\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library WIN95 release version
set OBJECTS=$(OBJECTS) $(WIN32_OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN95.mak "DEBUG=0" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)WIN95\OBJ\%" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXw95.lib
$(OD)WIN32\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library WIN32 release version
set OBJECTS=$(OBJECTS) $(WIN32_OBJECTS)
set OD=$(OD)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN32.mak "DEBUG=0" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)WIN32\OBJ\%" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXw32.lib
$(OD)WIN64\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library WIN64 release version
set OBJECTS=$(OBJECTS) $(WIN32_OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN64.mak "DEBUG=0" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)WIN64\OBJ\%" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXw64.lib
$(OD)DOS\DEBUG\BIN\T\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library DOS tiny debug version
set OBJECTS=$(OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak "DEBUG=1" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)DOS\DEBUG\OBJ\T\%" "MEM=T" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXdtd.lib
$(OD)DOS\DEBUG\BIN\S\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library DOS small debug version
set OBJECTS=$(OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak "DEBUG=1" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)DOS\DEBUG\OBJ\S\%" "MEM=S" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXdsd.lib
$(OD)DOS\DEBUG\BIN\L\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library DOS large debug version
set OBJECTS=$(OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak "DEBUG=1" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)DOS\DEBUG\OBJ\L\%" "MEM=L" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXdld.lib
$(OD)WIN95\DEBUG\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library WIN95 debug version
set OBJECTS=$(OBJECTS) $(WIN32_OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN95.mak "DEBUG=1" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)WIN95\DEBUG\OBJ\%" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXw95d.lib
$(OD)WIN32\DEBUG\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library WIN32 debug version
set OBJECTS=$(OBJECTS) $(WIN32_OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN32.mak "DEBUG=1" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)WIN32\DEBUG\OBJ\%" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXw32d.lib
$(OD)WIN64\DEBUG\MsvcLibX.lib: $(LIBDIR) NUL
$(HEADLINE) Building MsvcLibX library WIN64 debug version
set OBJECTS=$(OBJECTS) $(WIN32_OBJECTS)
$(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN64.mak "DEBUG=1" "PROGRAM=MsvcLibX" "OBJECTS=%OBJECTS:+=+$(OD)WIN64\DEBUG\OBJ\%" dirs $@
if exist $@ copy $@ $(LIBDIR)\MsvcLibXw64d.lib
# Erase all global environment variables created by this build
VARS=MSVCLIBX # Global environment variables generated here
cleanenv:
call <<"$(TMP)\cleanenv-$(PID).bat" &:# Delete variables created here
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set "KEY=HKCU\Environment"
if not "$(VARS)"=="" for %%v in ($(VARS)) do @(
>>"$(TMP)\cleanenv-$(PID).lst" (echo %%v) &:# Pass the name back to make.bat, for deleting it in the current shell environment
set "VALUE="
for /f "tokens=1,3" %%a in ('reg query "%KEY%" ^| findstr /i /b /r /c:" *%%v "') do set VALUE="%%b"
if defined VALUE ( :# The global environment variable exists. Delete it, using its actual name with the correct case.
set CMD=reg delete "%KEY%" /v %%v /f
echo !CMD!
!CMD! >NUL
)
)
<<
# Dummy target, to delete all files built by these make files
clean mostlyclean distclean:
rem # Delete temporary files
-for /f "delims=" %f in ('dir /b /s *~ *.bak #*# 2^>NUL') do @del "%f"
rem # Delete files built by this nmakefile
-for /f "delims=" %f in ('dir /b /s ..\*.zip *.log 2^>NUL') do @del "%f"
rem # Delete files built by the DOS.mak, WIN32.mak, WIN64.mak make files
rem # But make DOS.mak will fail if 16-bit tools are missing. Workaround:
-if exist $(STINCLUDE)\DOS.mak $(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\DOS.mak clean
if exist $(OD)DOS rd /s /q $(OD)DOS
rem # No such problem with the others, but just in case, do the same.
-if exist $(STINCLUDE)\WIN95.mak $(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN95.mak clean
if exist $(OD)WIN95 rd /s /q $(OD)WIN95
-if exist $(STINCLUDE)\WIN32.mak $(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN32.mak clean
if exist $(OD)WIN32 rd /s /q $(OD)WIN32
-if exist $(STINCLUDE)\WIN64.mak $(MAKE) /$(MAKEFLAGS) /f $(STINCLUDE)\WIN64.mak clean
if exist $(OD)WIN64 rd /s /q $(OD)WIN64
!IF DEFINED(OUTDIR)
-rd /S /Q $(OUTDIR) >NUL 2>&1
!ENDIF
-if "$@"=="distclean" del /Q config.*.bat >NUL 2>&1
# Dummy target, to build a source archive
dist zip:
$(MSG) Building ..\MsvcLibX.zip
cd ..
if exist MsvcLibX.zip del MsvcLibX.zip
set PATH=$(PATH);C:\Program Files\7-zip
7z.exe a MsvcLibX.zip *.txt src\*.bat src\*.mak src\*makefile src\exe src\*.c -r include\*.h lib\
rem # Delete files that got dragged in by wild cards, but that we don't want in the source zip.
7z.exe d MsvcLibX.zip src\config.*.bat lib\*.lib
cd src
# Run the configure.bat script in every subdirectory
config:
rem Nothing to do in $(MAKEDIR) as there is no further child level
# Dummy target, to display a help screen
help:
type <<
Targets:
all Rebuild all library versions (Default)
clean Delete all files built here, and all backup files
distclean Do a clean, then delete config.*.bat files
zip Build a source archive in ..\MsvcLibX.zip. Requires 7-zip.
<<NOKEEP
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename access.c * * Filename access.c *
* * * *
...@@ -10,17 +10,18 @@ ...@@ -10,17 +10,18 @@
* 2014-03-24 JFL Created this module. * * 2014-03-24 JFL Created this module. *
* 2014-07-02 JFL Added support for pathnames >= 260 characters. * * 2014-07-02 JFL Added support for pathnames >= 260 characters. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */ #define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */
#include <stdio.h>
#include <errno.h> #include <errno.h>
#include <io.h> #include <io.h>
#include "msvcStdio.h"
#include "msvclibx.h" #include "msvclibx.h"
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#ifdef _WIN32 #ifdef _WIN32
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename basename.c * * Filename basename.c *
* * * *
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* History * * History *
* 2016-09-08 JFL Created this file. * * 2016-09-08 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ 2005 security warnings */ #define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ 2005 security warnings */
#include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <libgen.h> #include "msvcStdlib.h"
#include <limits.h> #include "msvcLibgen.h"
#include "msvcLimits.h"
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename chdir.c * * Filename chdir.c *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-02-28 JFL Created this module. * * 2014-02-28 JFL Created this module. *
* 2014-07-02 JFL Added support for pathnames >= 260 characters. * * 2014-07-02 JFL Added support for pathnames >= 260 characters. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
/* Microsoft C libraries include files */ /* Microsoft C libraries include files */
#include <errno.h> #include <errno.h>
#include <stdio.h>
#include <string.h> #include <string.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include <unistd.h> #include "msvcStdio.h"
#include <iconv.h> #include "msvcUnistd.h"
#include "debugm.h" #include "msvcIconv.h"
#include "msvcDebugm.h"
#include "msvcLimits.h"
#include "sys/msvcTypes.h"
#if defined(_MSDOS) #if defined(_MSDOS)
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: clock_gettime.c * * Filename: clock_gettime.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-06-04 JFL Created this file. * * 2014-06-04 JFL Created this file. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#define WIN32_LEAN_AND_MEAN /* Avoid lots of unnecessary inclusions */ #define WIN32_LEAN_AND_MEAN /* Avoid lots of unnecessary inclusions */
#include <windows.h> #include <windows.h>
#include "msvcTime.h"
#include <sys/stat.h> /* For MsvcLibX's Filetime2Timespec */ #include "sys/msvcStat.h" /* For MsvcLibX's Filetime2Timespec */
int clock_gettime(clockid_t clock_id, struct timespec *pTS) { int clock_gettime(clockid_t clock_id, struct timespec *pTS) {
FILETIME ft; FILETIME ft;
......
:# config.DESKTOP-U79TD6T.bat generated by configure.bat on 2020/05/19 ܶ 7:50:15.02
:#
:# If changes are needeed, do not edit this file, but instead create a new script
:# called configure.YOURCHOICE.bat. This new script will be invoked automatically
:# by configure.bat while creating this file. Then your script can write extra
:# definitions, or change some of the variables before configure.bat writes them.
:#
:# Invoke configure.bat manually if anything changes in the tools config, such as
:# installing a Visual Studio update, or updating a configure.XXX.bat script.
set "HAS_STINCLUDE=1" &:# Found the System Tools global C includes
set "STINCLUDE=C:\Users\admin\Desktop\temp\MyGitHub\C\include" &:# System Tools global C includes
set "HAS_MSVCLIBX=1" &:# Found the MSVC Library eXtensions library
set "MSVCLIBX=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX" &:# MSVC Library eXtensions library
set "HAS_SDK_FLAGS=/DHAS_STINCLUDE=1 /DHAS_MSVCLIBX=1" &:# SDK detection flags for the C compiler
SET "PF32=C:\Program Files (x86)" &:# 32-bits Program Files
SET "PF64=C:\Program Files" &:# 64-bits Program Files
SET "ARCH=AMD64" &:# PROCESSOR_ARCHITECTURE
SET "MASM=" &:# Microsoft 16-bits Assembler base path
SET "MSVC=" &:# Microsoft 16-bits Visual C++ base path
SET "MAPSYM=" &:# 16-bits debugging symbols generator
SET "VSTUDIOLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0" &:# Microsoft Visual Studio (Long path)
SET "VSTUDIO=C:\PROGRA~2\MICROS~2.0" &:# Microsoft Visual Studio (Short path)
SET "VSCOMMONLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7" &:# Microsoft Visual Studio Common Files (Long path)
SET "VSCOMMON=C:\PROGRA~2\MICROS~2.0\Common7" &:# Microsoft Visual Studio Common Files (Short path)
SET "VSIDELONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE" &:# Microsoft Visual Studio IDE Files (Long path)
SET "VSIDE=C:\PROGRA~2\MICROS~2.0\Common7\IDE" &:# Microsoft Visual Studio IDE Files (Short path)
SET "VSTOOLSLONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools" &:# Microsoft Visual Studio Tools (Long paths)
SET "VSTOOLS=C:\PROGRA~2\MICROS~2.0\Common7\Tools" &:# Microsoft Visual Studio Tools (Short paths)
SET "MSVC32LONG=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC" &:# Microsoft Visual C++ 32/64 bits (Long path)
SET "MSVC32=C:\PROGRA~2\MICROS~2.0\VC" &:# Microsoft Visual C++ 32/64 bits (Short path)
SET "WIN_CP=936" &:# Windows Code Page
SET "WIN_CS=gb2312" &:# Windows Character Set
SET "DOS_CP=936" &:# DOS Code Page
SET "DOS_CS=gb2312" &:# DOS Character Set
SET "AS=" &:# Assembler
SET "CC=" &:# C compiler
SET "INCLUDE=C:\Users\admin\Desktop\temp\MyGitHub\C\include" &:# Include paths. Define USER_INCLUDE if needed.
SET "LK=" &:# Linker
SET "LIB=" &:# Libraries paths. Define USER_LIBS if needed.
SET "LB=" &:# Library manager
SET "RC=" &:# Resource compiler
SET "MT=" &:# Manifest tool
SET "DOS_CC=" &:# Microsoft Visual C++ 16-bits compiler
SET "DOS_AS=" &:# Microsoft 16-bits assembler
SET "DOS_LK=" &:# Microsoft 16-bits linker
SET "DOS_LB=" &:# Microsoft 16-bits librarian
SET "DOS_RC=" &:# Microsoft 16-bits resource compiler
SET "DOS_MT=" &:# Microsoft 16-bits manifest tool
SET "DOS_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for 16-bits compilation
SET "DOS_VCINC=" &:# Visual C++ 16-bits compiler include dir for MsvcLibX include_next
SET "DOS_CRTINC=" &:# Visual C++ 16-bits CRT library include dir for MsvcLibX include_next
SET "DOS_INCPATH=" &:# Include paths for 16-bits compilation
SET "DOS_LIBPATH=" &:# Libraries paths for 16-bits linking
SET "DOS_WINSDK=" &:# Microsoft Windows 16-bits SDK
SET "DOS_WINSDKINC=" &:# Microsoft Windows 16-bits SDK Include directory
SET "WIN95_CC=" &:# Microsoft Visual C++ 32-bits compiler
SET "WIN95_AS=" &:# Microsoft 32-bits assembler
SET "WIN95_LK=" &:# Microsoft 32-bits linker
SET "WIN95_LB=" &:# Microsoft 32-bits librarian
SET "WIN95_RC=" &:# Microsoft 32-bits resource compiler
SET "WIN95_MT=" &:# Microsoft 32-bits manifest tool
SET "WIN95_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for 32-bits compilation
SET "WIN95_VCINC=" &:# Visual C++ 32-bits compiler include dir for MsvcLibX include_next
SET "WIN95_CRTINC=" &:# Visual C++ 32-bits CRT library include dir for MsvcLibX include_next
SET "WIN95_INCPATH=" &:# Include paths for 32-bits compilation
SET "WIN95_LIBPATH=" &:# Libraries paths for 32-bits linking
SET "WIN95_WINSDK=" &:# Microsoft Windows 32-bits SDK
SET "WIN95_WINSDKINC=" &:# Microsoft Windows 32-bits SDK Include directory
SET "WIN32_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.EXE"" &:# Microsoft Visual C++ 32-bits compiler
SET "WIN32_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ML.EXE"" &:# Microsoft 32-bits assembler
SET "WIN32_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\LINK.EXE"" &:# Microsoft 32-bits linker
SET "WIN32_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\LIB.EXE"" &:# Microsoft 32-bits librarian
SET "WIN32_RC=" &:# Microsoft 32-bits resource compiler
SET "WIN32_MT=" &:# Microsoft 32-bits manifest tool
SET "WIN32_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for 32-bits compilation
SET "WIN32_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ 32-bits compiler include dir for MsvcLibX include_next
SET "WIN32_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ 32-bits CRT library include dir for MsvcLibX include_next
SET "WIN32_INCPATH=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for 32-bits compilation
SET "WIN32_LIBPATH=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX\lib;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x86" &:# Libraries paths for 32-bits linking
SET "WIN32_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows 32-bits SDK
SET "WIN32_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows 32-bits SDK Include directory
SET "IA64_CC=" &:# Microsoft Visual C++ IA64 compiler
SET "IA64_AS=" &:# Microsoft IA64 assembler
SET "IA64_LK=" &:# Microsoft IA64 linker
SET "IA64_LB=" &:# Microsoft IA64 librarian
SET "IA64_RC=" &:# Microsoft IA64 resource compiler
SET "IA64_MT=" &:# Microsoft IA64 manifest tool
SET "IA64_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for IA64 compilation
SET "IA64_VCINC=" &:# Visual C++ IA64 compiler include dir for MsvcLibX include_next
SET "IA64_CRTINC=" &:# Visual C++ IA64 CRT library include dir for MsvcLibX include_next
SET "IA64_INCPATH=" &:# Include paths for IA64 compilation
SET "IA64_LIBPATH=" &:# Libraries paths for IA64 linking
SET "IA64_WINSDK=" &:# Microsoft Windows IA64 SDK
SET "IA64_WINSDKINC=" &:# Microsoft Windows IA64 SDK Include directory
SET "WIN64_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.EXE"" &:# Microsoft Visual C++ 64-bits compiler
SET "WIN64_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\ML64.EXE"" &:# Microsoft 64-bits assembler
SET "WIN64_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\LINK.EXE"" &:# Microsoft 64-bits linker
SET "WIN64_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\LIB.EXE"" &:# Microsoft 64-bits librarian
SET "WIN64_RC=" &:# Microsoft 64-bits resource compiler
SET "WIN64_MT=" &:# Microsoft 64-bits manifest tool
SET "WIN64_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for 64-bits compilation
SET "WIN64_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ 64-bits compiler include dir for MsvcLibX include_next
SET "WIN64_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ 64-bits CRT library include dir for MsvcLibX include_next
SET "WIN64_INCPATH=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for 64-bits compilation
SET "WIN64_LIBPATH=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX\lib;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\amd64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64" &:# Libraries paths for 64-bits linking
SET "WIN64_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows 64-bits SDK
SET "WIN64_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows 64-bits SDK Include directory
SET "ARM_CC="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\CL.EXE"" &:# Microsoft Visual C++ ARM compiler
SET "ARM_AS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\ARMASM.EXE"" &:# Microsoft ARM assembler
SET "ARM_LK="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\LINK.EXE"" &:# Microsoft ARM linker
SET "ARM_LB="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm\LIB.EXE"" &:# Microsoft ARM librarian
SET "ARM_RC=" &:# Microsoft ARM resource compiler
SET "ARM_MT=" &:# Microsoft ARM manifest tool
SET "ARM_PATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_arm;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\System32;C:\Windows" &:# All tools paths for ARM compilation
SET "ARM_VCINC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" &:# Visual C++ ARM compiler include dir for MsvcLibX include_next
SET "ARM_CRTINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" &:# Visual C++ ARM CRT library include dir for MsvcLibX include_next
SET "ARM_INCPATH=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\winrt" &:# Include paths for ARM compilation
SET "ARM_LIBPATH=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX\lib;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\arm;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\arm" &:# Libraries paths for ARM linking
SET "ARM_WINSDK=C:\Program Files (x86)\Windows Kits\10" &:# Microsoft Windows ARM SDK
SET "ARM_WINSDKINC=C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0" &:# Microsoft Windows ARM SDK Include directory
SET "ARM64_CC=" &:# Microsoft Visual C++ ARM64 compiler
SET "ARM64_AS=" &:# Microsoft ARM64 assembler
SET "ARM64_LK=" &:# Microsoft ARM64 linker
SET "ARM64_LB=" &:# Microsoft ARM64 librarian
SET "ARM64_RC=" &:# Microsoft ARM64 resource compiler
SET "ARM64_MT=" &:# Microsoft ARM64 manifest tool
SET "ARM64_PATH=;C:\Windows\System32;C:\Windows" &:# All tools paths for ARM64 compilation
SET "ARM64_VCINC=" &:# Visual C++ ARM64 compiler include dir for MsvcLibX include_next
SET "ARM64_CRTINC=" &:# Visual C++ ARM64 CRT library include dir for MsvcLibX include_next
SET "ARM64_INCPATH=" &:# Include paths for ARM64 compilation
SET "ARM64_LIBPATH=" &:# Libraries paths for ARM64 linking
SET "ARM64_WINSDK=" &:# Microsoft Windows ARM64 SDK
SET "ARM64_WINSDKINC=" &:# Microsoft Windows ARM64 SDK Include directory
:# List of commands to run when make.bat exits
SET "POST_MAKE_ACTIONS=set "MSVCLIBX=C:\Users\admin\Desktop\temp\MyGitHub\C\MsvcLibX""
exit /b 0 &:# Configuration done successfully
@echo off
:#*****************************************************************************
:# *
:# Filename: configure.MsvcLibX.bat *
:# *
:# Description: Special make actions for rebuilding the MsvcLibX library *
:# *
:# Notes: *
:# *
:# History: *
:# 2015-11-06 JFL Created this script. *
:# 2016-09-27 JFL Correct the final MSVCLIBX if there's a different OUTDIR. *
:# 2016-11-03 JFL Removed the side effect creating %OUTDIR%. *
:# 2016-11-07 JFL Removed the dependency on OUTDIR. *
:# Immediately set the system environment. *
:# 2016-11-16 JFL Allow using a predefined alias for this lib base path. *
:# 2016-12-16 JFL Only use setx if requested by user, with PERSISTENT_VARS. *
:# *
:# © Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the MsvcLibX library base directory
if defined MSVCLIBX if not exist "%MSVCLIBX%\include\msvclibx.h" set "MSVCLIBX=" &:# Allow overriding with another alias name, but ignore invalid overrides
if not defined MSVCLIBX for /f "delims=" %%d in ('"pushd .. & cd & popd"') do SET "MSVCLIBX=%%d" &:# Default: Use the current directory
:# Declare the SDKs and libraries we need
%BEGIN_SDK_DEFS%
%USE_SDK% MSVCLIBX &:# Triggers the emission of a %CONFIG% record for MSVCLIBX
%END_SDK_DEFS%
:# Set the local environment variable just before make exits, so that future commands in this CMD window have it.
%ADD_POST_MAKE_ACTION% set "MSVCLIBX=%MSVCLIBX%"
:# Set the system environment variable, so that other CMD windows opened later on inherit it
if defined PERSISTENT_VARS setx MSVCLIBX "%MSVCLIBX%" >NUL
@echo off
:#*****************************************************************************
:# *
:# Filename: configure.bat *
:# *
:# Description: Detect system-specific settings and create config.*.bat *
:# *
:# Notes: Proxy script for %STINCLUDE%\configure.bat. *
:# *
:# Make any change needed in %STINCLUDE%\configure.bat. *
:# *
:# History: *
:# 2016-10-10 JFL jf.larvoire@hpe.com created this file. *
:# 2016-12-15 JFL Search for the real make.bat in [.|..|../..]\include. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the STINCLUDE library directory
if defined STINCLUDE if not exist "%STINCLUDE%\make.bat" set "STINCLUDE=" &:# Allow overriding with another alias name, but ignore invalid overrides
for %%p in (. .. ..\..) do if not defined STINCLUDE if exist %%p\include\make.bat ( :# Default: Search it the current directory, and 2 levels above.
for /f "delims=" %%d in ('"pushd %%p\include & cd & popd"') do SET "STINCLUDE=%%d"
)
if not defined STINCLUDE ( :# Try getting the copy in the master environment
for /f "tokens=3" %%v in ('reg query "HKCU\Environment" /v STINCLUDE 2^>NUL') do set "STINCLUDE=%%v"
)
if not exist %STINCLUDE%\make.bat (
>&2 echo %0 Error: Cannot find SysToolsLib's global C include directory. Please define variable STINCLUDE.
exit /b 1
)
if [%1]==[-d] echo "%STINCLUDE%\configure.bat" %*
"%STINCLUDE%\configure.bat" %*
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: debugv.c * * Filename: debugv.c *
* * * *
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
* History: * * History: *
* 2013-03-27 JFL jf.larvoire@hp.com created this file. * * 2013-03-27 JFL jf.larvoire@hp.com created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#include "debugm.h" #include "msvcDebugm.h"
#if defined(_DEBUG) #if defined(_DEBUG)
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: dirent.c * * Filename: dirent.c *
* * * *
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* 2015-12-14 JFL Bug fix: WIN32 readdirW always read the root on "D:". * * 2015-12-14 JFL Bug fix: WIN32 readdirW always read the root on "D:". *
* Bug fix: DOS opendir failed on root dirs, like "D:\". * * Bug fix: DOS opendir failed on root dirs, like "D:\". *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define _UTF8_SOURCE /* Generate the UTF-8 version of WIN32 printf & scandir */ #define _UTF8_SOURCE /* Generate the UTF-8 version of WIN32 printf & scandir */
#include "dirent.h" /* Include our associated .h, in the same dir as this .c. Do not use <>. */ #include "msvcDirent.h" /* Include our associated .h, in the same dir as this .c. Do not use <>. */
#ifndef _DIRENT_FOR_DOS_WINDOWS #ifndef _DIRENT_FOR_DOS_WINDOWS
#error "This requires MsvcLibX own version of dirent.h for DOS/Windows" #error "This requires MsvcLibX own version of dirent.h for DOS/Windows"
#endif #endif
...@@ -49,9 +49,10 @@ ...@@ -49,9 +49,10 @@
#include <memory.h> #include <memory.h>
#include <errno.h> #include <errno.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include <unistd.h> /* For readlink() */ #include "msvcUnistd.h" /* For readlink() */
#include <sys/stat.h> /* For Filetime2String() */ #include "sys/msvcStat.h" /* For Filetime2String() */
#include "debugm.h" /* Use our house debugging framework */ #include "msvcDebugm.h" /* Use our house debugging framework */
#include "msvcLimits.h" /* Use our house debugging framework */
/*****************************************************************************\ /*****************************************************************************\
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename dirname.c * * Filename dirname.c *
* * * *
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* History * * History *
* 2016-09-08 JFL Created this file. * * 2016-09-08 JFL Created this file. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <libgen.h> #include "msvcLibgen.h"
#include <limits.h> #include "msvcLimits.h"
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename err2errno.c * * Filename err2errno.c *
* * * *
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Removed a few useless special cases, and added EZERO case.* * Removed a few useless special cases, and added EZERO case.*
* Make sure the global errno is _not_ changed by this funct.* * Make sure the global errno is _not_ changed by this funct.*
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include "debugm.h" #include "msvcDebugm.h"
#ifdef _WIN32 #ifdef _WIN32
...@@ -65,7 +65,6 @@ int _get_errno_from_oserr(unsigned long dwErr) { ...@@ -65,7 +65,6 @@ int _get_errno_from_oserr(unsigned long dwErr) {
return errno; return errno;
} }
#else #else
#pragma message("Using the default " MSVCLIBX_STRINGIZE(_get_errno_from_oserr) "()")
/* Equivalent function in MSVC library. Does not know about symlink errors. */ /* Equivalent function in MSVC library. Does not know about symlink errors. */
extern int __cdecl _get_errno_from_oserr(unsigned long oserrno); extern int __cdecl _get_errno_from_oserr(unsigned long oserrno);
#endif #endif
......
#!/bin/bash
#*****************************************************************************#
# #
# Filename: exe #
# #
# Description: Build simple C/C++ programs for Unix/Linux #
# #
# Notes: Usage: ./exe PROGRAM #
# #
# Stores the executables in $OS.$PROC/[Debug/] for #
# consistency with the Windows build tools. #
# This allows sharing sources in a host system, and #
# using VMs for building the various Windows and Linux #
# versions in a set of OS-specific subdirectories. #
# #
# History: #
# 2013-12-16 JFL Added support for MinGW64. #
# 2015-12-12 JFL Help now displays the output directory name. #
# 2016-01-07 JFL Added compilation option -Wall. #
# #
# Copyright 2016 Hewlett Packard Enterprise Development LP #
# Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 #
#*****************************************************************************#
FileNoCase() # Case-independant search for a file.
{
find . -type f | grep -i -E "./$1$" | sed s=./==
}
# Identify the OS
OS=`uname -s`
PROC=`uname -p`
if [[ "$OS" == "OSF1" && "`uname -m`" == "alpha" ]] ; then
OS=Tru64
fi
if [[ "$OS" == "WindowsNT" ]] ; then
OS=WIN32
fi
OUTDIR=$OS.$PROC
if [[ "${OS:0:7}" == "MINGW32" ]] ; then # Ex: "MINGW32_NT-6.1"
OUTDIR=MINGW32 # MigGW shell if NOT case sensitive
# 2013-12-16 Actually, the 64-bits tool chain also reports MINGW32_NT-6.1
# So distinguish the two by whether /mingw is mounted on C:\MinGW or C:\MinGW64
if mount | grep /mingw | grep 64 > /dev/null ; then
OUTDIR=MINGW64 # MigGW shell if NOT case sensitive
fi
fi
if [[ "${OS:0:7}" == "MINGW64" ]] ; then # Ex: ?
OUTDIR=MINGW64
fi
if [[ "${OS:0:6}" == "CYGWIN" ]] ; then # Ex: "CYGWIN_NT-6.1-WOW64"
OUTDIR=cygwin # Cygwin shell if case sensitive, so use lower case
fi
# Command line analysis.
case "$1" in
"" | "-h" | "-?" | --help)
echo "Build simple C/C++ programs, storing the executables in $OUTDIR/"
echo "Usage: ./exe PROGRAM"
exit 0
;;
esac
# Identify the source file and program to build.
PROGRAM=$1
shift
SOURCES=`FileNoCase ${PROGRAM}.c`
CFLAGS="-std=c99 -Wall" # Force compilation in C, even if there are // comments.
if [[ "${SOURCES}" == "" ]] ; then
SOURCES=`FileNoCase ${PROGRAM}.cpp`
CFLAGS="-std=gnu++98 -lstdc++" # Force compilation in C++, even if plain C.
# -lstdc++ prevents error "undefined reference to '__gxx_personality_v0'"
fi
if [[ "${SOURCES}" == "" ]] ; then
echo "Failed to find ${PROGRAM} source."
exit 1
fi
# Make sure our include directories are accessible
if [[ -d "/u/JFL/SRC/Include" ]] ; then
if [[ ":$C_INCLUDE_PATH:" != *:/u/JFL/SRC/Include:* ]] ; then
if [[ "$C_INCLUDE_PATH" == "" ]] ; then
export C_INCLUDE_PATH="/u/JFL/SRC/Include"
else
export C_INCLUDE_PATH="$C_INCLUDE_PATH:/u/JFL/SRC/Include"
fi
fi
fi
echo "# C_INCLUDE_PATH=\"$C_INCLUDE_PATH\""
# Build it.
# gmake CC=gcc CFLAGS="$CFLAGS" SOURCES="$SOURCES" PROGRAM="$PROGRAM" OS="$OS" $*
mkdir -p $OUTDIR
echo "gcc $CFLAGS -U_DEBUG $SOURCES -o $OUTDIR/$PROGRAM"
gcc $CFLAGS -U_DEBUG $SOURCES -o $OUTDIR/$PROGRAM
mkdir -p $OUTDIR/debug
echo "gcc $CFLAGS -D_DEBUG $SOURCES -o $OUTDIR/debug/$PROGRAM"
gcc $CFLAGS -D_DEBUG $SOURCES -o $OUTDIR/debug/$PROGRAM
@echo off
:#*****************************************************************************
:# *
:# Filename: exe.bat *
:# *
:# Description: Front end to make.bat, to simply build multiple targets *
:# *
:# Arguments: Use option -? to display a help screen *
:# *
:# Notes: Builds the 16-bits MS-DOS version if Visual C++ 1.52 is *
:# installed in its default location in C:\MSVC. *
:# *
:# History: *
:# 2003-03-31 JFL Adapted from previous projects *
:# 2014-03-21 JFL Builds the 16-bits MS-DOS version if Visual C++ 1.52 is *
:# installed in its default location in C:\MSVC. *
:# 2014-03-27 JFL Changed option -f to use nmake option /A. *
:# Added option -r for completeness. *
:# 2015-11-13 JFL Adapted to the new multitarget make system. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
setlocal enableextensions enabledelayedexpansion
goto main
:main
set "FORCE=0"
set "ACTION=default"
set "EXEC="
set "MAKEOPTS="
goto get_arg
:next_arg
shift
:get_arg
if .%1.==.-?. goto help
if .%1.==./?. goto help
if .%1.==.-a. set "ACTION=all" & goto next_arg
if .%1.==.-d. set "ACTION=debug" & goto next_arg
if .%1.==.-f. set "FORCE=1" & goto next_arg
if .%1.==.-r. set "ACTION=release" & goto next_arg
if .%1.==.-X. set "EXEC=echo" & goto next_arg
set MAKEOPTS=%2 %3 %4 %5 %6 %7 %8 %9
if "%FORCE%"=="1" set "MAKEOPTS=%MAKEOPTS% /A"
goto %ACTION%
:help
echo.
echo..exe program builder from a C or C++ source
echo.
echo.Usage: exe [options] program [nmake_options]
echo.
echo.Options:
echo.
echo. -? Display this help page
echo. -a Builds all release ^& debug versions (default)
echo. -d Builds all debug versions only
echo. -f Force building all program targets, irrespective of file dates
echo. -r Builds all release versions only
echo. -X Display the make command generated and exit
echo.
echo.Notes:
echo.* exe myprog ^<==^> make myprog.exe debug\myprog.exe
echo.* This builds all possible OS targets
echo.* To force rebuilding all targets, irrespective of their date,
echo. use nmake option /A. So: exe -f myprog ^<==^> exe myprog /A
goto :eof
:release
%EXEC% make %MAKEOPTS% %1.exe
goto :eof
:debug
%EXEC% make %MAKEOPTS% debug\%1.exe
goto :eof
:default
:all
%EXEC% make %MAKEOPTS% %1.exe debug\%1.exe
goto :eof
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename filetime.c * * Filename filetime.c *
* * * *
...@@ -9,17 +9,17 @@ ...@@ -9,17 +9,17 @@
* History: * * History: *
* 2014-02-26 JFL Created this module. * * 2014-02-26 JFL Created this module. *
* 2014-03-24 JFL Renamed "statx.h" as the standard <sys/stat.h>. * * 2014-03-24 JFL Renamed "statx.h" as the standard <sys/stat.h>. *
* 2014-07-03 JFL Filetime2String: Output time with s precision if possib. * * 2014-07-03 JFL Filetime2String: Output time with s precision if possib. *
* 2016-09-13 JFL Fixed a warning. * * 2016-09-13 JFL Fixed a warning. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */ #define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */
#include <time.h> /* Define time_t */ #include "msvcTime.h" /* Define time_t */
#include <sys/stat.h> #include "sys/msvcStat.h"
#ifdef _MSDOS #ifdef _MSDOS
...@@ -230,7 +230,7 @@ struct tm *LocalFileTime(const time_t *pt) { ...@@ -230,7 +230,7 @@ struct tm *LocalFileTime(const time_t *pt) {
} }
/* Generate a string with the local file time, in the ISO 8601 date/time format */ /* Generate a string with the local file time, in the ISO 8601 date/time format */
/* 2014-07-03 Output time with s precision if possible */ /* 2014-07-03 Output time with s precision if possible */
char *Filetime2String(const FILETIME *pFT, char *pBuf, size_t nBufSize) { char *Filetime2String(const FILETIME *pFT, char *pBuf, size_t nBufSize) {
FILETIME lft; FILETIME lft;
SYSTEMTIME sTime; SYSTEMTIME sTime;
...@@ -246,7 +246,7 @@ char *Filetime2String(const FILETIME *pFT, char *pBuf, size_t nBufSize) { ...@@ -246,7 +246,7 @@ char *Filetime2String(const FILETIME *pFT, char *pBuf, size_t nBufSize) {
uli.LowPart = lft.dwLowDateTime; uli.LowPart = lft.dwLowDateTime;
uli.HighPart = lft.dwHighDateTime; uli.HighPart = lft.dwHighDateTime;
iFraction = (int)(uli.QuadPart % 10000000); /* FILETIME has 100ns resolution */ iFraction = (int)(uli.QuadPart % 10000000); /* FILETIME has 100ns resolution */
iFraction /= 10; /* Convert 100ns resolution to 1s resolution */ iFraction /= 10; /* Convert 100ns resolution to 1s resolution */
wsprintf(pBuf+19, ".%06d", iFraction); wsprintf(pBuf+19, ".%06d", iFraction);
} else if (nBufSize >= 24) { } else if (nBufSize >= 24) {
wsprintf(pBuf+19, ".%03d", sTime.wMilliseconds); wsprintf(pBuf+19, ".%03d", sTime.wMilliseconds);
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: fnmatch.c * * Filename: fnmatch.c *
* * * *
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* 2014-02-28 JFL Added support for UTF-8 pathnames. * * 2014-02-28 JFL Added support for UTF-8 pathnames. *
* 2014-03-05 JFL In debug mode, hide recursive calls. * * 2014-03-05 JFL In debug mode, hide recursive calls. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include "fnmatch.h" /* Include our associated .h, in the same dir as this .c. Do not use <>. */ #include "msvcFnmatch.h" /* Include our associated .h, in the same dir as this .c. Do not use <>. */
#include "debugm.h" #include "msvcDebugm.h"
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename fstat.c * * Filename fstat.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-06-24 JFL Created this module. * * 2014-06-24 JFL Created this module. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
/* MsvcLibX library extensions */
#include <sys/stat.h>
#include "debugm.h"
#include <stdint.h> #include <stdint.h>
/* MsvcLibX library extensions */
#include "sys/msvcStat.h"
#include "msvcDebugm.h"
#if defined(_MSDOS) #if defined(_MSDOS)
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename fstat64.c * * Filename fstat64.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-06-24 JFL Created this module. * * 2014-06-24 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename fstat64i32.c * * Filename fstat64i32.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-06-24 JFL Created this module. * * 2014-06-24 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename fullpath.c * * Filename fullpath.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History * * History *
* 2016-09-13 JFL Created this module with routine from truename.c. * * 2016-09-13 JFL Created this module with routine from truename.c. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
#define _UTF8_SOURCE /* Generate the UTF-8 version of routines */ #define _UTF8_SOURCE /* Generate the UTF-8 version of routines */
#include <stdlib.h> #include <stdlib.h>
#include <limits.h>
#include <malloc.h> #include <malloc.h>
#include "msvcLimits.h"
#ifdef _WIN32 /* Automatically defined when targeting a Win32 application */ #ifdef _WIN32 /* Automatically defined when targeting a Win32 application */
#include <windows.h> /* Also includes MsvcLibX' WIN32 UTF-8 extensions */ #include "msvcWindows.h" /* Also includes MsvcLibX' WIN32 UTF-8 extensions */
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename getcwd.c * * Filename getcwd.c *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-02-28 JFL Created this module. * * 2014-02-28 JFL Created this module. *
* 2014-07-02 JFL Added support for pathnames >= 260 characters. * * 2014-07-02 JFL Added support for pathnames >= 260 characters. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include <unistd.h> #include "msvcUnistd.h"
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#if defined(_MSDOS) #if defined(_MSDOS)
......
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
* *
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "getopt.h" #include "msvcGetopt.h"
#ifndef _DIAGASSERT #ifndef _DIAGASSERT
#ifdef NDEBUG #ifdef NDEBUG
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename getppid.c * * Filename getppid.c *
* * * *
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
* History: * * History: *
* 2013-03-27 JFL Created this module. * * 2013-03-27 JFL Created this module. *
* * * *
* © Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#include <unistd.h> #include "msvcUnistd.h"
#ifdef _WIN32 #ifdef _WIN32
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename gettimeofday.c * * Filename gettimeofday.c *
* * * *
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
* History * * History *
* 2014-06-04 JFL Created this file. * * 2014-06-04 JFL Created this file. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#include "msvclibx.h" #include "msvclibx.h"
#include <time.h> #include "msvcTime.h"
#include <sys/time.h> #include "sys/msvcTime.h"
#ifdef _MSDOS #ifdef _MSDOS
/* MS-DOS only has a 1-second resolution on system time. /* MS-DOS only has a 1-second resolution on system time.
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename iconv.c * * Filename iconv.c *
* * * *
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* 2015-12-09 JFL Added routines fputsU and vfprintfU. * * 2015-12-09 JFL Added routines fputsU and vfprintfU. *
* 2016-09-13 JFL Fixed warnings in fputsU. Do not change the input buffer. * * 2016-09-13 JFL Fixed warnings in fputsU. Do not change the input buffer. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -23,8 +23,9 @@ ...@@ -23,8 +23,9 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include "iconv.h" #include "msvcIconv.h"
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#if defined(_MSDOS) #if defined(_MSDOS)
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename lstat.c * * Filename lstat.c *
* * * *
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* 2014-03-24 JFL Renamed "statx.h" as the standard <sys/stat.h>. * * 2014-03-24 JFL Renamed "statx.h" as the standard <sys/stat.h>. *
* 2014-06-30 JFL Added support for 32K Unicode paths. * * 2014-06-30 JFL Added support for 32K Unicode paths. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -29,13 +29,14 @@ ...@@ -29,13 +29,14 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdint.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include "msvclibx.h" #include "msvclibx.h"
#include <sys/stat.h> #include <sys/msvcStat.h>
#include <dirent.h> #include "msvcDirent.h"
#include <unistd.h> /* For ResolveLinks() definition */ #include "msvcUnistd.h" /* For ResolveLinks() definition */
#include "debugm.h" #include "msvcDebugm.h"
#include <stdint.h> #include "msvcLimits.h"
#if defined(_MSDOS) #if defined(_MSDOS)
/* Make sure it's only defined it in one of the lstatxxx versions */ /* Make sure it's only defined it in one of the lstatxxx versions */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename lstat32.c * * Filename lstat32.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-14 JFL Created this module. * * 2014-02-14 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename lstat32i64.c * * Filename lstat32i64.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-14 JFL Created this module. * * 2014-02-14 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename lstat.c * * Filename lstat.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-14 JFL Created this module. * * 2014-02-14 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename lstat64i32.c * * Filename lstat64i32.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-14 JFL Created this module. * * 2014-02-14 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename main.c * * Filename main.c *
* * * *
...@@ -12,20 +12,20 @@ ...@@ -12,20 +12,20 @@
* 2017-02-05 JFL Redesigned to override libc's _setargv(). This avoids * * 2017-02-05 JFL Redesigned to override libc's _setargv(). This avoids *
* having to encapsulate the main() routine with one here. * * having to encapsulate the main() routine with one here. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#define _UTF8_SOURCE #define _UTF8_SOURCE
#define _CRT_SECURE_NO_WARNINGS /* Avoid depreciation warnings */ #define _CRT_SECURE_NO_WARNINGS /* Avoid depreciation warnings */
#include <stdio.h>
#include "msvclibx.h" #include "msvclibx.h"
#include "msvcStdio.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <iconv.h> /* For MsvcLibX' codePage global variable */ #include "msvcIconv.h" /* For MsvcLibX' codePage global variable */
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
@echo off
:#*****************************************************************************
:# *
:# Filename: make.bat *
:# *
:# Description: Build DOS and Windows targets *
:# *
:# Notes: Proxy script for %STINCLUDE%\make.bat. *
:# *
:# If any change is needed, put it in %STINCLUDE%\make.bat. *
:# *
:# History: *
:# 2016-10-10 JFL jf.larvoire@hpe.com created this file. *
:# 2016-12-15 JFL Search for the real make.bat in [.|..|../..]\include. *
:# *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:#*****************************************************************************
:# Get the full pathname of the STINCLUDE library directory
if defined STINCLUDE if not exist "%STINCLUDE%\make.bat" set "STINCLUDE=" &:# Allow overriding with another alias name, but ignore invalid overrides
for %%p in (. .. ..\..) do if not defined STINCLUDE if exist %%p\include\make.bat ( :# Default: Search it the current directory, and 2 levels above.
for /f "delims=" %%d in ('"pushd %%p\include & cd & popd"') do SET "STINCLUDE=%%d"
)
if not defined STINCLUDE ( :# Try getting the copy in the master environment
for /f "tokens=3" %%v in ('reg query "HKCU\Environment" /v STINCLUDE 2^>NUL') do set "STINCLUDE=%%v"
)
if not exist %STINCLUDE%\make.bat (
>&2 echo %0 Error: Cannot find SysToolsLib's global C include directory. Please define variable STINCLUDE.
exit /b 1
)
if [%1]==[-d] echo "%STINCLUDE%\make.bat" %*
"%STINCLUDE%\make.bat" %*
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename mb2wpath.c * * Filename mb2wpath.c *
* * * *
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
* History: * * History: *
* 2014-07-01 JFL Created this module. * * 2014-07-01 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#define _UTF8_SOURCE /* Generate the UTF-8 version of printf routines */ #define _UTF8_SOURCE /* Generate the UTF-8 version of printf routines */
#include "msvclibx.h" #include "msvclibx.h"
#include "debugm.h" #include "msvcDebugm.h"
#if defined(_WIN32) #if defined(_WIN32)
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename mkdir.c * * Filename mkdir.c *
* * * *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* 2014-03-24 JFL Renamed "statx.h" as the standard <sys/stat.h>. * * 2014-03-24 JFL Renamed "statx.h" as the standard <sys/stat.h>. *
* 2014-07-02 JFL Added support for pathnames >= 260 characters. * * 2014-07-02 JFL Added support for pathnames >= 260 characters. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
#include <direct.h> /* For _mkdir() */ #include <direct.h> /* For _mkdir() */
#include <errno.h> #include <errno.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include <sys/stat.h> #include <sys/msvcStat.h>
#include "msvclibx.h" #include "msvclibx.h"
#include "msvcLimits.h"
#ifdef _WIN32 #ifdef _WIN32
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename mkdtemp.c * * Filename mkdtemp.c *
* * * *
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
* History: * * History: *
* 2014-02-13 JFL Created this module. * * 2014-02-13 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include "msvcUnistd.h"
char *mkdtemp(char *pszName) { char *mkdtemp(char *pszName) {
char *pszXXX, *pc; char *pszXXX, *pc;
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename mkstemp.c * * Filename mkstemp.c *
* * * *
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
* History: * * History: *
* 2014-03-03 JFL Created this module. * * 2014-03-03 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */ #define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */
#include <unistd.h> #include "msvcUnistd.h"
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename open.c * * Filename open.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2017-02-16 JFL Created this module. * * 2017-02-16 JFL Created this module. *
* * * *
* Copyright 2017 Hewlett Packard Enterprise Development LP * * Copyright 2017 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
#include <errno.h> #include <errno.h>
#include "msvclibx.h" #include "msvclibx.h"
#include "fcntl.h" #include "msvcFcntl.h"
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#ifdef _WIN32 #ifdef _WIN32
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename readlink.c * * Filename readlink.c *
* * * *
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* 2014-07-03 JFL Added support for pathnames >= 260 characters. * * 2014-07-03 JFL Added support for pathnames >= 260 characters. *
* 2016-09-09 JFL Fixed a crash in debug mode, due to stack overflows. * * 2016-09-09 JFL Fixed a crash in debug mode, due to stack overflows. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -27,16 +27,17 @@ ...@@ -27,16 +27,17 @@
#define _UTF8_SOURCE /* Generate the UTF-8 version of routines */ #define _UTF8_SOURCE /* Generate the UTF-8 version of routines */
#include <unistd.h> #include "msvcUnistd.h"
#pragma comment(lib, "Mpr.lib") #pragma comment(lib, "Mpr.lib")
#include <errno.h> #include <errno.h>
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include "reparsept.h" #include "msvcReparsept.h"
/* Get the Reparse Point Tag for a mount point - Wide char version */ /* Get the Reparse Point Tag for a mount point - Wide char version */
/* See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365511(v=vs.85).aspx */ /* See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365511(v=vs.85).aspx */
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename realpath.c * * Filename realpath.c *
* * * *
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* Convert short WIN32 paths to long paths. * * Convert short WIN32 paths to long paths. *
* 2016-09-13 JFL Resize output buffers, to avoid wasting lots of memory. * * 2016-09-13 JFL Resize output buffers, to avoid wasting lots of memory. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -31,13 +31,15 @@ ...@@ -31,13 +31,15 @@
#define _UTF8_SOURCE /* Generate the UTF-8 version of routines */ #define _UTF8_SOURCE /* Generate the UTF-8 version of routines */
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <direct.h> /* For _getdcwd() */ #include <direct.h> /* For _getdcwd() */
#include <ctype.h> /* For toupper() */ #include <ctype.h> /* For toupper() */
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#include "msvcUnistd.h"
#include "msvcWindows.h"
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename spawn.c * * Filename spawn.c *
* * * *
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2014-03-27 JFL Created this module. * * 2014-03-27 JFL Created this module. *
* 2014-07-03 JFL Added support for pathnames >= 260 characters. * * 2014-07-03 JFL Added support for pathnames >= 260 characters. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -19,8 +19,9 @@ ...@@ -19,8 +19,9 @@
/* Microsoft C libraries include files */ /* Microsoft C libraries include files */
#include <stdio.h> #include <stdio.h>
/* MsvcLibX library extensions */ /* MsvcLibX library extensions */
#include "debugm.h" #include "msvcDebugm.h"
#include "msvclibx.h" #include "msvclibx.h"
#include "msvcLimits.h"
#ifdef _WIN32 #ifdef _WIN32
......
@echo off
:******************************************************************************
:* *
:* Filename: src2objs.bat *
:* *
:* Description: Generate object files names from source files names *
:* *
:* Notes: *
:* *
:* History: *
:* 2010-04-07 JFL Created this batch. *
:* *
:# Copyright 2016 Hewlett Packard Enterprise Development LP *
:# Licensed under the Apache 2.0 license www.apache.org/licenses/LICENSE-2.0 *
:******************************************************************************
setlocal 2>NUL
set ARG0=%0
:# Mechanism for calling subroutines. Done by {call %0 _call_ label [arguments]}.
if .%1.==._call_. shift /2 & goto %2
set CALL=call %0 _call_
set RETURN=goto end
:# Silent return. Used for routines silently called via call :label.
set _RETURN=goto _end
set PUTVARS=call :putvars
:# Set global defaults
setlocal
set OUTFILE=obj\objects.mak
set OUTPATH=obj
set NO_EXEC=0
goto get_args
:help
echo Generate object files names from source files names
echo.
echo Usage: %ARG0% [options] source ...
echo.
echo Options:
echo -?^|-h This help
echo -o {pathname} Output file pathname. Default: %OUTFILE%
echo -X Display object files names, but do not create the output file
goto end
:get_args
if .%1.==.. goto help
if .%1.==.-?. goto help
if .%1.==./?. goto help
if %1==-o shift & goto set_out
if %1==-X shift & goto no_exec
goto go
:set_out
set OUTFILE=%1
:# Split the path. Uses a fake drive @ to prevent prepending the current path on an existing drive.
for %%F in (@:"%OUTFILE%") do (
set "OUTPATH=%%~dpF"
)
:# Remove the head "@:\ and tail \ to the path
set "OUTPATH=%OUTPATH:~4,-1%"
shift
goto get_args
:no_exec
set NO_EXEC=1
goto get_args
:# Check prerequisites
:check
verify other 2>nul
setlocal enableextensions
if errorlevel 1 (
echo>&2 Error: Unable to enable command extensions.
exit /b 1
)
set VAR=before
if "%VAR%" == "before" (
set VAR=after
if not "!VAR!" == "after" (
echo>&2 Error: Delayed environment variable expansion must be enabled.
echo>&2 Please restart your cmd.exe shell with the /V option,
echo>&2 or set HKLM\Software\Microsoft\Command Processor\DelayedExpansion=1
exit /b 1
)
)
%_RETURN%
:go
%CALL% check
if errorlevel 1 exit /b 1
set OBJECTS=
:next
if .%1.==.. goto done
for %%s in (%1) do (
set EXT=%%~xs
set OBJ=
if .!EXT!.==..c. set OBJ=obj
if .!EXT!.==..C. set OBJ=obj
if .!EXT!.==..cpp. set OBJ=obj
if .!EXT!.==..CPP. set OBJ=obj
if .!EXT!.==..asm. set OBJ=obj
if .!EXT!.==..ASM. set OBJ=obj
if .!EXT!.==..rc. set OBJ=res
if .!EXT!.==..RC. set OBJ=res
if .!OBJ!.==.. (
echo>&2 Error: Unsupported source type: !EXT!
echo>&2 Please add a conversion rule in %ARG0%
) else (
if .!OBJECTS!.==.. (
set OBJECTS=%OUTPATH%\%%~ns.!OBJ!
) else (
set OBJECTS=!OBJECTS! %OUTPATH%\%%~ns.!OBJ!
)
)
)
shift
goto next
:done
echo OBJECTS=%OBJECTS%
if %NO_EXEC%==0 echo>%OUTFILE% OBJECTS=%OBJECTS%
:end
:_end
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename strerror.c * * Filename strerror.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-03-06 JFL Created this module. * * 2014-03-06 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename strndup.c * * Filename strndup.c *
* * * *
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* History: * * History: *
* 2014-02-13 JFL Created this module. * * 2014-02-13 JFL Created this module. *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename strptime.c * * Filename strptime.c *
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename symlink.c * * Filename symlink.c *
* * * *
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* do not support symlinks. * * do not support symlinks. *
* 2016-08-25 JFL Fixed two warnings. * * 2016-08-25 JFL Fixed two warnings. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -27,17 +27,18 @@ ...@@ -27,17 +27,18 @@
#define _UTF8_SOURCE /* Generate the UTF-8 version of routines */ #define _UTF8_SOURCE /* Generate the UTF-8 version of routines */
#include <unistd.h> #include "msvcUnistd.h"
#pragma comment(lib, "Mpr.lib") #pragma comment(lib, "Mpr.lib")
#include <errno.h> #include <errno.h>
#include "debugm.h" #include "msvcDebugm.h"
#include "msvcLimits.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include "reparsept.h" #include "msvcReparsept.h"
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
* * * *
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename: uname.c * * Filename: uname.c *
* * * *
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
* History: * * History: *
* 2014-05-30 JFL Created this file. * * 2014-05-30 JFL Created this file. *
* * * *
* © Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
#include "sys/utsname.h" #include "sys/msvcTsname.h"
#include <stdlib.h> /* For itoa() */ #include <stdlib.h> /* For itoa() */
static char major[4] = {0}; static char major[4] = {0};
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename utime.c * * Filename utime.c *
* * * *
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* 2014-07-02 JFL Added support for pathnames >= 260 characters. * * 2014-07-02 JFL Added support for pathnames >= 260 characters. *
* 2016-08-25 JFL Added missing routine utimeA(). * * 2016-08-25 JFL Added missing routine utimeA(). *
* * * *
* Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */ #define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */
#include <errno.h> #include <errno.h>
#include <sys/time.h> /* Must be included before any direct or indirect <windows.h> inclusion */ #include "sys/msvcTime.h" /* Must be included before any direct or indirect <windows.h> inclusion */
#include <utime.h> #include "msvcUtime.h"
#include "msvcDebugm.h"
#include "debugm.h" #include "msvcLimits.h"
#if defined(_DEBUG) #if defined(_DEBUG)
#include <stdio.h> #include <stdio.h>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <windows.h> #include <windows.h>
#include <io.h> /* For MSVC's _get_osfhandle() */ #include <io.h> /* For MSVC's _get_osfhandle() */
#include <unistd.h> /* For MsvcLibX's ResolveLinks() */ #include "msvcUnistd.h" /* For MsvcLibX's ResolveLinks() */
/* Convert a Windows FILETIME to a Unix time_t. /* Convert a Windows FILETIME to a Unix time_t.
A FILETIME is the number of 100-nanosecond intervals since January 1, 1601. A FILETIME is the number of 100-nanosecond intervals since January 1, 1601.
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename utimes.c * * Filename utimes.c *
* * * *
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* 2014-06-04 JFL Added handling of UTIME_NOW and UTIME_OMIT. * * 2014-06-04 JFL Added handling of UTIME_NOW and UTIME_OMIT. *
* 2014-07-02 JFL Added support for pathnames >= 260 characters. * * 2014-07-02 JFL Added support for pathnames >= 260 characters. *
* * * *
* ?Copyright 2016 Hewlett Packard Enterprise Development LP * * Copyright 2016 Hewlett Packard Enterprise Development LP *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 * * Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/ \*****************************************************************************/
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
#define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */ #define _CRT_SECURE_NO_WARNINGS 1 /* Avoid Visual C++ security warnings */
#include <errno.h> #include <errno.h>
#include <sys/time.h> /* Must be included before any direct or indirect <windows.h> inclusion */ #include "sys/msvcTime.h" /* Must be included before any direct or indirect <windows.h> inclusion */
#include <sys/stat.h> #include "sys/msvcStat.h"
#include "msvcDebugm.h"
#include "debugm.h" #include "msvcLimits.h"
#if defined(_DEBUG) #if defined(_DEBUG)
#include <stdio.h> #include <stdio.h>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include <windows.h> #include <windows.h>
#include <io.h> /* For MSVC's _get_osfhandle() */ #include <io.h> /* For MSVC's _get_osfhandle() */
#include <unistd.h> /* For MsvcLibX's ResolveLinks() */ #include "msvcUnistd.h" /* For MsvcLibX's ResolveLinks() */
DEBUG_CODE( DEBUG_CODE(
int Timeval2String(char *buf, size_t bufsize, const struct timeval *tvp) { int Timeval2String(char *buf, size_t bufsize, const struct timeval *tvp) {
...@@ -64,7 +64,7 @@ void Filetime2Timeval(const FILETIME *pFT, struct timeval *ptv) { ...@@ -64,7 +64,7 @@ void Filetime2Timeval(const FILETIME *pFT, struct timeval *ptv) {
ULARGE_INTEGER ull; ULARGE_INTEGER ull;
ull.LowPart = pFT->dwLowDateTime; ull.LowPart = pFT->dwLowDateTime;
ull.HighPart = pFT->dwHighDateTime; ull.HighPart = pFT->dwHighDateTime;
ptv->tv_sec = ull.QuadPart / 10000000ULL - 11644473600ULL; ptv->tv_sec = (long)(ull.QuadPart / 10000000ULL - 11644473600ULL);
ptv->tv_usec = (int32_t)((ull.QuadPart % 10000000ULL)/10); ptv->tv_usec = (int32_t)((ull.QuadPart % 10000000ULL)/10);
} }
......
/*****************************************************************************\ /*****************************************************************************\
* * * *
* Filename xfreopen.c * * Filename xfreopen.c *
* * * *
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include "xfreopen.h" #include "msvcXfreopen.h"
FILE *xfreopen(const char *filename, const char *mode, FILE *stream) { FILE *xfreopen(const char *filename, const char *mode, FILE *stream) {
int iMode = 0; int iMode = 0;
......
...@@ -360,7 +360,7 @@ find_shared_library_fullname () ...@@ -360,7 +360,7 @@ find_shared_library_fullname ()
ungetc (c, fp); ungetc (c, fp);
shared_library_fullname = NULL; size = 0; shared_library_fullname = NULL; size = 0;
len = getline (&shared_library_fullname, &size, fp); len = getline(&shared_library_fullname, &size, fp);
if (len >= 0) if (len >= 0)
{ {
/* Success: filled shared_library_fullname. */ /* Success: filled shared_library_fullname. */
......
...@@ -228,6 +228,8 @@ typedef unsigned long ULONG_PTR; ...@@ -228,6 +228,8 @@ typedef unsigned long ULONG_PTR;
#include "config.h" #include "config.h"
#endif /* HAVE_PTW32_CONFIG_H */ #endif /* HAVE_PTW32_CONFIG_H */
#include "msvcTime.h"
#if !defined(NEED_FTIME) #if !defined(NEED_FTIME)
#include <time.h> #include <time.h>
#else /* NEED_FTIME */ #else /* NEED_FTIME */
......
...@@ -100,18 +100,19 @@ ...@@ -100,18 +100,19 @@
#endif #endif
#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */ #endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */
#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN) // #if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN)
# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX // # if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
/* For pid_t */ // /* For pid_t */
# include <sys/types.h> // # include <sys/types.h>
/* Required by Unix 98 */ // /* Required by Unix 98 */
# include <time.h> // # include <time.h>
# else // # else
typedef int pid_t; // typedef int pid_t;
# endif // # endif
#else // #else
typedef int pid_t; // typedef int pid_t;
#endif // #endif
#include <sys/msvcTypes.h>
/* Thread scheduling policies */ /* Thread scheduling policies */
......
...@@ -99,6 +99,8 @@ ...@@ -99,6 +99,8 @@
#endif #endif
#endif /* PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX */ #endif /* PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX */
#include "sys/msvcTypes.h"
#define _POSIX_SEMAPHORES #define _POSIX_SEMAPHORES
#if defined(__cplusplus) #if defined(__cplusplus)
......
...@@ -912,7 +912,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -912,7 +912,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pSql->cmd.msgType = TSDB_MSG_TYPE_QUERY; pSql->cmd.msgType = TSDB_MSG_TYPE_QUERY;
pQueryMsg->head.contLen = htonl(msgLen); pQueryMsg->head.contLen = htonl(msgLen);
assert(msgLen + minMsgSize() <= pCmd->allocSize); assert(msgLen + minMsgSize() <= (int32_t)pCmd->allocSize);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -426,7 +426,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) { ...@@ -426,7 +426,7 @@ TAOS_RES *taos_consume(TAOS_SUB *tsub) {
size_t size = taosArrayGetSize(pSub->progress) * sizeof(STableIdInfo); size_t size = taosArrayGetSize(pSub->progress) * sizeof(STableIdInfo);
size += sizeof(SQueryTableMsg) + 4096; size += sizeof(SQueryTableMsg) + 4096;
tscAllocPayload(&pSql->cmd, size); tscAllocPayload(&pSql->cmd, (int)size);
for (int retry = 0; retry < 3; retry++) { for (int retry = 0; retry < 3; retry++) {
tscRemoveFromSqlList(pSql); tscRemoveFromSqlList(pSql);
......
...@@ -1941,6 +1941,7 @@ int16_t tscGetJoinTagColIdByUid(STagCond* pTagCond, uint64_t uid) { ...@@ -1941,6 +1941,7 @@ int16_t tscGetJoinTagColIdByUid(STagCond* pTagCond, uint64_t uid) {
return pTagCond->joinInfo.right.tagColId; return pTagCond->joinInfo.right.tagColId;
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
......
...@@ -147,12 +147,12 @@ int32_t tsMonitorInterval = 30; // seconds ...@@ -147,12 +147,12 @@ int32_t tsMonitorInterval = 30; // seconds
// internal // internal
int32_t tscEmbedded = 0; int32_t tscEmbedded = 0;
char configDir[TSDB_FILENAME_LEN] = "/etc/taos"; char configDir[TSDB_FILENAME_LEN] = {0};
char tsVnodeDir[TSDB_FILENAME_LEN] = {0}; char tsVnodeDir[TSDB_FILENAME_LEN] = {0};
char tsDnodeDir[TSDB_FILENAME_LEN] = {0}; char tsDnodeDir[TSDB_FILENAME_LEN] = {0};
char tsMnodeDir[TSDB_FILENAME_LEN] = {0}; char tsMnodeDir[TSDB_FILENAME_LEN] = {0};
char tsDataDir[TSDB_FILENAME_LEN] = "/var/lib/taos"; char tsDataDir[TSDB_FILENAME_LEN] = {0};
char tsScriptDir[TSDB_FILENAME_LEN] = "/etc/taos"; char tsScriptDir[TSDB_FILENAME_LEN] = {0};
char tsVnodeBakDir[TSDB_FILENAME_LEN] = {0}; char tsVnodeBakDir[TSDB_FILENAME_LEN] = {0};
/* /*
...@@ -295,6 +295,7 @@ bool taosCfgDynamicOptions(char *msg) { ...@@ -295,6 +295,7 @@ bool taosCfgDynamicOptions(char *msg) {
} }
static void doInitGlobalConfig(void) { static void doInitGlobalConfig(void) {
osInit();
SGlobalCfg cfg = {0}; SGlobalCfg cfg = {0};
// ip address // ip address
......
...@@ -62,7 +62,7 @@ void printHelp() { ...@@ -62,7 +62,7 @@ void printHelp() {
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
void shellParseArgument(int argc, char *argv[], struct arguments *arguments) { void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
wordexp_t full_path; wordexp_t full_path;
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
// for host // for host
......
...@@ -577,7 +577,7 @@ static int verticalPrintResult(TAOS_RES* tres) { ...@@ -577,7 +577,7 @@ static int verticalPrintResult(TAOS_RES* tres) {
int maxColNameLen = 0; int maxColNameLen = 0;
for (int col = 0; col < num_fields; col++) { for (int col = 0; col < num_fields; col++) {
int len = strlen(fields[col].name); int len = (int)strlen(fields[col].name);
if (len > maxColNameLen) { if (len > maxColNameLen) {
maxColNameLen = len; maxColNameLen = len;
} }
...@@ -604,9 +604,8 @@ static int verticalPrintResult(TAOS_RES* tres) { ...@@ -604,9 +604,8 @@ static int verticalPrintResult(TAOS_RES* tres) {
return numOfRows; return numOfRows;
} }
static int calcColWidth(TAOS_FIELD* field, int precision) { static int calcColWidth(TAOS_FIELD* field, int precision) {
int width = strlen(field->name); int width = (int)strlen(field->name);
switch (field->type) { switch (field->type) {
case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_BOOL:
...@@ -741,7 +740,7 @@ void read_history() { ...@@ -741,7 +740,7 @@ void read_history() {
return; return;
} }
while ((read_size = getline(&line, &line_size, f)) != -1) { while ((read_size = taosGetline(&line, &line_size, f)) != -1) {
line[read_size - 1] = '\0'; line[read_size - 1] = '\0';
history.hist[history.hend] = strdup(line); history.hist[history.hend] = strdup(line);
...@@ -822,7 +821,7 @@ void source_file(TAOS *con, char *fptr) { ...@@ -822,7 +821,7 @@ void source_file(TAOS *con, char *fptr) {
return; return;
} }
while ((read_len = getline(&line, &line_len, f)) != -1) { while ((read_len = taosGetline(&line, &line_len, f)) != -1) {
if (read_len >= tsMaxSQLStringLen) continue; if (read_len >= tsMaxSQLStringLen) continue;
line[--read_len] = '\0'; line[--read_len] = '\0';
......
...@@ -9,12 +9,16 @@ ...@@ -9,12 +9,16 @@
* *
* ****************************************************************/ * ****************************************************************/
#include "shell.h"
#include <assert.h> #include <assert.h>
#include <regex.h> #include <regex.h>
#include <stdio.h> #include <stdio.h>
#include "os.h"
#include "shell.h"
#include "taos.h"
#include "shellCommand.h" #include "shellCommand.h"
extern char configDir[];
void printHelp() { void printHelp() {
char indent[10] = " "; char indent[10] = " ";
printf("taos shell is used to test the TDEngine database\n"); printf("taos shell is used to test the TDEngine database\n");
...@@ -43,7 +47,7 @@ void printHelp() { ...@@ -43,7 +47,7 @@ void printHelp() {
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
void shellParseArgument(int argc, char *argv[], struct arguments *arguments) { void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
// for host // for host
if (strcmp(argv[i], "-h") == 0) { if (strcmp(argv[i], "-h") == 0) {
...@@ -81,7 +85,7 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) { ...@@ -81,7 +85,7 @@ void shellParseArgument(int argc, char *argv[], struct arguments *arguments) {
fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1); fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
strcpy(configDir, argv[i]); strcpy(configDir, argv[++i]);
} else { } else {
fprintf(stderr, "Option -c requires an argument\n"); fprintf(stderr, "Option -c requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
...@@ -13,5 +13,8 @@ IF (TD_LINUX) ...@@ -13,5 +13,8 @@ IF (TD_LINUX)
# ELSE () # ELSE ()
# TARGET_LINK_LIBRARIES(taosdemo taos_static) # TARGET_LINK_LIBRARIES(taosdemo taos_static)
# ENDIF () # ENDIF ()
ELSEIF (TD_WINDOWS)
AUX_SOURCE_DIRECTORY(. SRC)
ADD_EXECUTABLE(taosdemo ${SRC})
TARGET_LINK_LIBRARIES(taosdemo taos_static)
ENDIF () ENDIF ()
/* /*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com> * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
* *
* This program is free software: you can use, redistribute, and/or modify * This program is free software: you can use, redistribute, and/or modify
...@@ -15,24 +15,31 @@ ...@@ -15,24 +15,31 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <argp.h> #ifdef LINUX
#include <assert.h> #include "os.h"
#include <inttypes.h> #include <argp.h>
#include <assert.h>
#ifndef _ALPINE #include <inttypes.h>
#include <error.h> #ifndef _ALPINE
#include <error.h>
#endif
#include <pthread.h>
#include <semaphore.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <wordexp.h>
#include <regex.h>
#else
#include <assert.h>
#include <regex.h>
#include <stdio.h>
#include "os.h"
#endif #endif
#include <pthread.h>
#include <semaphore.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <wordexp.h>
#include <regex.h>
#include "taos.h" #include "taos.h"
#include "tutil.h" #include "tutil.h"
...@@ -48,32 +55,6 @@ extern char configDir[]; ...@@ -48,32 +55,6 @@ extern char configDir[];
#define STRING_LEN 60000 #define STRING_LEN 60000
#define MAX_PREPARED_RAND 1000000 #define MAX_PREPARED_RAND 1000000
/* The options we understand. */
static struct argp_option options[] = {
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
{0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1},
{0, 'u', "user", 0, "The TDEngine user name to use when connecting to the server. Default is 'root'.", 2},
{0, 'P', "password", 0, "The password to use when connecting to the server. Default is 'taosdata'.", 3},
{0, 'd', "database", 0, "Destination database. Default is 'test'.", 3},
{0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3},
{0, 's', "sql file", 0, "The select sql file.", 3},
{0, 'M', 0, 0, "Use metric flag.", 13},
{0, 'o', "outputfile", 0, "Direct output to the named file. Default is './output.txt'.", 14},
{0, 'q', "query_mode", 0, "Query mode--0: SYNC, 1: ASYNC. Default is SYNC.", 6},
{0, 'b', "type_of_cols", 0, "The data_type of columns: 'INT', 'TINYINT', 'SMALLINT', 'BIGINT', 'FLOAT', 'DOUBLE', 'BINARY'. Default is 'INT'.", 7},
{0, 'w', "length_of_binary", 0, "The length of data_type 'BINARY'. Only applicable when type of cols is 'BINARY'. Default is 8", 8},
{0, 'l', "num_of_cols_per_record", 0, "The number of columns per record. Default is 3.", 8},
{0, 'T', "num_of_threads", 0, "The number of threads. Default is 10.", 9},
{0, 'r', "num_of_records_per_req", 0, "The number of records per request. Default is 1000.", 10},
{0, 't', "num_of_tables", 0, "The number of tables. Default is 10000.", 11},
{0, 'n', "num_of_records_per_table", 0, "The number of records per table. Default is 100000.", 12},
{0, 'c', "config_directory", 0, "Configuration directory. Default is '/etc/taos/'.", 14},
{0, 'x', 0, 0, "Insert only flag.", 13},
{0, 'O', "order", 0, "Insert mode--0: In order, 1: Out of order. Default is in order.", 14},
{0, 'R', "rate", 0, "Out of order data's rate--if order=1 Default 10, min: 0, max: 50.", 14},
{0, 'D', "delete table", 0, "Delete data methods——0: don't delete, 1: delete by table, 2: delete by stable, 3: delete by database", 14},
{0}};
/* Used by main to communicate with parse_opt. */ /* Used by main to communicate with parse_opt. */
typedef struct DemoArguments { typedef struct DemoArguments {
char *host; char *host;
...@@ -101,8 +82,35 @@ typedef struct DemoArguments { ...@@ -101,8 +82,35 @@ typedef struct DemoArguments {
char **arg_list; char **arg_list;
} SDemoArguments; } SDemoArguments;
/* Parse a single option. */ #ifdef LINUX
static error_t parse_opt(int key, char *arg, struct argp_state *state) { /* The options we understand. */
static struct argp_option options[] = {
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
{0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1},
{0, 'u', "user", 0, "The TDEngine user name to use when connecting to the server. Default is 'root'.", 2},
{0, 'P', "password", 0, "The password to use when connecting to the server. Default is 'taosdata'.", 3},
{0, 'd', "database", 0, "Destination database. Default is 'test'.", 3},
{0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3},
{0, 's', "sql file", 0, "The select sql file.", 3},
{0, 'M', 0, 0, "Use metric flag.", 13},
{0, 'o', "outputfile", 0, "Direct output to the named file. Default is './output.txt'.", 14},
{0, 'q', "query_mode", 0, "Query mode--0: SYNC, 1: ASYNC. Default is SYNC.", 6},
{0, 'b', "type_of_cols", 0, "The data_type of columns: 'INT', 'TINYINT', 'SMALLINT', 'BIGINT', 'FLOAT', 'DOUBLE', 'BINARY'. Default is 'INT'.", 7},
{0, 'w', "length_of_binary", 0, "The length of data_type 'BINARY'. Only applicable when type of cols is 'BINARY'. Default is 8", 8},
{0, 'l', "num_of_cols_per_record", 0, "The number of columns per record. Default is 3.", 8},
{0, 'T', "num_of_threads", 0, "The number of threads. Default is 10.", 9},
{0, 'r', "num_of_records_per_req", 0, "The number of records per request. Default is 1000.", 10},
{0, 't', "num_of_tables", 0, "The number of tables. Default is 10000.", 11},
{0, 'n', "num_of_records_per_table", 0, "The number of records per table. Default is 100000.", 12},
{0, 'c', "config_directory", 0, "Configuration directory. Default is '/etc/taos/'.", 14},
{0, 'x', 0, 0, "Insert only flag.", 13},
{0, 'O', "order", 0, "Insert mode--0: In order, 1: Out of order. Default is in order.", 14},
{0, 'R', "rate", 0, "Out of order data's rate--if order=1 Default 10, min: 0, max: 50.", 14},
{0, 'D', "delete table", 0, "Delete data methods——0: don't delete, 1: delete by table, 2: delete by stable, 3: delete by database", 14},
{0}};
/* Parse a single option. */
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
/* Get the input argument from argp_parse, which we /* Get the input argument from argp_parse, which we
know is a pointer to our arguments structure. */ know is a pointer to our arguments structure. */
SDemoArguments *arguments = state->input; SDemoArguments *arguments = state->input;
...@@ -237,7 +245,174 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -237,7 +245,174 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
return ARGP_ERR_UNKNOWN; return ARGP_ERR_UNKNOWN;
} }
return 0; return 0;
} }
static struct argp argp = {options, parse_opt, 0, 0};
void parse_args(int argc, char *argv[], SDemoArguments *arguments) {
argp_parse(&argp, argc, argv, 0, 0, &arguments);
if (arguments->abort) {
#ifndef _ALPINE
error(10, 0, "ABORTED");
#else
abort();
#endif
}
}
#else
void printHelp() {
char indent[10] = " ";
printf("%s%s\n", indent, "-h");
printf("%s%s%s\n", indent, indent, "host, The host to connect to TDEngine. Default is localhost.");
printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "port, The TCP/IP port number to use for the connection. Default is 0.");
printf("%s%s\n", indent, "-u");
printf("%s%s%s\n", indent, indent, "user, The TDEngine user name to use when connecting to the server. Default is 'root'.");
printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "password, The password to use when connecting to the server. Default is 'taosdata'.");
printf("%s%s\n", indent, "-d");
printf("%s%s%s\n", indent, indent, "database, Destination database. Default is 'test'.");
printf("%s%s\n", indent, "-m");
printf("%s%s%s\n", indent, indent, "table_prefix, Table prefix name. Default is 't'.");
printf("%s%s\n", indent, "-s");
printf("%s%s%s\n", indent, indent, "sql file, The select sql file.");
printf("%s%s\n", indent, "-M");
printf("%s%s%s\n", indent, indent, "meteric, Use metric flag.");
printf("%s%s\n", indent, "-o");
printf("%s%s%s\n", indent, indent, "outputfile, Direct output to the named file. Default is './output.txt'.");
printf("%s%s\n", indent, "-q");
printf("%s%s%s\n", indent, indent, "query_mode, Query mode--0: SYNC, 1: ASYNC. Default is SYNC.");
printf("%s%s\n", indent, "-b");
printf("%s%s%s\n", indent, indent, "type_of_cols, data_type of columns: 'INT', 'TINYINT', 'SMALLINT', 'BIGINT', 'FLOAT', 'DOUBLE', 'BINARY'. Default is 'INT'.");
printf("%s%s\n", indent, "-w");
printf("%s%s%s\n", indent, indent, "length_of_binary, The length of data_type 'BINARY'. Only applicable when type of cols is 'BINARY'. Default is 8");
printf("%s%s\n", indent, "-l");
printf("%s%s%s\n", indent, indent, "num_of_cols_per_record, The number of columns per record. Default is 3.");
printf("%s%s\n", indent, "-T");
printf("%s%s%s\n", indent, indent, "num_of_threads, The number of threads. Default is 10.");
printf("%s%s\n", indent, "-r");
printf("%s%s%s\n", indent, indent, "num_of_records_per_req, The number of records per request. Default is 1000.");
printf("%s%s\n", indent, "-t");
printf("%s%s%s\n", indent, indent, "num_of_tables, The number of tables. Default is 10000.");
printf("%s%s\n", indent, "-n");
printf("%s%s%s\n", indent, indent, "num_of_records_per_table, The number of records per table. Default is 100000.");
printf("%s%s\n", indent, "-c");
printf("%s%s%s\n", indent, indent, "config_directory, Configuration directory. Default is '/etc/taos/'.");
printf("%s%s\n", indent, "-x");
printf("%s%s%s\n", indent, indent, "flag, Insert only flag.");
printf("%s%s\n", indent, "-O");
printf("%s%s%s\n", indent, indent, "order, Insert mode--0: In order, 1: Out of order. Default is in order.");
printf("%s%s\n", indent, "-R");
printf("%s%s%s\n", indent, indent, "rate, Out of order data's rate--if order=1 Default 10, min: 0, max: 50.");
printf("%s%s\n", indent, "-D");
printf("%s%s%s\n", indent, indent, "Delete data methods——0: don't delete, 1: delete by table, 2: delete by stable, 3: delete by database.");
}
void parse_args(int argc, char *argv[], SDemoArguments *arguments) {
char **sptr;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-h") == 0) {
arguments->host = argv[++i];
} else if (strcmp(argv[i], "-p") == 0) {
arguments->port = atoi(argv[++i]);
} else if (strcmp(argv[i], "-u") == 0) {
arguments->user = argv[++i];
} else if (strcmp(argv[i], "-P") == 0) {
arguments->password = argv[++i];
} else if (strcmp(argv[i], "-o") == 0) {
arguments->output_file = argv[++i];
} else if (strcmp(argv[i], "-s") == 0) {
arguments->sqlFile = argv[++i];
} else if (strcmp(argv[i], "-q") == 0) {
arguments->mode = atoi(argv[++i]);
} else if (strcmp(argv[i], "-T") == 0) {
arguments->num_of_threads = atoi(argv[++i]);
} else if (strcmp(argv[i], "-r") == 0) {
arguments->num_of_RPR = atoi(argv[++i]);
} else if (strcmp(argv[i], "-t") == 0) {
arguments->num_of_tables = atoi(argv[++i]);
} else if (strcmp(argv[i], "-n") == 0) {
arguments->num_of_DPT = atoi(argv[++i]);
} else if (strcmp(argv[i], "-d") == 0) {
arguments->database = argv[++i];
} else if (strcmp(argv[i], "-l") == 0) {
arguments->num_of_CPR = atoi(argv[++i]);
} else if (strcmp(argv[i], "-b") == 0) {
sptr = arguments->datatype;
++i;
if (strstr(argv[i], ",") == NULL) {
if (strcasecmp(argv[i], "INT") != 0 && strcasecmp(argv[i], "FLOAT") != 0 &&
strcasecmp(argv[i], "TINYINT") != 0 && strcasecmp(argv[i], "BOOL") != 0 &&
strcasecmp(argv[i], "SMALLINT") != 0 &&
strcasecmp(argv[i], "BIGINT") != 0 && strcasecmp(argv[i], "DOUBLE") != 0 &&
strcasecmp(argv[i], "BINARY") && strcasecmp(argv[i], "NCHAR")) {
fprintf(stderr, "Invalid data_type!\n");
printHelp();
exit(EXIT_FAILURE);
}
sptr[0] = argv[i];
} else {
int index = 0;
char *dupstr = strdup(argv[i]);
char *running = dupstr;
char *token = strsep(&running, ",");
while (token != NULL) {
if (strcasecmp(token, "INT") != 0 &&
strcasecmp(token, "FLOAT") != 0 &&
strcasecmp(token, "TINYINT") != 0 &&
strcasecmp(token, "BOOL") != 0 &&
strcasecmp(token, "SMALLINT") != 0 &&
strcasecmp(token, "BIGINT") != 0 &&
strcasecmp(token, "DOUBLE") != 0 && strcasecmp(token, "BINARY") && strcasecmp(token, "NCHAR")) {
fprintf(stderr, "Invalid data_type!\n");
printHelp();
exit(EXIT_FAILURE);
}
sptr[index++] = token;
token = strsep(&running, ",");
if (index >= MAX_NUM_DATATYPE) break;
}
}
} else if (strcmp(argv[i], "-w") == 0) {
arguments->len_of_binary = atoi(argv[++i]);
} else if (strcmp(argv[i], "-m") == 0) {
arguments->tb_prefix = argv[++i];
} else if (strcmp(argv[i], "-M") == 0) {
arguments->use_metric = false;
} else if (strcmp(argv[i], "-x") == 0) {
arguments->insert_only = false;
} else if (strcmp(argv[i], "-c") == 0) {
strcpy(configDir, argv[++i]);
} else if (strcmp(argv[i], "-O") == 0) {
arguments->order = atoi(argv[++i]);
if (arguments->order > 1 || arguments->order < 0) {
arguments->order = 0;
} else if (arguments->order == 1) {
arguments->rate = 10;
}
} else if (strcmp(argv[i], "-R") == 0) {
arguments->rate = atoi(argv[++i]);
if (arguments->order == 1 && (arguments->rate > 50 || arguments->rate <= 0)) {
arguments->rate = 10;
}
} else if (strcmp(argv[i], "-D") == 0) {
arguments->method_of_delete = atoi(argv[++i]);
if (arguments->method_of_delete < 0 || arguments->method_of_delete > 3) {
arguments->method_of_delete = 0;
}
} else if (strcmp(argv[i], "--help") == 0) {
printHelp();
exit(EXIT_FAILURE);
} else {
fprintf(stderr, "wrong options\n");
printHelp();
exit(EXIT_FAILURE);
}
}
}
#endif
/* ******************************* Structure /* ******************************* Structure
* definition******************************* */ * definition******************************* */
...@@ -293,9 +468,6 @@ typedef struct { ...@@ -293,9 +468,6 @@ typedef struct {
* variables******************************* */ * variables******************************* */
char *aggreFunc[] = {"*", "count(*)", "avg(f1)", "sum(f1)", "max(f1)", "min(f1)", "first(f1)", "last(f1)"}; char *aggreFunc[] = {"*", "count(*)", "avg(f1)", "sum(f1)", "max(f1)", "min(f1)", "first(f1)", "last(f1)"};
/* ******************************* Global
* functions******************************* */
static struct argp argp = {options, parse_opt, 0, 0};
void queryDB(TAOS *taos, char *command); void queryDB(TAOS *taos, char *command);
...@@ -368,15 +540,7 @@ int main(int argc, char *argv[]) { ...@@ -368,15 +540,7 @@ int main(int argc, char *argv[]) {
arguments.insert_only = true; arguments.insert_only = true;
// end change // end change
argp_parse(&argp, argc, argv, 0, 0, &arguments); parse_args(argc, argv, &arguments);
if (arguments.abort) {
#ifndef _ALPINE
error(10, 0, "ABORTED");
#else
abort();
#endif
}
enum MODE query_mode = arguments.mode; enum MODE query_mode = arguments.mode;
char *ip_addr = arguments.host; char *ip_addr = arguments.host;
...@@ -438,7 +602,7 @@ int main(int argc, char *argv[]) { ...@@ -438,7 +602,7 @@ int main(int argc, char *argv[]) {
printf("# Use metric: %s\n", use_metric ? "true" : "false"); printf("# Use metric: %s\n", use_metric ? "true" : "false");
printf("# Datatype of Columns: %s\n", dataString); printf("# Datatype of Columns: %s\n", dataString);
printf("# Binary Length(If applicable): %d\n", printf("# Binary Length(If applicable): %d\n",
(strcasestr(dataString, "BINARY") != NULL || strcasestr(dataString, "NCHAR") != NULL ) ? len_of_binary : -1); (strncasecmp(dataString, "BINARY", 6) == 0 || strncasecmp(dataString, "NCHAR", 5) == 0) ? len_of_binary : -1);
printf("# Number of Columns per record: %d\n", ncols_per_record); printf("# Number of Columns per record: %d\n", ncols_per_record);
printf("# Number of Threads: %d\n", threads); printf("# Number of Threads: %d\n", threads);
printf("# Number of Tables: %d\n", ntables); printf("# Number of Tables: %d\n", ntables);
...@@ -466,7 +630,7 @@ int main(int argc, char *argv[]) { ...@@ -466,7 +630,7 @@ int main(int argc, char *argv[]) {
fprintf(fp, "# Use metric: %s\n", use_metric ? "true" : "false"); fprintf(fp, "# Use metric: %s\n", use_metric ? "true" : "false");
fprintf(fp, "# Datatype of Columns: %s\n", dataString); fprintf(fp, "# Datatype of Columns: %s\n", dataString);
fprintf(fp, "# Binary Length(If applicable): %d\n", fprintf(fp, "# Binary Length(If applicable): %d\n",
(strcasestr(dataString, "BINARY") != NULL || strcasestr(dataString, "NCHAR") != NULL ) ? len_of_binary : -1); (strncasecmp(dataString, "BINARY", 6) == 0 || strncasecmp(dataString, "NCHAR", 5) == 0) ? len_of_binary : -1);
fprintf(fp, "# Number of Columns per record: %d\n", ncols_per_record); fprintf(fp, "# Number of Columns per record: %d\n", ncols_per_record);
fprintf(fp, "# Number of Threads: %d\n", threads); fprintf(fp, "# Number of Threads: %d\n", threads);
fprintf(fp, "# Number of Tables: %d\n", ntables); fprintf(fp, "# Number of Tables: %d\n", ntables);
...@@ -753,7 +917,7 @@ void querySqlFile(TAOS* taos, char* sqlFile) ...@@ -753,7 +917,7 @@ void querySqlFile(TAOS* taos, char* sqlFile)
double t = getCurrentTime(); double t = getCurrentTime();
while ((read_len = getline(&line, &line_len, fp)) != -1) { while ((read_len = taosGetline(&line, &line_len, fp)) != -1) {
if (read_len >= MAX_SQL_SIZE) continue; if (read_len >= MAX_SQL_SIZE) continue;
line[--read_len] = '\0'; line[--read_len] = '\0';
...@@ -1035,7 +1199,7 @@ void *syncWrite(void *sarg) { ...@@ -1035,7 +1199,7 @@ void *syncWrite(void *sarg) {
char **data_type = winfo->datatype; char **data_type = winfo->datatype;
int len_of_binary = winfo->len_of_binary; int len_of_binary = winfo->len_of_binary;
int ncols_per_record = winfo->ncols_per_record; int ncols_per_record = winfo->ncols_per_record;
srand(time(NULL)); srand((uint32_t)time(NULL));
int64_t time_counter = winfo->start_time; int64_t time_counter = winfo->start_time;
for (int i = 0; i < winfo->nrecords_per_table;) { for (int i = 0; i < winfo->nrecords_per_table;) {
for (int tID = winfo->start_table_id; tID <= winfo->end_table_id; tID++) { for (int tID = winfo->start_table_id; tID <= winfo->end_table_id; tID++) {
...@@ -1049,7 +1213,7 @@ void *syncWrite(void *sarg) { ...@@ -1049,7 +1213,7 @@ void *syncWrite(void *sarg) {
int rand_num = rand() % 100; int rand_num = rand() % 100;
int len = -1; int len = -1;
if (winfo->data_of_order ==1 && rand_num < winfo->data_of_rate) { if (winfo->data_of_order ==1 && rand_num < winfo->data_of_rate) {
long d = tmp_time - rand() % 1000000 + rand_num; int64_t d = tmp_time - rand() % 1000000 + rand_num;
len = generateData(data, data_type, ncols_per_record, d, len_of_binary); len = generateData(data, data_type, ncols_per_record, d, len_of_binary);
} else { } else {
len = generateData(data, data_type, ncols_per_record, tmp_time += 1000, len_of_binary); len = generateData(data, data_type, ncols_per_record, tmp_time += 1000, len_of_binary);
...@@ -1144,7 +1308,7 @@ void callBack(void *param, TAOS_RES *res, int code) { ...@@ -1144,7 +1308,7 @@ void callBack(void *param, TAOS_RES *res, int code) {
int rand_num = rand() % 100; int rand_num = rand() % 100;
if (tb_info->data_of_order ==1 && rand_num < tb_info->data_of_rate) if (tb_info->data_of_order ==1 && rand_num < tb_info->data_of_rate)
{ {
long d = tmp_time - rand() % 1000000 + rand_num; int64_t d = tmp_time - rand() % 1000000 + rand_num;
generateData(data, datatype, ncols_per_record, d, len_of_binary); generateData(data, datatype, ncols_per_record, d, len_of_binary);
} else } else
{ {
...@@ -1269,13 +1433,15 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times ...@@ -1269,13 +1433,15 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
bool b = rand() & 1; bool b = rand() & 1;
pstr += sprintf(pstr, ", %s", b ? "true" : "false"); pstr += sprintf(pstr, ", %s", b ? "true" : "false");
} else if (strcasecmp(data_type[i % c], "binary") == 0) { } else if (strcasecmp(data_type[i % c], "binary") == 0) {
char s[len_of_binary]; char *s = malloc(len_of_binary);
rand_string(s, len_of_binary); rand_string(s, len_of_binary);
pstr += sprintf(pstr, ", \"%s\"", s); pstr += sprintf(pstr, ", \"%s\"", s);
free(s);
}else if (strcasecmp(data_type[i % c], "nchar") == 0) { }else if (strcasecmp(data_type[i % c], "nchar") == 0) {
char s[len_of_binary]; char *s = malloc(len_of_binary);
rand_string(s, len_of_binary); rand_string(s, len_of_binary);
pstr += sprintf(pstr, ", \"%s\"", s); pstr += sprintf(pstr, ", \"%s\"", s);
free(s);
} }
if (pstr - res > MAX_DATA_SIZE) { if (pstr - res > MAX_DATA_SIZE) {
...@@ -1286,7 +1452,7 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times ...@@ -1286,7 +1452,7 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
pstr += sprintf(pstr, ")"); pstr += sprintf(pstr, ")");
return pstr - res; return (int32_t)(pstr - res);
} }
static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567890"; static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJK1234567890";
......
...@@ -56,18 +56,6 @@ int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstP ...@@ -56,18 +56,6 @@ int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstP
// TAOS_OS_FUNC_FILE_GETTMPFILEPATH // TAOS_OS_FUNC_FILE_GETTMPFILEPATH
void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath); void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath);
#ifdef TAOS_OS_FUNC_FILE_ISDIR
#define S_ISDIR(m) (((m) & 0170000) == (0040000))
#endif
#ifdef TAOS_OS_FUNC_FILE_ISREG
#define S_ISREG(m) !(S_ISDIR(m))
#endif
#ifdef TAOS_OS_FUNC_FILE_ISLNK
#define S_ISLNK(m) 0
#endif
#ifndef TAOS_OS_FUNC_FILE_FTRUNCATE #ifndef TAOS_OS_FUNC_FILE_FTRUNCATE
#define taosFtruncate ftruncate #define taosFtruncate ftruncate
#endif #endif
......
...@@ -35,6 +35,10 @@ extern "C" { ...@@ -35,6 +35,10 @@ extern "C" {
typedef int SOCKET; typedef int SOCKET;
#endif #endif
#ifndef TAOS_OS_DEF_EPOLL
#define TAOS_EPOLL_WAIT_TIME -1
#endif
#define taosClose(x) taosCloseSocket(x) #define taosClose(x) taosCloseSocket(x)
#ifdef TAOS_RANDOM_NETWORK_FAIL #ifdef TAOS_RANDOM_NETWORK_FAIL
......
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <direct.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h>
#include <float.h> #include <float.h>
#include <locale.h> #include <locale.h>
#include <intrin.h> #include <intrin.h>
...@@ -35,15 +33,18 @@ ...@@ -35,15 +33,18 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <inttypes.h>
#include "winsock2.h" #include "winsock2.h"
#include <WS2tcpip.h> #include <WS2tcpip.h>
#include <winbase.h> #include <winbase.h>
#include <Winsock2.h> #include <Winsock2.h>
#include <process.h> #include <time.h>
#include <inttypes.h>
#include "msvcProcess.h"
#include "msvcDirect.h"
#include "msvcFcntl.h"
#include "msvcStdio.h"
#include "sys/msvcStat.h"
#include "sys/msvcTypes.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -93,6 +94,9 @@ extern "C" { ...@@ -93,6 +94,9 @@ extern "C" {
typedef SOCKET eventfd_t; typedef SOCKET eventfd_t;
#define eventfd(a, b) -1 #define eventfd(a, b) -1
#define TAOS_OS_DEF_EPOLL
#define TAOS_EPOLL_WAIT_TIME 100
#define TAOS_OS_FUNC_STRING_WCHAR #define TAOS_OS_FUNC_STRING_WCHAR
int twcslen(const wchar_t *wcs); int twcslen(const wchar_t *wcs);
#define TAOS_OS_FUNC_STRING_GETLINE #define TAOS_OS_FUNC_STRING_GETLINE
...@@ -126,7 +130,6 @@ char *stpncpy (char *dest, const char *src, size_t n); ...@@ -126,7 +130,6 @@ char *stpncpy (char *dest, const char *src, size_t n);
typedef int (*__compar_fn_t)(const void *, const void *); typedef int (*__compar_fn_t)(const void *, const void *);
#define ssize_t int #define ssize_t int
#define bzero(ptr, size) memset((ptr), 0, (size)) #define bzero(ptr, size) memset((ptr), 0, (size))
#define mkdir(pathname, mode) _mkdir(pathname)
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define wcsncasecmp _wcsnicmp #define wcsncasecmp _wcsnicmp
...@@ -138,7 +141,6 @@ typedef int (*__compar_fn_t)(const void *, const void *); ...@@ -138,7 +141,6 @@ typedef int (*__compar_fn_t)(const void *, const void *);
#define twrite write #define twrite write
#define getpid _getpid #define getpid _getpid
int gettimeofday(struct timeval *tv, struct timezone *tz);
struct tm *localtime_r(const time_t *timep, struct tm *result); struct tm *localtime_r(const time_t *timep, struct tm *result);
char * strptime(const char *buf, const char *fmt, struct tm *tm); char * strptime(const char *buf, const char *fmt, struct tm *tm);
char * strsep(char **stringp, const char *delim); char * strsep(char **stringp, const char *delim);
...@@ -146,11 +148,8 @@ char * getpass(const char *prefix); ...@@ -146,11 +148,8 @@ char * getpass(const char *prefix);
int flock(int fd, int option); int flock(int fd, int option);
int fsync(int filedes); int fsync(int filedes);
char * strndup(const char *s, size_t n); char * strndup(const char *s, size_t n);
char * dirname(char *pszPathname);
// for function open in stat.h int gettimeofday(struct timeval *ptv, void *pTimeZone);
#define S_IRWXU _S_IREAD
#define S_IRWXG _S_IWRITE
#define S_IRWXO _S_IWRITE
// for access function in io.h // for access function in io.h
#define F_OK 00 //Existence only #define F_OK 00 //Existence only
......
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
#include "tglobal.h" #include "tglobal.h"
void osInit() { void osInit() {
if (configDir[0] == 0) {
strcpy(configDir, "/etc/taos"); strcpy(configDir, "/etc/taos");
}
strcpy(tsVnodeDir, ""); strcpy(tsVnodeDir, "");
strcpy(tsDnodeDir, ""); strcpy(tsDnodeDir, "");
strcpy(tsMnodeDir, ""); strcpy(tsMnodeDir, "");
......
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
#include "tglobal.h" #include "tglobal.h"
void osInit() { void osInit() {
if (configDir[0] == 0) {
strcpy(configDir, "~/TDengine/cfg"); strcpy(configDir, "~/TDengine/cfg");
}
strcpy(tsVnodeDir, ""); strcpy(tsVnodeDir, "");
strcpy(tsDnodeDir, ""); strcpy(tsDnodeDir, "");
strcpy(tsMnodeDir, ""); strcpy(tsMnodeDir, "");
......
...@@ -18,7 +18,10 @@ ...@@ -18,7 +18,10 @@
#include "tglobal.h" #include "tglobal.h"
void osInit() { void osInit() {
if (configDir[0] == 0) {
strcpy(configDir, "/etc/taos"); strcpy(configDir, "/etc/taos");
}
strcpy(tsVnodeDir, ""); strcpy(tsVnodeDir, "");
strcpy(tsDnodeDir, ""); strcpy(tsDnodeDir, "");
strcpy(tsMnodeDir, ""); strcpy(tsMnodeDir, "");
......
...@@ -4,4 +4,4 @@ PROJECT(TDengine) ...@@ -4,4 +4,4 @@ PROJECT(TDengine)
AUX_SOURCE_DIRECTORY(. SRC) AUX_SOURCE_DIRECTORY(. SRC)
ADD_LIBRARY(os ${SRC}) ADD_LIBRARY(os ${SRC})
TARGET_LINK_LIBRARIES(os winmm IPHLPAPI ws2_32) TARGET_LINK_LIBRARIES(os winmm IPHLPAPI ws2_32 MsvcLibXw64)
...@@ -18,8 +18,13 @@ ...@@ -18,8 +18,13 @@
#include "tglobal.h" #include "tglobal.h"
#include "tulog.h" #include "tulog.h"
extern void taosWinSocketInit();
void osInit() { void osInit() {
strcpy(configDir, "C:/TDengine/cfg"); if (configDir[0] == 0) {
strcpy(configDir, "~/TDengine/cfg");
}
strcpy(tsVnodeDir, "C:/TDengine/data"); strcpy(tsVnodeDir, "C:/TDengine/data");
strcpy(tsDnodeDir, ""); strcpy(tsDnodeDir, "");
strcpy(tsMnodeDir, ""); strcpy(tsMnodeDir, "");
...@@ -27,4 +32,5 @@ void osInit() { ...@@ -27,4 +32,5 @@ void osInit() {
strcpy(tsLogDir, "C:/TDengine/log"); strcpy(tsLogDir, "C:/TDengine/log");
strcpy(tsScriptDir, "C:/TDengine/script"); strcpy(tsScriptDir, "C:/TDengine/script");
strcpy(tsOsName, "Windows"); strcpy(tsOsName, "Windows");
taosWinSocketInit();
} }
\ No newline at end of file
...@@ -38,6 +38,7 @@ static void httpStopThread(HttpThread* pThread) { ...@@ -38,6 +38,7 @@ static void httpStopThread(HttpThread* pThread) {
eventfd_t fd = eventfd(1, 0); eventfd_t fd = eventfd(1, 0);
if (fd == -1) { if (fd == -1) {
httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno));
pThread->stop = true;
pthread_cancel(pThread->thread); pthread_cancel(pThread->thread);
} else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { } else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno)); httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno));
......
...@@ -13,5 +13,5 @@ IF (TD_LINUX) ...@@ -13,5 +13,5 @@ IF (TD_LINUX)
TARGET_LINK_LIBRARIES(query tsdb tutil m rt) TARGET_LINK_LIBRARIES(query tsdb tutil m rt)
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tests)
ELSEIF (TD_WINDOWS) ELSEIF (TD_WINDOWS)
TARGET_LINK_LIBRARIES(query tutil) TARGET_LINK_LIBRARIES(query tsdb tutil)
ENDIF () ENDIF ()
...@@ -174,6 +174,7 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) { ...@@ -174,6 +174,7 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
if (fd == -1) { if (fd == -1) {
// failed to create eventfd, call pthread_cancel instead, which may result in data corruption: // failed to create eventfd, call pthread_cancel instead, which may result in data corruption:
tError("%s, failed to create eventfd(%s)", pThreadObj->label, strerror(errno)); tError("%s, failed to create eventfd(%s)", pThreadObj->label, strerror(errno));
pThreadObj->stop = true;
pthread_cancel(pThreadObj->thread); pthread_cancel(pThreadObj->thread);
} else if (epoll_ctl(pThreadObj->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { } else if (epoll_ctl(pThreadObj->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
// failed to call epoll_ctl, call pthread_cancel instead, which may result in data corruption: // failed to call epoll_ctl, call pthread_cancel instead, which may result in data corruption:
...@@ -464,7 +465,7 @@ static void *taosProcessTcpData(void *param) { ...@@ -464,7 +465,7 @@ static void *taosProcessTcpData(void *param) {
SRecvInfo recvInfo; SRecvInfo recvInfo;
while (1) { while (1) {
int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, -1); int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, TAOS_EPOLL_WAIT_TIME);
if (pThreadObj->stop) { if (pThreadObj->stop) {
tDebug("%s TCP thread get stop event, exiting...", pThreadObj->label); tDebug("%s TCP thread get stop event, exiting...", pThreadObj->label);
break; break;
......
...@@ -184,7 +184,7 @@ static void *taosProcessTcpData(void *param) { ...@@ -184,7 +184,7 @@ static void *taosProcessTcpData(void *param) {
while (1) { while (1) {
if (pThread->stop) break; if (pThread->stop) break;
int fdNum = epoll_wait(pThread->pollFd, events, maxEvents, -1); int fdNum = epoll_wait(pThread->pollFd, events, maxEvents, TAOS_EPOLL_WAIT_TIME);
if (pThread->stop) { if (pThread->stop) {
uDebug("%p TCP epoll thread is exiting...", pThread); uDebug("%p TCP epoll thread is exiting...", pThread);
break; break;
...@@ -313,6 +313,7 @@ static void taosStopPoolThread(SThreadObj* pThread) { ...@@ -313,6 +313,7 @@ static void taosStopPoolThread(SThreadObj* pThread) {
// failed to create eventfd, call pthread_cancel instead, which may result in data corruption // failed to create eventfd, call pthread_cancel instead, which may result in data corruption
uError("failed to create eventfd(%s)", strerror(errno)); uError("failed to create eventfd(%s)", strerror(errno));
pthread_cancel(pThread->thread); pthread_cancel(pThread->thread);
pThread->stop = true;
} else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) { } else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
// failed to call epoll_ctl, call pthread_cancel instead, which may result in data corruption // failed to call epoll_ctl, call pthread_cancel instead, which may result in data corruption
uError("failed to call epoll_ctl(%s)", strerror(errno)); uError("failed to call epoll_ctl(%s)", strerror(errno));
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "tchecksum.h" #include "tchecksum.h"
#include "tsdbMain.h" #include "tsdbMain.h"
#include "tutil.h" #include "tutil.h"
#define TAOS_RANDOM_FILE_FAIL_TEST #define TAOS_RANDOM_FILE_FAIL_TEST
#ifdef TSDB_IDX #ifdef TSDB_IDX
...@@ -201,7 +202,7 @@ void tsdbSeekFileGroupIter(SFileGroupIter *pIter, int fid) { ...@@ -201,7 +202,7 @@ void tsdbSeekFileGroupIter(SFileGroupIter *pIter, int fid) {
pIter->index = -1; pIter->index = -1;
pIter->fileId = -1; pIter->fileId = -1;
} else { } else {
pIter->index = POINTER_DISTANCE(ptr, pFileH->pFGroup) / sizeof(SFileGroup); pIter->index = (int)(POINTER_DISTANCE(ptr, pFileH->pFGroup) / sizeof(SFileGroup));
pIter->fileId = ((SFileGroup *)ptr)->fileId; pIter->fileId = ((SFileGroup *)ptr)->fileId;
} }
} }
...@@ -304,8 +305,8 @@ void tsdbFitRetention(STsdbRepo *pRepo) { ...@@ -304,8 +305,8 @@ void tsdbFitRetention(STsdbRepo *pRepo) {
STsdbFileH *pFileH = pRepo->tsdbFileH; STsdbFileH *pFileH = pRepo->tsdbFileH;
SFileGroup *pGroup = pFileH->pFGroup; SFileGroup *pGroup = pFileH->pFGroup;
int mfid = TSDB_KEY_FILEID(taosGetTimestamp(pCfg->precision), pCfg->daysPerFile, pCfg->precision) - int mfid = (int)(TSDB_KEY_FILEID(taosGetTimestamp(pCfg->precision), pCfg->daysPerFile, pCfg->precision) -
TSDB_MAX_FILE(pCfg->keep, pCfg->daysPerFile); TSDB_MAX_FILE(pCfg->keep, pCfg->daysPerFile));
pthread_rwlock_wrlock(&(pFileH->fhlock)); pthread_rwlock_wrlock(&(pFileH->fhlock));
...@@ -370,7 +371,7 @@ void tsdbRemoveFileGroup(STsdbRepo *pRepo, SFileGroup *pFGroup) { ...@@ -370,7 +371,7 @@ void tsdbRemoveFileGroup(STsdbRepo *pRepo, SFileGroup *pFGroup) {
SFileGroup fileGroup = *pFGroup; SFileGroup fileGroup = *pFGroup;
int nFilesLeft = pFileH->nFGroups - (POINTER_DISTANCE(pFGroup, pFileH->pFGroup) / sizeof(SFileGroup) + 1); int nFilesLeft = pFileH->nFGroups - (int)(POINTER_DISTANCE(pFGroup, pFileH->pFGroup) / sizeof(SFileGroup) + 1);
if (nFilesLeft > 0) { if (nFilesLeft > 0) {
memmove((void *)pFGroup, POINTER_SHIFT(pFGroup, sizeof(SFileGroup)), sizeof(SFileGroup) * nFilesLeft); memmove((void *)pFGroup, POINTER_SHIFT(pFGroup, sizeof(SFileGroup)), sizeof(SFileGroup) * nFilesLeft);
} }
......
...@@ -211,7 +211,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_ ...@@ -211,7 +211,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
char *sdup = strdup(pRepo->rootDir); char *sdup = strdup(pRepo->rootDir);
char *prefix = dirname(sdup); char *prefix = dirname(sdup);
int prefixLen = strlen(prefix); int prefixLen = (int)strlen(prefix);
taosTFree(sdup); taosTFree(sdup);
if (name[0] == 0) { // get the file from index or after, but not larger than eindex if (name[0] == 0) { // get the file from index or after, but not larger than eindex
...@@ -232,7 +232,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_ ...@@ -232,7 +232,7 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
fname = strdup(pFGroup->files[(*index) % TSDB_FILE_TYPE_MAX].fname); fname = strdup(pFGroup->files[(*index) % TSDB_FILE_TYPE_MAX].fname);
magic = pFGroup->files[(*index) % TSDB_FILE_TYPE_MAX].info.magic; magic = pFGroup->files[(*index) % TSDB_FILE_TYPE_MAX].info.magic;
} else { } else {
if ((pFGroup->fileId + 1) * TSDB_FILE_TYPE_MAX - 1 < eindex) { if ((pFGroup->fileId + 1) * TSDB_FILE_TYPE_MAX - 1 < (int)eindex) {
fname = strdup(pFGroup->files[0].fname); fname = strdup(pFGroup->files[0].fname);
*index = pFGroup->fileId * TSDB_FILE_TYPE_MAX; *index = pFGroup->fileId * TSDB_FILE_TYPE_MAX;
magic = pFGroup->files[0].info.magic; magic = pFGroup->files[0].info.magic;
...@@ -327,7 +327,7 @@ void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int ...@@ -327,7 +327,7 @@ void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int
// ----------------- INTERNAL FUNCTIONS ----------------- // ----------------- INTERNAL FUNCTIONS -----------------
char *tsdbGetMetaFileName(char *rootDir) { char *tsdbGetMetaFileName(char *rootDir) {
int tlen = strlen(rootDir) + strlen(TSDB_META_FILE_NAME) + 2; int tlen = (int)(strlen(rootDir) + strlen(TSDB_META_FILE_NAME) + 2);
char *fname = calloc(1, tlen); char *fname = calloc(1, tlen);
if (fname == NULL) { if (fname == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
...@@ -366,7 +366,7 @@ int tsdbUnlockRepo(STsdbRepo *pRepo) { ...@@ -366,7 +366,7 @@ int tsdbUnlockRepo(STsdbRepo *pRepo) {
} }
char *tsdbGetDataDirName(char *rootDir) { char *tsdbGetDataDirName(char *rootDir) {
int tlen = strlen(rootDir) + strlen(TSDB_DATA_DIR_NAME) + 2; int tlen = (int)(strlen(rootDir) + strlen(TSDB_DATA_DIR_NAME) + 2);
char *fname = calloc(1, tlen); char *fname = calloc(1, tlen);
if (fname == NULL) { if (fname == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
...@@ -627,7 +627,7 @@ _err: ...@@ -627,7 +627,7 @@ _err:
} }
static char *tsdbGetCfgFname(char *rootDir) { static char *tsdbGetCfgFname(char *rootDir) {
int tlen = strlen(rootDir) + strlen(TSDB_CFG_FILE_NAME) + 2; int tlen = (int)(strlen(rootDir) + strlen(TSDB_CFG_FILE_NAME) + 2);
char *fname = calloc(1, tlen); char *fname = calloc(1, tlen);
if (fname == NULL) { if (fname == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
...@@ -853,8 +853,8 @@ static int tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { ...@@ -853,8 +853,8 @@ static int tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
return -1; return -1;
} }
int mfid = TSDB_KEY_FILEID(taosGetTimestamp(pCfg->precision), pCfg->daysPerFile, pCfg->precision) - int mfid = (int)(TSDB_KEY_FILEID(taosGetTimestamp(pCfg->precision), pCfg->daysPerFile, pCfg->precision) -
TSDB_MAX_FILE(keep, pCfg->daysPerFile); TSDB_MAX_FILE(keep, pCfg->daysPerFile));
int i = 0; int i = 0;
for (; i < pFileH->nFGroups; i++) { for (; i < pFileH->nFGroups; i++) {
......
...@@ -307,7 +307,7 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey ...@@ -307,7 +307,7 @@ int tsdbLoadDataFromCache(STable *pTable, SSkipListIterator *pIter, TSKEY maxKey
keyNext = tsdbNextIterKey(pIter); keyNext = tsdbNextIterKey(pIter);
if (keyNext < 0 || keyNext > maxKey) return numOfRows; if (keyNext < 0 || keyNext > maxKey) return numOfRows;
void *ptr = taosbsearch((void *)(&keyNext), (void *)filterKeys, nFilterKeys, sizeof(TSKEY), compTSKEY, TD_GE); void *ptr = taosbsearch((void *)(&keyNext), (void *)filterKeys, nFilterKeys, sizeof(TSKEY), compTSKEY, TD_GE);
filterIter = (ptr == NULL) ? nFilterKeys : (POINTER_DISTANCE(ptr, filterKeys) / sizeof(TSKEY)); filterIter = (ptr == NULL) ? nFilterKeys : (int)((POINTER_DISTANCE(ptr, filterKeys) / sizeof(TSKEY)));
} }
do { do {
...@@ -364,7 +364,7 @@ static void tsdbFreeBytes(STsdbRepo *pRepo, void *ptr, int bytes) { ...@@ -364,7 +364,7 @@ static void tsdbFreeBytes(STsdbRepo *pRepo, void *ptr, int bytes) {
tsdbTrace("vgId:%d free %d bytes to TSDB buffer pool, nBlocks %d offset %d remain %d", REPO_ID(pRepo), bytes, tsdbTrace("vgId:%d free %d bytes to TSDB buffer pool, nBlocks %d offset %d remain %d", REPO_ID(pRepo), bytes,
listNEles(pRepo->mem->bufBlockList), pBufBlock->offset, pBufBlock->remain); listNEles(pRepo->mem->bufBlockList), pBufBlock->offset, pBufBlock->remain);
} else { } else {
SListNode *pNode = (SListNode *)POINTER_SHIFT(ptr, -sizeof(SListNode)); SListNode *pNode = (SListNode *)POINTER_SHIFT(ptr, -(int)(sizeof(SListNode)));
ASSERT(listTail(pRepo->mem->extraBuffList) == pNode); ASSERT(listTail(pRepo->mem->extraBuffList) == pNode);
tdListPopNode(pRepo->mem->extraBuffList, pNode); tdListPopNode(pRepo->mem->extraBuffList, pNode);
free(pNode); free(pNode);
...@@ -495,8 +495,8 @@ static void *tsdbCommitData(void *arg) { ...@@ -495,8 +495,8 @@ static void *tsdbCommitData(void *arg) {
goto _exit; goto _exit;
} }
int sfid = TSDB_KEY_FILEID(pMem->keyFirst, pCfg->daysPerFile, pCfg->precision); int sfid = (int)(TSDB_KEY_FILEID(pMem->keyFirst, pCfg->daysPerFile, pCfg->precision));
int efid = TSDB_KEY_FILEID(pMem->keyLast, pCfg->daysPerFile, pCfg->precision); int efid = (int)(TSDB_KEY_FILEID(pMem->keyLast, pCfg->daysPerFile, pCfg->precision));
// Loop to commit to each file // Loop to commit to each file
for (int fid = sfid; fid <= efid; fid++) { for (int fid = sfid; fid <= efid; fid++) {
......
...@@ -443,7 +443,7 @@ STsdbMeta *tsdbNewMeta(STsdbCfg *pCfg) { ...@@ -443,7 +443,7 @@ STsdbMeta *tsdbNewMeta(STsdbCfg *pCfg) {
goto _err; goto _err;
} }
pMeta->uidMap = taosHashInit(TSDB_INIT_NTABLES * 1.1, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false); pMeta->uidMap = taosHashInit((size_t)(TSDB_INIT_NTABLES * 1.1), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false);
if (pMeta->uidMap == NULL) { if (pMeta->uidMap == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _err; goto _err;
...@@ -672,7 +672,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) { ...@@ -672,7 +672,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _err; goto _err;
} }
STR_WITH_SIZE_TO_VARSTR(pTable->name, pCfg->sname, tsize); STR_WITH_SIZE_TO_VARSTR(pTable->name, pCfg->sname, (VarDataLenT)tsize);
TABLE_UID(pTable) = pCfg->superUid; TABLE_UID(pTable) = pCfg->superUid;
TABLE_TID(pTable) = -1; TABLE_TID(pTable) = -1;
TABLE_SUID(pTable) = -1; TABLE_SUID(pTable) = -1;
...@@ -690,7 +690,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) { ...@@ -690,7 +690,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
} }
pTable->tagVal = NULL; pTable->tagVal = NULL;
STColumn *pCol = schemaColAt(pTable->tagSchema, DEFAULT_TAG_INDEX_COLUMN); STColumn *pCol = schemaColAt(pTable->tagSchema, DEFAULT_TAG_INDEX_COLUMN);
pTable->pIndex = tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, colType(pCol), colBytes(pCol), 1, 0, 1, getTagIndexKey); pTable->pIndex = tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, colType(pCol), (uint8_t)(colBytes(pCol)), 1, 0, 1, getTagIndexKey);
if (pTable->pIndex == NULL) { if (pTable->pIndex == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _err; goto _err;
...@@ -703,7 +703,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) { ...@@ -703,7 +703,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
goto _err; goto _err;
} }
STR_WITH_SIZE_TO_VARSTR(pTable->name, pCfg->name, tsize); STR_WITH_SIZE_TO_VARSTR(pTable->name, pCfg->name, (VarDataLenT)tsize);
TABLE_UID(pTable) = pCfg->tableId.uid; TABLE_UID(pTable) = pCfg->tableId.uid;
TABLE_TID(pTable) = pCfg->tableId.tid; TABLE_TID(pTable) = pCfg->tableId.tid;
...@@ -1165,7 +1165,7 @@ static void *tsdbDecodeTable(void *buf, STable **pRTable) { ...@@ -1165,7 +1165,7 @@ static void *tsdbDecodeTable(void *buf, STable **pRTable) {
buf = tdDecodeSchema(buf, &(pTable->tagSchema)); buf = tdDecodeSchema(buf, &(pTable->tagSchema));
STColumn *pCol = schemaColAt(pTable->tagSchema, DEFAULT_TAG_INDEX_COLUMN); STColumn *pCol = schemaColAt(pTable->tagSchema, DEFAULT_TAG_INDEX_COLUMN);
pTable->pIndex = pTable->pIndex =
tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, colType(pCol), colBytes(pCol), 1, 0, 1, getTagIndexKey); tSkipListCreate(TSDB_SUPER_TABLE_SL_LEVEL, colType(pCol), (uint8_t)(colBytes(pCol)), 1, 0, 1, getTagIndexKey);
if (pTable->pIndex == NULL) { if (pTable->pIndex == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tsdbFreeTable(pTable); tsdbFreeTable(pTable);
...@@ -1191,7 +1191,7 @@ static int tsdbGetTableEncodeSize(int8_t act, STable *pTable) { ...@@ -1191,7 +1191,7 @@ static int tsdbGetTableEncodeSize(int8_t act, STable *pTable) {
tlen = sizeof(SListNode) + sizeof(SActObj) + sizeof(SActCont) + tsdbEncodeTable(NULL, pTable) + sizeof(TSCKSUM); tlen = sizeof(SListNode) + sizeof(SActObj) + sizeof(SActCont) + tsdbEncodeTable(NULL, pTable) + sizeof(TSCKSUM);
} else { } else {
if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) { if (TABLE_TYPE(pTable) == TSDB_SUPER_TABLE) {
tlen = (sizeof(SListNode) + sizeof(SActObj)) * (tSkipListGetSize(pTable->pIndex) + 1); tlen = (int)((sizeof(SListNode) + sizeof(SActObj)) * (tSkipListGetSize(pTable->pIndex) + 1));
} else { } else {
tlen = sizeof(SListNode) + sizeof(SActObj); tlen = sizeof(SListNode) + sizeof(SActObj);
} }
......
...@@ -302,7 +302,7 @@ int tsdbCommitTableData(SRWHelper *pHelper, SCommitIter *pCommitIter, SDataCols ...@@ -302,7 +302,7 @@ int tsdbCommitTableData(SRWHelper *pHelper, SCommitIter *pCommitIter, SDataCols
if (tsdbLoadCompInfo(pHelper, NULL) < 0) return -1; if (tsdbLoadCompInfo(pHelper, NULL) < 0) return -1;
while (true) { while (true) {
ASSERT(blkIdx <= pIdx->numOfBlocks); ASSERT(blkIdx <= (int)pIdx->numOfBlocks);
TSKEY keyFirst = tsdbNextIterKey(pCommitIter->pIter); TSKEY keyFirst = tsdbNextIterKey(pCommitIter->pIter);
if (keyFirst < 0 || keyFirst > maxKey) break; // iter over if (keyFirst < 0 || keyFirst > maxKey) break; // iter over
...@@ -405,7 +405,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) { ...@@ -405,7 +405,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
pIdx->tid = pHelper->tableInfo.tid; pIdx->tid = pHelper->tableInfo.tid;
ASSERT(pIdx->offset >= TSDB_FILE_HEAD_SIZE); ASSERT(pIdx->offset >= TSDB_FILE_HEAD_SIZE);
if (taosTWrite(pFile->fd, (void *)(pHelper->pCompInfo), pIdx->len) < pIdx->len) { if (taosTWrite(pFile->fd, (void *)(pHelper->pCompInfo), pIdx->len) < (int)pIdx->len) {
tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(pHelper->pRepo), pIdx->len, tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(pHelper->pRepo), pIdx->len,
pFile->fname, strerror(errno)); pFile->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
...@@ -462,7 +462,7 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) { ...@@ -462,7 +462,7 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
pFile->info.offset = offset; pFile->info.offset = offset;
if (taosTWrite(pFile->fd, (void *)pHelper->pWIdx, pFile->info.len) < pFile->info.len) { if (taosTWrite(pFile->fd, (void *)pHelper->pWIdx, pFile->info.len) < (int)pFile->info.len) {
tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(pHelper->pRepo), pFile->info.len, tsdbError("vgId:%d failed to write %d bytes to file %s since %s", REPO_ID(pHelper->pRepo), pFile->info.len,
pFile->fname, strerror(errno)); pFile->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
...@@ -495,7 +495,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) { ...@@ -495,7 +495,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) {
return -1; return -1;
} }
if (taosTRead(fd, (void *)(pHelper->pBuffer), pFile->info.len) < pFile->info.len) { if (taosTRead(fd, (void *)(pHelper->pBuffer), pFile->info.len) < (int)pFile->info.len) {
tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pFile->info.len, tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pFile->info.len,
pFile->fname, strerror(errno)); pFile->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
...@@ -512,7 +512,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) { ...@@ -512,7 +512,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) {
// Decode it // Decode it
pHelper->idxH.numOfIdx = 0; pHelper->idxH.numOfIdx = 0;
void *ptr = pHelper->pBuffer; void *ptr = pHelper->pBuffer;
while (POINTER_DISTANCE(ptr, pHelper->pBuffer) < (pFile->info.len - sizeof(TSCKSUM))) { while (POINTER_DISTANCE(ptr, pHelper->pBuffer) < (int)(pFile->info.len - sizeof(TSCKSUM))) {
size_t tlen = taosTSizeof(pHelper->idxH.pIdxArray); size_t tlen = taosTSizeof(pHelper->idxH.pIdxArray);
pHelper->idxH.numOfIdx++; pHelper->idxH.numOfIdx++;
...@@ -535,7 +535,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) { ...@@ -535,7 +535,7 @@ int tsdbLoadCompIdx(SRWHelper *pHelper, void *target) {
ASSERT(pHelper->idxH.numOfIdx == 1 || pHelper->idxH.pIdxArray[pHelper->idxH.numOfIdx - 1].tid > ASSERT(pHelper->idxH.numOfIdx == 1 || pHelper->idxH.pIdxArray[pHelper->idxH.numOfIdx - 1].tid >
pHelper->idxH.pIdxArray[pHelper->idxH.numOfIdx - 2].tid); pHelper->idxH.pIdxArray[pHelper->idxH.numOfIdx - 2].tid);
ASSERT(POINTER_DISTANCE(ptr, pHelper->pBuffer) <= pFile->info.len - sizeof(TSCKSUM)); ASSERT(POINTER_DISTANCE(ptr, pHelper->pBuffer) <= (int)(pFile->info.len - sizeof(TSCKSUM)));
} }
} }
} }
...@@ -566,7 +566,7 @@ int tsdbLoadCompInfo(SRWHelper *pHelper, void *target) { ...@@ -566,7 +566,7 @@ int tsdbLoadCompInfo(SRWHelper *pHelper, void *target) {
} }
pHelper->pCompInfo = taosTRealloc((void *)pHelper->pCompInfo, pIdx->len); pHelper->pCompInfo = taosTRealloc((void *)pHelper->pCompInfo, pIdx->len);
if (taosTRead(fd, (void *)(pHelper->pCompInfo), pIdx->len) < pIdx->len) { if (taosTRead(fd, (void *)(pHelper->pCompInfo), pIdx->len) < (int)pIdx->len) {
tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pIdx->len, tsdbError("vgId:%d failed to read %d bytes from file %s since %s", REPO_ID(pHelper->pRepo), pIdx->len,
helperHeadF(pHelper)->fname, strerror(errno)); helperHeadF(pHelper)->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
...@@ -594,7 +594,7 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) { ...@@ -594,7 +594,7 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) {
ASSERT(pCompBlock->numOfSubBlocks <= 1); ASSERT(pCompBlock->numOfSubBlocks <= 1);
SFile *pFile = (pCompBlock->last) ? helperLastF(pHelper) : helperDataF(pHelper); SFile *pFile = (pCompBlock->last) ? helperLastF(pHelper) : helperDataF(pHelper);
if (lseek(pFile->fd, pCompBlock->offset, SEEK_SET) < 0) { if (lseek(pFile->fd, (off_t)pCompBlock->offset, SEEK_SET) < 0) {
tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno)); tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
return -1; return -1;
...@@ -614,7 +614,7 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) { ...@@ -614,7 +614,7 @@ int tsdbLoadCompData(SRWHelper *pHelper, SCompBlock *pCompBlock, void *target) {
return -1; return -1;
} }
if (!taosCheckChecksumWhole((uint8_t *)pHelper->pCompData, tsize)) { if (!taosCheckChecksumWhole((uint8_t *)pHelper->pCompData, (uint32_t)tsize)) {
tsdbError("vgId:%d file %s is broken, offset %" PRId64 " size %zu", REPO_ID(pHelper->pRepo), pFile->fname, tsdbError("vgId:%d file %s is broken, offset %" PRId64 " size %zu", REPO_ID(pHelper->pRepo), pFile->fname,
(int64_t)pCompBlock->offset, tsize); (int64_t)pCompBlock->offset, tsize);
terrno = TSDB_CODE_TDB_FILE_CORRUPTED; terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
...@@ -787,8 +787,8 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa ...@@ -787,8 +787,8 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
} }
flen = (*(tDataTypeDesc[pDataCol->type].compFunc))((char *)pDataCol->pData, tlen, rowsToWrite, tptr, flen = (*(tDataTypeDesc[pDataCol->type].compFunc))((char *)pDataCol->pData, tlen, rowsToWrite, tptr,
taosTSizeof(pHelper->pBuffer) - lsize, pCfg->compression, (int32_t)taosTSizeof(pHelper->pBuffer) - lsize, pCfg->compression,
pHelper->compBuffer, taosTSizeof(pHelper->compBuffer)); pHelper->compBuffer, (int32_t)taosTSizeof(pHelper->compBuffer));
} else { } else {
flen = tlen; flen = tlen;
memcpy(tptr, pDataCol->pData, flen); memcpy(tptr, pDataCol->pData, flen);
...@@ -879,7 +879,7 @@ static int tsdbAdjustInfoSizeIfNeeded(SRWHelper *pHelper, size_t esize) { ...@@ -879,7 +879,7 @@ static int tsdbAdjustInfoSizeIfNeeded(SRWHelper *pHelper, size_t esize) {
static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkIdx) { static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkIdx) {
SCompIdx *pIdx = &(pHelper->curCompIdx); SCompIdx *pIdx = &(pHelper->curCompIdx);
ASSERT(blkIdx >= 0 && blkIdx <= pIdx->numOfBlocks); ASSERT(blkIdx >= 0 && blkIdx <= (int)pIdx->numOfBlocks);
ASSERT(pCompBlock->numOfSubBlocks == 1); ASSERT(pCompBlock->numOfSubBlocks == 1);
// Adjust memory if no more room // Adjust memory if no more room
...@@ -887,7 +887,7 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int ...@@ -887,7 +887,7 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
if (tsdbAdjustInfoSizeIfNeeded(pHelper, pIdx->len + sizeof(SCompInfo)) < 0) goto _err; if (tsdbAdjustInfoSizeIfNeeded(pHelper, pIdx->len + sizeof(SCompInfo)) < 0) goto _err;
// Change the offset // Change the offset
for (int i = 0; i < pIdx->numOfBlocks; i++) { for (uint32_t i = 0; i < pIdx->numOfBlocks; i++) {
SCompBlock *pTCompBlock = &pHelper->pCompInfo->blocks[i]; SCompBlock *pTCompBlock = &pHelper->pCompInfo->blocks[i];
if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset += sizeof(SCompBlock); if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset += sizeof(SCompBlock);
} }
...@@ -906,7 +906,7 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int ...@@ -906,7 +906,7 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
pIdx->len += sizeof(SCompBlock); pIdx->len += sizeof(SCompBlock);
ASSERT(pIdx->len <= taosTSizeof(pHelper->pCompInfo)); ASSERT(pIdx->len <= taosTSizeof(pHelper->pCompInfo));
pIdx->maxKey = blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->keyLast; pIdx->maxKey = blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->keyLast;
pIdx->hasLast = blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->last; pIdx->hasLast = (uint32_t)blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->last;
if (pIdx->numOfBlocks > 1) { if (pIdx->numOfBlocks > 1) {
ASSERT(pHelper->pCompInfo->blocks[0].keyLast < pHelper->pCompInfo->blocks[1].keyFirst); ASSERT(pHelper->pCompInfo->blocks[0].keyLast < pHelper->pCompInfo->blocks[1].keyFirst);
...@@ -925,7 +925,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId ...@@ -925,7 +925,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
ASSERT(pCompBlock->numOfSubBlocks == 0); ASSERT(pCompBlock->numOfSubBlocks == 0);
SCompIdx *pIdx = &(pHelper->curCompIdx); SCompIdx *pIdx = &(pHelper->curCompIdx);
ASSERT(blkIdx >= 0 && blkIdx < pIdx->numOfBlocks); ASSERT(blkIdx >= 0 && blkIdx < (int)pIdx->numOfBlocks);
SCompBlock *pSCompBlock = pHelper->pCompInfo->blocks + blkIdx; SCompBlock *pSCompBlock = pHelper->pCompInfo->blocks + blkIdx;
ASSERT(pSCompBlock->numOfSubBlocks >= 1 && pSCompBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS); ASSERT(pSCompBlock->numOfSubBlocks >= 1 && pSCompBlock->numOfSubBlocks < TSDB_MAX_SUBBLOCKS);
...@@ -943,7 +943,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId ...@@ -943,7 +943,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
memmove((void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len + sizeof(SCompBlock)), memmove((void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len + sizeof(SCompBlock)),
(void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len), tsize); (void *)((char *)(pHelper->pCompInfo) + pSCompBlock->offset + pSCompBlock->len), tsize);
for (int i = blkIdx + 1; i < pIdx->numOfBlocks; i++) { for (uint32_t i = blkIdx + 1; i < pIdx->numOfBlocks; i++) {
SCompBlock *pTCompBlock = &pHelper->pCompInfo->blocks[i]; SCompBlock *pTCompBlock = &pHelper->pCompInfo->blocks[i];
if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset += sizeof(SCompBlock); if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset += sizeof(SCompBlock);
} }
...@@ -960,7 +960,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId ...@@ -960,7 +960,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
pIdx->len += sizeof(SCompBlock); pIdx->len += sizeof(SCompBlock);
} else { // Need to create two sub-blocks } else { // Need to create two sub-blocks
void *ptr = NULL; void *ptr = NULL;
for (int i = blkIdx + 1; i < pIdx->numOfBlocks; i++) { for (uint32_t i = blkIdx + 1; i < pIdx->numOfBlocks; i++) {
SCompBlock *pTCompBlock = pHelper->pCompInfo->blocks + i; SCompBlock *pTCompBlock = pHelper->pCompInfo->blocks + i;
if (pTCompBlock->numOfSubBlocks > 1) { if (pTCompBlock->numOfSubBlocks > 1) {
ptr = POINTER_SHIFT(pHelper->pCompInfo, pTCompBlock->offset); ptr = POINTER_SHIFT(pHelper->pCompInfo, pTCompBlock->offset);
...@@ -973,7 +973,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId ...@@ -973,7 +973,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
size_t tsize = pIdx->len - ((char *)ptr - (char *)(pHelper->pCompInfo)); size_t tsize = pIdx->len - ((char *)ptr - (char *)(pHelper->pCompInfo));
if (tsize > 0) { if (tsize > 0) {
memmove(POINTER_SHIFT(ptr, sizeof(SCompBlock) * 2), ptr, tsize); memmove(POINTER_SHIFT(ptr, sizeof(SCompBlock) * 2), ptr, tsize);
for (int i = blkIdx + 1; i < pIdx->numOfBlocks; i++) { for (uint32_t i = blkIdx + 1; i < pIdx->numOfBlocks; i++) {
SCompBlock *pTCompBlock = pHelper->pCompInfo->blocks + i; SCompBlock *pTCompBlock = pHelper->pCompInfo->blocks + i;
if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset += (sizeof(SCompBlock) * 2); if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset += (sizeof(SCompBlock) * 2);
} }
...@@ -995,7 +995,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId ...@@ -995,7 +995,7 @@ static int tsdbAddSubBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int blkId
} }
pIdx->maxKey = pHelper->pCompInfo->blocks[pIdx->numOfBlocks - 1].keyLast; pIdx->maxKey = pHelper->pCompInfo->blocks[pIdx->numOfBlocks - 1].keyLast;
pIdx->hasLast = pHelper->pCompInfo->blocks[pIdx->numOfBlocks - 1].last; pIdx->hasLast = (uint32_t)pHelper->pCompInfo->blocks[pIdx->numOfBlocks - 1].last;
tsdbDebug("vgId:%d tid:%d a subblock is added at index %d", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid, blkIdx); tsdbDebug("vgId:%d tid:%d a subblock is added at index %d", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid, blkIdx);
...@@ -1010,7 +1010,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int ...@@ -1010,7 +1010,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
SCompIdx *pIdx = &(pHelper->curCompIdx); SCompIdx *pIdx = &(pHelper->curCompIdx);
ASSERT(blkIdx >= 0 && blkIdx < pIdx->numOfBlocks); ASSERT(blkIdx >= 0 && blkIdx < (int)pIdx->numOfBlocks);
SCompBlock *pSCompBlock = pHelper->pCompInfo->blocks + blkIdx; SCompBlock *pSCompBlock = pHelper->pCompInfo->blocks + blkIdx;
...@@ -1024,7 +1024,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int ...@@ -1024,7 +1024,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset + pSCompBlock->len), tsize); POINTER_SHIFT(pHelper->pCompInfo, pSCompBlock->offset + pSCompBlock->len), tsize);
} }
for (int i = blkIdx + 1; i < pIdx->numOfBlocks; i++) { for (uint32_t i = blkIdx + 1; i < pIdx->numOfBlocks; i++) {
SCompBlock *pTCompBlock = &pHelper->pCompInfo->blocks[i]; SCompBlock *pTCompBlock = &pHelper->pCompInfo->blocks[i];
if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset -= (sizeof(SCompBlock) * pSCompBlock->numOfSubBlocks); if (pTCompBlock->numOfSubBlocks > 1) pTCompBlock->offset -= (sizeof(SCompBlock) * pSCompBlock->numOfSubBlocks);
} }
...@@ -1035,7 +1035,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int ...@@ -1035,7 +1035,7 @@ static int tsdbUpdateSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
*pSCompBlock = *pCompBlock; *pSCompBlock = *pCompBlock;
pIdx->maxKey = blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->keyLast; pIdx->maxKey = blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->keyLast;
pIdx->hasLast = blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->last; pIdx->hasLast = (uint32_t)blockAtIdx(pHelper, pIdx->numOfBlocks - 1)->last;
tsdbDebug("vgId:%d tid:%d a super block is updated at index %d", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid, tsdbDebug("vgId:%d tid:%d a super block is updated at index %d", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid,
blkIdx); blkIdx);
...@@ -1197,7 +1197,7 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl ...@@ -1197,7 +1197,7 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl
} }
int64_t offset = pCompBlock->offset + TSDB_GET_COMPCOL_LEN(pCompBlock->numOfCols) + pCompCol->offset; int64_t offset = pCompBlock->offset + TSDB_GET_COMPCOL_LEN(pCompBlock->numOfCols) + pCompCol->offset;
if (lseek(pFile->fd, offset, SEEK_SET) < 0) { if (lseek(pFile->fd, (off_t)offset, SEEK_SET) < 0) {
tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno)); tsdbError("vgId:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pFile->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
return -1; return -1;
...@@ -1212,7 +1212,7 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl ...@@ -1212,7 +1212,7 @@ static int tsdbLoadColData(SRWHelper *pHelper, SFile *pFile, SCompBlock *pCompBl
if (tsdbCheckAndDecodeColumnData(pDataCol, pHelper->pBuffer, pCompCol->len, pCompBlock->algorithm, if (tsdbCheckAndDecodeColumnData(pDataCol, pHelper->pBuffer, pCompCol->len, pCompBlock->algorithm,
pCompBlock->numOfRows, pHelper->pRepo->config.maxRowsPerFileBlock, pCompBlock->numOfRows, pHelper->pRepo->config.maxRowsPerFileBlock,
pHelper->compBuffer, taosTSizeof(pHelper->compBuffer)) < 0) { pHelper->compBuffer, (int32_t)taosTSizeof(pHelper->compBuffer)) < 0) {
tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pHelper->pRepo), pFile->fname, tsdbError("vgId:%d file %s is broken at column %d offset %" PRId64, REPO_ID(pHelper->pRepo), pFile->fname,
pCompCol->colId, offset); pCompCol->colId, offset);
return -1; return -1;
...@@ -1312,7 +1312,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa ...@@ -1312,7 +1312,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
SCompData *pCompData = (SCompData *)pHelper->pBuffer; SCompData *pCompData = (SCompData *)pHelper->pBuffer;
int fd = pFile->fd; int fd = pFile->fd;
if (lseek(fd, pCompBlock->offset, SEEK_SET) < 0) { if (lseek(fd, (off_t)pCompBlock->offset, SEEK_SET) < 0) {
tsdbError("vgId:%d tid:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid, tsdbError("vgId:%d tid:%d failed to lseek file %s since %s", REPO_ID(pHelper->pRepo), pHelper->tableInfo.tid,
pFile->fname, strerror(errno)); pFile->fname, strerror(errno));
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
...@@ -1375,7 +1375,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa ...@@ -1375,7 +1375,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
} }
if (tsdbCheckAndDecodeColumnData(pDataCol, (char *)pCompData + tsize + toffset, tlen, pCompBlock->algorithm, if (tsdbCheckAndDecodeColumnData(pDataCol, (char *)pCompData + tsize + toffset, tlen, pCompBlock->algorithm,
pCompBlock->numOfRows, pDataCols->maxPoints, pHelper->compBuffer, pCompBlock->numOfRows, pDataCols->maxPoints, pHelper->compBuffer,
taosTSizeof(pHelper->compBuffer)) < 0) { (int32_t)taosTSizeof(pHelper->compBuffer)) < 0) {
tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %d", tsdbError("vgId:%d file %s is broken at column %d block offset %" PRId64 " column offset %d",
REPO_ID(pHelper->pRepo), pFile->fname, tcolId, (int64_t)pCompBlock->offset, toffset); REPO_ID(pHelper->pRepo), pFile->fname, tcolId, (int64_t)pCompBlock->offset, toffset);
goto _err; goto _err;
...@@ -1499,7 +1499,7 @@ static int tsdbProcessMergeCommit(SRWHelper *pHelper, SCommitIter *pCommitIter, ...@@ -1499,7 +1499,7 @@ static int tsdbProcessMergeCommit(SRWHelper *pHelper, SCommitIter *pCommitIter,
SCompBlock *pCompBlock = taosbsearch((void *)(&keyFirst), (void *)blockAtIdx(pHelper, *blkIdx), SCompBlock *pCompBlock = taosbsearch((void *)(&keyFirst), (void *)blockAtIdx(pHelper, *blkIdx),
pIdx->numOfBlocks - *blkIdx, sizeof(SCompBlock), compareKeyBlock, TD_GE); pIdx->numOfBlocks - *blkIdx, sizeof(SCompBlock), compareKeyBlock, TD_GE);
ASSERT(pCompBlock != NULL); ASSERT(pCompBlock != NULL);
int tblkIdx = TSDB_GET_COMPBLOCK_IDX(pHelper, pCompBlock); int tblkIdx = (int32_t)(TSDB_GET_COMPBLOCK_IDX(pHelper, pCompBlock));
if (pCompBlock->last) { if (pCompBlock->last) {
ASSERT(pCompBlock->numOfRows < pCfg->minRowsPerFileBlock && tblkIdx == pIdx->numOfBlocks - 1); ASSERT(pCompBlock->numOfRows < pCfg->minRowsPerFileBlock && tblkIdx == pIdx->numOfBlocks - 1);
......
...@@ -235,9 +235,10 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab ...@@ -235,9 +235,10 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
STableCheckInfo info = { STableCheckInfo info = {
.lastKey = pQueryHandle->window.skey, .lastKey = pQueryHandle->window.skey,
.tableId = pTable->tableId, //.tableId = pTable->tableId,
.pTableObj = pTable, .pTableObj = pTable,
}; };
info.tableId = pTable->tableId;
assert(info.pTableObj != NULL && (info.pTableObj->type == TSDB_NORMAL_TABLE || assert(info.pTableObj != NULL && (info.pTableObj->type == TSDB_NORMAL_TABLE ||
info.pTableObj->type == TSDB_CHILD_TABLE || info.pTableObj->type == TSDB_STREAM_TABLE)); info.pTableObj->type == TSDB_CHILD_TABLE || info.pTableObj->type == TSDB_STREAM_TABLE));
...@@ -523,7 +524,7 @@ static int32_t getFileIdFromKey(TSKEY key, int32_t daysPerFile, int32_t precisio ...@@ -523,7 +524,7 @@ static int32_t getFileIdFromKey(TSKEY key, int32_t daysPerFile, int32_t precisio
fid = INT32_MAX; fid = INT32_MAX;
} }
return fid; return (int32_t)fid;
} }
static int32_t binarySearchForBlock(SCompBlock* pBlock, int32_t numOfBlocks, TSKEY skey, int32_t order) { static int32_t binarySearchForBlock(SCompBlock* pBlock, int32_t numOfBlocks, TSKEY skey, int32_t order) {
...@@ -571,7 +572,7 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo ...@@ -571,7 +572,7 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo
continue; // no data blocks in the file belongs to pCheckInfo->pTable continue; // no data blocks in the file belongs to pCheckInfo->pTable
} }
if (pCheckInfo->compSize < compIndex->len) { if (pCheckInfo->compSize < (int32_t)compIndex->len) {
assert(compIndex->len > 0); assert(compIndex->len > 0);
char* t = realloc(pCheckInfo->pCompInfo, compIndex->len); char* t = realloc(pCheckInfo->pCompInfo, compIndex->len);
...@@ -604,7 +605,7 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo ...@@ -604,7 +605,7 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo
} }
// todo speedup the procedure of located end block // todo speedup the procedure of located end block
while (end < compIndex->numOfBlocks && (pCompInfo->blocks[end].keyFirst <= e)) { while (end < (int32_t)compIndex->numOfBlocks && (pCompInfo->blocks[end].keyFirst <= e)) {
end += 1; end += 1;
} }
...@@ -644,7 +645,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo ...@@ -644,7 +645,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo
tdInitDataCols(pQueryHandle->rhelper.pDataCols[1], pSchema); tdInitDataCols(pQueryHandle->rhelper.pDataCols[1], pSchema);
int16_t* colIds = pQueryHandle->defaultLoadColumn->pData; int16_t* colIds = pQueryHandle->defaultLoadColumn->pData;
int32_t ret = tsdbLoadBlockDataCols(&(pQueryHandle->rhelper), pBlock, pCheckInfo->pCompInfo, colIds, QH_GET_NUM_OF_COLS(pQueryHandle)); int32_t ret = tsdbLoadBlockDataCols(&(pQueryHandle->rhelper), pBlock, pCheckInfo->pCompInfo, colIds, (int)(QH_GET_NUM_OF_COLS(pQueryHandle)));
if (ret == TSDB_CODE_SUCCESS) { if (ret == TSDB_CODE_SUCCESS) {
SDataBlockLoadInfo* pBlockLoadInfo = &pQueryHandle->dataBlockLoadInfo; SDataBlockLoadInfo* pBlockLoadInfo = &pQueryHandle->dataBlockLoadInfo;
...@@ -846,7 +847,7 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap ...@@ -846,7 +847,7 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap
return numOfRows; return numOfRows;
} }
int32_t requiredNumOfCols = taosArrayGetSize(pQueryHandle->pColumns); int32_t requiredNumOfCols = (int32_t)taosArrayGetSize(pQueryHandle->pColumns);
//data in buffer has greater timestamp, copy data in file block //data in buffer has greater timestamp, copy data in file block
int32_t i = 0, j = 0; int32_t i = 0, j = 0;
...@@ -862,15 +863,15 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap ...@@ -862,15 +863,15 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap
int32_t bytes = pColInfo->info.bytes; int32_t bytes = pColInfo->info.bytes;
if (ASCENDING_TRAVERSE(pQueryHandle->order)) { if (ASCENDING_TRAVERSE(pQueryHandle->order)) {
pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
} else { } else {
pData = pColInfo->pData + (capacity - numOfRows - num) * pColInfo->info.bytes; pData = (char*)pColInfo->pData + (capacity - numOfRows - num) * pColInfo->info.bytes;
} }
if (pColInfo->info.colId == src->colId) { if (pColInfo->info.colId == src->colId) {
if (pColInfo->info.type != TSDB_DATA_TYPE_BINARY && pColInfo->info.type != TSDB_DATA_TYPE_NCHAR) { if (pColInfo->info.type != TSDB_DATA_TYPE_BINARY && pColInfo->info.type != TSDB_DATA_TYPE_NCHAR) {
memmove(pData, src->pData + bytes * start, bytes * num); memmove(pData, (char*)src->pData + bytes * start, bytes * num);
} else { // handle the var-string } else { // handle the var-string
char* dst = pData; char* dst = pData;
...@@ -902,9 +903,9 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap ...@@ -902,9 +903,9 @@ static int32_t copyDataFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t cap
while (i < requiredNumOfCols) { // the remain columns are all null data while (i < requiredNumOfCols) { // the remain columns are all null data
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i);
if (ASCENDING_TRAVERSE(pQueryHandle->order)) { if (ASCENDING_TRAVERSE(pQueryHandle->order)) {
pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
} else { } else {
pData = pColInfo->pData + (capacity - numOfRows - num) * pColInfo->info.bytes; pData = (char*)pColInfo->pData + (capacity - numOfRows - num) * pColInfo->info.bytes;
} }
if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) {
...@@ -944,13 +945,13 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity, ...@@ -944,13 +945,13 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
} }
if (ASCENDING_TRAVERSE(pQueryHandle->order)) { if (ASCENDING_TRAVERSE(pQueryHandle->order)) {
pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
} else { } else {
pData = pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes; pData = (char*)pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes;
} }
if (pSchema->columns[j].colId == pColInfo->info.colId) { if (pSchema->columns[j].colId == pColInfo->info.colId) {
void* value = tdGetRowDataOfCol(row, pColInfo->info.type, TD_DATA_ROW_HEAD_SIZE + pSchema->columns[j].offset); void* value = tdGetRowDataOfCol(row, (int8_t)pColInfo->info.type, TD_DATA_ROW_HEAD_SIZE + pSchema->columns[j].offset);
if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) {
memcpy(pData, value, varDataTLen(value)); memcpy(pData, value, varDataTLen(value));
} else { } else {
...@@ -972,9 +973,9 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity, ...@@ -972,9 +973,9 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
while (i < numOfCols) { // the remain columns are all null data while (i < numOfCols) { // the remain columns are all null data
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i);
if (ASCENDING_TRAVERSE(pQueryHandle->order)) { if (ASCENDING_TRAVERSE(pQueryHandle->order)) {
pData = pColInfo->pData + numOfRows * pColInfo->info.bytes; pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
} else { } else {
pData = pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes; pData = (char*)pColInfo->pData + (capacity - numOfRows - 1) * pColInfo->info.bytes;
} }
if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) {
...@@ -997,7 +998,7 @@ static void moveDataToFront(STsdbQueryHandle* pQueryHandle, int32_t numOfRows, i ...@@ -997,7 +998,7 @@ static void moveDataToFront(STsdbQueryHandle* pQueryHandle, int32_t numOfRows, i
int32_t emptySize = pQueryHandle->outputCapacity - numOfRows; int32_t emptySize = pQueryHandle->outputCapacity - numOfRows;
for(int32_t i = 0; i < numOfCols; ++i) { for(int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i);
memmove(pColInfo->pData, pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes); memmove((char*)pColInfo->pData, (char*)pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes);
} }
} }
} }
...@@ -1075,7 +1076,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* ...@@ -1075,7 +1076,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
int32_t order = (pQueryHandle->order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC; int32_t order = (pQueryHandle->order == TSDB_ORDER_ASC)? TSDB_ORDER_DESC:TSDB_ORDER_ASC;
int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order)? 1:-1; int32_t step = ASCENDING_TRAVERSE(pQueryHandle->order)? 1:-1;
int32_t numOfCols = QH_GET_NUM_OF_COLS(pQueryHandle); int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle));
STable* pTable = pCheckInfo->pTableObj; STable* pTable = pCheckInfo->pTableObj;
int32_t endPos = cur->pos; int32_t endPos = cur->pos;
...@@ -1326,7 +1327,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO ...@@ -1326,7 +1327,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
size_t size = sizeof(STableBlockInfo) * numOfBlocks; size_t size = sizeof(STableBlockInfo) * numOfBlocks;
if (pQueryHandle->allocSize < size) { if (pQueryHandle->allocSize < size) {
pQueryHandle->allocSize = size; pQueryHandle->allocSize = (int32_t)size;
char* tmp = realloc(pQueryHandle->pDataBlockInfo, pQueryHandle->allocSize); char* tmp = realloc(pQueryHandle->pDataBlockInfo, pQueryHandle->allocSize);
if (tmp == NULL) { if (tmp == NULL) {
return TSDB_CODE_TDB_OUT_OF_MEMORY; return TSDB_CODE_TDB_OUT_OF_MEMORY;
...@@ -1338,7 +1339,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO ...@@ -1338,7 +1339,7 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
memset(pQueryHandle->pDataBlockInfo, 0, size); memset(pQueryHandle->pDataBlockInfo, 0, size);
*numOfAllocBlocks = numOfBlocks; *numOfAllocBlocks = numOfBlocks;
int32_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); int32_t numOfTables = (int32_t)taosArrayGetSize(pQueryHandle->pTableCheckInfo);
SBlockOrderSupporter sup = {0}; SBlockOrderSupporter sup = {0};
sup.numOfTables = numOfTables; sup.numOfTables = numOfTables;
...@@ -1445,7 +1446,7 @@ static int32_t getDataBlocksInFilesImpl(STsdbQueryHandle* pQueryHandle, bool* ex ...@@ -1445,7 +1446,7 @@ static int32_t getDataBlocksInFilesImpl(STsdbQueryHandle* pQueryHandle, bool* ex
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
int32_t numOfBlocks = 0; int32_t numOfBlocks = 0;
int32_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); int32_t numOfTables = (int32_t)taosArrayGetSize(pQueryHandle->pTableCheckInfo);
STsdbCfg* pCfg = &pQueryHandle->pTsdb->config; STsdbCfg* pCfg = &pQueryHandle->pTsdb->config;
STimeWindow win = TSWINDOW_INITIALIZER; STimeWindow win = TSWINDOW_INITIALIZER;
...@@ -1615,10 +1616,10 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { ...@@ -1615,10 +1616,10 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
if (pQueryHandle->cur.win.ekey == pQueryHandle->window.skey) { if (pQueryHandle->cur.win.ekey == pQueryHandle->window.skey) {
// data already retrieve, discard other data rows and return // data already retrieve, discard other data rows and return
int32_t numOfCols = QH_GET_NUM_OF_COLS(pQueryHandle); int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle));
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i);
memcpy(pCol->pData, pCol->pData + pCol->info.bytes * (pQueryHandle->cur.rows-1), pCol->info.bytes); memcpy((char*)pCol->pData, (char*)pCol->pData + pCol->info.bytes * (pQueryHandle->cur.rows - 1), pCol->info.bytes);
} }
pQueryHandle->cur.win = (STimeWindow){pQueryHandle->window.skey, pQueryHandle->window.skey}; pQueryHandle->cur.win = (STimeWindow){pQueryHandle->window.skey, pQueryHandle->window.skey};
...@@ -1646,7 +1647,7 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { ...@@ -1646,7 +1647,7 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
tsdbTakeMemSnapshot(pSecQueryHandle->pTsdb, &pSecQueryHandle->mem, &pSecQueryHandle->imem); tsdbTakeMemSnapshot(pSecQueryHandle->pTsdb, &pSecQueryHandle->mem, &pSecQueryHandle->imem);
// allocate buffer in order to load data blocks from file // allocate buffer in order to load data blocks from file
int32_t numOfCols = QH_GET_NUM_OF_COLS(pQueryHandle); int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle));
pSecQueryHandle->statis = calloc(numOfCols, sizeof(SDataStatis)); pSecQueryHandle->statis = calloc(numOfCols, sizeof(SDataStatis));
pSecQueryHandle->pColumns = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); pSecQueryHandle->pColumns = taosArrayInit(numOfCols, sizeof(SColumnInfoData));
...@@ -1669,9 +1670,10 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { ...@@ -1669,9 +1670,10 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
STableCheckInfo* pCheckInfo = (STableCheckInfo*) taosArrayGet(pQueryHandle->pTableCheckInfo, j); STableCheckInfo* pCheckInfo = (STableCheckInfo*) taosArrayGet(pQueryHandle->pTableCheckInfo, j);
STableCheckInfo info = { STableCheckInfo info = {
.lastKey = pSecQueryHandle->window.skey, .lastKey = pSecQueryHandle->window.skey,
.tableId = pCheckInfo->tableId, //.tableId = pCheckInfo->tableId,
.pTableObj = pCheckInfo->pTableObj, .pTableObj = pCheckInfo->pTableObj,
}; };
info.tableId = pCheckInfo->tableId;
taosArrayPush(pSecQueryHandle->pTableCheckInfo, &info); taosArrayPush(pSecQueryHandle->pTableCheckInfo, &info);
} }
...@@ -1688,12 +1690,12 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { ...@@ -1688,12 +1690,12 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i);
memcpy(pCol->pData, pCol->pData + pCol->info.bytes * (pQueryHandle->cur.rows-1), pCol->info.bytes); memcpy((char*)pCol->pData, (char*)pCol->pData + pCol->info.bytes * (pQueryHandle->cur.rows - 1), pCol->info.bytes);
SColumnInfoData* pCol1 = taosArrayGet(pSecQueryHandle->pColumns, i); SColumnInfoData* pCol1 = taosArrayGet(pSecQueryHandle->pColumns, i);
assert(pCol->info.colId == pCol1->info.colId); assert(pCol->info.colId == pCol1->info.colId);
memcpy(pCol->pData + pCol->info.bytes, pCol1->pData, pCol1->info.bytes); memcpy((char*)pCol->pData + pCol->info.bytes, pCol1->pData, pCol1->info.bytes);
} }
SColumnInfoData* pTSCol = taosArrayGet(pQueryHandle->pColumns, 0); SColumnInfoData* pTSCol = taosArrayGet(pQueryHandle->pColumns, 0);
...@@ -1839,7 +1841,7 @@ static void changeQueryHandleForInterpQuery(TsdbQueryHandleT pHandle) { ...@@ -1839,7 +1841,7 @@ static void changeQueryHandleForInterpQuery(TsdbQueryHandleT pHandle) {
static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int maxRowsToRead, STimeWindow* win, static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int maxRowsToRead, STimeWindow* win,
STsdbQueryHandle* pQueryHandle) { STsdbQueryHandle* pQueryHandle) {
int numOfRows = 0; int numOfRows = 0;
int32_t numOfCols = taosArrayGetSize(pQueryHandle->pColumns); int32_t numOfCols = (int32_t)taosArrayGetSize(pQueryHandle->pColumns);
win->skey = TSKEY_INITIAL_VAL; win->skey = TSKEY_INITIAL_VAL;
int64_t st = taosGetTimestampUs(); int64_t st = taosGetTimestampUs();
...@@ -1881,7 +1883,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int ...@@ -1881,7 +1883,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
for(int32_t i = 0; i < numOfCols; ++i) { for(int32_t i = 0; i < numOfCols; ++i) {
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, i);
memmove(pColInfo->pData, pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes); memmove((char*)pColInfo->pData, (char*)pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes);
} }
} }
...@@ -1910,7 +1912,7 @@ void tsdbRetrieveDataBlockInfo(TsdbQueryHandleT* pQueryHandle, SDataBlockInfo* p ...@@ -1910,7 +1912,7 @@ void tsdbRetrieveDataBlockInfo(TsdbQueryHandleT* pQueryHandle, SDataBlockInfo* p
pDataBlockInfo->tid = pTable->tableId.tid; pDataBlockInfo->tid = pTable->tableId.tid;
pDataBlockInfo->rows = cur->rows; pDataBlockInfo->rows = cur->rows;
pDataBlockInfo->window = cur->win; pDataBlockInfo->window = cur->win;
pDataBlockInfo->numOfCols = QH_GET_NUM_OF_COLS(pHandle); pDataBlockInfo->numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pHandle));
} }
/* /*
...@@ -1945,7 +1947,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(TsdbQueryHandleT* pQueryHandle, SDataSta ...@@ -1945,7 +1947,7 @@ int32_t tsdbRetrieveDataBlockStatisInfo(TsdbQueryHandleT* pQueryHandle, SDataSta
pHandle->statis[i].colId = colIds[i]; pHandle->statis[i].colId = colIds[i];
} }
tsdbGetDataStatis(&pHandle->rhelper, pHandle->statis, numOfCols); tsdbGetDataStatis(&pHandle->rhelper, pHandle->statis, (int)numOfCols);
// always load the first primary timestamp column data // always load the first primary timestamp column data
SDataStatis* pPrimaryColStatis = &pHandle->statis[0]; SDataStatis* pPrimaryColStatis = &pHandle->statis[0];
...@@ -2010,11 +2012,11 @@ SArray* tsdbRetrieveDataBlock(TsdbQueryHandleT* pQueryHandle, SArray* pIdList) { ...@@ -2010,11 +2012,11 @@ SArray* tsdbRetrieveDataBlock(TsdbQueryHandleT* pQueryHandle, SArray* pIdList) {
// if the buffer is not full in case of descending order query, move the data in the front of the buffer // if the buffer is not full in case of descending order query, move the data in the front of the buffer
if (!ASCENDING_TRAVERSE(pHandle->order) && numOfRows < pHandle->outputCapacity) { if (!ASCENDING_TRAVERSE(pHandle->order) && numOfRows < pHandle->outputCapacity) {
int32_t emptySize = pHandle->outputCapacity - numOfRows; int32_t emptySize = pHandle->outputCapacity - numOfRows;
int32_t reqNumOfCols = taosArrayGetSize(pHandle->pColumns); int32_t reqNumOfCols = (int32_t)taosArrayGetSize(pHandle->pColumns);
for(int32_t i = 0; i < reqNumOfCols; ++i) { for(int32_t i = 0; i < reqNumOfCols; ++i) {
SColumnInfoData* pColInfo = taosArrayGet(pHandle->pColumns, i); SColumnInfoData* pColInfo = taosArrayGet(pHandle->pColumns, i);
memmove(pColInfo->pData, pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes); memmove((char*)pColInfo->pData, (char*)pColInfo->pData + emptySize * pColInfo->info.bytes, numOfRows * pColInfo->info.bytes);
} }
} }
...@@ -2332,7 +2334,7 @@ int32_t tsdbQuerySTableByTagCond(TSDB_REPO_T* tsdb, uint64_t uid, const char* pT ...@@ -2332,7 +2334,7 @@ int32_t tsdbQuerySTableByTagCond(TSDB_REPO_T* tsdb, uint64_t uid, const char* pT
THROW( TSDB_CODE_TDB_OUT_OF_MEMORY ); THROW( TSDB_CODE_TDB_OUT_OF_MEMORY );
} }
expr->nodeType = TSQL_NODE_EXPR; expr->nodeType = TSQL_NODE_EXPR;
expr->_node.optr = tagNameRelType; expr->_node.optr = (uint8_t)tagNameRelType;
expr->_node.pLeft = tagExpr; expr->_node.pLeft = tagExpr;
expr->_node.pRight = tbnameExpr; expr->_node.pRight = tbnameExpr;
} }
......
...@@ -56,6 +56,7 @@ static FORCE_INLINE int tsCompressTinyint(const char *const input, int inputSize ...@@ -56,6 +56,7 @@ static FORCE_INLINE int tsCompressTinyint(const char *const input, int inputSize
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -68,6 +69,7 @@ static FORCE_INLINE int tsDecompressTinyint(const char *const input, int compres ...@@ -68,6 +69,7 @@ static FORCE_INLINE int tsDecompressTinyint(const char *const input, int compres
return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_TINYINT); return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_TINYINT);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -80,6 +82,7 @@ static FORCE_INLINE int tsCompressSmallint(const char *const input, int inputSiz ...@@ -80,6 +82,7 @@ static FORCE_INLINE int tsCompressSmallint(const char *const input, int inputSiz
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -92,6 +95,7 @@ static FORCE_INLINE int tsDecompressSmallint(const char *const input, int compre ...@@ -92,6 +95,7 @@ static FORCE_INLINE int tsDecompressSmallint(const char *const input, int compre
return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_SMALLINT); return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_SMALLINT);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -104,6 +108,7 @@ static FORCE_INLINE int tsCompressInt(const char *const input, int inputSize, co ...@@ -104,6 +108,7 @@ static FORCE_INLINE int tsCompressInt(const char *const input, int inputSize, co
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -116,6 +121,7 @@ static FORCE_INLINE int tsDecompressInt(const char *const input, int compressedS ...@@ -116,6 +121,7 @@ static FORCE_INLINE int tsDecompressInt(const char *const input, int compressedS
return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_INT); return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_INT);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -128,6 +134,7 @@ static FORCE_INLINE int tsCompressBigint(const char *const input, int inputSize, ...@@ -128,6 +134,7 @@ static FORCE_INLINE int tsCompressBigint(const char *const input, int inputSize,
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -140,6 +147,7 @@ static FORCE_INLINE int tsDecompressBigint(const char *const input, int compress ...@@ -140,6 +147,7 @@ static FORCE_INLINE int tsDecompressBigint(const char *const input, int compress
return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_BIGINT); return tsDecompressINTImp(buffer, nelements, output, TSDB_DATA_TYPE_BIGINT);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -152,6 +160,7 @@ static FORCE_INLINE int tsCompressBool(const char *const input, int inputSize, c ...@@ -152,6 +160,7 @@ static FORCE_INLINE int tsCompressBool(const char *const input, int inputSize, c
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -164,6 +173,7 @@ static FORCE_INLINE int tsDecompressBool(const char *const input, int compressed ...@@ -164,6 +173,7 @@ static FORCE_INLINE int tsDecompressBool(const char *const input, int compressed
return tsDecompressBoolImp(buffer, nelements, output); return tsDecompressBoolImp(buffer, nelements, output);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -186,6 +196,7 @@ static FORCE_INLINE int tsCompressFloat(const char *const input, int inputSize, ...@@ -186,6 +196,7 @@ static FORCE_INLINE int tsCompressFloat(const char *const input, int inputSize,
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -198,6 +209,7 @@ static FORCE_INLINE int tsDecompressFloat(const char *const input, int compresse ...@@ -198,6 +209,7 @@ static FORCE_INLINE int tsDecompressFloat(const char *const input, int compresse
return tsDecompressFloatImp(buffer, nelements, output); return tsDecompressFloatImp(buffer, nelements, output);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -210,6 +222,7 @@ static FORCE_INLINE int tsCompressDouble(const char *const input, int inputSize, ...@@ -210,6 +222,7 @@ static FORCE_INLINE int tsCompressDouble(const char *const input, int inputSize,
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -222,6 +235,7 @@ static FORCE_INLINE int tsDecompressDouble(const char *const input, int compress ...@@ -222,6 +235,7 @@ static FORCE_INLINE int tsDecompressDouble(const char *const input, int compress
return tsDecompressDoubleImp(buffer, nelements, output); return tsDecompressDoubleImp(buffer, nelements, output);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -234,6 +248,7 @@ static FORCE_INLINE int tsCompressTimestamp(const char *const input, int inputSi ...@@ -234,6 +248,7 @@ static FORCE_INLINE int tsCompressTimestamp(const char *const input, int inputSi
return tsCompressStringImp(buffer, len, output, outputSize); return tsCompressStringImp(buffer, len, output, outputSize);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
...@@ -246,6 +261,7 @@ static FORCE_INLINE int tsDecompressTimestamp(const char *const input, int compr ...@@ -246,6 +261,7 @@ static FORCE_INLINE int tsDecompressTimestamp(const char *const input, int compr
return tsDecompressTimestampImp(buffer, nelements, output); return tsDecompressTimestampImp(buffer, nelements, output);
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
......
...@@ -591,6 +591,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char ...@@ -591,6 +591,7 @@ int tsDecompressTimestampImp(const char *const input, const int nelements, char
} else { } else {
assert(0); assert(0);
return -1;
} }
} }
/* --------------------------------------------Double Compression /* --------------------------------------------Double Compression
......
sql connect
sleep 3000
print ============= step1
sql create user read pass 'taosdata'
sql create user write pass 'taosdata'
sql create user manage pass 'taosdata'
sql create user a PASS 'ade' privilege -x step11
return -1
step11:
sql create user a PASS 'ade' privilege a -x step12
return -1
step12:
sql create user a PASS 'ade' privilege read -x step13
return -1
step13:
sql show users
if $rows != 6 then
return -1
endi
sql alter user read privilege read
sql alter user write privilege write
sql alter user manage privilege super
print ============= step2
sql close
sql connect write
sleep 2000
sql create database d1
sql create database d2
sql create table d1.t1 (ts timestamp, i int)
sql create table d2.t2 (ts timestamp, i int)
sql insert into d1.t1 values(now, 1)
sql insert into d2.t2 values(now, 1)
sql insert into d2.t2 values(now+1s, 2)
sql show users
if $rows != 6 then
return -1
endi
sql show databases
if $rows != 2 then
return -1
endi
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2
if $rows != 2 then
return -1
endi
sql create account t1 pass 'taosdata' -x step21
return -1
step21:
sql create user t1 pass 'taosdata' -x step22
return -1
step22:
sql alter user read pass 'taosdata' -x step23
return -1
step23:
sql create dnode $hostname2 -x step24
return -1
step24:
sql drop dnode $hostname2 -x step25
return -1
step25:
sql create mnode 192.168.0.2 -x step26
return -1
step26:
sql drop mnode 192.168.0.2 -x step27
return -1
step27:
sql drop account root -x step28
return -1
step28:
sql alter user write pass 'taosdata'
print ============= step3
sql close
sql connect read
sleep 2000
sql create database d3 -x step31
return -1
step31:
sql create table d1.t3 (ts timestamp, i int) -x step32
return -1
step32:
#sql insert into d1.t1 values(now, 2) -x step33
# return -1
#step33:
sql show accounts
if $rows != 1 then
return -1
endi
sql show users
if $rows != 6 then
return -1
endi
sql show databases
if $rows != 2 then
return -1
endi
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2
if $rows != 2 then
return -1
endi
sql sql create account t1 pass 'taosdata' -x step34
return -1
step34:
sql sql create user t1 pass 'taosdata' -x step35
return -1
step35:
print ============= step4
sql close
sql connect manage
sleep 2000
sql create database d3
sql create database d4
sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int)
sql show accounts
if $rows != 1 then
return -1
endi
sql show users
if $rows != 6 then
return -1
endi
sql show databases
if $rows != 4 then
return -1
endi
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2
if $rows != 2 then
return -1
endi
sql create account other pass 'taosdata' -x step41
return -1
step41:
sql close
sql connect
sleep 2000
sql create account other pass 'taosdata'
print ============= step5
sql close
sql connect other
sleep 2000
sql create user read pass 'taosdata' -x step51
return -1
step51:
sql create other write pass 'taosdata' -x step52
return -1
step52:
sql create user oread pass 'taosdata'
sql create user owrite pass 'taosdata'
sql create user omanage pass 'taosdata'
sql show users
print show users $rows
if $rows != 5 then
return -1
endi
sql alter user oread privilege read
sql alter user owrite privilege write
sql alter user oroot privilege super -x step53
return -1
step53:
sql alter user read privilege read -x step54
return -1
step54:
print ============= step6
sql close
sql connect owrite
sleep 2000
sql create database d1
sql create database d3
sql create table d1.t1 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int)
sql insert into d1.t1 values(now, 11)
sql insert into d3.t3 values(now, 11)
sql insert into d3.t3 values(now+1s, 12)
sql show databases
if $rows != 2 then
return -1
endi
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2 -x step6
return -1
step6:
sql select * from d3.t3
if $rows != 2 then
return -1
endi
sql sql create user t1 pass 'taosdata' -x step62
return -1
step62:
print ============= step7
sql close
sql connect oread
sleep 2000
sql create database d7 -x step71
return -1
step71:
sql show databases
if $rows != 2 then
return -1
endi
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2 -x step72
return -1
step72:
sql select * from d3.t3
if $rows != 2 then
return -1
endi
sql sql create user t1 pass 'taosdata' -x step74
return -1
step74:
print ============= step8
sql close
sql connect omanage
sleep 2000
sql create database d4
sql create table d4.t4 (ts timestamp, i int)
sql show databases
if $rows != 3 then
return -1
endi
sql select * from d1.t1
if $rows != 1 then
return -1
endi
sql select * from d2.t2 -x step82
return -1
step82:
sql select * from d3.t3
if $rows != 2 then
return -1
endi
print ============= step9
sql close
sql connect
sleep 2000
sql show databases
if $rows != 4 then
return -1
endi
sql drop user read
sql drop user manage
sql drop user write
sql close
sql connect
sleep 2000
sql drop database d1
sql drop database d2
sql drop database d3
sql drop database d4
sql connect
sleep 3000
print =============== step1
sql show users
if $rows != 3 then
return -1
endi
sql create user read PASS 'pass123'
sql create user read PASS 'pass123' -x step1
return -1
step1:
sql show users
if $rows != 4 then
return -1
endi
sql alter user read PASS 'taosdata'
print =============== step2
sql close
sql connect read
sleep 2000
sql alter user read PASS 'taosdata'
print =============== step3
sql drop user read -x step31
return -1
step31:
sql drop user _root -x step32
return -1
step32:
sql drop user monitor -x step33
return -1
step33:
print =============== step4
sql close
sql connect
sleep 2000
sql alter user read privilege read
sql show users
if $data1_read != read then
return -1
endi
sql alter user read privilege super
sql show users
if $data1_read != super then
return -1
endi
sql alter user read privilege write
sql show users
if $data1_read != write then
return -1
endi
sql alter user read privilege 1 -x step43
return -1
step43:
sql drop user _root -x step41
return -1
step41:
sql drop user monitor -x step42
return -1
step42:
sql drop user read
sql connect
sleep 3000
$i = 0
$dbPrefix = lm_us_db
$tbPrefix = lm_us_tb
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
print =============== step1
sql drop user ac -x step0
return -1
step0:
sql create user PASS '123' -x step1
return -1
step1:
sql show users
if $rows != 3 then
return -1
endi
print =============== step2
sql drop user a -x step2
step2:
sql create user a PASS '123'
sql show users
if $rows != 4 then
return -1
endi
sql drop user a
sql show users
if $rows != 3 then
return -1
endi
print =============== step3
sql drop user abc01234567890123456789 -x step3
step3:
sql create user abc01234567890123456789 PASS '123'
sql show users
if $rows != 4 then
return -1
endi
sql drop user abc01234567890123456789
sql show users
if $rows != 3 then
return -1
endi
print =============== step4
sql create user abcd0123456789012345678901234567890111 PASS '123' -x step4
return -1
step4:
sql show users
if $rows != 3 then
return -1
endi
print =============== step5
sql drop user 123 -x step5
step5:
sql create user 123 PASS '123' -x step61
return -1
step61:
sql create user a123 PASS '123'
sql show users
if $rows != 4 then
return -1
endi
sql drop user a123
sql show users
if $rows != 3 then
return -1
endi
...@@ -35,7 +35,6 @@ endi ...@@ -35,7 +35,6 @@ endi
print ======== step2 print ======== step2
sql alter table mt add column b smallint sql alter table mt add column b smallint
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -64,7 +63,6 @@ endi ...@@ -64,7 +63,6 @@ endi
print ======== step3 print ======== step3
sql alter table mt add column c tinyint sql alter table mt add column c tinyint
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -99,7 +97,6 @@ endi ...@@ -99,7 +97,6 @@ endi
print ======== step4 print ======== step4
sql alter table mt add column d int sql alter table mt add column d int
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -140,7 +137,6 @@ endi ...@@ -140,7 +137,6 @@ endi
print ======== step5 print ======== step5
sql alter table mt add column e bigint sql alter table mt add column e bigint
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -187,7 +183,6 @@ endi ...@@ -187,7 +183,6 @@ endi
print ======== step6 print ======== step6
sql alter table mt add column f float sql alter table mt add column f float
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -240,7 +235,6 @@ endi ...@@ -240,7 +235,6 @@ endi
print ======== step7 print ======== step7
sql alter table mt add column g double sql alter table mt add column g double
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -299,7 +293,6 @@ endi ...@@ -299,7 +293,6 @@ endi
print ======== step8 print ======== step8
sql alter table mt add column h binary(10) sql alter table mt add column h binary(10)
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -461,7 +454,6 @@ print ======== step11 ...@@ -461,7 +454,6 @@ print ======== step11
print ======== step12 print ======== step12
sql alter table mt drop column b sql alter table mt drop column b
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -523,7 +515,6 @@ endi ...@@ -523,7 +515,6 @@ endi
print ======== step13 print ======== step13
sql alter table mt drop column c sql alter table mt drop column c
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -579,7 +570,6 @@ endi ...@@ -579,7 +570,6 @@ endi
print ======== step14 print ======== step14
sql alter table mt drop column d sql alter table mt drop column d
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -629,7 +619,6 @@ endi ...@@ -629,7 +619,6 @@ endi
print ======== step15 print ======== step15
sql alter table mt drop column e sql alter table mt drop column e
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -673,7 +662,6 @@ endi ...@@ -673,7 +662,6 @@ endi
print ======== step16 print ======== step16
sql alter table mt drop column f sql alter table mt drop column f
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -711,7 +699,6 @@ endi ...@@ -711,7 +699,6 @@ endi
print ======== step17 print ======== step17
sql alter table mt drop column g sql alter table mt drop column g
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -743,7 +730,6 @@ endi ...@@ -743,7 +730,6 @@ endi
print ============= step18 print ============= step18
sql alter table mt drop column h sql alter table mt drop column h
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -763,7 +749,7 @@ endi ...@@ -763,7 +749,7 @@ endi
if $data21 != INT then if $data21 != INT then
return -1 return -1
endi endi
if $data30 != NULL then if $data30 != null then
return -1 return -1
endi endi
......
...@@ -28,7 +28,6 @@ endi ...@@ -28,7 +28,6 @@ endi
print ======== step2 print ======== step2
sql alter table tb add column b smallint sql alter table tb add column b smallint
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -51,7 +50,6 @@ endi ...@@ -51,7 +50,6 @@ endi
print ======== step3 print ======== step3
sql alter table tb add column c tinyint sql alter table tb add column c tinyint
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -80,7 +78,6 @@ endi ...@@ -80,7 +78,6 @@ endi
print ======== step4 print ======== step4
sql alter table tb add column d int sql alter table tb add column d int
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -115,7 +112,6 @@ endi ...@@ -115,7 +112,6 @@ endi
print ======== step5 print ======== step5
sql alter table tb add column e bigint sql alter table tb add column e bigint
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -156,7 +152,6 @@ endi ...@@ -156,7 +152,6 @@ endi
print ======== step6 print ======== step6
sql alter table tb add column f float sql alter table tb add column f float
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -203,7 +198,6 @@ endi ...@@ -203,7 +198,6 @@ endi
print ======== step7 print ======== step7
sql alter table tb add column g double sql alter table tb add column g double
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -256,7 +250,6 @@ endi ...@@ -256,7 +250,6 @@ endi
print ======== step8 print ======== step8
sql alter table tb add column h binary(10) sql alter table tb add column h binary(10)
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -406,7 +399,6 @@ step115: ...@@ -406,7 +399,6 @@ step115:
print ======== step12 print ======== step12
sql alter table tb drop column b sql alter table tb drop column b
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -462,7 +454,6 @@ endi ...@@ -462,7 +454,6 @@ endi
print ======== step13 print ======== step13
sql alter table tb drop column c sql alter table tb drop column c
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -512,7 +503,6 @@ endi ...@@ -512,7 +503,6 @@ endi
print ======== step14 print ======== step14
sql alter table tb drop column d sql alter table tb drop column d
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -556,7 +546,6 @@ endi ...@@ -556,7 +546,6 @@ endi
print ======== step15 print ======== step15
sql alter table tb drop column e sql alter table tb drop column e
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -594,7 +583,6 @@ endi ...@@ -594,7 +583,6 @@ endi
print ======== step16 print ======== step16
sql alter table tb drop column f sql alter table tb drop column f
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -626,7 +614,6 @@ endi ...@@ -626,7 +614,6 @@ endi
print ======== step17 print ======== step17
sql alter table tb drop column g sql alter table tb drop column g
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -652,7 +639,6 @@ endi ...@@ -652,7 +639,6 @@ endi
print ============= step18 print ============= step18
sql alter table tb drop column h sql alter table tb drop column h
sleep 2500
sql describe tb sql describe tb
if $data00 != ts then if $data00 != ts then
return -1 return -1
...@@ -666,7 +652,7 @@ endi ...@@ -666,7 +652,7 @@ endi
if $data11 != INT then if $data11 != INT then
return -1 return -1
endi endi
if $data20 != NULL then if $data20 != null then
return -1 return -1
endi endi
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_di_db $dbPrefix = m_di_db
$tbPrefix = m_di_tb $tbPrefix = m_di_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_fi_db $dbPrefix = m_fi_db
$tbPrefix = m_fi_tb $tbPrefix = m_fi_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_in_db $dbPrefix = m_in_db
$tbPrefix = m_in_tb $tbPrefix = m_in_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_la_db $dbPrefix = m_la_db
$tbPrefix = m_la_tb $tbPrefix = m_la_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_le_db $dbPrefix = m_le_db
$tbPrefix = m_le_tb $tbPrefix = m_le_tb
...@@ -15,7 +15,7 @@ $mt = $mtPrefix . $i ...@@ -15,7 +15,7 @@ $mt = $mtPrefix . $i
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db sql create database $db keep 36500
sql use $db sql use $db
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int) sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol int)
...@@ -43,41 +43,41 @@ $tb = $tbPrefix . $i ...@@ -43,41 +43,41 @@ $tb = $tbPrefix . $i
sql select leastsquares(tbcol, 1, 1) from $tb sql select leastsquares(tbcol, 1, 1) from $tb
print ===> $data00 print ===> $data00
if $data00 != @(1.000000, 1.000000)@ then if $data00 != @{slop:1.000000, intercept:1.000000}@ then
return -1 return -1
endi endi
print =============== step3 print =============== step3
sql select leastsquares(tbcol, 1, 1) from $tb where ts < now + 4m sql select leastsquares(tbcol, 1, 1) from $tb where ts < now + 4m
print ===> $data00 print ===> $data00
if $data00 != @(1.000000, 1.000000)@ then if $data00 != @{slop:1.000000, intercept:1.000000}@ then
return -1 return -1
endi endi
print =============== step4 print =============== step4
sql select leastsquares(tbcol, 1, 1) as b from $tb sql select leastsquares(tbcol, 1, 1) as b from $tb
print ===> $data00 print ===> $data00
if $data00 != @(1.000000, 1.000000)@ then if $data00 != @{slop:1.000000, intercept:1.000000}@ then
return -1 return -1
endi endi
print =============== step5 print =============== step5
sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m) sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1m)
print ===> $data01 print ===> $data01
if $data01 != @(1.000000, 1.000000)@ then if $data01 != @{slop:1.000000, intercept:1.000000}@ then
return -1 return -1
endi endi
sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1d) sql select leastsquares(tbcol, 1, 1) as b from $tb interval(1d)
print ===> $data01 print ===> $data01
if $data01 != @(1.000000, 1.000000)@ then if $data01 != @{slop:1.000000, intercept:1.000000}@ then
return -1 return -1
endi endi
print =============== step6 print =============== step6
sql select leastsquares(tbcol, 1, 1) as b from $tb where ts < now + 4m interval(1m) sql select leastsquares(tbcol, 1, 1) as b from $tb where ts < now + 4m interval(1m)
print ===> $data01 print ===> $data01
if $data01 != @(1.000000, 1.000000)@ then if $data01 != @{slop:1.000000, intercept:1.000000}@ then
return -1 return -1
endi endi
print ===> $rows print ===> $rows
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_ma_db $dbPrefix = m_ma_db
$tbPrefix = m_ma_tb $tbPrefix = m_ma_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_mi_db $dbPrefix = m_mi_db
$tbPrefix = m_mi_tb $tbPrefix = m_mi_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_pe_db $dbPrefix = m_pe_db
$tbPrefix = m_pe_tb $tbPrefix = m_pe_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_st_db $dbPrefix = m_st_db
$tbPrefix = m_st_tb $tbPrefix = m_st_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_su_db $dbPrefix = m_su_db
$tbPrefix = m_su_tb $tbPrefix = m_su_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
$dbPrefix = m_to_db $dbPrefix = m_to_db
$tbPrefix = m_to_tb $tbPrefix = m_to_tb
......
sql connect
sleep 3000 sleep 3000
sql connect
print ============================ dnode1 start print ============================ dnode1 start
$i = 0 $i = 0
...@@ -9,7 +10,7 @@ $db = $dbPrefix . $i ...@@ -9,7 +10,7 @@ $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
print =============== step1 print =============== step1
sql create database $db replica 1 days 20 keep 2000 sql create database $db replica 1 days 20 keep 2000 cache 16
sql show databases sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then if $data00 != $db then
...@@ -24,10 +25,10 @@ endi ...@@ -24,10 +25,10 @@ endi
if $data04 != 1 then if $data04 != 1 then
return -1 return -1
endi endi
if $data05 != 20 then if $data06 != 20 then
return -1 return -1
endi endi
if $data07 != 1000 then if $data08 != 16 then
return -1 return -1
endi endi
...@@ -46,7 +47,7 @@ if $rows != 0 then ...@@ -46,7 +47,7 @@ if $rows != 0 then
endi endi
print =============== step4 print =============== step4
sql drop database $db sql_error drop database $db
print =============== step5 print =============== step5
sql create database $db replica 1 days 15 keep 1500 sql create database $db replica 1 days 15 keep 1500
...@@ -64,11 +65,7 @@ endi ...@@ -64,11 +65,7 @@ endi
if $data04 != 1 then if $data04 != 1 then
return -1 return -1
endi endi
if $data05 != 15 then if $data06 != 15 then
return -1
endi
if $data07 != 1000 then
return -1 return -1
endi endi
...@@ -95,9 +92,7 @@ $db = $dbPrefix . $i ...@@ -95,9 +92,7 @@ $db = $dbPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql create database $db sql create database $db
sql use $db sql use $db
sql create table $tb (ts timestamp, speed int) -x step6 sql create table $tb (ts timestamp, speed int)
return -1
step6:
print =============== step7 print =============== step7
$i = 0 $i = 0
......
sql connect
sleep 3000 sleep 3000
sql connect
print =============== step1 print =============== step1
sql drop database dd sql_error drop database dd
sql create database -x step1 sql create database -x step1
return -1 return -1
...@@ -40,7 +40,7 @@ if $rows != 0 then ...@@ -40,7 +40,7 @@ if $rows != 0 then
endi endi
print =============== step4 print =============== step4
sql create database a012345678901201234567890120123456789012 -x step4 sql create database a012345678901201234567890120123456789012a012345678901201234567890120123456789012 -x step4
return -1 return -1
step4: step4:
sql show databases sql show databases
......
...@@ -55,17 +55,10 @@ if $rows != 75 then ...@@ -55,17 +55,10 @@ if $rows != 75 then
return -1 return -1
endi endi
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol -x step13 print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1'
return -1 sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol
step13: sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol -x step14
return -1
step14:
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol -x step15
return -1
step15:
#can't filter binary fields #can't filter binary fields
......
...@@ -6,111 +6,112 @@ sql use ibadb ...@@ -6,111 +6,112 @@ sql use ibadb
sql create table tb(ts timestamp, i int) sql create table tb(ts timestamp, i int)
print ================= step1 print ================= step1
sql import into tb values(10000, 10000)
sql import into tb values(1564641710000, 10000)
sql select * from tb; sql select * from tb;
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
print ================= step2 print ================= step2
sql insert into tb values(8000, 8000) sql insert into tb values(1564641708000, 8000)
sql select * from tb; sql select * from tb;
if $rows != 1 then if $rows != 2 then
return -1 return -1
endi endi
print ================= step3 print ================= step3
sql insert into tb values(20000, 20000) sql insert into tb values(1564641720000, 20000)
sql select * from tb; sql select * from tb;
if $rows != 2 then if $rows != 3 then
return -1 return -1
endi endi
print ================= step4 print ================= step4
sql import into tb values(8000, 8000) sql import into tb values(1564641708000, 8000)
sql import into tb values(15000, 15000) sql import into tb values(1564641715000, 15000)
sql import into tb values(30000, 30000) sql import into tb values(1564641730000, 30000)
sql select * from tb; sql select * from tb;
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print ================= step5 print ================= step5
sql insert into tb values(8000, 8000) sql insert into tb values(1564641708000, 8000)
sql insert into tb values(14000, 14000) sql insert into tb values(1564641714000, 14000)
sql insert into tb values(25000, 25000) sql insert into tb values(1564641725000, 25000)
sql insert into tb values(40000, 40000) sql insert into tb values(1564641740000, 40000)
sql select * from tb; sql select * from tb;
if $rows != 6 then if $rows != 8 then
return -1 return -1
endi endi
print ================= step6 print ================= step6
sql import into tb values(7000, 7000) sql import into tb values(1564641707000, 7000)
sql import into tb values(12000, 12000) sql import into tb values(1564641712000, 12000)
sql import into tb values(23000, 23000) sql import into tb values(1564641723000, 23000)
sql import into tb values(34000, 34000) sql import into tb values(1564641734000, 34000)
sql import into tb values(50000, 50000) sql import into tb values(1564641750000, 50000)
sql select * from tb; sql select * from tb;
if $rows != 11 then if $rows != 13 then
return -1 return -1
endi endi
print ================= step7 print ================= step7
sql import into tb values(7001, 7001) sql import into tb values(1564641707001, 7001)
sql import into tb values(12001, 12001) sql import into tb values(1564641712001, 12001)
sql import into tb values(23001, 23001) sql import into tb values(1564641723001, 23001)
sql import into tb values(34001, 34001) sql import into tb values(1564641734001, 34001)
sql import into tb values(50001, 50001) sql import into tb values(1564641750001, 50001)
sql select * from tb; sql select * from tb;
if $rows != 16 then if $rows != 18 then
return -1 return -1
endi endi
print ================= step8 print ================= step8
sql insert into tb values(8002, 8002) sql insert into tb values(1564641708002, 8002)
sql insert into tb values(14002, 14002) sql insert into tb values(1564641714002, 14002)
sql insert into tb values(25002, 25002) sql insert into tb values(1564641725002, 25002)
sql insert into tb values(200000, 60000) sql insert into tb values(1564641900000, 200000)
sql select * from tb; sql select * from tb;
if $rows != 17 then if $rows != 22 then
return -1 return -1
endi endi
print ================= step9 only insert last one print ================= step9 only insert last one
sql import into tb values(5000, 5000)(18000, 18000)(700000, 700000) sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 700000)
sql select * from tb; sql select * from tb;
if $rows != 18 then if $rows != 25 then
return -1 return -1
endi endi
print ================= step10 print ================= step10
sql import into tb values(5000, 5000)(18000, 18000)(700000, 70000) sql import into tb values(1564641705000, 5000)(1564641718000, 18000)(1564642400000, 70000)
sql select * from tb; sql select * from tb;
if $rows != 19 then if $rows != 25 then
return -1 return -1
endi endi
print ================= step11 print ================= step11
sql import into tb values(700000, 700000) sql import into tb values(1564642400000, 700000)
sql select * from tb; sql select * from tb;
if $rows != 19 then if $rows != 25 then
return -1 return -1
endi endi
print ================= step12 print ================= step12
sql import into tb values(9527, 9527)(9527, 9528) sql import into tb values(1564641709527, 9527)(1564641709527, 9528)
sql select * from tb; sql select * from tb;
print rows=> $rows print rows=> $rows
if $rows != 21 then if $rows != 26 then
return -1 return -1
endi endi
print ================= step13 print ================= step13
sql import into tb values(9898, 9898)(9897, 9897) sql import into tb values(1564641709898, 9898)(1564641709897, 9897)
sql select * from tb; sql select * from tb;
print rows=> $rows print rows=> $rows
if $rows != 23 then if $rows != 28 then
return -1 return -1
endi endi
......
...@@ -22,20 +22,20 @@ while $x < 10 ...@@ -22,20 +22,20 @@ while $x < 10
endw endw
print =============== step 2 print =============== step 2
sql insert into $tb values (now - 5m , 10) -x error_insert sql insert into $tb values (now - 5m , 10)
sql insert into $tb values (now - 6m , 10) -x error_insert sql insert into $tb values (now - 6m , 10)
sql insert into $tb values (now - 7m , 10) -x error_insert sql insert into $tb values (now - 7m , 10)
sql insert into $tb values (now - 8m , 10) -x error_insert sql insert into $tb values (now - 8m , 10)
error_insert:
sql select * from $tb sql select * from $tb
print $rows points data are retrieved print $rows points data are retrieved
if $rows != 10 then if $rows != 14 then
return -1 return -1
endi endi
sql drop database $db sql drop database $db
sleep 1000
sql show databases sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
......
...@@ -27,7 +27,7 @@ $N = 20000 ...@@ -27,7 +27,7 @@ $N = 20000
$x = 0 $x = 0
while $x < $N while $x < $N
$ms = $x . m $ms = $x . s
#print insert into $tb values (now + $ms , $x ) #print insert into $tb values (now + $ms , $x )
sql insert into $tb values (now + $ms , $x ) -x error_insert sql insert into $tb values (now + $ms , $x ) -x error_insert
$x = $x + 1 $x = $x + 1
......
...@@ -38,7 +38,8 @@ if $data00 != 23456 then ...@@ -38,7 +38,8 @@ if $data00 != 23456 then
endi endi
print =============== step4 print =============== step4
sql insert into $tb values (now+3a, '345678') sql_error insert into $tb values (now+3a, '345678')
sql insert into $tb values (now+3a, '34567')
sql select speed from $tb order by ts desc sql select speed from $tb order by ts desc
if $rows != 3 then if $rows != 3 then
return -1 return -1
......
...@@ -19,7 +19,7 @@ if $rows != 1 then ...@@ -19,7 +19,7 @@ if $rows != 1 then
return -1 return -1
endi endi
if $data01 != true then if $data01 != 1 then
return -1 return -1
endi endi
...@@ -30,7 +30,7 @@ if $rows != 2 then ...@@ -30,7 +30,7 @@ if $rows != 2 then
return -1 return -1
endi endi
if $data01 != true then if $data01 != 1 then
return -1 return -1
endi endi
...@@ -41,7 +41,7 @@ if $rows != 3 then ...@@ -41,7 +41,7 @@ if $rows != 3 then
return -1 return -1
endi endi
if $data01 != true then if $data01 != 1 then
return -1 return -1
endi endi
...@@ -52,7 +52,7 @@ if $rows != 4 then ...@@ -52,7 +52,7 @@ if $rows != 4 then
return -1 return -1
endi endi
if $data01 != false then if $data01 != 0 then
return -1 return -1
endi endi
...@@ -63,7 +63,7 @@ if $rows != 5 then ...@@ -63,7 +63,7 @@ if $rows != 5 then
return -1 return -1
endi endi
if $data01 != true then if $data01 != 1 then
return -1 return -1
endi endi
...@@ -74,7 +74,7 @@ if $rows != 6 then ...@@ -74,7 +74,7 @@ if $rows != 6 then
return -1 return -1
endi endi
if $data01 != false then if $data01 != 0 then
return -1 return -1
endi endi
......
...@@ -29,13 +29,12 @@ if $rows != 0 then ...@@ -29,13 +29,12 @@ if $rows != 0 then
endi endi
print =============== step2 print =============== step2
sql create table $tb (ts timestamp, speed bigint, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -x step2 sql create table $tb (ts timestamp, speed bigint, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500))
return -1
step2:
sql show tables sql show tables
if $rows != 0 then if $rows != 1 then
return -1 return -1
endi endi
sql drop table $tb
print =============== step3 print =============== step3
sql create table $tb (ts timestamp, speed float, v1 binary(100), v2 binary(100), v3 binary(100), v4 binary(100), v5 binary(100)) sql create table $tb (ts timestamp, speed float, v1 binary(100), v2 binary(100), v3 binary(100), v4 binary(100), v5 binary(100))
...@@ -56,11 +55,9 @@ if $rows != 0 then ...@@ -56,11 +55,9 @@ if $rows != 0 then
endi endi
print =============== step4 print =============== step4
sql create table $tb (ts timestamp, speed double, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500)) -x step4 sql create table $tb (ts timestamp, speed double, v1 binary(1500), v2 binary(1500), v3 binary(1500), v4 binary(500), v5 binary(500))
return -1
step4:
sql show tables sql show tables
if $rows != 0 then if $rows != 1 then
return -1 return -1
endi endi
......
...@@ -31,7 +31,7 @@ sql select * from $tb order by ts desc ...@@ -31,7 +31,7 @@ sql select * from $tb order by ts desc
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data01 != 2.8500 then if $data01 != 2.85000 then
return -1 return -1
endi endi
...@@ -41,7 +41,7 @@ sql select * from $tb order by ts desc ...@@ -41,7 +41,7 @@ sql select * from $tb order by ts desc
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
if $data01 != 3.4000 then if $data01 != 3.40000 then
return -1 return -1
endi endi
...@@ -54,7 +54,7 @@ sql select * from $tb order by ts desc ...@@ -54,7 +54,7 @@ sql select * from $tb order by ts desc
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data01 != 0.0000 then if $data01 != 0.00000 then
return -1 return -1
endi endi
...@@ -67,7 +67,7 @@ sql select * from $tb order by ts desc ...@@ -67,7 +67,7 @@ sql select * from $tb order by ts desc
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
if $data01 != 2.0000 then if $data01 != 2.00000 then
return -1 return -1
endi endi
...@@ -80,7 +80,7 @@ sql select * from $tb order by ts desc ...@@ -80,7 +80,7 @@ sql select * from $tb order by ts desc
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
if $data01 != 2.0000 then if $data01 != 2.00000 then
return -1 return -1
endi endi
......
...@@ -58,7 +58,7 @@ sql create table $tb (ts timestamp, val float, val2 float) ...@@ -58,7 +58,7 @@ sql create table $tb (ts timestamp, val float, val2 float)
sql insert into $tb values(now, 5, 5) sql insert into $tb values(now, 5, 5)
sql select * from $tb sql select * from $tb
print ==> $data01 $data02 print ==> $data01 $data02
if $data01 != 5.0000 then if $data01 != 5.00000 then
return -1 return -1
endi endi
...@@ -162,7 +162,7 @@ endi ...@@ -162,7 +162,7 @@ endi
sql insert into $tb values(now, 5, 5) sql insert into $tb values(now, 5, 5)
sql select * from $tb sql select * from $tb
print ==> $data01 $data02 print ==> $data01 $data02
if $data01 != 5.0000 then if $data01 != 5.00000 then
return -1 return -1
endi endi
......
...@@ -51,7 +51,7 @@ if $rows != 0 then ...@@ -51,7 +51,7 @@ if $rows != 0 then
endi endi
print =============== step4 print =============== step4
sql create table ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789 (ts timestamp, speed int) -x step4 sql create table ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789ab01234567890123456789a0123456789a0123456789 (ts timestamp, speed int) -x step4
return -1 return -1
step4: step4:
sql show tables sql show tables
......
...@@ -30,7 +30,7 @@ endi ...@@ -30,7 +30,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -40,7 +40,7 @@ endi ...@@ -40,7 +40,7 @@ endi
sql alter table $mt drop tag tgcol2 sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 int sql alter table $mt add tag tgcol4 int
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4 =4 sql alter table $tb set tag tgcol4 =4
sql reset query cache sql reset query cache
sql select * from $mt where tgcol4 = 4 sql select * from $mt where tgcol4 = 4
...@@ -51,7 +51,7 @@ endi ...@@ -51,7 +51,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 4 then if $data03 != 4 then
...@@ -86,7 +86,7 @@ endi ...@@ -86,7 +86,7 @@ endi
sql alter table $mt drop tag tgcol2 sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 tinyint sql alter table $mt add tag tgcol4 tinyint
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql reset query cache sql reset query cache
sql select * from $mt where tgcol4 = 4 sql select * from $mt where tgcol4 = 4
...@@ -125,28 +125,29 @@ endi ...@@ -125,28 +125,29 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
sql describe $tb sql describe $tb
print sql describe $tb
if $data21 != BIGINT then if $data21 != BIGINT then
return -1 return -1
endi endi
if $data31 != FLOAT then if $data31 != FLOAT then
return -1 return -1
endi endi
if $data23 != 1 then if $data23 != TAG then
return -1 return -1
endi endi
if $data33 != 2.000000 then if $data33 != TAG then
return -1 return -1
endi endi
sql alter table $mt drop tag tgcol2 sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 float sql alter table $mt add tag tgcol4 float
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql reset query cache sql reset query cache
sql select * from $mt where tgcol4 = 4 sql select * from $mt where tgcol4 = 4
...@@ -160,7 +161,7 @@ endi ...@@ -160,7 +161,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 4.0000 then if $data03 != 4.00000 then
return -1 return -1
endi endi
...@@ -192,7 +193,7 @@ endi ...@@ -192,7 +193,7 @@ endi
sql alter table $mt drop tag tgcol2 sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 smallint sql alter table $mt add tag tgcol4 smallint
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql reset query cache sql reset query cache
sql select * from $mt where tgcol4 = 4 sql select * from $mt where tgcol4 = 4
...@@ -228,7 +229,7 @@ endi ...@@ -228,7 +229,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -245,9 +246,9 @@ sql alter table $mt add tag tgcol5 binary(10) ...@@ -245,9 +246,9 @@ sql alter table $mt add tag tgcol5 binary(10)
sql alter table $mt add tag tgcol6 binary(10) sql alter table $mt add tag tgcol6 binary(10)
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=false sql alter table $tb set tag tgcol4=false
sql alter table $tb set tgcol5=5 sql alter table $tb set tag tgcol5=5
sql alter table $tb set tgcol6=6 sql alter table $tb set tag tgcol6=6
sql reset query cache sql reset query cache
sql select * from $mt where tgcol5 = '5' sql select * from $mt where tgcol5 = '5'
...@@ -258,7 +259,7 @@ endi ...@@ -258,7 +259,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != false then if $data02 != 0 then
return -1 return -1
endi endi
if $data03 != 5 then if $data03 != 5 then
...@@ -276,7 +277,7 @@ endi ...@@ -276,7 +277,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != false then if $data02 != 0 then
return -1 return -1
endi endi
if $data03 != 5 then if $data03 != 5 then
...@@ -325,9 +326,9 @@ sql alter table $mt add tag tgcol5 bigint ...@@ -325,9 +326,9 @@ sql alter table $mt add tag tgcol5 bigint
sql alter table $mt add tag tgcol6 tinyint sql alter table $mt add tag tgcol6 tinyint
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql alter table $tb set tgcol5=5 sql alter table $tb set tag tgcol5=5
sql alter table $tb set tgcol6=6 sql alter table $tb set tag tgcol6=6
sql reset query cache sql reset query cache
sql select * from $mt where tgcol6 = 6 sql select * from $mt where tgcol6 = 6
...@@ -372,7 +373,7 @@ endi ...@@ -372,7 +373,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
if $data04 != 3 then if $data04 != 3 then
...@@ -385,9 +386,9 @@ sql alter table $mt drop tag tgcol3 ...@@ -385,9 +386,9 @@ sql alter table $mt drop tag tgcol3
sql alter table $mt add tag tgcol5 binary(17) sql alter table $mt add tag tgcol5 binary(17)
sql alter table $mt add tag tgcol6 bool sql alter table $mt add tag tgcol6 bool
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql alter table $tb set tgcol5=5 sql alter table $tb set tag tgcol5=5
sql alter table $tb set tgcol6=true sql alter table $tb set tag tgcol6=1
sql reset query cache sql reset query cache
sql select * from $mt where tgcol5 = '5' sql select * from $mt where tgcol5 = '5'
...@@ -405,7 +406,7 @@ endi ...@@ -405,7 +406,7 @@ endi
if $data03 != 5 then if $data03 != 5 then
return -1 return -1
endi endi
if $data04 != true then if $data04 != 1 then
return -1 return -1
endi endi
...@@ -447,12 +448,12 @@ sql alter table $mt add tag tgcol5 bool ...@@ -447,12 +448,12 @@ sql alter table $mt add tag tgcol5 bool
sql alter table $mt add tag tgcol6 float sql alter table $mt add tag tgcol6 float
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql alter table $tb set tgcol5=true sql alter table $tb set tag tgcol5=1
sql alter table $tb set tgcol6=6 sql alter table $tb set tag tgcol6=6
sql reset query cache sql reset query cache
sql select * from $mt where tgcol5 = true sql select * from $mt where tgcol5 = 1
print $data01 $data02 $data03 print $data01 $data02 $data03
if $rows != 1 then if $rows != 1 then
return -1 return -1
...@@ -463,10 +464,10 @@ endi ...@@ -463,10 +464,10 @@ endi
if $data02 != 4.000000000 then if $data02 != 4.000000000 then
return -1 return -1
endi endi
if $data03 != true then if $data03 != 1 then
return -1 return -1
endi endi
if $data04 != 6.0000 then if $data04 != 6.00000 then
return -1 return -1
endi endi
...@@ -516,8 +517,8 @@ sql alter table $mt add tag tgcol4 binary(10) ...@@ -516,8 +517,8 @@ sql alter table $mt add tag tgcol4 binary(10)
sql alter table $mt add tag tgcol5 bool sql alter table $mt add tag tgcol5 bool
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql alter table $tb set tgcol5=false sql alter table $tb set tag tgcol5=false
sql reset query cache sql reset query cache
sql select * from $mt where tgcol4 = '4' sql select * from $mt where tgcol4 = '4'
...@@ -534,10 +535,10 @@ endi ...@@ -534,10 +535,10 @@ endi
if $data03 != 4 then if $data03 != 4 then
return -1 return -1
endi endi
if $data04 != false then if $data04 != 0 then
return -1 return -1
endi endi
if $data05 != NULL then if $data05 != null then
return -1 return -1
endi endi
...@@ -562,7 +563,7 @@ endi ...@@ -562,7 +563,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -571,7 +572,7 @@ endi ...@@ -571,7 +572,7 @@ endi
if $data04 != 3 then if $data04 != 3 then
return -1 return -1
endi endi
if $data05 != 4.0000 then if $data05 != 4.00000 then
return -1 return -1
endi endi
if $data06 != 5 then if $data06 != 5 then
...@@ -594,11 +595,11 @@ sql alter table $mt add tag tgcol7 bigint ...@@ -594,11 +595,11 @@ sql alter table $mt add tag tgcol7 bigint
sql alter table $mt add tag tgcol8 smallint sql alter table $mt add tag tgcol8 smallint
sql reset query cache sql reset query cache
sql alter table $tb set tgcol4=4 sql alter table $tb set tag tgcol4=4
sql alter table $tb set tgcol5=5 sql alter table $tb set tag tgcol5=5
sql alter table $tb set tgcol6=6 sql alter table $tb set tag tgcol6=6
sql alter table $tb set tgcol7=7 sql alter table $tb set tag tgcol7=7
sql alter table $tb set tgcol8=8 sql alter table $tb set tag tgcol8=8
sql reset query cache sql reset query cache
sql select * from $mt where tgcol5 =5 sql select * from $mt where tgcol5 =5
...@@ -609,7 +610,7 @@ endi ...@@ -609,7 +610,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 4 then if $data03 != 4 then
...@@ -652,13 +653,13 @@ endi ...@@ -652,13 +653,13 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
return -1 return -1
endi endi
if $data04 != 3.0000 then if $data04 != 3.00000 then
return -1 return -1
endi endi
if $data05 != 4.000000000 then if $data05 != 4.000000000 then
...@@ -682,12 +683,12 @@ sql alter table $mt add tag tgcol4 binary(10) ...@@ -682,12 +683,12 @@ sql alter table $mt add tag tgcol4 binary(10)
sql alter table $mt add tag tgcol5 bigint sql alter table $mt add tag tgcol5 bigint
sql reset query cache sql reset query cache
sql alter table $tb set tgcol1=false sql alter table $tb set tag tgcol1=false
sql alter table $tb set tgcol2=5 sql alter table $tb set tag tgcol2=5
sql alter table $tb set tgcol3=4 sql alter table $tb set tag tgcol3=4
sql alter table $tb set tgcol4=3 sql alter table $tb set tag tgcol4=3
sql alter table $tb set tgcol5=2 sql alter table $tb set tag tgcol5=2
sql alter table $tb set tgcol6=1 sql alter table $tb set tag tgcol6=1
sql reset query cache sql reset query cache
sql select * from $mt where tgcol4 = '3' sql select * from $mt where tgcol4 = '3'
...@@ -698,7 +699,7 @@ endi ...@@ -698,7 +699,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != false then if $data02 != 0 then
return -1 return -1
endi endi
if $data03 != 1 then if $data03 != 1 then
...@@ -779,12 +780,12 @@ sql alter table $mt add tag tgcol4 int ...@@ -779,12 +780,12 @@ sql alter table $mt add tag tgcol4 int
sql alter table $mt add tag tgcol6 bigint sql alter table $mt add tag tgcol6 bigint
sql reset query cache sql reset query cache
sql alter table $tb set tgcol1=7 sql alter table $tb set tag tgcol1=7
sql alter table $tb set tgcol2=8 sql alter table $tb set tag tgcol2=8
sql alter table $tb set tgcol3=9 sql alter table $tb set tag tgcol3=9
sql alter table $tb set tgcol4=10 sql alter table $tb set tag tgcol4=10
sql alter table $tb set tgcol5=11 sql alter table $tb set tag tgcol5=11
sql alter table $tb set tgcol6=12 sql alter table $tb set tag tgcol6=12
sql reset query cache sql reset query cache
sql select * from $mt where tgcol2 = '8' sql select * from $mt where tgcol2 = '8'
...@@ -826,6 +827,8 @@ sql alter table $mt add tag tgcol3 binary(10) ...@@ -826,6 +827,8 @@ sql alter table $mt add tag tgcol3 binary(10)
sql alter table $mt add tag tgcol4 int sql alter table $mt add tag tgcol4 int
sql alter table $mt add tag tgcol5 bigint sql alter table $mt add tag tgcol5 bigint
sql alter table $mt add tag tgcol6 bigint sql alter table $mt add tag tgcol6 bigint
return
sql alter table $mt add tag tgcol7 bigint -x step141 sql alter table $mt add tag tgcol7 bigint -x step141
return -1 return -1
step141: step141:
......
...@@ -30,7 +30,7 @@ endi ...@@ -30,7 +30,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -43,9 +43,9 @@ step21: ...@@ -43,9 +43,9 @@ step21:
sql alter table $mt change tag tgcol1 tgcol2 -x step22 sql alter table $mt change tag tgcol1 tgcol2 -x step22
return -1 return -1
step22: step22:
sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 #sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20
return -1 # return -1
step20: #step20:
sql alter table $mt change tag tgcol1 tgcol3 sql alter table $mt change tag tgcol1 tgcol3
sql alter table $mt change tag tgcol2 tgcol4 sql alter table $mt change tag tgcol2 tgcol4
...@@ -94,7 +94,7 @@ endi ...@@ -94,7 +94,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
...@@ -191,7 +191,7 @@ endi ...@@ -191,7 +191,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -206,7 +206,7 @@ endi ...@@ -206,7 +206,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -278,7 +278,7 @@ endi ...@@ -278,7 +278,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
...@@ -293,7 +293,7 @@ endi ...@@ -293,7 +293,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
...@@ -386,7 +386,7 @@ endi ...@@ -386,7 +386,7 @@ endi
if $data06 != 6 then if $data06 != 6 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -413,7 +413,7 @@ endi ...@@ -413,7 +413,7 @@ endi
if $data06 != 6 then if $data06 != 6 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -440,7 +440,7 @@ endi ...@@ -440,7 +440,7 @@ endi
if $data06 != 6 then if $data06 != 6 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -467,7 +467,7 @@ endi ...@@ -467,7 +467,7 @@ endi
if $data06 != 6 then if $data06 != 6 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -494,7 +494,7 @@ endi ...@@ -494,7 +494,7 @@ endi
if $data06 != 6 then if $data06 != 6 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
......
...@@ -127,6 +127,7 @@ if $data01 != 1 then ...@@ -127,6 +127,7 @@ if $data01 != 1 then
endi endi
sql select * from $mt where tgcol = 0 sql select * from $mt where tgcol = 0
if $rows != 0 then if $rows != 0 then
print expect 0, actual: $rows
return -1 return -1
endi endi
...@@ -177,6 +178,7 @@ sql create table $tb using $mt tags( 1, 2 ) ...@@ -177,6 +178,7 @@ sql create table $tb using $mt tags( 1, 2 )
sql insert into $tb values(now, 1) sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = 2 sql select * from $mt where tgcol2 = 2
if $rows != 1 then if $rows != 1 then
print expect 1, actual: $rows
return -1 return -1
endi endi
if $data01 != 1 then if $data01 != 1 then
...@@ -569,7 +571,7 @@ $i = 30 ...@@ -569,7 +571,7 @@ $i = 30
$mt = $mtPrefix . $i $mt = $mtPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30 sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(250), tgcol2 binary(250), tgcol3 binary(30)) -x step30
return -1 # return -1
step30: step30:
print =============== step31 print =============== step31
...@@ -577,7 +579,8 @@ $i = 31 ...@@ -577,7 +579,8 @@ $i = 31
$mt = $mtPrefix . $i $mt = $mtPrefix . $i
$tb = $tbPrefix . $i $tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(5)) sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol binary(5))
sql create table $tb using $mt tags('1234567') sql_error create table $tb using $mt tags('1234567')
sql create table $tb using $mt tags('12345')
sql insert into $tb values(now, 1) sql insert into $tb values(now, 1)
sql select * from $mt sql select * from $mt
print sql select * from $mt print sql select * from $mt
......
...@@ -30,7 +30,7 @@ endi ...@@ -30,7 +30,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -79,7 +79,7 @@ endi ...@@ -79,7 +79,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
...@@ -90,7 +90,7 @@ endi ...@@ -90,7 +90,7 @@ endi
if $data31 != FLOAT then if $data31 != FLOAT then
return -1 return -1
endi endi
if $data23 != 1 then if $data23 != TAG then
return -1 return -1
endi endi
...@@ -139,7 +139,7 @@ endi ...@@ -139,7 +139,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -195,13 +195,13 @@ endi ...@@ -195,13 +195,13 @@ endi
if $data42 != 10 then if $data42 != 10 then
return -1 return -1
endi endi
if $data23 != 1 then if $data23 != TAG then
return -1 return -1
endi endi
if $data33 != 2 then if $data33 != TAG then
return -1 return -1
endi endi
if $data43 != 3 then if $data43 != TAG then
return -1 return -1
endi endi
...@@ -225,7 +225,7 @@ endi ...@@ -225,7 +225,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
if $data04 != 3 then if $data04 != 3 then
...@@ -307,7 +307,7 @@ endi ...@@ -307,7 +307,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -316,7 +316,7 @@ endi ...@@ -316,7 +316,7 @@ endi
if $data04 != 3 then if $data04 != 3 then
return -1 return -1
endi endi
if $data05 != 4.0000 then if $data05 != 4.00000 then
return -1 return -1
endi endi
if $data06 != 5 then if $data06 != 5 then
...@@ -341,13 +341,13 @@ endi ...@@ -341,13 +341,13 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
return -1 return -1
endi endi
if $data04 != 3.0000 then if $data04 != 3.00000 then
return -1 return -1
endi endi
if $data05 != 4.000000000 then if $data05 != 4.000000000 then
...@@ -417,10 +417,10 @@ endi ...@@ -417,10 +417,10 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
...@@ -444,7 +444,7 @@ endi ...@@ -444,7 +444,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
...@@ -468,7 +468,7 @@ endi ...@@ -468,7 +468,7 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
...@@ -492,7 +492,7 @@ endi ...@@ -492,7 +492,7 @@ endi
if $data02 != 1.000000000 then if $data02 != 1.000000000 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
...@@ -513,13 +513,13 @@ endi ...@@ -513,13 +513,13 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
...@@ -546,10 +546,10 @@ endi ...@@ -546,10 +546,10 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
...@@ -576,10 +576,10 @@ endi ...@@ -576,10 +576,10 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
...@@ -606,10 +606,10 @@ endi ...@@ -606,10 +606,10 @@ endi
if $data02 != 1.000000000 then if $data02 != 1.000000000 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
...@@ -636,13 +636,13 @@ endi ...@@ -636,13 +636,13 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != NULL then if $data03 != null then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
if $data05 != NULL then if $data05 != null then
return -1 return -1
endi endi
...@@ -669,19 +669,19 @@ endi ...@@ -669,19 +669,19 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 4.0000 then if $data03 != 4.00000 then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
if $data05 != NULL then if $data05 != null then
return -1 return -1
endi endi
if $data06 != NULL then if $data06 != null then
return -1 return -1
endi endi
...@@ -708,22 +708,22 @@ endi ...@@ -708,22 +708,22 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 4.000000000 then if $data03 != 4.000000000 then
return -1 return -1
endi endi
if $data04 != NULL then if $data04 != null then
return -1 return -1
endi endi
if $data05 != NULL then if $data05 != null then
return -1 return -1
endi endi
if $data06 != NULL then if $data06 != null then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -763,13 +763,13 @@ endi ...@@ -763,13 +763,13 @@ endi
if $data04 != 5.000000000 then if $data04 != 5.000000000 then
return -1 return -1
endi endi
if $data05 != NULL then if $data05 != null then
return -1 return -1
endi endi
if $data06 != NULL then if $data06 != null then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
......
...@@ -85,9 +85,7 @@ sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(t ...@@ -85,9 +85,7 @@ sql select count(tgcol), avg(tgcol), sum(tgcol), min(tgcol), max(tgcol), first(t
step7: step7:
print =============== step8 print =============== step8
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tbcol -x step8 sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by tbcol
return -1
step8:
print =============== step9 print =============== step9
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x step9 sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt group by noexist -x step9
...@@ -102,9 +100,7 @@ if $data00 != 100 then ...@@ -102,9 +100,7 @@ if $data00 != 100 then
endi endi
print =============== step11 print =============== step11
sql select count(tbcol) as c from $mt group by tbcol -x step11 sql select count(tbcol) as c from $mt group by tbcol
return -1
step11:
print =============== step12 print =============== step12
sql select count(tbcol) as c from $mt group by noexist -x step12 sql select count(tbcol) as c from $mt group by noexist -x step12
...@@ -122,6 +118,7 @@ print =============== step14 ...@@ -122,6 +118,7 @@ print =============== step14
sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 100 then if $data00 != 100 then
print expect 100, actual $data00
return -1 return -1
endi endi
......
...@@ -30,7 +30,7 @@ endi ...@@ -30,7 +30,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != true then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2 then if $data03 != 2 then
...@@ -40,8 +40,8 @@ endi ...@@ -40,8 +40,8 @@ endi
sql alter table $tb set tag tagcx 1 -x step21 sql alter table $tb set tag tagcx 1 -x step21
return -1 return -1
step21: step21:
sql alter table $tb set tgcol1=false sql alter table $tb set tag tgcol1=false
sql alter table $tb set tgcol2=4 sql alter table $tb set tag tgcol2=4
sql reset query cache sql reset query cache
...@@ -53,7 +53,7 @@ endi ...@@ -53,7 +53,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != false then if $data02 != 0 then
return -1 return -1
endi endi
if $data03 != 4 then if $data03 != 4 then
...@@ -68,7 +68,7 @@ endi ...@@ -68,7 +68,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != false then if $data02 != 0 then
return -1 return -1
endi endi
if $data03 != 4 then if $data03 != 4 then
...@@ -83,10 +83,10 @@ endi ...@@ -83,10 +83,10 @@ endi
if $data31 != INT then if $data31 != INT then
return -1 return -1
endi endi
if $data23 != false then if $data23 != TAG then
return -1 return -1
endi endi
if $data33 != 4 then if $data33 != TAG then
return -1 return -1
endi endi
...@@ -111,8 +111,8 @@ if $data03 != 2 then ...@@ -111,8 +111,8 @@ if $data03 != 2 then
return -1 return -1
endi endi
sql alter table $tb set tgcol1=3 sql alter table $tb set tag tgcol1=3
sql alter table $tb set tgcol2=4 sql alter table $tb set tag tgcol2=4
sql reset query cache sql reset query cache
...@@ -169,12 +169,12 @@ endi ...@@ -169,12 +169,12 @@ endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
if $data03 != 2.0000 then if $data03 != 2.00000 then
return -1 return -1
endi endi
sql alter table $tb set tgcol1=3 sql alter table $tb set tag tgcol1=3
sql alter table $tb set tgcol2=4 sql alter table $tb set tag tgcol2=4
sql reset query cache sql reset query cache
...@@ -189,7 +189,7 @@ endi ...@@ -189,7 +189,7 @@ endi
if $data02 != 3 then if $data02 != 3 then
return -1 return -1
endi endi
if $data03 != 4.0000 then if $data03 != 4.00000 then
return -1 return -1
endi endi
...@@ -204,7 +204,7 @@ endi ...@@ -204,7 +204,7 @@ endi
if $data02 != 3 then if $data02 != 3 then
return -1 return -1
endi endi
if $data03 != 4.0000 then if $data03 != 4.00000 then
return -1 return -1
endi endi
...@@ -230,8 +230,8 @@ if $data03 != 2 then ...@@ -230,8 +230,8 @@ if $data03 != 2 then
return -1 return -1
endi endi
sql alter table $tb set tgcol1=3 sql alter table $tb set tag tgcol1=3
sql alter table $tb set tgcol2='4' sql alter table $tb set tag tgcol2='4'
sql reset query cache sql reset query cache
...@@ -299,11 +299,11 @@ if $data07 != 6 then ...@@ -299,11 +299,11 @@ if $data07 != 6 then
endi endi
sql alter table $mt drop tag tgcol3 sql alter table $mt drop tag tgcol3
sql alter table $tb set tgcol1='7' sql alter table $tb set tag tgcol1='7'
sql alter table $tb set tgcol2=8 sql alter table $tb set tag tgcol2=8
sql alter table $tb set tgcol4='9' sql alter table $tb set tag tgcol4='9'
sql alter table $tb set tgcol5=10 sql alter table $tb set tag tgcol5=10
sql alter table $tb set tgcol6='11' sql alter table $tb set tag tgcol6='11'
sql reset query cache sql reset query cache
...@@ -330,7 +330,7 @@ endi ...@@ -330,7 +330,7 @@ endi
if $data06 != 11 then if $data06 != 11 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -357,7 +357,7 @@ endi ...@@ -357,7 +357,7 @@ endi
if $data06 != 11 then if $data06 != 11 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -384,7 +384,7 @@ endi ...@@ -384,7 +384,7 @@ endi
if $data06 != 11 then if $data06 != 11 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -411,7 +411,7 @@ endi ...@@ -411,7 +411,7 @@ endi
if $data06 != 11 then if $data06 != 11 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
...@@ -438,7 +438,7 @@ endi ...@@ -438,7 +438,7 @@ endi
if $data06 != 11 then if $data06 != 11 then
return -1 return -1
endi endi
if $data07 != NULL then if $data07 != null then
return -1 return -1
endi endi
......
run windows/account/user_create.sim
run windows/account/user_len.sim
run windows/db/len.sim
run windows/table/table.sim
run windows/table/table_len.sim
run windows/table/column_num.sim
run windows/table/column_name.sim
run windows/table/column_value.sim
run windows/table/binary.sim
run windows/table/bool.sim
run windows/table/double.sim
run windows/table/float.sim
run windows/table/db.table.sim
run windows/import/basic.sim
run windows/alter/table.sim run windows/alter/table.sim
run windows/alter/metrics.sim run windows/alter/metrics.sim
run windows/compute/count.sim
run windows/compute/avg.sim run windows/compute/avg.sim
run windows/compute/sum.sim run windows/compute/bottom.sim
run windows/compute/min.sim run windows/compute/count.sim
run windows/compute/max.sim run windows/compute/diff.sim
run windows/compute/first.sim run windows/compute/first.sim
run windows/compute/interval.sim
run windows/compute/last.sim run windows/compute/last.sim
run windows/compute/leastsquare.sim
run windows/compute/max.sim
run windows/compute/min.sim
run windows/compute/percentile.sim
run windows/compute/stddev.sim run windows/compute/stddev.sim
#run windows/compute/leastsquare.sim run windows/compute/sum.sim
run windows/compute/top.sim run windows/compute/top.sim
run windows/compute/bottom.sim
run windows/compute/percentile.sim
run windows/compute/diff.sim
run windows/compute/interval.sim
run windows/field/single.sim run windows/db/basic.sim
run windows/field/bool.sim run windows/db/len.sim
run windows/field/smallint.sim
run windows/field/tinyint.sim
run windows/field/int.sim
run windows/field/bigint.sim
run windows/field/float.sim
run windows/field/double.sim
run windows/field/binary.sim
run windows/field/2.sim run windows/field/2.sim
run windows/field/3.sim run windows/field/3.sim
run windows/field/4.sim run windows/field/4.sim
run windows/field/5.sim run windows/field/5.sim
run windows/field/6.sim run windows/field/6.sim
run windows/field/bigint.sim
run windows/field/binary.sim
run windows/field/bool.sim
run windows/field/double.sim
run windows/field/float.sim
run windows/field/int.sim
run windows/field/single.sim
run windows/field/smallint.sim
run windows/field/tinyint.sim
run windows/import/basic.sim
run windows/insert/basic.sim
run windows/insert/query_block1_file.sim
run windows/insert/query_block1_memory.sim
run windows/insert/query_block2_file.sim
run windows/insert/query_block2_memory.sim
run windows/insert/query_file_memory.sim
run windows/insert/query_multi_file.sim
run windows/table/binary.sim
run windows/table/bool.sim
run windows/table/column_num.sim
run windows/table/column_name.sim
run windows/table/column_value.sim
run windows/table/db.table.sim
run windows/table/double.sim
run windows/table/float.sim
run windows/table/table_len.sim
run windows/table/table.sim
run windows/tag/filter.sim
run windows/tag/column.sim
run windows/tag/bool.sim
run windows/tag/smallint.sim
run windows/tag/tinyint.sim
run windows/tag/int.sim
run windows/tag/bigint.sim
run windows/tag/float.sim
run windows/tag/double.sim
run windows/tag/binary.sim
run windows/tag/bool_int.sim
run windows/tag/bool_binary.sim
run windows/tag/int_float.sim
run windows/tag/int_binary.sim
run windows/tag/binary_binary.sim
run windows/tag/3.sim run windows/tag/3.sim
run windows/tag/4.sim run windows/tag/4.sim
run windows/tag/5.sim run windows/tag/5.sim
run windows/tag/6.sim run windows/tag/6.sim
run windows/tag/add.sim
run windows/tag/bigint.sim
run windows/tag/binary_binary.sim
run windows/tag/binary.sim
run windows/tag/bool_binary.sim
run windows/tag/bool_int.sim
run windows/tag/bool.sim
run windows/tag/change.sim
run windows/tag/column.sim
run windows/tag/create.sim run windows/tag/create.sim
#run windows/tag/delete.sim run windows/tag/delete.sim
run windows/tag/double.sim
#run windows/tag/set.sim run windows/tag/filter.sim
#run windows/tag/add.sim run windows/tag/float.sim
run windows/tag/int_binary.sim
run windows/tag/int_float.sim
run windows/tag/int.sim
run windows/tag/set.sim
run windows/tag/smallint.sim
run windows/tag/tinyint.sim
run windows/vector/single.sim run windows/vector/metrics_field.sim
run windows/vector/multi.sim run windows/vector/metrics_mix.sim
run windows/vector/table_query.sim
run windows/vector/table_time.sim
run windows/vector/table_field.sim
run windows/vector/table_mix.sim
run windows/vector/metrics_query.sim run windows/vector/metrics_query.sim
run windows/vector/metrics_tag.sim run windows/vector/metrics_tag.sim
run windows/vector/metrics_time.sim run windows/vector/metrics_time.sim
run windows/vector/metrics_field.sim run windows/vector/multi.sim
run windows/vector/metrics_mix.sim run windows/vector/single.sim
run windows/vector/table_field.sim
run windows/insert/basic.sim run windows/vector/table_mix.sim
run windows/insert/query_block1_memory.sim run windows/vector/table_query.sim
run windows/insert/query_block2_memory.sim run windows/vector/table_time.sim
run windows/insert/query_block1_file.sim
#run windows/insert/query_block2_file.sim
#run windows/insert/query_file_memory.sim
#run windows/insert/query_multi_file.sim
run windows/tag/change.sim
...@@ -200,7 +200,6 @@ sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc -x step ...@@ -200,7 +200,6 @@ sql select a + f from $tb where g = 2 and ts > now + 4m order by ts asc -x step
return -1 return -1
step74: step74:
print =============== clear print =============== clear
sql drop database $db sql drop database $db
sql show databases sql show databases
......
...@@ -4,10 +4,6 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc) ...@@ -4,10 +4,6 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
INCLUDE_DIRECTORIES(inc) INCLUDE_DIRECTORIES(inc)
IF (TD_WINDOWS)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread)
ENDIF ()
AUX_SOURCE_DIRECTORY(src SRC) AUX_SOURCE_DIRECTORY(src SRC)
ADD_EXECUTABLE(tsim ${SRC}) ADD_EXECUTABLE(tsim ${SRC})
TARGET_LINK_LIBRARIES(tsim taos_static trpc tutil pthread cJson) TARGET_LINK_LIBRARIES(tsim taos_static trpc tutil pthread cJson)
...@@ -313,7 +313,9 @@ bool simExecuteSystemCmd(SScript *script, char *option) { ...@@ -313,7 +313,9 @@ bool simExecuteSystemCmd(SScript *script, char *option) {
simError("script:%s, failed to execute %s , code %d, errno:%d %s, repeatTimes:%d", simError("script:%s, failed to execute %s , code %d, errno:%d %s, repeatTimes:%d",
script->fileName, buf, code, errno, strerror(errno), repeatTimes); script->fileName, buf, code, errno, strerror(errno), repeatTimes);
taosMsleep(1000); taosMsleep(1000);
#ifdef LINUX
signal(SIGCHLD, SIG_DFL); signal(SIGCHLD, SIG_DFL);
#endif
if (repeatTimes++ >= 10) { if (repeatTimes++ >= 10) {
exit(0); exit(0);
} }
...@@ -418,14 +420,14 @@ void simVisuallizeOption(SScript *script, char *src, char *dst) { ...@@ -418,14 +420,14 @@ void simVisuallizeOption(SScript *script, char *src, char *dst) {
var = strchr(src, '$'); var = strchr(src, '$');
if (var == NULL) break; if (var == NULL) break;
if (var && ((var - src - 1) > 0) && *(var - 1) == '\\') { if (var && ((var - src - 1) > 0) && *(var - 1) == '\\') {
srcLen = var - src - 1; srcLen = (int)(var - src - 1);
memcpy(dst + dstLen, src, srcLen); memcpy(dst + dstLen, src, srcLen);
dstLen += srcLen; dstLen += srcLen;
src = var; src = var;
break; break;
} }
srcLen = var - src; srcLen = (int)(var - src);
memcpy(dst + dstLen, src, srcLen); memcpy(dst + dstLen, src, srcLen);
dstLen += srcLen; dstLen += srcLen;
...@@ -433,7 +435,7 @@ void simVisuallizeOption(SScript *script, char *src, char *dst) { ...@@ -433,7 +435,7 @@ void simVisuallizeOption(SScript *script, char *src, char *dst) {
value = simGetVariable(script, token, tokenLen); value = simGetVariable(script, token, tokenLen);
strcpy(dst + dstLen, value); strcpy(dst + dstLen, value);
dstLen += strlen(value); dstLen += (int)strlen(value);
} }
strcpy(dst + dstLen, src); strcpy(dst + dstLen, src);
...@@ -455,9 +457,9 @@ void simCloseNativeConnect(SScript *script) { ...@@ -455,9 +457,9 @@ void simCloseNativeConnect(SScript *script) {
void simCloseTaosdConnect(SScript *script) { void simCloseTaosdConnect(SScript *script) {
if (simAsyncQuery) { if (simAsyncQuery) {
return simCloseRestFulConnect(script); simCloseRestFulConnect(script);
} else { } else {
return simCloseNativeConnect(script); simCloseNativeConnect(script);
} }
} }
// {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} // {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}
...@@ -575,7 +577,7 @@ int simExecuteRestFulCommand(SScript *script, char *command) { ...@@ -575,7 +577,7 @@ int simExecuteRestFulCommand(SScript *script, char *command) {
while (!feof(fp)) { while (!feof(fp)) {
int availSize = mallocSize - alreadyReadSize; int availSize = mallocSize - alreadyReadSize;
int len = fread(content + alreadyReadSize, 1, availSize, fp); int len = (int)fread(content + alreadyReadSize, 1, availSize, fp);
if (len >= availSize) { if (len >= availSize) {
alreadyReadSize += len; alreadyReadSize += len;
mallocSize *= 2; mallocSize *= 2;
......
...@@ -105,7 +105,7 @@ void simAddCmdIntoHash(SCommand *pCmd) { ...@@ -105,7 +105,7 @@ void simAddCmdIntoHash(SCommand *pCmd) {
int hash; int hash;
SCommand *node; SCommand *node;
hash = simHashCmd(pCmd->name, strlen(pCmd->name)); hash = simHashCmd(pCmd->name, (int)strlen(pCmd->name));
node = cmdHashList[hash]; node = cmdHashList[hash];
pCmd->next = node; pCmd->next = node;
cmdHashList[hash] = pCmd; cmdHashList[hash] = pCmd;
...@@ -199,7 +199,7 @@ SScript *simParseScript(char *fileName) { ...@@ -199,7 +199,7 @@ SScript *simParseScript(char *fileName) {
if (fgets(buffer, sizeof(buffer), fd) == NULL) continue; if (fgets(buffer, sizeof(buffer), fd) == NULL) continue;
lineNum++; lineNum++;
int cmdlen = strlen(buffer); int cmdlen = (int)strlen(buffer);
if (buffer[cmdlen - 1] == '\r' || buffer[cmdlen - 1] == '\n') if (buffer[cmdlen - 1] == '\r' || buffer[cmdlen - 1] == '\n')
buffer[cmdlen - 1] = 0; buffer[cmdlen - 1] = 0;
rest = buffer; rest = buffer;
...@@ -294,10 +294,10 @@ int simCheckExpression(char *exp) { ...@@ -294,10 +294,10 @@ int simCheckExpression(char *exp) {
rest = paGetToken(rest, &op, &opLen); rest = paGetToken(rest, &op, &opLen);
if (opLen == 0) return rest - exp; if (opLen == 0) return (int)(rest - exp);
/* if it is key word "then" */ /* if it is key word "then" */
if (strncmp(op, "then", 4) == 0) return op - exp; if (strncmp(op, "then", 4) == 0) return (int)(op - exp);
rest = paGetToken(rest, &op2, &op2Len); rest = paGetToken(rest, &op2, &op2Len);
if (op2Len == 0) { if (op2Len == 0) {
...@@ -312,7 +312,7 @@ int simCheckExpression(char *exp) { ...@@ -312,7 +312,7 @@ int simCheckExpression(char *exp) {
if (op[0] == '+' || op[0] == '-' || op[0] == '*' || op[0] == '/' || if (op[0] == '+' || op[0] == '-' || op[0] == '*' || op[0] == '/' ||
op[0] == '.') { op[0] == '.') {
return rest - exp; return (int)(rest - exp);
} }
return -1; return -1;
...@@ -655,7 +655,7 @@ bool simParsePrintCmd(char *rest, SCommand *pCmd, int lineNum) { ...@@ -655,7 +655,7 @@ bool simParsePrintCmd(char *rest, SCommand *pCmd, int lineNum) {
cmdLine[numOfLines].cmdno = SIM_CMD_PRINT; cmdLine[numOfLines].cmdno = SIM_CMD_PRINT;
cmdLine[numOfLines].lineNum = lineNum; cmdLine[numOfLines].lineNum = lineNum;
cmdLine[numOfLines].optionOffset = optionOffset; cmdLine[numOfLines].optionOffset = optionOffset;
expLen = strlen(rest); expLen = (int)strlen(rest);
memcpy(optionBuffer + optionOffset, rest, expLen); memcpy(optionBuffer + optionOffset, rest, expLen);
optionOffset += expLen + 1; optionOffset += expLen + 1;
*(optionBuffer + optionOffset - 1) = 0; *(optionBuffer + optionOffset - 1) = 0;
...@@ -690,7 +690,7 @@ bool simParseSqlCmd(char *rest, SCommand *pCmd, int lineNum) { ...@@ -690,7 +690,7 @@ bool simParseSqlCmd(char *rest, SCommand *pCmd, int lineNum) {
cmdLine[numOfLines].cmdno = SIM_CMD_SQL; cmdLine[numOfLines].cmdno = SIM_CMD_SQL;
cmdLine[numOfLines].lineNum = lineNum; cmdLine[numOfLines].lineNum = lineNum;
cmdLine[numOfLines].optionOffset = optionOffset; cmdLine[numOfLines].optionOffset = optionOffset;
expLen = strlen(rest); expLen = (int)strlen(rest);
memcpy(optionBuffer + optionOffset, rest, expLen); memcpy(optionBuffer + optionOffset, rest, expLen);
optionOffset += expLen + 1; optionOffset += expLen + 1;
*(optionBuffer + optionOffset - 1) = 0; *(optionBuffer + optionOffset - 1) = 0;
...@@ -706,7 +706,7 @@ bool simParseSqlErrorCmd(char *rest, SCommand *pCmd, int lineNum) { ...@@ -706,7 +706,7 @@ bool simParseSqlErrorCmd(char *rest, SCommand *pCmd, int lineNum) {
cmdLine[numOfLines].cmdno = SIM_CMD_SQL_ERROR; cmdLine[numOfLines].cmdno = SIM_CMD_SQL_ERROR;
cmdLine[numOfLines].lineNum = lineNum; cmdLine[numOfLines].lineNum = lineNum;
cmdLine[numOfLines].optionOffset = optionOffset; cmdLine[numOfLines].optionOffset = optionOffset;
expLen = strlen(rest); expLen = (int)strlen(rest);
memcpy(optionBuffer + optionOffset, rest, expLen); memcpy(optionBuffer + optionOffset, rest, expLen);
optionOffset += expLen + 1; optionOffset += expLen + 1;
*(optionBuffer + optionOffset - 1) = 0; *(optionBuffer + optionOffset - 1) = 0;
...@@ -728,7 +728,7 @@ bool simParseSystemCmd(char *rest, SCommand *pCmd, int lineNum) { ...@@ -728,7 +728,7 @@ bool simParseSystemCmd(char *rest, SCommand *pCmd, int lineNum) {
cmdLine[numOfLines].cmdno = SIM_CMD_SYSTEM; cmdLine[numOfLines].cmdno = SIM_CMD_SYSTEM;
cmdLine[numOfLines].lineNum = lineNum; cmdLine[numOfLines].lineNum = lineNum;
cmdLine[numOfLines].optionOffset = optionOffset; cmdLine[numOfLines].optionOffset = optionOffset;
expLen = strlen(rest); expLen = (int)strlen(rest);
memcpy(optionBuffer + optionOffset, rest, expLen); memcpy(optionBuffer + optionOffset, rest, expLen);
optionOffset += expLen + 1; optionOffset += expLen + 1;
*(optionBuffer + optionOffset - 1) = 0; *(optionBuffer + optionOffset - 1) = 0;
...@@ -840,14 +840,14 @@ void simInitsimCmdList() { ...@@ -840,14 +840,14 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_EXP; cmdno = SIM_CMD_EXP;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "exp"); strcpy(simCmdList[cmdno].name, "exp");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = NULL; simCmdList[cmdno].parseCmd = NULL;
simCmdList[cmdno].executeCmd = simExecuteExpCmd; simCmdList[cmdno].executeCmd = simExecuteExpCmd;
cmdno = SIM_CMD_IF; cmdno = SIM_CMD_IF;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "if"); strcpy(simCmdList[cmdno].name, "if");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseIfCmd; simCmdList[cmdno].parseCmd = simParseIfCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -855,7 +855,7 @@ void simInitsimCmdList() { ...@@ -855,7 +855,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_ELIF; cmdno = SIM_CMD_ELIF;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "elif"); strcpy(simCmdList[cmdno].name, "elif");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseElifCmd; simCmdList[cmdno].parseCmd = simParseElifCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -863,7 +863,7 @@ void simInitsimCmdList() { ...@@ -863,7 +863,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_ELSE; cmdno = SIM_CMD_ELSE;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "else"); strcpy(simCmdList[cmdno].name, "else");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseElseCmd; simCmdList[cmdno].parseCmd = simParseElseCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -871,7 +871,7 @@ void simInitsimCmdList() { ...@@ -871,7 +871,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_ENDI; cmdno = SIM_CMD_ENDI;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "endi"); strcpy(simCmdList[cmdno].name, "endi");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseEndiCmd; simCmdList[cmdno].parseCmd = simParseEndiCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -879,7 +879,7 @@ void simInitsimCmdList() { ...@@ -879,7 +879,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_WHILE; cmdno = SIM_CMD_WHILE;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "while"); strcpy(simCmdList[cmdno].name, "while");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseWhileCmd; simCmdList[cmdno].parseCmd = simParseWhileCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -887,7 +887,7 @@ void simInitsimCmdList() { ...@@ -887,7 +887,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_ENDW; cmdno = SIM_CMD_ENDW;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "endw"); strcpy(simCmdList[cmdno].name, "endw");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseEndwCmd; simCmdList[cmdno].parseCmd = simParseEndwCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -895,7 +895,7 @@ void simInitsimCmdList() { ...@@ -895,7 +895,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SWITCH; cmdno = SIM_CMD_SWITCH;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "switch"); strcpy(simCmdList[cmdno].name, "switch");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSwitchCmd; simCmdList[cmdno].parseCmd = simParseSwitchCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -903,7 +903,7 @@ void simInitsimCmdList() { ...@@ -903,7 +903,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_CASE; cmdno = SIM_CMD_CASE;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "case"); strcpy(simCmdList[cmdno].name, "case");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseCaseCmd; simCmdList[cmdno].parseCmd = simParseCaseCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -911,7 +911,7 @@ void simInitsimCmdList() { ...@@ -911,7 +911,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_DEFAULT; cmdno = SIM_CMD_DEFAULT;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "default"); strcpy(simCmdList[cmdno].name, "default");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseDefaultCmd; simCmdList[cmdno].parseCmd = simParseDefaultCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -919,7 +919,7 @@ void simInitsimCmdList() { ...@@ -919,7 +919,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_BREAK; cmdno = SIM_CMD_BREAK;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "break"); strcpy(simCmdList[cmdno].name, "break");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseBreakCmd; simCmdList[cmdno].parseCmd = simParseBreakCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -927,7 +927,7 @@ void simInitsimCmdList() { ...@@ -927,7 +927,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_CONTINUE; cmdno = SIM_CMD_CONTINUE;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "continue"); strcpy(simCmdList[cmdno].name, "continue");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseContinueCmd; simCmdList[cmdno].parseCmd = simParseContinueCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -935,7 +935,7 @@ void simInitsimCmdList() { ...@@ -935,7 +935,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_ENDS; cmdno = SIM_CMD_ENDS;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "ends"); strcpy(simCmdList[cmdno].name, "ends");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseEndsCmd; simCmdList[cmdno].parseCmd = simParseEndsCmd;
simCmdList[cmdno].executeCmd = NULL; simCmdList[cmdno].executeCmd = NULL;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -943,7 +943,7 @@ void simInitsimCmdList() { ...@@ -943,7 +943,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SLEEP; cmdno = SIM_CMD_SLEEP;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "sleep"); strcpy(simCmdList[cmdno].name, "sleep");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSleepCmd; simCmdList[cmdno].parseCmd = simParseSleepCmd;
simCmdList[cmdno].executeCmd = simExecuteSleepCmd; simCmdList[cmdno].executeCmd = simExecuteSleepCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -951,7 +951,7 @@ void simInitsimCmdList() { ...@@ -951,7 +951,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_GOTO; cmdno = SIM_CMD_GOTO;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "goto"); strcpy(simCmdList[cmdno].name, "goto");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseGotoCmd; simCmdList[cmdno].parseCmd = simParseGotoCmd;
simCmdList[cmdno].executeCmd = simExecuteGotoCmd; simCmdList[cmdno].executeCmd = simExecuteGotoCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -959,7 +959,7 @@ void simInitsimCmdList() { ...@@ -959,7 +959,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_RUN; cmdno = SIM_CMD_RUN;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "run"); strcpy(simCmdList[cmdno].name, "run");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseRunCmd; simCmdList[cmdno].parseCmd = simParseRunCmd;
simCmdList[cmdno].executeCmd = simExecuteRunCmd; simCmdList[cmdno].executeCmd = simExecuteRunCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -967,7 +967,7 @@ void simInitsimCmdList() { ...@@ -967,7 +967,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_RUN_BACK; cmdno = SIM_CMD_RUN_BACK;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "run_back"); strcpy(simCmdList[cmdno].name, "run_back");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseRunBackCmd; simCmdList[cmdno].parseCmd = simParseRunBackCmd;
simCmdList[cmdno].executeCmd = simExecuteRunBackCmd; simCmdList[cmdno].executeCmd = simExecuteRunBackCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -975,7 +975,7 @@ void simInitsimCmdList() { ...@@ -975,7 +975,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SYSTEM; cmdno = SIM_CMD_SYSTEM;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "system"); strcpy(simCmdList[cmdno].name, "system");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSystemCmd; simCmdList[cmdno].parseCmd = simParseSystemCmd;
simCmdList[cmdno].executeCmd = simExecuteSystemCmd; simCmdList[cmdno].executeCmd = simExecuteSystemCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -983,7 +983,7 @@ void simInitsimCmdList() { ...@@ -983,7 +983,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SYSTEM_CONTENT; cmdno = SIM_CMD_SYSTEM_CONTENT;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "system_content"); strcpy(simCmdList[cmdno].name, "system_content");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSystemContentCmd; simCmdList[cmdno].parseCmd = simParseSystemContentCmd;
simCmdList[cmdno].executeCmd = simExecuteSystemContentCmd; simCmdList[cmdno].executeCmd = simExecuteSystemContentCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -991,7 +991,7 @@ void simInitsimCmdList() { ...@@ -991,7 +991,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_PRINT; cmdno = SIM_CMD_PRINT;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "print"); strcpy(simCmdList[cmdno].name, "print");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParsePrintCmd; simCmdList[cmdno].parseCmd = simParsePrintCmd;
simCmdList[cmdno].executeCmd = simExecutePrintCmd; simCmdList[cmdno].executeCmd = simExecutePrintCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -999,7 +999,7 @@ void simInitsimCmdList() { ...@@ -999,7 +999,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SQL; cmdno = SIM_CMD_SQL;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "sql"); strcpy(simCmdList[cmdno].name, "sql");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSqlCmd; simCmdList[cmdno].parseCmd = simParseSqlCmd;
simCmdList[cmdno].executeCmd = simExecuteSqlCmd; simCmdList[cmdno].executeCmd = simExecuteSqlCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -1007,7 +1007,7 @@ void simInitsimCmdList() { ...@@ -1007,7 +1007,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SQL_ERROR; cmdno = SIM_CMD_SQL_ERROR;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "sql_error"); strcpy(simCmdList[cmdno].name, "sql_error");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSqlErrorCmd; simCmdList[cmdno].parseCmd = simParseSqlErrorCmd;
simCmdList[cmdno].executeCmd = simExecuteSqlErrorCmd; simCmdList[cmdno].executeCmd = simExecuteSqlErrorCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -1015,7 +1015,7 @@ void simInitsimCmdList() { ...@@ -1015,7 +1015,7 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_SQL_SLOW; cmdno = SIM_CMD_SQL_SLOW;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "sql_slow"); strcpy(simCmdList[cmdno].name, "sql_slow");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseSqlSlowCmd; simCmdList[cmdno].parseCmd = simParseSqlSlowCmd;
simCmdList[cmdno].executeCmd = simExecuteSqlSlowCmd; simCmdList[cmdno].executeCmd = simExecuteSqlSlowCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
...@@ -1024,14 +1024,14 @@ void simInitsimCmdList() { ...@@ -1024,14 +1024,14 @@ void simInitsimCmdList() {
cmdno = SIM_CMD_TEST; cmdno = SIM_CMD_TEST;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "test"); strcpy(simCmdList[cmdno].name, "test");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = NULL; simCmdList[cmdno].parseCmd = NULL;
simCmdList[cmdno].executeCmd = simExecuteTestCmd; simCmdList[cmdno].executeCmd = simExecuteTestCmd;
cmdno = SIM_CMD_RETURN; cmdno = SIM_CMD_RETURN;
simCmdList[cmdno].cmdno = cmdno; simCmdList[cmdno].cmdno = cmdno;
strcpy(simCmdList[cmdno].name, "return"); strcpy(simCmdList[cmdno].name, "return");
simCmdList[cmdno].nlen = strlen(simCmdList[cmdno].name); simCmdList[cmdno].nlen = (int)strlen(simCmdList[cmdno].name);
simCmdList[cmdno].parseCmd = simParseReturnCmd; simCmdList[cmdno].parseCmd = simParseReturnCmd;
simCmdList[cmdno].executeCmd = simExecuteReturnCmd; simCmdList[cmdno].executeCmd = simExecuteReturnCmd;
simAddCmdIntoHash(&(simCmdList[cmdno])); simAddCmdIntoHash(&(simCmdList[cmdno]));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册