about summary refs log tree commit diff stats
path: root/config.mk
blob: 690d48fa575ea2a64f20041b8acac54367f3291a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# dwm version
VERSION = 1.1

# Customize below to fit your system

# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib

# includes and libs
INCS = -I. -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11

# flags
CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS}
#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = -g ${LIBS}

# compiler and linker
CC = cc
LD = ${CC}
='n47' href='#n47'>47 48 49 50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70


                            
                                         




                                                   
                                   








                                                                     
                                     











                                       







                                       









                                            
                                   





                                                                     
                                                              





                                                                             





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

template setX(k, field) {.dirty.} =
  var s: seq[TFullReg]
  move(s, cast[seq[TFullReg]](a.slots))
  if s[a.ra].kind != k:
    myreset(s[a.ra])
    s[a.ra].kind = k
  s[a.ra].field = v

proc setResult*(a: VmArgs; v: BiggestInt) = setX(rkInt, intVal)
proc setResult*(a: VmArgs; v: BiggestFloat) = setX(rkFloat, floatVal)
proc setResult*(a: VmArgs; v: bool) =
  let v = v.ord
  setX(rkInt, intVal)

proc setResult*(a: VmArgs; v: string) =
  var s: seq[TFullReg]
  move(s, cast[seq[TFullReg]](a.slots))
  if s[a.ra].kind != rkNode:
    myreset(s[a.ra])
    s[a.ra].kind = rkNode
  s[a.ra].node = newNode(nkStrLit)
  s[a.ra].node.strVal = v

proc setResult*(a: VmArgs; n: PNode) =
  var s: seq[TFullReg]
  move(s, cast[seq[TFullReg]](a.slots))
  if s[a.ra].kind != rkNode:
    myreset(s[a.ra])
    s[a.ra].kind = rkNode
  s[a.ra].node = n

proc setResult*(a: VmArgs; v: seq[string]) =
  var s: seq[TFullReg]
  move(s, cast[seq[TFullReg]](a.slots))
  if s[a.ra].kind != rkNode:
    myreset(s[a.ra])
    s[a.ra].kind = rkNode
  var n = newNode(nkBracket)
  for x in v: n.add newStrNode(nkStrLit, x)
  s[a.ra].node = n

template getX(k, field) {.dirty.} =
  doAssert i < a.rc-1
  let s = cast[seq[TFullReg]](a.slots)
  doAssert s[i+a.rb+1].kind == k
  result = s[i+a.rb+1].field

proc getInt*(a: VmArgs; i: Natural): BiggestInt = getX(rkInt, intVal)
proc getBool*(a: VmArgs; i: Natural): bool = getInt(a, i) != 0
proc getFloat*(a: VmArgs; i: Natural): BiggestFloat = getX(rkFloat, floatVal)
proc getString*(a: VmArgs; i: Natural): string =
  doAssert i < a.rc-1
  let s = cast[seq[TFullReg]](a.slots)
  doAssert s[i+a.rb+1].kind == rkNode
  result = s[i+a.rb+1].node.strVal

proc getNode*(a: VmArgs; i: Natural): PNode =
  doAssert i < a.rc-1
  let s = cast[seq[TFullReg]](a.slots)
  doAssert s[i+a.rb+1].kind == rkNode
  result = s[i+a.rb+1].node