@@ -622,6 +622,22 @@ class idl2d
622622 case " RtlFlushNonVolatileMemoryRanges" :
623623 return 1 ;
624624
625+ // SDK 10.0.22621.0
626+ case " WIN_NOEXCEPT" :
627+ case " ReadLongPtrAcquire" :
628+ case " ReadLongPtrNoFence" :
629+ case " ReadLongPtrRaw" :
630+ case " WriteLongPtrRelease" :
631+ case " WriteLongPtrNoFence" :
632+ case " WriteLongPtrRaw" :
633+ case " ReadULongPtrAcquire" :
634+ case " ReadULongPtrNoFence" :
635+ case " ReadULongPtrRaw" :
636+ case " WriteULongPtrRelease" :
637+ case " WriteULongPtrNoFence" :
638+ case " WriteULongPtrRaw" :
639+ return 1 ;
640+
625641 default :
626642 break ;
627643 }
@@ -1086,6 +1102,8 @@ version(all)
10861102 while (replaceTokenSequence(tokens, " $_not $_ident($_ident1)($expr)" , " $_not cast($_ident1)($expr)" , true ) > 0 ) {}
10871103 replaceTokenSequence(tokens, " $_not $_ident($_ident1)cast" , " $_not cast($_ident1)cast" , true );
10881104 replaceTokenSequence(tokens, " $_not $_ident($_ident1*)$_not_semi;" , " $_not cast($_ident1*)$_not_semi" , true );
1105+ replaceTokenSequence(tokens, " $_not $_ident(const $_ident1*)$_not_semi;" , " $_not cast(const $_ident1*)$_not_semi" , true );
1106+ replaceTokenSequence(tokens, " $_not $_ident(volatile const $_ident1*)$_not_semi;" , " $_not cast(volatile const $_ident1*)$_not_semi" , true );
10891107 replaceTokenSequence(tokens, " $_not $_ident(struct $_ident1*)$_not_semi;" , " $_not cast(struct $_ident1*)$_not_semi" , true );
10901108 replaceTokenSequence(tokens, " $_not $_ident($_ident1 $_ident2*)" , " $_not cast($_ident1 $_ident2*)" , true );
10911109 replaceTokenSequence(tokens, " HRESULT cast" , " HRESULT" , true );
@@ -1270,6 +1288,11 @@ version(all)
12701288 replaceTokenSequence(tokens, " #ifndef TRUE\n #define TRUE$def\n #endif\n " , " #define TRUE 1\n " , false );
12711289 }
12721290
1291+ if (currentModule == " memoryapi" )
1292+ {
1293+ replaceTokenSequence(tokens, " typedef struct DECLSPEC_ALIGN($_num)" , " align($_num) typedef struct" , true );
1294+ }
1295+
12731296 if (currentModule == " winnt" )
12741297 {
12751298 replaceTokenSequence(tokens, " #if defined(MIDL_PASS)\n typedef struct $_ident {\n "
@@ -1299,6 +1322,13 @@ version(all)
12991322
13001323 replaceTokenSequence(tokens, " RtlZeroMemory($dest,$length)" ,
13011324 " import core.stdc.string: memset; memset($dest,0,$length)" , true );
1325+ // win 10.0.22621.0: duplicate definition
1326+ replaceTokenSequence(tokens, " POWER_SETTING_ALTITUDE, *PPOWER_SETTING_ALTITUDE;" ,
1327+ " *PPOWER_SETTING_ALTITUDE;" , true );
1328+ replaceTokenSequence(tokens, " FORCEINLINE BYTE ReadUCharAcquire $code WriteULong64Raw($args) { $code2 }" ,
1329+ " /+ $* +/" , true );
1330+ replaceTokenSequence(tokens, " FORCEINLINE PVOID ReadPointerAcquire $code WritePointerRaw($args) { $code2 }" ,
1331+ " /+ $* +/" , true );
13021332 }
13031333
13041334 if (currentModule == " commctrl" )
@@ -1385,7 +1415,10 @@ version(all)
13851415 // type name and field name identical
13861416 replaceTokenSequence(tokens, " ImageMoniker ImageMoniker;" , " ImageMoniker mImageMoniker;" , true );
13871417 }
1388-
1418+ if (currentModule.startsWith(" webprop" ))
1419+ {
1420+ replaceTokenSequence(tokens, " importlib(\" Microsoft.VisualStudio.Interop.tlb\" );" , " /+ $* +/;" , true );
1421+ }
13891422 // select unicode version of the API when defining without postfix A/W
13901423 replaceTokenSequence(tokens, " #ifdef UNICODE\n return $_identW(\n #else\n return $_identA(\n #endif\n " ,
13911424 " return $_identW(" , false );
@@ -1573,6 +1606,8 @@ version(all)
15731606 enums[tok.text] = true ;
15741607 break ;
15751608 }
1609+ if (indexOf(tok.pretext, " \\\n " ) >= 0 )
1610+ tok.pretext = replace(tok.pretext, " \\\n " , " \n " );
15761611 prevtext = tok.text;
15771612 ++ tokIt;
15781613 }
@@ -1653,6 +1688,10 @@ version(none) version(vsi)
16531688 replaceTokenSequence(tokens, " InterlockedCompareExchange($args __in LONG ExChange, __in LONG Comperand);" , " $* +/" , true );
16541689 replaceTokenSequence(tokens, " InterlockedOr(&Barrier, 0);" , " InterlockedExchangeAdd(&Barrier, 0);" , true ); // InterlockedOr exist only as intrinsic
16551690 }
1691+ if (currentModule == " winerror" )
1692+ {
1693+ replaceTokenSequence(tokens, " HRESULT HRESULT_FROM_SETUPAPI($args) { $code }" , " /+ $* +/" , true );
1694+ }
16561695 if (currentModule == " ocidl" )
16571696 {
16581697 // move alias out of interface declaration, it causes circular definitions with dmd 2.065+
@@ -2134,6 +2173,8 @@ else
21342173 TokenIterator inAlias = tokens.end();
21352174 for (TokenIterator tokIt = tokens.begin(); ! tokIt.atEnd(); ++ tokIt)
21362175 {
2176+ bool isAssign (string txt) { return txt == " =" || txt == " &=" || txt == " |=" || txt == " +=" || txt == " -=" ; }
2177+
21372178 Token tok = * tokIt;
21382179 // tok.pretext = tok.pretext.replace("//D", "");
21392180 tok.text = translateToken(tok.text);
@@ -2150,8 +2191,9 @@ else
21502191 }
21512192 else if (tok.text == " [" && tokIt[1 ].text != " ]" )
21522193 {
2153- if ((tokIt.atBegin() || tokIt[- 1 ].text != " {" || tokIt[- 2 ].text != " = " ) &&
2194+ if ((tokIt.atBegin() || tokIt[- 1 ].text != " {" || ! isAssign( tokIt[- 2 ].text) ) &&
21542195 (tokIt[1 ].type != Token .Number || tokIt[2 ].text != " ]" ) &&
2196+ tokIt[1 ].text != " i" && // RtlConstantTimeEqualMemory
21552197 (tokIt[2 ].text != " ]" || tokIt[3 ].text != " ;" ))
21562198 {
21572199 TokenIterator bit = tokIt;
@@ -2168,8 +2210,9 @@ else
21682210 {
21692211 TokenIterator openit = tokIt;
21702212 if (retreatToOpeningBracket(openit) &&
2171- (openit.atBegin || (openit- 1 ).atBegin || openit[- 1 ].text != " {" || openit[- 2 ].text != " = " ))
2213+ (openit.atBegin || (openit- 1 ).atBegin || openit[- 1 ].text != " {" || ! isAssign( openit[- 2 ].text) ))
21722214 if ((tokIt[- 1 ].type != Token .Number || tokIt[- 2 ].text != " [" ) &&
2215+ tokIt[- 1 ].text != " i" && // RtlConstantTimeEqualMemory
21732216 (tokIt[- 2 ].text != " [" || tokIt[1 ].text != " ;" ))
21742217 tok.text = " ]+/" ;
21752218 }
@@ -2900,8 +2943,8 @@ unittest
29002943 string exptxt = "
29012944int convert() { return " ~ "
29022945 hello; }
2903- // #define noconvert(n,m) \\
2904- // hallo1 |\\
2946+ // #define noconvert(n,m)
2947+ // hallo1 |
29052948// hallo2
29062949" ;
29072950 version (macro2template) exptxt = replace(exptxt, " int" , " auto" );
0 commit comments