Whitespace, dammit. Oh, and removal of several orphaned comments. Comments in front of functions suck.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-08-22 22:03:16 +00:00
parent 62d0845528
commit edcf092b05
28 changed files with 350 additions and 555 deletions

View file

@ -115,6 +115,7 @@ static byte chktbl[1024 + 4] = {
0x00, 0x00, 0x00, 0x00
};
/*
COM_BlockSequenceCRCByte

View file

@ -38,10 +38,9 @@
#include <ctype.h>
#include "QF/cvar.h"
#include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/qargs.h"
#include "QF/qendian.h"
@ -50,6 +49,8 @@
#include "QF/vfs.h"
#include "QF/zone.h"
#include "compat.h"
typedef struct cmdalias_s {
struct cmdalias_s *next;
const char *name;
@ -87,9 +88,6 @@ Cmd_Wait_f (void)
sizebuf_t cmd_text;
byte cmd_text_buf[8192];
/*
Cbuf_Init
*/
void
Cbuf_Init (void)
{
@ -116,7 +114,6 @@ Cbuf_AddText (const char *text)
SZ_Write (&cmd_text, text, strlen (text));
}
/*
Cbuf_InsertText
@ -149,7 +146,6 @@ Cbuf_InsertText (const char *text)
cmd_text.data[textlen] = '\n';
}
static void
extract_line (char *line)
{
@ -185,11 +181,6 @@ extract_line (char *line)
}
}
/*
Cbuf_Execute
*/
void
Cbuf_Execute (void)
{
@ -210,11 +201,6 @@ Cbuf_Execute (void)
}
}
/*
Cbuf_Execute
*/
void
Cbuf_Execute_Sets (void)
{
@ -287,11 +273,6 @@ Cmd_StuffCmds_f (void)
free (build);
}
/*
Cmd_Exec_File
*/
void
Cmd_Exec_File (const char *path)
{
@ -313,9 +294,6 @@ Cmd_Exec_File (const char *path)
}
}
/*
Cmd_Exec_f
*/
void
Cmd_Exec_f (void)
{
@ -341,7 +319,6 @@ Cmd_Exec_f (void)
Hunk_FreeToLowMark (mark);
}
/*
Cmd_Echo_f
@ -362,7 +339,6 @@ Cmd_Echo_f (void)
Creates a new command that executes a command string (possibly ; seperated)
*/
char *
CopyString (char *in)
{
@ -469,22 +445,14 @@ static char *cmd_argv[MAX_ARGS];
static const char *cmd_null_string = "";
static const char *cmd_args[MAX_ARGS];
static cmd_function_t *cmd_functions; // possible commands to execute
/*
Cmd_Argc
*/
int
Cmd_Argc (void)
{
return cmd_argc;
}
/*
Cmd_Argv
*/
const char *
Cmd_Argv (int arg)
{
@ -506,7 +474,6 @@ Cmd_Args (int start)
return cmd_args[start];
}
/*
Cmd_TokenizeString
@ -557,13 +524,8 @@ Cmd_TokenizeString (const char *text)
cmd_argc++;
}
}
}
/*
Cmd_AddCommand
*/
void
Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *description)
{
@ -594,9 +556,6 @@ Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *descripti
*c = cmd;
}
/*
Cmd_Exists
*/
qboolean
Cmd_Exists (const char *cmd_name)
{
@ -610,11 +569,6 @@ Cmd_Exists (const char *cmd_name)
return false;
}
/*
Cmd_CompleteCommand
*/
const char *
Cmd_CompleteCommand (const char *partial)
{
@ -653,7 +607,6 @@ Cmd_CompleteCommand (const char *partial)
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
Thanks to taniwha
*/
int
Cmd_CompleteCountPossible (const char *partial)
@ -683,7 +636,6 @@ Cmd_CompleteCountPossible (const char *partial)
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
Thanks to taniwha
*/
const char **
Cmd_CompleteBuildList (const char *partial)
@ -712,7 +664,6 @@ Cmd_CompleteBuildList (const char *partial)
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
Thanks to taniwha
*/
const char *
Cmd_CompleteAlias (const char * partial)
@ -740,7 +691,6 @@ Cmd_CompleteAlias (const char * partial)
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
Thanks to taniwha
*/
int
Cmd_CompleteAliasCountPossible (const char *partial)
@ -771,7 +721,6 @@ Cmd_CompleteAliasCountPossible (const char *partial)
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
Thanks to taniwha
*/
const char **
Cmd_CompleteAliasBuildList (const char *partial)
@ -779,7 +728,8 @@ Cmd_CompleteAliasBuildList (const char *partial)
cmdalias_t *alias;
int len = 0;
int bpos = 0;
int sizeofbuf = (Cmd_CompleteAliasCountPossible (partial) + 1) * sizeof (char *);
int sizeofbuf = (Cmd_CompleteAliasCountPossible (partial) + 1) *
sizeof (char *);
const char **buf;
len = strlen(partial);
@ -913,8 +863,6 @@ Cmd_ExecuteString (const char *text, cmd_source_t src)
Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv (0));
}
/*
Cmd_CheckParm
@ -970,7 +918,8 @@ Cmd_Help_f (void)
name = Cmd_Argv (1);
for (cmd = cmd_functions; cmd && strcasecmp (name, cmd->name); cmd = cmd->next)
for (cmd = cmd_functions; cmd && strcasecmp (name, cmd->name);
cmd = cmd->next)
;
if (cmd) {
Con_Printf ("%s\n", cmd->description);
@ -1021,31 +970,31 @@ void
Cmd_Init_Hash (void)
{
cmd_hash = Hash_NewTable (1021, cmd_get_key, 0, 0);
cmd_alias_hash = Hash_NewTable (1021, cmd_alias_get_key, cmd_alias_free, 0);
cmd_alias_hash = Hash_NewTable (1021, cmd_alias_get_key, cmd_alias_free,
0);
}
/*
Cmd_Init
*/
void
Cmd_Init (void)
{
//
// register our commands
//
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f, "Execute the commands given at startup again");
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f, "Execute the commands given "
"at startup again");
Cmd_AddCommand ("exec", Cmd_Exec_f, "Execute a script file");
Cmd_AddCommand ("echo", Cmd_Echo_f, "Print text to console");
Cmd_AddCommand ("alias", Cmd_Alias_f, "Used to create a reference to a command or list of commands.\n"
"When used without parameters, displays all current aliases.\n"
"Note: Enclose multiple commands within quotes and seperate each command with a semi-colon.");
Cmd_AddCommand ("alias", Cmd_Alias_f, "Used to create a reference to a "
"command or list of commands.\n"
"When used without parameters, displays all current "
"aliases.\n"
"Note: Enclose multiple commands within quotes and "
"seperate each command with a semi-colon.");
Cmd_AddCommand ("unalias", Cmd_UnAlias_f, "Remove the selected alias");
Cmd_AddCommand ("wait", Cmd_Wait_f, "Wait a game tic");
Cmd_AddCommand ("cmdlist", Cmd_CmdList_f, "List all commands");
Cmd_AddCommand ("help", Cmd_Help_f, "Display help for a command or variable");
Cmd_AddCommand ("help", Cmd_Help_f, "Display help for a command or "
"variable");
}
char com_token[MAX_COM_TOKEN];
/*

View file

@ -33,6 +33,7 @@
#include "QF/console.h"
#include "QF/sys.h"
/*
Con_Print

View file

@ -38,18 +38,20 @@
#include <stdarg.h>
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/sys.h"
#include "compat.h"
#define MAXPRINTMSG 4096
/*
Con_Printf
Handles cursor positioning, line wrapping, etc
*/
#define MAXPRINTMSG 4096
void
Con_Printf (const char *fmt, ...)
{
@ -130,4 +132,3 @@ Con_DisplayList(const char **list, int con_linewidth)
if (pos)
Con_Printf("\n\n");
}

View file

@ -74,6 +74,7 @@ static unsigned short crctable[256] = {
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
void
CRC_Init (unsigned short *crcvalue)
{

View file

@ -41,14 +41,15 @@
#include <stdio.h>
#include <stdlib.h>
#include "compat.h"
#include "QF/console.h"
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/hash.h"
#include "QF/qargs.h"
#include "QF/vfs.h"
#include "compat.h"
#define USER_RO_CVAR "User-created READ-ONLY Cvar"
#define USER_CVAR "User-created cvar"
@ -60,9 +61,7 @@ cvar_alias_t *calias_vars;
hashtab_t *cvar_hash;
hashtab_t *calias_hash;
/*
Cvar_FindVar
*/
cvar_t *
Cvar_FindVar (const char *var_name)
{
@ -106,9 +105,6 @@ Cvar_Alias_Get (const char *name, cvar_t *cvar)
}
}
/*
Cvar_VariableValue
*/
float
Cvar_VariableValue (const char *var_name)
{
@ -122,10 +118,6 @@ Cvar_VariableValue (const char *var_name)
return atof (var->string);
}
/*
Cvar_VariableString
*/
const char *
Cvar_VariableString (const char *var_name)
{
@ -139,10 +131,6 @@ Cvar_VariableString (const char *var_name)
return var->string;
}
/*
Cvar_CompleteVariable
*/
const char *
Cvar_CompleteVariable (const char *partial)
{
@ -184,7 +172,6 @@ Cvar_CompleteVariable (const char *partial)
New function for tab-completion system
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
*/
int
Cvar_CompleteCountPossible (const char *partial)
@ -214,7 +201,6 @@ Cvar_CompleteCountPossible (const char *partial)
Added by EvilTypeGuy
Thanks to Fett erich@heintz.com
Thanks to taniwha
*/
const char **
Cvar_CompleteBuildList (const char *partial)
@ -222,7 +208,8 @@ Cvar_CompleteBuildList (const char *partial)
cvar_t *cvar;
int len = 0;
int bpos = 0;
int sizeofbuf = (Cvar_CompleteCountPossible (partial) + 1) * sizeof (char *);
int sizeofbuf = (Cvar_CompleteCountPossible (partial) + 1) *
sizeof (char *);
const char **buf;
len = strlen(partial);
@ -236,9 +223,6 @@ Cvar_CompleteBuildList (const char *partial)
return buf;
}
/*
Cvar_Set
*/
void
Cvar_Set (cvar_t *var, const char *value)
{
@ -264,7 +248,6 @@ Cvar_Set (cvar_t *var, const char *value)
var->callback (var);
}
/*
Cvar_SetROM
@ -290,9 +273,6 @@ Cvar_SetROM (cvar_t *var, const char *value)
var->callback (var);
}
/*
Cvar_SetValue
*/
// 1999-09-07 weird cvar zeros fix by Maddes
void
Cvar_SetValue (cvar_t *var, float value)
@ -301,7 +281,8 @@ Cvar_SetValue (cvar_t *var, float value)
int i;
snprintf (val, sizeof (val), "%f", value);
for (i = strlen (val) - 1; i > 0 && val[i] == '0' && val[i - 1] != '.'; i--) {
for (i = strlen (val) - 1; i > 0 && val[i] == '0' && val[i - 1] != '.';
i--) {
val[i] = 0;
}
Cvar_Set (var, val);
@ -334,7 +315,6 @@ Cvar_Command (void)
return true;
}
/*
Cvar_WriteVariables
@ -371,7 +351,8 @@ Cvar_Set_f (void)
if (var) {
if (var->flags & CVAR_ROM) {
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n", var_name);
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n",
var_name);
} else {
Cvar_Set (var, value);
}
@ -401,7 +382,8 @@ Cvar_Setrom_f (void)
if (var) {
if (var->flags & CVAR_ROM) {
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n", var_name);
Con_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n",
var_name);
} else {
Cvar_Set (var, value);
Cvar_SetFlags (var, var->flags | CVAR_ROM);
@ -501,8 +483,10 @@ Cvar_Init (void)
developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL,
"set to enable extra debugging information");
Cmd_AddCommand ("set", Cvar_Set_f, "Set the selected variable, useful on the command line (+set variablename setting)");
Cmd_AddCommand ("setrom", Cvar_Setrom_f, "Set the selected variable and make it read only, useful on the command line.\n"
Cmd_AddCommand ("set", Cvar_Set_f, "Set the selected variable, useful on "
"the command line (+set variablename setting)");
Cmd_AddCommand ("setrom", Cvar_Setrom_f, "Set the selected variable and "
"make it read only, useful on the command line.\n"
"(+setrom variablename setting)");
Cmd_AddCommand ("toggle", Cvar_Toggle_f, "Toggle a cvar on or off");
Cmd_AddCommand ("cvarlist", Cvar_CvarList_f, "List all cvars");
@ -533,7 +517,6 @@ Cvar_Shutdown (void)
}
}
cvar_t *
Cvar_Get (const char *name, const char *string, int cvarflags,
void (*callback)(cvar_t*), const char *description)

View file

@ -13,14 +13,13 @@
*
*/
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <io.h>
#include <direct.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <io.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#define SUFFIX "*"
#define SLASH "\\"
@ -29,11 +28,12 @@
#define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) /* is a directory */
#endif S_ISDIR
/*
* opendir
*
* Returns a pointer to a DIR structure appropriately filled in to begin
* searching a directory.
opendir
Returns a pointer to a DIR structure appropriately filled in to begin
searching a directory.
*/
DIR *
opendir (const char *szPath)
@ -107,12 +107,11 @@ opendir (const char *szPath)
return nd;
}
/*
* readdir
*
* Return a pointer to a dirent structure filled with the information on the
* next entry in the directory.
readdir
Return a pointer to a dirent structure filled with the information on the
next entry in the directory.
*/
struct dirent *
readdir (DIR * dirp)
@ -169,11 +168,10 @@ readdir (DIR * dirp)
return (struct dirent *) 0;
}
/*
* closedir
*
* Frees up resources allocated by opendir.
closedir
Frees up resources allocated by opendir.
*/
int
closedir (DIR * dirp)
@ -199,10 +197,10 @@ closedir (DIR * dirp)
}
/*
* rewinddir
*
* Return to the beginning of the directory "stream". We simply call findclose
* and then reset things like an opendir.
rewinddir
Return to the beginning of the directory "stream". We simply call findclose
and then reset things like an opendir.
*/
void
rewinddir (DIR * dirp)
@ -223,10 +221,10 @@ rewinddir (DIR * dirp)
}
/*
* telldir
*
* Returns the "position" in the "directory stream" which can be used with
* seekdir to go back to an old entry. We simply return the value in stat.
telldir
Returns the "position" in the "directory stream" which can be used with
seekdir to go back to an old entry. We simply return the value in stat.
*/
long
telldir (DIR * dirp)
@ -241,13 +239,13 @@ telldir (DIR * dirp)
}
/*
* seekdir
*
* Seek to an entry previously returned by telldir. We rewind the directory
* and call readdir repeatedly until either dd_stat is the position number
* or -1 (off the end). This is not perfect, in that the directory may
* have changed while we weren't looking. But that is probably the case with
* any such system.
seekdir
Seek to an entry previously returned by telldir. We rewind the directory
and call readdir repeatedly until either dd_stat is the position number
or -1 (off the end). This is not perfect, in that the directory may
have changed while we weren't looking. But that is probably the case with
any such system.
*/
void
seekdir (DIR * dirp, long lPos)

View file

@ -32,6 +32,7 @@
#include "QF/qendian.h"
#include "QF/vfile.h"
void
WriteFloat (VFile *file, float f)
{

View file

@ -34,23 +34,22 @@
# define _GNU_SOURCE
#endif
#include <errno.h>
#include <ctype.h>
#include <errno.h>
#include "fnmatch.h"
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
it is simpler to just do this in the source for each such file.
*/
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
extern int errno;
#endif

View file

@ -1,7 +1,7 @@
/*
info.c
(description)
Info strings.
Copyright (C) 1996-1997 Id Software, Inc.
@ -39,13 +39,11 @@
#include <stdio.h>
#include <ctype.h>
#include "compat.h"
#include "QF/console.h"
#include "QF/info.h"
/*
INFO STRINGS
*/
#include "compat.h"
/*
Info_ValueForKey
@ -180,7 +178,6 @@ Info_RemovePrefixedKeys (char *start, char prefix)
}
void
Info_SetValueForStarKey (char *s, const char *key, const char *value, size_t maxsize, int flags)
{
@ -243,7 +240,8 @@ Info_SetValueForStarKey (char *s, const char *key, const char *value, size_t max
}
void
Info_SetValueForKey (char *s, const char *key, const char *value, size_t maxsize, int flags)
Info_SetValueForKey (char *s, const char *key, const char *value,
size_t maxsize, int flags)
{
if (key[0] == '*') {
Con_Printf ("Can't set * keys\n");

View file

@ -32,6 +32,7 @@
#include "QF/link.h"
// ClearLink is used for new headnodes
void
ClearLink (link_t *l)

View file

@ -72,9 +72,7 @@ ProjectPointOnPlane (vec3_t dst, const vec3_t p, const vec3_t normal)
dst[2] = p[2] - d * n[2];
}
/*
** assumes "src" is normalized
*/
// assumes "src" is normalized
void
PerpendicularVector (vec3_t dst, const vec3_t src)
{
@ -83,8 +81,7 @@ PerpendicularVector (vec3_t dst, const vec3_t src)
float minelem = 1.0F;
vec3_t tempvec;
/*
** find the smallest magnitude axially aligned vector */
/* find the smallest magnitude axially aligned vector */
for (pos = 0, i = 0; i < 3; i++) {
if (fabs (src[i]) < minelem) {
pos = i;
@ -94,12 +91,10 @@ PerpendicularVector (vec3_t dst, const vec3_t src)
tempvec[0] = tempvec[1] = tempvec[2] = 0.0F;
tempvec[pos] = 1.0F;
/*
** project the point onto the plane defined by src */
/* project the point onto the plane defined by src */
ProjectPointOnPlane (dst, tempvec, src);
/*
** normalize the result */
/* normalize the result */
VectorNormalize (dst);
}
@ -223,7 +218,8 @@ BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
float dist1, dist2;
int sides;
#if 0 // this is done by the BOX_ON_PLANE_SIDE macro before
#if 0
// this is done by the BOX_ON_PLANE_SIDE macro before
// calling this function
// fast axial cases
@ -328,7 +324,6 @@ BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
sides = 1;
if (dist2 < 0)
sides |= 2;
#endif
sides = 0;
@ -344,10 +339,8 @@ BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, mplane_t *p)
return sides;
}
#endif
void
AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
{
@ -395,7 +388,6 @@ _VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc)
vecc[2] = veca[2] + scale * vecb[2];
}
vec_t
_DotProduct (vec3_t v1, vec3_t v2)
{
@ -485,7 +477,6 @@ VectorScale (vec3_t in, vec_t scale, vec3_t out)
out[2] = in[2] * scale;
}
int
Q_log2 (int val)
{
@ -496,10 +487,6 @@ Q_log2 (int val)
return answer;
}
/*
R_ConcatRotations
*/
void
R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3])
{
@ -523,10 +510,6 @@ R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3])
in1[2][2] * in2[2][2];
}
/*
R_ConcatTransforms
*/
void
R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
{
@ -556,7 +539,6 @@ R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
in1[2][2] * in2[2][3] + in1[2][3];
}
/*
FloorDivMod
@ -564,7 +546,6 @@ R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4])
numer and denom, both of which should contain no fractional part. The
quotient must fit in 32 bits.
*/
void
FloorDivMod (double numer, double denom, int *quotient, int *rem)
{
@ -586,10 +567,8 @@ FloorDivMod (double numer, double denom, int *quotient, int *rem)
q = (int) x;
r = (int) floor (numer - (x * denom));
} else {
//
// perform operations with positive values, and fix mod to make
// floor-based
//
x = floor (-numer / denom);
q = -(int) x;
r = (int) floor (-numer - (x * denom));
@ -603,10 +582,6 @@ FloorDivMod (double numer, double denom, int *quotient, int *rem)
*rem = r;
}
/*
GreatestCommonDivisor
*/
int
GreatestCommonDivisor (int i1, int i2)
{
@ -621,17 +596,13 @@ GreatestCommonDivisor (int i1, int i2)
}
}
#ifndef USE_INTEL_ASM
// TODO: move to nonintel.c
/*
Invert24To16
Inverts an 8.24 value to a 16.16 value
TODO: move to nonintel.c
*/
fixed16_t
Invert24To16 (fixed16_t val)
{
@ -641,5 +612,4 @@ Invert24To16 (fixed16_t val)
return (fixed16_t)
(((double) 0x10000 * (double) 0x1000000 / (double) val) + 0.5);
}
#endif

View file

@ -41,7 +41,6 @@
#include "QF/uint32.h"
/* NOTE: This code makes no attempt to be fast!
It assumes that a int is at least 32 bits long
*/
@ -61,6 +60,7 @@ static struct mdfour *m;
#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s)
#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s)
/* this applies md4 to 64 byte chunks */
static void
mdfour64 (uint32 * M)
@ -183,7 +183,6 @@ mdfour_begin (struct mdfour *md)
md->totalN = 0;
}
static void
mdfour_tail (const unsigned char *in, int n)
{
@ -234,7 +233,6 @@ mdfour_update (struct mdfour *md, const unsigned char *in, int n)
mdfour_tail (in, n);
}
void
mdfour_result (struct mdfour *md, unsigned char *out)
{
@ -246,7 +244,6 @@ mdfour_result (struct mdfour *md, unsigned char *out)
copy4 (out + 12, m->D);
}
void
mdfour (unsigned char *out, const unsigned char *in, int n)
{

View file

@ -40,15 +40,14 @@
#include "QF/qendian.h"
#include "QF/sys.h"
/*
MESSAGE IO FUNCTIONS
Handles byte ordering and avoids alignment errors
*/
//
// writing functions
//
void
MSG_WriteChar (sizebuf_t *sb, int c)
@ -113,7 +112,6 @@ MSG_WriteFloat (sizebuf_t *sb, float f)
int l;
} dat;
dat.f = f;
dat.l = LittleLong (dat.l);
@ -148,9 +146,7 @@ MSG_WriteAngle16 (sizebuf_t *sb, float f)
}
//
// reading functions
//
void
MSG_BeginReading (msg_t *msg)

View file

@ -46,6 +46,7 @@
#include "compat.h"
tex_t *
LoadPCX (VFile *f, int convert, byte *pal)
{
@ -59,9 +60,7 @@ LoadPCX (VFile *f, int convert, byte *pal)
int count;
tex_t *tex;
//
// parse the PCX file
//
pcx_mark = Hunk_LowMark ();
pcx = Hunk_AllocName (com_filesize, "PCX");
Qread (f, pcx, com_filesize);
@ -145,7 +144,6 @@ LoadPCX (VFile *f, int convert, byte *pal)
return tex;
}
pcx_t *
EncodePCX (byte * data, int width, int height,
int rowbytes, byte * palette, qboolean flip, int *length)

View file

@ -29,19 +29,15 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
@ -65,6 +61,7 @@
cvar_t *fs_pluginpath;
void
PI_InitCvars (void)
{
@ -117,7 +114,8 @@ PI_LoadPlugin (const char *type, const char *name)
#if defined(HAVE_DLOPEN)
if (!(dlhand = dlopen (realname, RTLD_LAZY))) { // lib not found
Con_Printf ("Could not load plugin \"%s\": %s\n", realname, dlerror ());
Con_Printf ("Could not load plugin \"%s\": %s\n", realname,
dlerror ());
return NULL;
}
#elif defined (_WIN32)
@ -128,13 +126,16 @@ PI_LoadPlugin (const char *type, const char *name)
#endif
#if defined(HAVE_DLOPEN)
if (!(plugin_info = dlsym (dlhand, "PluginInfo"))) { // info function not found
if (!(plugin_info = dlsym (dlhand, "PluginInfo"))) {
// info function not found
dlclose (dlhand);
Con_Printf ("Plugin info function not found\n");
return NULL;
}
#elif defined (_WIN32)
if (!(plugin_info = (P_PluginInfo) GetProcAddress (dlhand, "PluginInfo"))) { // info function not found
if (!(plugin_info = (P_PluginInfo) GetProcAddress (dlhand,
"PluginInfo"))) {
// info function not found
FreeLibrary (dlhand);
Con_Printf ("Plugin info function not found\n");
return NULL;

View file

@ -63,6 +63,7 @@ char *com_cmdline;
qboolean nouse = false; // 1999-10-29 +USE fix by Maddes
/*
COM_CheckParm
@ -85,9 +86,6 @@ COM_CheckParm (char *parm)
return 0;
}
/*
COM_InitArgv
*/
void
COM_InitArgv (int argc, char **argv)
{
@ -96,9 +94,8 @@ COM_InitArgv (int argc, char **argv)
safe = false;
largv =
(char **) calloc (1, (argc + NUM_SAFE_ARGVS + 1) * sizeof (char **));
largv = (char **) calloc (1, (argc + NUM_SAFE_ARGVS + 1) *
sizeof (char **));
for (com_argc = 0, len = 0; com_argc < argc; com_argc++) {
largv[com_argc] = argv[com_argc];
@ -120,9 +117,8 @@ COM_InitArgv (int argc, char **argv)
}
if (safe) {
// force all the safe-mode switches. Note that we reserved extra
// space in
// case we need to add these, so we don't need an overflow check
// force all the safe-mode switches. Note that we reserved extra space
// in case we need to add these, so we don't need an overflow check
for (i = 0; i < NUM_SAFE_ARGVS; i++) {
largv[com_argc] = safeargvs[i];
com_argc++;
@ -132,11 +128,9 @@ COM_InitArgv (int argc, char **argv)
largv[com_argc] = argvdummy;
com_argv = largv;
// 1999-10-29 +USE fix by Maddes start
if (COM_CheckParm ("-nouse")) {
nouse = true;
}
// 1999-10-29 +USE fix by Maddes end
}
/*

View file

@ -60,6 +60,7 @@ float (*BigFloat) (float l) = FloatNoSwap;
float (*LittleFloat) (float l) = FloatSwap;
#endif
short
ShortSwap (short l)
{
@ -104,7 +105,6 @@ FloatSwap (float f)
byte b[4];
} dat1 , dat2;
dat1.f = f;
dat2.b[0] = dat1.b[3];
dat2.b[1] = dat1.b[2];

View file

@ -44,6 +44,7 @@ static qboolean PL_SkipSpace (pldata_t *);
static char *PL_ParseQuotedString (pldata_t *);
static char *PL_ParseUnquotedString (pldata_t *);
void
PL_FreeItem (plitem_t *item)
{
@ -213,7 +214,6 @@ PL_ParseQuotedString (pldata_t *pl)
if (pl->pos - start - shrink == 0) {
str = "";
} else {
char chars[pl->pos - start - shrink];
unsigned int j;
unsigned int k;
@ -286,7 +286,8 @@ PL_ParseQuotedString (pldata_t *pl)
}
}
}
str = strncat (calloc ((pl->pos - start - shrink) + 1, 1), chars, pl->pos - start - shrink);
str = strncat (calloc ((pl->pos - start - shrink) + 1, 1), chars,
pl->pos - start - shrink);
}
pl->pos++;
return str;
@ -303,7 +304,8 @@ PL_ParseUnquotedString (pldata_t *pl)
break;
pl->pos++;
}
str = strncat (calloc ((pl->pos - start) + 1, 1), &pl->ptr[start], pl->pos - start);
str = strncat (calloc ((pl->pos - start) + 1, 1), &pl->ptr[start],
pl->pos - start);
return str;
}
@ -316,7 +318,8 @@ PL_ParsePropertyListItem (pldata_t *pl)
return NULL;
switch (pl->ptr[pl->pos]) {
case '{': {
case '{':
{
hashtab_t *dict = Hash_NewTable (1021, dict_get_key, dict_free, NULL);
pl->pos++;

View file

@ -39,11 +39,11 @@
# include <unistd.h>
#endif
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <fcntl.h>
#include <dirent.h>
#ifdef HAVE_FNMATCH_H
# define model_t sunmodel_t
@ -62,7 +62,6 @@
#include <limits.h>
#include "QF/cmd.h"
#include "compat.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/hash.h"
@ -70,16 +69,17 @@
#include "QF/qargs.h"
#include "QF/qendian.h"
#include "QF/qtypes.h"
#include "QF/vfs.h"
#include "QF/sys.h"
#include "QF/va.h"
#include "QF/vfs.h"
#include "QF/zone.h"
#include "compat.h"
#ifndef HAVE_FNMATCH_PROTO
int fnmatch (const char *__pattern, const char *__string, int __flags);
#endif
/*
All of Quake's data access is through a hierchical file system, but the
contents of the file system can be transparently merged from several
@ -161,9 +161,7 @@ typedef struct searchpath_s {
searchpath_t *com_searchpaths;
searchpath_t *com_base_searchpaths; // without gamedirs
/*
COM_FileBase
*/
void
COM_FileBase (const char *in, char *out)
{
@ -191,9 +189,7 @@ COM_FileBase (const char *in, char *out)
}
}
/*
COM_filelength
*/
int
COM_filelength (VFile *f)
{
@ -208,9 +204,7 @@ COM_filelength (VFile *f)
return end;
}
/*
COM_FileOpenRead
*/
int
COM_FileOpenRead (char *path, VFile **hndl)
{
@ -226,9 +220,7 @@ COM_FileOpenRead (char *path, VFile **hndl)
return COM_filelength (f);
}
/*
COM_Path_f
*/
void
COM_Path_f (void)
{
@ -246,12 +238,6 @@ COM_Path_f (void)
}
}
/*
COM_Maplist_f
List map files in gamepaths.
*/
struct maplist {
char **list;
int count;
@ -329,6 +315,11 @@ maplist_print (struct maplist *maplist)
}
}
/*
COM_Maplist_f
List map files in gamepaths.
*/
void
COM_Maplist_f (void)
{
@ -433,7 +424,6 @@ COM_WriteBuffers (const char *filename, int count, ...)
va_end (args);
}
/*
COM_CreatePath
@ -456,7 +446,6 @@ COM_CreatePath (const char *path)
}
}
/*
COM_CopyFile
@ -492,9 +481,6 @@ COM_CopyFile (char *netpath, char *cachepath)
Qclose (out);
}
/*
COM_OpenRead
*/
VFile *
COM_OpenRead (const char *path, int offs, int len, int zip)
{
@ -552,12 +538,14 @@ contains_updir (const char *filename)
// FIXME: maybe I should handle alternate seperators?
for (i = 0; filename[i+1]; i++) {
if (!(i == 0 || filename[i-1] == '/') // beginning of string or first slash
if (!(i == 0 || filename[i-1] == '/') // beginning of string
// or first slash
|| filename[i] != '.' // first dot
|| filename[i+1] != '.') // second dot
continue;
if (filename[i+2] == 0 || filename[i+2] == '/') // end of string or second slash
if (filename[i+2] == 0 || filename[i+2] == '/')
// end of string or second slash
return 1;
}
return 0;
@ -595,9 +583,7 @@ _COM_FOpenFile (const char *filename, VFile **gzfile, char *foundname, int zip)
goto error;
}
//
// search through the path, one element at a time
//
for (search = com_searchpaths; search; search = search->next) {
// is the element a pak file?
if (search->pack) {
@ -631,7 +617,8 @@ _COM_FOpenFile (const char *filename, VFile **gzfile, char *foundname, int zip)
if (findtime == -1) {
#ifdef HAVE_ZLIB
strncpy (foundname, gzfilename, MAX_OSPATH);
snprintf (netpath, sizeof (netpath), "%s%s%s", search->filename,
snprintf (netpath, sizeof (netpath), "%s%s%s",
search->filename,
search->filename[0] ? "/" : "", gzfilename);
findtime = Sys_FileTime (netpath);
if (findtime == -1)
@ -795,7 +782,6 @@ COM_LoadPackFile (char *packfile)
Qseek (packhandle, header.dirofs, SEEK_SET);
Qread (packhandle, info, header.dirlen);
// parse the directory
for (i = 0; i < numpackfiles; i++) {
strcpy (newfiles[i].name, info[i].name);
@ -819,7 +805,6 @@ COM_LoadPackFile (char *packfile)
#define FNAME_SIZE MAX_OSPATH
// Note, this is /NOT/ a work-alike strcmp, this groups numbers sanely.
//int qstrcmp(const char *val, const char *ref)
int
qstrcmp (char **os1, char **os2)
{
@ -996,9 +981,7 @@ COM_Gamedir (const char *dir)
return; // still the same
strcpy (gamedirfile, dir);
//
// free up any current game dir info
//
while (com_searchpaths != com_base_searchpaths) {
if (com_searchpaths->pack) {
Qclose (com_searchpaths->pack->handle);
@ -1010,9 +993,7 @@ COM_Gamedir (const char *dir)
com_searchpaths = next;
}
//
// flush all data, so it will be forced to reload
//
Cache_Flush ();
if (fs_skinbase && strcmp (dir, fs_skinbase->string) == 0)
@ -1021,9 +1002,6 @@ COM_Gamedir (const char *dir)
COM_AddGameDirectory (dir);
}
/*
COM_CreateGameDirectory
*/
void
COM_CreateGameDirectory (const char *gamename)
{
@ -1032,9 +1010,6 @@ COM_CreateGameDirectory (const char *gamename)
COM_AddGameDirectory (gamename);
}
/*
COM_InitFilesystem
*/
void
COM_Filesystem_Init (void)
{
@ -1081,16 +1056,14 @@ void
COM_Filesystem_Init_Cvars (void)
{
fs_sharepath = Cvar_Get ("fs_sharepath", FS_SHAREPATH, CVAR_ROM, NULL,
"location of shared (read only) game directories");
"location of shared (read only) game "
"directories");
fs_userpath = Cvar_Get ("fs_userpath", FS_USERPATH, CVAR_ROM, NULL,
"location of your game directories");
fs_basegame = Cvar_Get ("fs_basegame", "id1", CVAR_ROM, NULL,
"game to use by default");
}
/*
COM_SkipPath
*/
const char *
COM_SkipPath (const char *pathname)
{
@ -1105,9 +1078,6 @@ COM_SkipPath (const char *pathname)
return last;
}
/*
COM_StripExtension
*/
void
COM_StripExtension (const char *in, char *out)
{
@ -1116,9 +1086,6 @@ COM_StripExtension (const char *in, char *out)
*out = 0;
}
/*
COM_FileExtension
*/
char *
COM_FileExtension (char *in)
{
@ -1136,19 +1103,13 @@ COM_FileExtension (char *in)
return exten;
}
/*
COM_DefaultExtension
*/
void
COM_DefaultExtension (char *path, char *extension)
{
char *src;
//
// if path doesn't have a .EXT, append extension
// (extension should include the .)
//
src = path + strlen (path) - 1;
while (*src != '/' && src != path) {
@ -1160,9 +1121,6 @@ COM_DefaultExtension (char *path, char *extension)
strncat (path, extension, MAX_OSPATH - strlen (path));
}
/*
COM_NextFileName
*/
int
COM_NextFilename (char *filename, const char *prefix, const char *ext)
{

View file

@ -53,12 +53,12 @@
# define _POSIX_
#endif
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <limits.h>
#include "QF/vfs.h"
#include "QF/vfile.h"
#include "QF/vfs.h"
#ifdef WIN32
# ifndef __BORLANDC__
@ -91,8 +91,7 @@ Qexpand_squiggle (const char *path, char *dest)
#ifdef _WIN32
// LordHavoc: first check HOME to duplicate previous version behavior
// (also handy if someone wants it somewhere other than their
// windows directory)
// (also handy if someone wants it elsewhere than their windows directory)
home = getenv ("HOME");
if (!home || !home[0])
home = getenv ("WINDIR");
@ -105,8 +104,8 @@ Qexpand_squiggle (const char *path, char *dest)
if (home) {
strcpy (dest, home);
strncat (dest, path + 1, MAX_OSPATH - strlen (dest)); // skip
// leading ~
strncat (dest, path + 1, MAX_OSPATH - strlen (dest));
// skip leading ~
} else
strcpy (dest, path);
}
@ -372,11 +371,9 @@ Qeof (VFile *file)
}
/*
Qgetline
Dynamic length version of Qgets. DO NOT free the buffer.
*/
const char *
Qgetline (VFile *file)

View file

@ -28,12 +28,6 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <errno.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#ifdef HAVE_STRING_H
# include <string.h>
#endif
@ -56,10 +50,18 @@
# include <sys/mman.h>
#endif
#include "compat.h"
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include "QF/cvar.h"
#include "QF/sys.h"
#include "compat.h"
static void Sys_StdPrintf (const char *fmt, va_list args);
cvar_t *sys_nostdout;
@ -104,6 +106,7 @@ const char sys_char_map[256] = {
#define MAXPRINTMSG 4096
void
Sys_mkdir (const char *path)
{
@ -156,9 +159,6 @@ Sys_SetPrintf (sys_printf_t func)
sys_printf_function = func;
}
/*
Sys_Printf
*/
static void
Sys_StdPrintf (const char *fmt, va_list args)
{
@ -187,9 +187,6 @@ Sys_Printf (const char *fmt, ...)
va_end (args);
}
/*
Sys_DoubleTime
*/
double
Sys_DoubleTime (void)
{

View file

@ -28,11 +28,14 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include "QF/sys.h"
#include "compat.h"
#include "QF/sys.h"
void
QFutil_Sys_Error (const char *error, ...)

View file

@ -55,7 +55,6 @@ fgetLittleShort (VFile *f)
return (short) (b1 + b2 * 256);
}
/*
static int
fgetLittleLong (VFile *f)
@ -71,7 +70,6 @@ fgetLittleLong (VFile *f)
}
*/
byte *
LoadTGA (VFile *fin)
{
@ -102,8 +100,8 @@ LoadTGA (VFile *fin)
if (targa_header.colormap_type != 0
|| (targa_header.pixel_size != 32 && targa_header.pixel_size != 24))
Sys_Error
("Texture_LoadTGA: Only 32 or 24 bit images supported (no colormaps)\n");
Sys_Error ("Texture_LoadTGA: Only 32 or 24 bit images supported "
"(no colormaps)\n");
columns = targa_header.width;
rows = targa_header.height;
@ -227,7 +225,6 @@ LoadTGA (VFile *fin)
return targa_rgba;
}
void
WriteTGAfile (const char *tganame, byte *data, int width, int height)
{

View file

@ -30,13 +30,15 @@
# include "config.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include "compat.h"
#include "QF/qtypes.h"
#include "QF/va.h"
#include "compat.h"
/*
va

View file

@ -31,8 +31,9 @@
# include "config.h"
#endif
#include <stdlib.h>
#include <ctype.h>
#include <stdlib.h>
/*
ver_compare

View file

@ -77,7 +77,6 @@ W_CleanupName (const char *in, char *out)
out[i] = 0;
}
void
W_LoadWadFile (const char *filename)
{
@ -89,12 +88,13 @@ W_LoadWadFile (const char *filename)
wad_base = COM_LoadHunkFile (filename);
if (!wad_base)
{
Sys_Printf (
"\n The following error is somewhat misleading. Most likely you don't\n"
" have a file by that name on your system because it's stored in a pak\n"
" file. The real problem is that it's not where we expect it to be.\n\n"
" Game data should be installed into fs_sharepath or fs_userpath, in a\n"
" subdirectory named %s.\n\n", fs_basegame->string);
Sys_Printf ("\n The following error is somewhat misleading. Most "
"likely you don't\n have a file by that name on your "
"system because it's stored in a pak\n file. The real "
"problem is that it's not where we expect it to be.\n\n"
" Game data should be installed into fs_sharepath or "
"fs_userpath, in a\n subdirectory named %s.\n\n",
fs_basegame->string);
Sys_Printf (" fs_sharepath is %s\n", fs_sharepath->string);
Sys_Printf (" fs_userpath is %s\n\n", fs_userpath->string);
Sys_Error ("W_LoadWadFile: unable to load %s\n\n", filename);
@ -121,7 +121,6 @@ W_LoadWadFile (const char *filename)
}
}
lumpinfo_t *
W_GetLumpinfo (const char *name)
{
@ -140,7 +139,6 @@ W_GetLumpinfo (const char *name)
return NULL;
}
void *
W_GetLumpName (const char *name)
{
@ -151,7 +149,6 @@ W_GetLumpName (const char *name)
return (void *) (wad_base + lump->filepos);
}
void *
W_GetLumpNum (int num)
{
@ -165,12 +162,10 @@ W_GetLumpNum (int num)
return (void *) (wad_base + lump->filepos);
}
/*
automatic byte swapping
*/
void
SwapPic (qpic_t *pic)
{

View file

@ -53,7 +53,6 @@
void Cache_FreeLow (int new_low_hunk);
void Cache_FreeHigh (int new_high_hunk);
/*
The zone calls are pretty much only used for small strings and structures,
all big things are allocated on the hunk.
@ -79,6 +78,7 @@ int hunk_tempmark;
void R_FreeTextures (void);
/*
Hunk_Check
@ -127,9 +127,7 @@ Hunk_Print (qboolean all)
Con_Printf ("-------------------------\n");
while (1) {
//
// skip to the high hunk if done with low hunk
//
if (h == endlow) {
Con_Printf ("-------------------------\n");
Con_Printf (" :%8i REMAINING\n",
@ -137,15 +135,11 @@ Hunk_Print (qboolean all)
Con_Printf ("-------------------------\n");
h = starthigh;
}
//
// if totally done, break
//
if (h == endhigh)
break;
//
// run consistancy checks
//
if (h->sentinal != HUNK_SENTINAL)
Sys_Error ("Hunk_Check: trahsed sentinal");
if (h->size < 16 || h->size + (byte *) h - hunk_base > hunk_size)
@ -156,16 +150,12 @@ Hunk_Print (qboolean all)
totalblocks++;
sum += h->size;
//
// print the single block
//
memcpy (name, h->name, 8);
if (all)
Con_Printf ("%8p :%8i %8s\n", h, h->size, name);
//
// print the total
//
if (next == endlow || next == endhigh ||
strncmp (h->name, next->name, 8)) {
if (!all)
@ -182,9 +172,6 @@ Hunk_Print (qboolean all)
}
/*
Hunk_AllocName
*/
void *
Hunk_AllocName (int size, const char *name)
{
@ -203,11 +190,13 @@ Hunk_AllocName (int size, const char *name)
// Sys_Error ("Hunk_Alloc: failed on %i bytes",size);
#ifdef _WIN32
Sys_Error
("Not enough RAM allocated. Try starting using \"-heapsize 16000\" on the %s command line.",
("Not enough RAM allocated. Try starting using "
"\"-heapsize 16000\" on the %s command line.",
PROGRAM);
#else
Sys_Error
("Not enough RAM allocated. Try starting using \"-mem 16\" on the %s command line.",
("Not enough RAM allocated. Try starting using \"-mem 16\" on "
"the %s command line.",
PROGRAM);
#endif
@ -225,9 +214,6 @@ Hunk_AllocName (int size, const char *name)
return (void *) (h + 1);
}
/*
Hunk_Alloc
*/
void *
Hunk_Alloc (int size)
{
@ -273,10 +259,6 @@ Hunk_FreeToHighMark (int mark)
hunk_high_used = mark;
}
/*
Hunk_HighAllocName
*/
void *
Hunk_HighAllocName (int size, const char *name)
{
@ -312,7 +294,6 @@ Hunk_HighAllocName (int size, const char *name)
return (void *) (h + 1);
}
/*
Hunk_TempAlloc
@ -355,9 +336,6 @@ cache_system_t *Cache_TryAlloc (int size, qboolean nobottom);
cache_system_t cache_head;
/*
Cache_Move
*/
void
Cache_Move (cache_system_t * c)
{
@ -479,6 +457,7 @@ Cache_TryAlloc (int size, qboolean nobottom)
Cache_MakeLRU (new);
return new;
}
// search from the bottom up for space
new = (cache_system_t *) (hunk_base + hunk_low_used);
@ -536,10 +515,6 @@ Cache_Flush (void)
Cache_Free (cache_head.next->user); // reclaim the space
}
/*
Cache_Print
*/
void
Cache_Print (void)
{
@ -550,9 +525,6 @@ Cache_Print (void)
}
}
/*
Cache_Report
*/
void
Cache_Report (void)
{
@ -561,17 +533,11 @@ Cache_Report (void)
hunk_low_used) / (float) (1024 * 1024));
}
/*
Cache_Compact
*/
void
Cache_Compact (void)
{
}
/*
Cache_Init
*/
void
Cache_Init (void)
{
@ -605,11 +571,6 @@ Cache_Free (cache_user_t *c)
Cache_UnlinkLRU (cs);
}
/*
Cache_Check
*/
void *
Cache_Check (cache_user_t *c)
{
@ -627,10 +588,6 @@ Cache_Check (cache_user_t *c)
return c->data;
}
/*
Cache_Alloc
*/
void *
Cache_Alloc (cache_user_t *c, int size, const char *name)
{
@ -665,10 +622,6 @@ Cache_Alloc (cache_user_t *c, int size, const char *name)
//============================================================================
/*
Memory_Init
*/
void
Memory_Init (void *buf, int size)
{