src/m_token.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <inttypes.h>
#include <stdint.h>
#include "m_token.h"
#include "m_ms.h"

Defines

#define MY_LL   "ll"

Functions

sGcCtxgenerate_gc (void)
void release_gc (sGcCtx *gc)
uMTokengen_tok (sGcCtx *gc, enum eMToken kind, enum eMSToken subkind, size_t addend)
void dump_tok (FILE *fp, uMToken *p)
uMTokenchain_tok (uMToken *l, uMToken *add)
uMTokengen_value (sGcCtx *gc, enum eMSToken skind, uint64_t val, int is_signed, int size)
uMTokengen_name (sGcCtx *gc, enum eMSToken skind, const char *name)
uMTokengen_dim (sGcCtx *gc, enum eMSToken skind, uint64_t val, const char *non_tt_param, int fSigned, int fNegate)
uMTokengen_unary (sGcCtx *gc, enum eMSToken skind, uMToken *un)
uMTokengen_binary (sGcCtx *gc, enum eMSToken skind, uMToken *l, uMToken *r)
char * sprint_decl (uMToken *r)
void print_decl (FILE *fp, uMToken *r)

Define Documentation

#define MY_LL   "ll"

Function Documentation

uMToken* chain_tok ( uMToken l,
uMToken add 
)

Chains uMTokens together.

Parameters:
[in] l uMtoken chain to link up with.
[in] add uMtoken to add to chain.
Returns:
l unchanged
void dump_tok ( FILE *  fp,
uMToken p 
)

Dumps uMToken to a file descriptor for debugging.

Parameters:
[in] fp File descriptor to print the token to.
[in] p uMToken chain to print.
uMToken* gen_binary ( sGcCtx gc,
enum eMSToken  skind,
uMToken l,
uMToken r 
)

Generates a binary node token.

Parameters:
[in] gc Pointer to garbage collection context.
[in] skind Token subKind.
[in] l Left node element.
[in] r Right node element.
Returns:
Pointer to binary token.
See also:
sMToken_binary
uMToken* gen_dim ( sGcCtx gc,
enum eMSToken  skind,
uint64_t  val,
const char *  non_tt_param,
int  fSigned,
int  fNegate 
)

Constructs a "dim" kind token.

Parameters:
[in] gc Pointer to garbage collection context.
[in] skind Token subkind.
[in] val Token numerical value.
[in] non_tt_param pointer to decoded C++ template name.
[in] fSigned Signedness of the numerical value.
[in] fNegate 1 for "val" is negative digit.
Returns:
Pointer to dim token.
See also:
sMToken_dim
uMToken* gen_name ( sGcCtx gc,
enum eMSToken  skind,
const char *  name 
)

Constructs a "name" kind token.

Parameters:
[in] gc Pointer to garbage collection context.
[in] skind Token subkind.
[in] name Pointer to name string.
Returns:
Pointer to name token.
See also:
sMToken_name
uMToken* gen_tok ( sGcCtx gc,
enum eMToken  kind,
enum eMSToken  subkind,
size_t  addend 
)

gen_tok constructs uMToken instances Instances are destroyed with release_gc().

Parameters:
[in] gc Pointer to garbage collection context.
[in] kind Kind of token to construct
[in] subkind Subkind of token to construct
[in] addend Additional byte padding at the end.
See also:
release_gc()
uMToken* gen_unary ( sGcCtx gc,
enum eMSToken  skind,
uMToken un 
)

Constructs a "unary" kind token.

Parameters:
[in] gc Pointer to garbage collection context.
[in] skind Token subkind.
[in] un Pointer to leaf element.
Returns:
Pointer to a unary token.
See also:
sMToken_unary
uMToken* gen_value ( sGcCtx gc,
enum eMSToken  skind,
uint64_t  val,
int  is_signed,
int  size 
)

Constructs a "value" kind token.

Parameters:
[in] gc Pointer to garbage collection context.
[in] skind Token subkind.
[in] val Sets the value on token,
[in] is_signed Signed bit of val.
[in] size Width of val.
Returns:
Pointer to value token.
See also:
sMToken_value
sGcCtx* generate_gc ( void   ) 

Constructs a garbage collection context token.

Returns:
Pointer to context.
See also:
release_gc()
void print_decl ( FILE *  fp,
uMToken p 
)

Prints C++ name to file descriptor.

Parameters:
[in] fp Output file descriptor.
[in] p Token containing information about the C++ name.
See also:
decode_ms_name()
void release_gc ( sGcCtx gc  ) 

Releases memory tracked by context.

Parameters:
[in] gc Garbage collection context to work on.
See also:
generate_gc()
char* sprint_decl ( uMToken r  ) 

Get pointer to decoded C++ name string. Use free() to release returned string.

Parameters:
[in] r C++ name token.
Returns:
pointer to decoded C++ name string.
See also:
decode_ms_name()

Generated on 10 Oct 2009 for libmangle by  doxygen 1.6.1