mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 08:19:53 +01:00 
			
		
		
		
	pas2js: added pas2jsdsgn.lpk
git-svn-id: trunk@56646 -
This commit is contained in:
		
							parent
							
								
									eae4efc5bd
								
							
						
					
					
						commit
						82c8f67445
					
				
							
								
								
									
										10
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -3752,6 +3752,15 @@ components/paradox/regparadox.res -text
 | 
			
		||||
components/paradox/tparadox.png -text svneol=unset#image/png
 | 
			
		||||
components/paradox/tparadox_150.png -text
 | 
			
		||||
components/paradox/tparadox_200.png -text
 | 
			
		||||
components/pas2js/Makefile svneol=native#text/plain
 | 
			
		||||
components/pas2js/Makefile.compiled svneol=native#text/plain
 | 
			
		||||
components/pas2js/Makefile.fpc svneol=native#text/plain
 | 
			
		||||
components/pas2js/Pas2JSDsgn.compiled svneol=native#text/plain
 | 
			
		||||
components/pas2js/fpmake.pp svneol=native#text/plain
 | 
			
		||||
components/pas2js/languages/pjsdsgnregister.po svneol=native#text/plain
 | 
			
		||||
components/pas2js/pas2jsdsgn.lpk svneol=native#text/plain
 | 
			
		||||
components/pas2js/pas2jsdsgn.pas svneol=native#text/plain
 | 
			
		||||
components/pas2js/pjsdsgnregister.pas svneol=native#text/plain
 | 
			
		||||
components/plotfunction/demo/event/frmmain.lfm svneol=native#text/plain
 | 
			
		||||
components/plotfunction/demo/event/frmmain.pp svneol=native#text/plain
 | 
			
		||||
components/plotfunction/demo/event/ploteventdemo.ico -text svneol=unset#image/ico
 | 
			
		||||
@ -9935,6 +9944,7 @@ packager/globallinks/multithreadprocslaz-1.2.1.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/notlcldesigner-0.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/onlinepackagemanager-1.0.1.2.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/packagetabs-0.1.1.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/pas2jsdsgn-1.0.1.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/pascalscript-0.0.0.1.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/pascalscriptfcl-0.0.0.1.lpl svneol=native#text/plain
 | 
			
		||||
packager/globallinks/pochecker-1.lpl svneol=native#text/plain
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3196
									
								
								components/pas2js/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3196
									
								
								components/pas2js/Makefile
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										5
									
								
								components/pas2js/Makefile.compiled
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								components/pas2js/Makefile.compiled
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<CONFIG>
 | 
			
		||||
  <Makefile Value="2"/>
 | 
			
		||||
  <Params Value=" -Fu../../packager/units/$(CPU_TARGET)-$(OS_TARGET);../lazutils/lib/$(CPU_TARGET)-$(OS_TARGET);../../lcl/units/$(CPU_TARGET)-$(OS_TARGET);../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM);../lazcontrols/lib/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM);../ideintf/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM);.  -MObjFPC -Schi -O1 -g -gl -l -vewnhibq -dLCL -dLCL$(LCL_PLATFORM) pas2jsdsgn.pas"/>
 | 
			
		||||
</CONFIG>
 | 
			
		||||
							
								
								
									
										64
									
								
								components/pas2js/Makefile.fpc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								components/pas2js/Makefile.fpc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,64 @@
 | 
			
		||||
#   File generated automatically by Lazarus Package Manager
 | 
			
		||||
#
 | 
			
		||||
#   Makefile.fpc for Pas2JSDsgn 1.0.1
 | 
			
		||||
#
 | 
			
		||||
#   This file was generated on 05.12.2017
 | 
			
		||||
 | 
			
		||||
[package]
 | 
			
		||||
name=pas2jsdsgn
 | 
			
		||||
version=1.0.1
 | 
			
		||||
 | 
			
		||||
[compiler]
 | 
			
		||||
unittargetdir=lib/$(CPU_TARGET)-$(OS_TARGET)
 | 
			
		||||
unitdir=../../packager/units/$(CPU_TARGET)-$(OS_TARGET) ../lazutils/lib/$(CPU_TARGET)-$(OS_TARGET) ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET) ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM) ../lazcontrols/lib/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM) ../ideintf/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM) .
 | 
			
		||||
options= -MObjFPC -Schi -O1 -g -gl -l -vewnhibq -dLCL -dLCL$(LCL_PLATFORM) $(DBG_OPTIONS)
 | 
			
		||||
 | 
			
		||||
[target]
 | 
			
		||||
units=pas2jsdsgn.pas
 | 
			
		||||
 | 
			
		||||
[clean]
 | 
			
		||||
files=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) \
 | 
			
		||||
      $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) \
 | 
			
		||||
      $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) \
 | 
			
		||||
      $(wildcard $(COMPILER_UNITTARGETDIR)/*.lfm) \
 | 
			
		||||
      $(wildcard $(COMPILER_UNITTARGETDIR)/*.res) \
 | 
			
		||||
      $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) \
 | 
			
		||||
      $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
 | 
			
		||||
 | 
			
		||||
[prerules]
 | 
			
		||||
# LCL Platform
 | 
			
		||||
ifndef LCL_PLATFORM
 | 
			
		||||
ifeq ($(OS_TARGET),win32)
 | 
			
		||||
LCL_PLATFORM=win32
 | 
			
		||||
else
 | 
			
		||||
ifeq ($(OS_TARGET),win64)
 | 
			
		||||
LCL_PLATFORM=win32
 | 
			
		||||
else
 | 
			
		||||
ifeq ($(OS_TARGET),darwin)
 | 
			
		||||
LCL_PLATFORM=carbon
 | 
			
		||||
else
 | 
			
		||||
LCL_PLATFORM=gtk2
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
export LCL_PLATFORM
 | 
			
		||||
 | 
			
		||||
DBG_OPTIONS=
 | 
			
		||||
ifeq ($(OS_TARGET),darwin)
 | 
			
		||||
DBG_OPTIONS=-gw
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
[rules]
 | 
			
		||||
.PHONY: cleartarget compiled all
 | 
			
		||||
 | 
			
		||||
cleartarget:
 | 
			
		||||
        -$(DEL) $(COMPILER_UNITTARGETDIR)/pas2jsdsgn$(PPUEXT)
 | 
			
		||||
 | 
			
		||||
compiled:
 | 
			
		||||
        $(CPPROG) -f Makefile.compiled $(COMPILER_UNITTARGETDIR)/Pas2JSDsgn.compiled
 | 
			
		||||
 | 
			
		||||
all: cleartarget $(COMPILER_UNITTARGETDIR) pas2jsdsgn$(PPUEXT) compiled
 | 
			
		||||
 | 
			
		||||
distclean: clean
 | 
			
		||||
        ${DELTREE} lib/*
 | 
			
		||||
							
								
								
									
										5
									
								
								components/pas2js/Pas2JSDsgn.compiled
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								components/pas2js/Pas2JSDsgn.compiled
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<CONFIG>
 | 
			
		||||
  <Makefile Value="2"/>
 | 
			
		||||
  <Params Value=" -Fu.  -MObjFPC -Schi -O1 -g -gl -l -vewnhibq pas2jsdsgn.pas"/>
 | 
			
		||||
</CONFIG>
 | 
			
		||||
							
								
								
									
										59
									
								
								components/pas2js/fpmake.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								components/pas2js/fpmake.pp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,59 @@
 | 
			
		||||
{
 | 
			
		||||
   File generated automatically by Lazarus Package Manager
 | 
			
		||||
 | 
			
		||||
   fpmake.pp for Pas2JSDsgn 1.0.1
 | 
			
		||||
 | 
			
		||||
   This file was generated on 05.12.2017
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
{$ifndef ALLPACKAGES} 
 | 
			
		||||
{$mode objfpc}{$H+}
 | 
			
		||||
program fpmake;
 | 
			
		||||
 | 
			
		||||
uses fpmkunit;
 | 
			
		||||
{$endif ALLPACKAGES}
 | 
			
		||||
 | 
			
		||||
procedure add_Pas2JSDsgn(const ADirectory: string);
 | 
			
		||||
 | 
			
		||||
var
 | 
			
		||||
  P : TPackage;
 | 
			
		||||
  T : TTarget;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  with Installer do
 | 
			
		||||
    begin
 | 
			
		||||
    P:=AddPackage('pas2jsdsgn');
 | 
			
		||||
    P.Version:='1.0.1';
 | 
			
		||||
 | 
			
		||||
    P.Directory:=ADirectory;
 | 
			
		||||
 | 
			
		||||
    P.Flags.Add('LazarusDsgnPkg');
 | 
			
		||||
 | 
			
		||||
    P.Dependencies.Add('ideintf');
 | 
			
		||||
    P.Options.Add('-MObjFPC');
 | 
			
		||||
    P.Options.Add('-Schi');
 | 
			
		||||
    P.Options.Add('-O1');
 | 
			
		||||
    P.Options.Add('-g');
 | 
			
		||||
    P.Options.Add('-gl');
 | 
			
		||||
    P.Options.Add('-l');
 | 
			
		||||
    P.Options.Add('-vewnhibq');
 | 
			
		||||
    P.Options.Add('-dLCL');
 | 
			
		||||
    P.Options.Add('-dLCL$(LCLWidgetType)');
 | 
			
		||||
    P.UnitPath.Add('.');
 | 
			
		||||
    T:=P.Targets.AddUnit('pas2jsdsgn.pas');
 | 
			
		||||
    t.Dependencies.AddUnit('pjsdsgnregister');
 | 
			
		||||
 | 
			
		||||
    T:=P.Targets.AddUnit('pjsdsgnregister.pas');
 | 
			
		||||
 | 
			
		||||
    // copy the compiled file, so the IDE knows how the package was compiled
 | 
			
		||||
    P.InstallFiles.Add('Pas2JSDsgn.compiled',AllOSes,'$(unitinstalldir)');
 | 
			
		||||
 | 
			
		||||
    end;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{$ifndef ALLPACKAGES}
 | 
			
		||||
begin
 | 
			
		||||
  add_Pas2JSDsgn('');
 | 
			
		||||
  Installer.Run;
 | 
			
		||||
end.
 | 
			
		||||
{$endif ALLPACKAGES}
 | 
			
		||||
							
								
								
									
										19
									
								
								components/pas2js/languages/pjsdsgnregister.po
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								components/pas2js/languages/pjsdsgnregister.po
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
msgid ""
 | 
			
		||||
msgstr "Content-Type: text/plain; charset=UTF-8"
 | 
			
		||||
 | 
			
		||||
#: pjsdsgnregister.pjsdnodejsappdescription
 | 
			
		||||
msgid "A pas2js program running in node.js"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: pjsdsgnregister.pjsdnodejsapplication
 | 
			
		||||
msgid "Node.js Application"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: pjsdsgnregister.pjsdwebappdescription
 | 
			
		||||
msgid "A pas2js program running in the browser"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
#: pjsdsgnregister.pjsdwebapplication
 | 
			
		||||
msgid "Web Application"
 | 
			
		||||
msgstr ""
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										47
									
								
								components/pas2js/pas2jsdsgn.lpk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								components/pas2js/pas2jsdsgn.lpk
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<CONFIG>
 | 
			
		||||
  <Package Version="4">
 | 
			
		||||
    <Name Value="Pas2JSDsgn"/>
 | 
			
		||||
    <Type Value="DesignTime"/>
 | 
			
		||||
    <Author Value="Mattias Gaertner"/>
 | 
			
		||||
    <CompilerOptions>
 | 
			
		||||
      <Version Value="11"/>
 | 
			
		||||
      <SearchPaths>
 | 
			
		||||
        <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
 | 
			
		||||
      </SearchPaths>
 | 
			
		||||
      <Parsing>
 | 
			
		||||
        <SyntaxOptions>
 | 
			
		||||
          <AllowLabel Value="False"/>
 | 
			
		||||
        </SyntaxOptions>
 | 
			
		||||
      </Parsing>
 | 
			
		||||
      <Other>
 | 
			
		||||
        <CreateMakefileOnBuild Value="True"/>
 | 
			
		||||
      </Other>
 | 
			
		||||
    </CompilerOptions>
 | 
			
		||||
    <Description Value="Adds a Lazarus project for pas2js browser applications."/>
 | 
			
		||||
    <License Value="Modified LGPL-2"/>
 | 
			
		||||
    <Version Major="1" Release="1"/>
 | 
			
		||||
    <Files Count="1">
 | 
			
		||||
      <Item1>
 | 
			
		||||
        <Filename Value="pjsdsgnregister.pas"/>
 | 
			
		||||
        <HasRegisterProc Value="True"/>
 | 
			
		||||
        <UnitName Value="pjsdsgnregister"/>
 | 
			
		||||
      </Item1>
 | 
			
		||||
    </Files>
 | 
			
		||||
    <i18n>
 | 
			
		||||
      <EnableI18N Value="True"/>
 | 
			
		||||
      <OutDir Value="languages"/>
 | 
			
		||||
    </i18n>
 | 
			
		||||
    <RequiredPkgs Count="1">
 | 
			
		||||
      <Item1>
 | 
			
		||||
        <PackageName Value="IDEIntf"/>
 | 
			
		||||
      </Item1>
 | 
			
		||||
    </RequiredPkgs>
 | 
			
		||||
    <UsageOptions>
 | 
			
		||||
      <UnitPath Value="$(PkgOutDir)"/>
 | 
			
		||||
    </UsageOptions>
 | 
			
		||||
    <PublishOptions>
 | 
			
		||||
      <Version Value="2"/>
 | 
			
		||||
    </PublishOptions>
 | 
			
		||||
  </Package>
 | 
			
		||||
</CONFIG>
 | 
			
		||||
							
								
								
									
										22
									
								
								components/pas2js/pas2jsdsgn.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								components/pas2js/pas2jsdsgn.pas
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
			
		||||
{ This file was automatically created by Lazarus. Do not edit!
 | 
			
		||||
  This source is only used to compile and install the package.
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
unit Pas2JSDsgn;
 | 
			
		||||
 | 
			
		||||
{$warn 5023 off : no warning about unused units}
 | 
			
		||||
interface
 | 
			
		||||
 | 
			
		||||
uses
 | 
			
		||||
  PJSDsgnRegister, LazarusPackageIntf;
 | 
			
		||||
 | 
			
		||||
implementation
 | 
			
		||||
 | 
			
		||||
procedure Register;
 | 
			
		||||
begin
 | 
			
		||||
  RegisterUnit('PJSDsgnRegister', @PJSDsgnRegister.Register);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
initialization
 | 
			
		||||
  RegisterPackage('Pas2JSDsgn', @Register);
 | 
			
		||||
end.
 | 
			
		||||
							
								
								
									
										206
									
								
								components/pas2js/pjsdsgnregister.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										206
									
								
								components/pas2js/pjsdsgnregister.pas
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,206 @@
 | 
			
		||||
unit PJSDsgnRegister;
 | 
			
		||||
 | 
			
		||||
{$mode objfpc}{$H+}
 | 
			
		||||
 | 
			
		||||
interface
 | 
			
		||||
 | 
			
		||||
uses
 | 
			
		||||
  Classes, SysUtils, ProjectIntf, CompOptsIntf, LazIDEIntf, Forms, Controls;
 | 
			
		||||
 | 
			
		||||
const
 | 
			
		||||
  ProjDescNamePas2JSWebApp = 'Web Application';
 | 
			
		||||
  ProjDescNamePas2JSNodeJSApp = 'NodeJS Application';
 | 
			
		||||
 | 
			
		||||
resourcestring
 | 
			
		||||
  pjsdWebApplication = 'Web Application';
 | 
			
		||||
  pjsdWebAppDescription = 'A pas2js program running in the browser';
 | 
			
		||||
  pjsdNodeJSApplication = 'Node.js Application';
 | 
			
		||||
  pjsdNodeJSAppDescription = 'A pas2js program running in node.js';
 | 
			
		||||
 | 
			
		||||
type
 | 
			
		||||
 | 
			
		||||
  { TProjectPas2JSWebApp }
 | 
			
		||||
 | 
			
		||||
  TProjectPas2JSWebApp = class(TProjectDescriptor)
 | 
			
		||||
  public
 | 
			
		||||
    constructor Create; override;
 | 
			
		||||
    function GetLocalizedName: string; override;
 | 
			
		||||
    function GetLocalizedDescription: string; override;
 | 
			
		||||
    function InitProject(AProject: TLazProject): TModalResult; override;
 | 
			
		||||
    function CreateStartFiles(AProject: TLazProject): TModalResult; override;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
  { TProjectPas2JSNodeJSApp }
 | 
			
		||||
 | 
			
		||||
  TProjectPas2JSNodeJSApp = class(TProjectDescriptor)
 | 
			
		||||
  public
 | 
			
		||||
    constructor Create; override;
 | 
			
		||||
    function GetLocalizedName: string; override;
 | 
			
		||||
    function GetLocalizedDescription: string; override;
 | 
			
		||||
    function InitProject(AProject: TLazProject): TModalResult; override;
 | 
			
		||||
    function CreateStartFiles(AProject: TLazProject): TModalResult; override;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
procedure Register;
 | 
			
		||||
 | 
			
		||||
implementation
 | 
			
		||||
 | 
			
		||||
procedure Register;
 | 
			
		||||
begin
 | 
			
		||||
  RegisterProjectDescriptor(TProjectPas2JSWebApp.Create);
 | 
			
		||||
  RegisterProjectDescriptor(TProjectPas2JSNodeJSApp.Create);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{ TProjectPas2JSNodeJSApp }
 | 
			
		||||
 | 
			
		||||
constructor TProjectPas2JSNodeJSApp.Create;
 | 
			
		||||
begin
 | 
			
		||||
  inherited Create;
 | 
			
		||||
  Name:=ProjDescNamePas2JSWebApp;
 | 
			
		||||
  Flags:=DefaultProjectNoApplicationFlags-[pfRunnable];
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSNodeJSApp.GetLocalizedName: string;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=pjsdNodeJSApplication;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSNodeJSApp.GetLocalizedDescription: string;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=pjsdNodeJSAppDescription;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSNodeJSApp.InitProject(AProject: TLazProject
 | 
			
		||||
  ): TModalResult;
 | 
			
		||||
var
 | 
			
		||||
  MainFile: TLazProjectFile;
 | 
			
		||||
  CompOpts: TLazCompilerOptions;
 | 
			
		||||
  NewSource: String;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=inherited InitProject(AProject);
 | 
			
		||||
 | 
			
		||||
  MainFile:=AProject.CreateProjectFile('project1.lpr');
 | 
			
		||||
  MainFile.IsPartOfProject:=true;
 | 
			
		||||
  AProject.AddFile(MainFile,false);
 | 
			
		||||
  AProject.MainFileID:=0;
 | 
			
		||||
 | 
			
		||||
  CompOpts:=AProject.LazCompilerOptions;
 | 
			
		||||
  CompOpts.TargetFilename:='program1';
 | 
			
		||||
  CompOpts.Win32GraphicApp:=false;
 | 
			
		||||
  CompOpts.UnitOutputDirectory:='js';
 | 
			
		||||
  CompOpts.TargetFilename:='project1';
 | 
			
		||||
  CompOpts.SetAlternativeCompile(
 | 
			
		||||
    '$MakeExe(pas2js) -Jc -Jminclude -Tnodejs "-Fu$(ProjUnitPath)" $Name($(ProjFile))',true);
 | 
			
		||||
 | 
			
		||||
  // create program source
 | 
			
		||||
  NewSource:='program Project1;'+LineEnding
 | 
			
		||||
    +LineEnding
 | 
			
		||||
    +'{$mode objfpc}'+LineEnding
 | 
			
		||||
    +LineEnding
 | 
			
		||||
    +'uses'+LineEnding
 | 
			
		||||
    +'  NodeJS, JS, Classes, SysUtils;'+LineEnding
 | 
			
		||||
    +LineEnding
 | 
			
		||||
    +'begin'+LineEnding
 | 
			
		||||
    +'end.'+LineEnding
 | 
			
		||||
    +LineEnding;
 | 
			
		||||
  AProject.MainFile.SetSourceText(NewSource,true);
 | 
			
		||||
 | 
			
		||||
  AProject.AddPackageDependency('pas2js_rtl');
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSNodeJSApp.CreateStartFiles(AProject: TLazProject
 | 
			
		||||
  ): TModalResult;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1,
 | 
			
		||||
                                      [ofProjectLoading,ofRegularFile]);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{ TProjectPas2JSWebApp }
 | 
			
		||||
 | 
			
		||||
constructor TProjectPas2JSWebApp.Create;
 | 
			
		||||
begin
 | 
			
		||||
  inherited Create;
 | 
			
		||||
  Name:=ProjDescNamePas2JSWebApp;
 | 
			
		||||
  Flags:=DefaultProjectNoApplicationFlags-[pfRunnable];
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSWebApp.GetLocalizedName: string;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=pjsdWebApplication;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSWebApp.GetLocalizedDescription: string;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=pjsdWebAppDescription;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSWebApp.InitProject(AProject: TLazProject): TModalResult;
 | 
			
		||||
var
 | 
			
		||||
  MainFile, HTMLFile: TLazProjectFile;
 | 
			
		||||
  CompOpts: TLazCompilerOptions;
 | 
			
		||||
  NewSource: String;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=inherited InitProject(AProject);
 | 
			
		||||
 | 
			
		||||
  MainFile:=AProject.CreateProjectFile('project1.lpr');
 | 
			
		||||
  MainFile.IsPartOfProject:=true;
 | 
			
		||||
  AProject.AddFile(MainFile,false);
 | 
			
		||||
  AProject.MainFileID:=0;
 | 
			
		||||
 | 
			
		||||
  CompOpts:=AProject.LazCompilerOptions;
 | 
			
		||||
  CompOpts.TargetFilename:='program1';
 | 
			
		||||
  CompOpts.Win32GraphicApp:=false;
 | 
			
		||||
  CompOpts.UnitOutputDirectory:='js';
 | 
			
		||||
  CompOpts.TargetFilename:='project1';
 | 
			
		||||
  CompOpts.SetAlternativeCompile(
 | 
			
		||||
    '$MakeExe(pas2js) -Jc -Jminclude -Tbrowser "-Fu$(ProjUnitPath)" $Name($(ProjFile))',true);
 | 
			
		||||
 | 
			
		||||
  // create program source
 | 
			
		||||
  NewSource:='program Project1;'+LineEnding
 | 
			
		||||
    +LineEnding
 | 
			
		||||
    +'{$mode objfpc}'+LineEnding
 | 
			
		||||
    +LineEnding
 | 
			
		||||
    +'uses'+LineEnding
 | 
			
		||||
    +'  JS, Classes, SysUtils, Web;'+LineEnding
 | 
			
		||||
    +LineEnding
 | 
			
		||||
    +'begin'+LineEnding
 | 
			
		||||
    +'end.'+LineEnding
 | 
			
		||||
    +LineEnding;
 | 
			
		||||
  AProject.MainFile.SetSourceText(NewSource,true);
 | 
			
		||||
 | 
			
		||||
  HTMLFile:=AProject.CreateProjectFile('project1.html');
 | 
			
		||||
  HTMLFile.IsPartOfProject:=true;
 | 
			
		||||
  AProject.AddFile(HTMLFile,false);
 | 
			
		||||
  // create html source
 | 
			
		||||
  NewSource:=
 | 
			
		||||
     '<!doctype html>'+LineEnding
 | 
			
		||||
    +'<html lang="en">'+LineEnding
 | 
			
		||||
    +'<head>'+LineEnding
 | 
			
		||||
    +'  <meta charset="utf-8">'+LineEnding
 | 
			
		||||
    +'  <title>Project1</title>'+LineEnding
 | 
			
		||||
    +'<style>'+LineEnding
 | 
			
		||||
    +'<script src="project1.js"></script>'+LineEnding
 | 
			
		||||
    +'</head>'+LineEnding
 | 
			
		||||
    +'<div>Project1</div>'+LineEnding
 | 
			
		||||
    +'<script>'+LineEnding
 | 
			
		||||
    +'  rtl.run();'+LineEnding
 | 
			
		||||
    +'</script>'+LineEnding
 | 
			
		||||
    +'<body>'+LineEnding;
 | 
			
		||||
  HTMLFile.SetSourceText(NewSource);
 | 
			
		||||
 | 
			
		||||
  AProject.AddPackageDependency('pas2js_rtl');
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
function TProjectPas2JSWebApp.CreateStartFiles(AProject: TLazProject
 | 
			
		||||
  ): TModalResult;
 | 
			
		||||
begin
 | 
			
		||||
  Result:=LazarusIDE.DoOpenEditorFile(AProject.MainFile.Filename,-1,-1,
 | 
			
		||||
                                      [ofProjectLoading,ofRegularFile]);
 | 
			
		||||
  if Result<>mrOK then exit;
 | 
			
		||||
  Result:=LazarusIDE.DoOpenEditorFile('project1.html',-1,-1,
 | 
			
		||||
                                      [ofProjectLoading,ofRegularFile]);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
end.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								packager/globallinks/pas2jsdsgn-1.0.1.lpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								packager/globallinks/pas2jsdsgn-1.0.1.lpl
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
$(LazarusDir)/components/pas2js/pas2jsdsgn.lpk
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user