Cthulhu  0.2.10
Cthulhu compiler collection
ops.c File Reference
#include "cthulhu/tree/ops.h"
#include "arena/arena.h"
#include "base/panic.h"
#include "memory/memory.h"
#include "std/vector.h"
#include "std/str.h"
#include "base/util.h"
#include "cthulhu/tree/tree.inc"
Include dependency graph for ops.c:

Go to the source code of this file.

Macros

#define UNARY_OP(ID, STR, SYM)   [ID] = (STR),
 
#define UNARY_OP(ID, STR, SYM)   [ID] = (SYM),
 
#define BINARY_OP(ID, STR, SYM)   [ID] = (STR),
 
#define BINARY_OP(ID, STR, SYM)   [ID] = (SYM),
 
#define COMPARE_OP(ID, STR, SYM)   [ID] = (STR),
 
#define COMPARE_OP(ID, STR, SYM)   [ID] = (SYM),
 
#define SIGN_KIND(ID, STR)   [ID] = (STR),
 
#define DIGIT_KIND(ID, STR)   [ID] = (STR),
 
#define TYPE_QUALIFIER(ID, STR, BIT)   + sizeof(STR)
 
#define TYPE_QUALIFIER(ID, STR, BIT)
 
#define TREE_LINKAGE(ID, STR)   [ID] = (STR),
 
#define TREE_VISIBILITY(ID, STR)   [ID] = (STR),
 

Functions

STA_DECL const char * unary_name (unary_t op)
 get the pretty name of a unary operator More...
 
STA_DECL const char * unary_symbol (unary_t op)
 get the C symbol of a unary operator More...
 
STA_DECL const char * binary_name (binary_t op)
 get the pretty name of a binary operator More...
 
STA_DECL const char * binary_symbol (binary_t op)
 get the C symbol of a binary operator More...
 
STA_DECL const char * compare_name (compare_t op)
 get the pretty name of a comparison operator More...
 
STA_DECL const char * compare_symbol (compare_t op)
 get the C symbol of a comparison operator More...
 
STA_DECL const char * sign_name (sign_t sign)
 get the pretty name of a integer sign More...
 
STA_DECL const char * digit_name (digit_t digit)
 get the pretty name of a digit More...
 
STA_DECL const char * quals_string (tree_quals_t quals)
 get the name of a set of qualifiers More...
 
STA_DECL const char * linkage_string (tree_linkage_t link)
 get the name of a linkage More...
 
STA_DECL const char * visibility_string (tree_visibility_t vis)
 get the name of visibility More...
 

Macro Definition Documentation

◆ BINARY_OP [1/2]

#define BINARY_OP (   ID,
  STR,
  SYM 
)    [ID] = (STR),

◆ BINARY_OP [2/2]

#define BINARY_OP (   ID,
  STR,
  SYM 
)    [ID] = (SYM),

◆ COMPARE_OP [1/2]

#define COMPARE_OP (   ID,
  STR,
  SYM 
)    [ID] = (STR),

◆ COMPARE_OP [2/2]

#define COMPARE_OP (   ID,
  STR,
  SYM 
)    [ID] = (SYM),

◆ DIGIT_KIND

#define DIGIT_KIND (   ID,
  STR 
)    [ID] = (STR),

◆ SIGN_KIND

#define SIGN_KIND (   ID,
  STR 
)    [ID] = (STR),

◆ TREE_LINKAGE

#define TREE_LINKAGE (   ID,
  STR 
)    [ID] = (STR),

◆ TREE_VISIBILITY

#define TREE_VISIBILITY (   ID,
  STR 
)    [ID] = (STR),

◆ TYPE_QUALIFIER [1/2]

#define TYPE_QUALIFIER (   ID,
  STR,
  BIT 
)    + sizeof(STR)

◆ TYPE_QUALIFIER [2/2]

#define TYPE_QUALIFIER (   ID,
  STR,
  BIT 
)
Value:
if (quals & (ID)) { \
if (ptr != buffer) \
*ptr++ = '|'; \
ctu_memcpy(ptr, STR, sizeof(STR)); \
ptr += sizeof(STR) - 1; \
}

◆ UNARY_OP [1/2]

#define UNARY_OP (   ID,
  STR,
  SYM 
)    [ID] = (STR),

◆ UNARY_OP [2/2]

#define UNARY_OP (   ID,
  STR,
  SYM 
)    [ID] = (SYM),

Function Documentation

◆ binary_name()

STA_DECL const char* binary_name ( binary_t  op)

get the pretty name of a binary operator

Parameters
opthe operator to get the name of
Returns
the name of op

Definition at line 42 of file ops.c.

◆ binary_symbol()

STA_DECL const char* binary_symbol ( binary_t  op)

get the C symbol of a binary operator

Parameters
opthe operator to get the symbol of
Returns
the symbol of op

Definition at line 54 of file ops.c.

◆ compare_name()

STA_DECL const char* compare_name ( compare_t  op)

get the pretty name of a comparison operator

Parameters
opthe operator to get the name of
Returns
the name of op

Definition at line 66 of file ops.c.

◆ compare_symbol()

STA_DECL const char* compare_symbol ( compare_t  op)

get the C symbol of a comparison operator

Parameters
opthe operator to get the symbol of
Returns
the symbol of op

Definition at line 78 of file ops.c.

◆ digit_name()

STA_DECL const char* digit_name ( digit_t  digit)

get the pretty name of a digit

Parameters
digitthe digit to get the name of
Returns
the name of op

Definition at line 102 of file ops.c.

◆ linkage_string()

STA_DECL const char* linkage_string ( tree_linkage_t  link)

get the name of a linkage

Parameters
linkthe linkage to get the name of
Returns
the name of link

Definition at line 141 of file ops.c.

◆ quals_string()

STA_DECL const char* quals_string ( tree_quals_t  quals)

get the name of a set of qualifiers

Parameters
qualsthe qualifiers to get the name of
Returns
the name of quals

Definition at line 109 of file ops.c.

◆ sign_name()

STA_DECL const char* sign_name ( sign_t  sign)

get the pretty name of a integer sign

Parameters
signthe sign to get the name of
Returns
the name of op

Definition at line 90 of file ops.c.

◆ unary_name()

STA_DECL const char* unary_name ( unary_t  op)

get the pretty name of a unary operator

Parameters
opthe operator to get the name of
Returns
the name of op

Definition at line 18 of file ops.c.

◆ unary_symbol()

STA_DECL const char* unary_symbol ( unary_t  op)

get the C symbol of a unary operator

Parameters
opthe operator to get the symbol of
Returns
the symbol of op

Definition at line 30 of file ops.c.

◆ visibility_string()

STA_DECL const char* visibility_string ( tree_visibility_t  vis)

get the name of visibility

Parameters
visthe visibility to get the name of
Returns
the name of vis

Definition at line 153 of file ops.c.