Spring Cleaning, Part Ichi (1)
Various minor things done to project files Updated sample extension project file and updated makefile to the new unified version (more changes likely on the way) Updated regex project file and makefile --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401971
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
||||
@@ -0,0 +1,101 @@
|
||||
(* SourceMod
|
||||
* compile.exe
|
||||
*
|
||||
* by the SourceMod Development Team (adapted from AMX Mod X's compiler tool)
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*)
|
||||
|
||||
program compile;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
{$R version.res}
|
||||
{$R icon.res}
|
||||
|
||||
uses
|
||||
SysUtils, Classes, IniFiles,
|
||||
uFunc in 'uFunc.pas';
|
||||
|
||||
var sr: TSearchRec;
|
||||
i: Word;
|
||||
cfg: TIniFile;
|
||||
outdir: String;
|
||||
begin
|
||||
WriteLn('//SourceMod Batch Compiler');
|
||||
WriteLn('// by the SourceMod Dev Team');
|
||||
WriteLn;
|
||||
|
||||
if not FileExists(ExtractFilePath(ParamStr(0))+COMPILER_EXE) then
|
||||
begin
|
||||
WriteLn('// Could not find '+COMPILER_EXE);
|
||||
AppExit;
|
||||
end;
|
||||
|
||||
cfg := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'compiler.ini');
|
||||
outdir := cfg.ReadString('Main', 'Output', '');
|
||||
if (outdir <> '') then begin
|
||||
if (DirectoryExists(outdir)) then
|
||||
outdir := IncludeTrailingPathDelimiter(outdir)
|
||||
else if (DirectoryExists(ExtractFilePath(ParamStr(0)) + outdir)) then
|
||||
outdir := ExtractFilePath(ParamStr(0)) + IncludeTrailingPathDelimiter(outdir);
|
||||
end
|
||||
else
|
||||
outdir := '';
|
||||
cfg.Free;
|
||||
|
||||
if (outdir = '') and (not DirectoryExists(ExtractFilePath(ParamStr(0))+'compiled')) then
|
||||
CreateDir(ExtractFilePath(ParamStr(0))+'compiled');
|
||||
|
||||
if ( ParamCount > 0 ) then
|
||||
begin
|
||||
for i := 1 to ParamCount do
|
||||
begin
|
||||
if FileExists(ParamStr(i)) then
|
||||
CompilePlugin(ParamStr(i), outdir)
|
||||
else
|
||||
begin
|
||||
WriteLn;
|
||||
WriteLn('// File not found.');
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if ( FindFirst('*.sp',faAnyFile,sr) = 0 ) then
|
||||
begin
|
||||
repeat
|
||||
CompilePlugin(sr.Name, outdir);
|
||||
until ( FindNext(sr) <> 0 );
|
||||
end
|
||||
else
|
||||
begin
|
||||
WriteLn('// No file found.');
|
||||
end;
|
||||
FindClose(sr);
|
||||
end;
|
||||
|
||||
AppExit;
|
||||
end.
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
SM ICON "pawn.ico"
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
@@ -0,0 +1,224 @@
|
||||
(* AMX Mod X
|
||||
* compile.exe
|
||||
*
|
||||
* by the AMX Mod X Development Team
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* In addition, as a special exception, the author gives permission to
|
||||
* link the code of this program with the Half-Life Game Engine ("HL
|
||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||
* respects for all of the code used other than the HL Engine and MODs
|
||||
* from Valve. If you modify this file, you may extend this exception
|
||||
* to your version of the file, but you are not obligated to do so. If
|
||||
* you do not wish to do so, delete this exception statement from your
|
||||
* version.
|
||||
*)
|
||||
|
||||
unit uFunc;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, SysUtils, Classes, Math, IniFiles;
|
||||
|
||||
resourcestring
|
||||
COMPILER_EXE = 'spcomp.exe';
|
||||
|
||||
procedure AppExit;
|
||||
procedure CompilePlugin(const Name, OutputDir: String);
|
||||
function GetAgeFromDat(const FileName: String): Integer;
|
||||
procedure SetAgeToDat(const FileName: String; const Age: Integer);
|
||||
function GetConsoleOutput(const Command: String; var Output: TStringList): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
procedure AppExit;
|
||||
begin
|
||||
WriteLn;
|
||||
Write('Press enter to exit ...');
|
||||
ReadLn;
|
||||
Halt;
|
||||
end;
|
||||
|
||||
procedure CompilePlugin(const Name, OutputDir: String);
|
||||
var
|
||||
Output: TStringList;
|
||||
i: Word;
|
||||
cStart,cEnd: Longword;
|
||||
FileName, FilePath, Compiled: String;
|
||||
begin
|
||||
FileName := ExtractFileName(Name);
|
||||
FilePath := ExtractFilePath(Name);
|
||||
if (OutputDir = '') then
|
||||
Compiled := FilePath+'compiled\'+ChangeFileExt(Filename,'.smx')
|
||||
else
|
||||
Compiled := OutputDir+ChangeFileExt(Filename,'.smx');
|
||||
|
||||
if (FilePath='') then
|
||||
FilePath := ExtractFilePath(ParamStr(0));
|
||||
|
||||
WriteLn;
|
||||
WriteLn('//// '+ExtractFileName(FileName));
|
||||
|
||||
if FileExists(Compiled) and ( GetAgeFromDat(Name)=FileAge(Name) ) then
|
||||
begin
|
||||
WriteLn('// Already compiled.');
|
||||
WriteLn('// ----------------------------------------');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
Output := TStringList.Create;
|
||||
|
||||
try
|
||||
cStart := GetTickCount;
|
||||
if not GetConsoleOutput(ExtractFilePath(ParamStr(0))+COMPILER_EXE+' "'+Name+'" "-o'+Compiled+'"',Output) then
|
||||
begin
|
||||
WriteLn('// Internal error.');
|
||||
AppExit;
|
||||
end;
|
||||
cEnd := GetTickCount;
|
||||
|
||||
for i := 3 to (Output.Count-1) do
|
||||
begin
|
||||
WriteLn('// '+Output.Strings[i]);
|
||||
end;
|
||||
|
||||
WriteLn('//');
|
||||
WriteLn('// Compilation Time: '+FloatToStr(SimpleRoundTo((cEnd-cStart) / 1000,-2))+' sec');
|
||||
WriteLn('// ----------------------------------------');
|
||||
Output.Free;
|
||||
except
|
||||
WriteLn('// Internal error.');
|
||||
AppExit;
|
||||
end;
|
||||
|
||||
SetAgeToDat(Name,FileAge(Name));
|
||||
end;
|
||||
|
||||
function GetAgeFromDat(const FileName: String): Integer;
|
||||
var
|
||||
Ini: TIniFile;
|
||||
begin
|
||||
Ini := TIniFile.Create(ExtractFilePath(ParamStr(0))+'compile.dat');
|
||||
Result := Ini.ReadInteger(FileName,'Age',-1);
|
||||
Ini.Free;
|
||||
end;
|
||||
|
||||
procedure SetAgeToDat(const FileName: String; const Age: Integer);
|
||||
var
|
||||
Ini: TIniFile;
|
||||
begin
|
||||
Ini := TIniFile.Create(ExtractFilePath(ParamStr(0))+'compile.dat');
|
||||
Ini.WriteInteger(FileName,'Age',Age);
|
||||
Ini.UpdateFile;
|
||||
Ini.Free;
|
||||
SetFileAttributes(PChar(ExtractFilePath(ParamStr(0))+'compile.dat'), faHidden);
|
||||
end;
|
||||
|
||||
function GetConsoleOutput(const Command: String; var Output: TStringList): Boolean;
|
||||
var
|
||||
StartupInfo: TStartupInfo;
|
||||
ProcessInfo: TProcessInformation;
|
||||
SecurityAttr: TSecurityAttributes;
|
||||
PipeOutputRead: THandle;
|
||||
PipeOutputWrite: THandle;
|
||||
PipeErrorsRead: THandle;
|
||||
PipeErrorsWrite: THandle;
|
||||
Succeed: Boolean;
|
||||
Buffer: array [0..255] of Char;
|
||||
NumberOfBytesRead: DWORD;
|
||||
Stream: TMemoryStream;
|
||||
Errors: String;
|
||||
begin
|
||||
FillChar(ProcessInfo, SizeOf(TProcessInformation), 0);
|
||||
FillChar(SecurityAttr, SizeOf(TSecurityAttributes), 0);
|
||||
|
||||
SecurityAttr.nLength := SizeOf(SecurityAttr);
|
||||
SecurityAttr.bInheritHandle := True;
|
||||
SecurityAttr.lpSecurityDescriptor := nil;
|
||||
|
||||
CreatePipe(PipeOutputRead, PipeOutputWrite, @SecurityAttr, 0);
|
||||
CreatePipe(PipeErrorsRead, PipeErrorsWrite, @SecurityAttr, 0);
|
||||
|
||||
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
|
||||
StartupInfo.cb:=SizeOf(StartupInfo);
|
||||
StartupInfo.hStdInput := 0;
|
||||
StartupInfo.hStdOutput := PipeOutputWrite;
|
||||
StartupInfo.hStdError := PipeErrorsWrite;
|
||||
StartupInfo.wShowWindow := SW_HIDE;
|
||||
StartupInfo.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
|
||||
|
||||
if CreateProcess(nil, PChar(command), nil, nil, true, CREATE_DEFAULT_ERROR_MODE or CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo) then begin
|
||||
Result := True;
|
||||
CloseHandle(PipeOutputWrite);
|
||||
CloseHandle(PipeErrorsWrite);
|
||||
|
||||
Stream := TMemoryStream.Create;
|
||||
try
|
||||
while True do begin
|
||||
Succeed := ReadFile(PipeOutputRead, Buffer, 255, NumberOfBytesRead, nil);
|
||||
if not Succeed then Break;
|
||||
Stream.Write(Buffer, NumberOfBytesRead);
|
||||
end;
|
||||
finally
|
||||
// nothing
|
||||
end;
|
||||
Stream.Position := 0;
|
||||
Output.LoadFromStream(Stream);
|
||||
Stream.Free;
|
||||
CloseHandle(PipeOutputRead);
|
||||
|
||||
Errors := '';
|
||||
try
|
||||
while True do
|
||||
begin
|
||||
Succeed := ReadFile(PipeErrorsRead, Buffer, 255, NumberOfBytesRead, nil);
|
||||
if not Succeed then Break;
|
||||
Errors := Errors + Copy(Buffer, 1, NumberOfBytesRead);
|
||||
end;
|
||||
finally
|
||||
// nothing
|
||||
end;
|
||||
CloseHandle(PipeErrorsRead);
|
||||
|
||||
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
|
||||
CloseHandle(ProcessInfo.hProcess);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := False;
|
||||
CloseHandle(PipeOutputRead);
|
||||
CloseHandle(PipeOutputWrite);
|
||||
CloseHandle(PipeErrorsRead);
|
||||
CloseHandle(PipeErrorsWrite);
|
||||
end;
|
||||
// error management
|
||||
if (Errors <> '') then begin
|
||||
if (Output.Count > 1) then begin
|
||||
if (Trim(Output[Output.Count -2]) = '') then
|
||||
Output.Strings[Output.Count -2] := TrimRight(Errors)
|
||||
else
|
||||
Output.Insert(Output.Count -1, TrimRight(Errors));
|
||||
end
|
||||
else
|
||||
Output.Add(Errors);
|
||||
Output.Text := Output.Text; // pseudo-rearrangement
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -0,0 +1,33 @@
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
|
||||
FILEVERSION 1,5,0,0
|
||||
PRODUCTVERSION 1,5,0,0
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP // VFT_APP VFT_DLL
|
||||
//FILEFLGAGS:
|
||||
// VS_FF_DEBUG VS_FF_PRERELEASE VS_FF_PATCHED VS_FF_PRIVATEBUILD VS_FF_INFOINFERRED VS_FF_SPECIALBUILD
|
||||
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "SPCOMP compile.exe\0"
|
||||
//VALUE "CompanyName", "AMXX Development Team\0"
|
||||
VALUE "FileDescription", "SPCOMP compile.exe\0"
|
||||
VALUE "FileVersion", "1.0\0"
|
||||
VALUE "InternalName", "SPCOMP compile.exe\0"
|
||||
VALUE "LegalCopyright", "(c) 2007, SourceMod Development Team\0"
|
||||
//VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "compile.exe\0"
|
||||
//VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "SPCOMP compile.exe\0"
|
||||
VALUE "ProductVersion", "1.0\0"
|
||||
//VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", LANG_ENGLISH SUBLANG_ENGLISH_US
|
||||
END
|
||||
END
|
||||
Binary file not shown.
Reference in New Issue
Block a user