initial commit moved from svn

This commit is contained in:
fatalerrors
2022-10-24 22:07:20 +02:00
parent b2caa19213
commit 0e96f4f5e4
229 changed files with 20039 additions and 0 deletions

170
uVersion.pas Normal file
View File

@@ -0,0 +1,170 @@
{
********************************************************************************
YaPeTaVi - Yet another Periodic Table Viewer
Copyright (C) 2000-2012 Geoffray Levasseur <geoffray.levasseurbrandin@numericable.fr>.
All rights reserved.
http://www.geoffray-levasseur.org/
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 3 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.
********************************************************************************
Description:
Version info manipulation functions
}
unit uVersion;
{$MODE objfpc}{$H+}
interface
uses
Classes, SysUtils, InterfaceBase, LCLPlatformDef, LCLVersion;
type
TVersionStade = (vsAlpha, vsBeta, vsReleaseCandidate, vsFinal);
TVerRec = record
Major: Byte;
Minor: Byte;
Release: Byte;
Build: Word;
Add: TVersionStade;
end;
const // Version info - please don't change (version update made by maintenor)
LCLPlatformDisplayNames: array[TLCLPlatform] of string = ('GTK 1', 'GTK 2',
//no release info for trunk starting 1.1 so impossible to detect that with precision
{$IF (lcl_major >= 1) and (lcl_minor >= 1)}
'GTK 3',
{$ENDIF}
'Win32/Win64', 'WinCE', 'Carbon', 'QT 4',
{$IF (lcl_major >= 1) and (lcl_minor >= 4)}
'QT 5',
{$ENDIF}
'FpGui', 'NoGui', 'Cocoa',
{$IF (lcl_major >= 1) and (lcl_minor >= 8)}
'Android', 'MUI');
{$ELSE}
'Android');
{$ENDIF}
VersionStadeDisplayNames: array[TVersionStade] of string = ('alpha', 'beta',
'RC', 'stable');
function GetBuildCPU: string;
function GetBuildOS: string;
function GetBuildDate: string;
function GetLCLWidgetType: TLCLPlatform;
function GetFPCVersion: String;
function GetLazarusVersion: string;
function GetLazarusRevision: string;
function GetVersionString(VerRec: TVerRec): String;
{$I version.inc}
var
Debug: Boolean;
implementation
uses
uUtils;
function GetBuildOS: string;
begin
Result := LowerCase({$I %FPCTARGETOS%});
end;
function GetBuildCPU: string;
begin
Result := LowerCase({$I %FPCTARGETCPU%});
end;
function GetLCLWidgetType: TLCLPlatform;
begin
if WidgetSet <> nil then
Result := WidgetSet.LCLPlatform
else begin
{$IFDEF Windows}
Result:= lpWin32;
{$ELSE}
Result:= lpGtk;
{$ENDIF}
end;
end;
function GetFPCVersion: String;
begin
Result := {$I %FPCVERSION%};
end;
function GetBuildDate: string;
var
BuildDate: string;
SlPos1, SlPos2: integer;
Date: TDateTime;
begin
BuildDate := {$I %date%};
SlPos1 := Pos('/', BuildDate);
SlPos2 := SlPos1 + Pos('/', Copy(BuildDate, SlPos1 + 1, Length(BuildDate)- SlPos1));
Date := EncodeDate(StrToWord(Copy(BuildDate, 1, SlPos1 - 1)),
StrToWord(Copy(BuildDate, SlPos1 + 1, SlPos2 - SlPos1 - 1)),
StrToWord(Copy(BuildDate, SlPos2 + 1, Length(BuildDate) - SlPos2)));
Result := FormatDateTime('yyyy-mm-dd', Date);
end;
function GetLazarusVersion: string;
begin
Result := Format('%d.%d.%d', [lcl_major, lcl_minor, lcl_release]);
end;
function GetLazarusRevision: string;
//use the lazarus source code - change path as you need
//if you don't have lazarus source code delete the line {$I <path>} and replace
//RevisionStr const by 'unknow'
{$IFNDEF Windows}
{$I ../../fp-laz/lazarus/ide/revision.inc}
{$ENDIF}
begin
{$IFNDEF Windows}
if Trim(RevisionStr) <> '' then
Result := 'svn ' + RevisionStr
else
{$ENDIF}
Result := 'inconnue';
end;
function GetVersionString(VerRec: TVerRec): String;
begin
Result := InttoStr(VerRec.Major) + '.' + InttoStr(VerRec.Minor) + '.' +
InttoStr(VerRec.Release) + '-' + InttoStr(VerRec.Build);
case VerRec.Add of
vsAlpha: Result := Result + ' alpha';
vsBeta: Result := Result + ' beta';
vsReleaseCandidate: Result := Result + 'RC';
end;
{$ifdef fpc}
Result := Result + ' ' + LCLPlatformDisplayNames[GetLCLWidgetType];
{$endif}
{$ifdef delphi}
Result := Result + ' ' + LCLPlatformDisplayNames[3];
{$endif}
end;
end.
)