;;; basis-utils.el --- miscellaneous utilities ;; Copyright (C) 1999-2001 Basis Technology, Corp. ;; Author: Tom Emerson ;; Created: Sometime in Fall '99 ;; Keywords: basis utilities source code ;; Modified by Simon L. Nielsen to include my copyright stuff ;; $Id: simon-basis-utils.el,v 1.7 2004/08/22 22:53:04 simon Exp $ ;;; Commentary: ;; This package contains a random collection of functions I've written ;; to automate some of the repetitive editing tasks when writing new ;; code. A side benefit is that they implicitly enforce our coding ;; conventions. ;;; Change Log (most recent first) ;; ;; 2001-04-05 tree Fixed bogosity in bt-insert-local-vars and ;; basis-insert-include-file-guards-in-region (the ;; latter thanks to Mike Wilson ;; 2000-08-29 tree Added bt_create_new_source_file functionality. ;; 2000-07-09 tree Created. ;;; Code: (defconst bt-include-directive-regexp "^[ \t]*#include[ \t]+[<\"]\\([a-zA-Z0-9_.]+\.h\\)[>\"][ \t]*$" "Regular expression used to detect #include directives") (defconst bt-file-suffix-regexp "\\.\\([a-zA-Z0-9]+\\)$" "Regular expression used to detect and extract the suffix of a file name") ; FIXME: this should really get the comment character from the current ; mode so that it can be used for other languages too. (defun simon-insert-std-copyright-c () "Insert the standard Simon L. Nielsen copyright notice at the current point." (interactive "*") (insert (format (concat "/*\n" " * Copyright (c) %s, Simon L. Nielsen \n" " * All rights reserved.\n" " *\n" " * Redistribution and use in source and binary forms, with or without\n" " * modification, are permitted provided that the following conditions\n" " * are met:\n" " * 1. Redistributions of source code must retain the above copyright\n" " * notice, this list of conditions and the following disclaimer.\n" " * 2. Redistributions in binary form must reproduce the above copyright\n" " * notice, this list of conditions and the following disclaimer in the\n" " * documentation and/or other materials provided with the distribution.\n" " *\n" " * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" " * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" " * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" " * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" " * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" " * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" " * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" " * SUCH DAMAGE.\n" " *\n" " */\n" "\n") (format-time-string "%Y") ) )) (defun simon-insert-std-copyright-sh () "Insert the standard Babeltech copyright notice at the current point. SH/Perl style." (interactive "*") (insert (format (concat "#\n" "# Copyright (c) %s Simon L. Nielsen \n" "# All rights reserved.\n" "#\n" "# Redistribution and use in source and binary forms, with or without\n" "# modification, are permitted provided that the following conditions\n" "# are met:\n" "# 1. Redistributions of source code must retain the above copyright\n" "# notice, this list of conditions and the following disclaimer.\n" "# 2. Redistributions in binary form must reproduce the above copyright\n" "# notice, this list of conditions and the following disclaimer in the\n" "# documentation and/or other materials provided with the distribution.\n" "#\n" "# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" "# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" "# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" "# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" "# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" "# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" "# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" "# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "# SUCH DAMAGE.\n" "\n") (format-time-string "%Y") ) ) ) (defun simon-insert-std-copyright-man () "Insert the standard BSD copyright notice at the current point. man style." (interactive "*") (insert (format (concat ".\\\"\n" ".\\\" Copyright (c) %s Simon L. Nielsen \n" ".\\\" All rights reserved.\n" ".\\\"\n" ".\\\" Redistribution and use in source and binary forms, with or without\n" ".\\\" modification, are permitted provided that the following conditions\n" ".\\\" are met:\n" ".\\\" 1. Redistributions of source code must retain the above copyright\n" ".\\\" notice, this list of conditions and the following disclaimer.\n" ".\\\" 2. Redistributions in binary form must reproduce the above copyright\n" ".\\\" notice, this list of conditions and the following disclaimer in the\n" ".\\\" documentation and/or other materials provided with the distribution.\n" ".\\\"\n" ".\\\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" ".\\\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" ".\\\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" ".\\\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" ".\\\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" ".\\\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" ".\\\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" ".\\\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" ".\\\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" ".\\\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" ".\\\" SUCH DAMAGE.\n" ".\\\"\n" ".\\\" $Id: simon-basis-utils.el,v 1.7 2004/08/22 22:53:04 simon Exp $\n" ".\\\"\n" "\n") (format-time-string "%Y") ) ) ) (defun simon-insert-std-copyright-sgml () "Insert the standard Simon L. Nielsen copyright notice at the current point." (interactive "*") (insert (format (concat "\n" "\n") (format-time-string "%Y") ) )) (provide 'simon-basis-utils) ;;; basis-utils.el ends here