summary refs log tree commit diff stats
path: root/lib/wrappers/tinyc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wrappers/tinyc.nim')
-rw-r--r--[-rwxr-xr-x]lib/wrappers/tinyc.nim59
1 files changed, 24 insertions, 35 deletions
diff --git a/lib/wrappers/tinyc.nim b/lib/wrappers/tinyc.nim
index f685c714d..8d2ba3802 100755..100644
--- a/lib/wrappers/tinyc.nim
+++ b/lib/wrappers/tinyc.nim
@@ -1,6 +1,6 @@
 #
 #
-#            Nimrod's Runtime Library
+#            Nim's Runtime Library
 #        (c) Copyright 2010 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
@@ -8,10 +8,10 @@
 #
 
 type
-  TccState {.pure, final.} = object
-  PccState* = ptr TccState
-  
-  TErrorFunc* = proc (opaque: pointer, msg: cstring) {.cdecl.}
+  CcState {.pure, final.} = object
+  PccState* = ptr CcState
+
+  ErrorFunc* = proc (opaque: pointer, msg: cstring) {.cdecl.}
 
 proc openCCState*(): PccState {.importc: "tcc_new", cdecl.}
   ## create a new TCC compilation context
@@ -19,44 +19,39 @@ proc openCCState*(): PccState {.importc: "tcc_new", cdecl.}
 proc closeCCState*(s: PccState) {.importc: "tcc_delete", cdecl.}
   ## free a TCC compilation context
 
-proc enableDebug*(s: PccState) {.importc: "tcc_enable_debug", cdecl.}
-  ## add debug information in the generated code
-
-proc setErrorFunc*(s: PccState, errorOpaque: pointer, errorFun: TErrorFunc) {.
+proc setErrorFunc*(s: PccState, errorOpaque: pointer, errorFun: ErrorFunc) {.
   cdecl, importc: "tcc_set_error_func".}
   ## set error/warning display callback
 
-proc setWarning*(s: PccState, warningName: cstring, value: int) {.cdecl,
-  importc: "tcc_set_warning".}
-  ## set/reset a warning
+proc setOptions*(s: PccState, options: cstring) {.cdecl, importc: "tcc_set_options".}
+  ## set a options
 
-# preprocessor 
+# preprocessor
 
-proc addIncludePath*(s: PccState, pathname: cstring) {.cdecl, 
+proc addIncludePath*(s: PccState, pathname: cstring) {.cdecl,
   importc: "tcc_add_include_path".}
   ## add include path
 
-proc addSysincludePath*(s: PccState, pathname: cstring) {.cdecl, 
+proc addSysincludePath*(s: PccState, pathname: cstring) {.cdecl,
   importc: "tcc_add_sysinclude_path".}
   ## add in system include path
 
-
-proc defineSymbol*(s: PccState, sym, value: cstring) {.cdecl, 
+proc defineSymbol*(s: PccState, sym, value: cstring) {.cdecl,
   importc: "tcc_define_symbol".}
   ## define preprocessor symbol 'sym'. Can put optional value
 
-proc undefineSymbol*(s: PccState, sym: cstring) {.cdecl, 
+proc undefineSymbol*(s: PccState, sym: cstring) {.cdecl,
   importc: "tcc_undefine_symbol".}
   ## undefine preprocess symbol 'sym'
 
-# compiling 
+# compiling
 
-proc addFile*(s: PccState, filename: cstring): cint {.cdecl, 
+proc addFile*(s: PccState, filename: cstring): cint {.cdecl,
   importc: "tcc_add_file".}
   ## add a file (either a C file, dll, an object, a library or an ld
   ## script). Return -1 if error.
 
-proc compileString*(s: PccState, buf: cstring): cint {.cdecl, 
+proc compileString*(s: PccState, buf: cstring): cint {.cdecl,
   importc: "tcc_compile_string".}
   ## compile a string containing a C source. Return non zero if error.
 
@@ -64,18 +59,14 @@ proc compileString*(s: PccState, buf: cstring): cint {.cdecl,
 
 
 const
-  OutputMemory*: cint = 0 ## output will be ran in memory (no
+  OutputMemory*: cint = 1 ## output will be ran in memory (no
                           ## output file) (default)
-  OutputExe*: cint = 1 ## executable file
-  OutputDll*: cint = 2 ## dynamic library
-  OutputObj*: cint = 3 ## object file
-  OutputPreprocess*: cint = 4 ## preprocessed file (used internally)
-  
-  OutputFormatElf*: cint = 0 ## default output format: ELF
-  OutputFormatBinary*: cint = 1 ## binary image output
-  OutputFormatCoff*: cint = 2 ## COFF
-
-proc setOutputType*(s: PCCState, outputType: cint): cint {.cdecl, 
+  OutputExe*: cint = 2 ## executable file
+  OutputDll*: cint = 3 ## dynamic library
+  OutputObj*: cint = 4 ## object file
+  OutputPreprocess*: cint = 5 ## preprocessed file (used internally)
+
+proc setOutputType*(s: PccState, outputType: cint): cint {.cdecl,
   importc: "tcc_set_output_type".}
   ## set output type. MUST BE CALLED before any compilation
 
@@ -83,7 +74,7 @@ proc addLibraryPath*(s: PccState, pathname: cstring): cint {.cdecl,
   importc: "tcc_add_library_path".}
   ## equivalent to -Lpath option
 
-proc addLibrary*(s: PCCState, libraryname: cstring): cint {.cdecl,
+proc addLibrary*(s: PccState, libraryname: cstring): cint {.cdecl,
   importc: "tcc_add_library".}
   ## the library name is the same as the argument of the '-l' option
 
@@ -114,5 +105,3 @@ proc getSymbol*(s: PccState, name: cstring): pointer {.cdecl,
 proc setLibPath*(s: PccState, path: cstring) {.cdecl,
   importc: "tcc_set_lib_path".}
   ## set CONFIG_TCCDIR at runtime
-  
-