ESR_Portable API functions


Defines

#define CHK(rc, x)   do { if ((rc = (x)) != ESR_SUCCESS) goto CLEANUP; } while (0)
#define HAS_ASSERT
#define passert(exp)   assert(exp)
#define EXTERN   extern
#define PINLINE   _inline
#define P_PATH_MAX   _MAX_PATH
#define P_CMDLINE_MAX   4000
#define UINT16_TMIN   0
#define UINT16_TMAX   65535
#define L(x)   x
#define LSTRCAT   strcat
#define LSTRCHR   strchr
#define LSTRRCHR   strrchr
#define LSTRCMP   strcmp
#define LSTRNCMP   strncmp
#define LSTRCPY   strcpy
#define LSTRFTIME   strftime
#define LSTRLEN   strlen
#define LSTRNCPY   strncpy
#define LMEMMOVE   memmove
#define LSTRSTR   strstr
#define LSTRLWR   lstrlwr
#define LSTRUPR   lstrupr
#define LSTRTOD   strtod
#define LSTRTOL   strtol
#define LSTRTOUL   strtoul
#define LISSPACE(c)   isspace((unsigned char) c)
#define LSTRCSPN   strcspn
#define LISALPHA   isalpha
#define LISALNUM   isalnum
#define LISDIGIT   isdigit
#define LSTRTOK   strtok
#define LGETENV   getenv
#define LTOUPPER   toupper
#define LTOLOWER   tolower
#define LPRINTF   printf
#define LFPRINTF   fprintf
#define LSPRINTF   sprintf
#define psprintf   sprintf
#define pvsprintf   vsprintf
#define LOG_10_2   (0.30102999566398)
#define MAX_UINT_DIGITS   ((size_t) ((CHAR_BIT * sizeof(int) * LOG_10_2) + 1))
#define MAX_INT_DIGITS   ((size_t) (MAX_UINT_DIGITS + 1))

Typedefs

typedef enum
ESR_ReturnCode_t 
ESR_ReturnCode
typedef unsigned int asr_uint32_t
typedef int asr_int32_t
typedef unsigned short asr_uint16_t
typedef short asr_int16_t
typedef unsigned char asr_uint8_t
typedef signed char asr_int8_t
typedef char LCHAR
typedef int LINT

Enumerations

enum  ESR_ReturnCode_t {
  ESR_SUCCESS,
  ESR_CONTINUE_PROCESSING,
  ESR_FATAL_ERROR,
  ESR_BUFFER_OVERFLOW,
  ESR_OPEN_ERROR,
  ESR_ALREADY_OPEN,
  ESR_CLOSE_ERROR,
  ESR_ALREADY_CLOSED,
  ESR_READ_ERROR,
  ESR_WRITE_ERROR,
  ESR_FLUSH_ERROR,
  ESR_SEEK_ERROR,
  ESR_OUT_OF_MEMORY,
  ESR_ARGUMENT_OUT_OF_BOUNDS,
  ESR_NO_MATCH_ERROR,
  ESR_INVALID_ARGUMENT,
  ESR_NOT_SUPPORTED,
  ESR_INVALID_STATE,
  ESR_THREAD_CREATION_ERROR,
  ESR_IDENTIFIER_COLLISION,
  ESR_TIMED_OUT,
  ESR_INVALID_RESULT_TYPE,
  ESR_NOT_IMPLEMENTED,
  ESR_CONNECTION_RESET_BY_PEER,
  ESR_PROCESS_CREATE_ERROR,
  ESR_TTS_NO_ENGINE,
  ESR_MUTEX_CREATION_ERROR,
  ESR_DEADLOCK
}

Functions

PORTABLE_API const
LCHAR
ESR_rc2str (const ESR_ReturnCode rc)
PORTABLE_API void _cdecl _penter (void)
PORTABLE_API void _cdecl _pexit (void)
PORTABLE_API void swap_byte_order (void *buffer, size_t count, size_t itemSize)
PORTABLE_API ESR_BOOL isNumber (const LCHAR *text)


Define Documentation

#define CHK ( rc,
 )     do { if ((rc = (x)) != ESR_SUCCESS) goto CLEANUP; } while (0)

Checks the function return-code and if it is not ESR_SUCCESS, returns it.

#define EXTERN   extern

Exports C-style symbols; avoids name-mangling.

#define HAS_ASSERT

Checks if platform supports ASSERT.

#define L (  )     x

LCHAR version of string-constant

#define LFPRINTF   fprintf

Portable fprintf().

#define LGETENV   getenv

LCHAR version of getenv()

#define LISALNUM   isalnum

LCHAR version of isalnum()

#define LISALPHA   isalpha

LCHAR version of isalpha()

#define LISDIGIT   isdigit

LCHAR version of isdigit()

#define LISSPACE (  )     isspace((unsigned char) c)

LCHAR version of isspace()

#define LMEMMOVE   memmove

LCHAR version of memmove()

#define LOG_10_2   (0.30102999566398)

Log of 2 in base 10.

#define LPRINTF   printf

Portable printf().

#define LSPRINTF   sprintf

Portable sprintf().

#define LSTRCAT   strcat

LCHAR version of strcat()

#define LSTRCHR   strchr

LCHAR version of strchr()

#define LSTRCMP   strcmp

LCHAR version of strcmp()

#define LSTRCPY   strcpy

LCHAR version of strcpy()

#define LSTRCSPN   strcspn

LCHAR version of strcspn()

#define LSTRFTIME   strftime

LCHAR version of strftime()

#define LSTRLEN   strlen

LCHAR version of strlen()

#define LSTRLWR   lstrlwr

LCHAR version of strlwr() which converts a string to lowercase.

#define LSTRNCMP   strncmp

LCHAR version of strncmp()

#define LSTRNCPY   strncpy

LCHAR version of strncpy()

#define LSTRRCHR   strrchr

LCHAR version of strrchr()

#define LSTRSTR   strstr

LCHAR version of strstr()

#define LSTRTOD   strtod

LCHAR version of strtod()

#define LSTRTOK   strtok

LCHAR version of strtok()

#define LSTRTOL   strtol

LCHAR version of strtol()

#define LSTRTOUL   strtoul

LCHAR version of strtoul()

#define LSTRUPR   lstrupr

LCHAR version of strupr() which converts a string to lowercase.

#define LTOLOWER   tolower

Converts LCHAR character to lowercase.

#define LTOUPPER   toupper

Converts LCHAR character to uppercase.

#define MAX_INT_DIGITS   ((size_t) (MAX_UINT_DIGITS + 1))

Maximum number of digits used to represent an int as a string in base 10. +1 for sign character [+, -]

#define MAX_UINT_DIGITS   ((size_t) ((CHAR_BIT * sizeof(int) * LOG_10_2) + 1))

Maximum number of digits used to represent an unsigned int as a string in base 10. The +1 is for taking into account the fact that the fractional part is removed and that we really need to take the ceiling.

#define P_CMDLINE_MAX   4000

Platform-independant maximum command-line length. In reality this value is shell-specific and is around 32k for WindowsNT however we can't spare that much stack-space and we assume such a large value will never actually occur so we settle for 4k instead.

#define P_PATH_MAX   _MAX_PATH

Platform-independant maximum filename path length.

#define passert ( exp   )     assert(exp)

Portable assert().

#define PINLINE   _inline

Portable 'inline' keyword

#define psprintf   sprintf

Portable sprintf().

#define pvsprintf   vsprintf

Portable svprintf().

#define UINT16_TMAX   65535

Maximum value of UINT16_T.

#define UINT16_TMIN   0

Minimum value of UINT16_T.


Typedef Documentation

typedef short asr_int16_t

Portable 16-bit signed integer.

typedef int asr_int32_t

Portable 32-bit signed integer.

typedef signed char asr_int8_t

Portable 8-bit signed integer.

typedef unsigned short asr_uint16_t

Portable 16-bit unsigned integer.

typedef unsigned int asr_uint32_t

Portable 32-bit unsigned integer.

typedef unsigned char asr_uint8_t

Portable 8-bit unsigned integer.

typedef enum ESR_ReturnCode_t ESR_ReturnCode

Return-code values.

typedef char LCHAR

Locale-independant character.

typedef int LINT

Locale-independant integer-representation of a character. Used by fgetc() and others.


Enumeration Type Documentation

enum ESR_ReturnCode_t

Return-code values.

Enumerator:
ESR_SUCCESS  Operation completed successfully.
ESR_CONTINUE_PROCESSING  Intermediate stage of operation completed successfully, we wish to indicate that remainig stages of operation may proceed.
ESR_FATAL_ERROR  Indicates a fatal error.
ESR_BUFFER_OVERFLOW  Buffer overflow occured.
ESR_OPEN_ERROR  Error typing to open an entity or the operation failed because the entity was not opened.
ESR_ALREADY_OPEN  Error trying to open an entity that is already open.
ESR_CLOSE_ERROR  Error typing to close a entity or the operation failed because the entity was not closed.
ESR_ALREADY_CLOSED  Error trying to close a entity that was already closed.
ESR_READ_ERROR  Error trying to read a file.
ESR_WRITE_ERROR  Error trying to write to a entity.
ESR_FLUSH_ERROR  Error trying to flush a entity.
ESR_SEEK_ERROR  Error trying to seek a entity.
ESR_OUT_OF_MEMORY  Error trying to allocate memory.
ESR_ARGUMENT_OUT_OF_BOUNDS  Specified argument is out of bounds.
ESR_NO_MATCH_ERROR  Failed to locate the specified entity.
ESR_INVALID_ARGUMENT  Passed in argument contains an invalid value. Such as when a NULL pointer is passed in when when an actual value is expected.
ESR_NOT_SUPPORTED  Indicates that request functionality is not supported.
ESR_INVALID_STATE  Indicates that the object is not in a state such that the operation can be succesfully performed.
ESR_THREAD_CREATION_ERROR  Indicates that a thread could not be created.
ESR_IDENTIFIER_COLLISION  Indicates that a resource with the same identifier already exists.
ESR_TIMED_OUT  Indicates that the operation timed out.
ESR_INVALID_RESULT_TYPE  Indicates that the object being retrieved isn't of the expected type. For example, when retrieving an integer from a HashMap we find out the value is actually of type float.
ESR_NOT_IMPLEMENTED  Indicates that the invoked function has not been implemented.
ESR_CONNECTION_RESET_BY_PEER  A connection was forcibly closed by a peer. This normally results from a loss of the connection on the remote socket due to a timeout or a reboot.
ESR_PROCESS_CREATE_ERROR  Indicates that a process could not be created.
ESR_TTS_NO_ENGINE  Indicates that no matching TTS engine is available.
ESR_MUTEX_CREATION_ERROR  Indicates that an attempt to create a mutex failed because the OS is running out of resources.
ESR_DEADLOCK  Indicates a deadlock situation has occured.


Function Documentation

PORTABLE_API void _cdecl _penter ( void   ) 

Called before entering any function.

PORTABLE_API void _cdecl _pexit ( void   ) 

Called after exiting any function.

PORTABLE_API const LCHAR* ESR_rc2str ( const ESR_ReturnCode  rc  ) 

Given a return-code, returns its string representation.

Parameters:
rc Return-code
Returns:
String representation of return-code.

PORTABLE_API ESR_BOOL isNumber ( const LCHAR text  ) 

Indicates if text contains a number (and nothing else).

Parameters:
text String to check
Returns:
ESR_TRUE if text is a number, ESR_FALSE otherwise.

PORTABLE_API void swap_byte_order ( void *  buffer,
size_t  count,
size_t  itemSize 
)

Swaps bytes of each item in buffer.

Parameters:
buffer Buffer containing items to swap.
count Number of items to swap.
itemSize Size of each items.


Generated on Thu May 1 15:37:26 2008 for SREC by  doxygen 1.5.3