summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/private/pcre.nim49
1 files changed, 24 insertions, 25 deletions
diff --git a/src/private/pcre.nim b/src/private/pcre.nim
index 89bd5c58c..be348444b 100644
--- a/src/private/pcre.nim
+++ b/src/private/pcre.nim
@@ -35,8 +35,7 @@ else:
   {. compile: "private/pcre_src/pcre_xclass.c" .}
   {. compile: "private/pcre_src/pcre_chartables.c" .}
 
-  const pcreHeader = "pcre.h"
-  {.pragma: pcreImport, header: pcreHeader.}
+  {.pragma: pcreImport.}
 
 #************************************************
 #       Perl-Compatible Regular Expressions      *
@@ -343,16 +342,16 @@ type
 #remain compatible. 
 
 type 
-  ExtraData* {.importc: "pcre_extra", header: "pcre.h".} = object 
-    flags* {.importc: "flags".}: culong # Bits for which fields are set 
-    study_data* {.importc: "study_data".}: pointer # Opaque data from pcre_study() 
-    match_limit* {.importc: "match_limit".}: culong # Maximum number of calls to match() 
-    callout_data* {.importc: "callout_data".}: pointer # Data passed back in callouts 
-    tables* {.importc: "tables".}: ptr cuchar # Pointer to character tables 
-    match_limit_recursion* {.importc: "match_limit_recursion".}: culong # Max 
+  ExtraData* = object 
+    flags*: culong # Bits for which fields are set 
+    study_data*: pointer # Opaque data from pcre_study() 
+    match_limit*: culong # Maximum number of calls to match() 
+    callout_data*: pointer # Data passed back in callouts 
+    tables*: ptr cuchar # Pointer to character tables 
+    match_limit_recursion*: culong # Max 
                                                                         # recursive calls to match() 
-    mark* {.importc: "mark".}: ptr ptr cuchar # For passing back a mark pointer 
-    executable_jit* {.importc: "executable_jit".}: pointer # Contains a pointer to a compiled jit code 
+    mark*: ptr ptr cuchar # For passing back a mark pointer 
+    executable_jit*: pointer # Contains a pointer to a compiled jit code 
 
 # The structure for passing out data via the pcre_callout_function. We use a
 #structure so that new fields can be added on the end in future versions,
@@ -360,25 +359,25 @@ type
 #without modification. 
 
 type 
-  callout_block* {.importc: "pcre_callout_block", header: pcreHeader.} = object 
-    version* {.importc: "version".}: cint # Identifies version of block 
+  callout_block* = object 
+    version*: cint # Identifies version of block 
                                           # ------------------------ Version 0 ------------------------------- 
-    callout_number* {.importc: "callout_number".}: cint # Number compiled into pattern 
-    offset_vector* {.importc: "offset_vector".}: ptr cint # The offset vector 
-    subject* {.importc: "subject".}: cstring # The subject being matched 
-    subject_length* {.importc: "subject_length".}: cint # The length of the subject 
-    start_match* {.importc: "start_match".}: cint # Offset to start of this match attempt 
-    current_position* {.importc: "current_position".}: cint # Where we currently are in the subject 
-    capture_top* {.importc: "capture_top".}: cint # Max current capture 
-    capture_last* {.importc: "capture_last".}: cint # Most recently closed capture 
-    callout_data* {.importc: "callout_data".}: pointer # Data passed in with the call 
+    callout_number*: cint # Number compiled into pattern 
+    offset_vector*: ptr cint # The offset vector 
+    subject*: cstring # The subject being matched 
+    subject_length*: cint # The length of the subject 
+    start_match*: cint # Offset to start of this match attempt 
+    current_position*: cint # Where we currently are in the subject 
+    capture_top*: cint # Max current capture 
+    capture_last*: cint # Most recently closed capture 
+    callout_data*: pointer # Data passed in with the call 
                                                        # ------------------- Added for Version 1 
                                                        # -------------------------- 
-    pattern_position* {.importc: "pattern_position".}: cint # Offset to next item in the pattern 
-    next_item_length* {.importc: "next_item_length".}: cint # Length of next item in the pattern 
+    pattern_position*: cint # Offset to next item in the pattern 
+    next_item_length*: cint # Length of next item in the pattern 
                                                             # ------------------- Added for Version 2 
                                                             # -------------------------- 
-    mark* {.importc: "mark".}: ptr cuchar # Pointer to current mark or NULL    
+    mark*: ptr cuchar # Pointer to current mark or NULL    
                                           # 
                                           # ------------------------------------------------------------------ 
 # Indirection for store get and free functions. These can be set to
ame the previous revision' href='/ahoang/Nim/blame/tools/build.tmpl?h=devel&id=300430fbba28b408f7ac86ca46b03d9d50839399'>^
f56816def ^
66a7e3d37 ^




f58cc4967 ^

66a7e3d37 ^

ff02ce2d5 ^



66a7e3d37 ^

b1ca3ab7c ^
ff02ce2d5 ^



66a7e3d37 ^


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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
                                   
                                                         


                                                                           

            

                                 




                                            
                                              





















                                            
                                        

                  





















                                                
            



                                   
                        
                    








                                          







                                        
                       




                                                                         

                                                                                

            



                                                          

      
          



                                                        


              
#! stdtmpl(subsChar='?') | standard
#proc GenerateBuildShellScript(c: TConfigData): string = 
#  result = "#! /bin/sh\n# Generated from niminst\n" &
#           "# Template is in tools/buildsh.tmpl\n" &
#           "# To regenerate run ``niminst csource`` or ``koch csource``\n"
CC="gcc"
LINKER="gcc"
COMP_FLAGS="?{c.ccompiler.flags}"
LINK_FLAGS="?{c.linker.flags}"
#  add(result, "# platform detection\n")
ucpu=`uname -m`
uos=`uname`

#  add(result, "# convert to lower case:\n")
ucpu=`echo $ucpu | tr "[:upper:]" "[:lower:]"`
uos=`echo $uos | tr "[:upper:]" "[:lower:]"`

case $uos in
  *linux* ) 
    myos="linux" 
    LINK_FLAGS="$LINK_FLAGS -ldl -lm"
    ;;
  *freebsd* ) 
    myos="freebsd"
    LINK_FLAGS="$LINK_FLAGS -lm"
    ;;
  *openbsd* )
    myos="openbsd" 
    LINK_FLAGS="$LINK_FLAGS -lm"
    ;;
  *netbsd* )
    myos="netbsd"
    LINK_FLAGS="$LINK_FLAGS -lm"
    ;;
  *darwin* ) 
    myos="macosx"
    LINK_FLAGS="$LINK_FLAGS -ldl -lm"
    if [ "$HOSTTYPE" = "x86_64" ] ; then
      ucpu="amd64"
    fi
    ;;
  *aix* )
    myos="aix"
    LINK_FLAGS="$LINK_FLAGS -ldl -lm"    
    ;;
  *solaris* | *sun* ) 
    myos="solaris"
    LINK_FLAGS="$LINK_FLAGS -ldl -lm"
    ;;
  *) 
    echo "Error: unknown operating system: $uos"
    exit 1
    ;;
esac

case $ucpu in
  *i386* | *i486* | *i586* | *i686* ) 
    mycpu="i386" ;;
  *amd*64* | *x86-64* | *x86_64* ) 
    mycpu="amd64" ;;
  *sparc*|*sun* ) 
    mycpu="sparc" ;;
  *ppc64* ) 
    if [ "$myos" = "linux" ] ; then
      COMP_FLAGS="$COMP_FLAGS -m64"
      LINK_FLAGS="$LINK_FLAGS -m64"
    fi
    mycpu="powerpc64" ;;
  *power*|*Power* ) 
    mycpu="powerpc" ;;
  *mips* ) 
    mycpu="mips" ;;
  *) 
    echo "Error: unknown processor: $ucpu"
    exit 1
    ;;
esac

#  add(result, "# call the compiler:\n")

case $myos in
#  for osA in 1..c.oses.len:
?{c.oses[osA-1]}) 
  case $mycpu in
#    for cpuA in 1..c.cpus.len:
  ?{c.cpus[cpuA-1]})
#      var linkCmd = ""
#      for f in items(c.cfiles[osA][cpuA]):
    echo "$CC $COMP_FLAGS -Ibuild -c ?{f} -o ?{changeFileExt(f, "o")}"
    $CC $COMP_FLAGS -Ibuild -c ?{f} -o ?{changeFileExt(f, "o")} || exit 1
#        add(linkCmd, " \\\n" & changeFileExt(f, "o"))
#      end for    
    echo "$LINKER $LINK_FLAGS -o ?{firstBinPath(c)/toLower(c.name)} ?linkCmd"
    $LINKER $LINK_FLAGS -o ?{firstBinPath(c)/toLower(c.name)} ?linkCmd || exit 1
    ;;
#    end for
  *)
    echo "Error: no C code generated for: [$myos: $mycpu]"
    exit 1
    ;;
  esac
  ;;
#  end for
*) 
  echo "Error: no C code generated for: [$myos: $mycpu]"
  exit 1
  ;;
esac

echo "SUCCESS"