From 013af2ac4b5f9a0804864b90fa57e5108f98c469 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Sun, 4 Mar 2018 20:28:09 -0700 Subject: [PATCH] dtool: Delete 'newheader' This is a task better handled by editors/scripts. [skip ci] --- dtool/src/newheader/newheader.cxx | 108 ------------------------------ 1 file changed, 108 deletions(-) delete mode 100644 dtool/src/newheader/newheader.cxx diff --git a/dtool/src/newheader/newheader.cxx b/dtool/src/newheader/newheader.cxx deleted file mode 100644 index 2e97dbb031..0000000000 --- a/dtool/src/newheader/newheader.cxx +++ /dev/null @@ -1,108 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file newheader.cxx - * @author drose - * @date 2004-07-05 - */ - -#include "dtoolbase.h" - -#include -#include -#include - -const char *cxx_style = -"// Filename: %s\n" -"// Created by: %s (%s)\n" -"//\n" -"////////////////////////////////////////////////////////////////////\n" -"//\n" -"// PANDA 3D SOFTWARE\n" -"// Copyright (c) Carnegie Mellon University. All rights reserved.\n" -"//\n" -"// All use of this software is subject to the terms of the revised BSD\n" -"// license. You should have received a copy of this license along\n" -"// with this source code in a file named \"LICENSE.\"\n" -"//\n" -"////////////////////////////////////////////////////////////////////\n" -"\n"; - -const char *c_style = -"/* Filename: %s\n" -" * Created by: %s (%s)\n" -" *\n" -" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n" -" *\n" -" * PANDA 3D SOFTWARE\n" -" * Copyright (c) Carnegie Mellon University. All rights reserved.\n" -" *\n" -" * All use of this software is subject to the terms of the revised BSD\n" -" * license. You should have received a copy of this license along\n" -" * with this source code in a file named \"LICENSE.\"\n" -" *\n" -" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n" -"\n"; - -struct FileDef { - const char *extension; - const char *header; -}; - -FileDef file_def[] = { - { "h", cxx_style }, - { "cxx", cxx_style }, - { "I", cxx_style }, - { "T", cxx_style }, - { "c", c_style }, - { NULL, NULL }, -}; - -void -generate_header(const char *header, const string &filename) { - const char *username = getenv("USER"); - if (username == NULL) { - username = ""; - } - - static const size_t max_date_buffer = 128; - char date_buffer[max_date_buffer]; - time_t now = time(NULL); - strftime(date_buffer, max_date_buffer, "%d%b%y", localtime(&now)); - - printf(header, filename.c_str(), username, date_buffer); -} - -int -main(int argc, char *argv[]) { - if (argc < 2) { - cerr << "Must specify the filename to generate a header for.\n"; - exit(1); - } - - string filename = argv[1]; - size_t dot = filename.rfind('.'); - if (dot == string::npos) { - // No extension, no header. - return 0; - } - - string extension = filename.substr(dot + 1); - - size_t i = 0; - while (file_def[i].extension != NULL) { - if (extension == file_def[i].extension) { - generate_header(file_def[i].header, filename); - return 0; - } - i++; - } - - // No matching extension, no problem. - return 0; -}