diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2012-08-30 16:16:25 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2012-08-30 17:03:31 -0700 |
commit | 41974ae5265fbc23a06f276f9e008d5dad020e0b (patch) | |
tree | 9d595215172e87e2d83b74f7bf3430b3040e780e /src/common | |
parent | 21742909143df9159b2401c3e2a39cc0b2bad620 (diff) | |
download | tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.tar.gz tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.tar.bz2 tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.tar.xz tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.zip |
Rename files for C++ conversion. Does not compile.
After updating, you can remove these files, as shown in 'git status':
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/map/magic-interpreter-lexer.c
src/map/magic-interpreter-parser.c
src/map/magic-interpreter-parser.h
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/core.cpp (renamed from src/common/core.c) | 12 | ||||
-rw-r--r-- | src/common/core.hpp (renamed from src/common/core.h) | 6 | ||||
-rw-r--r-- | src/common/db.cpp (renamed from src/common/db.c) | 4 | ||||
-rw-r--r-- | src/common/db.hpp (renamed from src/common/db.h) | 6 | ||||
-rw-r--r-- | src/common/grfio.cpp (renamed from src/common/grfio.c) | 8 | ||||
-rw-r--r-- | src/common/grfio.hpp (renamed from src/common/grfio.h) | 6 | ||||
-rw-r--r-- | src/common/lock.cpp (renamed from src/common/lock.c) | 4 | ||||
-rw-r--r-- | src/common/lock.hpp (renamed from src/common/lock.h) | 6 | ||||
-rw-r--r-- | src/common/md5calc.cpp (renamed from src/common/md5calc.c) | 4 | ||||
-rw-r--r-- | src/common/md5calc.hpp (renamed from src/common/md5calc.h) | 6 | ||||
-rw-r--r-- | src/common/mmo.hpp (renamed from src/common/mmo.h) | 8 | ||||
-rw-r--r-- | src/common/mt_rand.cpp (renamed from src/common/mt_rand.c) | 2 | ||||
-rw-r--r-- | src/common/mt_rand.hpp (renamed from src/common/mt_rand.h) | 8 | ||||
-rw-r--r-- | src/common/nullpo.cpp (renamed from src/common/nullpo.c) | 2 | ||||
-rw-r--r-- | src/common/nullpo.hpp (renamed from src/common/nullpo.h) | 8 | ||||
-rw-r--r-- | src/common/sanity.hpp (renamed from src/common/sanity.h) | 21 | ||||
-rw-r--r-- | src/common/socket.cpp (renamed from src/common/socket.c) | 6 | ||||
-rw-r--r-- | src/common/socket.hpp (renamed from src/common/socket.h) | 8 | ||||
-rw-r--r-- | src/common/timer.cpp (renamed from src/common/timer.c) | 4 | ||||
-rw-r--r-- | src/common/timer.hpp (renamed from src/common/timer.h) | 8 | ||||
-rw-r--r-- | src/common/utils.hpp (renamed from src/common/utils.h) | 6 | ||||
-rw-r--r-- | src/common/version.hpp (renamed from src/common/version.h) | 6 |
22 files changed, 72 insertions, 77 deletions
diff --git a/src/common/core.c b/src/common/core.cpp index b08276c..38b2260 100644 --- a/src/common/core.c +++ b/src/common/core.cpp @@ -4,12 +4,12 @@ #include <signal.h> #include <sys/wait.h> -#include "core.h" -#include "socket.h" -#include "timer.h" -#include "version.h" -#include "mt_rand.h" -#include "nullpo.h" +#include "core.hpp" +#include "socket.hpp" +#include "timer.hpp" +#include "version.hpp" +#include "mt_rand.hpp" +#include "nullpo.hpp" /// Defined by each server extern int do_init (int, char **); diff --git a/src/common/core.h b/src/common/core.hpp index 44473e9..8a52c55 100644 --- a/src/common/core.h +++ b/src/common/core.hpp @@ -1,5 +1,5 @@ -#ifndef CORE_H -#define CORE_H +#ifndef CORE_HPP +#define CORE_HPP #include <stdbool.h> /// core.c contains a server-independent main() function /// and then runs a do_sendrecv loop @@ -16,4 +16,4 @@ extern int do_init (int, char **); /// or when if we manage to exit() gracefully. extern void term_func (void); -#endif // CORE_H +#endif // CORE_HPP diff --git a/src/common/db.c b/src/common/db.cpp index f56a511..21a3597 100644 --- a/src/common/db.c +++ b/src/common/db.cpp @@ -1,10 +1,10 @@ -#include "db.h" +#include "db.hpp" #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "utils.h" +#include "utils.hpp" #define ROOT_SIZE 4096 diff --git a/src/common/db.h b/src/common/db.hpp index 7152854..145ba13 100644 --- a/src/common/db.h +++ b/src/common/db.hpp @@ -1,7 +1,7 @@ // WARNING: there is a system header by this name -#ifndef DB_H -#define DB_H -# include "sanity.h" +#ifndef DB_HPP +#define DB_HPP +# include "sanity.hpp" # include <stdarg.h> diff --git a/src/common/grfio.c b/src/common/grfio.cpp index d640263..1b89b18 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.cpp @@ -4,10 +4,10 @@ #include <string.h> #include <sys/stat.h> -#include "utils.h" -#include "grfio.h" -#include "mmo.h" -#include "socket.h" +#include "utils.hpp" +#include "grfio.hpp" +#include "mmo.hpp" +#include "socket.hpp" //---------------------------- // file entry table struct diff --git a/src/common/grfio.h b/src/common/grfio.hpp index 4919a7b..3485904 100644 --- a/src/common/grfio.h +++ b/src/common/grfio.hpp @@ -2,8 +2,8 @@ // Note .gat files are mapped to .wlk files by data/resnametable.txt // Note that there currently is a 1-1 correlation between them, // but it is possible for a single .wlk to have multiple .gats reference it -#ifndef GRFIO_H -#define GRFIO_H +#ifndef GRFIO_HPP +#define GRFIO_HPP /// Load file into memory # define grfio_read(resourcename) grfio_reads (resourcename, NULL) @@ -14,4 +14,4 @@ void *grfio_reads (const char *resourcename, size_t *size); // This is only called once, and that is to check the existence of a file. size_t grfio_size (const char *resourcename) __attribute__((deprecated)); -#endif // GRFIO_H +#endif // GRFIO_HPP diff --git a/src/common/lock.c b/src/common/lock.cpp index dd42ef2..2ba9a0a 100644 --- a/src/common/lock.c +++ b/src/common/lock.cpp @@ -1,7 +1,7 @@ #include <unistd.h> #include <stdio.h> -#include "lock.h" -#include "socket.h" +#include "lock.hpp" +#include "socket.hpp" /// Protected file writing /// (Until the file is closed, it keeps the old file) diff --git a/src/common/lock.h b/src/common/lock.hpp index 2f087fd..19c1302 100644 --- a/src/common/lock.h +++ b/src/common/lock.hpp @@ -1,8 +1,8 @@ -#ifndef LOCK_H -#define LOCK_H +#ifndef LOCK_HPP +#define LOCK_HPP /// Locked FILE I/O // Changes are made in a separate file until lock_fclose FILE *lock_fopen (const char *filename, int *info); void lock_fclose (FILE * fp, const char *filename, int *info); -#endif // LOCK_H +#endif // LOCK_HPP diff --git a/src/common/md5calc.c b/src/common/md5calc.cpp index ba8f6af..f00861d 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.cpp @@ -1,6 +1,6 @@ -#include "md5calc.h" +#include "md5calc.hpp" #include <string.h> -#include "mt_rand.h" +#include "mt_rand.hpp" // auxilary data /* diff --git a/src/common/md5calc.h b/src/common/md5calc.hpp index b864791..1dde2ed 100644 --- a/src/common/md5calc.h +++ b/src/common/md5calc.hpp @@ -1,7 +1,7 @@ -#ifndef MD5CALC_H -#define MD5CALC_H +#ifndef MD5CALC_HPP +#define MD5CALC_HPP -#include "sanity.h" +#include "sanity.hpp" #include <netinet/in.h> diff --git a/src/common/mmo.h b/src/common/mmo.hpp index 64e0523..2ca93b0 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.hpp @@ -1,9 +1,9 @@ /// Global structures and defines -#ifndef MMO_H -#define MMO_H +#ifndef MMO_HPP +#define MMO_HPP # include <time.h> -# include "utils.h" // LCCWIN32 +# include "utils.hpp" // LCCWIN32 # define FIFOSIZE_SERVERLINK 256*1024 @@ -280,4 +280,4 @@ enum }; -#endif // MMO_H +#endif // MMO_HPP diff --git a/src/common/mt_rand.c b/src/common/mt_rand.cpp index e4e8d12..89872ad 100644 --- a/src/common/mt_rand.c +++ b/src/common/mt_rand.cpp @@ -46,7 +46,7 @@ */ #include <time.h> -#include "mt_rand.h" +#include "mt_rand.hpp" #define N 624 // length of state vector #define M 397 // a period parameter diff --git a/src/common/mt_rand.h b/src/common/mt_rand.hpp index 84d32e5..c7bae4e 100644 --- a/src/common/mt_rand.h +++ b/src/common/mt_rand.hpp @@ -1,7 +1,7 @@ -#ifndef MT_RAND_H -#define MT_RAND_H +#ifndef MT_RAND_HPP +#define MT_RAND_HPP -# include "sanity.h" +# include "sanity.hpp" /// Initialize the generator (called automatically with time() if you don't) void mt_seed (uint32_t seed); @@ -21,4 +21,4 @@ uint32_t mt_random (void); # define MRAND(mod) ((int)(mt_random() % (mod))) # define MPRAND(add, mod) ((add) + MRAND(mod)) -#endif // MT_RAND_H +#endif // MT_RAND_HPP diff --git a/src/common/nullpo.c b/src/common/nullpo.cpp index 8c7c405..6dd2736 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.cpp @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdarg.h> #include <string.h> -#include "nullpo.h" +#include "nullpo.hpp" static void nullpo_info_core (const char *file, int line, const char *func, const char *fmt, va_list ap); diff --git a/src/common/nullpo.h b/src/common/nullpo.hpp index 9b33b4b..7aff691 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.hpp @@ -1,6 +1,6 @@ /// return wrappers for unexpected NULL pointers -#ifndef NULLPO_H -#define NULLPO_H +#ifndef NULLPO_HPP +#define NULLPO_HPP /// Comment this out to live dangerously # define NULLPO_CHECK @@ -39,7 +39,7 @@ # define nullpo_retr_f(ret, t, fmt, ...) t; # endif // NULLPO_CHECK -# include "sanity.h" +# include "sanity.hpp" /// Used by macros in this header bool nullpo_chk (const char *file, int line, const char *func, @@ -58,4 +58,4 @@ void nullpo_info_f (const char *file, int line, const char *func, const char *fmt, ...) __attribute__ ((format (printf, 4, 5))); -#endif // NULLPO_H +#endif // NULLPO_HPP diff --git a/src/common/sanity.h b/src/common/sanity.hpp index 168671f..7ffd077 100644 --- a/src/common/sanity.h +++ b/src/common/sanity.hpp @@ -1,8 +1,8 @@ /// return wrappers for unexpected NULL pointers -#ifndef SANITY_H -#define SANITY_H -# if __STDC_VERSION__ < 199901L -# error "Please compile in C99 mode" +#ifndef SANITY_HPP +#define SANITY_HPP +# ifndef __cplusplus +# error "Please compile in C++ mode" # endif # if __GNUC__ < 3 // I don't specifically know what version this requires, @@ -22,15 +22,10 @@ # endif /// A name for unused function arguments - can be repeated -# define UNUSED UNUSED_IMPL(__COUNTER__) -// Don't you just love the hoops the preprocessor makes you go through? -# define UNUSED_IMPL(arg) UNUSED_IMPL2(arg) -# define UNUSED_IMPL2(suffix) unused_ ## suffix __attribute__((unused)) -/// Convert conditions to use the bool type -# include <stdbool.h> +# define UNUSED /* empty works for C++ */ /// Convert type assumptions to use the standard types here -# include <stdint.h> +# include <cstdint> /// size_t, NULL -# include <stddef.h> +# include <cstddef> -#endif // SANITY_H +#endif // SANITY_HPP diff --git a/src/common/socket.c b/src/common/socket.cpp index 67a5102..cc6e4b3 100644 --- a/src/common/socket.c +++ b/src/common/socket.cpp @@ -15,9 +15,9 @@ #include <fcntl.h> #include <string.h> -#include "mmo.h" // [Valaris] thanks to fov -#include "socket.h" -#include "utils.h" +#include "mmo.hpp" // [Valaris] thanks to fov +#include "socket.hpp" +#include "utils.hpp" fd_set readfds; int fd_max; diff --git a/src/common/socket.h b/src/common/socket.hpp index b886df0..00f2df0 100644 --- a/src/common/socket.h +++ b/src/common/socket.hpp @@ -1,7 +1,7 @@ -#ifndef SOCKET_H -#define SOCKET_H +#ifndef SOCKET_HPP +#define SOCKET_HPP -# include "sanity.h" +# include "sanity.hpp" # include <stdio.h> @@ -132,4 +132,4 @@ void fclose_ (FILE * fp); FILE *fopen_ (const char *path, const char *mode); bool free_fds (void); -#endif // SOCKET_H +#endif // SOCKET_HPP diff --git a/src/common/timer.c b/src/common/timer.cpp index 6795824..66aaa9b 100644 --- a/src/common/timer.c +++ b/src/common/timer.cpp @@ -6,8 +6,8 @@ #include <sys/socket.h> #include <sys/time.h> -#include "timer.h" -#include "utils.h" +#include "timer.hpp" +#include "utils.hpp" static struct TimerData *timer_data; static uint32_t timer_data_max, timer_data_num; diff --git a/src/common/timer.h b/src/common/timer.hpp index e6a292c..fdda344 100644 --- a/src/common/timer.h +++ b/src/common/timer.hpp @@ -1,7 +1,7 @@ -#ifndef TIMER_H -#define TIMER_H +#ifndef TIMER_HPP +#define TIMER_HPP -# include "sanity.h" +# include "sanity.hpp" enum TIMER_TYPE { @@ -58,4 +58,4 @@ interval_t do_timer (tick_t tick); -#endif // TIMER_H +#endif // TIMER_HPP diff --git a/src/common/utils.h b/src/common/utils.hpp index 961d960..7c7da16 100644 --- a/src/common/utils.h +++ b/src/common/utils.hpp @@ -1,5 +1,5 @@ -#ifndef UTILS_H -#define UTILS_H +#ifndef UTILS_HPP +#define UTILS_HPP /* Notes about memory allocation in tmwAthena: There used to be 3 sources of allocation: these macros, @@ -15,4 +15,4 @@ future calls should either use this or depend on the coming segfault. if (!((result) = (type *) realloc ((result), sizeof(type) * (number))))\ { perror("SYSERR: realloc failure"); abort(); } else (void)0 -#endif //UTILS_H +#endif //UTILS_HPP diff --git a/src/common/version.h b/src/common/version.hpp index 46165aa..d72f41e 100644 --- a/src/common/version.h +++ b/src/common/version.hpp @@ -1,8 +1,8 @@ /// Some constants to identify the version of (e)Athena /// The values are different if the client connects (-1,'T','M','W',flags32) // These numbers have never been changed while TMW -#ifndef VERSION_H -#define VERSION_H +#ifndef VERSION_HPP +#define VERSION_HPP //When a server receives a 0x7530 packet from an admin connection, //it sends an 0x7531 packet with the following bytes # define ATHENA_MAJOR_VERSION 1 // Major Version @@ -21,4 +21,4 @@ // and this as two bytes # define ATHENA_MOD_VERSION 1052 // mod version (patch No.) -#endif // VERSION_H +#endif // VERSION_HPP |