How to compute permalink to docs? Fixed #865.

This commit is contained in:
Mike Battista 2023-05-01 17:28:53 -07:00
Родитель b2af89ee6a
Коммит 62a25c42b5
8 изменённых файлов: 115802 добавлений и 2 удалений

Просмотреть файл

@ -49,6 +49,7 @@ DISCLAIMER: This list is a work in progress and is not yet comprehensive.
* Calling convention is captured in the [CallingConvention](https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.callingconvention) property
* Whether a function calls `SetLastError` before returning is captured in the [SetLastError](https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.setlasterror) property
* Architecture-specific types are represented as types with the same name where each type is decorated with the `[SupportedArchitecture]` attribute indicating the architecture(s) where that type is supported
* Documentation links are captured in the `[Documentation]` attribute
* Input and output parameters are decorated with `[In]` and `[Out]` attributes. Parameters that are both input and output will contain both attributes. COM output pointer parameters are also decorated with the `[ComOutPtr]` attribute.
* Optional parameters are decorated with the `[Optional]` attribute. Optional parameters may be `NULL`.
* Reserved parameters are decorated with the `[Reserved]` attribute. Since reserved parameters always expect a `NULL` value, projections can choose to abstract away these parameters to improve the developer experience.
@ -85,6 +86,7 @@ DISCLAIMER: This list is a work in progress and is not yet comprehensive.
* [Windows.Win32.UI.WindowsAndMessaging.SetWindowLongPtrW](https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-setwindowlongptrw)
* DllImport attribute
* SupportedArchitecture attribute
* Documentation attribute
* NativeTypedef parameter (HWND)
* Enum parameter (WINDOW_LONG_PTR_INDEX)
* [Windows.Win32.Security.Cryptography.BcryptEncrypt](https://learn.microsoft.com/windows/win32/api/bcrypt/nf-bcrypt-bcryptencrypt)

Просмотреть файл

@ -32,6 +32,7 @@
<ItemGroup>
<EmitterRsp Include="emitter.settings.rsp"/>
<EmitterRsp Include="requiredNamespacesForNames.rsp"/>
<EmitterRsp Include="documentationMappings.rsp"/>
</ItemGroup>
<PropertyGroup>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -63,6 +63,13 @@ public class CppAttributeList : Attribute
}
}
public class DocumentationAttribute : Attribute
{
public DocumentationAttribute(String Uri)
{
}
}
public class DoNotReleaseAttribute : Attribute
{
public DoNotReleaseAttribute()

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using Windows.Win32.Foundation.Metadata;
namespace Windows.Win32.System.WinRT
{

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,24 @@
. "$PSScriptRoot\CommonUtils.ps1"
$documentationMappingsRsp = Join-Path $windowsWin32ProjectRoot "documentationMappings.rsp"
Write-Host "Writing to $documentationMappingsRsp..."
$output = [System.Text.StringBuilder]::new()
$output.AppendLine("--memberRemap") | Out-Null
Get-ChildItem $sdkApiPath -Include "*.md" -Exclude "index.md", "TOC.md" -Recurse |
ForEach-Object {
$match = [regex]::Match($_.Name, "(n.-([^-]+)-([^-]*)(-[^-]*)?).md")
if ($match.Success) {
$page = $match.Groups[1].Value
$header = $match.Groups[2].Value
$match = [regex]::Match((Get-Content $_ -TotalCount 5), "title: ([^\s\(]+)")
$api = $match.Groups[1].Value
$output.AppendLine("$api=[Documentation(""https://docs.microsoft.com/windows/win32/api/$header/$page"")]") | Out-Null
}
}
[System.IO.File]::WriteAllLines($documentationMappingsRsp, $output.ToString())

Просмотреть файл

@ -13,7 +13,7 @@ namespace MetadataUtils
public const string AttributeToRemoveSuffix = "__remove";
private static readonly System.Text.RegularExpressions.Regex RemappedParmRegex = new System.Text.RegularExpressions.Regex(@"(?:\[([^\]]*)\])?(?:\s*(\w+\**)(?:\s+(\w+))?)?");
private static readonly System.Text.RegularExpressions.Regex AttributeRegex = new System.Text.RegularExpressions.Regex(@"(-?\w+)(\([^\)]+\))?");
private static readonly System.Text.RegularExpressions.Regex AttributeRegex = new System.Text.RegularExpressions.Regex(@"(-?\w+)(\(.+\)$)?");
public static bool DecodeRemap(string remappedTo, out List<AttributeSyntax> listAttributes, out string newType, out string newName)
{