From ef1b9f48581f0369063c565c51a3fe61b903d280 Mon Sep 17 00:00:00 2001 From: cpicanco Date: Wed, 28 Dec 2016 14:52:58 -0300 Subject: [PATCH] rename experiment runner project --- cultural_matrix.ico | Bin 137458 -> 0 bytes cultural_matrix.lpi | 198 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ cultural_matrix.lpr | 120 ------------------------------------------------------------------------------------------------------------------------ experiment_runner.ico | Bin 0 -> 137458 bytes experiment_runner.lpi | 198 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ experiment_runner.lpr | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 318 insertions(+), 318 deletions(-) delete mode 100644 cultural_matrix.ico delete mode 100644 cultural_matrix.lpi delete mode 100644 cultural_matrix.lpr create mode 100644 experiment_runner.ico create mode 100644 experiment_runner.lpi create mode 100644 experiment_runner.lpr diff --git a/cultural_matrix.ico b/cultural_matrix.ico deleted file mode 100644 index 94d7efa..0000000 Binary files a/cultural_matrix.ico and /dev/null differ diff --git a/cultural_matrix.lpi b/cultural_matrix.lpi deleted file mode 100644 index f74ef38..0000000 --- a/cultural_matrix.lpi +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - <ResourceType Value="res"/> - <UseXPManifest Value="True"/> - <Icon Value="0"/> - </General> - <i18n> - <EnableI18N LFM="False"/> - </i18n> - <VersionInfo> - <StringTable ProductVersion=""/> - </VersionInfo> - <BuildModes Count="3"> - <Item1 Name="Linux64" Default="True"/> - <Item2 Name="Win32 Debug"> - <CompilerOptions> - <Version Value="11"/> - <Target> - <Filename Value="cultural_matrix"/> - </Target> - <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)"/> - <Libraries Value="/usr/lib/gcc/x86_64-linux-gnu/4.9/"/> - <OtherUnitFiles Value="units;../../dependency/delphizmq;../../units"/> - <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> - </SearchPaths> - <Linking> - <Options> - <Win32> - <GraphicApplication Value="True"/> - </Win32> - </Options> - </Linking> - </CompilerOptions> - </Item2> - <Item3 Name="Win32 Release"> - <CompilerOptions> - <Version Value="11"/> - <Target> - <Filename Value="cultural_matrix"/> - </Target> - <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)"/> - <Libraries Value="/usr/lib/gcc/x86_64-linux-gnu/4.9/"/> - <OtherUnitFiles Value="units;../../dependency/delphizmq;../../units"/> - <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> - </SearchPaths> - <CodeGeneration> - <SmartLinkUnit Value="True"/> - <Optimizations> - <OptimizationLevel Value="4"/> - </Optimizations> - </CodeGeneration> - <Linking> - <Debugging> - <GenerateDebugInfo Value="False"/> - <StripSymbols Value="True"/> - </Debugging> - <LinkSmart Value="True"/> - <Options> - <Win32> - <GraphicApplication Value="True"/> - </Win32> - </Options> - </Linking> - </CompilerOptions> - </Item3> - </BuildModes> - <PublishOptions> - <Version Value="2"/> - </PublishOptions> - <RunParams> - <local> - <FormatVersion Value="1"/> - </local> - </RunParams> - <RequiredPackages Count="2"> - <Item1> - <PackageName Value="FCL"/> - </Item1> - <Item2> - <PackageName Value="LCL"/> - </Item2> - </RequiredPackages> - <Units Count="15"> - <Unit0> - <Filename Value="cultural_matrix.lpr"/> - <IsPartOfProject Value="True"/> - </Unit0> - <Unit1> - <Filename Value="form_matrixgame.pas"/> - <IsPartOfProject Value="True"/> - <ComponentName Value="FormMatrixGame"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="Form"/> - </Unit1> - <Unit2> - <Filename Value="README.md"/> - <IsPartOfProject Value="True"/> - </Unit2> - <Unit3> - <Filename Value="units/zmq_network.pas"/> - <IsPartOfProject Value="True"/> - </Unit3> - <Unit4> - <Filename Value="units/game_zmq_actors.pas"/> - <IsPartOfProject Value="True"/> - </Unit4> - <Unit5> - <Filename Value="units/game_actors.pas"/> - <IsPartOfProject Value="True"/> - </Unit5> - <Unit6> - <Filename Value="units/game_experiment.pas"/> - <IsPartOfProject Value="True"/> - </Unit6> - <Unit7> - <Filename Value="units/game_file_methods.pas"/> - <IsPartOfProject Value="True"/> - </Unit7> - <Unit8> - <Filename Value="units/game_resources.pas"/> - <IsPartOfProject Value="True"/> - </Unit8> - <Unit9> - <Filename Value="units/game_control.pas"/> - <IsPartOfProject Value="True"/> - </Unit9> - <Unit10> - <Filename Value="units/string_methods.pas"/> - <IsPartOfProject Value="True"/> - </Unit10> - <Unit11> - <Filename Value="units/game_actors_point.pas"/> - <IsPartOfProject Value="True"/> - </Unit11> - <Unit12> - <Filename Value="units/game_visual_elements.pas"/> - <IsPartOfProject Value="True"/> - </Unit12> - <Unit13> - <Filename Value="form_chooseactor.pas"/> - <IsPartOfProject Value="True"/> - <ComponentName Value="FormChooseActor"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="Form"/> - </Unit13> - <Unit14> - <Filename Value="units/csv_writer.pas"/> - <IsPartOfProject Value="True"/> - </Unit14> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="11"/> - <Target> - <Filename Value="cultural_matrix"/> - </Target> - <SearchPaths> - <IncludeFiles Value="$(ProjOutDir)"/> - <Libraries Value="/usr/lib/gcc/x86_64-linux-gnu/4.9/"/> - <OtherUnitFiles Value="units;../../dependency/delphizmq;../../units"/> - <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> - </SearchPaths> - <Linking> - <Options> - <Win32> - <GraphicApplication Value="True"/> - </Win32> - </Options> - </Linking> - <Other> - <CustomOptions Value="-dUseCThreads"/> - <OtherDefines Count="1"> - <Define0 Value="UseCThreads"/> - </OtherDefines> - </Other> - </CompilerOptions> - <Debugging> - <Exceptions Count="3"> - <Item1> - <Name Value="EAbort"/> - </Item1> - <Item2> - <Name Value="ECodetoolError"/> - </Item2> - <Item3> - <Name Value="EFOpenError"/> - </Item3> - </Exceptions> - </Debugging> -</CONFIG> diff --git a/cultural_matrix.lpr b/cultural_matrix.lpr deleted file mode 100644 index 946ebcc..0000000 --- a/cultural_matrix.lpr +++ /dev/null @@ -1,120 +0,0 @@ -{ - Stimulus Control - Copyright (C) 2014-2016 Carlos Rafael Fernandes Picanço, Universidade Federal do Pará. - - The present file is distributed under the terms of the GNU General Public License (GPL v3.0). - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -} -program cultural_matrix; - -{$mode objfpc}{$H+} - -{$DEFINE DEBUG} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Interfaces // this includes the LCL widgetset - {$IFDEF DEBUG} - , Dialogs, FileUtil, LazFileUtils - {$IFDEF LINUX} - , BaseUnix - {$ENDIF} - {$ENDIF} - , StrUtils, Forms, Classes, sysutils - , form_matrixgame, game_actors - , zhelpers, form_chooseactor - ; - - -var - ApplicationPath, - F : string; - -const - PAdmin : array [0..3] of string = ('--admin','--adm','-admin','-adm'); - PPlayer : array [0..3] of string = ('--player','--play','-player','-play'); - PWatcher : array [0..3] of string = ('--watcher','--watch','-watcher','-watch'); - -{$R *.res} - - -{$IFDEF DEBUG} - function CreateDebugFoldersForPlayers:Boolean; - var - i : integer; - begin - Result := True; - for i := 0 to 2 do - begin - if Pos(('Participant'), Application.ExeName) > 0 then - Break; - F := ApplicationPath+'Participant'+IntToStr(i+1); - WriteLn(F); - if ForceDirectoriesUTF8(F) then // ensure we have always the newer version for tests - begin - CopyFile(Application.ExeName,F+PathDelim+ApplicationName,[cffOverwriteFile]); - {$IFDEF LINUX} - FpChmod(F+PathDelim+ApplicationName,S_IRWXU); - {$ENDIF} - end - else Result := False; - end; - end; -{$ENDIF} - - function GetZMQNetworkID(var F:string):Boolean; - var ID : TStringList; - begin - Result := True; - ID := TStringList.Create; - if FileExists(F) then - try - ID.LoadFromFile(F); - F := Copy(ID.Text,0,Length(ID.Text)-2); - finally - ID.Free; - end - else - try - ID.Text := s_random(32); - ID.SaveToFile(F); - F := Copy(ID.Text,0,Length(ID.Text)-2); - except - on E: Exception do - begin - ID.Free; - {$IFDEF DEBUG} - ShowMessage(E.Message); - {$ENDIF} - Result := False; - end; - end; - end; - -begin - ApplicationPath := ExtractFilePath(Application.ExeName); - {$IFDEF DEBUG} - if not CreateDebugFoldersForPlayers then Exit; - {$ENDIF} - Application.Initialize; - F := ApplicationPath+PathDelim+'id'; - if not GetZMQNetworkID(F) then Exit; - Application.CreateForm(TFormMatrixGame, FormMatrixGame); - - FormMatrixGame.SetID(F); - if Paramcount > 0 then - begin - if AnsiMatchStr(lowercase(ParamStr(0)), PAdmin) then - FormMatrixGame.SetGameActor(gaAdmin); - if AnsiMatchStr(lowercase(ParamStr(0)), PPlayer) then - FormMatrixGame.SetGameActor(gaPlayer); - if AnsiMatchStr(lowercase(ParamStr(0)), PWatcher) then - FormMatrixGame.SetGameActor(gaWatcher); - end; - Application.Run; -end. - diff --git a/experiment_runner.ico b/experiment_runner.ico new file mode 100644 index 0000000..94d7efa Binary files /dev/null and b/experiment_runner.ico differ diff --git a/experiment_runner.lpi b/experiment_runner.lpi new file mode 100644 index 0000000..539cba1 --- /dev/null +++ b/experiment_runner.lpi @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="experiment_runner"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="3"> + <Item1 Name="Linux64" Default="True"/> + <Item2 Name="Win32 Debug"> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="experiment_runner"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <Libraries Value="/usr/lib/gcc/x86_64-linux-gnu/4.9/"/> + <OtherUnitFiles Value="units;../../dependency/delphizmq;../../units"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + </Item2> + <Item3 Name="Win32 Release"> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="experiment_runner"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <Libraries Value="/usr/lib/gcc/x86_64-linux-gnu/4.9/"/> + <OtherUnitFiles Value="units;../../dependency/delphizmq;../../units"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="4"/> + </Optimizations> + </CodeGeneration> + <Linking> + <Debugging> + <GenerateDebugInfo Value="False"/> + <StripSymbols Value="True"/> + </Debugging> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + </Item3> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="FCL"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="15"> + <Unit0> + <Filename Value="experiment_runner.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="form_matrixgame.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FormMatrixGame"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="README.md"/> + <IsPartOfProject Value="True"/> + </Unit2> + <Unit3> + <Filename Value="units/zmq_network.pas"/> + <IsPartOfProject Value="True"/> + </Unit3> + <Unit4> + <Filename Value="units/game_zmq_actors.pas"/> + <IsPartOfProject Value="True"/> + </Unit4> + <Unit5> + <Filename Value="units/game_actors.pas"/> + <IsPartOfProject Value="True"/> + </Unit5> + <Unit6> + <Filename Value="units/game_experiment.pas"/> + <IsPartOfProject Value="True"/> + </Unit6> + <Unit7> + <Filename Value="units/game_file_methods.pas"/> + <IsPartOfProject Value="True"/> + </Unit7> + <Unit8> + <Filename Value="units/game_resources.pas"/> + <IsPartOfProject Value="True"/> + </Unit8> + <Unit9> + <Filename Value="units/game_control.pas"/> + <IsPartOfProject Value="True"/> + </Unit9> + <Unit10> + <Filename Value="units/string_methods.pas"/> + <IsPartOfProject Value="True"/> + </Unit10> + <Unit11> + <Filename Value="units/game_actors_point.pas"/> + <IsPartOfProject Value="True"/> + </Unit11> + <Unit12> + <Filename Value="units/game_visual_elements.pas"/> + <IsPartOfProject Value="True"/> + </Unit12> + <Unit13> + <Filename Value="form_chooseactor.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="FormChooseActor"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit13> + <Unit14> + <Filename Value="units/csv_writer.pas"/> + <IsPartOfProject Value="True"/> + </Unit14> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="experiment_runner"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <Libraries Value="/usr/lib/gcc/x86_64-linux-gnu/4.9/"/> + <OtherUnitFiles Value="units;../../dependency/delphizmq;../../units"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dUseCThreads"/> + <OtherDefines Count="1"> + <Define0 Value="UseCThreads"/> + </OtherDefines> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/experiment_runner.lpr b/experiment_runner.lpr new file mode 100644 index 0000000..2ab016d --- /dev/null +++ b/experiment_runner.lpr @@ -0,0 +1,120 @@ +{ + Stimulus Control + Copyright (C) 2014-2016 Carlos Rafael Fernandes Picanço, Universidade Federal do Pará. + + The present file is distributed under the terms of the GNU General Public License (GPL v3.0). + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +} +program experiment_runner; + +{$mode objfpc}{$H+} + +{$DEFINE DEBUG} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces // this includes the LCL widgetset + {$IFDEF DEBUG} + , Dialogs, FileUtil, LazFileUtils + {$IFDEF LINUX} + , BaseUnix + {$ENDIF} + {$ENDIF} + , StrUtils, Forms, Classes, sysutils + , form_matrixgame, game_actors + , zhelpers, form_chooseactor + ; + + +var + ApplicationPath, + F : string; + +const + PAdmin : array [0..3] of string = ('--admin','--adm','-admin','-adm'); + PPlayer : array [0..3] of string = ('--player','--play','-player','-play'); + PWatcher : array [0..3] of string = ('--watcher','--watch','-watcher','-watch'); + +{$R *.res} + + +{$IFDEF DEBUG} + function CreateDebugFoldersForPlayers:Boolean; + var + i : integer; + begin + Result := True; + for i := 0 to 2 do + begin + if Pos(('Participant'), Application.ExeName) > 0 then + Break; + F := ApplicationPath+'Participant'+IntToStr(i+1); + WriteLn(F); + if ForceDirectoriesUTF8(F) then // ensure we have always the newer version for tests + begin + CopyFile(Application.ExeName,F+PathDelim+ApplicationName,[cffOverwriteFile]); + {$IFDEF LINUX} + FpChmod(F+PathDelim+ApplicationName,S_IRWXU); + {$ENDIF} + end + else Result := False; + end; + end; +{$ENDIF} + + function GetZMQNetworkID(var F:string):Boolean; + var ID : TStringList; + begin + Result := True; + ID := TStringList.Create; + if FileExists(F) then + try + ID.LoadFromFile(F); + F := Copy(ID.Text,0,Length(ID.Text)-2); + finally + ID.Free; + end + else + try + ID.Text := s_random(32); + ID.SaveToFile(F); + F := Copy(ID.Text,0,Length(ID.Text)-2); + except + on E: Exception do + begin + ID.Free; + {$IFDEF DEBUG} + ShowMessage(E.Message); + {$ENDIF} + Result := False; + end; + end; + end; + +begin + ApplicationPath := ExtractFilePath(Application.ExeName); + {$IFDEF DEBUG} + if not CreateDebugFoldersForPlayers then Exit; + {$ENDIF} + Application.Initialize; + F := ApplicationPath+PathDelim+'id'; + if not GetZMQNetworkID(F) then Exit; + Application.CreateForm(TFormMatrixGame, FormMatrixGame); + + FormMatrixGame.SetID(F); + if Paramcount > 0 then + begin + if AnsiMatchStr(lowercase(ParamStr(0)), PAdmin) then + FormMatrixGame.SetGameActor(gaAdmin); + if AnsiMatchStr(lowercase(ParamStr(0)), PPlayer) then + FormMatrixGame.SetGameActor(gaPlayer); + if AnsiMatchStr(lowercase(ParamStr(0)), PWatcher) then + FormMatrixGame.SetGameActor(gaWatcher); + end; + Application.Run; +end. + -- libgit2 0.21.2