added "fixed some header guards and added a script to fix them all!" by Choupom

This commit is contained in:
oy 2011-04-13 20:22:10 +02:00
parent aeec62266b
commit e6f0318bdf
11 changed files with 56 additions and 21 deletions

View file

@ -0,0 +1,35 @@
import os
PATH = "../src/"
def check_file(filename):
file = open(filename)
while 1:
line = file.readline()
if len(line) == 0:
break
if line[0] == "/" or line[0] == "*" or line[0] == "\r" or line[0] == "\n" or line[0] == "\t":
continue
if line[:7] == "#ifndef":
hg = "#ifndef " + ("_".join(filename.split(PATH)[1].split("/"))[:-2]).upper() + "_H"
if line[:-1] != hg:
print "Wrong header guard in " + filename
else:
print "Missing header guard in " + filename
break
file.close()
def check_dir(dir):
list = os.listdir(dir)
for file in list:
if os.path.isdir(dir+file):
if file != "external" and file != "generated":
check_dir(dir+file+"/")
elif file[-2:] == ".h" and file != "keynames.h":
check_file(dir+file)
check_dir(PATH)

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef BASELIB_FILE_CONFIG_H #ifndef BASE_DETECT_H
#define BASELIB_FILE_CONFIG_H #define BASE_DETECT_H
/* /*
this file detected the family, platform and architecture this file detected the family, platform and architecture

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_ALGORITHM_HPP #ifndef BASE_TL_ALGORITHM_H
#define TL_FILE_ALGORITHM_HPP #define BASE_TL_ALGORITHM_H
#include "range.h" #include "range.h"

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_ALLOCATOR_HPP #ifndef BASE_TL_ALLOCATOR_H
#define TL_FILE_ALLOCATOR_HPP #define BASE_TL_ALLOCATOR_H
template <class T> template <class T>
class allocator_default class allocator_default

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_ARRAY_HPP #ifndef BASE_TL_ARRAY_H
#define TL_FILE_ARRAY_HPP #define BASE_TL_ARRAY_H
#include "range.h" #include "range.h"
#include "allocator.h" #include "allocator.h"

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_BASE_HPP #ifndef BASE_TL_BASE_H
#define TL_FILE_BASE_HPP #define BASE_TL_BASE_H
#include <base/system.h> #include <base/system.h>

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_RANGE_HPP #ifndef BASE_TL_RANGE_H
#define TL_FILE_RANGE_HPP #define BASE_TL_RANGE_H
#include "base.h" #include "base.h"

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_SORTED_ARRAY_HPP #ifndef BASE_TL_SORTED_ARRAY_H
#define TL_FILE_SORTED_ARRAY_HPP #define BASE_TL_SORTED_ARRAY_H
#include "algorithm.h" #include "algorithm.h"
#include "array.h" #include "array.h"

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef TL_FILE_STRING_HPP #ifndef BASE_TL_STRING_H
#define TL_FILE_STRING_HPP #define BASE_TL_STRING_H
#include "base.h" #include "base.h"
#include "allocator.h" #include "allocator.h"

View file

@ -1,7 +1,7 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef ENGINE_SHARED_E_CONFIG_H #ifndef ENGINE_SHARED_CONFIG_H
#define ENGINE_SHARED_E_CONFIG_H #define ENGINE_SHARED_CONFIG_H
struct CConfiguration struct CConfiguration
{ {

View file

@ -1,8 +1,8 @@
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef ENGINE_SHARED_E_CONFIG_VARIABLES_H #ifndef ENGINE_SHARED_CONFIG_VARIABLES_H
#define ENGINE_SHARED_E_CONFIG_VARIABLES_H #define ENGINE_SHARED_CONFIG_VARIABLES_H
#undef ENGINE_SHARED_E_CONFIG_VARIABLES_H // this file will be included several times #undef ENGINE_SHARED_CONFIG_VARIABLES_H // this file will be included several times
// TODO: remove this // TODO: remove this
#include "././game/variables.h" #include "././game/variables.h"