NetMsgs.NetMsgsBase
index
/prj/rnr-sdk/netmsgs/nmPython/modules/NetMsgs/NetMsgsBase.py

NetMsgs Base Data Module

 
Modules
       
sys

 
Classes
       
exceptions.Exception(exceptions.BaseException)
NetMsgsError

 
class NetMsgsError(exceptions.Exception)
    NetMsgs Exception Class.
 
 
Method resolution order:
NetMsgsError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, msg='XML Parser Error')
Raise exception.
 
Parameters:
  msg    - Exception message string.

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
Functions
       
IsIdentifier(token)
Returns True if token is a valid identifier, else False.
 
Parameters:
  token   - Parsed token.
NMFCode lambda xmlftype
## Get NetMsgs field type code given the XML field type.
PrettyPrintAssignExpr(name, val, col=0, indent=0, fp=<open file '<stderr>', mode 'w'>)
Pretty print name = value.
 
Parameters:
  nam     - Variable name
  val     - Variable value.
  col     - Current column position.
  indent  - Indentation.
  fp      - Opened file pointer.
PrettyPrintCols(fp, cursor, *args, **kwargs)
Pretty print argument strings aligned to column.
 
Parameters:
  cursor    - Current column cursor position.
  args      - List of argument (pos, s) 2-tuples.
  kwargs    - Print control keywords.
PrettyPrintDict(d, col=0, indent=0, fp=<open file '<stderr>', mode 'w'>)
Pretty print dictionary in sorted, indented clarity.
 
Parameters:
  d       - The dictionary.
  col     - Current column position.
  indent  - Indentation.
  fp      - Opened file pointer.
 
Return:
  New column position
PrettyPrintList(l, col=0, indent=0, fp=<open file '<stderr>', mode 'w'>)
Pretty print list.
 
Parameters:
  l       - The list.
  col     - Current column position.
  indent  - Indentation.
  fp      - Opened file pointer.
 
Return:
  New column position
PrettyPrintVal(val, col=0, indent=0, fp=<open file '<stderr>', mode 'w'>)
Pretty print value.
 
Parameters:
  val     - Variable value.
  col     - Current column position.
  indent  - Indentation.
  fp      - Opened file pointer.
 
Return:
  New column position
PrintBits(val, msbit, count=None, preface='', fp=<open file '<stderr>', mode 'w'>)
Pretty print bits in value to opened file stream. 
 
Parameters:
  val     - Bits to print.
  msbit   - Starting most significant bit, zero based.
  count   - Number of bits to print (None = msbit+1).
  preface - Optional buffer preface string.
  fp      - Output file pointer.
PrintBuf(buf, count=None, preface='', nlfreq=None, indent=0, col=0, fp=<open file '<stderr>', mode 'w'>)
Pretty print binary buffer to opened file stream.
 
Parameters:
  buf     - Buffer to print.
  count   - Number of bytes to print.
  preface - Optional buffer preface string.
  nlfreq  - Newline frequency (None for no newlines).
  ident   - Indentation column alignment.
  col     - Current column position.
  fp      - Output file pointer.
StrError(ecode)
Get the error string describing the NetMsgs error code.
 
The absolute value of the error code is taken prior retrieving the
string. An unknown or out-of-range error code will be mapped to
NM_ECODE_BADEC.
 
Parameters:
  ecode     - NetMsgs error code.
 
Return:
  The appropriate error code string.
nmStrError(...)
space lambda indent
## space quickie

 
Data
        NMAliasMap = {'byte': 'u8', 'double': 'f64', 'float': 'f32', 'int': 's32', 'longlong': 's64', 'longpointer': 'p64', 'pointer': 'p32', 'schar': 's8', 'short': 'u16', 'uint': 'u32', ...}
NMBuiltInFieldTypes = {'bool': {'T': 'bool_t', 'code': '?', 'comp': 'simple', 'desc': 'boolean 0=false, 1(non-zero)=true', 'flen': 1, 'pre': 'b'}, 'byte': {'T': 'byte_t', 'code': 'B', 'comp': 'simple', 'desc': 'unsigned 8-bit integer', 'flen': 1, 'pre': 'by'}, 'char': {'T': 'char', 'code': 'c', 'comp': 'simple', 'desc': '8-bit character', 'flen': 1, 'pre': 'c'}, 'double': {'T': 'double', 'code': 'F', 'comp': 'simple', 'desc': '64-bit floating-point number', 'flen': 8, 'pre': 'f'}, 'f32': {'T': 'float', 'code': 'f', 'comp': 'simple', 'desc': '32-bit floating-point number', 'flen': 4, 'pre': 'hf'}, 'f64': {'T': 'double', 'code': 'F', 'comp': 'simple', 'desc': '64-bit floating-point number', 'flen': 8, 'pre': 'f'}, 'float': {'T': 'float', 'code': 'f', 'comp': 'simple', 'desc': '32-bit floating-point number', 'flen': 4, 'pre': 'hf'}, 'int': {'T': 'int', 'code': 'i', 'comp': 'simple', 'desc': 'signed 32-bit integer', 'flen': 4, 'pre': 'i'}, 'longlong': {'T': 'long long', 'code': 'q', 'comp': 'simple', 'desc': 'signed 64-bit integer', 'flen': 8, 'pre': 'lli'}, 'longpointer': {'T': 'void *', 'code': 'P', 'comp': 'simple', 'desc': '64-bit pointer', 'flen': 8, 'pre': 'p'}, ...}
NMEncoding = ['flat', 'itv']
NMEncodingCLI = 2
NMEncodingFlat = 0
NMEncodingITV = 1
NMEncodingNumOf = 3
NMEndian = ['big', 'little', 'native']
NMEndianBig = 0
NMEndianLittle = 1
NMEndianNative = 2
NMFHdrLen = {'flat': {'simple': 0, 'string': 0, 'struct': 0, 'vector': 0}, 'itv': {'simple': 2, 'string': 3, 'struct': 3, 'vector': 4}}
NMFID_NONE = 0
NMFIdNone = 0
NMFTypeBool = '?'
NMFTypeByte = 'B'
NMFTypeChar = 'c'
NMFTypeCode2Xml = {'?': 'bool', 'B': 'u8', 'F': 'f64', 'H': 'u16', 'I': 'u32', 'P': 'p64', 'Q': 'u64', '[': 'vector', 'b': 's8', 'c': 'char', ...}
NMFTypeCodeCompound = ['s', '{', '[']
NMFTypeCodeSimple = ['c', 'B', 'b', '?', 'H', 'h', 'I', 'i', 'Q', 'q', 'f', 'F', 'p', 'P']
NMFTypeCompound = ['string', 'struct', 'vector']
NMFTypeDouble = 'F'
NMFTypeF32 = 'f'
NMFTypeF64 = 'F'
NMFTypeFloat = 'f'
NMFTypeInt = 'i'
NMFTypeLongLong = 'q'
NMFTypeLongPointer = 'P'
NMFTypeNone = 0
NMFTypeNumOf = 18
NMFTypeNumber = ['u8', 's8', 'u16', 's16', 'u32', 's32', 'u64', 's64', 'f32', 'f64']
NMFTypeP32 = 'p'
NMFTypeP64 = 'P'
NMFTypePad = 'x'
NMFTypePadTr = 0
NMFTypePointer = 'p'
NMFTypeS16 = 'h'
NMFTypeS32 = 'i'
NMFTypeS64 = 'q'
NMFTypeS8 = 'b'
NMFTypeSChar = 'b'
NMFTypeShort = 'h'
NMFTypeSimple = ['char', 'u8', 's8', 'bool', 'u16', 's16', 'u32', 's32', 'u64', 's64', 'f32', 'f64', 'p32', 'p64']
NMFTypeString = 's'
NMFTypeStruct = '{'
NMFTypeU16 = 'H'
NMFTypeU32 = 'I'
NMFTypeU64 = 'Q'
NMFTypeU8 = 'B'
NMFTypeUInt = 'I'
NMFTypeULongLong = 'Q'
NMFTypeUShort = 'H'
NMFTypeVector = '['
NMFVAL_LEN_BOOL = 1
NMFVAL_LEN_BYTE = 1
NMFVAL_LEN_CHAR = 1
NMFVAL_LEN_DOUBLE = 8
NMFVAL_LEN_F32 = 4
NMFVAL_LEN_F64 = 8
NMFVAL_LEN_FLOAT = 4
NMFVAL_LEN_INT = 4
NMFVAL_LEN_LONGLONG = 8
NMFVAL_LEN_LONGPOINTER = 8
NMFVAL_LEN_MAX_STRING = 255
NMFVAL_LEN_MAX_VECTOR = 255
NMFVAL_LEN_P32 = 4
NMFVAL_LEN_P64 = 8
NMFVAL_LEN_POINTER = 4
NMFVAL_LEN_S16 = 2
NMFVAL_LEN_S32 = 4
NMFVAL_LEN_S64 = 8
NMFVAL_LEN_S8 = 1
NMFVAL_LEN_SCHAR = 1
NMFVAL_LEN_SHORT = 2
NMFVAL_LEN_STRING = 0
NMFVAL_LEN_STRUCT = 0
NMFVAL_LEN_U16 = 2
NMFVAL_LEN_U32 = 4
NMFVAL_LEN_U64 = 8
NMFVAL_LEN_U8 = 1
NMFVAL_LEN_UINT = 4
NMFVAL_LEN_ULONGLONG = 8
NMFVAL_LEN_USHORT = 2
NMFVAL_LEN_VECTOR = 0
NMITV_FCOUNT_SIZE = 1
NMITV_FHDR_SIZE_BASE = 2
NMITV_FHDR_SIZE_SIMPLE = 2
NMITV_FHDR_SIZE_STRING = 3
NMITV_FHDR_SIZE_STRUCT = 3
NMITV_FHDR_SIZE_VECTOR = 4
NMITV_FID_SIZE = 1
NMITV_FTYPE_SIZE = 1
NMITV_MSGHDR_SIZE = 3
NMITV_MSGID_SIZE = 2
NMKeyOrder = '>'
NMKeyPad = '#'
NMMSG_ID_NONE = 0
NMPadDftCount = 1
NMPadFVal = 0
NMStringMaxCount = 255
NMVectorMaxCount = 255
NMVectorSuffix = '[]'
NM_ECODE_ARCH_NOTSUP = 3
NM_ECODE_BADEC = 9
NM_ECODE_EMSG = 6
NM_ECODE_FTYPE = 5
NM_ECODE_GEN = 1
NM_ECODE_INTERNAL = 8
NM_ECODE_MSGID = 7
NM_ECODE_NOMEM = 2
NM_ECODE_NUMOF = 10
NM_ECODE_RANGE = 4
NM_OK = 0