Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Anil Anar committed Jun 21, 2016
1 parent 267d277 commit ae6a6ba
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
To get started:
# To build:

Download [emscripten](https://kripken.github.io/emscripten-site/index.html). I used portable SDK. You may need to change your `PATH` depending on how/what you install. If you download portable SDK, you can find SDK binaries (e.g. `emmake`) in `$SDK_ROOT/emsdk_portable/emscripten/$VERSION/`. Then run the following:

Expand All @@ -8,13 +8,43 @@ cd dbc2json.js
emmake make
```

To clean:
# To use:

After project is built, `dist/main.js` is created which exports a function called `run`:

```c
const char* run();
```

`run` function expects a DBC file at `/test.dbc` (memory based virtual FS). You can run the following in Javascript to create the file:

```js
// Assuming dbcFile is the string content of an actual dbc file
FS.writeFile('/test.dbc', dbcFile);
```

### Example usage from browser:

```html
<script src="main.js"></script>
<script>
...
// Assuming dbcFile is the string content of an actual dbc file
var parse = Module.cwrap('run', 'string', []);
FS.writeFile('/test.dbc', dbcFile);
var output = parse();
FS.unlink('/test.dbc');
console.log(output);
</script>
```

# To clean:

```shell
make clean
```

To force build (in case stuff gets out of sync):
# To force build everything:

```shell
emmake make -B
Expand Down

0 comments on commit ae6a6ba

Please sign in to comment.