Skip to content

Commit

Permalink
Refactor: Moved ddstring, Writer, Reader to libdeng1
Browse files Browse the repository at this point in the history
This sizable commit moves the Str, Reader and Writer classes
from the engine to libdeng1. "Str" was added as the new
preferred alias for struct ddstring_s, as it is consistent
with the prefix naming convention.

In other words, instead of "ddstring_t*", one should
henceforth use "Str*".

The dd_string.h header was renamed to "de/str.h".

libdeng2: C wrappers were added for the little-endian
byte order conversion functions for various values as
the engine's SHORT(), LONG(), etc. byte order macros are
not available (and shouldn't be) in libdeng1.

The constructors of Reader and Writer that access the
network data buffer were left behind in the engine.

Win32: Obsolete exports were removed from doomsday.def.
  • Loading branch information
skyjake committed Jul 24, 2012
1 parent 184d3f0 commit c5228d2
Show file tree
Hide file tree
Showing 47 changed files with 661 additions and 542 deletions.
2 changes: 0 additions & 2 deletions doomsday/engine/api/dd_share.h
Expand Up @@ -98,8 +98,6 @@ char* strlwr(char *string);
#endif

int dd_snprintf(char* str, size_t size, const char* format, ...);
int dd_vsnprintf(char* str, size_t size, const char* format,
va_list ap);

// Format checking for printf-like functions in GCC2
#if defined(__GNUC__) && __GNUC__ >= 2
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_types.h
Expand Up @@ -120,7 +120,7 @@ struct plane_s;
struct surface_s;
struct material_s;

#include "dd_string.h"
#include "de/ddstring.h"
#include "uri.h"

#endif /* ENGINE_TYPES_H */
160 changes: 80 additions & 80 deletions doomsday/engine/api/doomsday.def
Expand Up @@ -239,49 +239,49 @@ EXPORTS
Point3f_Equality @804 NONAME

; String.
Str_New @461 NONAME
Str_FromAutoStr @844 NONAME
Str_Init @462 NONAME
Str_InitStd @848 NONAME
Str_InitStatic @756 NONAME
Str_Free @463 NONAME
Str_Delete @464 NONAME
Str_Clear @465 NONAME
Str_Reserve @466 NONAME
Str_Set @467 NONAME
Str_Append @468 NONAME
Str_AppendChar @469 NONAME
Str_Appendf @470 NONAME
Str_PartAppend @471 NONAME
Str_Prepend @472 NONAME
Str_Length @473 NONAME
Str_IsEmpty @474 NONAME
Str_Text @475 NONAME
Str_Copy @476 NONAME
Str_CopyOrClear @843 NONAME
Str_StripLeft @477 NONAME
Str_StripLeft2 @761 NONAME
Str_StripRight @478 NONAME
Str_StripRight2 @762 NONAME
Str_Strip @479 NONAME
Str_Strip2 @763 NONAME
Str_GetLine @480 NONAME
Str_CopyDelim2 @481 NONAME
Str_CopyDelim @482 NONAME
Str_CompareIgnoreCase @483 NONAME
Str_At @484 NONAME
Str_RAt @485 NONAME
Str_Truncate @498 NONAME
Str_PrependChar @336 NONAME
Str_PercentEncode @757 NONAME
Str_PercentEncode2 @758 NONAME
Str_PercentDecode @759 NONAME
Str_Write @739 NONAME
Str_Read @740 NONAME

AutoStr_New @845 NONAME
AutoStr_NewStd @846 NONAME
AutoStr_FromStr @847 NONAME
; Str_New @461 NONAME
; Str_FromAutoStr @844 NONAME
; Str_Init @462 NONAME
; Str_InitStd @848 NONAME
; Str_InitStatic @756 NONAME
; Str_Free @463 NONAME
; Str_Delete @464 NONAME
; Str_Clear @465 NONAME
; Str_Reserve @466 NONAME
; Str_Set @467 NONAME
; Str_Append @468 NONAME
; Str_AppendChar @469 NONAME
; Str_Appendf @470 NONAME
; Str_PartAppend @471 NONAME
; Str_Prepend @472 NONAME
; Str_Length @473 NONAME
; Str_IsEmpty @474 NONAME
; Str_Text @475 NONAME
; Str_Copy @476 NONAME
; Str_CopyOrClear @843 NONAME
; Str_StripLeft @477 NONAME
; Str_StripLeft2 @761 NONAME
; Str_StripRight @478 NONAME
; Str_StripRight2 @762 NONAME
; Str_Strip @479 NONAME
; Str_Strip2 @763 NONAME
; Str_GetLine @480 NONAME
; Str_CopyDelim2 @481 NONAME
; Str_CopyDelim @482 NONAME
; Str_CompareIgnoreCase @483 NONAME
; Str_At @484 NONAME
; Str_RAt @485 NONAME
; Str_Truncate @498 NONAME
; Str_PrependChar @336 NONAME
; Str_PercentEncode @757 NONAME
; Str_PercentEncode2 @758 NONAME
; Str_PercentDecode @759 NONAME
; Str_Write @739 NONAME
; Str_Read @740 NONAME
;
; AutoStr_New @845 NONAME
; AutoStr_NewStd @846 NONAME
; AutoStr_FromStr @847 NONAME

; StringPool.
StringPool_New @537 NONAME
Expand Down Expand Up @@ -376,7 +376,7 @@ EXPORTS

; Base: Misc.
dd_snprintf @447 NONAME
dd_vsnprintf @448 NONAME
; dd_vsnprintf @448 NONAME

; Base: BusyMode.
BusyMode_Active @126 NONAME
Expand Down Expand Up @@ -957,44 +957,44 @@ EXPORTS
DED_DelArray @195 NONAME

; Reader.
Reader_NewWithBuffer @547 NONAME
Reader_NewWithCallbacks @743 NONAME
Reader_Delete @548 NONAME
Reader_ReadChar @549 NONAME
Reader_ReadByte @550 NONAME
Reader_ReadInt16 @551 NONAME
Reader_ReadUInt16 @552 NONAME
Reader_ReadInt32 @553 NONAME
Reader_ReadUInt32 @554 NONAME
Reader_ReadFloat @555 NONAME
Reader_ReadPackedUInt16 @556 NONAME
Reader_ReadPackedUInt32 @557 NONAME
Reader_Read @558 NONAME
Reader_AtEnd @559 NONAME
Reader_Pos @560 NONAME
Reader_SetPos @561 NONAME
Reader_Size @562 NONAME
; Reader_NewWithBuffer @547 NONAME
; Reader_NewWithCallbacks @743 NONAME
; Reader_Delete @548 NONAME
; Reader_ReadChar @549 NONAME
; Reader_ReadByte @550 NONAME
; Reader_ReadInt16 @551 NONAME
; Reader_ReadUInt16 @552 NONAME
; Reader_ReadInt32 @553 NONAME
; Reader_ReadUInt32 @554 NONAME
; Reader_ReadFloat @555 NONAME
; Reader_ReadPackedUInt16 @556 NONAME
; Reader_ReadPackedUInt32 @557 NONAME
; Reader_Read @558 NONAME
; Reader_AtEnd @559 NONAME
; Reader_Pos @560 NONAME
; Reader_SetPos @561 NONAME
; Reader_Size @562 NONAME

; Writer.
Writer_NewWithBuffer @563 NONAME
Writer_NewWithDynamicBuffer @564 NONAME
Writer_NewWithCallbacks @742 NONAME
Writer_Delete @565 NONAME
Writer_Size @566 NONAME
Writer_Data @567 NONAME
Writer_TotalBufferSize @568 NONAME
Writer_BytesLeft @569 NONAME
Writer_SetPos @570 NONAME
Writer_WriteChar @571 NONAME
Writer_WriteByte @572 NONAME
Writer_WriteInt16 @573 NONAME
Writer_WriteUInt16 @574 NONAME
Writer_WriteInt32 @575 NONAME
Writer_WriteUInt32 @576 NONAME
Writer_WriteFloat @577 NONAME
Writer_WritePackedUInt16 @578 NONAME
Writer_WritePackedUInt32 @579 NONAME
Writer_Write @580 NONAME
; Writer_NewWithBuffer @563 NONAME
; Writer_NewWithDynamicBuffer @564 NONAME
; Writer_NewWithCallbacks @742 NONAME
; Writer_Delete @565 NONAME
; Writer_Size @566 NONAME
; Writer_Data @567 NONAME
; Writer_TotalBufferSize @568 NONAME
; Writer_BytesLeft @569 NONAME
; Writer_SetPos @570 NONAME
; Writer_WriteChar @571 NONAME
; Writer_WriteByte @572 NONAME
; Writer_WriteInt16 @573 NONAME
; Writer_WriteUInt16 @574 NONAME
; Writer_WriteInt32 @575 NONAME
; Writer_WriteUInt32 @576 NONAME
; Writer_WriteFloat @577 NONAME
; Writer_WritePackedUInt16 @578 NONAME
; Writer_WritePackedUInt32 @579 NONAME
; Writer_Write @580 NONAME

; Smoother.
; Smoother_IsOnFloor @581 NONAME
Expand Down
22 changes: 20 additions & 2 deletions doomsday/engine/api/doomsday.h
Expand Up @@ -82,11 +82,11 @@ struct font_s;
#include "dd_plugin.h"
#include "dfile.h"
#include "point.h"
#include "reader.h"
#include "rect.h"
#include "size.h"
#include "stringpool.h"
#include "writer.h"
#include <de/reader.h>
#include <de/writer.h>
#include <de/memoryzone.h>
#include <de/smoother.h>

Expand Down Expand Up @@ -337,6 +337,24 @@ boolean MPE_End(void);
/// @addtogroup network
///@{

/**
* Constructs a new reader. The reader will use the engine's netBuffer
* as the reading buffer. The reader has to be destroyed with Reader_Delete()
* after it is not needed any more.
*
* @todo Rename to Reader_NewWithNetworkBuffer().
*/
Reader* Reader_New(void);

/**
* Constructs a new writer. The writer will use the engine's netBuffer
* as the writing buffer. The writer has to be destroyed with Writer_Delete()
* after it is not needed any more.
*
* @todo Rename to Writer_NewWithNetworkBuffer().
*/
Writer* Writer_New(void);

/**
* Send a packet over the network.
*
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/api/materialarchive.h
Expand Up @@ -25,8 +25,8 @@
#ifndef LIBDENG_MATERIALARCHIVE_H
#define LIBDENG_MATERIALARCHIVE_H

#include "writer.h"
#include "reader.h"
#include <de/writer.h>
#include <de/reader.h>

#ifdef __cplusplus
extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/api/uri.h
Expand Up @@ -34,9 +34,9 @@
extern "C" {
#endif

#include "dd_string.h"
#include "reader.h"
#include "writer.h"
#include <de/str.h>
#include <de/reader.h>
#include <de/writer.h>

struct uri_s; // The uri instance (opaque).

Expand Down
14 changes: 1 addition & 13 deletions doomsday/engine/engine.pro
Expand Up @@ -71,12 +71,6 @@ else {
}
}

# Build Configuration --------------------------------------------------------

deng_writertypecheck {
DEFINES += DENG_WRITER_TYPECHECK
}

# Linking --------------------------------------------------------------------

win32 {
Expand Down Expand Up @@ -109,7 +103,6 @@ DENG_API_HEADERS = \
api/dd_maptypes.h \
api/dd_plugin.h \
api/dd_share.h \
api/dd_string.h \
api/dd_types.h \
api/dd_ui.h \
api/dd_vectorgraphic.h \
Expand All @@ -121,16 +114,14 @@ DENG_API_HEADERS = \
api/doomsday.h \
api/materialarchive.h \
api/point.h \
api/reader.h \
api/rect.h \
api/size.h \
api/stringpool.h \
api/sys_audiod.h \
api/sys_audiod_mus.h \
api/sys_audiod_sfx.h \
api/thinker.h \
api/uri.h \
api/writer.h
api/uri.h

# Convenience headers.
DENG_HEADERS += \
Expand Down Expand Up @@ -540,7 +531,6 @@ SOURCES += \
portable/src/m_mus2midi.c \
portable/src/m_nodepile.c \
portable/src/m_stack.c \
portable/src/m_string.c \
portable/src/m_vector.c \
portable/src/masterserver.cpp \
portable/src/material.c \
Expand Down Expand Up @@ -588,7 +578,6 @@ SOURCES += \
portable/src/r_things.c \
portable/src/r_util.c \
portable/src/r_world.c \
portable/src/reader.c \
portable/src/rect.c \
portable/src/render/busyvisual.c \
portable/src/render/rend_bias.c \
Expand Down Expand Up @@ -655,7 +644,6 @@ SOURCES += \
portable/src/vertex.cpp \
portable/src/wadfile.c \
portable/src/window.cpp \
portable/src/writer.c \
portable/src/zipfile.c \
portable/src/zonedebug.c

Expand Down
1 change: 0 additions & 1 deletion doomsday/engine/portable/include/abstractresource.h
Expand Up @@ -24,7 +24,6 @@
#ifndef LIBDENG_ABSTRACTRESOURCE_H
#define LIBDENG_ABSTRACTRESOURCE_H

#include "dd_string.h"
#include "uri.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/audiodriver.h
Expand Up @@ -23,7 +23,7 @@
#ifndef LIBDENG_AUDIO_DRIVER_H
#define LIBDENG_AUDIO_DRIVER_H

#include "dd_string.h"
#include <de/str.h>
#include "sys_audiod.h"
#include "sys_audiod_sfx.h"
#include "sys_audiod_mus.h"
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/audiodriver_music.h
Expand Up @@ -29,7 +29,7 @@
#ifndef LIBDENG_AUDIODRIVER_MUSIC_H
#define LIBDENG_AUDIODRIVER_MUSIC_H

#include "dd_string.h"
#include <de/str.h>
#include "audiodriver.h"

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/cl_infine.h
Expand Up @@ -28,7 +28,7 @@
#ifndef LIBDENG_CLIENT_INFINE
#define LIBDENG_CLIENT_INFINE

#include "reader.h"
#include <de/reader.h>

finaleid_t Cl_CurrentFinale(void);

Expand Down
1 change: 0 additions & 1 deletion doomsday/engine/portable/include/dam_file.h
Expand Up @@ -29,7 +29,6 @@
#define LIBDENG_ARCHIVED_MAP_FILE_H

#include "de_play.h"
#include "dd_string.h"

/**
* Check if a map in the archive is up to date. The source data must not be
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/dd_input.h
Expand Up @@ -32,8 +32,8 @@
#define NUMKKEYS 256

#include <de/smoother.h>
#include <de/ddstring.h>

#include "dd_string.h"
#if _DEBUG
# include "point.h" // For the debug visual.
#endif
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/include/de_base.h
Expand Up @@ -37,6 +37,8 @@
#include <de/memory.h>
#include <de/memoryzone.h>
#include <de/garbage.h>
#include <de/reader.h>
#include <de/writer.h>
#include <de/c_wrapper.h>

#include "dd_def.h"
Expand All @@ -50,8 +52,6 @@
#include "library.h"
#include "nativeui.h"
#include "busymode.h"
#include "reader.h"
#include "writer.h"
#include "zonedebug.h"

#endif /* LIBDENG_BASE_H */

0 comments on commit c5228d2

Please sign in to comment.