Skip to content

Commit

Permalink
Run clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Sep 29, 2019
1 parent c81ad72 commit fdec231
Show file tree
Hide file tree
Showing 45 changed files with 6,574 additions and 6,191 deletions.
25 changes: 11 additions & 14 deletions release/include/terra/terra.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
/* See Copyright Notice in ../LICENSE.txt */


#ifndef terra_h
#define terra_h

#if __cplusplus
extern "C" {
#endif

#include "lauxlib.h"
#include "lua.h"
#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
64 changes: 29 additions & 35 deletions src/bin2c.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
License: BSD
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
Expand All @@ -14,51 +14,45 @@ are met:
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>

static void Abort (char *fmt,...)
{
va_list args;
va_start (args, fmt);
vfprintf (stderr, fmt, args);
va_end (args);
exit (1);
static void Abort(char *fmt, ...) {
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
exit(1);
}

int main (int argc, char **argv)
{
FILE *inFile;
FILE *outFile = stdout;
time_t now = time (NULL);
int ch, i;
int main(int argc, char **argv) {
FILE *inFile;
FILE *outFile = stdout;
time_t now = time(NULL);
int ch, i;

if (argc != 2)
Abort ("Usage: %s bin-file [> result]", argv[0]);
if (argc != 2) Abort("Usage: %s bin-file [> result]", argv[0]);

if ((inFile = fopen(argv[1],"rb")) == NULL)
Abort ("Cannot open %s\n", argv[1]);
if ((inFile = fopen(argv[1], "rb")) == NULL) Abort("Cannot open %s\n", argv[1]);

fprintf (outFile,
"/* data statements for file %s at %.24s */\n"
"/* Generated by BIN2C, G.Vanem 1995 */\n",
argv[1], ctime(&now));
fprintf(outFile,
"/* data statements for file %s at %.24s */\n"
"/* Generated by BIN2C, G.Vanem 1995 */\n",
argv[1], ctime(&now));

i = 0;
while ((ch = fgetc(inFile)) != EOF)
{
if (i++ % 12 == 0)
fputs ("\n ", outFile);
fprintf (outFile, "0x%02X,", ch);
}
fputc ('\n', outFile);
fclose (inFile);
return (0);
i = 0;
while ((ch = fgetc(inFile)) != EOF) {
if (i++ % 12 == 0) fputs("\n ", outFile);
fprintf(outFile, "0x%02X,", ch);
}
fputc('\n', outFile);
fclose(inFile);
return (0);
}
Expand Down
Loading

0 comments on commit fdec231

Please sign in to comment.