Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/skyjake/Doomsday-Engine
Browse files Browse the repository at this point in the history
Conflicts:
	doomsday/engine/include/map/p_particle.h
  • Loading branch information
skyjake committed Nov 20, 2012
2 parents f812c48 + 080bb66 commit 4d5f28c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
8 changes: 8 additions & 0 deletions doomsday/engine/include/map/p_maptypes.h
Expand Up @@ -5,6 +5,10 @@

#include "p_mapdata.h"

#ifdef __cplusplus
extern "C" {
#endif

#define LO_prev link[0]
#define LO_next link[1]

Expand Down Expand Up @@ -482,4 +486,8 @@ typedef struct bspnode_s {
uint index; /// Unique. Set when saving the BSP.
} BspNode;

#ifdef __cplusplus
} // extern "C"
#endif

#endif
24 changes: 13 additions & 11 deletions doomsday/engine/scripts/makedmt.py
Expand Up @@ -51,37 +51,38 @@ def println(f, line, comment=''):
internal_file.write("#ifndef __DOOMSDAY_PLAY_MAP_DATA_TYPES_H__\n")
internal_file.write("#define __DOOMSDAY_PLAY_MAP_DATA_TYPES_H__\n\n")
internal_file.write("#include \"p_mapdata.h\"\n\n")
internal_file.write("#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n")

# Begin writing to the public header.
public_file.write("#ifndef __DOOMSDAY_PLAY_PUBLIC_MAP_DATA_TYPES_H__\n")
public_file.write("#define __DOOMSDAY_PLAY_PUBLIC_MAP_DATA_TYPES_H__\n\n")

for input_line in sys.stdin.readlines():
line = input_line.strip()

if verbatim:
if line == 'end':
println(verbatim, "")
verbatim = None
else:
println(verbatim, input_line.rstrip())
continue

# Skip empty lines and comments.
if len(line) == 0 or line[0] == '#':
continue

# If there is a comment on the line, get rid of it.
comment_stripped = line
line_comment = ''
if '//' in comment_stripped:
index = comment_stripped.index('//')
line_comment = comment_stripped[index:]
comment_stripped = comment_stripped[:index]

tokens = comment_stripped.split()
count = len(tokens)

if current is None:
if count == 1:
if tokens[0] == 'internal':
Expand All @@ -103,7 +104,7 @@ def println(f, line, comment=''):
if count == 3:
# Use "-" to omit the DDVT type declaration (internal usage only).
if tokens[0] != '-':
println(public_file,
println(public_file,
"#define DMT_%s_%s DDVT_%s" % (publicName.upper(),
tokens[2].upper(),
tokens[0].upper()), line_comment)
Expand All @@ -114,18 +115,18 @@ def println(f, line, comment=''):
pos = c_type.index('[')
indexed = c_type[pos:]
c_type = c_type[:pos]

# Translate the type into a real C type.
if '_s' in c_type:
c_type = 'struct ' + c_type
for symbol, real in type_replacements.items():
c_type = c_type.replace(symbol, real)

# Add some visual padding to align the members.
padding = 24 - len(c_type) - 4
if padding < 1: padding = 1
println(internal_file, " %s%s%s%s;" % (c_type, ' '*padding, tokens[2], indexed),

println(internal_file, " %s%s%s%s;" % (c_type, ' '*padding, tokens[2], indexed),
line_comment)
elif count == 1:
if tokens[0] == 'end':
Expand All @@ -136,7 +137,8 @@ def println(f, line, comment=''):
error(input_line, 'syntax error')
else:
error(input_line, "unknown definition in struct %s" % current)

# End the header files.
internal_file.write("#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n")
internal_file.write("#endif\n")
public_file.write("#endif\n")

0 comments on commit 4d5f28c

Please sign in to comment.