Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace u_scanner with DECORATE compatible version #2090

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ set(WOOF_SOURCES
m_input.c m_input.h
m_io.c m_io.h
m_json.c m_json.h
m_scanner.c m_scanner.h
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update README.md as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in fb64425

mn_font.c mn_font.h
mn_menu.c mn_menu.h
mn_setup.c mn_internal.h
Expand Down Expand Up @@ -137,7 +138,6 @@ set(WOOF_SOURCES
statdump.c statdump.h
tables.c tables.h
u_mapinfo.c u_mapinfo.h
u_scanner.c u_scanner.h
v_flextran.c v_flextran.h
v_fmt.c v_fmt.h
v_trans.c v_trans.h
Expand Down
4 changes: 2 additions & 2 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,9 @@ static boolean CheckMapLump(const char *lumpname, const char *filename)

static boolean FileContainsMaps(const char *filename)
{
for (int i = 0; i < U_mapinfo.mapcount; ++i)
for (int i = 0; i < array_size(umapinfo); ++i)
{
if (CheckMapLump(U_mapinfo.maps[i].mapname, filename))
if (CheckMapLump(umapinfo[i].mapname, filename))
{
return true;
}
Expand Down
16 changes: 8 additions & 8 deletions src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -3851,21 +3851,21 @@ void G_SetFastParms(int fast_pending)

mapentry_t *G_LookupMapinfo(int episode, int map)
{
int i;
char lumpname[9];

strcpy(lumpname, MapName(episode, map));

for (i = 0; i < U_mapinfo.mapcount; i++)
mapentry_t *entry;

array_foreach(entry, umapinfo)
{
if (!strcasecmp(lumpname, U_mapinfo.maps[i].mapname))
return &U_mapinfo.maps[i];
if (!strcasecmp(lumpname, entry->mapname))
return entry;
}

for (i = 0; i < default_mapinfo.mapcount; i++)
array_foreach(entry, umapdef)
{
if (!strcasecmp(lumpname, default_mapinfo.maps[i].mapname))
return &default_mapinfo.maps[i];
if (!strcasecmp(lumpname, entry->mapname))
return entry;
}

return NULL;
Expand Down
16 changes: 9 additions & 7 deletions src/m_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,34 +72,36 @@ inline static void array_clear(const void *v)
}
}

#define array_grow(v, n) ((v) = M_ArrayGrow((v), sizeof(*(v)), n))
#define array_grow(v, n) ((v) = M_ArrayGrow(v, sizeof(*(v)), n))

#define array_push(v, e) \
do \
{ \
if (!(v)) \
{ \
(v) = M_ArrayGrow((v), sizeof(*(v)), M_ARRAY_INIT_CAPACITY); \
(v) = M_ArrayGrow(v, sizeof(*(v)), M_ARRAY_INIT_CAPACITY); \
} \
else if (array_ptr((v))->size == array_ptr((v))->capacity) \
else if (array_ptr(v)->size == array_ptr(v)->capacity) \
{ \
(v) = M_ArrayGrow((v), sizeof(*(v)), array_ptr((v))->capacity); \
(v) = M_ArrayGrow(v, sizeof(*(v)), array_ptr(v)->capacity); \
} \
(v)[array_ptr((v))->size++] = (e); \
(v)[array_ptr(v)->size++] = (e); \
} while (0)

#define array_free(v) \
do \
{ \
if (v) \
{ \
M_ARRAY_FREE(array_ptr((v))); \
M_ARRAY_FREE(array_ptr(v)); \
(v) = NULL; \
} \
} while (0)

#define array_end(v) ((v) + array_size(v))

#define array_foreach(ptr, v) \
for (ptr = (v); ptr != &(v)[array_size((v))]; ++ptr)
for (ptr = (v); ptr < array_end(v); ++ptr)

inline static void *M_ArrayGrow(void *v, size_t esize, int n)
{
Expand Down
12 changes: 7 additions & 5 deletions src/m_cheat.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "g_game.h"
#include "info.h"
#include "m_cheat.h"
#include "m_array.h"
#include "m_fixed.h"
#include "m_input.h"
#include "m_misc.h"
Expand Down Expand Up @@ -876,7 +877,7 @@ static void cheat_spechits()
plyr->cards[i] = origcards[i];
}

if (gamemapinfo && gamemapinfo->numbossactions > 0)
if (gamemapinfo && array_size(gamemapinfo->bossactions))
{
thinker_t *th;

Expand All @@ -886,13 +887,14 @@ static void cheat_spechits()
{
mobj_t *mo = (mobj_t *) th;

for (i = 0; i < gamemapinfo->numbossactions; i++)
bossaction_t *bossaction;
array_foreach(bossaction, gamemapinfo->bossactions)
{
if (gamemapinfo->bossactions[i].type == mo->type)
if (bossaction->type == mo->type)
{
dummy = *lines;
dummy.special = (short)gamemapinfo->bossactions[i].special;
dummy.tag = (short)gamemapinfo->bossactions[i].tag;
dummy.special = (short)bossaction->special;
dummy.tag = (short)bossaction->tag;
// use special semantics for line activation to block problem types.
if (!P_UseSpecialLine(mo, &dummy, 0, true))
P_CrossSpecialLine(&dummy, 0, mo, true);
Expand Down
42 changes: 24 additions & 18 deletions src/m_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,39 +235,45 @@ const char *M_BaseName(const char *path)

char M_ToUpper(const char c)
{
if (c >= 'a' && c <= 'z')
return c + 'A' - 'a';
else
return c;
if (c >= 'a' && c <= 'z')
{
return c + 'A' - 'a';
}
else
{
return c;
}
}

void M_StringToUpper(char *text)
void M_StringToUpper(char *str)
{
char *p;

for (p = text; *p != '\0'; ++p)
while (*str)
{
*p = M_ToUpper(*p);
*str = M_ToUpper(*str);
++str;
}
}

// Change string to lowercase.

char M_ToLower(const char c)
{
if (c >= 'A' && c <= 'Z')
return c - 'A' + 'a';
else
return c;
if (c >= 'A' && c <= 'Z')
{
return c - 'A' + 'a';
}
else
{
return c;
}
}

void M_StringToLower(char *text)
void M_StringToLower(char *str)
{
char *p;

for (p = text; *p != '\0'; ++p)
while (*str)
{
*p = M_ToLower(*p);
*str = M_ToLower(*str);
++str;
}
}

Expand Down
Loading