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

Configuration for clang-format #406

Merged
merged 2 commits into from
Oct 11, 2019
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
9 changes: 9 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
Language: Cpp
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 90
AccessModifierOffset: -4
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
SortIncludes: false # breaks the build when enabled
16 changes: 16 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

for f in src/*.c src/*.cpp src/*.h release/include/*/*.h tests/*.h tests/*/*.h; do
# Skip files that are imported from external sources.
if [[ ! $f = src/bin2c.* && \
! $f = src/lctype.* && \
! $f = src/linenoise.* && \
! $f = src/lj_strscan.* && \
! $f = src/lstring.* && \
! $f = src/lzio.* && \
! $f = src/MSVCSetupAPI.* ]]; then
clang-format -i "$f"
fi
done
23 changes: 10 additions & 13 deletions release/include/terra/terra.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* See Copyright Notice in ../LICENSE.txt */


#ifndef terra_h
#define terra_h

Expand All @@ -12,30 +11,28 @@ extern "C" {
#include "lualib.h"
#include "lauxlib.h"

int terra_init(lua_State * L);
int terra_init(lua_State *L);

typedef struct { /* default values are 0 */
typedef struct { /* default values are 0 */
int verbose; /*-v, print more debugging info (can be 1 for some, 2 for more) */
int debug; /*-g, turn on debugging symbols and base pointers */
int usemcjit;
char* cmd_line_chunk;
char *cmd_line_chunk;
} terra_Options;
int terra_initwithoptions(lua_State * L, terra_Options * options);
int terra_initwithoptions(lua_State *L, terra_Options *options);

int terra_load(lua_State *L,lua_Reader reader, void *data, const char *chunkname);
int terra_loadfile(lua_State * L, const char * file);
int terra_loadbuffer(lua_State * L, const char *buf, size_t size, const char *name);
int terra_load(lua_State *L, lua_Reader reader, void *data, const char *chunkname);
int terra_loadfile(lua_State *L, const char *file);
int terra_loadbuffer(lua_State *L, const char *buf, size_t size, const char *name);
int terra_loadstring(lua_State *L, const char *s);
void terra_llvmshutdown();

#define terra_dofile(L, fn) \
(terra_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define terra_dofile(L, fn) (terra_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))

#define terra_dostring(L, s) \
(terra_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define terra_dostring(L, s) (terra_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))

#if __cplusplus
} /*extern C*/
#endif

#endif
Loading