testprogram.out

来自「格式化源码的最新板」· OUT 代码 · 共 159 行

OUT
159
字号
program testprogram

uses
  Forms,
  SysUtils,
  syncobjs,
  Classes,
  Windows,
  settings in 'Settings\Settings.pas',
  log in 'Log.pas',
  globals in 'Globals.pas',
  spinpalette in 'Palette\SpinPalette.pas',
  palettefns in 'Palette\PaletteFns.pas',
  memorybuffer in 'Classes\MemoryBuffer.pas',
  palettechangethread in 'Palette\PaletteChangeThread.pas',
  paletteeffectlists in 'Palette\PaletteEffectLists.pas',
  palettespinthread in 'Palette\PaletteSpinThread.pas',
  paletteeffect in 'Palette\PaletteEffect.pas',
  paletteeffectbinary in 'Palette\Effects\PaletteEffectBinary.pas',
  paletteeffectsfade in 'Palette\Effects\PaletteEffectsFade.pas',
  paletteeffectsnowburst in 'Palette\Effects\PaletteEffectSnowburst.pas',
  paletteeffectssimple in 'Palette\Effects\PaletteEffectsSimple.pas',
  paletteeffectsstain in 'Palette\Effects\PaletteEffectsStain.pas',
  mandalatypes in 'MandalaTypes.pas',
  noscreensaver in 'Classes\NoScreenSaver.pas',
  patterncreatethread in 'Pattern\PatternCreateThread.pas',
  patterndisplaythread in 'Pattern\PatternDisplayThread.pas',
  directdrawform in 'DirectDrawForm.pas' {frmDirectDraw},
  mainform in 'MainForm.pas' {frmMain},
  aboutform in 'AboutForm.pas' {frmAbout},
  stringfunctions in '..\Functions\StringFunctions.pas' {this is a long comment, as there might be a long form name which should not be line-broken},
  miscfunctions in '..\Functions\MiscFunctions.pas',
  patterns_tlb in '..\PatternLib\Patterns_TLB.pas',
  formsettings in 'Settings\FormSettings.pas' {frmMandalaSettings},
  mathfunctions in '..\Functions\MathFunctions.pas',
  dxtools in '..\Imports\DXTools.pas',
  dinput in '..\Imports\DInput.pas',
  ddraw in '..\Imports\DDraw.pas',
  directmanager in 'Classes\DirectManager.pas',
  bitmapfn in 'BitmapFn.pas',
  directxfunctions in '..\Functions\DirectXFunctions.pas',
  osversion in '..\Imports\OSVersion.pas',
  savinit in '..\Imports\Saver\savInit.pas',
  mandalaconstants in '..\MandalaConstants.pas',
  paletteeffectfourcolours in 'Palette\Effects\PaletteEffectFourColours.pas',
  paletteeffectsequential in 'Palette\Effects\PaletteEffectSequential.pas',
  colourlist in 'Classes\ColourList.pas';

{$R *.RES}

  procedure initpatternmanager;
  begin
    cipatternmanager := copatternmanager.Create;
    cipatternmanager.excludelist(cmandalasettings.excludedpatterns);
  end;

var
  sparam:     string;
  iparamloop: integer;
  bauto:      boolean;
  hsemaphore: thandle;
begin
  getsavermode;
  hsemaphore := createsemaphore(nil, 0, 1, 'MandalaSemaphore');
  if ((hsemaphore <> 0) and (getlasterror = error_already_exists)) then
  begin
    closehandle(hsemaphore);
    halt;
  end;
  application.Initialize;
  application.title  := 'Mandala';
  cmandalasettings   := tmandalasettings.Create(application);
  applicationlog     := tclog.Create(cmandalasettings.logdir);
  applicationlog.debugmode := cmandalasettings.logdebug;
  screencriticalsection := tcriticalsection.Create;
  varcriticalsection := tcriticalsection.Create;
  initpatternmanager;
  paletteeffectsmanager := tpaletteeffectmanager.Create(application);
  try
    bglobalshutdown := False;
    bnofades := True;
    bspeedupcycling := False;
    bslowdowncycling := False;
    bchangecycledir := False;
    bcyclefastest := False;
    bcycleslowest := False;
    bcyclepause := False;
    patternchangetiming := eregular;
    bauto := False;
    for iparamloop := 1 to paramcount do
    begin
      sparam := ParamStr(iparamloop);
      sparam := AnsiUpperCase(sparam);
      if (sparam[1] <> '-') and (sparam[1] <> '/') then
      begin
        applicationlog.logmessage(merror, 'badly formed command line parameter ' +
          ParamStr(iparamloop));
        continue;
      end;
      sparam := restof(sparam, 2);
      if sparam = 'A' then
      begin
        bauto := True;
      end
      else
      begin
        applicationlog.logmessage(merror, 'unknown command line parameter ' + ParamStr(iparamloop));
      end;
    end;
    excludescreensaver := tnoscreensaver.Create(application);
    if bauto then
    begin
      frmdirectdraw := tfrmdirectdraw.Create(application);
      frmdirectdraw.Execute;
    end
    else
    begin
      frmmain := tfrmmain.Create(application);
      frmmain.Execute;
    end;
  finally
    if assigned(frmmain) then
    begin
      frmmain.Release;
      frmmain := nil;
    end;
    if assigned(frmdirectdraw) then
    begin
      frmdirectdraw.Release;
      frmdirectdraw := nil;
    end;
    screencriticalsection.Free;
    screencriticalsection := nil;
    varcriticalsection.Free;
    varcriticalsection := nil;
    if assigned(paletteeffectsmanager) then
    begin
      paletteeffectsmanager.Free;
      paletteeffectsmanager := nil;
    end;
    cipatternmanager := nil;
    if assigned(cmandalasettings) then
    begin
      cmandalasettings.Free;
      cmandalasettings := nil;
    end;
    if assigned(applicationlog) then
    begin
      applicationlog.Free;
      applicationlog := nil;
    end;
    if assigned(excludescreensaver) then
    begin
      excludescreensaver.Free;
      excludescreensaver := nil;
    end;
  end;
end.
 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?