sherpa Namespace Reference

A lexically indivisible unit of text with an associated location. More...


Data Structures

struct  nvec
class  BigNum
class  EnumSet
 Zero-overhead wrapper class for type-preserving bit sets. More...
struct  INOstream
struct  LexLoc
struct  LToken
struct  UExceptionType
 Class used to declare an exception instance. More...
class  UExceptionBase
class  UException
 Exception type template. More...

Namespaces

namespace  excpt

Typedefs

typedef uint32_t hash32_t

Functions

static int vu_cmp (const nvec n1, const nvec n2)
 compare two digit vectors for relative magnitude. Return -1, 0, 1 according to whether v1 is less than, equal to, or greater than v2.
static void vu_rshift_digits (const nvec n1, size_t nShift, nvec n2)
 n2 = n1 / (radix^nShift)
static void vu_lshift_digits (const nvec n1, size_t nShift, nvec n2)
 n2 = n1 * (radix^nShift)
static void vu_rshift_bits (const nvec n1, size_t nShift, nvec n2)
 n2 = n1 >> nShift
static void vu_lshift_bits (const nvec n1, size_t nShift, nvec n2)
 n2 = n1 << nShift
static unsigned vu_get_bit (const nvec n1, size_t bit)
static void vu_set_bit (nvec n1, size_t bit)
static void vu_clear_bit (nvec n1, size_t bit)
static void vu_copy (const nvec n1, nvec n2)
static void vu_sub (const nvec n1, const nvec n2, nvec n3)
 Subtract: n3 = n1 - n2.
static void vu_add (const nvec n1, const nvec n2, nvec n3)
 Add: n3 = n1 + n2.
static void vu_mul (const nvec n1, const nvec n2, nvec n3)
 Multiply: n3 = n1 * n2.
static void vu_divqr (const nvec dividend, const nvec divisor, nvec quotient, nvec remainder)
 Divide q = n1 / n2, r = (n1 - (n2 * q)).
std::ostream & operator<< (std::ostream &strm, const sherpa::BigNum &bn)
std::istream & operator>> (std::istream &strm, sherpa::BigNum &bn)
template<class T>
EnumSet< T > operator| (const T &lhs, const EnumSet< T > &rhs)
template<class T>
EnumSet< T > operator & (const T &lhs, const EnumSet< T > &rhs)
template<class T>
EnumSet< T > operator^ (const T &lhs, const EnumSet< T > &rhs)
template<class T>
boost::enable_if_c< boost::is_enum<
T >::value, EnumSet< T
> >::type 
operator| (const T &lhs, const T &rhs)
template<class T>
boost::enable_if_c< boost::is_enum<
T >::value, EnumSet< T
> >::type 
operator & (const T &lhs, const T &rhs)
template<class T>
boost::enable_if_c< boost::is_enum<
T >::value, EnumSet< T
> >::type 
operator^ (const T &lhs, const T &rhs)
template<class T>
boost::enable_if_c< boost::is_enum<
T >::value, EnumSet< T
> >::type 
operator~ (const T &lhs)
std::string vformat (const char *fmt, va_list ap)
std::string format (const char *fmt,...)
std::ostream & operator<< (std::ostream &strm, const LexLoc &ll)
uint32_t utf8_decode (const char *s, const char **snext)
unsigned utf8_encode (uint32_t ucs4, char utf[7])
std::string strdowncase (const std::string &s)
std::string unsigned_str (uint32_t n)
static char * unsigned64_to_buffer (uint64_t ul, char *buf)
std::string unsigned64_str (uint64_t ul)
uint64_t atollu (const char *s)
uint64_t atollu (const std::string &s)
void * xbsearch (const void *key, const void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))
std::string sgetenv (const char *var)
std::string sgetenv (const std::string &s)
const char * strnchr (const char *s, size_t len, char c)
const unsigned char * ustrnchr (const unsigned char *s, size_t len, unsigned char c)

Variables

static uint32_t u_zero = 0
static const nvec nv_zero (1,&u_zero)
static uint32_t u_one = 1
static const nvec nv_one (1,&u_one)


Detailed Description

A lexically indivisible unit of text with an associated location.

The LToken class provides a degree of support for multiphase lexical processing where the input may be rewritten by several passes. In particular, it allows the intermediate passes to correctly track input locations for any portion of the current string that originated from a file, and also to correctly attribute locations when input strings must be rewritten into intermediate forms whose length may not agree with the length of the original text. Provision is made for an LToken that explicitly identifies its origin location as "unspecified".

For example, the CapIDL input processing for documentation comments goes through several phases during which pieces of the input may be replaced internally by alternative strings, and also phases in which new text may be introduced whose length does not match the original input text. In order to support correct error reporting, we track these cases by describing the input as a string whose elements are LTokens.


Typedef Documentation

typedef uint32_t sherpa::hash32_t

Definition at line 59 of file util.hxx.


Function Documentation

static int sherpa::vu_cmp ( const nvec  n1,
const nvec  n2 
) [static]

compare two digit vectors for relative magnitude. Return -1, 0, 1 according to whether v1 is less than, equal to, or greater than v2.

Definition at line 121 of file BigNum.cxx.

References sherpa::nvec::getDigit(), sherpa::nvec::len, and max().

Referenced by sherpa::BigNum::cmp(), sherpa::BigNum::operator-(), and vu_divqr().

static void sherpa::vu_rshift_digits ( const nvec  n1,
size_t  nShift,
nvec  n2 
) [static]

n2 = n1 / (radix^nShift)

Requirement: n2 > 0

Definition at line 142 of file BigNum.cxx.

References for(), sherpa::nvec::len, min(), and sherpa::nvec::vec.

Referenced by vu_rshift_bits().

static void sherpa::vu_lshift_digits ( const nvec  n1,
size_t  nShift,
nvec  n2 
) [static]

n2 = n1 * (radix^nShift)

Requirement: n2 > 0

Definition at line 161 of file BigNum.cxx.

References for(), sherpa::nvec::len, min(), and sherpa::nvec::vec.

Referenced by vu_copy(), and vu_lshift_bits().

static void sherpa::vu_rshift_bits ( const nvec  n1,
size_t  nShift,
nvec  n2 
) [static]

n2 = n1 >> nShift

Requirement: n2 > 0

Definition at line 176 of file BigNum.cxx.

References sherpa::nvec::getDigit(), sherpa::nvec::len, sherpa::nvec::vec, and vu_rshift_digits().

Referenced by sherpa::BigNum::operator>>().

static void sherpa::vu_lshift_bits ( const nvec  n1,
size_t  nShift,
nvec  n2 
) [static]

n2 = n1 << nShift

Requirement: n2 > 0

Definition at line 195 of file BigNum.cxx.

References sherpa::nvec::getDigit(), sherpa::nvec::len, min(), sherpa::nvec::vec, and vu_lshift_digits().

Referenced by sherpa::BigNum::operator<<().

static unsigned sherpa::vu_get_bit ( const nvec  n1,
size_t  bit 
) [inline, static]

Definition at line 213 of file BigNum.cxx.

References sherpa::nvec::vec.

static void sherpa::vu_set_bit ( nvec  n1,
size_t  bit 
) [inline, static]

Definition at line 219 of file BigNum.cxx.

References sherpa::nvec::vec.

Referenced by vu_divqr().

static void sherpa::vu_clear_bit ( nvec  n1,
size_t  bit 
) [inline, static]

Definition at line 225 of file BigNum.cxx.

References sherpa::nvec::vec.

Referenced by vu_divqr().

static void sherpa::vu_copy ( const nvec  n1,
nvec  n2 
) [inline, static]

Definition at line 231 of file BigNum.cxx.

References vu_lshift_digits().

Referenced by vu_divqr(), and vu_mul().

static void sherpa::vu_sub ( const nvec  n1,
const nvec  n2,
nvec  n3 
) [static]

Subtract: n3 = n1 - n2.

Update to n3 occurs in-place.

Requirement: n2 <= n1. Requirement: n3 is at least as big as n1. Requirement: n3 does not alias n2

Definition at line 263 of file BigNum.cxx.

References assert(), sherpa::nvec::getDigit(), sherpa::nvec::len, UINT32_T_MAX, and sherpa::nvec::vec.

Referenced by sherpa::BigNum::operator-(), and vu_divqr().

static void sherpa::vu_add ( const nvec  n1,
const nvec  n2,
nvec  n3 
) [static]

Add: n3 = n1 + n2.

Update to n3 occurs in-place.

Requirement: n3.len = max(n1.len, n2.len)+1

Definition at line 298 of file BigNum.cxx.

References assert(), sherpa::nvec::getDigit(), sherpa::nvec::len, and sherpa::nvec::vec.

Referenced by sherpa::BigNum::operator+(), sherpa::BigNum::operator-(), and vu_mul().

static void sherpa::vu_mul ( const nvec  n1,
const nvec  n2,
nvec  n3 
) [static]

Multiply: n3 = n1 * n2.

Update to n3 occurs in-place.

Requirement: n3.len = n1.len + n2.len

Definition at line 319 of file BigNum.cxx.

References assert(), for(), sherpa::nvec::getDigit(), sherpa::nvec::len, rmemset(), sherpa::nvec::vec, vu_add(), and vu_copy().

Referenced by sherpa::BigNum::operator *(), and vu_divqr().

static void sherpa::vu_divqr ( const nvec  dividend,
const nvec  divisor,
nvec  quotient,
nvec  remainder 
) [static]

Divide q = n1 / n2, r = (n1 - (n2 * q)).

Definition at line 352 of file BigNum.cxx.

References sherpa::nvec::len, nv_one, nv_zero, rmemset(), sherpa::nvec::vec, vu_clear_bit(), vu_cmp(), vu_copy(), vu_mul(), vu_set_bit(), and vu_sub().

Referenced by sherpa::BigNum::operator%(), and sherpa::BigNum::operator/().

std::ostream& sherpa::operator<< ( std::ostream &  strm,
const sherpa::BigNum bn 
) [inline]

Definition at line 240 of file BigNum.hxx.

References sherpa::BigNum::toStream().

std::istream& sherpa::operator>> ( std::istream &  strm,
sherpa::BigNum bn 
) [inline]

Definition at line 253 of file BigNum.hxx.

References sherpa::BigNum::fromStream().

template<class T>
EnumSet<T> sherpa::operator| ( const T &  lhs,
const EnumSet< T > &  rhs 
) [inline]

Definition at line 232 of file EnumSet.hxx.

template<class T>
EnumSet<T> sherpa::operator & ( const T &  lhs,
const EnumSet< T > &  rhs 
) [inline]

Definition at line 238 of file EnumSet.hxx.

template<class T>
EnumSet<T> sherpa::operator^ ( const T &  lhs,
const EnumSet< T > &  rhs 
) [inline]

Definition at line 244 of file EnumSet.hxx.

template<class T>
boost::enable_if_c<boost::is_enum<T>::value, EnumSet<T> >::type sherpa::operator| ( const T &  lhs,
const T &  rhs 
) [inline]

Definition at line 259 of file EnumSet.hxx.

template<class T>
boost::enable_if_c<boost::is_enum<T>::value, EnumSet<T> >::type sherpa::operator & ( const T &  lhs,
const T &  rhs 
) [inline]

Definition at line 267 of file EnumSet.hxx.

template<class T>
boost::enable_if_c<boost::is_enum<T>::value, EnumSet<T> >::type sherpa::operator^ ( const T &  lhs,
const T &  rhs 
) [inline]

Definition at line 275 of file EnumSet.hxx.

template<class T>
boost::enable_if_c<boost::is_enum<T>::value, EnumSet<T> >::type sherpa::operator~ ( const T &  lhs  )  [inline]

Definition at line 284 of file EnumSet.hxx.

std::string sherpa::vformat ( const char *  fmt,
va_list  ap 
)

Definition at line 52 of file format.cxx.

References PUT_DIGIT.

Referenced by format().

std::string sherpa::format ( const char *  fmt,
  ... 
)

Definition at line 392 of file format.cxx.

References vformat().

std::ostream& sherpa::operator<< ( std::ostream &  strm,
const LexLoc &  ll 
) [inline]

Definition at line 111 of file LexLoc.hxx.

References sherpa::LexLoc::asString().

uint32_t sherpa::utf8_decode ( const char *  s,
const char **  snext 
)

Definition at line 58 of file utf8.cxx.

Referenced by CMangle(), LitValue::DecodeBlockCharacter(), LitValue::DecodeStringCharacter(), sherpa::LexLoc::updateWith(), and sherpa::LexLoc::with().

unsigned sherpa::utf8_encode ( uint32_t  ucs4,
char  utf[7] 
)

Definition at line 102 of file utf8.cxx.

Referenced by toc().

std::string sherpa::strdowncase ( const std::string &  s  ) 

Definition at line 54 of file util.cxx.

std::string sherpa::unsigned_str ( uint32_t  n  ) 

Definition at line 79 of file util.cxx.

References unsigned64_str().

static char* sherpa::unsigned64_to_buffer ( uint64_t  ul,
char *  buf 
) [static]

Definition at line 90 of file util.cxx.

References BUFSZ.

Referenced by unsigned64_str().

std::string sherpa::unsigned64_str ( uint64_t  ul  ) 

Definition at line 111 of file util.cxx.

References BUFSZ, and unsigned64_to_buffer().

Referenced by unsigned_str().

uint64_t sherpa::atollu ( const char *  s  ) 

Definition at line 120 of file util.cxx.

uint64_t sherpa::atollu ( const std::string &  s  ) 

Definition at line 133 of file util.cxx.

void* sherpa::xbsearch ( const void *  key,
const void *  base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *)  compar 
)

Definition at line 353 of file util.cxx.

std::string sherpa::sgetenv ( const char *  var  ) 

Definition at line 363 of file util.cxx.

References s.

Referenced by sgetenv().

std::string sherpa::sgetenv ( const std::string &  s  )  [inline]

Definition at line 51 of file util.hxx.

References sgetenv().

const char* sherpa::strnchr ( const char *  s,
size_t  len,
char  c 
)

Referenced by ustrnchr().

const unsigned char* sherpa::ustrnchr ( const unsigned char *  s,
size_t  len,
unsigned char  c 
) [inline]

Definition at line 63 of file util.hxx.

References strnchr().


Variable Documentation

uint32_t sherpa::u_zero = 0 [static]

Definition at line 112 of file BigNum.cxx.

const nvec sherpa::nv_zero(1,&u_zero) [static]

Referenced by vu_divqr().

uint32_t sherpa::u_one = 1 [static]

Definition at line 114 of file BigNum.cxx.

const nvec sherpa::nv_one(1,&u_one) [static]

Referenced by vu_divqr().


Generated on Wed Sep 8 07:59:29 2010 for BitC Compiler by  doxygen 1.4.7