OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
misc.h File Reference
#include <stdint.h>
#include "Xosdefs.h"
#include <stddef.h>
#include "Xfuncs.h"
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAXSCREENS   3
 
#define MAXCLIENTS   128
 
#define MAXFORMATS   8
 
#define MAXVISUALS_PER_SCREEN   50
 
#define TRUE   1
 
#define FALSE   0
 
#define NullBox   ((BoxPtr)0)
 
#define MILLI_PER_MIN   (1000 * 60)
 
#define MILLI_PER_SECOND   (1000)
 
#define USE_BACKGROUND_PIXEL   3
 
#define USE_BORDER_PIXEL   3
 
#define lswapl(x)
 
#define lswaps(x)   ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define abs(a)   ((a) > 0 ? (a) : -(a))
 
#define fabs(a)   ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */
 
#define sign(x)   ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))
 
#define modulus(a, b, d)   if (((d) = (a) % (b)) < 0) (d) += (b)
 
#define lowbit(x)   ((x) & (~(x) + 1))
 
#define MAXSHORT   32767
 
#define MINSHORT   -MAXSHORT
 
#define LengthRestB(stuff)   (((uint32_t)stuff->length << 2) - sizeof(*stuff))
 
#define LengthRestS(stuff)   (((uint32_t)stuff->length << 1) - (sizeof(*stuff) >> 1))
 
#define LengthRestL(stuff)   ((uint32_t)stuff->length - (sizeof(*stuff) >> 2))
 
#define SwapRestS(stuff)   SwapShorts((short *)(stuff + 1), LengthRestS(stuff))
 
#define SwapRestL(stuff)   SwapLongs((int32_t *)(stuff + 1), LengthRestL(stuff))
 
#define swapl(x, n)
 
#define swaps(x, n)
 
#define cpswapl(src, dst)
 
#define cpswaps(src, dst)
 

Typedefs

typedef unsigned char * pointer
 
typedef int Bool
 
typedef uint32_t PIXEL
 
typedef uint32_t ATOM
 

Functions

void SwapLongs ()
 
void SwapShorts ()
 

Variables

uint32_t globalSerialNumber
 
uint32_t serverGeneration
 

Macro Definition Documentation

◆ abs

#define abs (   a)    ((a) > 0 ? (a) : -(a))

Definition at line 90 of file misc.h.

◆ cpswapl

#define cpswapl (   src,
  dst 
)
Value:
((char *)&(dst))[0] = ((char *) &(src))[3];\
((char *)&(dst))[1] = ((char *) &(src))[2];\
((char *)&(dst))[2] = ((char *) &(src))[1];\
((char *)&(dst))[3] = ((char *) &(src))[0];

Definition at line 142 of file misc.h.

◆ cpswaps

#define cpswaps (   src,
  dst 
)
Value:
((char *) &(dst))[0] = ((char *) &(src))[1];\
((char *) &(dst))[1] = ((char *) &(src))[0];

Definition at line 149 of file misc.h.

◆ fabs

#define fabs (   a)    ((a) > 0.0 ? (a) : -(a)) /* floating absolute value */

Definition at line 93 of file misc.h.

◆ FALSE

#define FALSE   0

Definition at line 62 of file misc.h.

◆ LengthRestB

#define LengthRestB (   stuff)    (((uint32_t)stuff->length << 2) - sizeof(*stuff))

Definition at line 113 of file misc.h.

◆ LengthRestL

#define LengthRestL (   stuff)    ((uint32_t)stuff->length - (sizeof(*stuff) >> 2))

Definition at line 119 of file misc.h.

◆ LengthRestS

#define LengthRestS (   stuff)    (((uint32_t)stuff->length << 1) - (sizeof(*stuff) >> 1))

Definition at line 116 of file misc.h.

◆ lowbit

#define lowbit (   x)    ((x) & (~(x) + 1))

Definition at line 105 of file misc.h.

◆ lswapl

#define lswapl (   x)
Value:
((((x) & 0xff) << 24) |\
(((x) & 0xff00) << 8) |\
(((x) & 0xff0000) >> 8) |\
(((x) >> 24) & 0xff))

Definition at line 79 of file misc.h.

◆ lswaps

#define lswaps (   x)    ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))

Definition at line 85 of file misc.h.

◆ max

#define max (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 88 of file misc.h.

◆ MAXCLIENTS

#define MAXCLIENTS   128

Definition at line 50 of file misc.h.

◆ MAXFORMATS

#define MAXFORMATS   8

Definition at line 51 of file misc.h.

◆ MAXSCREENS

#define MAXSCREENS   3

Definition at line 49 of file misc.h.

◆ MAXSHORT

#define MAXSHORT   32767

Definition at line 107 of file misc.h.

◆ MAXVISUALS_PER_SCREEN

#define MAXVISUALS_PER_SCREEN   50

Definition at line 52 of file misc.h.

◆ MILLI_PER_MIN

#define MILLI_PER_MIN   (1000 * 60)

Definition at line 67 of file misc.h.

◆ MILLI_PER_SECOND

#define MILLI_PER_SECOND   (1000)

Definition at line 68 of file misc.h.

◆ min

#define min (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 87 of file misc.h.

◆ MINSHORT

#define MINSHORT   -MAXSHORT

Definition at line 108 of file misc.h.

◆ modulus

#define modulus (   a,
  b,
 
)    if (((d) = (a) % (b)) < 0) (d) += (b)

Definition at line 97 of file misc.h.

◆ NullBox

#define NullBox   ((BoxPtr)0)

Definition at line 66 of file misc.h.

◆ sign

#define sign (   x)    ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0))

Definition at line 95 of file misc.h.

◆ swapl

#define swapl (   x,
 
)
Value:
n = ((char *) (x))[0];\
((char *) (x))[0] = ((char *) (x))[3];\
((char *) (x))[3] = n;\
n = ((char *) (x))[1];\
((char *) (x))[1] = ((char *) (x))[2];\
((char *) (x))[2] = n;

Definition at line 129 of file misc.h.

◆ SwapRestL

#define SwapRestL (   stuff)    SwapLongs((int32_t *)(stuff + 1), LengthRestL(stuff))

Definition at line 125 of file misc.h.

◆ SwapRestS

#define SwapRestS (   stuff)    SwapShorts((short *)(stuff + 1), LengthRestS(stuff))

Definition at line 122 of file misc.h.

◆ swaps

#define swaps (   x,
 
)
Value:
n = ((char *) (x))[0];\
((char *) (x))[0] = ((char *) (x))[1];\
((char *) (x))[1] = n

Definition at line 137 of file misc.h.

◆ TRUE

#define TRUE   1

Definition at line 61 of file misc.h.

◆ USE_BACKGROUND_PIXEL

#define USE_BACKGROUND_PIXEL   3

Definition at line 74 of file misc.h.

◆ USE_BORDER_PIXEL

#define USE_BORDER_PIXEL   3

Definition at line 75 of file misc.h.

Typedef Documentation

◆ ATOM

typedef uint32_t ATOM

Definition at line 57 of file misc.h.

◆ Bool

typedef int Bool

Definition at line 55 of file misc.h.

◆ PIXEL

typedef uint32_t PIXEL

Definition at line 56 of file misc.h.

◆ pointer

typedef unsigned char* pointer

Definition at line 54 of file misc.h.

Function Documentation

◆ SwapLongs()

void SwapLongs ( )

◆ SwapShorts()

void SwapShorts ( )

Variable Documentation

◆ globalSerialNumber

uint32_t globalSerialNumber

◆ serverGeneration

uint32_t serverGeneration