diff --git a/.codex/hooks.json b/.codex/hooks.json index b10bc053..7d7e4887 100644 --- a/.codex/hooks.json +++ b/.codex/hooks.json @@ -7,7 +7,6 @@ { "type": "command", "command": "bash \"$(git rev-parse --show-toplevel)/.codex/hooks/format-csharp.sh\"", - "commandWindows": "powershell -NoProfile -ExecutionPolicy Bypass -Command \"$root = git rev-parse --show-toplevel; & (Join-Path $root '.codex/hooks/format-csharp.ps1')\"", "timeout": 600, "statusMessage": "Formatting C# with CSharpier" } diff --git a/.codex/hooks/format-csharp.ps1 b/.codex/hooks/format-csharp.ps1 deleted file mode 100644 index 64da3d99..00000000 --- a/.codex/hooks/format-csharp.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -$ErrorActionPreference = "Stop" - -$root = git rev-parse --show-toplevel -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} - -dotnet tool restore --tool-manifest (Join-Path $root "dotnet-tools.json") | Out-Null -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} - -dotnet csharpier format $root -exit $LASTEXITCODE diff --git a/.github/workflows/PrxCi.yml b/.github/workflows/PrxCi.yml index 9c99c785..eb71d015 100644 --- a/.github/workflows/PrxCi.yml +++ b/.github/workflows/PrxCi.yml @@ -15,18 +15,8 @@ on: jobs: build: - strategy: - matrix: - os: - - windows - - linux - include: - - os: windows - build_platform: windows-2022 - - os: linux - build_platform: ubuntu-24.04 - name: Build & Test Prexonite on ${{ matrix.os }} - runs-on: ${{ matrix.build_platform }} + name: Build & Test Prexonite on Linux + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/PrxRelease.yml b/.github/workflows/PrxRelease.yml index 4585d381..54e5f56f 100644 --- a/.github/workflows/PrxRelease.yml +++ b/.github/workflows/PrxRelease.yml @@ -7,24 +7,13 @@ on: jobs: build: - strategy: - matrix: - os: - - windows - - linux - include: - - os: windows - build_platform: windows-2022 - runtime_ident: win-x64 - - os: linux - build_platform: ubuntu-24.04 - runtime_ident: linux-x64 - name: Release Prexonite on ${{ matrix.os }} - runs-on: ${{ matrix.build_platform }} + name: Release Prexonite for Linux + runs-on: ubuntu-24.04 permissions: contents: write # required for creating a release env: DOTNET_NOLOGO: true + RUNTIME_IDENTIFIER: linux-x64 steps: - name: Determine version @@ -37,7 +26,7 @@ jobs: # remove refs/tags/v prefix (11 characters) ver="${ref:11}" echo "Version: $ver" - echo "::set-output name=version::$ver" + echo "version=$ver" >> "$GITHUB_OUTPUT" shell: bash - uses: actions/checkout@v4 - name: Setup .NET SDK @@ -56,39 +45,34 @@ jobs: restore-keys: | ${{ runner.os }}-nuget - name: Install dependencies - run: dotnet restore --runtime ${{ matrix.runtime_ident }} --lock-file-path=./packages.lock.json --verbosity=normal + run: dotnet restore --runtime ${{ env.RUNTIME_IDENTIFIER }} --lock-file-path=./packages.lock.json --verbosity=normal - name: Build run: dotnet build --configuration=Release --no-restore --verbosity=normal -p:Version=${{steps.determine-version.outputs.version}} - name: Test run: dotnet test --configuration=Release --no-restore --no-build --verbosity=normal -p:Version=${{steps.determine-version.outputs.version}} - - name: Pack (windows-only) - if: matrix.os == 'windows' + - name: Pack run: dotnet pack --configuration=Release --no-restore --no-build --verbosity=normal -p:Version=${{steps.determine-version.outputs.version}} - name: Publish - run: dotnet publish --configuration=Release --runtime ${{ matrix.runtime_ident }} --verbosity=normal -p:Version=${{steps.determine-version.outputs.version}} + run: dotnet publish --configuration=Release --runtime ${{ env.RUNTIME_IDENTIFIER }} --verbosity=normal -p:Version=${{steps.determine-version.outputs.version}} - name: Prepare Binary ZIP run: | ver='${{steps.determine-version.outputs.version}}' - cd Prx/bin/Release/net10.0/${{ matrix.runtime_ident }} && \ + cd Prx/bin/Release/net10.0/${{ env.RUNTIME_IDENTIFIER }} && \ mkdir zip-env && \ mv publish "zip-env/prexonite-v$ver" shell: bash - name: Binary ZIP uses: thedoctor0/zip-release@0.6.1 with: - filename: prexonite-v${{steps.determine-version.outputs.version}}-${{ matrix.runtime_ident }}.zip - directory: Prx/bin/Release/net10.0/${{ matrix.runtime_ident }}/zip-env - - name: Push Prexonite Package (windows-only) - if: matrix.os == 'windows' + filename: prexonite-v${{steps.determine-version.outputs.version}}-${{ env.RUNTIME_IDENTIFIER }}.zip + directory: Prx/bin/Release/net10.0/${{ env.RUNTIME_IDENTIFIER }}/zip-env + - name: Push Prexonite Package run: dotnet nuget push Prexonite/bin/Release/Prexonite.${{steps.determine-version.outputs.version}}.nupkg - - name: Push Prexonite Symbols Package (windows-only) - if: matrix.os == 'windows' + - name: Push Prexonite Symbols Package run: dotnet nuget push Prexonite/bin/Release/Prexonite.${{steps.determine-version.outputs.version}}.snupkg - - name: Push Prx Package (windows-only) - if: matrix.os == 'windows' + - name: Push Prx Package run: dotnet nuget push Prx/bin/Release/Prx.${{steps.determine-version.outputs.version}}.nupkg - - name: Push Prx Symbols Package (windows-only) - if: matrix.os == 'windows' + - name: Push Prx Symbols Package run: dotnet nuget push Prx/bin/Release/Prx.${{steps.determine-version.outputs.version}}.snupkg - name: Create Release uses: ncipollo/release-action@v1.10.0 diff --git a/.gitignore b/.gitignore index 175a1d9a..3b0e5cbf 100644 --- a/.gitignore +++ b/.gitignore @@ -73,16 +73,6 @@ _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML -############ -## Windows -############ - -# Windows image file caches -Thumbs.db - -# Folder config file -Desktop.ini - # Ignore merge by-products *.orig @@ -92,6 +82,7 @@ Prexonite/Properties/Resources.Designer.cs # Ignore NuGet packages folder packages/* +.nuget/ codemap/* # Ignore files designated local-only diff --git a/.nuget/CredentialProvider.VSS.exe b/.nuget/CredentialProvider.VSS.exe deleted file mode 100644 index d2f34fd8..00000000 Binary files a/.nuget/CredentialProvider.VSS.exe and /dev/null differ diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config deleted file mode 100644 index 6efc7f7b..00000000 --- a/.nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe deleted file mode 100644 index ec1309c7..00000000 Binary files a/.nuget/NuGet.exe and /dev/null differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets deleted file mode 100644 index 466bc3c3..00000000 --- a/.nuget/NuGet.targets +++ /dev/null @@ -1,185 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - false - - - false - - - true - - - false - - - - - - - - - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) - $([System.IO.Path]::Combine($(SolutionDir), "packages")) - - - - - $(SolutionDir).nuget - packages.config - $(SolutionDir)packages - - - - - $(NuGetToolsPath)\nuget.exe - @(PackageSource) - - "$(NuGetExePath)" - mono --runtime=v4.0.30319 $(NuGetExePath) - - $(TargetDir.Trim('\\')) - - -RequireConsent - - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)" - $(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(ResolveReferencesDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Prexonite/Compiler/Internal/PathSet.cs b/Prexonite/Compiler/Internal/PathSet.cs index b09d2905..15e1f65c 100644 --- a/Prexonite/Compiler/Internal/PathSet.cs +++ b/Prexonite/Compiler/Internal/PathSet.cs @@ -46,7 +46,7 @@ static string canonical(string path) if (!path.StartsWith(ResourceSpec.Prefix)) { path = Path.GetFullPath(path); - if (OperatingSystem.IsMacOS() || OperatingSystem.IsWindows()) + if (OperatingSystem.IsMacOS()) { // PRX-58 This generalization is of course not correct, but there currently is no convenient API // to get a canonical path. diff --git a/Prx/Program.cs b/Prx/Program.cs index d5c6e0f4..8bfaed25 100644 --- a/Prx/Program.cs +++ b/Prx/Program.cs @@ -87,7 +87,7 @@ static void _runApplication(Engine engine, Application app, IEnumerable #region Stopwatch commands - //prx.exe provides these three additional commands for high speed access to a stopwatch from your script code + //prx provides these three additional commands for high speed access to a stopwatch from your script code var timer = new Stopwatch(); engine.Commands.AddHostCommand( @"timer\start", diff --git a/Prx/Prx.csproj b/Prx/Prx.csproj index fc034d8d..411a1c6a 100644 --- a/Prx/Prx.csproj +++ b/Prx/Prx.csproj @@ -18,10 +18,7 @@ true true - win-x64 - linux-x64 + linux-x64 true diff --git a/Prx/SuperConsole.cs b/Prx/SuperConsole.cs index 90cab7f3..940dc3a5 100644 --- a/Prx/SuperConsole.cs +++ b/Prx/SuperConsole.cs @@ -35,7 +35,6 @@ using System.Diagnostics.CodeAnalysis; using System.Text; using System.Threading; -using Prx.Win32; //Removed references to IronPython (-P) @@ -383,10 +382,9 @@ void Insert(ConsoleKeyInfo key) } else { - //c = key.KeyChar; - var us = User32.ToUnicode(key, true); - if (us.Length > 0) - Insert(us[0]); + var character = key.KeyChar; + if (character != '\0') + Insert(character); } } @@ -809,8 +807,7 @@ void MoveEnd() //Made FinalLineText static (-P) - static string FinalLineText => - Environment.OSVersion.Platform != PlatformID.Unix ? "\x1A" : "\x04"; + static string FinalLineText => "\x04"; public void Write(string text, Style style) { diff --git a/Prx/Win32/User32.cs b/Prx/Win32/User32.cs deleted file mode 100644 index 6abaa37e..00000000 --- a/Prx/Win32/User32.cs +++ /dev/null @@ -1,117 +0,0 @@ -#line 28 - -#region Shared Source License - -// The above license text has been added by an automated tool. -// However, for this particular file a different license is in effect: - -/* ********************************************************************************** -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* -* This source code is subject to terms and conditions of the Shared Source License -* for IronPython. A copy of the license can be found in the License.html file -* at the root of this distribution. If you can not locate the Shared Source License -* for IronPython, please send an email to ironpy@microsoft.com. -* By using this source code in any fashion, you are agreeing to be bound by -* the terms of the Shared Source License for IronPython. -* -* You must not remove this notice, or any other, from this software. -* -* **********************************************************************************/ - -#endregion - -/* - * Adaption for use as a general purpose console wrapper. - * Copyright of changes Christian Klauser - * Changes are marked with (-P) - */ - -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace Prx.Win32; - -public static class User32 -{ - const uint VK_SHIFT = 0x10, - VK_CONTROL = 0x11, - VK_ALT = 0x12, - //a.k.a. "VK_MENU" - VK_CAPITAL = 0x14; //CAPS LOCK - - public static string ToUnicode(ConsoleKeyInfo key, bool relaxed) - { - // Intercept Packet keystrokes (unicode characters sent to the console by other applications) (-P) - if (key.Key == ConsoleKey.Packet) - { - return key.KeyChar.ToString(); - } - else - { - const int bufferLength = 16; - var outputBuilder = new StringBuilder(bufferLength); - var modifiers = GetKeyState(key.Modifiers); - var result = ToUnicode((uint)key.Key, 0, modifiers, outputBuilder, bufferLength, 0); - if (result > 0 && result <= outputBuilder.Length) - return outputBuilder.ToString(0, result); - else if (relaxed) - return string.Empty; - else //Fail early (-P) - throw new("Invalid key (" + key.KeyChar + "/" + result + "/" + outputBuilder + ")"); - } - } - - public static string ToAscii(ConsoleKeyInfo key) - { - var outputBuilder = new StringBuilder(2); - var modifiers = GetKeyState(key.Modifiers); - var result = ToAscii((uint)key.Key, 0, modifiers, outputBuilder, 0); - if (result > 0) - return outputBuilder.ToString(0, result); - else - throw new("Invalid key (" + key + ")"); - } - - const byte HighBit = 0x80; - - static byte[] GetKeyState(ConsoleModifiers modifiers) - { - var keyState = new byte[256]; - - if ((modifiers & ConsoleModifiers.Shift) == ConsoleModifiers.Shift) - keyState[VK_SHIFT] = HighBit; - if ((modifiers & ConsoleModifiers.Control) == ConsoleModifiers.Control) - keyState[VK_CONTROL] = HighBit; - if ((modifiers & ConsoleModifiers.Alt) == ConsoleModifiers.Alt) - keyState[VK_ALT] = HighBit; - - keyState[VK_CAPITAL] = (byte)(_queryKeyState(VK_CAPITAL) & 0xFF); - - return keyState; - } - - [DllImport("user32.dll", EntryPoint = nameof(GetKeyState))] - static extern short _queryKeyState(uint nVirtKey); - - [DllImport("user32.dll")] - static extern int ToAscii( - uint uVirtKey, - uint uScanCode, - byte[] lpKeyState, - [Out] StringBuilder lpChar, - uint uFlags - ); - - [DllImport("user32.dll")] - static extern int ToUnicode( - uint wVirtKey, - uint wScanCode, - byte[] lpKeyState, - [Out, MarshalAs(UnmanagedType.LPWStr, SizeConst = 64)] StringBuilder pwszBuff, - int cchBuff, - uint wFlags - ); -} diff --git a/Prx/src/prx_lib.pxs b/Prx/src/prx_lib.pxs index fc0d7dac..5d8cc858 100644 --- a/Prx/src/prx_lib.pxs +++ b/Prx/src/prx_lib.pxs @@ -71,11 +71,9 @@ namespace prx.cli ?.() ; - var isWindowsNT = System::Environment.OSVersion.Platform~Int == System::PlatformID.Win32NT~Int; - function __consoleAvailable = asm(ldr.eng).Commands.Contains("__console"); - var supportsTabs = (supportsTabs ?? (isWindowsNT && __consoleAvailable))~Bool; + var supportsTabs = (supportsTabs ?? __consoleAvailable)~Bool; function readline = if(supportsTabs) @@ -131,4 +129,4 @@ namespace prx.cli function thisEngine = asm ( ldr.eng ); function thisApplication = asm ( ldr.app ); -} \ No newline at end of file +} diff --git a/Prx/src/prx_main.pxs b/Prx/src/prx_main.pxs index 0f221102..cbe3c708 100644 --- a/Prx/src/prx_main.pxs +++ b/Prx/src/prx_main.pxs @@ -277,7 +277,7 @@ namespace prx.cli "\n"+ "--verbose -v enables additional output.\n"+ "--header -h extracts declarations (only with -c).\n"+ - "--no-tab -b disables tab completion (tab completion only supported on windows).\n"+ + "--no-tab -b disables tab completion.\n"+ "-- -a forwards the rest of the arguments to the executing script.\n" + "--debug -d enables debugging mode\n" + "--search-path also searches for files/modules in that directory.\n" + @@ -631,4 +631,4 @@ namespace prx.cli Entry prx\main; function prx\main()[\sps] = sys.call(prx.cli.prx\main(?),var args); -{ sys.rt.compile_to_cil; } \ No newline at end of file +{ sys.rt.compile_to_cil; } diff --git a/PxCoco/ParserGen.cs b/PxCoco/ParserGen.cs index 9a376364..85a3ae9a 100644 --- a/PxCoco/ParserGen.cs +++ b/PxCoco/ParserGen.cs @@ -32,7 +32,7 @@ used as a plugin in non-free software. * CoCo/R to better fit my needs. The code generator now uses the symbolic * constants whenever possible. * - * To distinguish CoCo/R and from my version, I called my executable PxCoco.exe + * To distinguish CoCo/R and from my version, I called my executable PxCoco */ using System; diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index a529e71e..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,84 +0,0 @@ - -trigger: - batch: true - branches: - include: - - '*' -pr: none - -stages: - - stage: build_test - displayName: Build/Test - variables: - solution: 'prx.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - jobs: - - job: build_test - timeoutInMinutes: 5 - cancelTimeoutInMinutes: 1 - strategy: - matrix: - Windows: - vmImage: 'windows-latest' - jobSuffix: win - Linux: - vmImage: 'ubuntu-latest' - jobSuffix: linux - displayName: Build/Test - pool: - vmImage: '$(vmImage)' - steps: - - task: UseDotNet@2 - inputs: - version: '5.0.x' - - - task: NuGetAuthenticate@0 - - - task: DotNetCoreCLI@2 - displayName: Restore - inputs: - command: restore - projects: '$(solution)' - selectOrConfig: 'config' - nugetConfigPath: NuGet.Config - - - task: DotNetCoreCLI@2 - displayName: Restore Tools - inputs: - command: custom - custom: tool - arguments: 'restore' - selectOrConfig: 'config' - nugetConfigPath: NuGet.Config - - - task: DotNetCoreCLI@2 - displayName: Build - inputs: - command: build - projects: '$(solution)' - arguments: '"/p:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)" --no-restore' - - - task: DotNetCoreCLI@2 - displayName: Unit Test - inputs: - command: test - projects: '**/*Tests.csproj' - nobuild: true - arguments: '"/p:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)" --no-restore' - - - task: DotNetCoreCLI@2 - displayName: Pack - inputs: - command: pack - searchPatternPack: 'Prexonite/Prexonite.csproj' - nobuild: true - configurationToPack: $(BuildConfiguration) - buildProperties: Platform=$(BuildPlatform) - - - task: PublishPipelineArtifact@0 - displayName: Publish to pipeline - condition: and(succeeded(), eq(variables['jobSuffix'], 'win')) - inputs: - artifactName: 'binaries' - targetPath: '$(Build.ArtifactStagingDirectory)' diff --git a/azure-release-pipelines.yml b/azure-release-pipelines.yml deleted file mode 100644 index 6899a9d0..00000000 --- a/azure-release-pipelines.yml +++ /dev/null @@ -1,89 +0,0 @@ - -trigger: - tags: - include: - - 'v.*' -pr: none - -stages: - - stage: build_test_release - displayName: Build/Test/Release - variables: - solution: 'prx.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - jobs: - - job: build_test_release - timeoutInMinutes: 5 - cancelTimeoutInMinutes: 1 - displayName: Build/Test/Release - pool: - vmImage: 'ubuntu-latest' - steps: - - task: UseDotNet@2 - inputs: - version: '5.0.x' - - - powershell: | - # Remove /refs/tags (10 chars) and v. (2 chars) from checkout string - $ver = $env:BUILD_SOURCEBRANCH.remove(0, 12) - Write-Host "##vso[task.setvariable variable=Version]$ver" - displayName: 'Update version to Tag' - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) - - - task: NuGetAuthenticate@0 - - - task: DotNetCoreCLI@2 - displayName: Restore - inputs: - command: restore - projects: '$(solution)' - selectOrConfig: 'config' - nugetConfigPath: NuGet.Config - - - task: DotNetCoreCLI@2 - displayName: Restore Tools - inputs: - command: custom - custom: tool - arguments: 'restore' - selectOrConfig: 'config' - nugetConfigPath: NuGet.Config - - - task: DotNetCoreCLI@2 - displayName: Build - inputs: - command: build - projects: '$(solution)' - arguments: '"/p:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration);Version=$(Version)" --no-restore' - - - task: DotNetCoreCLI@2 - displayName: Unit Test - inputs: - command: test - projects: '**/*Tests.csproj' - nobuild: true - arguments: '"/p:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration);Version=$(Version)" --no-restore' - - - task: DotNetCoreCLI@2 - displayName: Pack - inputs: - command: pack - searchPatternPack: 'Prexonite/Prexonite.csproj' - nobuild: true - configurationToPack: $(BuildConfiguration) - buildProperties: Platform=$(BuildPlatform);Version=$(Version) - - - task: PublishPipelineArtifact@0 - displayName: Publish to pipeline - condition: succeeded() - inputs: - artifactName: 'binaries' - targetPath: '$(Build.ArtifactStagingDirectory)' - - - task: DotNetCoreCLI@2 - displayName: Publish (NuGet) - condition: succeeded() - inputs: - command: push - publishVstsFeed: 'edge'