@@ -622,6 +622,22 @@ class idl2d
622
622
case " RtlFlushNonVolatileMemoryRanges" :
623
623
return 1 ;
624
624
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
+
625
641
default :
626
642
break ;
627
643
}
@@ -1086,6 +1102,8 @@ version(all)
1086
1102
while (replaceTokenSequence(tokens, " $_not $_ident($_ident1)($expr)" , " $_not cast($_ident1)($expr)" , true ) > 0 ) {}
1087
1103
replaceTokenSequence(tokens, " $_not $_ident($_ident1)cast" , " $_not cast($_ident1)cast" , true );
1088
1104
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 );
1089
1107
replaceTokenSequence(tokens, " $_not $_ident(struct $_ident1*)$_not_semi;" , " $_not cast(struct $_ident1*)$_not_semi" , true );
1090
1108
replaceTokenSequence(tokens, " $_not $_ident($_ident1 $_ident2*)" , " $_not cast($_ident1 $_ident2*)" , true );
1091
1109
replaceTokenSequence(tokens, " HRESULT cast" , " HRESULT" , true );
@@ -1270,6 +1288,11 @@ version(all)
1270
1288
replaceTokenSequence(tokens, " #ifndef TRUE\n #define TRUE$def\n #endif\n " , " #define TRUE 1\n " , false );
1271
1289
}
1272
1290
1291
+ if (currentModule == " memoryapi" )
1292
+ {
1293
+ replaceTokenSequence(tokens, " typedef struct DECLSPEC_ALIGN($_num)" , " align($_num) typedef struct" , true );
1294
+ }
1295
+
1273
1296
if (currentModule == " winnt" )
1274
1297
{
1275
1298
replaceTokenSequence(tokens, " #if defined(MIDL_PASS)\n typedef struct $_ident {\n "
@@ -1299,6 +1322,11 @@ version(all)
1299
1322
1300
1323
replaceTokenSequence(tokens, " RtlZeroMemory($dest,$length)" ,
1301
1324
" 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 );
1302
1330
}
1303
1331
1304
1332
if (currentModule == " commctrl" )
@@ -1385,7 +1413,10 @@ version(all)
1385
1413
// type name and field name identical
1386
1414
replaceTokenSequence(tokens, " ImageMoniker ImageMoniker;" , " ImageMoniker mImageMoniker;" , true );
1387
1415
}
1388
-
1416
+ if (currentModule.startsWith(" webprop" ))
1417
+ {
1418
+ replaceTokenSequence(tokens, " importlib(\" Microsoft.VisualStudio.Interop.tlb\" );" , " /+ $* +/;" , true );
1419
+ }
1389
1420
// select unicode version of the API when defining without postfix A/W
1390
1421
replaceTokenSequence(tokens, " #ifdef UNICODE\n return $_identW(\n #else\n return $_identA(\n #endif\n " ,
1391
1422
" return $_identW(" , false );
@@ -1573,6 +1604,8 @@ version(all)
1573
1604
enums[tok.text] = true ;
1574
1605
break ;
1575
1606
}
1607
+ if (indexOf(tok.pretext, " \\\n " ) >= 0 )
1608
+ tok.pretext = replace(tok.pretext, " \\\n " , " \n " );
1576
1609
prevtext = tok.text;
1577
1610
++ tokIt;
1578
1611
}
@@ -1653,6 +1686,10 @@ version(none) version(vsi)
1653
1686
replaceTokenSequence(tokens, " InterlockedCompareExchange($args __in LONG ExChange, __in LONG Comperand);" , " $* +/" , true );
1654
1687
replaceTokenSequence(tokens, " InterlockedOr(&Barrier, 0);" , " InterlockedExchangeAdd(&Barrier, 0);" , true ); // InterlockedOr exist only as intrinsic
1655
1688
}
1689
+ if (currentModule == " winerror" )
1690
+ {
1691
+ replaceTokenSequence(tokens, " HRESULT HRESULT_FROM_SETUPAPI($args) { $code }" , " /+ $* +/" , true );
1692
+ }
1656
1693
if (currentModule == " ocidl" )
1657
1694
{
1658
1695
// move alias out of interface declaration, it causes circular definitions with dmd 2.065+
@@ -2134,6 +2171,8 @@ else
2134
2171
TokenIterator inAlias = tokens.end();
2135
2172
for (TokenIterator tokIt = tokens.begin(); ! tokIt.atEnd(); ++ tokIt)
2136
2173
{
2174
+ bool isAssign (string txt) { return txt == " =" || txt == " &=" || txt == " |=" || txt == " +=" || txt == " -=" ; }
2175
+
2137
2176
Token tok = * tokIt;
2138
2177
// tok.pretext = tok.pretext.replace("//D", "");
2139
2178
tok.text = translateToken(tok.text);
@@ -2150,8 +2189,9 @@ else
2150
2189
}
2151
2190
else if (tok.text == " [" && tokIt[1 ].text != " ]" )
2152
2191
{
2153
- if ((tokIt.atBegin() || tokIt[- 1 ].text != " {" || tokIt[- 2 ].text != " = " ) &&
2192
+ if ((tokIt.atBegin() || tokIt[- 1 ].text != " {" || ! isAssign( tokIt[- 2 ].text) ) &&
2154
2193
(tokIt[1 ].type != Token .Number || tokIt[2 ].text != " ]" ) &&
2194
+ tokIt[1 ].text != " i" && // RtlConstantTimeEqualMemory
2155
2195
(tokIt[2 ].text != " ]" || tokIt[3 ].text != " ;" ))
2156
2196
{
2157
2197
TokenIterator bit = tokIt;
@@ -2168,8 +2208,9 @@ else
2168
2208
{
2169
2209
TokenIterator openit = tokIt;
2170
2210
if (retreatToOpeningBracket(openit) &&
2171
- (openit.atBegin || (openit- 1 ).atBegin || openit[- 1 ].text != " {" || openit[- 2 ].text != " = " ))
2211
+ (openit.atBegin || (openit- 1 ).atBegin || openit[- 1 ].text != " {" || ! isAssign( openit[- 2 ].text) ))
2172
2212
if ((tokIt[- 1 ].type != Token .Number || tokIt[- 2 ].text != " [" ) &&
2213
+ tokIt[- 1 ].text != " i" && // RtlConstantTimeEqualMemory
2173
2214
(tokIt[- 2 ].text != " [" || tokIt[1 ].text != " ;" ))
2174
2215
tok.text = " ]+/" ;
2175
2216
}
@@ -2900,8 +2941,8 @@ unittest
2900
2941
string exptxt = "
2901
2942
int convert() { return " ~ "
2902
2943
hello; }
2903
- // #define noconvert(n,m) \\
2904
- // hallo1 |\\
2944
+ // #define noconvert(n,m)
2945
+ // hallo1 |
2905
2946
// hallo2
2906
2947
" ;
2907
2948
version (macro2template) exptxt = replace(exptxt, " int" , " auto" );
0 commit comments