From 928b460051be016d0035c90bb94f4168db68386b Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Mon, 6 Jun 2011 10:46:18 -0400 Subject: snapshot of project "lynx", label v2-8-8dev_8k --- makefile.bcb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'makefile.bcb') diff --git a/makefile.bcb b/makefile.bcb index c197a240..c1d093c1 100644 --- a/makefile.bcb +++ b/makefile.bcb @@ -1,4 +1,4 @@ -# $LynxId: makefile.bcb,v 1.15 2011/05/28 13:07:55 tom Exp $ +# $LynxId: makefile.bcb,v 1.16 2011/06/04 14:18:03 tom Exp $ # # Borland C++ / C++ builder # 1997/11/08 (Sat) 10:45:37 @@ -42,7 +42,7 @@ DEBUG= #SOCK_DEFS = /DUSE_WINSOCK2_H /D_WIN32_WINNT=0x0400 CC_FLAGS = $(DEBUG) $(CS_DEFS) $(SOCK_DEFS) \ --I./;$(ETC_LIB);SRC;$(WWW_LIB);$(BCC_INC);SRC/CHRTRANS \ +-I./;$(ETC_LIB);$(ETC_LIB)/openssl;SRC;$(WWW_LIB);$(BCC_INC);SRC/CHRTRANS \ -DACCESS_AUTH \ -DCJK_EX \ -DCOLOR_CURSES \ @@ -71,6 +71,10 @@ CC_FLAGS = $(DEBUG) $(CS_DEFS) $(SOCK_DEFS) \ -DUSE_EXTERNALS \ -DUSE_JUSTIFY_ELTS \ -DUSE_MULTIBYTE_CURSES \ +-DFEPCTRL \ +-DENABLE_NLS \ +-DHAVE_GETTEXT \ +-DHAVE_LIBINTL_H \ -DUSE_PERSISTENT_COOKIES \ -DUSE_PRETTYSRC \ -DUSE_READPROGRESS \ @@ -80,6 +84,8 @@ CC_FLAGS = $(DEBUG) $(CS_DEFS) $(SOCK_DEFS) \ -DWIN_EX \ -D_WINDOWS \ -D_WIN_CC=1 \ +-DUSE_SSL \ +-DUSE_X509_SUPPORT \ -DEXP_JAPANESEUTF8_SUPPORT # @@ -98,8 +104,12 @@ clean : -del /f/s/q *.i Dep_lynxdexe = \ - $(ETC_LIB)/zlib.lib\ + $(ETC_LIB)/zdllbor.lib\ $(ETC_LIB)/pdcurses.lib\ + $(ETC_LIB)/libeay32.lib\ + $(ETC_LIB)/ssleay32.lib\ + $(ETC_LIB)/iconv.lib\ + $(ETC_LIB)/libintl.lib\ $(ETC_LIB)/iconv.lib\ $(OBJ)/DefaultStyle.obj\ $(OBJ)/GridText.obj\ -- cgit 1.4.1-2-gfad0 /stats/compiler/hlo.nim?h=devel'>stats
path: root/compiler/hlo.nim
blob: 152fd44147980e7bca781cd024d56cf83a259def (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
89
90
91
#
#
#           The Nimrod Compiler
#        (c) Copyright 2012 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

# This include implements the high level optimization pass.

proc hlo(c: PContext, n: PNode): PNode

proc evalPattern(c: PContext, n, orig: PNode): PNode =
  InternalAssert n.kind == nkCall and n.sons[0].kind == nkSym
  # we need to ensure that the resulting AST is semchecked. However, it's
  # aweful to semcheck before macro invocation, so we don't and treat
  # templates and macros as immediate in this context.
  var rule: string
  if optHints in gOptions and hintPattern in gNotes:
    rule = renderTree(n, {renderNoComments})
  let s = n.sons[0].sym
  case s.kind
  of skMacro:
    result = semMacroExpr(c, n, orig, s)
  of skTemplate:
    result = semTemplateExpr(c, n, s)
  else:
    result = semDirectOp(c, n, {})
  if optHints in gOptions and hintPattern in gNotes:
    Message(orig.info, hintPattern, rule & " --> '" & 
      renderTree(result, {renderNoComments}) & "'")
  # check the resulting AST for optimization rules again:
  result = hlo(c, result)

proc applyPatterns(c: PContext, n: PNode): PNode =
  result = n
  # we apply the last pattern first, so that pattern overriding is possible;
  # however the resulting AST would better not trigger the old rule then
  # anymore ;-)
  for i in countdown(<c.patterns.len, 0):
    let pattern = c.patterns[i]
    if not isNil(pattern):
      let x = applyRule(c, pattern, result)
      if not isNil(x):
        assert x.kind in {nkStmtList, nkCall}
        inc(evalTemplateCounter)
        if evalTemplateCounter > 100:
          GlobalError(n.info, errTemplateInstantiationTooNested)
        # deactivate this pattern:
        c.patterns[i] = nil
        if x.kind == nkStmtList:
          assert x.len == 3
          x.sons[1] = evalPattern(c, x.sons[1], result)
          result = flattenStmts(x)
        else:
          result = evalPattern(c, x, result)
        dec(evalTemplateCounter)
        # activate this pattern again:
        c.patterns[i] = pattern

proc hlo(c: PContext, n: PNode): PNode =
  case n.kind
  of nkMacroDef, nkTemplateDef, procDefs:
    # already processed (special cases in semstmts.nim)
    result = n
  else:
    result = applyPatterns(c, n)
    if result == n:
      # no optimization applied, try subtrees:
      for i in 0 .. < safeLen(result):
        let a = result.sons[i]
        let h = hlo(c, a)
        if h != a: result.sons[i] = h
    else:
      # perform type checking, so that the replacement still fits:
      if n.typ == nil and (result.typ == nil or 
          result.typ.kind in {tyStmt, tyEmpty}):
        nil
      else:
        result = fitNode(c, n.typ, result)

proc hloBody(c: PContext, n: PNode): PNode =
  # fast exit:
  if c.patterns.len == 0 or optPatterns notin gOptions: return n
  result = hlo(c, n)

proc hloStmt(c: PContext, n: PNode): PNode =
  # fast exit:
  if c.patterns.len == 0 or optPatterns notin gOptions: return n
  result = hlo(c, n)