summary refs log tree commit diff stats
path: root/rod
diff options
context:
space:
mode:
Diffstat (limited to 'rod')
-rwxr-xr-xrod/ast.nim6
-rwxr-xr-xrod/c2nim/c2nim.cfg4
-rw-r--r--rod/c2nim/manual.txt2
-rwxr-xr-xrod/commands.nim8
-rwxr-xr-xrod/ropes.nim4
-rwxr-xr-xrod/semfold.nim9
6 files changed, 24 insertions, 9 deletions
diff --git a/rod/ast.nim b/rod/ast.nim
index fde238eaa..15e74198c 100755
--- a/rod/ast.nim
+++ b/rod/ast.nim
@@ -308,7 +308,8 @@ type
     mShrI, mShlI, mBitandI, mBitorI, mBitxorI, mMinI, mMaxI, 
     mShrI64, mShlI64, mBitandI64, mBitorI64, mBitxorI64, mMinI64, mMaxI64,
     mMinF64, mMaxF64, mAddU, mSubU, mMulU, 
-    mDivU, mModU, mAddU64, mSubU64, mMulU64, mDivU64, mModU64, mEqI, mLeI, mLtI, 
+    mDivU, mModU, mAddU64, mSubU64, mMulU64, mDivU64, mModU64, mEqI, mLeI,
+    mLtI, 
     mEqI64, mLeI64, mLtI64, mEqF64, mLeF64, mLtF64, mLeU, mLtU, mLeU64, mLtU64, 
     mEqEnum, mLeEnum, mLtEnum, mEqCh, mLeCh, mLtCh, mEqB, mLeB, mLtB, mEqRef, 
     mEqProc, mEqUntracedRef, mLePtr, mLtPtr, mEqCString, mXor, mUnaryMinusI, 
@@ -326,7 +327,8 @@ type
     mInt64, mFloat, mFloat32, mFloat64, mBool, mChar, mString, mCstring, 
     mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, mStmt, mTypeDesc, 
     mIsMainModule, mCompileDate, mCompileTime, mNimrodVersion, mNimrodMajor, 
-    mNimrodMinor, mNimrodPatch, mCpuEndian, mHostOS, mHostCPU, mNaN, mInf, 
+    mNimrodMinor, mNimrodPatch, mCpuEndian, mHostOS, mHostCPU, mAppType, 
+    mNaN, mInf, 
     mNegInf, mNLen, mNChild, mNSetChild, mNAdd, mNAddMultiple, mNDel, mNKind, 
     mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, mNStrVal, mNSetIntVal, 
     mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, 
diff --git a/rod/c2nim/c2nim.cfg b/rod/c2nim/c2nim.cfg
new file mode 100755
index 000000000..789e6ec7f
--- /dev/null
+++ b/rod/c2nim/c2nim.cfg
@@ -0,0 +1,4 @@
+# Use the modules of the compiler
+
+path: "$nimrod/rod"
+
diff --git a/rod/c2nim/manual.txt b/rod/c2nim/manual.txt
index b2bb3dc06..68ad7a8bd 100644
--- a/rod/c2nim/manual.txt
+++ b/rod/c2nim/manual.txt
@@ -170,7 +170,7 @@ in the future as it cannot work for backends that do not generate C code.
 that can be used for the same purpose.
 
 c2nim does not do any name mangling by default. However the 
- ``#prefix`` and ``#suffix`` directives can be used to strip prefixes and
+``#prefix`` and ``#suffix`` directives can be used to strip prefixes and
 suffixes from the identifiers in the C code: 
  
 .. code-block:: C
diff --git a/rod/commands.nim b/rod/commands.nim
index 289f9c68e..f67a8e765 100755
--- a/rod/commands.nim
+++ b/rod/commands.nim
@@ -156,14 +156,14 @@ proc splitSwitch(switch: string, cmd, arg: var string, pass: TCmdLinePass,
                  info: TLineInfo) = 
   cmd = ""
   var i = 0
-  if (i < len(switch) + 0) and (switch[i] == '-'): inc(i)
-  if (i < len(switch) + 0) and (switch[i] == '-'): inc(i)
-  while i < len(switch) + 0: 
+  if i < len(switch) and switch[i] == '-': inc(i)
+  if i < len(switch) and switch[i] == '-': inc(i)
+  while i < len(switch): 
     case switch[i]
     of 'a'..'z', 'A'..'Z', '0'..'9', '_', '.': add(cmd, switch[i])
     else: break 
     inc(i)
-  if i >= len(switch) + 0: arg = ""
+  if i >= len(switch): arg = ""
   elif switch[i] in {':', '=', '['}: arg = copy(switch, i + 1)
   else: InvalidCmdLineOption(pass, switch, info)
   
diff --git a/rod/ropes.nim b/rod/ropes.nim
index 0139daf2b..542c6b3b3 100755
--- a/rod/ropes.nim
+++ b/rod/ropes.nim
@@ -52,9 +52,9 @@
 #  Note that the left and right pointers are not needed for leafs.
 #  Leafs have relatively high memory overhead (~30 bytes on a 32
 #  bit machines) and we produce many of them. This is why we cache and
-#  share leafs accross different rope trees.
+#  share leaves accross different rope trees.
 #  To cache them they are inserted in another tree, a splay tree for best
-#  performance. But for the caching tree we use the leafs' left and right
+#  performance. But for the caching tree we use the leaves' left and right
 #  pointers.
 #
 
diff --git a/rod/semfold.nim b/rod/semfold.nim
index 7aa6da1a6..a4de04e4f 100755
--- a/rod/semfold.nim
+++ b/rod/semfold.nim
@@ -274,6 +274,14 @@ proc magicCall(m: PSym, n: PNode): PNode =
     b = nil
   result = evalOp(s.magic, n, a, b, c)
   
+proc getAppType(n: PNode): PNode = 
+  if gGlobalOptions.contains(optGenDynLib):
+    result = newStrNodeT("lib", n)
+  elif gGlobalOptions.contains(optGenGuiApp):
+    result = newStrNodeT("gui", n)
+  else:
+    result = newStrNodeT("console", n)
+  
 proc getConstExpr(m: PSym, n: PNode): PNode = 
   result = nil
   case n.kind
@@ -293,6 +301,7 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
       of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
       of mHostOS: result = newStrNodeT(toLower(platform.OS[targetOS].name), n)
       of mHostCPU: result = newStrNodeT(toLower(platform.CPU[targetCPU].name), n)
+      of mAppType: result = getAppType(n)
       of mNaN: result = newFloatNodeT(NaN, n)
       of mInf: result = newFloatNodeT(Inf, n)
       of mNegInf: result = newFloatNodeT(NegInf, n)