libkernaux/CONTRIBUTING.md

81 lines
1.4 KiB
Markdown
Raw Normal View History

2022-06-08 07:45:28 +00:00
Common
------
* Add your name to [COPYING](/COPYING).
2022-06-12 13:52:40 +00:00
* If you change the behavior (even just fix a bug) of **libkernaux** (stable) or
[libc](/libc), add a record to [ChangeLog](/ChangeLog).
2022-06-08 07:45:28 +00:00
2022-05-30 21:13:43 +00:00
C language
----------
2022-06-15 10:10:44 +00:00
* Create `typedef`s with the names of related `struct`s. Use this name with a
prefix `struct` to declare the data itself, withoth the prefix to declare
a pointer or an array:
```c
typedef struct FooBar { int car; } *FooBar;
static struct FooBar FooBar_create();
2022-06-15 10:14:37 +00:00
static void FooBar FooBar_init(FooBar foobar);
2022-06-15 10:10:44 +00:00
2022-06-15 10:14:37 +00:00
static void FooBar_do_something(FooBar foobar);
2022-06-15 10:10:44 +00:00
2022-06-15 10:14:37 +00:00
// Initialize:
2022-06-15 10:10:44 +00:00
struct FooBar foobar = FooBar_create();
2022-06-15 10:14:37 +00:00
// or
struct FooBar foobar;
FooBar_init(&foobar);
// Use:
2022-06-15 10:10:44 +00:00
FooBar foobar_ptr = &foobar;
FooBar_do_something(&foobar);
```
```c
typedef struct FooBar { int car; } FooBar[1];
static struct FooBar FooBar_create();
static void FooBar FooBar_init(FooBar foobar);
static void FooBar_do_something(FooBar foobar);
2022-06-15 10:14:37 +00:00
// Initialize:
2022-06-15 10:10:44 +00:00
FooBar foobar = { FooBar_create() };
// or
FooBar foobar;
FooBar_init(foobar);
2022-06-15 10:14:37 +00:00
// Use:
2022-06-15 10:10:44 +00:00
FooBar_do_something(foobar);
```
2022-05-30 21:13:43 +00:00
Python
------
Nothing here yet.
Ruby
----
### Matz's Ruby interpreter
Use **RuboCop**. See [bindings/ruby/.rubocop.yml](/bindings/ruby/.rubocop.yml)
2022-05-30 21:13:43 +00:00
### mruby
Use **RuboCop**. See [bindings/mruby/.rubocop.yml](/bindings/mruby/.rubocop.yml)
2022-05-30 21:13:43 +00:00
Rust
----
Use **rustfmt** and **Clippy**.
See [bindings/rust/rustfmt.toml](/bindings/rust/rustfmt.toml)