mORMot and Open Source friends
Check-in [4e2cad5b70]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:SynProject updated to version 1.9:
  • handle more than one recursivity level for =[section] include in document
  • fix error displaying the Refers (RK) items without the description in the paragraph title
  • "\TableImplements=ISO-LIS Simulator" syntax to ignore any "\Implements ISO ..." in [LIS-Simulator] document
  • new extended e.g. \TableRK=1,2,3 syntax, similar to \TableDI=...
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4e2cad5b707c422fd1bb14532d73de26770f921a
User & Date: ab 2010-09-30 12:40:47
Context
2010-10-14
17:13
SQLite3 c core engine updated to version 3.7.3 check-in: b38f6f8fb6 user: ab tags: trunk
2010-09-30
12:40
SynProject updated to version 1.9:
  • handle more than one recursivity level for =[section] include in document
  • fix error displaying the Refers (RK) items without the description in the paragraph title
  • "\TableImplements=ISO-LIS Simulator" syntax to ignore any "\Implements ISO ..." in [LIS-Simulator] document
  • new extended e.g. \TableRK=1,2,3 syntax, similar to \TableDI=...
check-in: 4e2cad5b70 user: ab tags: trunk
2010-09-27
07:56
added missing SQLite3UIEdit.dfm in repository check-in: b90d6094e4 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynProject/ProjectSections.pas.

59
60
61
62
63
64
65

66
67
68
69
70
71
72
..
86
87
88
89
90
91
92




93
94
95
96
97
98
99
100
101
102
...
390
391
392
393
394
395
396




397
398
399
400

401
402
403
404
405
406
407
408
409


410
411
412
413
414
415
416
    function CSVValueContains(const aName, aValue: string): boolean;
    procedure Clear;
    function ReadString(const aName, aDefault: string): string;
    function ReadInteger(const aName: string; aDefault: integer): integer;
    /// e.g. 'SWRS'
    function ItemName: string;
    function DocName: string;

    function DisplayName(Doc: TSection): string;
    function Description: string;
    function ShortDescription(const layout: string): string;
    function PreparedBy: string;
    function RevisionDate: string;
    function Risk: string;
    function Hint: string; // for display
................................................................................
    procedure SetItem(Index: Integer; const Value: TSection);
  public
    property Items[Index: Integer]: TSection read GetItem write SetItem; default;
  end;

  TSectionsStorage = class
  private




    ReaderSection, ReaderSectionPushed: TSection;
    ReaderIndex, ReaderIndexPushed: integer;
    ReaderValue, ReaderValuePushed: string;
    //FCacheName: string;
    //FCacheValue: TSection;
    procedure ReaderNextLine(noIgnore: boolean = false);
    function GetSectionIndex(const aSection: string): integer;
    function GetSection(const aSection: string): TSection;
    function GetText: string;
    procedure SetText(const Value: string);
................................................................................
      until ReadEof;
  end else
    ReaderIndex := -1;
end;

procedure TSectionsStorage.ReadPop;
begin




  ReaderSection := ReaderSectionPushed;
  ReaderIndex := ReaderIndexPushed;
  ReaderValue := ReaderValuePushed;
  ReaderSectionPushed := nil;

end;

procedure TSectionsStorage.ReadPush;
begin
  assert(ReaderSectionPushed=nil);
  if ReaderSectionPushed<>nil then exit; // stack of size 1 (enough till now)
  ReaderSectionPushed := ReaderSection;
  ReaderIndexPushed := ReaderIndex;
  ReaderValuePushed := ReaderValue;


end;

function TSectionsStorage.ReadString(const aSection, aName, aDefault: string): string;
begin
  result := Section[aSection].ReadString(aName,aDefault);
end;







>







 







>
>
>
>
|
|
|







 







>
>
>
>
|
|
|
<
>




|
<
|
|
|
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
395
396
397
398
399
400
401
402
403
404
405
406
407
408

409
410
411
412
413
414

415
416
417
418
419
420
421
422
423
424
425
426
    function CSVValueContains(const aName, aValue: string): boolean;
    procedure Clear;
    function ReadString(const aName, aDefault: string): string;
    function ReadInteger(const aName: string; aDefault: integer): integer;
    /// e.g. 'SWRS'
    function ItemName: string;
    function DocName: string;
    // [SRS] -> 'SWRS', [SRS-DI-4.7.1] -> 'SWRS # DI-4.7.1'
    function DisplayName(Doc: TSection): string;
    function Description: string;
    function ShortDescription(const layout: string): string;
    function PreparedBy: string;
    function RevisionDate: string;
    function Risk: string;
    function Hint: string; // for display
................................................................................
    procedure SetItem(Index: Integer; const Value: TSection);
  public
    property Items[Index: Integer]: TSection read GetItem write SetItem; default;
  end;

  TSectionsStorage = class
  private
    ReaderSection: TSection;
    ReaderIndex: integer;
    ReaderValue: string;
    PushIndex: integer;
    ReaderSectionPushed: array[0..2] of TSection;
    ReaderIndexPushed: array[0..2] of integer;
    ReaderValuePushed: array[0..2] of string;
    //FCacheName: string;
    //FCacheValue: TSection;
    procedure ReaderNextLine(noIgnore: boolean = false);
    function GetSectionIndex(const aSection: string): integer;
    function GetSection(const aSection: string): TSection;
    function GetText: string;
    procedure SetText(const Value: string);
................................................................................
      until ReadEof;
  end else
    ReaderIndex := -1;
end;

procedure TSectionsStorage.ReadPop;
begin
  if PushIndex<=0 then
    exit;
  dec(PushIndex);
  if PushIndex<=high(ReaderSectionPushed) then begin
    ReaderSection := ReaderSectionPushed[PushIndex];
    ReaderIndex := ReaderIndexPushed[PushIndex];
    ReaderValue := ReaderValuePushed[PushIndex];

  end;
end;

procedure TSectionsStorage.ReadPush;
begin
  if PushIndex<=high(ReaderSectionPushed) then begin

    ReaderSectionPushed[PushIndex] := ReaderSection;
    ReaderIndexPushed[PushIndex] := ReaderIndex;
    ReaderValuePushed[PushIndex] := ReaderValue;
  end;
  inc(PushIndex);
end;

function TSectionsStorage.ReadString(const aSection, aName, aDefault: string): string;
begin
  result := Section[aSection].ReadString(aName,aDefault);
end;

Changes to SynProject/ProjectTypes.pas.

1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
....
1741
1742
1743
1744
1745
1746
1747



1748
1749
1750
1751
1752
1753
1754
1755
....
2998
2999
3000
3001
3002
3003
3004
3005
3006






3007
3008
3009
3010
3011
3012
3013
3014


3015
3016
3017
3018
3019
3020
3021
....
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
....
3191
3192
3193
3194
3195
3196
3197
3198


3199













3200
3201
3202
3203
3204
3205
3206
    result := result+WR.RtfFontString(120);
  result := result+TrimLastPeriod(DIDetails['Ident'])+'}';
end;
procedure AppendBlock(aValue: string; Parent: PDocument);
// aValue='4.2.1' from DILayout (Parent=DI), or '1' for 'RK-1' (Parent=RK)
var j,k: integer;
    U, P: PChar;
    aItemName: string;
begin
  aValue := Parent.Params.SectionName+'-'+aValue; // 'Parent-4.2.1'
  DIDetailsIndex := Parent.GetSectionIndex(aValue);
  if DIDetailsIndex<0 then exit;
  DIDetails := Parent.List[DIDetailsIndex]; // DIDetails = [Parent-4.2.1]
  if Doc.Owner=Parent.Params then begin // Parent or SRS: DIDetails in title
    aLevel := Level+1; // DIDetails.Level; all titles at the same level
................................................................................
  end else begin // SAD,SDD,Test: write every item
     if Parent<>DI then
      aItemName := Parent.Params.ItemName else
      aItemName := Doc.Owner.ItemName;
    for j := 0 to length(Doc.List)-1 do begin // for all items
      Current := Doc.List[j];
      if Current.Root<>DIDetails then continue;



      WR.RtfTitle(aItemName+' # '+Current.SectionNameValue, // SWRS # Parent-4.4
        Level+1,true,Current.SectionNameValue); // BookMark=SectionNameValue='DI-4.3'
      // .TestDoc=[Tests] where DocByDescription=Test
      if Doc.TestDoc<>nil then begin
        if Current['Description']<>'' then begin
          testdesc := Current['Description'];
          TestGetDescr(Current,DIDetails,Doc,testdocname,title1stpart);
        end;
................................................................................
    desc := TableKind;
  end else begin
    desc := copy(TableKind,1,i-1);
    param := copy(TableKind,i+1,maxInt);
  end;
  case CSVIndexOf('SoftwareChanges,TraceabilityMatrix,'+
    'NewFeatures,BugFixes,Tests,Documents,DI,Implements',desc) of
  7: begin // \TableImplements=ISO
    // -> add '\implements ISO 5.1 [blabla][\DocName]' inside any document section






    search := '\IMPLEMENTS '+UpperCase(trim(param))+' ';
    Data.ReadPush;
    TNum := TSection.Create('TableImplementsNum');
    TCaption := TSection.Create('TableImplementsCaption');
    try
      for i := 0 to high(Document) do begin
        // 1. create a list of all '\implements' items, and corresponding sections
        aDoc := @Document[i];


        MainDone := False;
        for j := 0 to Data.Sections.Count-1 do
        if Data.Sections[j].SectionNameKind=aDoc.Params.SectionName then begin
          AddImplements(Data.Sections[j]); // sub paragraphs
          if Data.Sections[j]=aDoc.Params then
            MainDone := True;
        end;
................................................................................
  6: begin // \TableDI=6.3.1.2,6.3.1.3
    P := pointer(param);
    WR.RtfColsPercent([18,82],true,true,false,'\trhdr');
    WR.RtfRow(['\qc\b '+sItemSharp, '\qc '+sDescription+'\b0'],true);
    WR.RtfColsPercent([18,82],true,true,false,'\trkeep');
    while P<>nil do begin
      i := DI.GetSectionIndex('DI-'+GetNextItem(P));
      if i>0 then
        with DI.List[i] do
          WR.RtfRow(['\qc '+SectionNameValueWithDI,'\ql '+Value['Ident']]);
    end;
    WR.RtfColsEnd.RtfPar;
  end;
  0: begin // \TableSoftwareChanges (for SCRS)
    if not InitDescri then exit;
................................................................................
    if (param='') or CSVContains(param,Params.SectionName) then
      WR.RtfRow(['\ql '+Params['Name'],'\qc '+Params['Revision'],
        '{'+WR.RtfFontString(91)+Params.RevisionDate+'}',Params.ItemName,
        '\ql{'+WR.RtfFontString(91)+Project.ReadString('DocName',Project['Name'])+
        ' '+Params.DocName+'.doc}']);
    WR.RtfColsEnd.RtfPar;
  end;
  -1:


    WR.RtfText.Rtf('Unkwnown command: \Table'+TableKind).RtfPar;













  end;
end;

procedure TProject.NeedGraphValues;
begin
  if fGraphValues=nil then begin // we need our copy of the GraphValues file
    fGraphValues := TSection.Create('GraphValues');






|







 







>
>
>
|







 







|

>
>
>
>
>
>








>
>







 







|







 







|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>







1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
....
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
....
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
....
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
....
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
    result := result+WR.RtfFontString(120);
  result := result+TrimLastPeriod(DIDetails['Ident'])+'}';
end;
procedure AppendBlock(aValue: string; Parent: PDocument);
// aValue='4.2.1' from DILayout (Parent=DI), or '1' for 'RK-1' (Parent=RK)
var j,k: integer;
    U, P: PChar;
    aItemName, aItemTitle: string;
begin
  aValue := Parent.Params.SectionName+'-'+aValue; // 'Parent-4.2.1'
  DIDetailsIndex := Parent.GetSectionIndex(aValue);
  if DIDetailsIndex<0 then exit;
  DIDetails := Parent.List[DIDetailsIndex]; // DIDetails = [Parent-4.2.1]
  if Doc.Owner=Parent.Params then begin // Parent or SRS: DIDetails in title
    aLevel := Level+1; // DIDetails.Level; all titles at the same level
................................................................................
  end else begin // SAD,SDD,Test: write every item
     if Parent<>DI then
      aItemName := Parent.Params.ItemName else
      aItemName := Doc.Owner.ItemName;
    for j := 0 to length(Doc.List)-1 do begin // for all items
      Current := Doc.List[j];
      if Current.Root<>DIDetails then continue;
      aItemTitle := Current.Description;
      if aItemTitle<>'' then
        aItemTitle := '\line '+aItemTitle;
      WR.RtfTitle(aItemName+' # '+Current.SectionNameValue+aItemTitle, // SWRS # Parent-4.4
        Level+1,true,Current.SectionNameValue); // BookMark=SectionNameValue='DI-4.3'
      // .TestDoc=[Tests] where DocByDescription=Test
      if Doc.TestDoc<>nil then begin
        if Current['Description']<>'' then begin
          testdesc := Current['Description'];
          TestGetDescr(Current,DIDetails,Doc,testdocname,title1stpart);
        end;
................................................................................
    desc := TableKind;
  end else begin
    desc := copy(TableKind,1,i-1);
    param := copy(TableKind,i+1,maxInt);
  end;
  case CSVIndexOf('SoftwareChanges,TraceabilityMatrix,'+
    'NewFeatures,BugFixes,Tests,Documents,DI,Implements',desc) of
  7: begin // \TableImplements=ISO-LIS Simulator
    // -> add '\implements ISO 5.1 [blabla][\DocName]' inside any document section
    i := pos('-',param);
    if i>0 then begin
      desc := copy(param,i+1,maxInt); // desc='LIS Simulator' will be ignored
      param := copy(param,1,i-1);
    end else
      desc := '';
    search := '\IMPLEMENTS '+UpperCase(trim(param))+' ';
    Data.ReadPush;
    TNum := TSection.Create('TableImplementsNum');
    TCaption := TSection.Create('TableImplementsCaption');
    try
      for i := 0 to high(Document) do begin
        // 1. create a list of all '\implements' items, and corresponding sections
        aDoc := @Document[i];
        if (desc<>'') and (CSVIndexOf(desc,aDoc.Params.SectionName)>=0) then
          Continue; // \TableImplements=ISO-LIS Simulator -> ignore [LIS Simulator]
        MainDone := False;
        for j := 0 to Data.Sections.Count-1 do
        if Data.Sections[j].SectionNameKind=aDoc.Params.SectionName then begin
          AddImplements(Data.Sections[j]); // sub paragraphs
          if Data.Sections[j]=aDoc.Params then
            MainDone := True;
        end;
................................................................................
  6: begin // \TableDI=6.3.1.2,6.3.1.3
    P := pointer(param);
    WR.RtfColsPercent([18,82],true,true,false,'\trhdr');
    WR.RtfRow(['\qc\b '+sItemSharp, '\qc '+sDescription+'\b0'],true);
    WR.RtfColsPercent([18,82],true,true,false,'\trkeep');
    while P<>nil do begin
      i := DI.GetSectionIndex('DI-'+GetNextItem(P));
      if i>=0 then
        with DI.List[i] do
          WR.RtfRow(['\qc '+SectionNameValueWithDI,'\ql '+Value['Ident']]);
    end;
    WR.RtfColsEnd.RtfPar;
  end;
  0: begin // \TableSoftwareChanges (for SCRS)
    if not InitDescri then exit;
................................................................................
    if (param='') or CSVContains(param,Params.SectionName) then
      WR.RtfRow(['\ql '+Params['Name'],'\qc '+Params['Revision'],
        '{'+WR.RtfFontString(91)+Params.RevisionDate+'}',Params.ItemName,
        '\ql{'+WR.RtfFontString(91)+Project.ReadString('DocName',Project['Name'])+
        ' '+Params.DocName+'.doc}']);
    WR.RtfColsEnd.RtfPar;
  end;
  -1: begin
    aDoc := DocumentFind(desc); // try \TableRK=1,2,3,4,5,6
    if (aDoc=nil) or (param='') then
      WR.RtfText.Rtf('Unkwnown command: \Table'+TableKind).RtfPar else begin
      P := pointer(param);
      WR.RtfColsPercent([18,82],true,true,false,'\trhdr');
      WR.RtfRow(['\qc\b '+sItemSharp, '\qc '+sDescription+'\b0'],true);
      WR.RtfColsPercent([18,82],true,true,false,'\trkeep');
      while P<>nil do begin
        i := aDoc.GetSectionIndex(desc+'-'+GetNextItem(P)); // get e.g. [RK-1]
        if i>=0 then
          with aDoc.List[i] do
            WR.RtfRow(['\qc '+SectionNameValueWithDI,'\ql '+Description]);
      end;
      WR.RtfColsEnd.RtfPar;
    end;
  end;
  end;
end;

procedure TProject.NeedGraphValues;
begin
  if fGraphValues=nil then begin // we need our copy of the GraphValues file
    fGraphValues := TSection.Create('GraphValues');