Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
status.cpp File Reference
#include "precompiled.h"
#include "lib/status.h"
#include <cstring>
#include <cstdio>
#include "lib/posix/posix_errno.h"
Include dependency graph for status.cpp:

Functions

StatusDefinitionBucketStatusAddDefinitions (StatusDefinitionBucket *bucket)
 (called via STATUS_ADD_DEFINITIONS) More...
 
static const StatusDefinitionDefinitionFromStatus (Status status)
 
static const StatusDefinitionDefinitionFromErrno (int errno_equivalent)
 
wchar_t * StatusDescription (Status status, wchar_t *buf, size_t max_chars)
 generate textual description of a Status. More...
 
int ErrnoFromStatus (Status status)
 
Status StatusFromErrno ()
 
 STATUS_ADD_DEFINITIONS (statusDefs)
 

Variables

static StatusDefinitionBucketbuckets
 
static const StatusDefinition statusDefs []
 

Function Documentation

◆ DefinitionFromErrno()

static const StatusDefinition * DefinitionFromErrno ( int  errno_equivalent)
static

◆ DefinitionFromStatus()

static const StatusDefinition * DefinitionFromStatus ( Status  status)
static

◆ ErrnoFromStatus()

int ErrnoFromStatus ( Status  status)
Returns
the errno equivalent of a Status.

used in wposix - underlying functions return Status but must be translated to errno at e.g. the mmap interface level. higher-level code that calls mmap will in turn convert back to Status.

◆ STATUS_ADD_DEFINITIONS()

STATUS_ADD_DEFINITIONS ( statusDefs  )

◆ StatusAddDefinitions()

StatusDefinitionBucket * StatusAddDefinitions ( StatusDefinitionBucket bucket)

(called via STATUS_ADD_DEFINITIONS)

Parameters
bucketis being added; its definitions and numDefinitions must already be initialized.
Returns
previous bucket in list, suitable for initializing bucket->next.

(this function must be callable as a static initializer; initializing next avoids the need for a separate dummy variable)

◆ StatusDescription()

wchar_t * StatusDescription ( Status  status,
wchar_t *  buf,
size_t  max_chars 
)

generate textual description of a Status.

Parameters
bufdestination buffer (allows generating strings with the code's numerical value if no definition is found)
max_charssize of buffer [characters]
Returns
buf (allows using this function in expressions)

◆ StatusFromErrno()

Status StatusFromErrno ( )
Returns
Status equivalent of errno, or ERR::FAIL if there's no equivalent.

NB: reset errno to 0 before calling POSIX functions to avoid confusion with previous errors.

Variable Documentation

◆ buckets

StatusDefinitionBucket* buckets
static

◆ statusDefs

const StatusDefinition statusDefs[]
static