/*
1TBS-2S Syntax Rules (Lang:C)
Joris van Rooij (jorrizza@wasda.nl) 2006
*/

/*
intendation
after a statement a newline with two spaces
even after a case
*/

/*
defines
always in capital
*/
#define CONSTANT 0xFF00FF00;

/* 
variable declaration
never use capitals in variable names
hex is always in capital
*/
int variable_name[ = value];

/*
pointers
the '*' in front of the name, not after the type
*/
char *pointer;


/*
stuct declarations
use typedef as little as possible, just use a good name for your struct
never use capitals in struct names
*/
struct struct_name {
  int a;
  int b;
  int c;
};

/*
function declaration
point: whitespace in between function_name and ()
the first line is the header
never use capitals in function names
*/
void function_name (char param1, char param2);
void function_name (char param1, char param2) {
  code
  code
  code
}

/*
function calls
no whitespace in between function and ()
*/
function_name(param1, param2);

/*
keywords (if, else, while, for, switch)
whitespace after keyword, whitespace after closing ')'
*/
if (argument >= argument) {
  code
  code
  code
}

switch (int) {
  case 1:
    code
    code
    code
    break;
  case 2:
    code
    code
    code
    break;
}

for (i = 0; i < 144; i++) {
  code
  code
  code
}

/*
curly braces
curly braces only when using multiple statements
*/

if (strcmp(a, b) == 0)
  printf("%s eq %s\n", a, b);

if (a < b && c < b) {
  printf("%d ", b);
  printf(" AND %d > %d\n", c, a);
}

/*
math, bitwise, compare statement and '='
always with spaces
*/
unsigned char out = (a < b && a <= c);
unsigned char out = a & b & (c + d);