posix.nim compiles again

This commit is contained in:
Araq 2014-08-29 01:28:48 +02:00
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 a typed memory object, the length in bytes.
## For other file types, the use of this field is ## For other file types, the use of this field is
## unspecified. ## unspecified.
st_atime*: TTime ## Time of last access. st_atime*: Time ## Time of last access.
st_mtime*: TTime ## Time of last data modification. st_mtime*: Time ## Time of last data modification.
st_ctime*: TTime ## Time of last status change. st_ctime*: Time ## Time of last status change.
st_blksize*: Tblksize ## A file system-specific preferred I/O block size st_blksize*: Tblksize ## A file system-specific preferred I/O block size
## for this object. In some file system types, this ## for this object. In some file system types, this
## may vary from file to file. ## may vary from file to file.
@ -310,7 +310,7 @@ type
tm_isdst*: cint ## Daylight Savings flag. tm_isdst*: cint ## Daylight Savings flag.
Ttimespec* {.importc: "struct timespec", Ttimespec* {.importc: "struct timespec",
header: "<time.h>", final, pure.} = object ## struct timespec header: "<time.h>", final, pure.} = object ## struct timespec
tv_sec*: TTime ## Seconds. tv_sec*: Time ## Seconds.
tv_nsec*: int ## Nanoseconds. tv_nsec*: int ## Nanoseconds.
titimerspec* {.importc: "struct itimerspec", header: "<time.h>", titimerspec* {.importc: "struct itimerspec", header: "<time.h>",
final, pure.} = object ## struct itimerspec final, pure.} = object ## struct itimerspec
@ -449,17 +449,17 @@ type
Tmsghdr* {.importc: "struct msghdr", pure, final, Tmsghdr* {.importc: "struct msghdr", pure, final,
header: "<sys/socket.h>".} = object ## struct msghdr header: "<sys/socket.h>".} = object ## struct msghdr
msg_name*: pointer ## Optional address. 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_iov*: ptr TIOVec ## Scatter/gather array.
msg_iovlen*: cint ## Members in msg_iov. msg_iovlen*: cint ## Members in msg_iov.
msg_control*: pointer ## Ancillary data; see below. 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. msg_flags*: cint ## Flags on received message.
Tcmsghdr* {.importc: "struct cmsghdr", pure, final, Tcmsghdr* {.importc: "struct cmsghdr", pure, final,
header: "<sys/socket.h>".} = object ## struct cmsghdr 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_level*: cint ## Originating protocol.
cmsg_type*: cint ## Protocol-specific type. cmsg_type*: cint ## Protocol-specific type.
@ -564,7 +564,7 @@ type
{.deprecated: [TSockaddr_in: Sockaddr_in, TAddrinfo: AddrInfo, {.deprecated: [TSockaddr_in: Sockaddr_in, TAddrinfo: AddrInfo,
TSockAddr: SockAddr, TSockLen: SockLen, TTimeval: Timeval, TSockAddr: SockAddr, TSockLen: SockLen, TTimeval: Timeval,
TFdSet: FdSet, Thostent: Hostent, TServent: Servent, TFdSet: FdSet, Thostent: Hostent, TServent: Servent,
TInAddr: InAddr, Tin6_addr: In6_addr, Tsockaddr_in6: Sockaddr_in6].} TInAddr: InAddr].}
var var
errno* {.importc, header: "<errno.h>".}: cint ## error variable 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>".} importc, header: "<arpa/inet.h>".}
var var
in6addr_any* {.importc, header: "<netinet/in.h>".}: In6_addr in6addr_any* {.importc, header: "<netinet/in.h>".}: TIn6_addr
in6addr_loopback* {.importc, header: "<netinet/in.h>".}: In6_addr in6addr_loopback* {.importc, header: "<netinet/in.h>".}: TIn6_addr
proc IN6ADDR_ANY_INIT* (): In6_addr {.importc, header: "<netinet/in.h>".} proc IN6ADDR_ANY_INIT* (): TIn6_addr {.importc, header: "<netinet/in.h>".}
proc IN6ADDR_LOOPBACK_INIT* (): In6_addr {.importc, header: "<netinet/in.h>".} proc IN6ADDR_LOOPBACK_INIT* (): TIn6_addr {.importc, header: "<netinet/in.h>".}
# dirent.h # dirent.h
proc closedir*(a1: ptr TDIR): cint {.importc, header: "<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 {. proc clock_settime*(a1: TClockId, a2: var Ttimespec): cint {.
importc, header: "<time.h>".} importc, header: "<time.h>".}
proc ctime*(a1: var TTime): cstring {.importc, header: "<time.h>".} proc ctime*(a1: var Time): cstring {.importc, header: "<time.h>".}
proc ctime_r*(a1: var TTime, a2: cstring): cstring {.importc, header: "<time.h>".} proc ctime_r*(a1: var Time, a2: cstring): cstring {.importc, header: "<time.h>".}
proc difftime*(a1, a2: TTime): cdouble {.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 getdate*(a1: cstring): ptr Ttm {.importc, header: "<time.h>".}
proc gmtime*(a1: var TTime): ptr Ttm {.importc, header: "<time.h>".} proc gmtime*(a1: var Time): ptr Ttm {.importc, header: "<time.h>".}
proc gmtime_r*(a1: var TTime, a2: var Ttm): 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 TTime): ptr Ttm {.importc, header: "<time.h>".} proc localtime*(a1: var Time): ptr Ttm {.importc, header: "<time.h>".}
proc localtime_r*(a1: var TTime, a2: var Ttm): 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): TTime {.importc, header: "<time.h>".} proc mktime*(a1: var Ttm): Time {.importc, header: "<time.h>".}
proc timegm*(a1: var Ttm): TTime {.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 nanosleep*(a1, a2: var Ttimespec): cint {.importc, header: "<time.h>".}
proc strftime*(a1: cstring, a2: int, a3: cstring, proc strftime*(a1: cstring, a2: int, a3: cstring,
a4: var Ttm): int {.importc, header: "<time.h>".} a4: var Ttm): int {.importc, header: "<time.h>".}
proc strptime*(a1, a2: cstring, a3: var Ttm): cstring {.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, proc timer_create*(a1: var TClockId, a2: var TsigEvent,
a3: var Ttimer): cint {.importc, header: "<time.h>".} a3: var Ttimer): cint {.importc, header: "<time.h>".}
proc timer_delete*(a1: 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_nameindex*(): ptr Tif_nameindex {.importc, header: "<net/if.h>".}
proc if_freenameindex*(a1: 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>".} importc, header: "<netinet/in.h>".}
## Unspecified address. ## 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>".} importc, header: "<netinet/in.h>".}
## Loopback address. ## 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>".} importc, header: "<netinet/in.h>".}
## Multicast address. ## 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>".} importc, header: "<netinet/in.h>".}
## Unicast link-local address. ## 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>".} importc, header: "<netinet/in.h>".}
## Unicast site-local address. ## 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>".} importc, header: "<netinet/in.h>".}
## IPv4 mapped address. ## 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>".} importc, header: "<netinet/in.h>".}
## IPv4-compatible address. ## 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>".} importc, header: "<netinet/in.h>".}
## Multicast node-local address. ## 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>".} importc, header: "<netinet/in.h>".}
## Multicast link-local address. ## 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>".} importc, header: "<netinet/in.h>".}
## Multicast site-local address. ## 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>".} importc, header: "<netinet/in.h>".}
## Multicast organization-local address. ## 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>".} importc, header: "<netinet/in.h>".}
## Multicast global address. ## Multicast global address.

View file

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

View file

@ -1,8 +1,8 @@
# Posix detect program # Posix detect program
# (c) 2010 Andreas Rumpf # (c) 2010 Andreas Rumpf
# This program produces a C program that produces a Nimrod include file. # This program produces a C program that produces a Nim include file.
# The Nimrod include file lists the values of each POSIX constant. # 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 # 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 # language is ignored. It would have been easier had they specified the
# concrete values of the constants. Sigh. # concrete values of the constants. Sigh.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -80,7 +80,7 @@
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 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'); })(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'); ga('send', 'pageview');
</script> </script>