MicropolisEngine/src/fileio.cpp File Reference

#include "stdafx.h"
#include "micropolis.h"

Go to the source code of this file.

Defines

#define SWAP_SHORTS(buf, len)   swap_shorts(buf, len)
#define HALF_SWAP_LONGS(buf, len)   half_swap_longs(buf, len)

Functions

static void swap_shorts (short *buf, int len)
static void half_swap_longs (long *buf, int len)
static bool load_short (short *buf, int len, FILE *f)
static bool save_short (short *buf, int len, FILE *f)


Detailed Description

Definition in file fileio.cpp.


Define Documentation

#define HALF_SWAP_LONGS ( buf,
len   )     half_swap_longs(buf, len)

Convert an array of long values between MAC and Intel endian formats.

Parameters:
buf Array with longs.
len Number of long values in the array.

Definition at line 89 of file fileio.cpp.

Referenced by Micropolis::loadFile(), and Micropolis::saveFile().

#define SWAP_SHORTS ( buf,
len   )     swap_shorts(buf, len)

Convert an array of short values between MAC and Intel endian formats.

Parameters:
buf Array with shorts.
len Number of short values in the array.

Definition at line 82 of file fileio.cpp.

Referenced by load_short(), and save_short().


Function Documentation

static void half_swap_longs ( long *  buf,
int  len 
) [static]

Swap upper and lower words of all longs in the array.

Parameters:
buf Array with longs.
len Number of long values in the array.

Definition at line 113 of file fileio.cpp.

static bool load_short ( short *  buf,
int  len,
FILE *  f 
) [static]

Load an array of short values from file to memory.

Convert to the correct processor architecture, if necessary.

Parameters:
buf Buffer to put the loaded short values in.
len Number of short values to load.
f File handle of the file to load from.
Returns:
Load was succesfull.

Definition at line 161 of file fileio.cpp.

References SWAP_SHORTS.

Referenced by Micropolis::loadFileDir().

static bool save_short ( short *  buf,
int  len,
FILE *  f 
) [static]

Save an array of short values from memory to file.

Convert to the correct endianness first, if necessary.

Parameters:
buf Buffer containing the short values to save.
len Number of short values to save.
f File handle of the file to save to.
Returns:
Save was succesfull.

Definition at line 184 of file fileio.cpp.

References SWAP_SHORTS.

Referenced by Micropolis::saveFile().

static void swap_shorts ( short *  buf,
int  len 
) [static]

Swap upper and lower byte of all shorts in the array.

Parameters:
buf Array with shorts.
len Number of short values in the array.

Definition at line 96 of file fileio.cpp.


Generated on Wed Feb 2 09:19:22 2011 for Micropolis by  doxygen 1.5.6