summary refs log tree commit diff stats
path: root/lib/pure
Commit message (Expand)AuthorAgeFilesLines
* Improve asyncdispatch error messages, fix some tests on Windows.Dominik Picheta2015-09-111-17/+31
* Implement strutils.indentDominik Picheta2015-09-111-0/+18
* Reintroduce FutureVar[T] from commit 72b4912c84b16644657.Dominik Picheta2015-09-113-20/+70
* Example: add extra getGmTime interval addition exampleJamesP2015-09-101-1/+2
* tests added: toSeconds with local/GM timezones, interval add/subJamesP2015-09-101-0/+25
* bug fix: `+` and `-` handle GM and Local time correctlyJamesP2015-09-101-8/+8
* add examples block to top of times moduleJamesP2015-09-101-0/+19
* Merge pull request #3303 from Amrykid/amrykid-name-changeAndreas Rumpf2015-09-082-4/+4
|\
| * Fixed my name.Alexander Mitchell-Robinson2015-09-072-4/+4
* | Added == operator for comparing two Object IDsRostyslav Dzinko2015-09-081-0/+4
|/
* Merge remote-tracking branch 'upstream/devel' into improve-xmltreeAndrey Sobolev2015-09-071-2/+7
|\
| * documented NimScriptAraq2015-09-071-2/+7
* | allow to delete xmlnode childsAndrey Sobolev2015-09-071-0/+5
* | add text modification procAndrey Sobolev2015-09-071-0/+6
|/
* Fixes dom96/jester#45.Dominik Picheta2015-09-061-0/+1
* attempt to support recursions for spawnAraq2015-09-061-2/+20
* fixes #3282Araq2015-09-051-1/+1
* lib: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-0440-1316/+1316
* Merge pull request #3288 from Snowie/develDominik Picheta2015-09-041-2/+10
|\
| * Include port in host header as expectedDoran2015-09-041-2/+10
* | Merge pull request #3285 from nanoant/patch/lib-pure-osproc-spawn-vs-fork-sim...Dominik Picheta2015-09-041-38/+39
|\ \
| * | osproc: Define and select spawn/fork same wayAdam Strzelecki2015-09-031-38/+39
* | | split os into os and ospaths parts; ospaths is available for NimScript; bette...Araq2015-09-042-524/+562
| |/ |/|
* | times: Export & document countLeapYears/Years/DaysAdam Strzelecki2015-09-031-14/+18
|/
* formatFloat takes an optional decimalSep parameterAraq2015-09-011-10/+17
* Add :idx: for `suspend` in coro module.Dominik Picheta2015-08-301-0/+2
* coro.sleep -> suspendSimon Hafner2015-08-301-5/+5
* removed coro deprecationsSimon Hafner2015-08-251-6/+0
* removed coro prefixes from coro.nimSimon Hafner2015-08-251-17/+19
* Merge pull request #3160 from r-ku/coroutinesAndreas Rumpf2015-08-251-0/+145
|\
| * Merge branch 'devel' into coroutinesrku2015-08-2011-46/+354
| |\
| * | Coroutine support for i386/amd64 platforms unix/windows OSes markAndSweep/ref...rku2015-07-311-0/+145
* | | implemented nimPinToCpu threadpool featureAraq2015-08-241-1/+9
* | | Improves osproc.startProcess error message on POSIX. Ref #2183.Dominik Picheta2015-08-231-1/+2
* | | Improves osproc.startProcess error message. Fixes #2183.Dominik Picheta2015-08-231-1/+8
* | | Better docs for os.getCreationTime(). Fixes #1058.Dominik Picheta2015-08-231-2/+4
* | | Fixes parsing of URIs that begin with '//'.Dominik Picheta2015-08-231-7/+20
* | | math.nim works with NimScriptAraq2015-08-211-7/+9
* | | Merge pull request #3205 from fenekku/unittest-work-2Andreas Rumpf2015-08-211-15/+21
|\ \ \
| * | | make testSetupIMPL and testTeardownIMPL non-publicfenekku2015-08-121-5/+4
| * | | failed unittest check causes identifiers and calls to be printed outfenekku2015-08-121-10/+17
* | | | Merge pull request #3215 from rbehrends/fix-reversed-emptyAndreas Rumpf2015-08-211-1/+2
|\ \ \ \ | |_|_|/ |/| | |
| * | | Fixed algorithm.reversed to work for empty seq's.Reimer Behrends2015-08-141-1/+2
* | | | workaround windows 'findNextFile' bugAraq2015-08-161-1/+8
* | | | Merge pull request #3213 from yglukhov/times-js-fixDominik Picheta2015-08-141-16/+18
|\ \ \ \
| * | | | Fixed compilation of times module with JS.Yuriy Glukhov2015-08-141-16/+18
| |/ / /
* / / / Fix exponentiation operation to avoid overflow.Reimer Behrends2015-08-141-1/+3
|/ / /
* | | Merge pull request #3131 from zachaysan/develDominik Picheta2015-08-131-2/+57
|\ \ \
| * | | Add extern pragmaZach Aysan2015-07-211-3/+5
| * | | Add docsZach Aysan2015-07-211-0/+27
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88


                               
                                         







                                                   
                                     
 


                                                                             
 
                                     
                           
 
                                    
                            
 
                                        



                                                           
 
                                      

                                  
 
                                   
            

                                  
 
                      
                                                 
                                                     

                                            
                                
                          
                            
                          
                                 

                                  



                                     
               





                             

                                                                           
















                                     
               
                                           


                                                             

                                                              
#
#
#           The Nimrod Compiler
#        (c) Copyright 2013 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

# This module handles the conditional symbols.

import 
  strtabs, platform, strutils, idents

# We need to use a PStringTable here as defined symbols are always guaranteed
# to be style insensitive. Otherwise hell would break lose.
var gSymbols: PStringTable

proc DefineSymbol*(symbol: string) = 
  gSymbols[symbol] = "true"

proc UndefSymbol*(symbol: string) = 
  gSymbols[symbol] = "false"

proc isDefined*(symbol: string): bool = 
  if gSymbols.hasKey(symbol):
    result = gSymbols[symbol] == "true"
  
proc isDefined*(symbol: PIdent): bool = isDefined(symbol.s)

iterator definedSymbolNames*: string =
  for key, val in pairs(gSymbols):
    if val == "true": yield key

proc countDefinedSymbols*(): int = 
  result = 0
  for key, val in pairs(gSymbols):
    if val == "true": inc(result)

proc InitDefines*() = 
  gSymbols = newStringTable(modeStyleInsensitive)
  DefineSymbol("nimrod") # 'nimrod' is always defined
  # for bootstrapping purposes and old code:
  DefineSymbol("nimhygiene")
  DefineSymbol("niminheritable")
  DefineSymbol("nimmixin")
  DefineSymbol("nimeffects")
  DefineSymbol("nimbabel")
  DefineSymbol("nimcomputedgoto")
  
  # add platform specific symbols:
  case targetCPU
  of cpuI386: DefineSymbol("x86")
  of cpuIa64: DefineSymbol("itanium")
  of cpuAmd64: DefineSymbol("x8664")
  else: discard
  case targetOS
  of osDOS: 
    DefineSymbol("msdos")
  of osWindows: 
    DefineSymbol("mswindows")
    DefineSymbol("win32")
  of osLinux, osMorphOS, osSkyOS, osIrix, osPalmOS, osQNX, osAtari, osAix, 
     osHaiku:
    # these are all 'unix-like'
    DefineSymbol("unix")
    DefineSymbol("posix")
  of osSolaris: 
    DefineSymbol("sunos")
    DefineSymbol("unix")
    DefineSymbol("posix")
  of osNetBSD, osFreeBSD, osOpenBSD: 
    DefineSymbol("unix")
    DefineSymbol("bsd")
    DefineSymbol("posix")
  of osMacOS: 
    DefineSymbol("macintosh")
  of osMacOSX: 
    DefineSymbol("macintosh")
    DefineSymbol("unix")
    DefineSymbol("posix")
  else: discard
  DefineSymbol("cpu" & $cpu[targetCPU].bit)
  DefineSymbol(normalize(endianToStr[cpu[targetCPU].endian]))
  DefineSymbol(cpu[targetCPU].name)
  DefineSymbol(platform.os[targetOS].name)
  if platform.OS[targetOS].props.contains(ospLacksThreadVars):
    DefineSymbol("emulatedthreadvars")