Skip to content
This repository
Browse code

README++

  • Loading branch information...
commit 064b2a924f45d6258ba8a4e7a72d7b02c86ce18f 1 parent 0972185
Nathan Rajlich authored October 16, 2011

Showing 1 changed file with 28 additions and 22 deletions. Show diff stats Hide diff stats

  1. 50  README.md
50  README.md
Source Rendered
@@ -9,36 +9,42 @@ node-ffi is a Node.js addon for loading and calling dynamic libraries using pure
9 9
 
10 10
 It also simplifies the augmentation of node.js with C code as it takes care of handling the translation of types across JavaScript and C, which can add reams of boilerplate code to your otherwise simple C. See the `example/factorial` for an example of this use case.
11 11
 
12  
-WARNING: node-ffi assumes you know what you're doing. You can pretty easily create situations where you will segfault the interpreter and unless you've got C debugger skills, you probably won't know what's going on.
  12
+**WARNING**: node-ffi assumes you know what you're doing. You can pretty easily create situations where you will segfault the interpreter and unless you've got C debugger skills, you probably won't know what's going on.
13 13
 
14 14
 # EXAMPLE
15 15
 
16  
-    var FFI = require("node-ffi");
  16
+``` js
  17
+var FFI = require("node-ffi");
17 18
 
18  
-    var libm = new FFI.Library("libm", { "ceil": [ "double", [ "double" ] ] });
19  
-    libm.ceil(1.5); // 2
  19
+var libm = new FFI.Library("libm", { "ceil": [ "double", [ "double" ] ] });
  20
+libm.ceil(1.5); // 2
20 21
 
21  
-    // You can also access just functions in the current process by passing a null
22  
-    var current = new FFI.Library(null, { "atoi": [ "int32", [ "string" ] ] });
23  
-    current.atoi("1234"); // 1234
  22
+// You can also access just functions in the current process by passing a null
  23
+var current = new FFI.Library(null, { "atoi": [ "int32", [ "string" ] ] });
  24
+current.atoi("1234"); // 1234
  25
+```
24 26
 
25 27
 # REQUIREMENTS
26 28
 
27 29
 * Linux, OS X, or Solaris.
28  
-* The current version is tested to run on node.js 0.4 (specifically, 0.4.7)
  30
+* The current version is tested to run on node.js 0.4 (specifically, 0.4.12)
29 31
 * libffi installed -- with development headers (comes with OS X and most Linux distros)
30 32
 
31 33
 # NPM INSTALL
32  
-  
33  
-    $ npm install node-ffi
  34
+
  35
+``` bash
  36
+$ npm install node-ffi
  37
+```
34 38
 
35 39
 # SOURCE INSTALL
36 40
 
37  
-    $ git clone git://github.com/rbranson/node-ffi.git
38  
-    $ cd node-ffi
39  
-    $ node-waf configure build
40  
-    $ node test.js
41  
-    $ node-waf install
  41
+``` bash
  42
+$ git clone git://github.com/rbranson/node-ffi.git
  43
+$ cd node-ffi
  44
+$ node-waf configure build
  45
+$ node test.js
  46
+$ node-waf install
  47
+```
42 48
 
43 49
 # TYPES
44 50
 
@@ -61,13 +67,13 @@ In addition to the basic types, there are type aliases for common C types.
61 67
     char        char
62 68
     uchar       unsigned char
63 69
     short       short
64  
-    ushort		unsigned short
65  
-    int			int
66  
-    uint		unsigned int
67  
-    long		long
68  
-    ulong		unsigned long
69  
-    longlong	long long
70  
-    ulonglong	unsigned long long
  70
+    ushort      unsigned short
  71
+    int         int
  72
+    uint        unsigned int
  73
+    long        long
  74
+    ulong       unsigned long
  75
+    longlong    long
  76
+    ulonglong   unsigned long long
71 77
     size_t      platform-dependent, usually pointer size
72 78
 
73 79
 # V8 and 64-bit Types

0 notes on commit 064b2a9

Please sign in to comment.
Something went wrong with that request. Please try again.