Replaced custom varargs handing by portable stdarg.h stuff.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@92 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2002-09-27 22:38:20 +00:00
parent 6f5dab6d17
commit 84e3266576
25 changed files with 32 additions and 85 deletions
-4
View File
@@ -574,10 +574,6 @@ SOURCE=..\sc2code\libs\timelib.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\libs\vargs.h
# End Source File
# Begin Source File
SOURCE=..\sc2code\libs\vidlib.h
# End Source File
# End Group
-1
View File
@@ -20,7 +20,6 @@
#define _CODERES_H
#include "reslib.h"
#include "vargs.h"
extern MEM_HANDLE LoadCodeResFile (PSTR pStr);
extern BOOLEAN InstallCodeResType (COUNT code_type);
+1 -1
View File
@@ -515,7 +515,7 @@ Intro (void)
construct_response (shared_phrase_buf,
i_am_captain0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
i_am_captain1,
GLOBAL_SIS (ShipName),
i_am_captain2,
+3 -3
View File
@@ -127,7 +127,7 @@ ByeBye (RESPONSE_REF R)
construct_response (shared_phrase_buf,
name_40,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
name_41,
0);
@@ -524,7 +524,7 @@ RevealSelf (RESPONSE_REF R)
{
construct_response (shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_vindicator1,
GLOBAL_SIS (ShipName),
we_are_vindicator2,
@@ -630,7 +630,7 @@ Intro (void)
construct_response (
shared_phrase_buf,
no_but_well_help0,
(vararg_dcl)GLOBAL_SIS (ShipName),
GLOBAL_SIS (ShipName),
no_but_well_help1,
0
);
+1 -1
View File
@@ -1398,7 +1398,7 @@ yack0_respond (void)
construct_response (
shared_phrase_buf,
we_are_from_alliance0,
(vararg_dcl)buf,
buf,
(RESPONSE_REF)-1
);
DoResponsePhrase (we_are_from_alliance0, DoFirstMeeting, shared_phrase_buf);
+1 -1
View File
@@ -521,7 +521,7 @@ OrzNeutral (RESPONSE_REF R)
{
construct_response (shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_vindicator1,
GLOBAL_SIS (ShipName),
we_are_vindicator2,
+2 -2
View File
@@ -294,7 +294,7 @@ DiscussConquer (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
conquer_because_1,
(vararg_dcl)buf,
buf,
(RESPONSE_REF)-1
);
DoResponsePhrase (conquer_because_1, DiscussConquer, shared_phrase_buf);
@@ -607,7 +607,7 @@ PkunkHome (RESPONSE_REF R)
{
construct_response (shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_vindicator1,
GLOBAL_SIS (ShipName),
we_are_vindicator2,
+1 -1
View File
@@ -329,7 +329,7 @@ RealizeMistake (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
i_am_captain0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
i_am_captain1,
buf,
i_am_captain2,
+1 -1
View File
@@ -723,7 +723,7 @@ HomeWorld (RESPONSE_REF R)
case 0:
construct_response (shared_phrase_buf,
we_are_us0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_us1,
GLOBAL_SIS (ShipName),
we_are_us2,
+1 -1
View File
@@ -853,7 +853,7 @@ SpathiPassword (RESPONSE_REF R)
{
construct_response (shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_vindicator1,
GLOBAL_SIS (ShipName),
we_are_vindicator2,
+2 -2
View File
@@ -917,7 +917,7 @@ TellStarBase (RESPONSE_REF R)
construct_response (
buf0,
tell_me_about_modules0,
(vararg_dcl)GLOBAL_SIS (ShipName),
GLOBAL_SIS (ShipName),
tell_me_about_modules1,
0
);
@@ -933,7 +933,7 @@ TellStarBase (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
tell_me_about_fuel0,
(vararg_dcl)GLOBAL_SIS (ShipName),
GLOBAL_SIS (ShipName),
tell_me_about_fuel1,
0
);
+3 -3
View File
@@ -406,7 +406,7 @@ NeutralSupox (RESPONSE_REF R)
case 0:
construct_response (shared_phrase_buf,
i_am0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
i_am1,
0);
pStr[0] = i_am0;
@@ -415,7 +415,7 @@ NeutralSupox (RESPONSE_REF R)
case 1:
construct_response (shared_phrase_buf,
my_ship0,
(vararg_dcl)GLOBAL_SIS (ShipName),
GLOBAL_SIS (ShipName),
my_ship1,
0);
pStr[0] = my_ship0;
@@ -429,7 +429,7 @@ NeutralSupox (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
from_alliance0,
(vararg_dcl)buf,
buf,
from_alliance1,
0
);
+1 -1
View File
@@ -870,7 +870,7 @@ Intro (void)
{
construct_response (shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_vindicator1,
GLOBAL_SIS (ShipName),
we_are_vindicator2,
+1 -1
View File
@@ -491,7 +491,7 @@ CompelPlayer (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (ShipName),
GLOBAL_SIS (ShipName),
we_are_vindicator1,
0
);
+1 -1
View File
@@ -350,7 +350,7 @@ Zombies (RESPONSE_REF R)
{
construct_response (shared_phrase_buf,
we_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_vindicator1,
GLOBAL_SIS (ShipName),
we_vindicator2,
+1 -1
View File
@@ -528,7 +528,7 @@ NeutralUtwig (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
we_are_vindicator1,
buf,
we_are_vindicator2,
+2 -2
View File
@@ -360,7 +360,7 @@ YehatHome (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
i_demand_you_ally_homeworld0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
i_demand_you_ally_homeworld1,
buf,
i_demand_you_ally_homeworld2,
@@ -486,7 +486,7 @@ YehatSpace (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
i_demand_you_ally_space0,
(vararg_dcl)GLOBAL_SIS (CommanderName),
GLOBAL_SIS (CommanderName),
i_demand_you_ally_space1,
GLOBAL_SIS (ShipName),
i_demand_you_ally_space2,
+1 -1
View File
@@ -465,7 +465,7 @@ AquaintZoqFot (RESPONSE_REF R)
construct_response (
shared_phrase_buf,
we_are_vindicator0,
(vararg_dcl)buf,
buf,
we_are_vindicator1,
GLOBAL_SIS (ShipName),
we_are_vindicator2,
+7 -7
View File
@@ -19,6 +19,7 @@
#include "starcon.h"
#include "commglue.h"
#include "libs/sound/trackplayer.h"
#include <stdarg.h>
void
NPCPhrase (int index)
@@ -106,13 +107,12 @@ GetAllianceName (UNICODE *buf, RESPONSE_REF name_1)
}
void
construct_response (UNICODE *buf, RESPONSE_REF R, vararg_dcl c_args,
...)
construct_response (UNICODE *buf, RESPONSE_REF R, ...)
{
UNICODE *name;
vararg_list vlist;
va_list vlist;
vararg_start (vlist, c_args);
va_start (vlist, R);
do
{
COUNT len;
@@ -122,18 +122,18 @@ construct_response (UNICODE *buf, RESPONSE_REF R, vararg_dcl c_args,
wstrcpy (buf, (UNICODE *)GetStringAddress (S));
len = wstrlen (buf);
buf += len;
name = vararg_val (vlist, UNICODE *);
name = va_arg (vlist, UNICODE *);
if (name)
{
len = wstrlen (name);
wstrncpy (buf, name, len);
buf += len;
if ((R = vararg_val (vlist, RESPONSE_REF)) == (RESPONSE_REF)-1)
if ((R = va_arg (vlist, RESPONSE_REF)) == (RESPONSE_REF)-1)
name = 0;
}
} while (name);
vararg_end (vlist);
va_end (vlist);
*buf = '\0';
}
+1 -4
View File
@@ -19,8 +19,6 @@
#ifndef _COMMGLUE_H
#define _COMMGLUE_H
#include "libs/vargs.h"
extern LOCDATA CommData;
extern int cur_comm;
extern UNICODE shared_phrase_buf[256];
@@ -61,8 +59,7 @@ extern void NPCPhrase (int index);
extern void GetAllianceName (UNICODE *buf, RESPONSE_REF name_1);
extern void construct_response (UNICODE *buf, RESPONSE_REF R, vararg_dcl
c_args, ...);
extern void construct_response (UNICODE *buf, RESPONSE_REF R, ...);
extern LOCDATAPTR init_race (RESOURCE comm_id);
+1 -1
View File
@@ -4,7 +4,7 @@ SUBDIRS = decomp graphics input math memory resource sound strings \
noinst_HEADERS = \
compiler.h declib.h gfxlib.h inplib.h mathlib.h \
memlib.h reslib.h sndlib.h strlib.h tasklib.h threadlib.h \
timelib.h vargs.h vidlib.h misc.h
timelib.h vidlib.h misc.h
INCLUDES = @SDL_CFLAGS@ \
-I$(top_srcdir)/src \
-45
View File
@@ -1,45 +0,0 @@
//Copyright Paul Reiche, Fred Ford. 1992-2002
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _VARARGS_H
#define _VARARGS_H
typedef char *vararg_list;
typedef char *vararg_dcl;
#define vararg_start(list,alist) (list) = (vararg_list)&(alist)
#define vararg_end(list)
#define vararg_val(list,type) \
(sizeof (type) >= sizeof (int) ? \
(((type *)((list) += sizeof (type)))[-1]) : \
((type)((int *)((list) += sizeof (int)))[-1]))
#define vararg_farval(list,type) \
(sizeof (type) >= sizeof (int) ? \
(((type *)((list) += sizeof (type)))[-1]) : \
(((int *)((list) += sizeof (int)))[-1]))
#define begin_arg_stack(name) char name[0
#define add_to_arg_stack(type) + (sizeof (type) > sizeof (int) ? \
sizeof (type) : sizeof (int))
#define end_arg_stack ];
#define arg_stack_push(list,type,val) \
(sizeof (type) >= sizeof (int) ? \
(((type *)((list) += sizeof (type)))[-1] = (val)) : \
(((int *)((list) += sizeof (int)))[-1] = (int)(val)))
#endif /* _VARARGS_H */