Skip to content

Commit

Permalink
Add auto-generated go bindings
Browse files Browse the repository at this point in the history
Bindings were generated using c-for-go (https://github.com/xlab/c-for-go)
  • Loading branch information
Asalle authored and gavv committed Nov 13, 2019
1 parent 339acfd commit c546c98
Show file tree
Hide file tree
Showing 14 changed files with 1,472 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{go,c}]
charset = utf-8

# 4 space indentation
[*.go]
indent_style = tab
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
all:
all: build test

.PHONY: build test

build:
go build ./roc

test:
go test ./roc/...
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
Go bindings for Roc
-------------------

*Work in progress!*
_Work in progress!_

```
go get github.com/roc-project/roc-go/roc
```

# Dependencies
You will need to have libroc and libroc-devel (headers) installed. Refer to official build [instructions](https://roc-project.github.io/roc/docs/building.html) on how to install libroc. There is no official distribution for any os as of now, you will need to install from source.

# Build
Will not produce any lib/binary. It's just to check for the syntax errors:

`make build`

# Test

`make test`
73 changes: 73 additions & 0 deletions roc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
GENERATOR:
PackageName: roc
PackageDescription: "Package roc provides Go bindings for libroc"
PackageLicense: ""
Includes:
- ../include/roc/address.h
- ../include/roc/config.h
- ../include/roc/context.h
- ../include/roc/frame.h
- ../include/roc/log.h
- ../include/roc/platform.h
- ../include/roc/receiver.h
- ../include/roc/sender.h
FlagGroups:
- {name: "CFLAGS", flags: [
"-I\"../include\"",
]}
- {name: "LDFLAGS", flags: [
"-lroc",
]}

PARSER:
IncludePaths: ["include", "/usr/lib/gcc/x86_64-redhat-linux/9/include"]
SourcesPaths:
- include/roc/address.h
- include/roc/config.h
- include/roc/context.h
- include/roc/frame.h
- include/roc/log.h
- include/roc/platform.h
- include/roc/receiver.h
- include/roc/sender.h

TRANSLATOR:
ConstRules:
defines: expand
PtrTips:
function:
- {target: "^roc_address_init$", tips: [ref,0,ref,0]}
- {target: "^roc_address_family$", tips: [ref]}
- {target: "^roc_address_ip$", tips: [ref,arr]}
- {target: "^roc_context", tips: [ref]}
- {target: "^roc_receiver_open$", tips: [ref, ref]}
- {target: "^roc_receiver_bind$", tips: [ref, 0, 0, ref]}
- {target: "^roc_receiver_read$", tips: [ref, ref]}
- {target: "^roc_receiver_close$", tips: [ref]}
- {target: "^roc_sender_open$", tips: [ref, ref]}
- {target: "^roc_sender_bind$", tips: [ref, ref]}
- {target: "^roc_sender_connect$", tips: [ref, 0, 0, ref]}
- {target: "^roc_sender_write$", tips: [ref, ref]}
- {target: "^roc_sender_close$", tips: [ref]}
- {target: "^roc_", tips: [sref, sref, sref, sref, sref]}
Rules:
global:
- {transform: lower}
- {action: accept, from: "^roc_"}
- {action: replace, from: "^roc_", to: _}
- {transform: unexport}
const:
- {transform: export}
- {action: accept, from: "^ROC_"}
- {action: replace, from: "^ROC_", to: _}
type:
- {transform: export}
- {action: replace, from: "_t$"}
function:
- {transform: unexport}
private:
- {transform: unexport}
post-global:
- {action: replace, from: _$}
- {load: snakecase}
10 changes: 10 additions & 0 deletions roc/cgo_helpers.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// WARNING: This file has automatically been generated on Sun, 03 Nov 2019 20:29:42 CET.
// Code generated by https://git.io/c-for-go. DO NOT EDIT.

#include "_cgo_export.h"
#include "cgo_helpers.h"

void roc_log_handler_9e4bbc5e(roc_log_level level, char* component, char* message) {
logHandler9E4BBC5E(level, component, message);
}

Loading

0 comments on commit c546c98

Please sign in to comment.