annotate src/TemplateBatchScript.cpp @ 768:f3631db17328

Updated all date occurrences to the year 2011. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1045 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Thu, 21 Apr 2011 15:17:51 +0000
parents aae5a8d04f70
children fa7aa6f543f1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
1 /***************************************************************************
768
f3631db17328 Updated all date occurrences to the year 2011.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents: 727
diff changeset
2 * Copyright (C) 2006-2011 by Thomas Schweitzer *
638
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
3 * thomas-schweitzer(at)arcor.de *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
4 * *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
6 * it under the terms of the GNU General Public License version 2.0 as *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
7 * published by the Free Software Foundation. *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
8 * *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful, *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
12 * GNU General Public License for more details. *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
13 * *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
15 * along with this program in the file LICENSE.GPL; if not, write to the *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
16 * Free Software Foundation, Inc., *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
18 ***************************************************************************/
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
19
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
20 #include "TemplateBatchScript.h"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
21
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
22 // Need to include QObject here so that platform specific defines like Q_OS_WIN32 are set.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
23 #include <QObject>
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
24
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
25 /*!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
26 \brief The only and static function of this class returns a batch or shell script
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
27 as string that can be used to call an indenter with the current settings from
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
28 the command line.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
29
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
30 The returned string contains some placeholders where the indenter name needs to
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
31 be filled in. The placeholders are "__INDENTERCALLSTRING1__" that should be replaced
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
32 by the indenter call string that indents a complete directory.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
33 "__INDENTERCALLSTRING2__" the call string for indenting only one file.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
34 And "__INDENTERCALLSTRINGSCRIPTNAME__" which is only the shown name of the indenter.
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
35 */
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
36 const char* TemplateBatchScript::getTemplateBatchScript() {
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
37 static const char* templateBatchScript =
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
38 #if defined(Q_OS_WIN32)
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
39 "@echo off\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
40 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
41 "IF (%1)==() GOTO error\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
42 "dir /b /ad %1 >nul 2>nul && GOTO indentDir\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
43 "IF NOT EXIST %1 GOTO error\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
44 "goto indentFile\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
45 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
46 ":indentDir\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
47 "set searchdir=%1\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
48 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
49 "IF (%2)==() GOTO assignDefaultSuffix\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
50 "set filesuffix=%2\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
51 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
52 "GOTO run\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
53 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
54 ":assignDefaultSuffix\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
55 "::echo !!!!DEFAULT SUFFIX!!!\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
56 "set filesuffix=*\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
57 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
58 ":run\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
59 "FOR /F \"tokens=*\" %%G IN ('DIR /B /S %searchdir%\\*.%filesuffix%') DO (\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
60 "echo Indenting file \"%%G\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
61 "__INDENTERCALLSTRING1__\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
62 ")\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
63 "GOTO ende\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
64 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
65 ":indentFile\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
66 "echo Indenting one file %1\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
67 "__INDENTERCALLSTRING2__\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
68 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
69 "GOTO ende\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
70 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
71 ":error\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
72 "echo .\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
73 "echo ERROR: As parameter given directory or file does not exist!\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
74 "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
75 "echo Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
76 "echo Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
77 "echo .\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
78 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
79 ":ende\n";
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
80
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
81 #else
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
82
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
83 "#!/bin/sh \n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
84 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
85 "if [ ! -n \"$1\" ]; then\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
86 "echo \"Syntax is: recurse.sh dirname filesuffix\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
87 "echo \"Syntax is: recurse.sh filename\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
88 "echo \"Example: recurse.sh temp cpp\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
89 "exit 1\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
90 "fi\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
91 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
92 "if [ -d \"$1\" ]; then\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
93 "#echo \"Dir ${1} exists\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
94 "if [ -n \"$2\" ]; then\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
95 "filesuffix=$2\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
96 "else\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
97 "filesuffix=\"*\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
98 "fi\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
99 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
100 "#echo \"Filtering files using suffix ${filesuffix}\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
101 "\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
102 "file_list=`find ${1} -name \"*.${filesuffix}\" -type f`\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
103 "for file2indent in $file_list\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
104 "do \n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
105 "echo \"Indenting file $file2indent\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
106 "__INDENTERCALLSTRING1__\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
107 "done\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
108 "else\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
109 "if [ -f \"$1\" ]; then\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
110 "echo \"Indenting one file $1\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
111 "__INDENTERCALLSTRING2__\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
112 "else\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
113 "echo \"ERROR: As parameter given directory or file does not exist!\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
114 "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ dirname filesuffix\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
115 "echo \"Syntax is: __INDENTERCALLSTRINGSCRIPTNAME__ filename\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
116 "echo \"Example: __INDENTERCALLSTRINGSCRIPTNAME__ temp cpp\"\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
117 "exit 1\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
118 "fi\n"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
119 "fi\n";
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
120 #endif // #if defined(Q_OS_WIN32)
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
121 return templateBatchScript;
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
122 }
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
123
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
124
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
125 /* Here comes the original batch script without the c++ markup
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
126 @echo off
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
127
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
128 IF (%1)==() GOTO error
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
129 dir /b /ad %1 >nul 2>nul && GOTO indentDir
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
130 IF NOT EXIST %1 GOTO error
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
131 goto indentFile
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
132
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
133 :indentDir
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
134 set searchdir=%1
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
135
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
136 IF (%2)==() GOTO assignDefaultSuffix
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
137 set filesuffix=%2
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
138
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
139 GOTO run
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
140
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
141 :assignDefaultSuffix
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
142 ::echo !!!!DEFAULT SUFFIX!!!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
143 set filesuffix=*
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
144
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
145 :run
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
146 FOR /F "tokens=*" %%G IN ('DIR /B /S %searchdir%\*.%filesuffix%') DO (
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
147 echo Indenting file "%%G"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
148 ::call call_CSSTidy.bat "%%G"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
149 "C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" "%%G" --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false indentoutput.css
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
150 move /Y indentoutput.css "%%G"
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
151 )
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
152 GOTO ende
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
153
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
154 :indentFile
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
155 echo Indenting one file %1
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
156 "C:/Dokumente und Einstellungen/ts/Eigene Dateien/Visual Studio 2005/Projects/UiGuixy/indenters/csstidy.exe" %1 --timestamp=true --allow_html_in_templates=false --compress_colors=true --compress_font=true --lowercase_s=false --preserve_css=false --remove_last_;=false --remove_bslash=true --sort_properties=false --sort_selectors=false indentoutput.css
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
157 move /Y indentoutput.css %1
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
158
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
159 GOTO ende
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
160
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
161 :error
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
162 echo .
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
163 echo ERROR: As parameter given directory or file does not exist!
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
164 echo Syntax is: recurse.bat dirname filesuffix
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
165 echo Syntax is: recurse.bat filename
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
166 echo Example: recurse.bat temp cpp
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
167 echo .
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
168
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
169 :ende
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
170
94734b9eb54f Renamed the source files and some classes to have consistent names. What a nice kind of work.
thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
parents:
diff changeset
171 */