mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 22:47:59 +02:00
* Added JSON to pascal converter
git-svn-id: trunk@35296 -
This commit is contained in:
parent
f85466b013
commit
e6000e88d1
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2516,13 +2516,17 @@ packages/fcl-json/fpmake.pp svneol=native#text/plain
|
||||
packages/fcl-json/src/README.txt svneol=native#text/plain
|
||||
packages/fcl-json/src/fpjson.pp svneol=native#text/plain
|
||||
packages/fcl-json/src/fpjsonrtti.pp svneol=native#text/plain
|
||||
packages/fcl-json/src/fpjsontopas.pp svneol=native#text/plain
|
||||
packages/fcl-json/src/jsonconf.pp svneol=native#text/plain
|
||||
packages/fcl-json/src/jsonparser.pp svneol=native#text/plain
|
||||
packages/fcl-json/src/jsonscanner.pp svneol=native#text/plain
|
||||
packages/fcl-json/tests/jsonconftest.pp svneol=native#text/plain
|
||||
packages/fcl-json/tests/tcjsontocode.pp svneol=native#text/plain
|
||||
packages/fcl-json/tests/testcomps.pp svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjson.lpi svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjson.pp svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjson2code.lpi svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjson2code.lpr svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjsonconf.lpi svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjsonconf.pp svneol=native#text/plain
|
||||
packages/fcl-json/tests/testjsondata.pp svneol=native#text/plain
|
||||
|
@ -31,31 +31,42 @@ begin
|
||||
P.SourcePath.Add('src');
|
||||
|
||||
T:=P.Targets.AddUnit('fpjson.pp');
|
||||
T.ResourceStrings:=true;
|
||||
T.ResourceStrings:=true;
|
||||
|
||||
T:=P.Targets.AddUnit('jsonconf.pp');
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonparser');
|
||||
end;
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonparser');
|
||||
end;
|
||||
|
||||
T:=P.Targets.AddUnit('jsonparser.pp');
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonscanner');
|
||||
end;
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonscanner');
|
||||
end;
|
||||
|
||||
T:=P.Targets.AddUnit('jsonscanner.pp');
|
||||
T.ResourceStrings:=true;
|
||||
T.ResourceStrings:=true;
|
||||
|
||||
T:=P.Targets.AddUnit('fpjsonrtti.pp');
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonparser');
|
||||
end;
|
||||
T.ResourceStrings:=true;
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonparser');
|
||||
end;
|
||||
|
||||
T:=P.Targets.AddUnit('fpjsontopas.pp');
|
||||
T.ResourceStrings:=true;
|
||||
with T.Dependencies do
|
||||
begin
|
||||
AddUnit('fpjson');
|
||||
AddUnit('jsonparser');
|
||||
end;
|
||||
|
||||
P.ExamplePath.Add('examples');
|
||||
T:=P.Targets.AddExampleProgram('confdemo.pp');
|
||||
|
1279
packages/fcl-json/src/fpjsontopas.pp
Normal file
1279
packages/fcl-json/src/fpjsontopas.pp
Normal file
File diff suppressed because it is too large
Load Diff
2422
packages/fcl-json/tests/tcjsontocode.pp
Normal file
2422
packages/fcl-json/tests/tcjsontocode.pp
Normal file
File diff suppressed because it is too large
Load Diff
70
packages/fcl-json/tests/testjson2code.lpi
Normal file
70
packages/fcl-json/tests/testjson2code.lpi
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="testjson2code"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<CommandLineParams Value="--suite=TestLoadObjectProperty"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="testjson2code.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="tcjsontocode.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../src/fpjsontopas.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="../src"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
52
packages/fcl-json/tests/testjson2code.lpr
Normal file
52
packages/fcl-json/tests/testjson2code.lpr
Normal file
@ -0,0 +1,52 @@
|
||||
program testjson2code;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, consoletestrunner, tcjsontocode, fpjsontopas;
|
||||
|
||||
type
|
||||
|
||||
{ TLazTestRunner }
|
||||
|
||||
{ TMyTestRunner }
|
||||
|
||||
TMyTestRunner = class(TTestRunner)
|
||||
protected
|
||||
function GetShortOpts: string; override;
|
||||
procedure AppendLongOpts; override;
|
||||
procedure DoRun; override;
|
||||
end;
|
||||
|
||||
var
|
||||
Application: TMyTestRunner;
|
||||
|
||||
{ TMyTestRunner }
|
||||
|
||||
function TMyTestRunner.GetShortOpts: string;
|
||||
begin
|
||||
Result:=inherited GetShortOpts;
|
||||
Result:=Result+'t:';
|
||||
end;
|
||||
|
||||
procedure TMyTestRunner.AppendLongOpts;
|
||||
begin
|
||||
inherited AppendLongOpts;
|
||||
LongOpts.Add('testunitdir:');
|
||||
end;
|
||||
|
||||
procedure TMyTestRunner.DoRun;
|
||||
begin
|
||||
TestUnitDir:=GetOptionValue('t','testunitdir');
|
||||
inherited DoRun;
|
||||
end;
|
||||
|
||||
begin
|
||||
DefaultFormat:=fPlain;
|
||||
DefaultRunAllTests:=True;
|
||||
Application := TMyTestRunner.Create(nil);
|
||||
Application.Initialize;
|
||||
Application.Title := 'FPCUnit Console test runner';
|
||||
Application.Run;
|
||||
Application.Free;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user