Initial Windows port

This commit is contained in:
Asanka Herath
2009-07-22 15:55:45 -04:00
committed by Love Hornquist Astrand
parent 25a2ac726b
commit b1063ea8fc
361 changed files with 11994 additions and 1334 deletions

155
lib/wind/NTMakefile Normal file
View File

@@ -0,0 +1,155 @@
########################################################################
#
# Copyright (c) 2009, Secure Endpoints Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
RELDIR=lib\wind
!include ../../windows/NTMakefile.w32
libwind_OBJs= \
$(OBJ)\bidi.obj \
$(OBJ)\bidi_table.obj \
$(OBJ)\combining.obj \
$(OBJ)\combining_table.obj \
$(OBJ)\errorlist.obj \
$(OBJ)\errorlist_table.obj \
$(OBJ)\map.obj \
$(OBJ)\map_table.obj \
$(OBJ)\ldap.obj \
$(OBJ)\normalize.obj \
$(OBJ)\normalize_table.obj \
$(OBJ)\punycode.obj \
$(OBJ)\stringprep.obj \
$(OBJ)\wind_err.obj \
$(OBJ)\utf8.obj
$(LIBWIND): $(libwind_OBJs)
$(LIBCON)
INCFILES= \
$(INCDIR)\wind.h \
$(INCDIR)\wind_err.h \
$(INCDIR)\map_table.h \
$(INCDIR)\errorlist_table.h \
$(INCDIR)\normalize_table.h \
$(INCDIR)\combining_table.h \
$(INCDIR)\bidi_table.h \
$(INCDIR)\punycode_examples.h
$(OBJ)\map_table.h $(OBJ)\map_table.c: rfc3454.txt gen-map.py stringprep.py
cd $(OBJ)
$(PYTHON) $(SRCDIR)\gen-map.py $(SRCDIR)\rfc3454.txt
cd $(SRCDIR)
$(OBJ)\errorlist_table.h $(OBJ)\errorlist_table.c: rfc3454.txt gen-errorlist.py stringprep.py
cd $(OBJ)
$(PYTHON) $(SRCDIR)\gen-errorlist.py $(SRCDIR)\rfc3454.txt
cd $(SRCDIR)
$(OBJ)\normalize_table.h $(OBJ)\normalize_table.c: UnicodeData.txt CompositionExclusions-3.2.0.txt gen-normalize.py
cd $(OBJ)
$(PYTHON) $(SRCDIR)\gen-normalize.py $(SRCDIR)\UnicodeData.txt $(SRCDIR)\CompositionExclusions-3.2.0.txt
cd $(SRCDIR)
$(OBJ)\combining_table.h $(OBJ)\combining_table.c: UnicodeData.txt gen-combining.py
cd $(OBJ)
$(PYTHON) $(SRCDIR)\gen-combining.py $(SRCDIR)\UnicodeData.txt
cd $(SRCDIR)
$(OBJ)\bidi_table.h $(OBJ)\bidi_table.c: rfc3454.txt gen-bidi.py
cd $(OBJ)
$(PYTHON) $(SRCDIR)\gen-bidi.py $(SRCDIR)\rfc3454.txt
cd $(SRCDIR)
$(OBJ)\punycode_examples.h $(OBJ)\punycode_examples.c: gen-punycode-examples.py rfc3492.txt
cd $(OBJ)
$(PYTHON) $(SRCDIR)\gen-punycode-examples.py $(SRCDIR)\rfc3492.txt
cd $(SRCDIR)
$(OBJ)\wind_err.c $(OBJ)\wind_err.h: wind_err.et
cd $(OBJ)
$(BINDIR)\compile_et.exe $(SRCDIR)\wind_err.et
cd $(SRCDIR)
TEST_BINARIES=\
$(OBJ)\test-bidi.exe \
$(OBJ)\test-map.exe \
$(OBJ)\test-rw.exe \
$(OBJ)\test-normalize.exe \
$(OBJ)\test-prohibited.exe \
$(OBJ)\test-punycode.exe \
$(OBJ)\test-ldap.exe \
$(OBJ)\test-utf8.exe
{$(OBJ)}.c{$(OBJ)}.obj:
$(C2OBJ) -I$(SRCDIR)
{$(OBJ)}.obj{$(OBJ)}.exe:
$(EXECONLINK) $(LIBWIND) $(LIBROKEN)
$(_VC_MANIFEST_EMBED_EXE)
$(_VC_MANIFEST_CLEAN)
$(OBJ)\test-bidi.exe: $(OBJ)\test-bidi.obj
$(OBJ)\test-map.exe: $(OBJ)\test-map.obj
$(OBJ)\test-rw.exe: $(OBJ)\test-rw.obj
$(OBJ)\test-normalize.exe: $(OBJ)\test-normalize.obj
$(OBJ)\test-prohibited.exe: $(OBJ)\test-prohibited.obj
$(OBJ)\test-punycode.exe: $(OBJ)\test-punycode.obj $(OBJ)\punycode_examples.obj
$(OBJ)\test-ldap.exe: $(OBJ)\test-ldap.obj
$(OBJ)\test-utf8.exe: $(OBJ)\test-utf8.obj
test-binaries: $(TEST_BINARIES)
test-run:
cd $(OBJ)
test-bidi.exe
test-map.exe
test-rw.exe
test-normalize.exe $(SRCDIR)\NormalizationTest.txt
test-prohibited.exe
test-punycode.exe
test-ldap.exe
test-utf8.exe
cd $(SRCDIR)
all:: $(INCFILES) $(LIBWIND)
clean::
-$(RM) $(LIBWIND)
-$(RM) $(INCFILES)
test:: test-binaries test-run

View File

@@ -70,6 +70,7 @@ extern const size_t _wind_l_table_size;
bidi_c.file.write(
'''
#include <stdlib.h>
#include "bidi_table.h"
''')

View File

@@ -73,6 +73,7 @@ extern const size_t _wind_combining_table_size;
combining_c.file.write(
'''
#include <stdlib.h>
#include "combining_table.h"
const struct translation _wind_combining_table[] = {

View File

@@ -77,6 +77,7 @@ extern const size_t _wind_errorlist_table_size;
errorlist_c.file.write(
'''
#include <stdlib.h>
#include "errorlist_table.h"
const struct error_entry _wind_errorlist_table[] = {

View File

@@ -97,6 +97,7 @@ extern const unsigned short _wind_canon_next_table[];
normalize_c.file.write(
'''
#include <stdlib.h>
#include "normalize_table.h"
const struct translation _wind_normalize_table[] = {

View File

@@ -104,6 +104,7 @@ extern const size_t punycode_examples_size;
examples_c.file.write(
'''
#include <stdlib.h>
#include "punycode_examples.h"
const struct punycode_example punycode_examples[] = {

View File

@@ -45,7 +45,7 @@ struct test {
};
static struct test passing_cases[] = {
{0, {}},
{0, {0}},
{1, {0x0041}},
{1, {0x05be}},
};

View File

@@ -50,7 +50,7 @@ struct testcase {
};
static const struct testcase testcases[] = {
{ { 0x20 }, 1, { }, 0 },
{ { 0x20 }, 1, { 0 }, 0 },
{ { 0x20, 0x61 }, 2, { 0x20, 0x61, 0x20}, 3 },
{ { 0x20, 0x61, 0x20 }, 3, { 0x20, 0x61, 0x20}, 3 },
{ { 0x20, 0x61, 0x20, 0x61 }, 4, { 0x20, 0x61, 0x20, 0x20, 0x61, 0x20}, 6 }

View File

@@ -51,10 +51,10 @@ struct example {
};
static struct example cases[] = {
{{}, 0, {}, 0},
{{0}, 0, {0}, 0},
{{0x0041}, 1, {0x0061}, 1},
{{0x0061}, 1, {0x0061}, 1},
{{0x00AD}, 1, {}, 0},
{{0x00AD}, 1, {0}, 0},
{{0x00DF}, 1, {0x0073, 0x0073}, 2}
};
@@ -95,3 +95,4 @@ main(void)
failures += try(&cases[i]);
return failures != 0;
}

View File

@@ -67,7 +67,7 @@ struct testcase {
WIND_RW_BOM,
2, "\xfe\xff",
0,
0, { },
0, { 0 },
WIND_RW_BE
},
/* no input */
@@ -75,7 +75,7 @@ struct testcase {
WIND_RW_BOM,
0, "",
0,
0, { },
0, { 0 },
WIND_RW_BOM
},
/* BOM only */
@@ -83,7 +83,7 @@ struct testcase {
WIND_RW_BOM,
2, "\xff\xfe",
0,
0, { },
0, { 0 },
WIND_RW_LE
},
/* water + z */
@@ -123,7 +123,7 @@ struct testcase {
WIND_RW_BOM,
1, "\xfe",
WIND_ERR_LENGTH_NOT_MOD2,
0, { },
0, { 0 },
WIND_RW_BOM
},
/* error, missing BOM */
@@ -131,7 +131,7 @@ struct testcase {
WIND_RW_BOM,
2, "\x00\x20",
WIND_ERR_NO_BOM,
0, { },
0, { 0 },
WIND_RW_BOM
},
/* error, overrun */

View File

@@ -78,7 +78,7 @@ struct testcase {
};
static const struct testcase testcases[] = {
{"", 0, {}},
{"", 0, {0}},
{"\x01", 1, {1}},
{"\x7F", 1, {0x7F}},
{"\x01\x7F", 2, {0x01, 0x7F}},

View File

@@ -41,6 +41,7 @@
#endif
#include <krb5-types.h>
#include <roken.h>
#include "wind.h"
#include "wind_err.h"