Skip to content

Commit

Permalink
pipelines logic mprovements (#14)
Browse files Browse the repository at this point in the history
pipeline logics rewrite with compositions
  • Loading branch information
malstraem authored Nov 28, 2024
1 parent 2fdeaef commit 093e32a
Show file tree
Hide file tree
Showing 115 changed files with 762 additions and 768 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x
- name: Generate Pages
run: |
dotnet tool update -g docfx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-version: 9.x
- name: Create Package
run: dotnet pack --tl
- name: Push to NuGet
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- run: dotnet build -c release --tl
dotnet-version: |
8.x
9.x
- run: dotnet build -c release
- run: dotnet test -c release --no-build
runs-on: ubuntu-latest
5 changes: 3 additions & 2 deletions Arinc424.sln
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ Global
{342A9F66-58E0-4583-ABD4-FBA7C553FBFF}.Release|x86.ActiveCfg = Release|x86
{342A9F66-58E0-4583-ABD4-FBA7C553FBFF}.Release|x86.Build.0 = Release|x86
{A3AC33B6-1C87-453A-A6A8-39A2A17CEF24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3AC33B6-1C87-453A-A6A8-39A2A17CEF24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3AC33B6-1C87-453A-A6A8-39A2A17CEF24}.Debug|ARM32.ActiveCfg = Debug|ARM32
{A3AC33B6-1C87-453A-A6A8-39A2A17CEF24}.Debug|ARM32.Build.0 = Debug|ARM32
{A3AC33B6-1C87-453A-A6A8-39A2A17CEF24}.Debug|ARM64.ActiveCfg = Debug|ARM64
Expand Down Expand Up @@ -114,6 +113,7 @@ Global
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.Debug|x86.ActiveCfg = Debug|x86
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.Debug|x86.Build.0 = Debug|x86
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.NoParallel|Any CPU.ActiveCfg = NoParallel|Any CPU
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.NoParallel|Any CPU.Build.0 = NoParallel|Any CPU
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.NoParallel|ARM32.ActiveCfg = Debug|ARM32
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.NoParallel|ARM64.ActiveCfg = Debug|ARM64
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.NoParallel|x64.ActiveCfg = Debug|x64
Expand All @@ -130,7 +130,6 @@ Global
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.Release|x86.ActiveCfg = Release|x86
{AF48F5D2-D2BE-41FC-95D5-AB425BBA3388}.Release|x86.Build.0 = Release|x86
{A1DF49EA-81E4-4AC2-8AF3-5C8F36424815}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A1DF49EA-81E4-4AC2-8AF3-5C8F36424815}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A1DF49EA-81E4-4AC2-8AF3-5C8F36424815}.Debug|ARM32.ActiveCfg = Debug|ARM32
{A1DF49EA-81E4-4AC2-8AF3-5C8F36424815}.Debug|ARM32.Build.0 = Debug|ARM32
{A1DF49EA-81E4-4AC2-8AF3-5C8F36424815}.Debug|ARM64.ActiveCfg = Debug|ARM64
Expand Down Expand Up @@ -200,6 +199,7 @@ Global
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.Debug|x86.ActiveCfg = Debug|x86
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.Debug|x86.Build.0 = Debug|x86
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.NoParallel|Any CPU.ActiveCfg = NoParallel|Any CPU
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.NoParallel|Any CPU.Build.0 = NoParallel|Any CPU
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.NoParallel|ARM32.ActiveCfg = Debug|ARM32
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.NoParallel|ARM64.ActiveCfg = Debug|ARM64
{989FABB9-3676-4746-AE8C-F14369DCDCBA}.NoParallel|x64.ActiveCfg = Debug|x64
Expand All @@ -225,6 +225,7 @@ Global
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.Debug|x86.ActiveCfg = Debug|x86
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.Debug|x86.Build.0 = Debug|x86
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.NoParallel|Any CPU.ActiveCfg = NoParallel|Any CPU
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.NoParallel|Any CPU.Build.0 = NoParallel|Any CPU
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.NoParallel|ARM32.ActiveCfg = Debug|ARM32
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.NoParallel|ARM64.ActiveCfg = Debug|ARM64
{8236EEB2-1AA0-4DF8-9596-1C21D50E9462}.NoParallel|x64.ActiveCfg = Debug|x64
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<Configurations>Debug;Release;NoParallel</Configurations>

<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>

<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
25 changes: 12 additions & 13 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" PrivateAssets="all" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" PrivateAssets="all" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />

<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />

<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2"
PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.0-pre.49" />

<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />

<PackageVersion Include="Docfx.App" Version="2.77.0" />
<PackageVersion Include="Docfx.App" Version="2.78.1" />

<PackageVersion Include="Avalonia" Version="11.1.3" />
<PackageVersion Include="Avalonia.Desktop" Version="11.1.3" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.1.3" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.1.3" />
<PackageVersion Include="Avalonia" Version="11.2.1" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.1" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.1" />
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.1" />

<PackageVersion Include="Semi.Avalonia" Version="11.1.0.4" />
<PackageVersion Include="Irihi.Ursa" Version="1.4.0" />
<PackageVersion Include="Irihi.Ursa.Themes.Semi" Version="1.4.0" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1" />
<PackageVersion Include="Irihi.Ursa" Version="1.6.0" />
<PackageVersion Include="Irihi.Ursa.Themes.Semi" Version="1.6.0.2" />

<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.3.2" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions codegen/Arinc424.Generators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions codegen/CharGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public static bool TryConvert({CharArg}, out {target.Symbol.Name} value)
return builder.Append(@$"
default:
value = {target.Unknown}; return false;
}}").Append($@"
}}");
}}").Append(@"
}");
}

private protected override bool IsMatch(EnumDeclarationSyntax @enum) => @enum.HaveAttribute(CharAttribute);
Expand Down
1 change: 0 additions & 1 deletion codegen/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal static class Constants

internal const string Char = "@char";
internal const string String = "@string";
internal const string Problem = "problem";

internal const string CharArg = "char @char";
internal const string StringArg = "ReadOnlySpan<char> @string";
Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ In practice, this allows you to explore and manipulate the tree-like representat
- [Helipad](api/Arinc424.Ground.Helipad.yml)
- [TAA](api/Arinc424.Ground.ArrivalAltitude.yml)
- [MSA](api/Arinc424.Ground.MinimumAltitude.yml)
- [SBAS Path Point](api/Arinc424.Ground.SatellitePoint.yml) 🚧
- [SBAS Path Point](api/Arinc424.Ground.SatellitePoint.yml)
- [Communication](api/Arinc424.Comms.PortCommunication.yml)

# [Airport](#tab/airport)
Expand Down Expand Up @@ -76,8 +76,8 @@ In practice, this allows you to explore and manipulate the tree-like representat

# [Airspace](#tab/airspace)

- [Controlled Airspace](api/Arinc424.Airspace.ControlledSpace.yml) 🚧
- [FIR/UIR](api/Arinc424.Airspace.FlightRegion.yml) 🚧
- [Restrictive Airspace](api/Arinc424.Airspace.RestrictiveSpace.yml) 🚧
- [Controlled Airspace](api/Arinc424.Airspace.ControlledSpace.yml)
- [FIR/UIR](api/Arinc424.Airspace.FlightRegion.yml)
- [Restrictive Airspace](api/Arinc424.Airspace.RestrictiveSpace.yml)

---
17 changes: 10 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
*work in progress and target on ver. 20 of the specification (with potential up to 23 with backward compatibility)*

*any reviews and PRs are welcome*

*nuget package will be deployed once the API is stabilized*
> [!NOTE]
> *work in progress and target on ver. 23 of the specification (with backward compatibility to 18)*
*any reviews and PRs are welcome, nuget package will be released once the API is stabilized*

*if you see any issues testing the library on real world data, please report it*

# Overview

While the **`ARINC 424`** specification describes entities (*or records*) with 132-byte fixed-length string, this library creates
This is a long-term research and proof of concept to provide a model and reader for the globally used **`ARINC 424`** aircraft navigation data using metaprogramming.

While the **`ARINC 424`** specification describes entities (*or records in terms*) with 132-byte fixed-length strings, this library creates
a database object model via building entities using reflection and runtime compilation.

Most terms are converted according to the specification into associated enumerations or numeric values ​​on the fly.
Expand All @@ -19,7 +22,7 @@ See [docs](https://malstraem.github.io/arinc424.net) to know how specification i

## Build and prerequisites

- .NET 8
- .NET 9 SDK
- `dotnet build`

The project actively uses the Roslyn API to generate converters of specification terms to internal types. Use a suitable IDE to view the generated code.
4 changes: 2 additions & 2 deletions source/library/Data424.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ internal static Dictionary<PropertyInfo, Section> GetProperties()
Dictionary<PropertyInfo, Section> properties = [];

foreach (var property in typeof(Data424).GetProperties())
properties.Add(property, property.GetCustomAttribute<SectionAttribute>()!.Section);
properties.Add(property, property.GetCustomAttribute<SectionAttribute>()!.Value);

return properties;
}

public static Data424 Create(Meta424 meta, IEnumerable<string> strings, out string[] skipped, out Build[] invalid)
public static Data424 Create(Meta424 meta, IEnumerable<string> strings, out Queue<string> skipped, out Queue<Build> invalid)
=> new Parser424(meta).Parse(strings, out skipped, out invalid);

/// <summary>
Expand Down
65 changes: 35 additions & 30 deletions source/library/Meta424.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
Record<HoldingPattern>,
Record<SpecialArea>,

Sequence<Airway, AirwayPoint>,
Sequence<AirwayCommunication, AirwayTransmitter>,
Record<Airway>,
Record<AirwayCommunication>,
#endregion

#region Airport and Heliport
Expand All @@ -52,11 +52,11 @@

Record<InstrumentMarker>,

Sequence<PortCommunication, PortTransmitter>,
Record<PortCommunication>,

Sequence<ArrivalSequence, ArrivalPoint>,
Sequence<ApproachSequence, ApproachPoint>,
Sequence<DepartureSequence, DeparturePoint>,
Record<Arrival>,
Record<Approach>,
Record<Departure>,

Record<Heliport>,

Check warning on line 61 in source/library/Meta424.cs

View workflow job for this annotation

GitHub Actions / tests

'Heliport' is obsolete: 'todo'

Check warning on line 61 in source/library/Meta424.cs

View workflow job for this annotation

GitHub Actions / deploy

'Heliport' is obsolete: 'todo'
#endregion
Expand All @@ -71,13 +71,13 @@
Record<CommunicationType>,

Check warning on line 71 in source/library/Meta424.cs

View workflow job for this annotation

GitHub Actions / tests

'CommunicationType' is obsolete: 'placeholder'

Check warning on line 71 in source/library/Meta424.cs

View workflow job for this annotation

GitHub Actions / deploy

'CommunicationType' is obsolete: 'placeholder'
Record<GeographicalReference>,

Check warning on line 72 in source/library/Meta424.cs

View workflow job for this annotation

GitHub Actions / tests

'GeographicalReference' is obsolete: 'placeholder'

Check warning on line 72 in source/library/Meta424.cs

View workflow job for this annotation

GitHub Actions / deploy

'GeographicalReference' is obsolete: 'placeholder'

Sequence<CruiseTable, CruiseRow>,
Record<CruiseTable>,
#endregion

#region Airspace
Sequence<RegionVolume, RegionPoint>,
Sequence<ControlledVolume, BoundaryPoint>,
Sequence<RestrictiveVolume, BoundaryPoint>,
Record<FlightRegion>,
Record<ControlledSpace>,
Record<RestrictiveSpace>,
#endregion
]
#endregion
Expand All @@ -89,40 +89,45 @@ namespace Arinc424;
/// </summary>
public class Meta424
{
private Meta424(RecordInfo[] info, FrozenDictionary<Section, Type> types, FrozenDictionary<Type, RecordInfo> typeInfo)
{
Info = info;
Types = types;
TypeInfo = typeInfo;
}

/// <summary>
/// Creates metadata using target <paramref name="supplement"/>.
/// </summary>
/// <returns>Runtime compiled metadata.</returns>
[Obsolete("todo: supplement versioning (v18 - v23)")]
public static Meta424 Create(Supplement supplement)
{
var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes<InfoAttribute>();

var infos = attributes.SelectMany(x => x.GetInfo(supplement)).ToArray();

List<SectionAttribute> sections = [];
Dictionary<Section, Type> types = [];
Dictionary<Type, RecordInfo> typeInfo = [];
Dictionary<Section, RecordInfo> info = [];

foreach (var info in infos)
{
types.Add(info.Section, info.Type);
var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes<RecordAttribute>();

foreach (var attribute in attributes.Select(x => x.GetInfo(supplement)))
{
foreach (var section in attribute.Sections)
{
info.Add(section.Value, attribute);
types.Add(section.Value, attribute.Composition.Top);
sections.Add(section);
}
// types with multiple sections will be stored once
_ = typeInfo.TryAdd(info.Type, info);
_ = typeInfo.TryAdd(attribute.Composition.Top, attribute);
}
return new Meta424(infos, types.ToFrozenDictionary(), typeInfo.ToFrozenDictionary());
return new Meta424()
{
Info = info.ToFrozenDictionary(),
Types = types.ToFrozenDictionary(),
TypeInfo = typeInfo.ToFrozenDictionary(),
Sections = [.. sections]
};
}
#pragma warning disable CS8618
internal SectionAttribute[] Sections { get; init; }

internal RecordInfo[] Info { get; }
internal FrozenDictionary<Section, Type> Types { get; init; }

internal FrozenDictionary<Section, Type> Types { get; }
internal FrozenDictionary<Section, RecordInfo> Info { get; init; }

internal FrozenDictionary<Type, RecordInfo> TypeInfo { get; }
internal FrozenDictionary<Type, RecordInfo> TypeInfo { get; init; }
#pragma warning restore CS8618
}
Loading

0 comments on commit 093e32a

Please sign in to comment.