posix.nim compiles again

This commit is contained in:
Araq
2014-08-29 01:28:48 +02:00
parent 6713ebcd98
commit a68f17a9f7
9 changed files with 76 additions and 76 deletions

View File

@@ -267,9 +267,9 @@ type
## For a typed memory object, the length in bytes.
## For other file types, the use of this field is
## unspecified.
st_atime*: TTime ## Time of last access.
st_mtime*: TTime ## Time of last data modification.
st_ctime*: TTime ## Time of last status change.
st_atime*: Time ## Time of last access.
st_mtime*: Time ## Time of last data modification.
st_ctime*: Time ## Time of last status change.
st_blksize*: Tblksize ## A file system-specific preferred I/O block size
## for this object. In some file system types, this
## may vary from file to file.
@@ -310,7 +310,7 @@ type
tm_isdst*: cint ## Daylight Savings flag.
Ttimespec* {.importc: "struct timespec",
header: "<time.h>", final, pure.} = object ## struct timespec
tv_sec*: TTime ## Seconds.
tv_sec*: Time ## Seconds.
tv_nsec*: int ## Nanoseconds.
titimerspec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec
@@ -449,17 +449,17 @@ type
Tmsghdr* {.importc: "struct msghdr", pure, final,
header: "<sys/socket.h>".} = object ## struct msghdr
msg_name*: pointer ## Optional address.
msg_namelen*: TSocklen ## Size of address.
msg_namelen*: Socklen ## Size of address.
msg_iov*: ptr TIOVec ## Scatter/gather array.
msg_iovlen*: cint ## Members in msg_iov.
msg_control*: pointer ## Ancillary data; see below.
msg_controllen*: TSocklen ## Ancillary data buffer len.
msg_controllen*: Socklen ## Ancillary data buffer len.
msg_flags*: cint ## Flags on received message.
Tcmsghdr* {.importc: "struct cmsghdr", pure, final,
header: "<sys/socket.h>".} = object ## struct cmsghdr
cmsg_len*: TSocklen ## Data byte count, including the cmsghdr.
cmsg_len*: Socklen ## Data byte count, including the cmsghdr.
cmsg_level*: cint ## Originating protocol.
cmsg_type*: cint ## Protocol-specific type.
@@ -564,7 +564,7 @@ type
{.deprecated: [TSockaddr_in: Sockaddr_in, TAddrinfo: AddrInfo,
TSockAddr: SockAddr, TSockLen: SockLen, TTimeval: Timeval,
TFdSet: FdSet, Thostent: Hostent, TServent: Servent,
TInAddr: InAddr, Tin6_addr: In6_addr, Tsockaddr_in6: Sockaddr_in6].}
TInAddr: InAddr].}
var
errno* {.importc, header: "<errno.h>".}: cint ## error variable
@@ -1799,11 +1799,11 @@ proc inet_pton*(a1: cint, a2: cstring, a3: pointer): cint {.
importc, header: "<arpa/inet.h>".}
var
in6addr_any* {.importc, header: "<netinet/in.h>".}: In6_addr
in6addr_loopback* {.importc, header: "<netinet/in.h>".}: In6_addr
in6addr_any* {.importc, header: "<netinet/in.h>".}: TIn6_addr
in6addr_loopback* {.importc, header: "<netinet/in.h>".}: TIn6_addr
proc IN6ADDR_ANY_INIT* (): In6_addr {.importc, header: "<netinet/in.h>".}
proc IN6ADDR_LOOPBACK_INIT* (): In6_addr {.importc, header: "<netinet/in.h>".}
proc IN6ADDR_ANY_INIT* (): TIn6_addr {.importc, header: "<netinet/in.h>".}
proc IN6ADDR_LOOPBACK_INIT* (): TIn6_addr {.importc, header: "<netinet/in.h>".}
# dirent.h
proc closedir*(a1: ptr TDIR): cint {.importc, header: "<dirent.h>".}
@@ -2285,22 +2285,22 @@ proc clock_nanosleep*(a1: TClockId, a2: cint, a3: var Ttimespec,
proc clock_settime*(a1: TClockId, a2: var Ttimespec): cint {.
importc, header: "<time.h>".}
proc ctime*(a1: var TTime): cstring {.importc, header: "<time.h>".}
proc ctime_r*(a1: var TTime, a2: cstring): cstring {.importc, header: "<time.h>".}
proc difftime*(a1, a2: TTime): cdouble {.importc, header: "<time.h>".}
proc ctime*(a1: var Time): cstring {.importc, header: "<time.h>".}
proc ctime_r*(a1: var Time, a2: cstring): cstring {.importc, header: "<time.h>".}
proc difftime*(a1, a2: Time): cdouble {.importc, header: "<time.h>".}
proc getdate*(a1: cstring): ptr Ttm {.importc, header: "<time.h>".}
proc gmtime*(a1: var TTime): ptr Ttm {.importc, header: "<time.h>".}
proc gmtime_r*(a1: var TTime, a2: var Ttm): ptr Ttm {.importc, header: "<time.h>".}
proc localtime*(a1: var TTime): ptr Ttm {.importc, header: "<time.h>".}
proc localtime_r*(a1: var TTime, a2: var Ttm): ptr Ttm {.importc, header: "<time.h>".}
proc mktime*(a1: var Ttm): TTime {.importc, header: "<time.h>".}
proc timegm*(a1: var Ttm): TTime {.importc, header: "<time.h>".}
proc gmtime*(a1: var Time): ptr Ttm {.importc, header: "<time.h>".}
proc gmtime_r*(a1: var Time, a2: var Ttm): ptr Ttm {.importc, header: "<time.h>".}
proc localtime*(a1: var Time): ptr Ttm {.importc, header: "<time.h>".}
proc localtime_r*(a1: var Time, a2: var Ttm): ptr Ttm {.importc, header: "<time.h>".}
proc mktime*(a1: var Ttm): Time {.importc, header: "<time.h>".}
proc timegm*(a1: var Ttm): Time {.importc, header: "<time.h>".}
proc nanosleep*(a1, a2: var Ttimespec): cint {.importc, header: "<time.h>".}
proc strftime*(a1: cstring, a2: int, a3: cstring,
a4: var Ttm): int {.importc, header: "<time.h>".}
proc strptime*(a1, a2: cstring, a3: var Ttm): cstring {.importc, header: "<time.h>".}
proc time*(a1: var TTime): TTime {.importc, header: "<time.h>".}
proc time*(a1: var Time): Time {.importc, header: "<time.h>".}
proc timer_create*(a1: var TClockId, a2: var TsigEvent,
a3: var Ttimer): cint {.importc, header: "<time.h>".}
proc timer_delete*(a1: var Ttimer): cint {.importc, header: "<time.h>".}
@@ -2517,40 +2517,40 @@ proc if_indextoname*(a1: cint, a2: cstring): cstring {.
proc if_nameindex*(): ptr Tif_nameindex {.importc, header: "<net/if.h>".}
proc if_freenameindex*(a1: ptr Tif_nameindex) {.importc, header: "<net/if.h>".}
proc IN6_IS_ADDR_UNSPECIFIED* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_UNSPECIFIED* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Unspecified address.
proc IN6_IS_ADDR_LOOPBACK* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_LOOPBACK* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Loopback address.
proc IN6_IS_ADDR_MULTICAST* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_MULTICAST* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Multicast address.
proc IN6_IS_ADDR_LINKLOCAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_LINKLOCAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Unicast link-local address.
proc IN6_IS_ADDR_SITELOCAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_SITELOCAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Unicast site-local address.
proc IN6_IS_ADDR_V4MAPPED* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_V4MAPPED* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## IPv4 mapped address.
proc IN6_IS_ADDR_V4COMPAT* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_V4COMPAT* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## IPv4-compatible address.
proc IN6_IS_ADDR_MC_NODELOCAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_MC_NODELOCAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Multicast node-local address.
proc IN6_IS_ADDR_MC_LINKLOCAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_MC_LINKLOCAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Multicast link-local address.
proc IN6_IS_ADDR_MC_SITELOCAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_MC_SITELOCAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Multicast site-local address.
proc IN6_IS_ADDR_MC_ORGLOCAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_MC_ORGLOCAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Multicast organization-local address.
proc IN6_IS_ADDR_MC_GLOBAL* (a1: ptr In6_addr): cint {.
proc IN6_IS_ADDR_MC_GLOBAL* (a1: ptr TIn6_addr): cint {.
importc, header: "<netinet/in.h>".}
## Multicast global address.

View File

@@ -3,10 +3,10 @@
import os, sets, pegs
type
TProcessResult = enum prSkipIncludeDir, prAddIncludeDir
ProcessResult = enum prSkipIncludeDir, prAddIncludeDir
proc process(dir, infile: string, outfile: TFile,
processed: var TSet[string]): TProcessResult =
proc process(dir, infile: string, outfile: File,
processed: var HashSet[string]): ProcessResult =
if processed.containsOrIncl(infile): return prSkipIncludeDir
let toProcess = dir / infile
if not existsFile(toProcess):
@@ -24,7 +24,7 @@ proc process(dir, infile: string, outfile: TFile,
writeln(outfile, line)
proc main(dir, outfile: string) =
var o: TFile
var o: File
if open(o, outfile, fmWrite):
var processed = initSet[string]()
processed.incl(outfile)

View File

@@ -1,8 +1,8 @@
# Posix detect program
# (c) 2010 Andreas Rumpf
# This program produces a C program that produces a Nimrod include file.
# The Nimrod include file lists the values of each POSIX constant.
# This program produces a C program that produces a Nim include file.
# The Nim include file lists the values of each POSIX constant.
# This is needed because POSIX is brain-dead: It only cares for C, any other
# language is ignored. It would have been easier had they specified the
# concrete values of the constants. Sigh.

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod Grep Utility
# Nim Grep Utility
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -12,7 +12,7 @@ import
const
Version = "0.9"
Usage = "nimgrep - Nimrod Grep Utility Version " & version & """
Usage = "nimgrep - Nim Grep Utility Version " & version & """
(c) 2012 Andreas Rumpf
Usage:
@@ -194,7 +194,7 @@ proc processFile(filename: string) =
i = t.last+1
if optReplace in options:
result.add(substr(buffer, i))
var f: TFile
var f: File
if open(f, filename, fmWrite):
f.write(result)
f.close()

View File

@@ -1,6 +1,6 @@
#
#
# The Nimrod Installation Generator
# The Nim Installation Generator
# (c) Copyright 2012 Dominik Picheta
#
# See the file "copying.txt", included in this
@@ -104,7 +104,7 @@ proc createChangelog(pkgName, version, maintainer: string): string =
formatDateTime(getGMTime(getTime()), "+0000"))
proc createRules(): string =
## Creates a nimrod application-agnostic rules file for building deb packages.
## Creates a nim application-agnostic rules file for building deb packages.
## Please note: this assumes the c sources have been built and the
## ``build.sh`` and ``install.sh`` files are available.
result = ""
@@ -131,9 +131,9 @@ proc createDotInstall(pkgName: string, binaries, config, docs,
for c in config:
addN(pkgName / c & " " & "etc/")
for d in docs:
addN(pkgName / d & " " & "usr/share/doc/nimrod/")
addN(pkgName / d & " " & "usr/share/doc/nim/")
for l1 in lib:
addN(pkgName / l1 & " " & "usr/lib/nimrod")
addN(pkgName / l1 & " " & "usr/lib/nim")
proc makeMtn(name, email: string): string =
return name & " <" & email & ">"
@@ -145,7 +145,7 @@ proc prepDeb*(packName, version, mtnName, mtnEmail, shortDesc, desc: string,
licenses: seq[tuple[files, license: string]], binaries,
config, docs, lib: seq[string],
buildDepends, pkgDepends = "") =
## binaries/config/docs/lib: files relative to nimrod's root, that need to
## binaries/config/docs/lib: files relative to nim's root, that need to
## be installed.
let pkgName = packName.toLower()
@@ -212,24 +212,24 @@ proc prepDeb*(packName, version, mtnName, mtnEmail, shortDesc, desc: string,
echo("And execute `debuild -us -uc` to build the .deb")
when isMainModule:
#var controlFile = createControl("nimrod", "Dominik Picheta <morfeusz8@gmail.com>",
# "The Nimrod compiler", "Compiler for the Nimrod programming language", "gcc (>= 4:4.3.2)", "gcc (>= 4:4.3.2)")
#var controlFile = createControl("nim", "Dominik Picheta <morfeusz8@gmail.com>",
# "The Nim compiler", "Compiler for the Nim programming language", "gcc (>= 4:4.3.2)", "gcc (>= 4:4.3.2)")
#echo(controlFile)
#var copyrightFile = createCopyright("nimrod", "Dominik Picheta", "morfeusz8@a.b", "0.8.14",
# @[("bin/nimrod", "gpl2"), ("lib/*", "lgpl")])
#var copyrightFile = createCopyright("nim", "Dominik Picheta", "morfeusz8@a.b", "0.8.14",
# @[("bin/nim", "gpl2"), ("lib/*", "lgpl")])
#echo copyrightFile
#var changelogFile = createChangelog("nimrod", "0.8.14", "Dom P <m@b.c>")
#var changelogFile = createChangelog("nim", "0.8.14", "Dom P <m@b.c>")
#echo(changelogFile)
#echo(createRules())
prepDeb("nimrod", "0.9.2", "Dominik Picheta", "morfeusz8@gmail.com",
"The Nimrod compiler", "Compiler for the Nimrod programming language",
@[("bin/nimrod", "MIT"), ("lib/*", "MIT")],
@["bin/nimrod"], @["config/*"], @["doc/*"], @["lib/*"],
prepDeb("nim", "0.9.2", "Dominik Picheta", "morfeusz8@gmail.com",
"The Nim compiler", "Compiler for the Nim programming language",
@[("bin/nim", "MIT"), ("lib/*", "MIT")],
@["bin/nim"], @["config/*"], @["doc/*"], @["lib/*"],
"gcc (>= 4:4.3.2)", "gcc (>= 4:4.3.2)")

View File

@@ -1,7 +1,7 @@
#
#
# The Nimrod Installation Generator
# (c) Copyright 2013 Andreas Rumpf
# The Nim Installation Generator
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
@@ -60,7 +60,7 @@ type
explicitPlatforms: bool
vars: PStringTable
app: TAppType
nimrodArgs: string
nimArgs: string
debOpts: TDebOptions
const
@@ -85,7 +85,7 @@ proc initConfigData(c: var TConfigData) =
c.license = ""
c.infile = ""
c.outdir = ""
c.nimrodArgs = ""
c.nimArgs = ""
c.libpath = ""
c.innoSetupFlag = false
c.installScript = false
@@ -126,7 +126,7 @@ include "deinstall.tmpl"
const
Version = "0.9"
Usage = "niminst - Nimrod Installation Generator Version " & Version & """
Usage = "niminst - Nim Installation Generator Version " & Version & """
(c) 2013 Andreas Rumpf
Usage:
@@ -166,7 +166,7 @@ proc parseCmdLine(c: var TConfigData) =
else: quit(Usage)
else:
c.infile = addFileExt(key.string, "ini")
c.nimrodArgs = cmdLineRest(p).string
c.nimArgs = cmdLineRest(p).string
break
of cmdLongoption, cmdShortOption:
case normalize(key.string)
@@ -451,14 +451,14 @@ proc srcdist(c: var TConfigData) =
var dir = getOutputDir(c) / buildDir(osA, cpuA)
if existsDir(dir): removeDir(dir)
createDir(dir)
var cmd = ("nimrod compile -f --symbolfiles:off --compileonly " &
var cmd = ("nim compile -f --symbolfiles:off --compileonly " &
"--gen_mapping --cc:gcc --skipUserCfg" &
" --os:$# --cpu:$# $# $#") %
[osname, cpuname, c.nimrodArgs,
[osname, cpuname, c.nimArgs,
changeFileExt(c.infile, "nim")]
echo(cmd)
if execShellCmd(cmd) != 0:
quit("Error: call to nimrod compiler failed")
quit("Error: call to nim compiler failed")
readCFiles(c, osA, cpuA)
for i in 0 .. c.cfiles[osA][cpuA].len-1:
let dest = dir / extractFilename(c.cfiles[osA][cpuA][i])

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod REPL
# Nim REPL
# (c) Copyright 2012 Dominik Picheta
#
# See the file "copying.txt", included in this
@@ -14,8 +14,8 @@ when defined(tinyc):
else:
const runCmd = "c -r"
var nimExe = findExe("nimrod")
if nimExe.len == 0: nimExe = "../bin" / addFileExt("nimrod", os.exeExt)
var nimExe = findExe("nim")
if nimExe.len == 0: nimExe = "../bin" / addFileExt("nim", os.exeExt)
proc execCode(code: string): string =
var f: TFile
@@ -36,7 +36,7 @@ var OutputTextBuffer: PTextBuffer
proc destroy(widget: PWidget, data: pgpointer){.cdecl.} =
main_quit()
proc FileOpenClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
proc fileOpenClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
var path = ChooseFileToOpen(w)
if path != "":
var file = readFile(path)
@@ -45,7 +45,7 @@ proc FileOpenClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
else:
error(w, "Unable to read from file")
proc FileSaveClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
proc fileSaveClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
var path = ChooseFileToSave(w)
if path == "": return
@@ -115,12 +115,12 @@ proc initControls() =
append(FileMenu, OpenMenuItem)
show(OpenMenuItem)
discard signal_connect(OpenMenuItem, "activate",
SIGNAL_FUNC(FileOpenClicked), nil)
SIGNAL_FUNC(fileOpenClicked), nil)
var SaveMenuItem = menu_item_new("Save...")
append(FileMenu, SaveMenuItem)
show(SaveMenuItem)
discard signal_connect(SaveMenuItem, "activate",
SIGNAL_FUNC(FileSaveClicked), nil)
SIGNAL_FUNC(fileSaveClicked), nil)
var FileMenuItem = menu_item_new("File")

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod Website Generator
# Nim Website Generator
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -54,7 +54,7 @@ include "website.tmpl"
const
Version = "0.7"
Usage = "nimweb - Nimrod Website Generator Version " & version & """
Usage = "nimweb - Nim Website Generator Version " & version & """
(c) 2012 Andreas Rumpf
Usage:

View File

@@ -80,7 +80,7 @@
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48159761-1', 'nimrod-lang.org');
ga('create', 'UA-48159761-1', 'nim-lang.org');
ga('send', 'pageview');
</script>