mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
bugfix: new GCC version requires -ldl to come after object files
This commit is contained in:
16
build.bat
16
build.bat
@@ -53,6 +53,8 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/intsets.c -o build/1_1/intsets.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/intsets.c -o build/1_1/intsets.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/math.c -o build/1_1/math.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/math.c -o build/1_1/math.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/idgen.c -o build/1_1/idgen.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/idgen.c -o build/1_1/idgen.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/astalgo.c -o build/1_1/astalgo.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/astalgo.c -o build/1_1/astalgo.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/rodutils.c -o build/1_1/rodutils.o
|
||||
@@ -89,6 +91,8 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/filter_tmpl.c -o build/1_1/filter_tm
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/filter_tmpl.c -o build/1_1/filter_tmpl.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/rodread.c -o build/1_1/rodread.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/rodread.c -o build/1_1/rodread.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/memfiles.c -o build/1_1/memfiles.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/memfiles.c -o build/1_1/memfiles.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/rodwrite.c -o build/1_1/rodwrite.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/rodwrite.c -o build/1_1/rodwrite.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/passes.c -o build/1_1/passes.o
|
||||
@@ -115,8 +119,6 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/semdata.c -o build/1_1/semdata.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/semdata.c -o build/1_1/semdata.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/treetab.c -o build/1_1/treetab.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/treetab.c -o build/1_1/treetab.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/sem.c -o build/1_1/sem.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/sem.c -o build/1_1/sem.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/evals.c -o build/1_1/evals.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/evals.c -o build/1_1/evals.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/semfold.c -o build/1_1/semfold.o
|
||||
@@ -125,6 +127,8 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/transf.c -o build/1_1/transf.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/transf.c -o build/1_1/transf.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/cgmeth.c -o build/1_1/cgmeth.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/cgmeth.c -o build/1_1/cgmeth.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/sem.c -o build/1_1/sem.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/sem.c -o build/1_1/sem.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/procfind.c -o build/1_1/procfind.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/procfind.c -o build/1_1/procfind.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/pragmas.c -o build/1_1/pragmas.o
|
||||
@@ -145,6 +149,10 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/cgen.c -o build/1_1/cgen.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/cgen.c -o build/1_1/cgen.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/ccgutils.c -o build/1_1/ccgutils.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/ccgutils.c -o build/1_1/ccgutils.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/cgendata.c -o build/1_1/cgendata.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/cgendata.c -o build/1_1/cgendata.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/ccgmerge.c -o build/1_1/ccgmerge.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/ccgmerge.c -o build/1_1/ccgmerge.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/ecmasgen.c -o build/1_1/ecmasgen.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/ecmasgen.c -o build/1_1/ecmasgen.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/passaux.c -o build/1_1/passaux.o
|
||||
@@ -154,8 +162,8 @@ ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/depends.c -o build/1_1/depends.o
|
||||
ECHO %CC% %COMP_FLAGS% -Ibuild -c build/1_1/parseopt.c -o build/1_1/parseopt.o
|
||||
%CC% %COMP_FLAGS% -Ibuild -c build/1_1/parseopt.c -o build/1_1/parseopt.o
|
||||
|
||||
ECHO %LINKER% %LINK_FLAGS% -o bin\nimrod.exe build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/intsets.o build/1_1/math.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/semthreads.o build/1_1/tables.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/sem.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o
|
||||
%LINKER% %LINK_FLAGS% -o bin\nimrod.exe build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/intsets.o build/1_1/math.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/semthreads.o build/1_1/tables.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/sem.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o
|
||||
ECHO %LINKER% %LINK_FLAGS% -o bin\nimrod.exe build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/intsets.o build/1_1/math.o build/1_1/idgen.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/memfiles.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/semthreads.o build/1_1/tables.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/sem.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/cgendata.o build/1_1/ccgmerge.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o
|
||||
%LINKER% %LINK_FLAGS% -o bin\nimrod.exe build/1_1/nim__dat.o build/1_1/system.o build/1_1/nimrod.o build/1_1/times.o build/1_1/strutils.o build/1_1/parseutils.o build/1_1/winlean.o build/1_1/commands.o build/1_1/os.o build/1_1/msgs.o build/1_1/options.o build/1_1/lists.o build/1_1/strtabs.o build/1_1/hashes.o build/1_1/nversion.o build/1_1/condsyms.o build/1_1/ast.o build/1_1/crc.o build/1_1/ropes.o build/1_1/platform.o build/1_1/idents.o build/1_1/intsets.o build/1_1/math.o build/1_1/idgen.o build/1_1/astalgo.o build/1_1/rodutils.o build/1_1/extccomp.o build/1_1/osproc.o build/1_1/streams.o build/1_1/wordrecg.o build/1_1/lexer.o build/1_1/lexbase.o build/1_1/llstream.o build/1_1/nimconf.o build/1_1/main.o build/1_1/syntaxes.o build/1_1/parser.o build/1_1/pbraces.o build/1_1/filters.o build/1_1/renderer.o build/1_1/filter_tmpl.o build/1_1/rodread.o build/1_1/memfiles.o build/1_1/rodwrite.o build/1_1/passes.o build/1_1/types.o build/1_1/trees.o build/1_1/magicsys.o build/1_1/nimsets.o build/1_1/bitsets.o build/1_1/semthreads.o build/1_1/tables.o build/1_1/importer.o build/1_1/lookups.o build/1_1/semdata.o build/1_1/treetab.o build/1_1/evals.o build/1_1/semfold.o build/1_1/transf.o build/1_1/cgmeth.o build/1_1/sem.o build/1_1/procfind.o build/1_1/pragmas.o build/1_1/semtypinst.o build/1_1/sigmatch.o build/1_1/suggest.o build/1_1/docgen.o build/1_1/rst.o build/1_1/highlite.o build/1_1/cgen.o build/1_1/ccgutils.o build/1_1/cgendata.o build/1_1/ccgmerge.o build/1_1/ecmasgen.o build/1_1/passaux.o build/1_1/depends.o build/1_1/parseopt.o
|
||||
|
||||
ECHO SUCCESS
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ const
|
||||
buildGui: " -mwindows",
|
||||
buildDll: " -shared",
|
||||
linkerExe: "gcc",
|
||||
linkTmpl: "$options $buildgui $builddll -o $exefile $objfiles",
|
||||
linkTmpl: "$buildgui $builddll -o $exefile $objfiles $options",
|
||||
includeCmd: " -I",
|
||||
debug: "",
|
||||
pic: "-fPIC",
|
||||
@@ -67,7 +67,7 @@ const
|
||||
buildGui: " -mwindows",
|
||||
buildDll: " -shared",
|
||||
linkerExe: "llvm-gcc",
|
||||
linkTmpl: "$options $buildgui $builddll -o $exefile $objfiles",
|
||||
linkTmpl: "$buildgui $builddll -o $exefile $objfiles $options",
|
||||
includeCmd: " -I",
|
||||
debug: "",
|
||||
pic: "-fPIC",
|
||||
@@ -82,7 +82,7 @@ const
|
||||
buildGui: " -mwindows",
|
||||
buildDll: " -shared",
|
||||
linkerExe: "clang",
|
||||
linkTmpl: "$options $buildgui $builddll -o $exefile $objfiles",
|
||||
linkTmpl: "$buildgui $builddll -o $exefile $objfiles $options",
|
||||
includeCmd: " -I",
|
||||
debug: "",
|
||||
pic: "-fPIC",
|
||||
@@ -202,7 +202,7 @@ const
|
||||
buildGui: "",
|
||||
buildDll: " -shared ",
|
||||
linkerExe: "cc",
|
||||
linkTmpl: "-o $exefile $options $buildgui $builddll $objfiles",
|
||||
linkTmpl: "-o $exefile $buildgui $builddll $objfiles $options",
|
||||
includeCmd: " -I",
|
||||
debug: "",
|
||||
pic: "",
|
||||
@@ -232,7 +232,7 @@ const
|
||||
buildGui: " -mwindows",
|
||||
buildDll: " -mdll",
|
||||
linkerExe: "g++",
|
||||
linkTmpl: "$options $buildgui $builddll -o $exefile $objfiles",
|
||||
linkTmpl: "$buildgui $builddll -o $exefile $objfiles $options",
|
||||
includeCmd: " -I",
|
||||
debug: " -g ",
|
||||
pic: "-fPIC",
|
||||
|
||||
14
install.sh
14
install.sh
@@ -132,6 +132,10 @@ if [ $# -eq 1 ] ; then
|
||||
chmod 644 $docdir/tut1.txt
|
||||
cp doc/tut2.txt $docdir/tut2.txt || exit 1
|
||||
chmod 644 $docdir/tut2.txt
|
||||
cp doc/intern.html $docdir/intern.html || exit 1
|
||||
chmod 644 $docdir/intern.html
|
||||
cp doc/nimrodc.html $docdir/nimrodc.html || exit 1
|
||||
chmod 644 $docdir/nimrodc.html
|
||||
cp doc/mytest.cfg $docdir/mytest.cfg || exit 1
|
||||
chmod 644 $docdir/mytest.cfg
|
||||
cp doc/c2nim.pdf $docdir/c2nim.pdf || exit 1
|
||||
@@ -264,6 +268,8 @@ if [ $# -eq 1 ] ; then
|
||||
chmod 644 $libdir/pure/math.nim
|
||||
cp lib/pure/md5.nim $libdir/pure/md5.nim || exit 1
|
||||
chmod 644 $libdir/pure/md5.nim
|
||||
cp lib/pure/memfiles.nim $libdir/pure/memfiles.nim || exit 1
|
||||
chmod 644 $libdir/pure/memfiles.nim
|
||||
cp lib/pure/os.nim $libdir/pure/os.nim || exit 1
|
||||
chmod 644 $libdir/pure/os.nim
|
||||
cp lib/pure/osproc.nim $libdir/pure/osproc.nim || exit 1
|
||||
@@ -308,8 +314,8 @@ if [ $# -eq 1 ] ; then
|
||||
chmod 644 $libdir/pure/times.nim
|
||||
cp lib/pure/unicode.nim $libdir/pure/unicode.nim || exit 1
|
||||
chmod 644 $libdir/pure/unicode.nim
|
||||
cp lib/pure/uuid.nim $libdir/pure/uuid.nim || exit 1
|
||||
chmod 644 $libdir/pure/uuid.nim
|
||||
cp lib/pure/unittest.nim $libdir/pure/unittest.nim || exit 1
|
||||
chmod 644 $libdir/pure/unittest.nim
|
||||
cp lib/pure/xmldom.nim $libdir/pure/xmldom.nim || exit 1
|
||||
chmod 644 $libdir/pure/xmldom.nim
|
||||
cp lib/pure/xmldomparser.nim $libdir/pure/xmldomparser.nim || exit 1
|
||||
@@ -360,8 +366,12 @@ if [ $# -eq 1 ] ; then
|
||||
chmod 644 $libdir/wrappers/expat.nim
|
||||
cp lib/wrappers/iup.nim $libdir/wrappers/iup.nim || exit 1
|
||||
chmod 644 $libdir/wrappers/iup.nim
|
||||
cp lib/wrappers/joyent_http_parser.nim $libdir/wrappers/joyent_http_parser.nim || exit 1
|
||||
chmod 644 $libdir/wrappers/joyent_http_parser.nim
|
||||
cp lib/wrappers/libcurl.nim $libdir/wrappers/libcurl.nim || exit 1
|
||||
chmod 644 $libdir/wrappers/libcurl.nim
|
||||
cp lib/wrappers/libuv.nim $libdir/wrappers/libuv.nim || exit 1
|
||||
chmod 644 $libdir/wrappers/libuv.nim
|
||||
cp lib/wrappers/mysql.nim $libdir/wrappers/mysql.nim || exit 1
|
||||
chmod 644 $libdir/wrappers/mysql.nim
|
||||
cp lib/wrappers/odbcsql.nim $libdir/wrappers/odbcsql.nim || exit 1
|
||||
|
||||
@@ -106,19 +106,29 @@ proc skipWhitespace*(s: string, start = 0): int {.inline.} =
|
||||
while s[start+result] in Whitespace: inc(result)
|
||||
|
||||
proc skip*(s, token: string, start = 0): int {.inline.} =
|
||||
## skips the `token` starting at ``s[start]``. Returns the length of `token`
|
||||
## or 0 if there was no `token` at ``s[start]``.
|
||||
while result < token.len and s[result+start] == token[result]: inc(result)
|
||||
if result != token.len: result = 0
|
||||
|
||||
proc skipIgnoreCase*(s, token: string, start = 0): int =
|
||||
## same as `skip` but case is ignored for token matching.
|
||||
while result < token.len and
|
||||
toLower(s[result+start]) == toLower(token[result]): inc(result)
|
||||
if result != token.len: result = 0
|
||||
|
||||
proc skipUntil*(s: string, until: set[char], start = 0): int {.inline.} =
|
||||
## Skips all characters until one char from the set `token` is found.
|
||||
## Skips all characters until one char from the set `until` is found
|
||||
## or the end is reached.
|
||||
## Returns number of characters skipped.
|
||||
while s[result+start] notin until and s[result+start] != '\0': inc(result)
|
||||
|
||||
proc skipUntil*(s: string, until: char, start = 0): int {.inline.} =
|
||||
## Skips all characters until the char `until` is found
|
||||
## or the end is reached.
|
||||
## Returns number of characters skipped.
|
||||
while s[result+start] != until and s[result+start] != '\0': inc(result)
|
||||
|
||||
proc skipWhile*(s: string, toSkip: set[char], start = 0): int {.inline.} =
|
||||
## Skips all characters while one char from the set `token` is found.
|
||||
## Returns number of characters skipped.
|
||||
@@ -130,7 +140,17 @@ proc parseUntil*(s: string, token: var string, until: set[char],
|
||||
## the number of the parsed characters or 0 in case of an error. A token
|
||||
## consists of the characters notin `until`.
|
||||
var i = start
|
||||
while s[i] notin until: inc(i)
|
||||
while i < s.len and s[i] notin until: inc(i)
|
||||
result = i-start
|
||||
token = substr(s, start, i-1)
|
||||
|
||||
proc parseUntil*(s: string, token: var string, until: char,
|
||||
start = 0): int {.inline.} =
|
||||
## parses a token and stores it in ``token``. Returns
|
||||
## the number of the parsed characters or 0 in case of an error. A token
|
||||
## consists of any character that is not the `until` character.
|
||||
var i = start
|
||||
while i < s.len and s[i] != until: inc(i)
|
||||
result = i-start
|
||||
token = substr(s, start, i-1)
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# This module implements the RFC 4122 specification for generating universally unique identifiers
|
||||
# http://en.wikipedia.org/wiki/Universally_unique_identifier
|
||||
|
||||
# This module is a work-in-progress
|
||||
# If you want to help with the implementation, take a loot at:
|
||||
# http://dsource.org/projects/tango/docs/current/tango.util.uuid.Uuid.html
|
||||
|
||||
type TUuid* = array[0..15, char]
|
||||
|
||||
when defined(windows):
|
||||
# This is actually available only on Windows 2000+
|
||||
type PUuid* {.importc: "UUID __RPC_FAR *", header: "<Rpc.h>".} = ptr TUuid
|
||||
proc uuid1Sys*(uuid: PUuid) {.importc: "UuidCreateSequential", header: "<Rpc.h>".}
|
||||
|
||||
else:
|
||||
type PUuid {.importc: "uuid_t", header: "<uuid/uuid.h>".} = ptr TUuid
|
||||
proc uuid1Sys*(uuid: PUuid) {.importc: "uuid_generate_time", header: "<uuid/uuid.h>".}
|
||||
|
||||
# v1 UUIDs include the MAC address of the machine generating the ID and a timestamp
|
||||
# This scheme has the strongest guaranty of uniqueness, but discloses when the ID was generated
|
||||
proc uuidMacTime* : TUuid = uuid1Sys(addr(result))
|
||||
|
||||
# v4 UUID are created entirely using a random number generator.
|
||||
# Some bits have fixed value in order to indicate the UUID type
|
||||
proc uuidRandom*[RandomGenerator](rand: RandomGenerator) : TUuid = nil
|
||||
|
||||
# v3 and v5 UUIDs are derived from given namespace and name using a secure hashing algorithm.
|
||||
# v3 uses MD5, v5 uses SHA1.
|
||||
proc uuidByName*[Hash](namespace: TUuid, name: string, hasher: Hash, v: int) : TUuid = nil
|
||||
|
||||
Reference in New Issue
Block a user