From 9eb2fb05e4baa7a3d0cb6118d453e2810e82d04f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 17 Dec 2023 22:14:52 +0100 Subject: [PATCH] Updated the copyright headers and clang-format scripts. --- misc/scripts/clang_format.sh | 2 +- misc/scripts/copyright_headers.py | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh index 1bd041870..5720304e5 100755 --- a/misc/scripts/clang_format.sh +++ b/misc/scripts/clang_format.sh @@ -34,7 +34,7 @@ while IFS= read -rd '' f; do elif [[ "$f" == "platform/android/java/lib/src/org/pandemoniumengine/pandemonium/utils/ProcessPhoenix"* ]]; then continue 2 fi - #python misc/scripts/copyright_headers.py "$f" + python misc/scripts/copyright_headers.py "$f" continue 2 fi done diff --git a/misc/scripts/copyright_headers.py b/misc/scripts/copyright_headers.py index ddc491cbb..70c6f7792 100755 --- a/misc/scripts/copyright_headers.py +++ b/misc/scripts/copyright_headers.py @@ -7,12 +7,13 @@ header = """\ /*************************************************************************/ /* $filename */ /*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ +/* This file is part of: */ +/* PANDEMONIUM ENGINE */ +/* https://github.com/Relintai/pandemonium_engine */ /*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2022-present Péter Magyar. */ /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -66,11 +67,20 @@ text += "\n" # then we can append the rest (step 2). fileread = open(fname.strip(), "r") -line = fileread.readline() +line = fileread.readline().strip() header_done = False -while line.strip() == "": # Skip empty lines at the top +orig_lines = "" + +while line == "" or line.startswith("#ifndef") or line.startswith("#define"): # Skip empty lines at the top, and include guards + if line != "": + orig_lines += line + "\n" + line = fileread.readline() + line = line.strip() + +if orig_lines != "": + text = orig_lines + "\n" + text if line.find("/**********") == -1: # Pandemonium header starts this way # Maybe starting with a non-Pandemonium comment, abort header magic