first release

This commit is contained in:
Rumpf 2008-06-23 01:37:49 +02:00
commit 916c25f9a7
321 changed files with 1785 additions and 1808 deletions

12
.bzrignore Normal file
View file

@ -0,0 +1,12 @@
web/*.html
doc/*.html
*.o
*.pyc
*.pyo
*.obj
*.ppu
*.exe
*.dll
*.zip
*.tar.gz
dist

0
Nimrod.geany Executable file → Normal file
View file

0
cogapp.py Executable file → Normal file
View file

0
config/doctempl.cfg Executable file → Normal file
View file

36
config/nimrod.cfg Executable file → Normal file
View file

@ -9,7 +9,7 @@
# Environment variables cannot be used in the options, however! # Environment variables cannot be used in the options, however!
# Just call the compiler with several options: # Just call the compiler with several options:
cc = @if unix: gcc @else: bcc @end cc = @if unix: gcc @else: llvm_gcc @end
lib="$nimrod/lib" lib="$nimrod/lib"
path="$lib/base" path="$lib/base"
path="$lib/base/gtk" path="$lib/base/gtk"
@ -22,7 +22,7 @@ path="$lib/extra"
# additional defines: # additional defines:
#define="" #define=""
# additional options always passed to the compiler: # additional options always passed to the compiler:
c_file_cache=on force_build
line_dir=off line_dir=off
hint[LineTooLong]=off hint[LineTooLong]=off
@ -38,6 +38,15 @@ hint[XDeclaredButNotUsed]=off
passc = "-cxxlib" passc = "-cxxlib"
@end @end
# Configuration for the LLVM GCC compiler:
@if windows:
llvm_gcc.path = r"dist\llvm-gcc4.2\bin"
@end
llvm_gcc.options.debug = "-g"
llvm_gcc.options.always = "-w"
llvm_gcc.options.speed = "-O3 -ffast-math"
llvm_gcc.options.size = "-Os -ffast-math"
# Configuration for the Borland C++ Compiler: # Configuration for the Borland C++ Compiler:
@if windows: @if windows:
bcc.path = r"C:\eigenes\compiler\cbuilder5\bin" bcc.path = r"C:\eigenes\compiler\cbuilder5\bin"
@ -53,16 +62,6 @@ bcc.options.size = "-O1 -6"
@prepend_env path r"C:\Eigenes\compiler\vcc2005\Common7\IDE;" @prepend_env path r"C:\Eigenes\compiler\vcc2005\Common7\IDE;"
@prepend_env INCLUDE r"C:\Eigenes\compiler\vcc2005\VC\include;C:\Eigenes\compiler\vcc2005\VC\ATLMFC\INCLUDE;" @prepend_env INCLUDE r"C:\Eigenes\compiler\vcc2005\VC\include;C:\Eigenes\compiler\vcc2005\VC\ATLMFC\INCLUDE;"
@prepend_env LIB r"C:\Eigenes\compiler\vcc2005\VC\lib;C:\Eigenes\compiler\vcc2005\SDK\v2.0\Lib;" @prepend_env LIB r"C:\Eigenes\compiler\vcc2005\VC\lib;C:\Eigenes\compiler\vcc2005\SDK\v2.0\Lib;"
#~ @prepend_env VSINSTALLDIR C:\eigenes\compiler\vcc2005
#~ @prepend_env VCINSTALLDIR C:\eigenes\compiler\vcc2005\VC
#~ @prepend_env FrameworkDir C:\WINDOWS\Microsoft.NET\Framework
#~ @prepend_env FrameworkVersion v2.0.50727
#~ @prepend_env FrameworkSDKDir C:\eigenes\compiler\vcc2005\SDK\v2.0
#~ @set DevEnvDir=C:\eigenes\compiler\vcc2005\Common7\IDE
#~ @prepend_env PATH %DevEnvDir%;%VCINSTALLDIR%\BIN;%VSINSTALLDIR%\Common7\Tools;%VSINSTALLDIR%\Common7\Tools\bin;%VCINSTALLDIR%\PlatformSDK\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\VCPackages;%PATH%
#~ @prepend_env INCLUDE %VCINSTALLDIR%\ATLMFC\INCLUDE;%VCINSTALLDIR%\INCLUDE;%VCINSTALLDIR%\PlatformSDK\include;%FrameworkSDKDir%\include;%INCLUDE%
#~ @prepend_env LIB %VCINSTALLDIR%\ATLMFC\LIB;%VCINSTALLDIR%\LIB;%VCINSTALLDIR%\PlatformSDK\lib;%FrameworkSDKDir%\lib;%LIB%
#~ @prepend_env LIBPATH %FrameworkDir%\%FrameworkVersion%;%VCINSTALLDIR%\ATLMFC\LIB
@end @end
@if windows: @if windows:
vcc.path = r"C:\Eigenes\compiler\vcc2005\VC\bin" vcc.path = r"C:\Eigenes\compiler\vcc2005\VC\bin"
@ -87,9 +86,9 @@ wcc.options.size = "-ox -on -6 -d0 -fp6 -zW"
@end @end
gcc.options.debug = "-g" gcc.options.debug = "-g"
@if macosx: @if macosx:
gcc.options.always = "-Wall -g -fasm-blocks" gcc.options.always = "-w -fasm-blocks"
@else: @else:
gcc.options.always = "-Wall -g" gcc.options.always = "-w"
@end @end
gcc.options.speed = "-O3 -ffast-math" gcc.options.speed = "-O3 -ffast-math"
gcc.options.size = "-Os -ffast-math" gcc.options.size = "-Os -ffast-math"
@ -130,15 +129,6 @@ pcc.options.always = "-Ze"
pcc.options.speed = "-Ox" pcc.options.speed = "-Ox"
pcc.options.size = "-Os" pcc.options.size = "-Os"
# Configuration for the LLVM GCC compiler:
@if windows:
llvm_gcc.path = r"c:\eignes\compiler\llvm-gcc\bin"
@end
llvm_gcc.options.debug = "-g"
llvm_gcc.options.always = "-w"
llvm_gcc.options.speed = "-O3 -ffast-math"
llvm_gcc.options.size = "-Os -ffast-math"
@if windows: @if windows:
icc.path = r"c:\eignes\compiler\icc\bin" icc.path = r"c:\eignes\compiler\icc\bin"
@end @end

0
configure vendored Executable file → Normal file
View file

0
data/advopt.txt Executable file → Normal file
View file

0
data/ast.yml Executable file → Normal file
View file

0
data/basicopt.txt Executable file → Normal file
View file

0
data/ccomps.txt Executable file → Normal file
View file

0
data/changes.txt Executable file → Normal file
View file

0
data/keywords.txt Executable file → Normal file
View file

0
data/magic.yml Executable file → Normal file
View file

0
data/messages.yml Executable file → Normal file
View file

0
data/pas_keyw.yml Executable file → Normal file
View file

0
data/readme.txt Executable file → Normal file
View file

0
dist/empty.txt vendored Executable file → Normal file
View file

0
doc/docs.txt Executable file → Normal file
View file

0
doc/endb.txt Executable file → Normal file
View file

0
doc/filelist.txt Executable file → Normal file
View file

0
doc/grammar.txt Executable file → Normal file
View file

0
doc/html/empty.txt Executable file → Normal file
View file

84
doc/intern.txt Executable file → Normal file
View file

@ -82,7 +82,7 @@ Coding standards
================ ================
The compiler is written in a subset of Pascal with special annotations so The compiler is written in a subset of Pascal with special annotations so
that it can be translated to Nimrod code automatically. As a generell rule, that it can be translated to Nimrod code automatically. As a general rule,
Pascal code that does not translate to Nimrod automatically is forbidden. Pascal code that does not translate to Nimrod automatically is forbidden.
@ -126,55 +126,6 @@ We already knew the type information as a graph in the compiler.
Thus we need to serialize this graph as RTTI for C code generation. Thus we need to serialize this graph as RTTI for C code generation.
Look at the files ``lib/typeinfo.nim``, ``lib/hti.nim`` for more information. Look at the files ``lib/typeinfo.nim``, ``lib/hti.nim`` for more information.
However, generating type information proved to be difficult and the format
wastes memory. Variant records make problems too. We use a mix of iterator
procedures and constant data structures:
.. code-block:: Nimrod
type
TNimTypeSlot {.export.} = record
offset: int
typ: int
name: CString
TSlotIterator = proc (obj: pointer, field: int): ptr TNimTypeSlot
TNimType {.export.} = record
Kind: TNimTypeKind
baseType, indexType: int
size, len: int
slots: TSlotIterator # instead of: ptr array [0..10_000, TNimTypeSlot]
This is not easy to understand either. Best is to use just the ``rodgen``
module and store type information as string constants.
After thinking I came to the conclusion that this is again premature
optimization. We should just construct the type graph at runtime. In the init
section new types should be constructed and registered:
.. code-block:: Nimrod
type
TSlotTriple = record
offset: int
typ: PRTL_Type
name: Cstring
PSlots = ptr TSlots
TSlots = record
case kind
of linear:
fields: array [TSlotTriple]
of nested:
discriminant: TSlotTriple
otherSlots: array [discriminant, PSlots]
TTypeKind = enum ...
RTL_Type = record
size: int
base: PRTL_Type
case kind
of tyArray, tySequence:
elemSize: int
of tyRecord, tyObject, tyEnum:
slots: PSlots
The Garbage Collector The Garbage Collector
===================== =====================
@ -457,39 +408,6 @@ the CCG. Therefore the module ``magicsys`` contains a table
(``compilerprocs``) with all symbols that are marked as ``compilerproc``. (``compilerprocs``) with all symbols that are marked as ``compilerproc``.
How separate compilation will work
==================================
Soon compiling from scratch every module that's needed will become too slow as
programs grow. For easier cleaning all generated files are generated in the
directory: ``$base/rod_gen``. This cannot be changed. The generated C files
get the names of the modules they result from. A compiled Nimrod module has the
extension ``.rod`` and is a binary file. The format may change from release
to release. The rod-file is mostly a binary representation of the parse trees.
Nimrod currently compiles any module into its own C file. Some things like
type-information, common string literals, common constant sets need to be
shared though. We deal with this problem by writing the shared data
in the main C file. Only "headers" are generated in the other modules. However,
each precompiled Nimrod module lists the shared data it depends on. The same
holds for procedures that have to generated from generics.
A big problem is that the data must get the same name each time it is compiled.
The C compiler is only called for the C files, that changed after the last
compilation (or if their object file does not exist anymore). To work
reliably, in the header comment of the C file these things are listed, so
that the C compiler is called again should they change:
* Nimrod's Version
* the target CC
* the target OS
* the target CPU
The version is questionable: If the resulting C file is the same, it does not
matter that Nimrods's version has increased. We do it anyway to be on the safe
side.
Generation of dynamic link libraries Generation of dynamic link libraries
==================================== ====================================

0
doc/lib.txt Executable file → Normal file
View file

0
doc/manual.txt Executable file → Normal file
View file

0
doc/nimdoc.css Executable file → Normal file
View file

0
doc/nimrodc.txt Executable file → Normal file
View file

0
doc/overview.txt Executable file → Normal file
View file

0
doc/posix.txt Executable file → Normal file
View file

0
doc/readme.txt Executable file → Normal file
View file

0
doc/regexprs.txt Executable file → Normal file
View file

0
doc/rst.txt Executable file → Normal file
View file

0
doc/spec.txt Executable file → Normal file
View file

19
doc/theindex.txt Executable file → Normal file
View file

@ -566,7 +566,7 @@ Index
`os.html#136 <os.html#136>`_ `os.html#136 <os.html#136>`_
`existsEnv`:idx: `existsEnv`:idx:
`os.html#140 <os.html#140>`_ `os.html#141 <os.html#141>`_
`ExistsFile`:idx: `ExistsFile`:idx:
`os.html#115 <os.html#115>`_ `os.html#115 <os.html#115>`_
@ -592,6 +592,9 @@ Index
`fatal`:idx: `fatal`:idx:
`manual.html#227 <manual.html#227>`_ `manual.html#227 <manual.html#227>`_
`fileNewer`:idx:
`os.html#138 <os.html#138>`_
`FileSystemCaseSensitive`:idx: `FileSystemCaseSensitive`:idx:
`os.html#106 <os.html#106>`_ `os.html#106 <os.html#106>`_
@ -674,7 +677,7 @@ Index
`times.html#111 <times.html#111>`_ `times.html#111 <times.html#111>`_
`getEnv`:idx: `getEnv`:idx:
`os.html#139 <os.html#139>`_ `os.html#140 <os.html#140>`_
`getFilePos`:idx: `getFilePos`:idx:
`system.html#389 <system.html#389>`_ `system.html#389 <system.html#389>`_
@ -792,7 +795,7 @@ Index
`manual.html#206 <manual.html#206>`_ `manual.html#206 <manual.html#206>`_
`iterOverEnvironment`:idx: `iterOverEnvironment`:idx:
`os.html#144 <os.html#144>`_ `os.html#145 <os.html#145>`_
`JoinPath`:idx: `JoinPath`:idx:
* `os.html#116 <os.html#116>`_ * `os.html#116 <os.html#116>`_
@ -963,10 +966,10 @@ Index
`manual.html#142 <manual.html#142>`_ `manual.html#142 <manual.html#142>`_
`paramCount`:idx: `paramCount`:idx:
`os.html#141 <os.html#141>`_ `os.html#142 <os.html#142>`_
`paramStr`:idx: `paramStr`:idx:
`os.html#142 <os.html#142>`_ `os.html#143 <os.html#143>`_
`ParDir`:idx: `ParDir`:idx:
`os.html#102 <os.html#102>`_ `os.html#102 <os.html#102>`_
@ -1020,7 +1023,7 @@ Index
`manual.html#230 <manual.html#230>`_ `manual.html#230 <manual.html#230>`_
`putEnv`:idx: `putEnv`:idx:
`os.html#138 <os.html#138>`_ `os.html#139 <os.html#139>`_
`quit`:idx: `quit`:idx:
`system.html#286 <system.html#286>`_ `system.html#286 <system.html#286>`_
@ -1105,7 +1108,7 @@ Index
`manual.html#167 <manual.html#167>`_ `manual.html#167 <manual.html#167>`_
`sameFile`:idx: `sameFile`:idx:
`os.html#143 <os.html#143>`_ `os.html#144 <os.html#144>`_
`scope`:idx: `scope`:idx:
* `manual.html#106 <manual.html#106>`_ * `manual.html#106 <manual.html#106>`_
@ -1381,7 +1384,7 @@ Index
`nimrodc.html#109 <nimrodc.html#109>`_ `nimrodc.html#109 <nimrodc.html#109>`_
`walkFiles`:idx: `walkFiles`:idx:
`os.html#145 <os.html#145>`_ `os.html#146 <os.html#146>`_
`warning`:idx: `warning`:idx:
* `manual.html#222 <manual.html#222>`_ * `manual.html#222 <manual.html#222>`_

0
doc/tutorial.txt Executable file → Normal file
View file

0
dos2unix.py Executable file → Normal file
View file

0
gcccpuopt.sh Executable file → Normal file
View file

0
ide/main.nim Executable file → Normal file
View file

0
ide/nimide.glade Executable file → Normal file
View file

50
install.txt Executable file → Normal file
View file

@ -1,5 +1,26 @@
Note: Installation does not work yet - you have to bootstrap. Play with the Installation
``koch.py`` script to compile the compiler. ============
Installation on Windows - the easy way
--------------------------------------
Install Nimrod by downloading the appropriate .zip file and extracting it to a
directory of your choice. The Nimrod Compiler will stay in this directory;
do not use a temporary one! You should add the ``bin`` directory of Nimrod to
your ``$PATH`` environment variable.
Installation on UNIX
--------------------
Note:
A C compiler is required - knowledge of C is not!
**Note: Installation under UNIX does not work yet** - you have to bootstrap.
Play with the ``koch.py`` script to compile the compiler. Under Windows the
``nim.exe`` is provided, so you don't need to do anything. Under UNIX you need
to install the `FreePascal <www.freepascal.org>`_ compiler.
Compile the compiler:: Compile the compiler::
python koch.py nim python koch.py nim
@ -8,16 +29,6 @@ To bootstrap (does not work yet)::
python koch.py boot python koch.py boot
Installation
============
Note:
A C compiler is required - knowledge of C is not!
Installation on UNIX
--------------------
The GNU C Compiler is fully supported, other compilers may work. The C compiler The GNU C Compiler is fully supported, other compilers may work. The C compiler
should be in your ``$PATH`` (most likely the case). Note that some Linux should be in your ``$PATH`` (most likely the case). Note that some Linux
distributions do not ship with a C compiler preinstalled - then you have to distributions do not ship with a C compiler preinstalled - then you have to
@ -49,36 +60,29 @@ need to install Apple's developer's tools for the GNU Compiler Collection
though. though.
Installation on Windows Installation on Windows - the hard way
----------------------- --------------------------------------
Windows does not ship with a C compiler; you have to install one. The Windows does not ship with a C compiler; you have to install one. The
following C compilers are supported under Windows: following C compilers are supported under Windows:
- | Digital Mars C++ - | Digital Mars C++
| http://www.digitalmars.com/download/freecompiler.html | http://www.digitalmars.com/download/freecompiler.html
- | Watcom C++ - | Watcom C++
| http://www.openwatcom.org/ftp/ | http://www.openwatcom.org/ftp/
- | Borland C++ (5.5 or above; including Borland C++Builder) - | Borland C++ (5.5 or above; including Borland C++Builder)
| http://www.borland.com/downloads/download_cbuilder.html | http://www.borland.com/downloads/download_cbuilder.html
| (Download the package under "compiler" - this requires registration though.) | (Download the package under "compiler" - this requires registration though.)
- | Microsoft's Visual C++ - | Microsoft's Visual C++
| http://msdn.microsoft.com/visualc | http://msdn.microsoft.com/visualc
| (You may need the SDK too - but not the full one: Essential are only | (You may need the SDK too - but not the full one: Essential are only
the win32api header files and import libraries.) the win32api header files and import libraries.)
- | Gnu C Compiler (the mingw version; the cygwin version has not been tested!) - | Gnu C Compiler (the mingw version; the cygwin version has not been tested!)
| http://www.mingw.org/download.shtml | http://www.mingw.org/download.shtml
- | LLVM with GNU C/C++ frontend - | LLVM with GNU C/C++ frontend
| http://llvm.org/releases/download.html#2.2 | http://llvm.org/releases/download.html#2.2
- | Pelles C Compiler - | Pelles C Compiler
| http://www.smorgasbordet.com/pellesc | http://www.smorgasbordet.com/pellesc
- | Lcc-win32 - | Lcc-win32
| http://www.cs.virginia.edu/~lcc-win32 | http://www.cs.virginia.edu/~lcc-win32
@ -91,8 +95,8 @@ LLVM.
After you have made sure that a C compiler is available, install After you have made sure that a C compiler is available, install
Nimrod by downloading the appropriate .zip file and extracting it to a Nimrod by downloading the appropriate .zip file and extracting it to a
directory of your choice. The Nimrod Compiler will stay in this directory of your choice. The Nimrod Compiler will stay in this
directory; do not use a temporary one! Then run ``config.exe`` in the directory; do not use a temporary one! Then adapt the ``config/nimrod.cfg``
``bin`` subdirectory. Choose your C compiler and press ``OK``. You should file appropriately. Choose your C compiler and press ``OK``. You should
add Nimrod to your ``$PATH``. add Nimrod to your ``$PATH``.
Alternatively, you can install Nimrod with the ``koch.py`` script just like Alternatively, you can install Nimrod with the ``koch.py`` script just like

129
koch.py Executable file → Normal file
View file

@ -8,7 +8,7 @@
########################################################################## ##########################################################################
import os, os.path, sys, re, zipfile, filecmp, shutil, cPickle, time import os, os.path, sys, re, zipfile, filecmp, shutil, cPickle, time
import string, getopt, textwrap, glob, shutil, getopt, string import string, getopt, textwrap, glob, shutil, getopt, string, stat
if sys.version_info[0] >= 3: # this script does not work with Python 3.0 if sys.version_info[0] >= 3: # this script does not work with Python 3.0
@ -20,7 +20,7 @@ from kochmod import *
CFLAGS = "" # modify to set flags to the first compilation step CFLAGS = "" # modify to set flags to the first compilation step
NIMROD_VERSION = '0.2.1' NIMROD_VERSION = '0.5.1'
# This string contains Nimrod's version. It is the only place # This string contains Nimrod's version. It is the only place
# where the version needs to be updated. The rest is done by # where the version needs to be updated. The rest is done by
# the build process automatically. It is replaced **everywhere** # the build process automatically. It is replaced **everywhere**
@ -118,10 +118,9 @@ Possible Commands:
configure configures the environment for developing Nimrod configure configures the environment for developing Nimrod
doc builds the documentation in HTML doc builds the documentation in HTML
clean cleans Nimrod project; removes generated files clean cleans Nimrod project; removes generated files
dist produces a distribution as dist [target] produces a distribution as
nimrod_$target_$version.zip nimrod_$target_$version.zip
boot [options] bootstraps with given command line options boot [options] bootstraps with given command line options
tests [options] runs the complete testsuite (with options)
rodsrc generates Nimrod version from Pascal version rodsrc generates Nimrod version from Pascal version
web generates the website (requires Cheetah) web generates the website (requires Cheetah)
""" % (NIMROD_VERSION + ' ' * (44-len(NIMROD_VERSION))) """ % (NIMROD_VERSION + ' ' * (44-len(NIMROD_VERSION)))
@ -149,9 +148,11 @@ def main(args):
elif cmd == "configure": cmd_configure() elif cmd == "configure": cmd_configure()
elif cmd == "doc": cmd_doc() elif cmd == "doc": cmd_doc()
elif cmd == "clean": cmd_clean() elif cmd == "clean": cmd_clean()
elif cmd == "dist": cmd_dist() elif cmd == "dist":
if i < len(args)-1: cmd_dist(args[i+1])
else: cmd_dist()
elif cmd == "boot": cmd_boot(" ".join(args[i+1:])) elif cmd == "boot": cmd_boot(" ".join(args[i+1:]))
elif cmd == "tests": cmd_tests(" ".join(args[i+1:])) #elif cmd == "tests": cmd_tests(" ".join(args[i+1:]))
elif cmd == "install": cmd_install(args[i+1:]) elif cmd == "install": cmd_install(args[i+1:])
elif cmd == "rodsrc": cmd_rodsrc() elif cmd == "rodsrc": cmd_rodsrc()
elif cmd == "web": cmd_web() elif cmd == "web": cmd_web()
@ -243,7 +244,8 @@ def cmd_web():
] ]
TEMPLATE_FILE = "web/sunset.tmpl" TEMPLATE_FILE = "web/sunset.tmpl"
#CMD = "rst2html.py --template=web/docutils.tmpl web/%s.txt web/%s.temp " #CMD = "rst2html.py --template=web/docutils.tmpl web/%s.txt web/%s.temp "
CMD = "nim rst2html --compileonly -o:web/%s.temp web/%s.txt" CMD = "nim rst2html --compileonly " \
" --putenv:nimrodversion=%s -o:web/%s.temp web/%s.txt"
c = Changed("web", Glob("web/*.txt") + [TEMPLATE_FILE, "koch.py"] + c = Changed("web", Glob("web/*.txt") + [TEMPLATE_FILE, "koch.py"] +
Glob("doc/*.txt") + Glob("lib/*.txt") + Glob("lib/*.nim")+ Glob("doc/*.txt") + Glob("lib/*.txt") + Glob("lib/*.nim")+
@ -251,10 +253,10 @@ def cmd_web():
EXPLAIN) EXPLAIN)
if c or force: if c or force:
cmd_nim() # we need Nimrod for processing the documentation cmd_nim() # we need Nimrod for processing the documentation
Exec(CMD % ("news","news")) Exec(CMD % (NIMROD_VERSION, "news","news"))
newsText = file("web/news.temp").read() newsText = file("web/news.temp").read()
for t in TABS: for t in TABS:
Exec(CMD % (t[1],t[1])) Exec(CMD % (NIMROD_VERSION, t[1],t[1]))
tmpl = Cheetah.Template.Template(file=TEMPLATE_FILE) tmpl = Cheetah.Template.Template(file=TEMPLATE_FILE)
tmpl.content = file("web/%s.temp" % t[1]).read() tmpl.content = file("web/%s.temp" % t[1]).read()
@ -262,14 +264,14 @@ def cmd_web():
tmpl.tab = t[1] tmpl.tab = t[1]
tmpl.tabs = TABS tmpl.tabs = TABS
tmpl.lastupdate = time.strftime("%Y-%m-%d %X", time.gmtime()) tmpl.lastupdate = time.strftime("%Y-%m-%d %X", time.gmtime())
f = file("web/%s.html" % t[1], "w+") f = file("web/upload/%s.html" % t[1], "w+")
f.write(str(tmpl)) f.write(str(tmpl))
f.close() f.close()
# remove temporaries: # remove temporaries:
Remove("web/news.temp") Remove("web/news.temp")
for t in TABS: Remove("web/%s.temp" % t[1]) for t in TABS: Remove("web/%s.temp" % t[1])
buildDoc("web") buildDoc("web/upload")
if Exists("web/index.html"): if Exists("web/upload/index.html"):
c.success() c.success()
# ------------------ doc ------------------------------------------------------ # ------------------ doc ------------------------------------------------------
@ -306,7 +308,10 @@ def cmd_clean(dir = "."):
for name in files: for name in files:
if (extRegEx.match(name) if (extRegEx.match(name)
or (root == "tests" and ('.' not in name))): or (root == "tests" and ('.' not in name))):
Remove(os.path.join(root, name)) x = os.path.join(root, name)
if "/dist/" not in x and "\\dist\\" not in x:
Echo("removing: " + x)
Remove(os.path.join(root, name))
for name in dirs: for name in dirs:
if name == "rod_gen": if name == "rod_gen":
shutil.rmtree(path=os.path.join(root, name), ignore_errors=True) shutil.rmtree(path=os.path.join(root, name), ignore_errors=True)
@ -318,48 +323,48 @@ def cmd_clean(dir = "."):
distlist = { distlist = {
'common': ( 'common': (
"copying.txt", "*.txt",
"gpl.html", "*.html",
"koch.py", "*.py",
"lib/nimbase.h -> lib/nimbase.h", "lib/nimbase.h -> lib/nimbase.h",
"lib/*.nim -> lib", "lib/*.nim -> lib",
"rod/*.nim -> rod", "rod/*.* -> rod",
"nim/*.pas -> nim", "build/*.* -> build",
"nim/*.txt -> nim", "nim/*.* -> nim",
"data/*.yml -> data", "data/*.yml -> data",
"data/*.txt -> data", "data/*.txt -> data",
"obj/*.txt",
"config/nimrod.cfg -> config/nimrod.cfg", "config/*.cfg -> config",
# documentation: # documentation:
"doc/*.txt", # only include the text documentation; saves bandwidth! "doc/*.txt",
# the installation program should generate the HTML "doc/*.html",
"readme.txt -> readme.txt", # tests:
"install.txt -> install.txt", "tests/*.*",
# library: # library:
"lib/base/pcre_all.c -> lib/base/pcre_all.c", "lib/base/*.c -> lib/base",
"lib/base/pcre.nim -> lib/base/pcre.nim", "lib/base/*.nim -> lib/base",
"lib/base/regexprs.nim -> lib/base/regexprs.nim", "lib/base/gtk/*.nim -> lib/base/gtk",
#"lib/windows/winapi.nim -> lib/windows/winapi.nim" "lib/base/cairo/*.nim -> lib/base/cairo",
"lib/windows/*.nim -> lib/windows",
"lib/posix/*.nim -> lib/posix"
# don't be too clever here; maybe useful on Linux # don't be too clever here; maybe useful on Linux
# for cross-compiling to Windows? # for cross-compiling to Windows?
), ),
'windows': ( 'windows': (
"bin/nim.exe -> bin/nim.exe", "bin/nim.exe -> bin/nim.exe",
"koch.exe -> koch.exe",
"lib/dlmalloc.h -> lib/dlmalloc.h", "lib/dlmalloc.h -> lib/dlmalloc.h",
"lib/dlmalloc.c -> lib/dlmalloc.c", "lib/dlmalloc.c -> lib/dlmalloc.c",
"dist/llvm-gcc4.2",
), ),
'linux': ( 'unix': (
"lib/rod_gen/*.c -> build",
"rod/rod_gen/*.c -> build",
),
'macosx': (
"lib/rod_gen/*.c -> build", "lib/rod_gen/*.c -> build",
"rod/rod_gen/*.c -> build", "rod/rod_gen/*.c -> build",
"lib/dlmalloc.h -> lib/dlmalloc.h",
"lib/dlmalloc.c -> lib/dlmalloc.c",
) )
} }
@ -370,6 +375,14 @@ def getHost():
# a heuristic that could work (most likely not :-): # a heuristic that could work (most likely not :-):
else: return re.sub(r"[0-9]+$", r"", sys.platform).lower() else: return re.sub(r"[0-9]+$", r"", sys.platform).lower()
def mydirwalker(dir, L):
for name in os.listdir(dir):
path = os.path.join(dir, name)
if os.path.isdir(path):
mydirwalker(path, L)
else:
L.append(path)
def iterInstallFiles(target=getHost()): def iterInstallFiles(target=getHost()):
for section in ['common', target]: for section in ['common', target]:
for rule in distlist[section]: for rule in distlist[section]:
@ -378,16 +391,27 @@ def iterInstallFiles(target=getHost()):
source, dest = splittedRule source, dest = splittedRule
if '*' in source: if '*' in source:
for f in Glob(source): for f in Glob(source):
yield (Path(f), Path(dest + '/' + os.path.split(f)[1])) if not stat.S_ISDIR(os.stat(f)[stat.ST_MODE]):
yield (Path(f), Path(dest + '/' + os.path.split(f)[1]))
else: else:
yield (Path(source), Path(dest)) yield (Path(source), Path(dest))
elif os.path.isdir(Path(rule)):
L = []
mydirwalker(Path(rule), L)
for f in L:
yield f, f
else: else:
for f in Glob(rule): for f in Glob(rule):
yield (Path(f), Path(f)) if not stat.S_ISDIR(os.stat(f)[stat.ST_MODE]):
yield (Path(f), Path(f))
def cmd_dist(target=getHost()): def cmd_dist(target=""):
from zipfile import ZipFile from zipfile import ZipFile
distfile = Path('dist/nimrod_%s_%s.zip' % (target, getVersion())) if not target:
if os.name == "nt": target = "windows"
else: target = "unix"
distfile = Path('web/upload/download/nimrod_%s_%s.zip' %
(target, getVersion()))
Echo("creating: %s..." % distfile) Echo("creating: %s..." % distfile)
z = ZipFile(distfile, 'w', zipfile.ZIP_DEFLATED) z = ZipFile(distfile, 'w', zipfile.ZIP_DEFLATED)
for source, dest in iterInstallFiles(target): for source, dest in iterInstallFiles(target):
@ -407,8 +431,8 @@ DefaultDirName={code:GiveMeAPath|nimrod}
DefaultGroupName=Nimrod DefaultGroupName=Nimrod
AllowNoIcons=yes AllowNoIcons=yes
LicenseFile=nim\copying.txt LicenseFile=nim\copying.txt
OutputDir=dist OutputDir=web\upload\download
OutputBaseFilename=install_nimrod_$version OutputBaseFilename=nimrod_windows_$version
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
PrivilegesRequired=none PrivilegesRequired=none
@ -464,8 +488,6 @@ def makeKochExe():
def cmd_wininstaller(): def cmd_wininstaller():
FILENAME = "install_nimrod.iss" FILENAME = "install_nimrod.iss"
makeKochExe()
# generate an installer file # generate an installer file
files = "" files = ""
for source, dest in iterInstallFiles("windows"): for source, dest in iterInstallFiles("windows"):
@ -692,13 +714,14 @@ CONFIG_TEMPLATE = r"""# Configuration file for the Nimrod Compiler.
# Environment variables cannot be used in the options, however! # Environment variables cannot be used in the options, however!
# Just call the compiler with several options: # Just call the compiler with several options:
cc = @if unix: %(cc)s @else: vcc @end cc = @if unix: %(cc)s @else: llvm_gcc @end
lib="$nimrod/lib" lib="$nimrod/lib"
path="$lib/base" path="$lib/base"
path="$lib/base/gtk" path="$lib/base/gtk"
path="$lib/base/cairo" path="$lib/base/cairo"
path="$lib/base/x11" path="$lib/base/x11"
path="$lib/windows" path="$lib/windows"
path="$lib/posix"
path="$lib/extra" path="$lib/extra"
# additional defines: # additional defines:
@ -720,6 +743,15 @@ hint[XDeclaredButNotUsed]=off
passc = "-cxxlib" passc = "-cxxlib"
@end @end
# Configuration for the LLVM GCC compiler:
@if windows:
llvm_gcc.path = r"dist\llvm-gcc4.2\bin"
@end
llvm_gcc.options.debug = "-g"
llvm_gcc.options.always = "-w"
llvm_gcc.options.speed = "-O3 -ffast-math"
llvm_gcc.options.size = "-Os -ffast-math"
# Configuration for the Borland C++ Compiler: # Configuration for the Borland C++ Compiler:
@if windows: @if windows:
bcc.path = r"C:\eigenes\compiler\cbuilder5\bin" bcc.path = r"C:\eigenes\compiler\cbuilder5\bin"
@ -802,15 +834,6 @@ pcc.options.always = "-Ze"
pcc.options.speed = "-Ox" pcc.options.speed = "-Ox"
pcc.options.size = "-Os" pcc.options.size = "-Os"
# Configuration for the LLVM GCC compiler:
@if windows:
llvm_gcc.path = r"c:\eignes\compiler\llvm-gcc\bin"
@end
llvm_gcc.options.debug = "-g"
llvm_gcc.options.always = "-w"
llvm_gcc.options.speed = "-O3 -ffast-math"
llvm_gcc.options.size = "-Os -ffast-math"
@if windows: @if windows:
icc.path = r"c:\eignes\compiler\icc\bin" icc.path = r"c:\eignes\compiler\icc\bin"
@end @end

0
kochmod.py Executable file → Normal file
View file

0
lib/amd64.asm.in Executable file → Normal file
View file

0
lib/ansi_c.nim Executable file → Normal file
View file

0
lib/arithm.nim Executable file → Normal file
View file

0
lib/assign.nim Executable file → Normal file
View file

0
lib/base/dialogs.nim Executable file → Normal file
View file

0
lib/base/gtk/atk.nim Executable file → Normal file
View file

0
lib/base/gtk/gdk2.nim Executable file → Normal file
View file

0
lib/base/gtk/gdk2pixbuf.nim Executable file → Normal file
View file

0
lib/base/gtk/gdkglext.nim Executable file → Normal file
View file

0
lib/base/gtk/glib2.nim Executable file → Normal file
View file

0
lib/base/gtk/gtk2.nim Executable file → Normal file
View file

0
lib/base/gtk/gtkglext.nim Executable file → Normal file
View file

0
lib/base/gtk/gtkhtml.nim Executable file → Normal file
View file

0
lib/base/gtk/libglade2.nim Executable file → Normal file
View file

0
lib/base/gtk/pango.nim Executable file → Normal file
View file

0
lib/base/gtk/pangoutils.nim Executable file → Normal file
View file

0
lib/base/nregex.nim Executable file → Normal file
View file

0
lib/base/pcre.nim Executable file → Normal file
View file

0
lib/base/pcre_all.c Executable file → Normal file
View file

0
lib/base/regexprs.nim Executable file → Normal file
View file

0
lib/cntbits.nim Executable file → Normal file
View file

0
lib/complex.nim Executable file → Normal file
View file

0
lib/copying.txt Executable file → Normal file
View file

0
lib/debugger.nim Executable file → Normal file
View file

0
lib/dlmalloc.c Executable file → Normal file
View file

0
lib/dlmalloc.h Executable file → Normal file
View file

0
lib/dyncalls.nim Executable file → Normal file
View file

0
lib/excpt.nim Executable file → Normal file
View file

0
lib/gc.nim Executable file → Normal file
View file

0
lib/hti.nim Executable file → Normal file
View file

0
lib/i386.asm.in Executable file → Normal file
View file

0
lib/int64s.nim Executable file → Normal file
View file

0
lib/lgpl.txt Executable file → Normal file
View file

0
lib/locks.nim Executable file → Normal file
View file

0
lib/math.nim Executable file → Normal file
View file

0
lib/memman.nim Executable file → Normal file
View file

0
lib/nimbase.h Executable file → Normal file
View file

0
lib/optparse.nim Executable file → Normal file
View file

7
lib/os.nim Executable file → Normal file
View file

@ -294,6 +294,10 @@ proc existsDir*(dir: string): bool
proc getLastModificationTime*(file: string): TTime proc getLastModificationTime*(file: string): TTime
## Gets the time of the `file`'s last modification. ## Gets the time of the `file`'s last modification.
proc fileNewer*(a, b: string): bool
## returns true if the file `a` is newer than file `b`, i.e. if `a`'s
## modification time is later than `b`'s.
# procs dealing with environment variables: # procs dealing with environment variables:
proc putEnv*(key, val: string) proc putEnv*(key, val: string)
## Sets the value of the environment variable named `key` to `val`. ## Sets the value of the environment variable named `key` to `val`.
@ -936,4 +940,7 @@ else:
proc paramCount(): int = return cmdCount-1 proc paramCount(): int = return cmdCount-1
proc fileNewer(a, b: string): bool =
result = getLastModificationTime(a) - getLastModificationTime(b) > 0
{.pop.} {.pop.}

0
lib/posix/posix.nim Executable file → Normal file
View file

0
lib/powerpc.asm.in Executable file → Normal file
View file

0
lib/process.nim Executable file → Normal file
View file

0
lib/ptrset.nim Executable file → Normal file
View file

0
lib/repr.nim Executable file → Normal file
View file

0
lib/sets.nim Executable file → Normal file
View file

0
lib/strutils.nim Executable file → Normal file
View file

0
lib/sysio.nim Executable file → Normal file
View file

0
lib/sysstr.nim Executable file → Normal file
View file

0
lib/system.nim Executable file → Normal file
View file

0
lib/times.nim Executable file → Normal file
View file

0
lib/typeinfo.nim Executable file → Normal file
View file

0
lib/unicode.nim Executable file → Normal file
View file

0
lib/windows/mmsystem.nim Executable file → Normal file
View file

0
lib/windows/nb30.nim Executable file → Normal file
View file

0
lib/windows/ole2.nim Executable file → Normal file
View file

0
lib/windows/shellapi.nim Executable file → Normal file
View file

0
lib/windows/shfolder.nim Executable file → Normal file
View file

0
lib/windows/windows.nim Executable file → Normal file
View file

Some files were not shown because too many files have changed in this diff Show more