Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to next/kelvin/410 #673

Merged
merged 7 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ you can pass them with [`--per_file_copt`][per_file_copt] like so:
bazel build --per_file_copt='pkg/.*@-DMACRO'
```

## LSP Integration

```console
bazel run //bazel:refresh_compile_commands
```

Running this command will generate a `compile_commands.json` file in the root
of the repository, which `clangd` (or other language server processors) will
use automatically to provide modern editor features like syntax highlighting,
go-to definitions, call hierarchies, symbol manipulation, etc.

## Test Commands

You can build and run unit tests only on native builds. If you have a native
Expand Down
14 changes: 14 additions & 0 deletions pkg/c3/defs.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#include "defs.h"

c3_s
c3_sift_short(c3_y buf_y[2]);
c3_w
c3_sift_word(c3_y buf_y[4]);
c3_d
c3_sift_chub(c3_y byt_y[8]);

void
c3_etch_short(c3_y buf_y[2], c3_s sot_s);
void
c3_etch_word(c3_y buf_y[4], c3_w wod_w);
void
c3_etch_chub(c3_y byt_y[8], c3_d num_d);

c3_w c3_align_w(c3_w x, c3_w al, align_dir hilo);
c3_d c3_align_d(c3_d x, c3_d al, align_dir hilo);
void *c3_align_p(void const * p, size_t al, align_dir hilo);
54 changes: 54 additions & 0 deletions pkg/c3/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,60 @@
| (((w) >> 8) & 0xff) << 16 \
| ( (w) & 0xff) << 24 )

inline c3_s
c3_sift_short(c3_y buf_y[2])
{
return (buf_y[1] << 8 | buf_y[0]);
}

inline c3_w
c3_sift_word(c3_y buf_y[4])
{
return (buf_y[3] << 24 | buf_y[2] << 16 | buf_y[1] << 8 | buf_y[0]);
}

inline c3_d
c3_sift_chub(c3_y byt_y[8])
{
return (c3_d)byt_y[0]
| (c3_d)byt_y[1] << 8
| (c3_d)byt_y[2] << 16
| (c3_d)byt_y[3] << 24
| (c3_d)byt_y[4] << 32
| (c3_d)byt_y[5] << 40
| (c3_d)byt_y[6] << 48
| (c3_d)byt_y[7] << 56;
}

inline void
c3_etch_short(c3_y buf_y[2], c3_s sot_s)
{
buf_y[0] = sot_s & 0xff;
buf_y[1] = (sot_s >> 8) & 0xff;
}

inline void
c3_etch_word(c3_y buf_y[4], c3_w wod_w)
{
buf_y[0] = wod_w & 0xff;
buf_y[1] = (wod_w >> 8) & 0xff;
buf_y[2] = (wod_w >> 16) & 0xff;
buf_y[3] = (wod_w >> 24) & 0xff;
}

inline void
c3_etch_chub(c3_y byt_y[8], c3_d num_d)
{
byt_y[0] = num_d & 0xff;
byt_y[1] = (num_d >> 8) & 0xff;
byt_y[2] = (num_d >> 16) & 0xff;
byt_y[3] = (num_d >> 24) & 0xff;
byt_y[4] = (num_d >> 32) & 0xff;
byt_y[5] = (num_d >> 40) & 0xff;
byt_y[6] = (num_d >> 48) & 0xff;
byt_y[7] = (num_d >> 56) & 0xff;
}

/* Asserting allocators.
*/
# define c3_free(s) free(s)
Expand Down
2 changes: 2 additions & 0 deletions pkg/vere/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ vere_library(
"*.h",
"db/*.c",
"io/*.c",
"io/*/*.h",
"io/*/*.c",
],
exclude = [
"main.c",
Expand Down
4 changes: 2 additions & 2 deletions pkg/vere/ames_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ _test_stun_addr_roundtrip(u3_lane* inn_u)
c3_y req_y[20] = {0};
c3_i ret_i = 0;

_stun_make_response(req_y, inn_u, rep_y);
u3_stun_make_response(req_y, inn_u, rep_y);

u3_lane lan_u;

if ( c3n == _stun_find_xor_mapped_address(rep_y, sizeof(rep_y), &lan_u) ) {
if ( c3n == u3_stun_find_xor_mapped_address(rep_y, sizeof(rep_y), &lan_u) ) {
fprintf(stderr, "stun: failed to find addr in response\r\n");
ret_i = 1;
}
Expand Down
Loading
Loading