3#include <winpr/winpr.h> 
    4#include <winpr/collections.h> 
   97static char* gdi_convert_postfix_to_infix(
const char* postfix)
 
  102  wStack* stack = Stack_New(FALSE);
 
  103  size_t length = strlen(postfix);
 
  105  for (
size_t i = 0; i < length; i++)
 
  107    BOOL success = FALSE;
 
  108    if ((postfix[i] == 
'P') || (postfix[i] == 
'D') || (postfix[i] == 
'S'))
 
  117      Stack_Push(stack, a);
 
  136      else if (c[0] == 
'o')
 
  140      else if (c[0] == 
'n')
 
  145      else if (c[0] == 
'x')
 
  151        printf(
"invalid operator: %c\n", c[0]);
 
  155      a = (
char*)Stack_Pop(stack);
 
  160        b = (
char*)Stack_Pop(stack);
 
  168      size_t dl = al + bl + cl + 3;
 
  169      char* d = malloc(dl + 1);
 
  173      (void)sprintf_s(d, dl, 
"(%s%s%s)", b ? b : 
"", c, a);
 
  174      Stack_Push(stack, d);
 
  186  char* d = (
char*)Stack_Pop(stack);
 
  195static const char* test_ROP3[] = { 
"DSPDxax",  
"PSDPxax", 
"SPna",   
"DSna",   
"DPa",
 
  196                                 "PDxn",     
"DSxn",    
"PSDnox", 
"PDSona", 
"DSPDxox",
 
  197                                 "DPSDonox", 
"SPDSxax", 
"DPon",   
"DPna",   
"Pn",
 
  198                                 "PDna",     
"DPan",    
"DSan",   
"DSxn",   
"DPa",
 
  199                                 "D",        
"DPno",    
"SDno",   
"PDno",   
"DPo" };
 
  201int TestGdiRop3(
int argc, 
char* argv[])
 
  206  for (
size_t index = 0; index < 
sizeof(test_ROP3) / 
sizeof(test_ROP3[0]); index++)
 
  208    const char* postfix = test_ROP3[index];
 
  209    char* infix = gdi_convert_postfix_to_infix(postfix);
 
  214    printf(
"%s\t\t%s\n", postfix, infix);