#ifndef MISC_H
#define MISC_H


// constants for SYS_SetSTDIOFocus ---
//
#define  SYS_FOCUS_SHELL              1
#define  SYS_FOCUS_APP                2
#define  SYS_FOCUS_BOTH               3


/**
 * Swap two bytes of a word.
 */
inline unsigned SwapShort(const unsigned &i)
{
  return ((i << 8) & 0xff00) |
         ((i >> 8) & 0x00ff);
}

/**
 * Swap byte order of a long.
 */
inline unsigned long  SwapLong(const unsigned long &i)
{
  return ((i << 24) & 0xff000000L) |
         ((i <<  8) & 0x00ff0000L) |
         ((i >>  8) & 0x0000ff00L) |
         ((i >> 24) & 0x000000ffL);
}

extern void  SYS_SetSTDIOFocus(int focus);
extern char *ProgressBar(float v, float min, float max);
extern void  HexDump(void *mem, unsigned length);


#endif
