Skip to content

Commit

Permalink
Added a public API for the Con module
Browse files Browse the repository at this point in the history
Only includes Con_Message at this stage.
  • Loading branch information
skyjake committed Jan 2, 2013
1 parent 2b359bf commit 00eac25
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 7 deletions.
13 changes: 7 additions & 6 deletions doomsday/engine/api/api_base.h
Expand Up @@ -26,12 +26,13 @@
/// All APIs exported from the executable.
enum {
DE_API_BASE_v1 = 0, // 1.10
DE_API_DEFINITIONS_v1 = 100, // 1.10
DE_API_DIRECT_DATA_ACCESS_v1 = 200, // 1.10
DE_API_FILE_SYSTEM_v1 = 300, // 1.10
DE_API_PLUGIN_v1 = 400, // 1.10
DE_API_URI_v1 = 500, // 1.10
DE_API_WAD_v1 = 600 // 1.10
DE_API_CONSOLE_v1 = 100, // 1.10
DE_API_DEFINITIONS_v1 = 200, // 1.10
DE_API_DIRECT_DATA_ACCESS_v1 = 300, // 1.10
DE_API_FILE_SYSTEM_v1 = 400, // 1.10
DE_API_PLUGIN_v1 = 500, // 1.10
DE_API_URI_v1 = 600, // 1.10
DE_API_WAD_v1 = 700 // 1.10
};

/**
Expand Down
22 changes: 22 additions & 0 deletions doomsday/engine/api/api_console.h
@@ -0,0 +1,22 @@
#ifndef DOOMSDAY_API_CONSOLE_H
#define DOOMSDAY_API_CONSOLE_H

#include "api_base.h"

DENG_API_TYPEDEF(Con)
{
de_api_t api;

void (*Message)(char const* message, ...);
}
DENG_API_T(Con);

#ifndef DENG_NO_API_MACROS_CONSOLE
#define Con_Message _api_Con.Message
#endif

#ifdef __DOOMSDAY__
DENG_USING_API(Con);
#endif

#endif // DOOMSDAY_API_CONSOLE_H
2 changes: 1 addition & 1 deletion doomsday/engine/api/doomsday.h
Expand Up @@ -87,6 +87,7 @@ struct font_s;
#include "api_plugin.h"
#include "api_def.h"
#include "api_filesys.h"
#include "api_console.h"

#include "filehandle.h"
#include <de/memoryzone.h>
Expand Down Expand Up @@ -245,7 +246,6 @@ void Con_SetUri(char const* name, Uri const* uri);
void Con_Printf(char const* format, ...) PRINTF_F(1,2);
void Con_FPrintf(int flags, char const* format, ...) PRINTF_F(2,3);
void Con_PrintRuler(void);
void Con_Message(char const* message, ...) PRINTF_F(1,2);
void Con_Error(char const* error, ...) PRINTF_F(1,2);

void Con_SetPrintFilter(con_textfilter_t filter);
Expand Down
1 change: 1 addition & 0 deletions doomsday/engine/engine.pro
Expand Up @@ -77,6 +77,7 @@ else {

DENG_API_HEADERS = \
api/api_base.h \
api/api_console.h \
api/api_def.h \
api/api_filesys.h \
api/api_plugin.h \
Expand Down
2 changes: 2 additions & 0 deletions doomsday/engine/include/de_console.h
Expand Up @@ -35,4 +35,6 @@
#include "ui/b_main.h"
#include "ui/b_context.h"

#include "api_console.h"

#endif /* LIBDENG_CONSOLE */
9 changes: 9 additions & 0 deletions doomsday/engine/src/con_main.c
Expand Up @@ -2002,6 +2002,8 @@ void Con_PrintPathList(const char* pathList)
Con_PrintPathList2(pathList, ';');
}

#undef Con_Message

void Con_Message(const char *message, ...)
{
va_list argptr;
Expand Down Expand Up @@ -2666,3 +2668,10 @@ D_CMD(DebugError)
Con_Error("Fatal error.\n");
return true;
}

DENG_DECLARE_API(Con) =
{
{ DE_API_CONSOLE_v1 },

Con_Message
};
2 changes: 2 additions & 0 deletions doomsday/plugins/dehread/include/dehread.h
Expand Up @@ -56,6 +56,8 @@ const int NUMSTATES = 968;
extern ded_sprid_t origSpriteNames[NUMSPRITES];
extern ded_funcid_t origActionNames[NUMSTATES];

DENG_USING_API(Base);
DENG_USING_API(Con);
DENG_USING_API(Def);
DENG_USING_API(F);
DENG_USING_API(Plug);
Expand Down
4 changes: 4 additions & 0 deletions doomsday/plugins/dehread/src/dehread.cpp
Expand Up @@ -181,13 +181,17 @@ extern "C" const char* deng_LibraryType(void)
return "deng-plugin/generic";
}

DENG_DECLARE_API(Base);
DENG_DECLARE_API(Con);
DENG_DECLARE_API(Def);
DENG_DECLARE_API(F);
DENG_DECLARE_API(Plug);
DENG_DECLARE_API(W);
DENG_DECLARE_API(Uri);

DENG_API_EXCHANGE(
DENG_GET_API(DE_API_BASE_v1, Base);
DENG_GET_API(DE_API_CONSOLE_v1, Con);
DENG_GET_API(DE_API_DEFINITIONS_v1, Def);
DENG_GET_API(DE_API_FILE_SYSTEM_v1, F);
DENG_GET_API(DE_API_PLUGIN_v1, Plug);
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/wadmapconverter/include/wadmapconverter.h
Expand Up @@ -31,6 +31,7 @@

extern Id1Map* DENG_PLUGIN_GLOBAL(map);

DENG_USING_API(Base);
DENG_USING_API(Plug);
DENG_USING_API(Uri);
DENG_USING_API(W);
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/wadmapconverter/src/wadmapconverter.cpp
Expand Up @@ -284,11 +284,13 @@ extern "C" const char* deng_LibraryType(void)
return "deng-plugin/generic";
}

DENG_DECLARE_API(Base);
DENG_DECLARE_API(Plug);
DENG_DECLARE_API(Uri);
DENG_DECLARE_API(W);

DENG_API_EXCHANGE(
DENG_GET_API(DE_API_BASE_v1, Base);
DENG_GET_API(DE_API_PLUGIN_v1, Plug);
DENG_GET_API(DE_API_URI_v1, Uri);
DENG_GET_API(DE_API_WAD_v1, W);
Expand Down
1 change: 1 addition & 0 deletions doomsday/server/server.pro
Expand Up @@ -71,6 +71,7 @@ SRC = ../engine

DENG_API_HEADERS = \
$$SRC/api/api_base.h \
$$SRC/api/api_console.h \
$$SRC/api/api_def.h \
$$SRC/api/api_filesys.h \
$$SRC/api/api_plugin.h \
Expand Down

0 comments on commit 00eac25

Please sign in to comment.