Advertisement
Guest User

Notepad++ Parser for AMX Mod X INC Files

a guest
Apr 13th, 2014
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 68.62 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <io.h>
  3. #include <string.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <time.h>
  7. #include <iostream>
  8. #include <cstdio>
  9. #include <stack>
  10. #include <errno.h>
  11. #include <cerrno>
  12. #include <cassert>
  13. #include <assert.h>
  14. #include <vadefs.h>
  15. #include <valarray>
  16. #include <tpcver.h>
  17. #include <string>
  18. #include <vector>
  19. #include <stdbool.h>
  20. #include <wchar.h>
  21. #include <sys/types.h>
  22. #include <sys/timeb.h>
  23. #include <sys/utime.h>
  24. #include <sys/stat.h>
  25. #include <sys/locking.h>
  26. #include <direct.h>
  27. #include <regbag.h>
  28. #include <WinBase.h>
  29. #include <stdint.h>
  30. #include <WinSock.h>
  31. #include <stddef.h>
  32.  
  33. #if defined Hattrick
  34.     #error Hattrick symbol is already defined. Try to rename below in Source.cpp file.
  35. #endif
  36.  
  37. #if !defined STATIC
  38.     #define STATIC static
  39. #endif
  40.  
  41. #if !defined NAMESPACE
  42.     #define NAMESPACE namespace
  43. #endif
  44.  
  45. #if !defined FINDDATA
  46.     #define FINDDATA _finddata_t
  47. #endif
  48.  
  49. #if !defined TEMPLATE
  50.     #define TEMPLATE template
  51. #endif
  52.  
  53. #if !defined TYPENAME
  54.     #define TYPENAME typename
  55. #endif
  56.  
  57. #if !defined RETURN
  58.     #define RETURN return
  59. #endif
  60.  
  61. #if !defined SIZEOF
  62.     #define SIZEOF sizeof
  63. #endif
  64.  
  65. #if !defined BREAK
  66.     #define BREAK break
  67. #endif
  68.  
  69. #if !defined CONTINUE
  70.     #define CONTINUE continue
  71. #endif
  72.  
  73. #if !defined ELSE
  74.     #define ELSE else
  75. #endif
  76.  
  77. #if !defined IF
  78.     #define IF if
  79. #endif
  80.  
  81. #if !defined FOR
  82.     #define FOR for
  83. #endif
  84.  
  85. #if !defined WHILE
  86.     #define WHILE while
  87. #endif
  88.  
  89. #if !defined OR
  90.     #define OR ||
  91. #endif
  92.  
  93. #if !defined AND
  94.     #define AND &&
  95. #endif
  96.  
  97. NAMESPACE Hattrick
  98. {
  99.     STATIC SIZE_T Natives = 0U;
  100.     STATIC SIZE_T Forwards = 0U;
  101.     STATIC SIZE_T Stocks = 0U;
  102.     STATIC SIZE_T Definitions = 0U;
  103.  
  104.     STATIC FILE * Journal = NULL;
  105.     STATIC FILE * Output = NULL;
  106.  
  107.     STATIC BOOL UnicodeJournal = FALSE;
  108.  
  109.     VOID OpenJournal(BOOL Unicode)
  110.     {
  111.         IF (!Journal)
  112.         {
  113.             IF (Unicode)
  114.             {
  115.                 _wfopen_s(&Journal, L"journal.log", L"a+, ccs=UNICODE");
  116.             }
  117.  
  118.             ELSE
  119.             {
  120.                 fopen_s(&Journal, "journal.log", "a+");
  121.             }
  122.  
  123.             UnicodeJournal = Unicode;
  124.         }
  125.     }
  126.  
  127.     VOID CloseJournal(VOID)
  128.     {
  129.         IF (Journal)
  130.         {
  131.             fclose(Journal);
  132.  
  133.             Journal = NULL;
  134.         }
  135.     }
  136.  
  137.     VOID Log(PWCHAR Format, ...)
  138.     {
  139.         IF (Format)
  140.         {
  141.             STATIC WCHAR String[1024U] = { (WCHAR)L'\0' };
  142.  
  143.             STATIC PCHAR Handle = NULL;
  144.  
  145.             va_start(Handle, Format);
  146.  
  147.             _vsnwprintf_s(String, SIZEOF(String), SIZEOF(String) / SIZEOF(WCHAR), Format, Handle);
  148.  
  149.             va_end(Handle);
  150.  
  151.             IF (Journal)
  152.             {
  153.                 IF (!UnicodeJournal)
  154.                 {
  155.                     CloseJournal();
  156.  
  157.                     OpenJournal(TRUE);
  158.  
  159.                     IF (!Journal)
  160.                     {
  161.                         RETURN;
  162.                     }
  163.                 }
  164.  
  165.                 fwprintf_s(Journal, L"%ls\n", String);
  166.             }
  167.         }
  168.     }
  169.  
  170.     VOID Log(PCHAR Format, ...)
  171.     {
  172.         IF (Format)
  173.         {
  174.             STATIC CHAR String[1024U] = { '\0' };
  175.  
  176.             STATIC PCHAR Handle = NULL;
  177.  
  178.             va_start(Handle, Format);
  179.  
  180.             _vsnprintf_s(String, SIZEOF(String), SIZEOF(String) / SIZEOF(CHAR), Format, Handle);
  181.  
  182.             va_end(Handle);
  183.  
  184.             IF (Journal)
  185.             {
  186.                 IF (UnicodeJournal)
  187.                 {
  188.                     CloseJournal();
  189.  
  190.                     OpenJournal(FALSE);
  191.  
  192.                     IF (!Journal)
  193.                     {
  194.                         RETURN;
  195.                     }
  196.                 }
  197.  
  198.                 fprintf_s(Journal, "%s\n", String);
  199.             }
  200.         }
  201.     }
  202.  
  203.     VOID StringAppend(PCHAR Destination, SIZE_T DestinationSize, PCHAR Source)
  204.     {
  205.         IF (Destination AND Source)
  206.         {
  207.             _snprintf_s(Destination, DestinationSize, DestinationSize / SIZEOF(CHAR), "%s%s", Destination, Source);
  208.         }
  209.     }
  210.  
  211.     VOID StringAppend(PWCHAR Destination, SIZE_T DestinationSize, PWCHAR Source)
  212.     {
  213.         IF (Destination AND Source)
  214.         {
  215.             _snwprintf_s(Destination, DestinationSize, DestinationSize / SIZEOF(WCHAR), L"%ls%ls", Destination, Source);
  216.         }
  217.     }
  218.  
  219.     VOID StringToLower(PWCHAR Destination, SIZE_T DestinationSize)
  220.     {
  221.         IF (Destination)
  222.         {
  223.             _wcslwr_s(Destination, DestinationSize);
  224.         }
  225.     }
  226.  
  227.     VOID StringToLower(PCHAR Destination, SIZE_T DestinationSize)
  228.     {
  229.         IF (Destination)
  230.         {
  231.             _strlwr_s(Destination, DestinationSize);
  232.         }
  233.     }
  234.  
  235.     BOOL FileHasExtension(PWCHAR Destination, SIZE_T DestinationSize, PWCHAR Extension)
  236.     {
  237.         IF (Destination AND Extension)
  238.         {
  239.             STATIC SIZE_T DestinationLength = 0U;
  240.             STATIC SIZE_T ExtensionLength = 0U;
  241.  
  242.             DestinationLength = wcslen(Destination);
  243.             ExtensionLength = wcslen(Extension);
  244.  
  245.             IF (DestinationLength > ExtensionLength + 1U AND _wcsicmp(&Destination[DestinationLength - ExtensionLength], Extension) == 0U)
  246.             {
  247.                 RETURN TRUE;
  248.             }
  249.         }
  250.  
  251.         RETURN FALSE;
  252.     }
  253.  
  254.     BOOL FileHasExtension(PCHAR Destination, SIZE_T DestinationSize, PCHAR Extension)
  255.     {
  256.         IF (Destination AND Extension)
  257.         {
  258.             STATIC SIZE_T DestinationLength = 0U;
  259.             STATIC SIZE_T ExtensionLength = 0U;
  260.  
  261.             DestinationLength = strlen(Destination);
  262.             ExtensionLength = strlen(Extension);
  263.  
  264.             IF (DestinationLength > ExtensionLength + 1U AND _stricmp(&Destination[DestinationLength - ExtensionLength], Extension) == 0U)
  265.             {
  266.                 RETURN TRUE;
  267.             }
  268.         }
  269.  
  270.         RETURN FALSE;
  271.     }
  272.  
  273.     VOID StringTruncateRight(PWCHAR Destination, WCHAR Character)
  274.     {
  275.         IF (Destination)
  276.         {
  277.             STATIC SIZE_T Iterator = 0U;
  278.  
  279.             FOR (Iterator = wcslen(Destination) - 1U; Iterator >= 0U; Iterator--)
  280.             {
  281.                 IF (Destination[Iterator] == Character)
  282.                 {
  283.                     Destination[Iterator] = (WCHAR)L'\0';
  284.  
  285.                     BREAK;
  286.                 }
  287.             }
  288.         }
  289.     }
  290.  
  291.     VOID StringTruncateRight(PCHAR Destination, CHAR Character)
  292.     {
  293.         IF (Destination)
  294.         {
  295.             STATIC SIZE_T Iterator = 0U;
  296.  
  297.             FOR (Iterator = strlen(Destination) - 1U; Iterator >= 0U; Iterator--)
  298.             {
  299.                 IF (Destination[Iterator] == Character)
  300.                 {
  301.                     Destination[Iterator] = '\0';
  302.  
  303.                     BREAK;
  304.                 }
  305.             }
  306.         }
  307.     }
  308.  
  309.     VOID StringTruncateLeft(PWCHAR Destination, WCHAR Character)
  310.     {
  311.         IF (Destination)
  312.         {
  313.             STATIC SIZE_T Iterator = 0U;
  314.  
  315.             FOR (Iterator = 0U; Iterator < wcslen(Destination); Iterator++)
  316.             {
  317.                 IF (Destination[Iterator] == Character)
  318.                 {
  319.                     Destination[Iterator] = (WCHAR)L'\0';
  320.  
  321.                     BREAK;
  322.                 }
  323.             }
  324.         }
  325.     }
  326.  
  327.     VOID StringTruncateLeft(PCHAR Destination, CHAR Character)
  328.     {
  329.         IF (Destination)
  330.         {
  331.             STATIC SIZE_T Iterator = 0U;
  332.  
  333.             FOR (Iterator = 0U; Iterator < strlen(Destination); Iterator++)
  334.             {
  335.                 IF (Destination[Iterator] == Character)
  336.                 {
  337.                     Destination[Iterator] = '\0';
  338.  
  339.                     BREAK;
  340.                 }
  341.             }
  342.         }
  343.     }
  344.  
  345.     INT GetFirstCharacterPositionInString(PCHAR Destination, WCHAR Character)
  346.     {
  347.         IF (Destination)
  348.         {
  349.             STATIC SIZE_T Iterator = 0U;
  350.  
  351.             FOR (Iterator = 0U; Iterator < strlen(Destination); Iterator++)
  352.             {
  353.                 IF (Destination[Iterator] == Character)
  354.                 {
  355.                     RETURN Iterator;
  356.                 }
  357.             }
  358.         }
  359.  
  360.         RETURN -1;
  361.     }
  362.  
  363.     INT GetFirstCharacterPositionInString(PWCHAR Destination, WCHAR Character)
  364.     {
  365.         IF (Destination)
  366.         {
  367.             STATIC SIZE_T Iterator = 0U;
  368.  
  369.             FOR (Iterator = 0U; Iterator < wcslen(Destination); Iterator++)
  370.             {
  371.                 IF (Destination[Iterator] == Character)
  372.                 {
  373.                     RETURN Iterator;
  374.                 }
  375.             }
  376.         }
  377.  
  378.         RETURN -1;
  379.     }
  380.  
  381.     INT GetLastCharacterPositionInString(PCHAR Destination, CHAR Character)
  382.     {
  383.         IF (Destination)
  384.         {
  385.             STATIC SIZE_T Iterator = 0U;
  386.  
  387.             FOR (Iterator = strlen(Destination) - 1U; Iterator >= 0U; Iterator--)
  388.             {
  389.                 IF (Destination[Iterator] == Character)
  390.                 {
  391.                     RETURN Iterator;
  392.                 }
  393.             }
  394.         }
  395.  
  396.         RETURN -1;
  397.     }
  398.  
  399.     INT GetLastCharacterPositionInString(PWCHAR Destination, WCHAR Character)
  400.     {
  401.         IF (Destination)
  402.         {
  403.             STATIC SIZE_T Iterator = 0U;
  404.  
  405.             FOR (Iterator = wcslen(Destination) - 1U; Iterator >= 0U; Iterator--)
  406.             {
  407.                 IF (Destination[Iterator] == Character)
  408.                 {
  409.                     RETURN Iterator;
  410.                 }
  411.             }
  412.         }
  413.  
  414.         RETURN -1;
  415.     }
  416.  
  417.     INT GetFirstEligibleCharacterPositionInString(PCHAR Destination)
  418.     {
  419.         IF (Destination)
  420.         {
  421.             STATIC SIZE_T Iterator = 0U;
  422.  
  423.             FOR (Iterator = 0U; Iterator < strlen(Destination); Iterator++)
  424.             {
  425.                 IF (isprint(Destination[Iterator]))
  426.                 {
  427.                     RETURN Iterator;
  428.                 }
  429.             }
  430.         }
  431.  
  432.         RETURN -1;
  433.     }
  434.  
  435.     INT GetFirstEligibleCharacterPositionInString(PWCHAR Destination)
  436.     {
  437.         IF (Destination)
  438.         {
  439.             STATIC SIZE_T Iterator = 0U;
  440.  
  441.             FOR (Iterator = 0U; Iterator < wcslen(Destination); Iterator++)
  442.             {
  443.                 IF (iswprint(Destination[Iterator]))
  444.                 {
  445.                     RETURN Iterator;
  446.                 }
  447.             }
  448.         }
  449.  
  450.         RETURN -1;
  451.     }
  452.  
  453.     PCHAR Trim(PCHAR Destination)
  454.     {
  455.         IF (Destination)
  456.         {
  457.             STATIC INT EligibleCharacterPosition = 0U;
  458.  
  459.             STATIC SIZE_T Iterator = 0U;
  460.  
  461.             STATIC std::string String = "";
  462.  
  463.             WHILE (*Destination AND (isspace(*Destination) OR *Destination == '\n' OR *Destination == '\0' OR *Destination == ' ' \
  464.                 OR *Destination == '\r' OR *Destination == '\t' OR *Destination == '\f' OR *Destination == '\v' OR *Destination == '#'))
  465.             {
  466.                 Destination++;
  467.             }
  468.  
  469.             FOR (Iterator = strlen(Destination) - 1U; Iterator >= 0U; Iterator--)
  470.             {
  471.                 IF (isspace(Destination[Iterator]) OR Destination[Iterator] == '\n' OR Destination[Iterator] == '\0' \
  472.                     OR Destination[Iterator] == ' ' OR Destination[Iterator] == '\r' OR Destination[Iterator] == '\t' \
  473.                     OR Destination[Iterator] == '\f' OR Destination[Iterator] == '\v' OR Destination[Iterator] == '=')
  474.                 {
  475.                     Destination[Iterator] = '\0';
  476.                 }
  477.  
  478.                 ELSE
  479.                 {
  480.                     BREAK;
  481.                 }
  482.             }
  483.  
  484.             EligibleCharacterPosition = GetFirstEligibleCharacterPositionInString(Destination);
  485.  
  486.             IF (EligibleCharacterPosition >= 0U)
  487.             {
  488.                 String.assign(&Destination[EligibleCharacterPosition]);
  489.  
  490.                 RETURN (PCHAR)String.c_str();
  491.             }
  492.         }
  493.  
  494.         RETURN NULL;
  495.     }
  496.  
  497.     PWCHAR Trim(PWCHAR Destination)
  498.     {
  499.         IF (Destination)
  500.         {
  501.             STATIC INT EligibleCharacterPosition = 0U;
  502.  
  503.             STATIC SIZE_T Iterator = 0U;
  504.  
  505.             STATIC std::wstring String = L"";
  506.  
  507.             WHILE (*Destination AND (iswspace(*Destination) OR *Destination == (WCHAR)L'\n' OR *Destination == (WCHAR)L'\0' OR \
  508.                 *Destination == (WCHAR)L' ' OR *Destination == (WCHAR)L'\r' OR *Destination == (WCHAR)L'\t' OR \
  509.                 *Destination == (WCHAR)L'\f' OR *Destination == (WCHAR)L'\v') OR *Destination == (WCHAR)L'#')
  510.             {
  511.                 Destination++;
  512.             }
  513.  
  514.             FOR (Iterator = wcslen(Destination) - 1U; Iterator >= 0U; Iterator--)
  515.             {
  516.                 IF (iswspace(Destination[Iterator]) OR Destination[Iterator] == (WCHAR)L'\n' OR \
  517.                     Destination[Iterator] == (WCHAR)L'\0' OR Destination[Iterator] == (WCHAR)L' ' \
  518.                     OR Destination[Iterator] == (WCHAR)L'\r' OR Destination[Iterator] == (WCHAR)L'\t' \
  519.                     OR Destination[Iterator] == (WCHAR)L'\f' OR Destination[Iterator] == (WCHAR)L'\v' \
  520.                     OR Destination[Iterator] == (WCHAR)L'=')
  521.                 {
  522.                     Destination[Iterator] = (WCHAR)L'\0';
  523.                 }
  524.  
  525.                 ELSE
  526.                 {
  527.                     BREAK;
  528.                 }
  529.             }
  530.  
  531.             EligibleCharacterPosition = GetFirstEligibleCharacterPositionInString(Destination);
  532.  
  533.             IF (EligibleCharacterPosition >= 0U)
  534.             {
  535.                 String.assign(&Destination[EligibleCharacterPosition]);
  536.  
  537.                 RETURN (PWCHAR)String.c_str();
  538.             }
  539.         }
  540.  
  541.         RETURN NULL;
  542.     }
  543.  
  544.     BOOL IsFolder(PWCHAR File)
  545.     {
  546.         IF (File)
  547.         {
  548.             STATIC DWORD Attributes = 0U;
  549.  
  550.             Attributes = GetFileAttributesW(File);
  551.  
  552.             IF (Attributes == INVALID_FILE_ATTRIBUTES OR !(Attributes & FILE_ATTRIBUTE_DIRECTORY))
  553.             {
  554.                 RETURN FALSE;
  555.             }
  556.  
  557.             RETURN TRUE;
  558.         }
  559.  
  560.         RETURN FALSE;
  561.     }
  562.  
  563.     BOOL IsFolder(PCHAR File)
  564.     {
  565.         IF (File)
  566.         {
  567.             STATIC DWORD Attributes = 0U;
  568.  
  569.             Attributes = GetFileAttributesA(File);
  570.  
  571.             IF (Attributes == INVALID_FILE_ATTRIBUTES OR !(Attributes & FILE_ATTRIBUTE_DIRECTORY))
  572.             {
  573.                 RETURN FALSE;
  574.             }
  575.  
  576.             RETURN TRUE;
  577.         }
  578.  
  579.         RETURN FALSE;
  580.     }
  581.  
  582.     BOOL EnumerateFiles(LPARAM Flag, PWCHAR Directory, PWCHAR Extension, VOID Function(PWCHAR, LPARAM))
  583.     {
  584.         IF (Directory AND Extension AND Function)
  585.         {
  586.             STATIC INT_PTR Handle = NULL;
  587.  
  588.             STATIC _wfinddata_t Data;
  589.  
  590.             Handle = _wfindfirst(Directory, &Data);
  591.  
  592.             IF (Handle == -1L)
  593.             {
  594.                 RETURN FALSE;
  595.             }
  596.  
  597.             do
  598.             {
  599.  
  600.                 IF (FileHasExtension(Data.name, SIZEOF(Data.name), Extension))
  601.                 {
  602.                     Function(Data.name, Flag);
  603.                 }
  604.             }
  605.  
  606.             WHILE (!_wfindnext(Handle, &Data));
  607.         }
  608.  
  609.         RETURN FALSE;
  610.     }
  611.  
  612.     BOOL EnumerateFiles(LPARAM Flag, PCHAR Directory, PCHAR Extension, VOID Function(PCHAR, LPARAM))
  613.     {
  614.         IF (Directory AND Extension AND Function)
  615.         {
  616.             STATIC INT_PTR Handle = NULL;
  617.  
  618.             STATIC FINDDATA Data;
  619.  
  620.             Handle = _findfirst(Directory, &Data);
  621.  
  622.             IF (Handle == -1L)
  623.             {
  624.                 RETURN FALSE;
  625.             }
  626.  
  627.             do
  628.             {
  629.  
  630.                 IF (FileHasExtension(Data.name, SIZEOF(Data.name), Extension))
  631.                 {
  632.                     Function(Data.name, Flag);
  633.                 }
  634.             }
  635.  
  636.             WHILE (!_findnext(Handle, &Data));
  637.         }
  638.  
  639.         RETURN FALSE;
  640.     }
  641.  
  642.     PCHAR StripFirstWordFromBuffer(PCHAR Buffer)
  643.     {
  644.         IF (Buffer)
  645.         {
  646.             STATIC std::string String = "";
  647.  
  648.             STATIC SIZE_T Iterator = 0U;
  649.             STATIC SIZE_T Try = 0U;
  650.  
  651.             STATIC BOOL StartCopy = FALSE;
  652.             STATIC BOOL IsComment = FALSE;
  653.             STATIC BOOL IsSpace = FALSE;
  654.  
  655.             StartCopy = FALSE;
  656.             IsComment = FALSE;
  657.             IsSpace = FALSE;
  658.  
  659.             String = "";
  660.  
  661.             FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  662.             {
  663.                 IsSpace = isspace(Buffer[Iterator]) OR Buffer[Iterator] == ' ' OR Buffer[Iterator] == '\t' ? TRUE : FALSE;
  664.  
  665.                 IF (IsSpace)
  666.                 {
  667.                     StartCopy = TRUE;
  668.  
  669.                     String += Buffer[Iterator];
  670.  
  671.                     CONTINUE;
  672.                 }
  673.  
  674.                 ELSE IF (Buffer[Iterator] == '/' AND Buffer[Iterator + 1U] == '*')
  675.                 {
  676.                     IsComment = TRUE;
  677.  
  678.                     CONTINUE;
  679.                 }
  680.  
  681.                 ELSE IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '*')
  682.                 {
  683.                     IsComment = FALSE;
  684.  
  685.                     CONTINUE;
  686.                 }
  687.  
  688.                 ELSE IF (StartCopy AND !IsComment)
  689.                 {
  690.                     String += Buffer[Iterator];
  691.                 }
  692.             }
  693.  
  694.             IF (String.length())
  695.             {
  696.                 RETURN (PCHAR)String.c_str();
  697.             }
  698.         }
  699.  
  700.         RETURN NULL;
  701.     }
  702.  
  703.     PWCHAR StripFirstWordFromBuffer(PWCHAR Buffer)
  704.     {
  705.         IF (Buffer)
  706.         {
  707.             STATIC std::wstring String = L"";
  708.  
  709.             STATIC SIZE_T Iterator = 0U;
  710.  
  711.             STATIC BOOL StartCopy = FALSE;
  712.             STATIC BOOL IsComment = FALSE;
  713.             STATIC BOOL IsSpace = FALSE;
  714.  
  715.             StartCopy = FALSE;
  716.             IsComment = FALSE;
  717.             IsSpace = FALSE;
  718.  
  719.             String = L"";
  720.  
  721.             FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  722.             {
  723.                 IsSpace = iswspace(Buffer[Iterator]) OR Buffer[Iterator] == (WCHAR)L' ' OR Buffer[Iterator] == (WCHAR)L'\t' ? TRUE : FALSE;
  724.  
  725.                 IF (IsSpace)
  726.                 {
  727.                     StartCopy = TRUE;
  728.  
  729.                     String += Buffer[Iterator];
  730.  
  731.                     CONTINUE;
  732.                 }
  733.  
  734.                 ELSE IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator + 1U] == (WCHAR)L'*')
  735.                 {
  736.                     IsComment = TRUE;
  737.  
  738.                     CONTINUE;
  739.                 }
  740.  
  741.                 ELSE IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'*')
  742.                 {
  743.                     IsComment = FALSE;
  744.  
  745.                     CONTINUE;
  746.                 }
  747.  
  748.                 ELSE IF (StartCopy AND !IsComment)
  749.                 {
  750.                     String += Buffer[Iterator];
  751.                 }
  752.             }
  753.  
  754.             IF (String.length())
  755.             {
  756.                 RETURN (PWCHAR)String.c_str();
  757.             }
  758.         }
  759.  
  760.         RETURN NULL;
  761.     }
  762.  
  763.     PCHAR StripFirstWordFromBufferStock(PCHAR Buffer)
  764.     {
  765.         IF (Buffer)
  766.         {
  767.             STATIC std::string String = "";
  768.  
  769.             STATIC SIZE_T Iterator = 0U;
  770.  
  771.             STATIC BOOL StartCopy = FALSE;
  772.             STATIC BOOL IsComment = FALSE;
  773.             STATIC BOOL IsSpace = FALSE;
  774.             STATIC BOOL HasBrackets = FALSE;
  775.  
  776.             StartCopy = FALSE;
  777.             IsComment = FALSE;
  778.             IsSpace = FALSE;
  779.  
  780.             HasBrackets = strchr(Buffer, '(') OR strchr(Buffer, ')') ? TRUE : FALSE;
  781.  
  782.             String = "";
  783.  
  784.             FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  785.             {
  786.                 IsSpace = isspace(Buffer[Iterator]) OR Buffer[Iterator] == ' ' OR Buffer[Iterator] == '\t' ? TRUE : FALSE;
  787.  
  788.                 IF ((!HasBrackets AND (Buffer[Iterator] == '=' OR Buffer[Iterator] == '[')) OR Buffer[Iterator] == ';')
  789.                 {
  790.                     BREAK;
  791.                 }
  792.  
  793.                 ELSE IF (IsSpace)
  794.                 {
  795.                     StartCopy = TRUE;
  796.  
  797.                     String += Buffer[Iterator];
  798.  
  799.                     CONTINUE;
  800.                 }
  801.  
  802.                 ELSE IF (Buffer[Iterator] == '/' AND Buffer[Iterator + 1U] == '*')
  803.                 {
  804.                     IsComment = TRUE;
  805.  
  806.                     CONTINUE;
  807.                 }
  808.  
  809.                 ELSE IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '*')
  810.                 {
  811.                     IsComment = FALSE;
  812.  
  813.                     CONTINUE;
  814.                 }
  815.  
  816.                 ELSE IF (StartCopy AND !IsComment)
  817.                 {
  818.                     String += Buffer[Iterator];
  819.                 }
  820.             }
  821.  
  822.             IF (String.length())
  823.             {
  824.                 RETURN (PCHAR)String.c_str();
  825.             }
  826.         }
  827.  
  828.         RETURN NULL;
  829.     }
  830.  
  831.     PWCHAR StripFirstWordFromBufferStock(PWCHAR Buffer)
  832.     {
  833.         IF (Buffer)
  834.         {
  835.             STATIC std::wstring String = L"";
  836.  
  837.             STATIC SIZE_T Iterator = 0U;
  838.  
  839.             STATIC BOOL StartCopy = FALSE;
  840.             STATIC BOOL IsComment = FALSE;
  841.             STATIC BOOL IsSpace = FALSE;
  842.             STATIC BOOL HasBrackets = FALSE;
  843.  
  844.             StartCopy = FALSE;
  845.             IsSpace = FALSE;
  846.             IsComment = FALSE;
  847.  
  848.             HasBrackets = wcschr(Buffer, (WCHAR)L'(') OR wcschr(Buffer, (WCHAR)L')') ? TRUE : FALSE;
  849.  
  850.             String = L"";
  851.  
  852.             FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  853.             {
  854.                 IsSpace = iswspace(Buffer[Iterator]) OR Buffer[Iterator] == (WCHAR)L' ' OR Buffer[Iterator] == (WCHAR)L'\t' ? TRUE : FALSE;
  855.  
  856.                 IF ((!HasBrackets AND (Buffer[Iterator] == (WCHAR)L'=' OR Buffer[Iterator] == (WCHAR)L'[')) OR Buffer[Iterator] == (WCHAR)L';')
  857.                 {
  858.                     BREAK;
  859.                 }
  860.  
  861.                 ELSE IF (IsSpace)
  862.                 {
  863.                     StartCopy = TRUE;
  864.  
  865.                     String += Buffer[Iterator];
  866.  
  867.                     CONTINUE;
  868.                 }
  869.  
  870.                 ELSE IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator + 1U] == (WCHAR)L'*')
  871.                 {
  872.                     IsComment = TRUE;
  873.  
  874.                     CONTINUE;
  875.                 }
  876.  
  877.                 ELSE IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'*')
  878.                 {
  879.                     IsComment = FALSE;
  880.  
  881.                     CONTINUE;
  882.                 }
  883.  
  884.                 ELSE IF (StartCopy AND !IsComment)
  885.                 {
  886.                     String += Buffer[Iterator];
  887.                 }
  888.             }
  889.  
  890.             IF (String.length())
  891.             {
  892.                 RETURN (PWCHAR)String.c_str();
  893.             }
  894.         }
  895.  
  896.         RETURN NULL;
  897.     }
  898.  
  899.     PCHAR StripFirstWordFromBufferDefinition(PCHAR Buffer)
  900.     {
  901.         IF (Buffer)
  902.         {
  903.             STATIC std::string String = "";
  904.  
  905.             STATIC SIZE_T Iterator = 0U;
  906.  
  907.             STATIC BOOL StartCopy = FALSE;
  908.             STATIC BOOL IsComment = FALSE;
  909.             STATIC BOOL IsSpace = FALSE;
  910.             STATIC BOOL HasBrackets = FALSE;
  911.  
  912.             StartCopy = FALSE;
  913.             IsComment = FALSE;
  914.             IsSpace = FALSE;
  915.             HasBrackets = FALSE;
  916.  
  917.             String = "";
  918.  
  919.             IF (strchr(Buffer, '%') AND ((strchr(Buffer, ')') AND strchr(Buffer, '(')) OR (strchr(Buffer, ']') AND strchr(Buffer, '['))))
  920.             {
  921.                 HasBrackets = TRUE;
  922.             }
  923.  
  924.             FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  925.             {
  926.                 IsSpace = isspace(Buffer[Iterator]) OR Buffer[Iterator] == ' ' OR Buffer[Iterator] == '\t' ? TRUE : FALSE;
  927.  
  928.                 IF (IsSpace)
  929.                 {
  930.                     StartCopy = TRUE;
  931.  
  932.                     IF (!HasBrackets AND String.length())
  933.                     {
  934.                         BREAK;
  935.                     }
  936.  
  937.                     String += Buffer[Iterator];
  938.  
  939.                     CONTINUE;
  940.                 }
  941.  
  942.                 ELSE IF (Buffer[Iterator] == '/' AND Buffer[Iterator + 1U] == '*')
  943.                 {
  944.                     IsComment = TRUE;
  945.  
  946.                     CONTINUE;
  947.                 }
  948.  
  949.                 ELSE IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '*')
  950.                 {
  951.                     IsComment = FALSE;
  952.  
  953.                     CONTINUE;
  954.                 }
  955.  
  956.                 ELSE IF (StartCopy AND !IsComment)
  957.                 {
  958.                     String += Buffer[Iterator];
  959.                 }
  960.             }
  961.  
  962.             IF (String.length())
  963.             {
  964.                 RETURN (PCHAR)String.c_str();
  965.             }
  966.         }
  967.  
  968.         RETURN NULL;
  969.     }
  970.  
  971.     PWCHAR StripFirstWordFromBufferDefinition(PWCHAR Buffer)
  972.     {
  973.         IF (Buffer)
  974.         {
  975.             STATIC std::wstring String = L"";
  976.  
  977.             STATIC SIZE_T Iterator = 0U;
  978.  
  979.             STATIC BOOL StartCopy = FALSE;
  980.             STATIC BOOL IsComment = FALSE;
  981.             STATIC BOOL IsSpace = FALSE;
  982.             STATIC BOOL HasBrackets = FALSE;
  983.  
  984.             StartCopy = FALSE;
  985.             IsComment = FALSE;
  986.             IsSpace = FALSE;
  987.             HasBrackets = FALSE;
  988.  
  989.             String = L"";
  990.  
  991.             IF (wcschr(Buffer, (WCHAR)L'%') AND ((wcschr(Buffer, (WCHAR)L')') AND wcschr(Buffer, (WCHAR)L'(')) OR (wcschr(Buffer, (WCHAR)L']') AND wcschr(Buffer, (WCHAR)L'['))))
  992.             {
  993.                 HasBrackets = TRUE;
  994.             }
  995.  
  996.             FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  997.             {
  998.                 IsSpace = iswspace(Buffer[Iterator]) OR Buffer[Iterator] == (WCHAR)L' ' OR Buffer[Iterator] == (WCHAR)L'\t' ? TRUE : FALSE;
  999.  
  1000.                 IF (IsSpace)
  1001.                 {
  1002.                     StartCopy = TRUE;
  1003.  
  1004.                     IF (!HasBrackets AND String.length())
  1005.                     {
  1006.                         BREAK;
  1007.                     }
  1008.  
  1009.                     String += Buffer[Iterator];
  1010.  
  1011.                     CONTINUE;
  1012.                 }
  1013.  
  1014.                 ELSE IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator + 1U] == (WCHAR)L'*')
  1015.                 {
  1016.                     IsComment = TRUE;
  1017.  
  1018.                     CONTINUE;
  1019.                 }
  1020.  
  1021.                 ELSE IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'*')
  1022.                 {
  1023.                     IsComment = FALSE;
  1024.  
  1025.                     CONTINUE;
  1026.                 }
  1027.  
  1028.                 ELSE IF (StartCopy AND !IsComment)
  1029.                 {
  1030.                     String += Buffer[Iterator];
  1031.                 }
  1032.             }
  1033.  
  1034.             IF (String.length())
  1035.             {
  1036.                 RETURN (PWCHAR)String.c_str();
  1037.             }
  1038.         }
  1039.  
  1040.         RETURN NULL;
  1041.     }
  1042.  
  1043.     PCHAR GetFunctionName(PCHAR Buffer)
  1044.     {
  1045.         IF (Buffer)
  1046.         {
  1047.             STATIC std::string Function = "";
  1048.  
  1049.             STATIC SIZE_T Iterator = 0U;
  1050.  
  1051.             Function = "";
  1052.  
  1053.             FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1054.             {
  1055.                 IF (Buffer[Iterator] != '(' AND isprint(Buffer[Iterator]))
  1056.                 {
  1057.                     Function += Buffer[Iterator];
  1058.                 }
  1059.  
  1060.                 ELSE
  1061.                 {
  1062.                     BREAK;
  1063.                 }
  1064.             }
  1065.  
  1066.             IF (Function.length())
  1067.             {
  1068.                 RETURN Trim((PCHAR)Function.c_str());
  1069.             }
  1070.         }
  1071.  
  1072.         RETURN NULL;
  1073.     }
  1074.  
  1075.     PWCHAR GetFunctionName(PWCHAR Buffer)
  1076.     {
  1077.         IF (Buffer)
  1078.         {
  1079.             STATIC std::wstring Function = L"";
  1080.  
  1081.             STATIC SIZE_T Iterator = 0U;
  1082.  
  1083.             Function = L"";
  1084.  
  1085.             FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1086.             {
  1087.                 IF (Buffer[Iterator] != (WCHAR)L'(' AND iswprint(Buffer[Iterator]))
  1088.                 {
  1089.                     Function += Buffer[Iterator];
  1090.                 }
  1091.  
  1092.                 ELSE
  1093.                 {
  1094.                     BREAK;
  1095.                 }
  1096.             }
  1097.  
  1098.             IF (Function.length())
  1099.             {
  1100.                 RETURN Trim((PWCHAR)Function.c_str());
  1101.             }
  1102.         }
  1103.  
  1104.         RETURN NULL;
  1105.     }
  1106.  
  1107.     PCHAR GetFunctionNameStock(PCHAR Buffer)
  1108.     {
  1109.         IF (Buffer)
  1110.         {
  1111.             STATIC std::string Function = "";
  1112.  
  1113.             STATIC SIZE_T Iterator = 0U;
  1114.  
  1115.             Function = "";
  1116.  
  1117.             FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1118.             {
  1119.                 IF (Buffer[Iterator] != '(' AND isprint(Buffer[Iterator]))
  1120.                 {
  1121.                     Function += Buffer[Iterator];
  1122.                 }
  1123.  
  1124.                 ELSE
  1125.                 {
  1126.                     BREAK;
  1127.                 }
  1128.             }
  1129.  
  1130.             IF (Function.length())
  1131.             {
  1132.                 RETURN Trim((PCHAR)Function.c_str());
  1133.             }
  1134.         }
  1135.  
  1136.         RETURN NULL;
  1137.     }
  1138.  
  1139.     PWCHAR GetFunctionNameStock(PWCHAR Buffer)
  1140.     {
  1141.         IF (Buffer)
  1142.         {
  1143.             STATIC std::wstring Function = L"";
  1144.  
  1145.             STATIC SIZE_T Iterator = 0U;
  1146.  
  1147.             Function = L"";
  1148.  
  1149.             FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1150.             {
  1151.                 IF (Buffer[Iterator] != (WCHAR)L'(' AND iswprint(Buffer[Iterator]))
  1152.                 {
  1153.                     Function += Buffer[Iterator];
  1154.                 }
  1155.  
  1156.                 ELSE
  1157.                 {
  1158.                     BREAK;
  1159.                 }
  1160.             }
  1161.  
  1162.             IF (Function.length())
  1163.             {
  1164.                 RETURN Trim((PWCHAR)Function.c_str());
  1165.             }
  1166.         }
  1167.  
  1168.         RETURN NULL;
  1169.     }
  1170.  
  1171.     PCHAR GetFunctionNameDefinition(PCHAR Buffer)
  1172.     {
  1173.         IF (Buffer)
  1174.         {
  1175.             STATIC std::string Function = "";
  1176.  
  1177.             STATIC SIZE_T Iterator = 0U;
  1178.  
  1179.             STATIC BOOL HasRightBrackets = FALSE;
  1180.             STATIC BOOL HasBrackets = FALSE;
  1181.             STATIC BOOL UseRightBrackets = FALSE;
  1182.             STATIC BOOL HasSlash = FALSE;
  1183.  
  1184.             STATIC INT OpenRightBracketPosition = 0U;
  1185.             STATIC INT CloseRightBracketPosition = 0U;
  1186.  
  1187.             STATIC INT OpenBracketPosition = 0U;
  1188.             STATIC INT CloseBracketPosition = 0U;
  1189.  
  1190.             STATIC INT SlashPosition = 0U;
  1191.  
  1192.             HasRightBrackets = FALSE;
  1193.             HasBrackets = FALSE;
  1194.             UseRightBrackets = FALSE;
  1195.  
  1196.             HasSlash = strchr(Buffer, '/') ? TRUE : FALSE;
  1197.  
  1198.             SlashPosition = GetFirstCharacterPositionInString(Buffer, '/');
  1199.  
  1200.             IF (strchr(Buffer, '[') AND strchr(Buffer, ']'))
  1201.             {
  1202.                 HasRightBrackets = TRUE;
  1203.  
  1204.                 OpenRightBracketPosition = GetFirstCharacterPositionInString(Buffer, '[');
  1205.                 CloseRightBracketPosition = GetFirstCharacterPositionInString(Buffer, ']');
  1206.  
  1207.                 IF (HasSlash)
  1208.                 {
  1209.                     IF (SlashPosition != -1 AND SlashPosition < OpenRightBracketPosition)
  1210.                     {
  1211.                         HasRightBrackets = FALSE;
  1212.                     }
  1213.                 }
  1214.             }
  1215.  
  1216.             IF (strchr(Buffer, ')') AND strchr(Buffer, '('))
  1217.             {
  1218.                 HasBrackets = TRUE;
  1219.  
  1220.                 OpenBracketPosition = GetFirstCharacterPositionInString(Buffer, '(');
  1221.                 CloseBracketPosition = GetFirstCharacterPositionInString(Buffer, ')');
  1222.  
  1223.                 IF (HasSlash)
  1224.                 {
  1225.                     IF (SlashPosition != -1 AND SlashPosition < OpenBracketPosition)
  1226.                     {
  1227.                         HasBrackets = FALSE;
  1228.                     }
  1229.                 }
  1230.             }
  1231.  
  1232.             IF (HasBrackets AND !HasRightBrackets)
  1233.             {
  1234.                 UseRightBrackets = FALSE;
  1235.             }
  1236.  
  1237.             ELSE IF (!HasBrackets AND HasRightBrackets)
  1238.             {
  1239.                 UseRightBrackets = TRUE;
  1240.             }
  1241.  
  1242.             ELSE IF (!HasSlash)
  1243.             {
  1244.                 IF (OpenRightBracketPosition < OpenBracketPosition AND CloseRightBracketPosition < CloseBracketPosition)
  1245.                 {
  1246.                     UseRightBrackets = TRUE;
  1247.                 }
  1248.  
  1249.                 ELSE
  1250.                 {
  1251.                     UseRightBrackets = FALSE;
  1252.                 }
  1253.             }
  1254.  
  1255.             Function = "";
  1256.  
  1257.             IF (UseRightBrackets)
  1258.             {
  1259.                 IF (strchr(Buffer, '[') AND strchr(Buffer, ']'))
  1260.                 {
  1261.                     FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1262.                     {
  1263.                         IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '/')
  1264.                         {
  1265.                             BREAK;
  1266.                         }
  1267.  
  1268.                         ELSE IF (Buffer[Iterator + 1U] == '/' AND Buffer[Iterator] == '/')
  1269.                         {
  1270.                             BREAK;
  1271.                         }
  1272.  
  1273.                         ELSE IF (Buffer[Iterator] != '[' AND isprint(Buffer[Iterator]))
  1274.                         {
  1275.                             Function += Buffer[Iterator];
  1276.                         }
  1277.  
  1278.                         ELSE
  1279.                         {
  1280.                             BREAK;
  1281.                         }
  1282.                     }
  1283.                 }
  1284.  
  1285.                 ELSE IF (strchr(Buffer, '(') AND strchr(Buffer, ')'))
  1286.                 {
  1287.                     FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1288.                     {
  1289.                         IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '/')
  1290.                         {
  1291.                             BREAK;
  1292.                         }
  1293.  
  1294.                         ELSE IF (Buffer[Iterator + 1U] == '/' AND Buffer[Iterator] == '/')
  1295.                         {
  1296.                             BREAK;
  1297.                         }
  1298.  
  1299.                         ELSE IF (Buffer[Iterator] != '(' AND isprint(Buffer[Iterator]))
  1300.                         {
  1301.                             Function += Buffer[Iterator];
  1302.                         }
  1303.  
  1304.                         ELSE
  1305.                         {
  1306.                             BREAK;
  1307.                         }
  1308.                     }
  1309.                 }
  1310.  
  1311.                 ELSE
  1312.                 {
  1313.                     FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1314.                     {
  1315.                         IF (isprint(Buffer[Iterator]))
  1316.                         {
  1317.                             IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '/')
  1318.                             {
  1319.                                 BREAK;
  1320.                             }
  1321.  
  1322.                             ELSE IF (Buffer[Iterator + 1U] == '/' AND Buffer[Iterator] == '/')
  1323.                             {
  1324.                                 BREAK;
  1325.                             }
  1326.  
  1327.                             Function += Buffer[Iterator];
  1328.                         }
  1329.                     }
  1330.                 }
  1331.             }
  1332.  
  1333.             ELSE
  1334.             {
  1335.                 IF (strchr(Buffer, '(') AND strchr(Buffer, ')'))
  1336.                 {
  1337.                     FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1338.                     {
  1339.                         IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '/')
  1340.                         {
  1341.                             BREAK;
  1342.                         }
  1343.  
  1344.                         ELSE IF (Buffer[Iterator + 1U] == '/' AND Buffer[Iterator] == '/')
  1345.                         {
  1346.                             BREAK;
  1347.                         }
  1348.  
  1349.                         ELSE IF (Buffer[Iterator] != '(' AND isprint(Buffer[Iterator]))
  1350.                         {
  1351.                             Function += Buffer[Iterator];
  1352.                         }
  1353.  
  1354.                         ELSE
  1355.                         {
  1356.                             BREAK;
  1357.                         }
  1358.                     }
  1359.                 }
  1360.  
  1361.                 ELSE IF (strchr(Buffer, '[') AND strchr(Buffer, ']'))
  1362.                 {
  1363.                     FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1364.                     {
  1365.                         IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '/')
  1366.                         {
  1367.                             BREAK;
  1368.                         }
  1369.  
  1370.                         ELSE IF (Buffer[Iterator + 1U] == '/' AND Buffer[Iterator] == '/')
  1371.                         {
  1372.                             BREAK;
  1373.                         }
  1374.  
  1375.                         ELSE IF (Buffer[Iterator] != '[' AND isprint(Buffer[Iterator]))
  1376.                         {
  1377.                             Function += Buffer[Iterator];
  1378.                         }
  1379.  
  1380.                         ELSE
  1381.                         {
  1382.                             BREAK;
  1383.                         }
  1384.                     }
  1385.                 }
  1386.  
  1387.                 ELSE
  1388.                 {
  1389.                     FOR (Iterator = 0U; Iterator < strlen(Buffer); Iterator++)
  1390.                     {
  1391.                         IF (isprint(Buffer[Iterator]))
  1392.                         {
  1393.                             IF (Buffer[Iterator] == '/' AND Buffer[Iterator - 1U] == '/')
  1394.                             {
  1395.                                 BREAK;
  1396.                             }
  1397.  
  1398.                             ELSE IF (Buffer[Iterator + 1U] == '/' AND Buffer[Iterator] == '/')
  1399.                             {
  1400.                                 BREAK;
  1401.                             }
  1402.  
  1403.                             Function += Buffer[Iterator];
  1404.                         }
  1405.                     }
  1406.                 }
  1407.             }
  1408.  
  1409.             IF (Function.length())
  1410.             {
  1411.                 RETURN Trim((PCHAR)Function.c_str());
  1412.             }
  1413.         }
  1414.  
  1415.         RETURN NULL;
  1416.     }
  1417.  
  1418.     PWCHAR GetFunctionNameDefinition(PWCHAR Buffer)
  1419.     {
  1420.         IF (Buffer)
  1421.         {
  1422.             STATIC std::wstring Function = L"";
  1423.  
  1424.             STATIC SIZE_T Iterator = 0U;
  1425.  
  1426.             STATIC BOOL HasRightBrackets = FALSE;
  1427.             STATIC BOOL HasBrackets = FALSE;
  1428.             STATIC BOOL UseRightBrackets = FALSE;
  1429.             STATIC BOOL HasSlash = FALSE;
  1430.  
  1431.             STATIC INT OpenRightBracketPosition = 0U;
  1432.             STATIC INT CloseRightBracketPosition = 0U;
  1433.  
  1434.             STATIC INT OpenBracketPosition = 0U;
  1435.             STATIC INT CloseBracketPosition = 0U;
  1436.  
  1437.             STATIC INT SlashPosition = 0U;
  1438.  
  1439.             HasRightBrackets = FALSE;
  1440.             HasBrackets = FALSE;
  1441.             UseRightBrackets = FALSE;
  1442.  
  1443.             HasSlash = wcschr(Buffer, (WCHAR)L'/') ? TRUE : FALSE;
  1444.  
  1445.             SlashPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'/');
  1446.  
  1447.             IF (wcschr(Buffer, (WCHAR)L'[') AND wcschr(Buffer, (WCHAR)L']'))
  1448.             {
  1449.                 HasRightBrackets = TRUE;
  1450.  
  1451.                 OpenRightBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'[');
  1452.                 CloseRightBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L']');
  1453.  
  1454.                 IF (HasSlash)
  1455.                 {
  1456.                     IF (SlashPosition != -1 AND SlashPosition < OpenRightBracketPosition)
  1457.                     {
  1458.                         HasRightBrackets = FALSE;
  1459.                     }
  1460.                 }
  1461.             }
  1462.  
  1463.             IF (wcschr(Buffer, (WCHAR)L')') AND wcschr(Buffer, (WCHAR)L'('))
  1464.             {
  1465.                 HasBrackets = TRUE;
  1466.  
  1467.                 OpenBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'(');
  1468.                 CloseBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L')');
  1469.  
  1470.                 IF (HasSlash)
  1471.                 {
  1472.                     IF (SlashPosition != -1 AND SlashPosition < OpenBracketPosition)
  1473.                     {
  1474.                         HasBrackets = FALSE;
  1475.                     }
  1476.                 }
  1477.             }
  1478.  
  1479.             IF (HasBrackets AND !HasRightBrackets)
  1480.             {
  1481.                 UseRightBrackets = FALSE;
  1482.             }
  1483.  
  1484.             ELSE IF (!HasBrackets AND HasRightBrackets)
  1485.             {
  1486.                 UseRightBrackets = TRUE;
  1487.             }
  1488.  
  1489.             ELSE IF (!HasSlash)
  1490.             {
  1491.                 IF (OpenRightBracketPosition < OpenBracketPosition AND CloseRightBracketPosition < CloseBracketPosition)
  1492.                 {
  1493.                     UseRightBrackets = TRUE;
  1494.                 }
  1495.  
  1496.                 ELSE
  1497.                 {
  1498.                     UseRightBrackets = FALSE;
  1499.                 }
  1500.             }
  1501.  
  1502.             Function = L"";
  1503.  
  1504.             IF (UseRightBrackets)
  1505.             {
  1506.                 IF (wcschr(Buffer, (WCHAR)L'[') AND wcschr(Buffer, (WCHAR)L']'))
  1507.                 {
  1508.                     FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1509.                     {
  1510.                         IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'/')
  1511.                         {
  1512.                             BREAK;
  1513.                         }
  1514.  
  1515.                         ELSE IF (Buffer[Iterator + 1U] == (WCHAR)L'/' AND Buffer[Iterator] == (WCHAR)L'/')
  1516.                         {
  1517.                             BREAK;
  1518.                         }
  1519.  
  1520.                         ELSE IF (Buffer[Iterator] != (WCHAR)L'[' AND iswprint(Buffer[Iterator]))
  1521.                         {
  1522.                             Function += Buffer[Iterator];
  1523.                         }
  1524.  
  1525.                         ELSE
  1526.                         {
  1527.                             BREAK;
  1528.                         }
  1529.                     }
  1530.                 }
  1531.  
  1532.                 ELSE IF (wcschr(Buffer, (WCHAR)L'(') AND wcschr(Buffer, (WCHAR)L')'))
  1533.                 {
  1534.                     FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1535.                     {
  1536.                         IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'/')
  1537.                         {
  1538.                             BREAK;
  1539.                         }
  1540.  
  1541.                         ELSE IF (Buffer[Iterator + 1U] == (WCHAR)L'/' AND Buffer[Iterator] == (WCHAR)L'/')
  1542.                         {
  1543.                             BREAK;
  1544.                         }
  1545.  
  1546.                         ELSE IF (Buffer[Iterator] != (WCHAR)L'(' AND iswprint(Buffer[Iterator]))
  1547.                         {
  1548.                             Function += Buffer[Iterator];
  1549.                         }
  1550.  
  1551.                         ELSE
  1552.                         {
  1553.                             BREAK;
  1554.                         }
  1555.                     }
  1556.                 }
  1557.  
  1558.                 ELSE
  1559.                 {
  1560.                     FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1561.                     {
  1562.                         IF (iswprint(Buffer[Iterator]))
  1563.                         {
  1564.                             IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'/')
  1565.                             {
  1566.                                 BREAK;
  1567.                             }
  1568.  
  1569.                             ELSE IF (Buffer[Iterator + 1U] == (WCHAR)L'/' AND Buffer[Iterator] == (WCHAR)L'/')
  1570.                             {
  1571.                                 BREAK;
  1572.                             }
  1573.  
  1574.                             Function += Buffer[Iterator];
  1575.                         }
  1576.                     }
  1577.                 }
  1578.             }
  1579.  
  1580.             ELSE
  1581.             {
  1582.                 IF (wcschr(Buffer, (WCHAR)L'(') AND wcschr(Buffer, (WCHAR)L')'))
  1583.                 {
  1584.                     FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1585.                     {
  1586.                         IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'/')
  1587.                         {
  1588.                             BREAK;
  1589.                         }
  1590.  
  1591.                         ELSE IF (Buffer[Iterator + 1U] == (WCHAR)L'/' AND Buffer[Iterator] == (WCHAR)L'/')
  1592.                         {
  1593.                             BREAK;
  1594.                         }
  1595.  
  1596.                         ELSE IF (Buffer[Iterator] != (WCHAR)L'(' AND iswprint(Buffer[Iterator]))
  1597.                         {
  1598.                             Function += Buffer[Iterator];
  1599.                         }
  1600.  
  1601.                         ELSE
  1602.                         {
  1603.                             BREAK;
  1604.                         }
  1605.                     }
  1606.                 }
  1607.  
  1608.                 ELSE IF (wcschr(Buffer, (WCHAR)L'[') AND wcschr(Buffer, (WCHAR)L']'))
  1609.                 {
  1610.                     FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1611.                     {
  1612.                         IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'/')
  1613.                         {
  1614.                             BREAK;
  1615.                         }
  1616.  
  1617.                         ELSE IF (Buffer[Iterator + 1U] == (WCHAR)L'/' AND Buffer[Iterator] == (WCHAR)L'/')
  1618.                         {
  1619.                             BREAK;
  1620.                         }
  1621.  
  1622.                         ELSE IF (Buffer[Iterator] != (WCHAR)L'[' AND iswprint(Buffer[Iterator]))
  1623.                         {
  1624.                             Function += Buffer[Iterator];
  1625.                         }
  1626.  
  1627.                         ELSE
  1628.                         {
  1629.                             BREAK;
  1630.                         }
  1631.                     }
  1632.                 }
  1633.  
  1634.                 ELSE
  1635.                 {
  1636.                     FOR (Iterator = 0U; Iterator < wcslen(Buffer); Iterator++)
  1637.                     {
  1638.                         IF (iswprint(Buffer[Iterator]))
  1639.                         {
  1640.                             IF (Buffer[Iterator] == (WCHAR)L'/' AND Buffer[Iterator - 1U] == (WCHAR)L'/')
  1641.                             {
  1642.                                 BREAK;
  1643.                             }
  1644.  
  1645.                             ELSE IF (Buffer[Iterator + 1U] == (WCHAR)L'/' AND Buffer[Iterator] == (WCHAR)L'/')
  1646.                             {
  1647.                                 BREAK;
  1648.                             }
  1649.  
  1650.                             Function += Buffer[Iterator];
  1651.                         }
  1652.                     }
  1653.                 }
  1654.             }
  1655.  
  1656.             IF (Function.length())
  1657.             {
  1658.                 RETURN Trim((PWCHAR)Function.c_str());
  1659.             }
  1660.         }
  1661.  
  1662.         RETURN NULL;
  1663.     }
  1664.  
  1665.     PWCHAR GetParametersDefinition(PWCHAR Buffer)
  1666.     {
  1667.         IF (Buffer)
  1668.         {
  1669.             STATIC BOOL UseNormalBrackets = FALSE;
  1670.             STATIC BOOL RightBracketsFound = FALSE;
  1671.             STATIC BOOL BracketsFound = FALSE;
  1672.  
  1673.             STATIC INT OpeningBracketPosition = 0U;
  1674.             STATIC INT ClosingBracketPosition = 0U;
  1675.  
  1676.             STATIC INT OpeningRightBracketPosition = 0U;
  1677.             STATIC INT ClosingRightBracketPosition = 0U;
  1678.  
  1679.             UseNormalBrackets = FALSE;
  1680.             RightBracketsFound = FALSE;
  1681.             BracketsFound = FALSE;
  1682.  
  1683.             IF (wcschr(Buffer, (WCHAR)L'[') AND wcschr(Buffer, (WCHAR)L']'))
  1684.             {
  1685.                 OpeningRightBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'[');
  1686.                 ClosingRightBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L']');
  1687.  
  1688.                 RightBracketsFound = TRUE;
  1689.             }
  1690.  
  1691.             IF (wcschr(Buffer, (WCHAR)L'(') AND wcschr(Buffer, (WCHAR)L')'))
  1692.             {
  1693.                 OpeningBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'(');
  1694.                 ClosingBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L')');
  1695.  
  1696.                 BracketsFound = TRUE;
  1697.             }
  1698.  
  1699.             IF (RightBracketsFound AND !BracketsFound)
  1700.             {
  1701.                 UseNormalBrackets = FALSE;
  1702.             }
  1703.  
  1704.             ELSE IF (BracketsFound AND !RightBracketsFound)
  1705.             {
  1706.                 UseNormalBrackets = TRUE;
  1707.             }
  1708.  
  1709.             ELSE IF (BracketsFound AND RightBracketsFound)
  1710.             {
  1711.                 IF (OpeningBracketPosition < OpeningRightBracketPosition AND ClosingBracketPosition < ClosingRightBracketPosition)
  1712.                 {
  1713.                     UseNormalBrackets = TRUE;
  1714.                 }
  1715.  
  1716.                 ELSE
  1717.                 {
  1718.                     UseNormalBrackets = FALSE;
  1719.                 }
  1720.             }
  1721.  
  1722.             IF (BracketsFound OR RightBracketsFound)
  1723.             {
  1724.                 STATIC std::wstring Parameters = L"";
  1725.  
  1726.                 STATIC SIZE_T Iterator = 0U;
  1727.                 STATIC SIZE_T Start = 0U;
  1728.                 STATIC SIZE_T Finish = 0U;
  1729.  
  1730.                 STATIC BOOL Quotes = FALSE;
  1731.                 STATIC BOOL BigBrackets = FALSE;
  1732.  
  1733.                 Quotes = FALSE;
  1734.                 BigBrackets = FALSE;
  1735.  
  1736.                 Parameters = L"";
  1737.  
  1738.                 IF (UseNormalBrackets)
  1739.                 {
  1740.                     Start = (SIZE_T)OpeningBracketPosition + 1U;
  1741.                     Finish = (SIZE_T)ClosingBracketPosition;
  1742.                 }
  1743.  
  1744.                 ELSE
  1745.                 {
  1746.                     Start = (SIZE_T)OpeningRightBracketPosition + 1U;
  1747.                     Finish = (SIZE_T)ClosingRightBracketPosition;
  1748.                 }
  1749.  
  1750.                 FOR (Iterator = Start; Iterator < Finish; Iterator++)
  1751.                 {
  1752.                     IF (!Quotes AND (Buffer[Iterator] == (WCHAR)L'"' OR Buffer[Iterator] == (WCHAR)L'\''))
  1753.                     {
  1754.                         Quotes = TRUE;
  1755.  
  1756.                         CONTINUE;
  1757.                     }
  1758.  
  1759.                     ELSE IF (Quotes AND (Buffer[Iterator] == (WCHAR)L'"' OR Buffer[Iterator] == (WCHAR)L'\''))
  1760.                     {
  1761.                         Quotes = FALSE;
  1762.  
  1763.                         CONTINUE;
  1764.                     }
  1765.  
  1766.                     ELSE IF (!BigBrackets AND Buffer[Iterator] == (WCHAR)L'{')
  1767.                     {
  1768.                         Parameters += (WCHAR)L'{';
  1769.  
  1770.                         BigBrackets = TRUE;
  1771.  
  1772.                         CONTINUE;
  1773.                     }
  1774.  
  1775.                     ELSE IF (BigBrackets AND Buffer[Iterator] == (WCHAR)L'}')
  1776.                     {
  1777.                         Parameters += (WCHAR)L'}';
  1778.  
  1779.                         BigBrackets = FALSE;
  1780.  
  1781.                         CONTINUE;
  1782.                     }
  1783.  
  1784.                     ELSE IF (!Quotes)
  1785.                     {
  1786.                         IF (BigBrackets AND Buffer[Iterator] == (WCHAR)L',')
  1787.                         {
  1788.                             Parameters += (WCHAR)L'@';
  1789.  
  1790.                             CONTINUE;
  1791.                         }
  1792.  
  1793.                         Parameters += Buffer[Iterator];
  1794.                     }
  1795.                 }
  1796.  
  1797.                 IF (Parameters.length())
  1798.                 {
  1799.                     RETURN Trim((PWCHAR)Parameters.c_str());
  1800.                 }
  1801.             }
  1802.         }
  1803.  
  1804.         RETURN NULL;
  1805.     }
  1806.  
  1807.     PCHAR GetParametersDefinition(PCHAR Buffer)
  1808.     {
  1809.         IF (Buffer)
  1810.         {
  1811.             STATIC BOOL UseNormalBrackets = FALSE;
  1812.             STATIC BOOL RightBracketsFound = FALSE;
  1813.             STATIC BOOL BracketsFound = FALSE;
  1814.  
  1815.             STATIC INT OpeningBracketPosition = 0U;
  1816.             STATIC INT ClosingBracketPosition = 0U;
  1817.            
  1818.             STATIC INT OpeningRightBracketPosition = 0U;
  1819.             STATIC INT ClosingRightBracketPosition = 0U;
  1820.  
  1821.             UseNormalBrackets = FALSE;
  1822.             RightBracketsFound = FALSE;
  1823.             BracketsFound = FALSE;
  1824.  
  1825.             IF (strchr(Buffer, '[') AND strchr(Buffer, ']'))
  1826.             {
  1827.                 OpeningRightBracketPosition = GetFirstCharacterPositionInString(Buffer, '[');
  1828.                 ClosingRightBracketPosition = GetFirstCharacterPositionInString(Buffer, ']');
  1829.  
  1830.                 RightBracketsFound = TRUE;
  1831.             }
  1832.  
  1833.             IF (strchr(Buffer, '(') AND strchr(Buffer, ')'))
  1834.             {
  1835.                 OpeningBracketPosition = GetFirstCharacterPositionInString(Buffer, '(');
  1836.                 ClosingBracketPosition = GetFirstCharacterPositionInString(Buffer, ')');
  1837.  
  1838.                 BracketsFound = TRUE;
  1839.             }
  1840.  
  1841.             IF (RightBracketsFound AND !BracketsFound)
  1842.             {
  1843.                 UseNormalBrackets = FALSE;
  1844.             }
  1845.  
  1846.             ELSE IF (BracketsFound AND !RightBracketsFound)
  1847.             {
  1848.                 UseNormalBrackets = TRUE;
  1849.             }
  1850.  
  1851.             ELSE IF (BracketsFound AND RightBracketsFound)
  1852.             {
  1853.                 IF (OpeningBracketPosition < OpeningRightBracketPosition AND ClosingBracketPosition < ClosingRightBracketPosition)
  1854.                 {
  1855.                     UseNormalBrackets = TRUE;
  1856.                 }
  1857.  
  1858.                 ELSE
  1859.                 {
  1860.                     UseNormalBrackets = FALSE;
  1861.                 }
  1862.             }
  1863.  
  1864.             IF (BracketsFound OR RightBracketsFound)
  1865.             {
  1866.                 STATIC std::string Parameters = "";
  1867.  
  1868.                 STATIC SIZE_T Iterator = 0U;
  1869.                 STATIC SIZE_T Start = 0U;
  1870.                 STATIC SIZE_T Finish = 0U;
  1871.  
  1872.                 STATIC BOOL Quotes = FALSE;
  1873.                 STATIC BOOL BigBrackets = FALSE;
  1874.  
  1875.                 Quotes = FALSE;
  1876.                 BigBrackets = FALSE;
  1877.  
  1878.                 Parameters = "";
  1879.  
  1880.                 IF (UseNormalBrackets)
  1881.                 {
  1882.                     Start = (SIZE_T)OpeningBracketPosition + 1U;
  1883.                     Finish = (SIZE_T)ClosingBracketPosition;
  1884.                 }
  1885.  
  1886.                 ELSE
  1887.                 {
  1888.                     Start = (SIZE_T)OpeningRightBracketPosition + 1U;
  1889.                     Finish = (SIZE_T)ClosingRightBracketPosition;
  1890.                 }
  1891.  
  1892.                 FOR (Iterator = Start; Iterator < Finish; Iterator++)
  1893.                 {
  1894.                     IF (!Quotes AND (Buffer[Iterator] == '"' OR Buffer[Iterator] == '\''))
  1895.                     {
  1896.                         Quotes = TRUE;
  1897.  
  1898.                         CONTINUE;
  1899.                     }
  1900.  
  1901.                     ELSE IF (Quotes AND (Buffer[Iterator] == '"' OR Buffer[Iterator] == '\''))
  1902.                     {
  1903.                         Quotes = FALSE;
  1904.  
  1905.                         CONTINUE;
  1906.                     }
  1907.  
  1908.                     ELSE IF (!BigBrackets AND Buffer[Iterator] == '{')
  1909.                     {
  1910.                         Parameters += '{';
  1911.  
  1912.                         BigBrackets = TRUE;
  1913.  
  1914.                         CONTINUE;
  1915.                     }
  1916.  
  1917.                     ELSE IF (BigBrackets AND Buffer[Iterator] == '}')
  1918.                     {
  1919.                         Parameters += '}';
  1920.  
  1921.                         BigBrackets = FALSE;
  1922.  
  1923.                         CONTINUE;
  1924.                     }
  1925.  
  1926.                     ELSE IF (!Quotes)
  1927.                     {
  1928.                         IF (BigBrackets AND Buffer[Iterator] == ',')
  1929.                         {
  1930.                             Parameters += '@';
  1931.  
  1932.                             CONTINUE;
  1933.                         }
  1934.  
  1935.                         Parameters += Buffer[Iterator];
  1936.                     }
  1937.                 }
  1938.  
  1939.                 IF (Parameters.length())
  1940.                 {
  1941.                     RETURN Trim((PCHAR)Parameters.c_str());
  1942.                 }
  1943.             }
  1944.         }
  1945.  
  1946.         RETURN NULL;
  1947.     }
  1948.  
  1949.     PCHAR GetParameters(PCHAR Buffer)
  1950.     {
  1951.         IF (Buffer)
  1952.         {
  1953.             STATIC INT OpeningBracketPosition = 0U;
  1954.             STATIC INT ClosingBracketPosition = 0U;
  1955.  
  1956.             OpeningBracketPosition = GetFirstCharacterPositionInString(Buffer, '(');
  1957.             ClosingBracketPosition = GetFirstCharacterPositionInString(Buffer, ')');
  1958.  
  1959.             IF (OpeningBracketPosition != -1 AND ClosingBracketPosition != -1)
  1960.             {
  1961.                 STATIC std::string Parameters = "";
  1962.  
  1963.                 STATIC SIZE_T Iterator = 0U;
  1964.  
  1965.                 STATIC BOOL Quotes = FALSE;
  1966.                 STATIC BOOL BigBrackets = FALSE;
  1967.  
  1968.                 Quotes = FALSE;
  1969.                 BigBrackets = FALSE;
  1970.  
  1971.                 Parameters = "";
  1972.  
  1973.                 FOR (Iterator = (SIZE_T)OpeningBracketPosition + 1U; Iterator < (SIZE_T)ClosingBracketPosition; Iterator++)
  1974.                 {
  1975.                     IF (!Quotes AND (Buffer[Iterator] == '"' OR Buffer[Iterator] == '\''))
  1976.                     {
  1977.                         Quotes = TRUE;
  1978.  
  1979.                         CONTINUE;
  1980.                     }
  1981.  
  1982.                     ELSE IF (Quotes AND (Buffer[Iterator] == '"' OR Buffer[Iterator] == '\''))
  1983.                     {
  1984.                         Quotes = FALSE;
  1985.  
  1986.                         CONTINUE;
  1987.                     }
  1988.  
  1989.                     ELSE IF (!BigBrackets AND Buffer[Iterator] == '{')
  1990.                     {
  1991.                         Parameters += '{';
  1992.  
  1993.                         BigBrackets = TRUE;
  1994.  
  1995.                         CONTINUE;
  1996.                     }
  1997.  
  1998.                     ELSE IF (BigBrackets AND Buffer[Iterator] == '}')
  1999.                     {
  2000.                         Parameters += '}';
  2001.  
  2002.                         BigBrackets = FALSE;
  2003.  
  2004.                         CONTINUE;
  2005.                     }
  2006.  
  2007.                     ELSE IF (!Quotes)
  2008.                     {
  2009.                         IF (BigBrackets AND Buffer[Iterator] == ',')
  2010.                         {
  2011.                             Parameters += '@';
  2012.  
  2013.                             CONTINUE;
  2014.                         }
  2015.  
  2016.                         Parameters += Buffer[Iterator];
  2017.                     }
  2018.                 }
  2019.  
  2020.                 IF (Parameters.length())
  2021.                 {
  2022.                     RETURN Trim((PCHAR)Parameters.c_str());
  2023.                 }
  2024.             }
  2025.         }
  2026.  
  2027.         RETURN NULL;
  2028.     }
  2029.  
  2030.     PWCHAR GetParameters(PWCHAR Buffer)
  2031.     {
  2032.         IF (Buffer)
  2033.         {
  2034.             STATIC INT OpeningBracketPosition = 0U;
  2035.             STATIC INT ClosingBracketPosition = 0U;
  2036.  
  2037.             OpeningBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'(');
  2038.             ClosingBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L')');
  2039.  
  2040.             IF (OpeningBracketPosition != -1 AND ClosingBracketPosition != -1)
  2041.             {
  2042.                 STATIC std::wstring Parameters = L"";
  2043.  
  2044.                 STATIC SIZE_T Iterator = 0U;
  2045.  
  2046.                 STATIC BOOL Quotes = FALSE;
  2047.                 STATIC BOOL BigBrackets = FALSE;
  2048.  
  2049.                 Quotes = FALSE;
  2050.                 BigBrackets = FALSE;
  2051.  
  2052.                 Parameters = L"";
  2053.  
  2054.                 FOR (Iterator = (SIZE_T)OpeningBracketPosition + 1U; Iterator < (SIZE_T)ClosingBracketPosition; Iterator++)
  2055.                 {
  2056.                     IF (!Quotes AND (Buffer[Iterator] == (WCHAR)L'"' OR Buffer[Iterator] == (WCHAR)L'\''))
  2057.                     {
  2058.                         Quotes = TRUE;
  2059.  
  2060.                         CONTINUE;
  2061.                     }
  2062.  
  2063.                     ELSE IF (Quotes AND (Buffer[Iterator] == (WCHAR)L'"' OR Buffer[Iterator] == (WCHAR)L'\''))
  2064.                     {
  2065.                         Quotes = FALSE;
  2066.  
  2067.                         CONTINUE;
  2068.                     }
  2069.  
  2070.                     ELSE IF (!BigBrackets AND Buffer[Iterator] == (WCHAR)L'{')
  2071.                     {
  2072.                         Parameters += (WCHAR)L'{';
  2073.  
  2074.                         BigBrackets = TRUE;
  2075.  
  2076.                         CONTINUE;
  2077.                     }
  2078.  
  2079.                     ELSE IF (BigBrackets AND Buffer[Iterator] == (WCHAR)L'}')
  2080.                     {
  2081.                         Parameters += (WCHAR)L'}';
  2082.  
  2083.                         BigBrackets = FALSE;
  2084.  
  2085.                         CONTINUE;
  2086.                     }
  2087.  
  2088.                     ELSE IF (!Quotes)
  2089.                     {
  2090.                         IF (BigBrackets AND Buffer[Iterator] == (WCHAR)L',')
  2091.                         {
  2092.                             Parameters += (WCHAR)L'@';
  2093.  
  2094.                             CONTINUE;
  2095.                         }
  2096.  
  2097.                         Parameters += Buffer[Iterator];
  2098.                     }
  2099.                 }
  2100.  
  2101.                 IF (Parameters.length())
  2102.                 {
  2103.                     RETURN Trim((PWCHAR)Parameters.c_str());
  2104.                 }
  2105.             }
  2106.         }
  2107.  
  2108.         RETURN NULL;
  2109.     }
  2110.  
  2111.     PCHAR GetParametersStock(PCHAR Buffer)
  2112.     {
  2113.         IF (Buffer)
  2114.         {
  2115.             STATIC INT OpeningBracketPosition = 0U;
  2116.             STATIC INT ClosingBracketPosition = 0U;
  2117.  
  2118.             OpeningBracketPosition = GetFirstCharacterPositionInString(Buffer, '(');
  2119.             ClosingBracketPosition = GetFirstCharacterPositionInString(Buffer, ')');
  2120.  
  2121.             IF (OpeningBracketPosition != -1 AND ClosingBracketPosition != -1)
  2122.             {
  2123.                 STATIC std::string Parameters = "";
  2124.  
  2125.                 STATIC SIZE_T Iterator = 0U;
  2126.  
  2127.                 STATIC BOOL Quotes = FALSE;
  2128.                 STATIC BOOL BigBrackets = FALSE;
  2129.  
  2130.                 Quotes = FALSE;
  2131.                 BigBrackets = FALSE;
  2132.  
  2133.                 Parameters = "";
  2134.  
  2135.                 FOR (Iterator = (SIZE_T)OpeningBracketPosition + 1U; Iterator < (SIZE_T)ClosingBracketPosition; Iterator++)
  2136.                 {
  2137.                     IF (!Quotes AND (Buffer[Iterator] == '"' OR Buffer[Iterator] == '\''))
  2138.                     {
  2139.                         Quotes = TRUE;
  2140.  
  2141.                         CONTINUE;
  2142.                     }
  2143.  
  2144.                     ELSE IF (Quotes AND (Buffer[Iterator] == '"' OR Buffer[Iterator] == '\''))
  2145.                     {
  2146.                         Quotes = FALSE;
  2147.  
  2148.                         CONTINUE;
  2149.                     }
  2150.  
  2151.                     ELSE IF (!BigBrackets AND Buffer[Iterator] == '{')
  2152.                     {
  2153.                         Parameters += '{';
  2154.  
  2155.                         BigBrackets = TRUE;
  2156.  
  2157.                         CONTINUE;
  2158.                     }
  2159.  
  2160.                     ELSE IF (BigBrackets AND Buffer[Iterator] == '}')
  2161.                     {
  2162.                         Parameters += '}';
  2163.  
  2164.                         BigBrackets = FALSE;
  2165.  
  2166.                         CONTINUE;
  2167.                     }
  2168.  
  2169.                     ELSE IF (!Quotes)
  2170.                     {
  2171.                         IF (BigBrackets AND Buffer[Iterator] == ',')
  2172.                         {
  2173.                             Parameters += '@';
  2174.  
  2175.                             CONTINUE;
  2176.                         }
  2177.  
  2178.                         Parameters += Buffer[Iterator];
  2179.                     }
  2180.                 }
  2181.  
  2182.                 IF (Parameters.length())
  2183.                 {
  2184.                     RETURN Trim((PCHAR)Parameters.c_str());
  2185.                 }
  2186.             }
  2187.         }
  2188.  
  2189.         RETURN NULL;
  2190.     }
  2191.  
  2192.     PWCHAR GetParametersStock(PWCHAR Buffer)
  2193.     {
  2194.         IF (Buffer)
  2195.         {
  2196.             STATIC INT OpeningBracketPosition = 0U;
  2197.             STATIC INT ClosingBracketPosition = 0U;
  2198.  
  2199.             OpeningBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L'(');
  2200.             ClosingBracketPosition = GetFirstCharacterPositionInString(Buffer, (WCHAR)L')');
  2201.  
  2202.             IF (OpeningBracketPosition != -1 AND ClosingBracketPosition != -1)
  2203.             {
  2204.                 STATIC std::wstring Parameters = L"";
  2205.  
  2206.                 STATIC SIZE_T Iterator = 0U;
  2207.  
  2208.                 STATIC BOOL Quotes = FALSE;
  2209.                 STATIC BOOL BigBrackets = FALSE;
  2210.  
  2211.                 Quotes = FALSE;
  2212.                 BigBrackets = FALSE;
  2213.  
  2214.                 Parameters = L"";
  2215.  
  2216.                 FOR (Iterator = (SIZE_T)OpeningBracketPosition + 1U; Iterator < (SIZE_T)ClosingBracketPosition; Iterator++)
  2217.                 {
  2218.                     IF (!Quotes AND (Buffer[Iterator] == (WCHAR)L'"' OR Buffer[Iterator] == (WCHAR)L'\''))
  2219.                     {
  2220.                         Quotes = TRUE;
  2221.  
  2222.                         CONTINUE;
  2223.                     }
  2224.  
  2225.                     ELSE IF (Quotes AND (Buffer[Iterator] == (WCHAR)L'"' OR Buffer[Iterator] == (WCHAR)L'\''))
  2226.                     {
  2227.                         Quotes = FALSE;
  2228.  
  2229.                         CONTINUE;
  2230.                     }
  2231.  
  2232.                     ELSE IF (!BigBrackets AND Buffer[Iterator] == (WCHAR)L'{')
  2233.                     {
  2234.                         Parameters += (WCHAR)L'{';
  2235.  
  2236.                         BigBrackets = TRUE;
  2237.  
  2238.                         CONTINUE;
  2239.                     }
  2240.  
  2241.                     ELSE IF (BigBrackets AND Buffer[Iterator] == (WCHAR)L'}')
  2242.                     {
  2243.                         Parameters += (WCHAR)L'}';
  2244.  
  2245.                         BigBrackets = FALSE;
  2246.  
  2247.                         CONTINUE;
  2248.                     }
  2249.  
  2250.                     ELSE IF (!Quotes)
  2251.                     {
  2252.                         IF (BigBrackets AND Buffer[Iterator] == (WCHAR)L',')
  2253.                         {
  2254.                             Parameters += (WCHAR)L'@';
  2255.  
  2256.                             CONTINUE;
  2257.                         }
  2258.  
  2259.                         Parameters += Buffer[Iterator];
  2260.                     }
  2261.                 }
  2262.  
  2263.                 IF (Parameters.length())
  2264.                 {
  2265.                     RETURN Trim((PWCHAR)Parameters.c_str());
  2266.                 }
  2267.             }
  2268.         }
  2269.  
  2270.         RETURN NULL;
  2271.     }
  2272.  
  2273.     VOID PushNativeToFile(FILE * File, PCHAR Buffer)
  2274.     {
  2275.         IF (File AND Buffer)
  2276.         {
  2277.             STATIC PCHAR Function = NULL;
  2278.  
  2279.             Function = StripFirstWordFromBuffer(Buffer);
  2280.  
  2281.             IF (Function AND Function[0U])
  2282.             {
  2283.                 STATIC PCHAR FunctionName = NULL;
  2284.  
  2285.                 FunctionName = GetFunctionName(Function);
  2286.  
  2287.                 IF (FunctionName AND FunctionName[0U])
  2288.                 {
  2289.                     STATIC PCHAR Parameters = NULL;
  2290.                     STATIC PCHAR Context = NULL;
  2291.                     STATIC PCHAR FunctionType = NULL;
  2292.  
  2293.                     IF (strchr(FunctionName, ':'))
  2294.                     {
  2295.                         FunctionType = Trim(strtok_s(FunctionName, ":", &Context));
  2296.                         FunctionName = strtok_s(NULL, ":", &Context);
  2297.                     }
  2298.  
  2299.                     ELSE
  2300.                     {
  2301.                         FunctionType = NULL;
  2302.                     }
  2303.  
  2304.                     fprintf_s(File, "\t\t<KeyWord name=\"%s\" func=\"yes\">\n", FunctionName);
  2305.                    
  2306.                     IF (FunctionType)
  2307.                     {
  2308.                         Hattrick::Log("Processing '%s' native, named '%s'...", FunctionType, FunctionName);
  2309.                     }
  2310.  
  2311.                     ELSE
  2312.                     {
  2313.                         Hattrick::Log("Processing native, named '%s'...", FunctionName);
  2314.                     }
  2315.  
  2316.                     Natives++;
  2317.  
  2318.                     IF (FunctionType)
  2319.                     {
  2320.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2321.                     }
  2322.  
  2323.                     ELSE
  2324.                     {
  2325.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2326.                     }
  2327.  
  2328.                     Parameters = GetParameters(Function);
  2329.  
  2330.                     IF (Parameters AND Parameters[0U])
  2331.                     {
  2332.                         STATIC std::string GoodParameter = "";
  2333.  
  2334.                         STATIC PCHAR Parameter = NULL;
  2335.  
  2336.                         STATIC SIZE_T Iterator = 0U;
  2337.  
  2338.                         Parameter = strtok_s(Parameters, ",", &Context);
  2339.  
  2340.                         WHILE (Parameter)
  2341.                         {
  2342.                             Parameter = Trim(Parameter);
  2343.  
  2344.                             GoodParameter = "";
  2345.  
  2346.                             FOR (Iterator = 0U; Iterator < strlen(Parameter); Iterator++)
  2347.                             {
  2348.                                 IF (Parameter[Iterator] == '@')
  2349.                                 {
  2350.                                     GoodParameter += ',';
  2351.  
  2352.                                     CONTINUE;
  2353.                                 }
  2354.  
  2355.                                 GoodParameter += Parameter[Iterator];
  2356.                             }
  2357.  
  2358.                             fprintf_s(File, "\t\t\t\t<Param name=\"%s\" />\n", GoodParameter.c_str());
  2359.  
  2360.                             Parameter = strtok_s(NULL, ",", &Context);
  2361.                         }
  2362.                     }
  2363.  
  2364.                     fprintf_s(File, "\t\t\t</Overload>\n");
  2365.                     fprintf_s(File, "\t\t</KeyWord>\n");
  2366.                 }
  2367.             }
  2368.         }
  2369.     }
  2370.  
  2371.     VOID PushNativeToFile(FILE * File, PWCHAR Buffer)
  2372.     {
  2373.         IF (File AND Buffer)
  2374.         {
  2375.             STATIC PWCHAR Function = NULL;
  2376.  
  2377.             Function = StripFirstWordFromBuffer(Buffer);
  2378.  
  2379.             IF (Function AND Function[0U])
  2380.             {
  2381.                 STATIC PWCHAR FunctionName = NULL;
  2382.  
  2383.                 FunctionName = GetFunctionName(Function);
  2384.  
  2385.                 IF (FunctionName AND FunctionName[0U])
  2386.                 {
  2387.                     STATIC PWCHAR Parameters = NULL;
  2388.                     STATIC PWCHAR Context = NULL;
  2389.                     STATIC PWCHAR FunctionType = NULL;
  2390.  
  2391.                     IF (wcschr(FunctionName, (WCHAR)L':'))
  2392.                     {
  2393.                         FunctionType = Trim(wcstok_s(FunctionName, L":", &Context));
  2394.                         FunctionName = wcstok_s(NULL, L":", &Context);
  2395.                     }
  2396.  
  2397.                     ELSE
  2398.                     {
  2399.                         FunctionType = NULL;
  2400.                     }
  2401.  
  2402.                     fwprintf_s(File, L"\t\t<KeyWord name=\"%ls\" func=\"yes\">\n", FunctionName);
  2403.  
  2404.                     IF (FunctionType)
  2405.                     {
  2406.                         Hattrick::Log(L"Processing '%ls' native, named '%ls'...", FunctionType, FunctionName);
  2407.                     }
  2408.  
  2409.                     ELSE
  2410.                     {
  2411.                         Hattrick::Log(L"Processing native, named '%ls'...", FunctionName);
  2412.                     }
  2413.  
  2414.                     Natives++;
  2415.  
  2416.                     IF (FunctionType)
  2417.                     {
  2418.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2419.                     }
  2420.  
  2421.                     ELSE
  2422.                     {
  2423.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2424.                     }
  2425.  
  2426.                     Parameters = GetParameters(Function);
  2427.  
  2428.                     IF (Parameters AND Parameters[0U])
  2429.                     {
  2430.                         STATIC std::wstring GoodParameter = L"";
  2431.  
  2432.                         STATIC PWCHAR Parameter = NULL;
  2433.  
  2434.                         STATIC SIZE_T Iterator = 0U;
  2435.  
  2436.                         Parameter = wcstok_s(Parameters, L",", &Context);
  2437.  
  2438.                         WHILE (Parameter)
  2439.                         {
  2440.                             Parameter = Trim(Parameter);
  2441.  
  2442.                             GoodParameter = L"";
  2443.  
  2444.                             FOR (Iterator = 0U; Iterator < wcslen(Parameter); Iterator++)
  2445.                             {
  2446.                                 IF (Parameter[Iterator] == (WCHAR)L'@')
  2447.                                 {
  2448.                                     GoodParameter += (WCHAR)L',';
  2449.  
  2450.                                     CONTINUE;
  2451.                                 }
  2452.  
  2453.                                 GoodParameter += Parameter[Iterator];
  2454.                             }
  2455.  
  2456.                             fwprintf_s(File, L"\t\t\t\t<Param name=\"%ls\" />\n", GoodParameter.c_str());
  2457.    
  2458.                             Parameter = wcstok_s(NULL, L",", &Context);
  2459.                         }
  2460.                     }
  2461.  
  2462.                     fwprintf_s(File, L"\t\t\t</Overload>\n");
  2463.                     fwprintf_s(File, L"\t\t</KeyWord>\n");
  2464.                 }
  2465.             }
  2466.         }
  2467.     }
  2468.  
  2469.     VOID PushForwardToFile(FILE * File, PCHAR Buffer)
  2470.     {
  2471.         IF (File AND Buffer)
  2472.         {
  2473.             STATIC PCHAR Function = NULL;
  2474.  
  2475.             Function = StripFirstWordFromBuffer(Buffer);
  2476.  
  2477.             IF (Function AND Function[0U])
  2478.             {
  2479.                 STATIC PCHAR FunctionName = NULL;
  2480.  
  2481.                 FunctionName = GetFunctionName(Function);
  2482.  
  2483.                 IF (FunctionName AND FunctionName[0U])
  2484.                 {
  2485.                     STATIC PCHAR Parameters = NULL;
  2486.                     STATIC PCHAR Context = NULL;
  2487.                     STATIC PCHAR FunctionType = NULL;
  2488.  
  2489.                     IF (strchr(FunctionName, ':'))
  2490.                     {
  2491.                         FunctionType = Trim(strtok_s(FunctionName, ":", &Context));
  2492.                         FunctionName = strtok_s(NULL, ":", &Context);
  2493.                     }
  2494.  
  2495.                     ELSE
  2496.                     {
  2497.                         FunctionType = NULL;
  2498.                     }
  2499.  
  2500.                     fprintf_s(File, "\t\t<KeyWord name=\"%s\" func=\"yes\">\n", FunctionName);
  2501.  
  2502.                     IF (FunctionType)
  2503.                     {
  2504.                         Hattrick::Log("Processing '%s' forward, named '%s'...", FunctionType, FunctionName);
  2505.                     }
  2506.  
  2507.                     ELSE
  2508.                     {
  2509.                         Hattrick::Log("Processing forward, named '%s'...", FunctionName);
  2510.                     }
  2511.  
  2512.                     Forwards++;
  2513.  
  2514.                     IF (FunctionType)
  2515.                     {
  2516.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2517.                     }
  2518.  
  2519.                     ELSE
  2520.                     {
  2521.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2522.                     }
  2523.  
  2524.                     Parameters = GetParameters(Function);
  2525.  
  2526.                     IF (Parameters AND Parameters[0U])
  2527.                     {
  2528.                         STATIC std::string GoodParameter = "";
  2529.  
  2530.                         STATIC PCHAR Parameter = NULL;
  2531.  
  2532.                         STATIC SIZE_T Iterator = 0U;
  2533.  
  2534.                         Parameter = strtok_s(Parameters, ",", &Context);
  2535.  
  2536.                         WHILE (Parameter)
  2537.                         {
  2538.                             Parameter = Trim(Parameter);
  2539.  
  2540.                             GoodParameter = "";
  2541.  
  2542.                             FOR (Iterator = 0U; Iterator < strlen(Parameter); Iterator++)
  2543.                             {
  2544.                                 IF (Parameter[Iterator] == '@')
  2545.                                 {
  2546.                                     GoodParameter += ',';
  2547.  
  2548.                                     CONTINUE;
  2549.                                 }
  2550.  
  2551.                                 GoodParameter += Parameter[Iterator];
  2552.                             }
  2553.  
  2554.                             fprintf_s(File, "\t\t\t\t<Param name=\"%s\" />\n", GoodParameter.c_str());
  2555.  
  2556.                             Parameter = strtok_s(NULL, ",", &Context);
  2557.                         }
  2558.                     }
  2559.  
  2560.                     fprintf_s(File, "\t\t\t</Overload>\n");
  2561.                     fprintf_s(File, "\t\t</KeyWord>\n");
  2562.                 }
  2563.             }
  2564.         }
  2565.     }
  2566.  
  2567.     VOID PushForwardToFile(FILE * File, PWCHAR Buffer)
  2568.     {
  2569.         IF (File AND Buffer)
  2570.         {
  2571.             STATIC PWCHAR Function = NULL;
  2572.  
  2573.             Function = StripFirstWordFromBuffer(Buffer);
  2574.  
  2575.             IF (Function AND Function[0U])
  2576.             {
  2577.                 STATIC PWCHAR FunctionName = NULL;
  2578.  
  2579.                 FunctionName = GetFunctionName(Function);
  2580.  
  2581.                 IF (FunctionName AND FunctionName[0U])
  2582.                 {
  2583.                     STATIC PWCHAR Parameters = NULL;
  2584.                     STATIC PWCHAR Context = NULL;
  2585.                     STATIC PWCHAR FunctionType = NULL;
  2586.  
  2587.                     IF (wcschr(FunctionName, (WCHAR)L':'))
  2588.                     {
  2589.                         FunctionType = Trim(wcstok_s(FunctionName, L":", &Context));
  2590.                         FunctionName = wcstok_s(NULL, L":", &Context);
  2591.                     }
  2592.  
  2593.                     ELSE
  2594.                     {
  2595.                         FunctionType = NULL;
  2596.                     }
  2597.  
  2598.                     fwprintf_s(File, L"\t\t<KeyWord name=\"%ls\" func=\"yes\">\n", FunctionName);
  2599.  
  2600.                     IF (FunctionType)
  2601.                     {
  2602.                         Hattrick::Log(L"Processing '%ls' forward, named '%ls'...", FunctionType, FunctionName);
  2603.                     }
  2604.  
  2605.                     ELSE
  2606.                     {
  2607.                         Hattrick::Log(L"Processing forward, named '%ls'...", FunctionName);
  2608.                     }
  2609.  
  2610.                     Forwards++;
  2611.  
  2612.                     IF (FunctionType)
  2613.                     {
  2614.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2615.                     }
  2616.  
  2617.                     ELSE
  2618.                     {
  2619.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2620.                     }
  2621.  
  2622.                     Parameters = GetParameters(Function);
  2623.  
  2624.                     IF (Parameters AND Parameters[0U])
  2625.                     {
  2626.                         STATIC std::wstring GoodParameter = L"";
  2627.  
  2628.                         STATIC PWCHAR Parameter = NULL;
  2629.  
  2630.                         STATIC SIZE_T Iterator = 0U;
  2631.  
  2632.                         Parameter = wcstok_s(Parameters, L",", &Context);
  2633.  
  2634.                         WHILE (Parameter)
  2635.                         {
  2636.                             Parameter = Trim(Parameter);
  2637.  
  2638.                             GoodParameter = L"";
  2639.  
  2640.                             FOR (Iterator = 0U; Iterator < wcslen(Parameter); Iterator++)
  2641.                             {
  2642.                                 IF (Parameter[Iterator] == (WCHAR)L'@')
  2643.                                 {
  2644.                                     GoodParameter += (WCHAR)L',';
  2645.  
  2646.                                     CONTINUE;
  2647.                                 }
  2648.  
  2649.                                 GoodParameter += Parameter[Iterator];
  2650.                             }
  2651.  
  2652.                             fwprintf_s(File, L"\t\t\t\t<Param name=\"%ls\" />\n", GoodParameter.c_str());
  2653.  
  2654.                             Parameter = wcstok_s(NULL, L",", &Context);
  2655.                         }
  2656.                     }
  2657.  
  2658.                     fwprintf_s(File, L"\t\t\t</Overload>\n");
  2659.                     fwprintf_s(File, L"\t\t</KeyWord>\n");
  2660.                 }
  2661.             }
  2662.         }
  2663.     }
  2664.  
  2665.     VOID PushStockToFile(FILE * File, PCHAR Buffer)
  2666.     {
  2667.         IF (File AND Buffer)
  2668.         {
  2669.             STATIC PCHAR Function = NULL;
  2670.  
  2671.             Function = StripFirstWordFromBufferStock(Buffer);
  2672.  
  2673.             IF (Function AND Function[0U])
  2674.             {
  2675.                 STATIC PCHAR FunctionName = NULL;
  2676.  
  2677.                 FunctionName = GetFunctionNameStock(Function);
  2678.  
  2679.                 IF (FunctionName AND FunctionName[0U])
  2680.                 {
  2681.                     STATIC PCHAR Parameters = NULL;
  2682.                     STATIC PCHAR Context = NULL;
  2683.                     STATIC PCHAR FunctionType = NULL;
  2684.  
  2685.                     IF (strchr(FunctionName, ':'))
  2686.                     {
  2687.                         FunctionType = Trim(strtok_s(FunctionName, ":", &Context));
  2688.                         FunctionName = strtok_s(NULL, ":", &Context);
  2689.                     }
  2690.  
  2691.                     ELSE
  2692.                     {
  2693.                         FunctionType = NULL;
  2694.                     }
  2695.  
  2696.                     fprintf_s(File, "\t\t<KeyWord name=\"%s\" func=\"yes\">\n", FunctionName);
  2697.  
  2698.                     IF (FunctionType)
  2699.                     {
  2700.                         Hattrick::Log("Processing '%s' stock, named '%s'...", FunctionType, FunctionName);
  2701.                     }
  2702.  
  2703.                     ELSE
  2704.                     {
  2705.                         Hattrick::Log("Processing stock, named '%s'...", FunctionName);
  2706.                     }
  2707.  
  2708.                     Stocks++;
  2709.  
  2710.                     IF (FunctionType)
  2711.                     {
  2712.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2713.                     }
  2714.  
  2715.                     ELSE
  2716.                     {
  2717.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2718.                     }
  2719.  
  2720.                     Parameters = GetParametersStock(Function);
  2721.  
  2722.                     IF (Parameters AND Parameters[0U])
  2723.                     {
  2724.                         STATIC std::string GoodParameter = "";
  2725.  
  2726.                         STATIC PCHAR Parameter = NULL;
  2727.  
  2728.                         STATIC SIZE_T Iterator = 0U;
  2729.  
  2730.                         Parameter = strtok_s(Parameters, ",", &Context);
  2731.  
  2732.                         WHILE (Parameter)
  2733.                         {
  2734.                             Parameter = Trim(Parameter);
  2735.  
  2736.                             GoodParameter = "";
  2737.  
  2738.                             FOR (Iterator = 0U; Iterator < strlen(Parameter); Iterator++)
  2739.                             {
  2740.                                 IF (Parameter[Iterator] == '@')
  2741.                                 {
  2742.                                     GoodParameter += ',';
  2743.  
  2744.                                     CONTINUE;
  2745.                                 }
  2746.  
  2747.                                 GoodParameter += Parameter[Iterator];
  2748.                             }
  2749.  
  2750.                             fprintf_s(File, "\t\t\t\t<Param name=\"%s\" />\n", GoodParameter.c_str());
  2751.    
  2752.                             Parameter = strtok_s(NULL, ",", &Context);
  2753.                         }
  2754.                     }
  2755.  
  2756.                     fprintf_s(File, "\t\t\t</Overload>\n");
  2757.                     fprintf_s(File, "\t\t</KeyWord>\n");
  2758.                 }
  2759.             }
  2760.         }
  2761.     }
  2762.  
  2763.     VOID PushStockToFile(FILE * File, PWCHAR Buffer)
  2764.     {
  2765.         IF (File AND Buffer)
  2766.         {
  2767.             STATIC PWCHAR Function = NULL;
  2768.  
  2769.             Function = StripFirstWordFromBufferStock(Buffer);
  2770.  
  2771.             IF (Function AND Function[0U])
  2772.             {
  2773.                 STATIC PWCHAR FunctionName = NULL;
  2774.  
  2775.                 FunctionName = GetFunctionNameStock(Function);
  2776.  
  2777.                 IF (FunctionName AND FunctionName[0U])
  2778.                 {
  2779.                     STATIC PWCHAR Parameters = NULL;
  2780.                     STATIC PWCHAR Context = NULL;
  2781.                     STATIC PWCHAR FunctionType = NULL;
  2782.  
  2783.                     IF (wcschr(FunctionName, (WCHAR)L':'))
  2784.                     {
  2785.                         FunctionType = Trim(wcstok_s(FunctionName, L":", &Context));
  2786.                         FunctionName = wcstok_s(NULL, L":", &Context);
  2787.                     }
  2788.  
  2789.                     ELSE
  2790.                     {
  2791.                         FunctionType = NULL;
  2792.                     }
  2793.  
  2794.                     fwprintf_s(File, L"\t\t<KeyWord name=\"%ls\" func=\"yes\">\n", FunctionName);
  2795.  
  2796.                     IF (FunctionType)
  2797.                     {
  2798.                         Hattrick::Log(L"Processing '%ls' stock, named '%ls'...", FunctionType, FunctionName);
  2799.                     }
  2800.  
  2801.                     ELSE
  2802.                     {
  2803.                         Hattrick::Log(L"Processing stock, named '%ls'...", FunctionName);
  2804.                     }
  2805.  
  2806.                     Stocks++;
  2807.  
  2808.                     IF (FunctionType)
  2809.                     {
  2810.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2811.                     }
  2812.  
  2813.                     ELSE
  2814.                     {
  2815.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2816.                     }
  2817.  
  2818.                     Parameters = GetParametersStock(Function);
  2819.  
  2820.                     IF (Parameters AND Parameters[0U])
  2821.                     {
  2822.                         STATIC std::wstring GoodParameter = L"";
  2823.  
  2824.                         STATIC PWCHAR Parameter = NULL;
  2825.  
  2826.                         STATIC SIZE_T Iterator = 0U;
  2827.  
  2828.                         Parameter = wcstok_s(Parameters, L",", &Context);
  2829.  
  2830.                         WHILE (Parameter)
  2831.                         {
  2832.                             Parameter = Trim(Parameter);
  2833.  
  2834.                             GoodParameter = L"";
  2835.  
  2836.                             FOR (Iterator = 0U; Iterator < wcslen(Parameter); Iterator++)
  2837.                             {
  2838.                                 IF (Parameter[Iterator] == (WCHAR)L'@')
  2839.                                 {
  2840.                                     GoodParameter += (WCHAR)L',';
  2841.  
  2842.                                     CONTINUE;
  2843.                                 }
  2844.  
  2845.                                 GoodParameter += Parameter[Iterator];
  2846.                             }
  2847.  
  2848.                             fwprintf_s(File, L"\t\t\t\t<Param name=\"%ls\" />\n", GoodParameter.c_str());
  2849.  
  2850.                             Parameter = wcstok_s(NULL, L",", &Context);
  2851.                         }
  2852.                     }
  2853.  
  2854.                     fwprintf_s(File, L"\t\t\t</Overload>\n");
  2855.                     fwprintf_s(File, L"\t\t</KeyWord>\n");
  2856.                 }
  2857.             }
  2858.         }
  2859.     }
  2860.  
  2861.     VOID PushDefinitionToFile(FILE * File, PWCHAR Buffer)
  2862.     {
  2863.         IF (File AND Buffer)
  2864.         {
  2865.             STATIC PWCHAR Function = NULL;
  2866.  
  2867.             Function = StripFirstWordFromBufferDefinition(Buffer);
  2868.  
  2869.             IF (Function AND Function[0U])
  2870.             {
  2871.                 STATIC PWCHAR FunctionName = NULL;
  2872.  
  2873.                 FunctionName = GetFunctionNameDefinition(Function);
  2874.  
  2875.                 IF (FunctionName AND FunctionName[0U])
  2876.                 {
  2877.                     STATIC PWCHAR Parameters = NULL;
  2878.                     STATIC PWCHAR Context = NULL;
  2879.                     STATIC PWCHAR FunctionType = NULL;
  2880.  
  2881.                     IF (wcschr(FunctionName, (WCHAR)L':'))
  2882.                     {
  2883.                         FunctionType = Trim(wcstok_s(FunctionName, L":", &Context));
  2884.                         FunctionName = wcstok_s(NULL, L":", &Context);
  2885.                     }
  2886.  
  2887.                     ELSE
  2888.                     {
  2889.                         FunctionType = NULL;
  2890.                     }
  2891.  
  2892.                     fwprintf_s(File, L"\t\t<KeyWord name=\"%ls\" func=\"yes\">\n", FunctionName);
  2893.  
  2894.                     IF (FunctionType)
  2895.                     {
  2896.                         Hattrick::Log(L"Processing '%ls' definition, named '%ls'...", FunctionType, FunctionName);
  2897.                     }
  2898.  
  2899.                     ELSE
  2900.                     {
  2901.                         Hattrick::Log(L"Processing definition, named '%ls'...", FunctionName);
  2902.                     }
  2903.  
  2904.                     Definitions++;
  2905.  
  2906.                     IF (FunctionType)
  2907.                     {
  2908.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  2909.                     }
  2910.  
  2911.                     ELSE
  2912.                     {
  2913.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  2914.                     }
  2915.  
  2916.                     Parameters = GetParametersDefinition(Function);
  2917.  
  2918.                     IF (Parameters AND Parameters[0U])
  2919.                     {
  2920.                         STATIC std::wstring GoodParameter = L"";
  2921.  
  2922.                         STATIC PWCHAR Parameter = NULL;
  2923.  
  2924.                         STATIC SIZE_T Iterator = 0U;
  2925.  
  2926.                         Parameter = wcstok_s(Parameters, L",", &Context);
  2927.  
  2928.                         WHILE (Parameter)
  2929.                         {
  2930.                             Parameter = Trim(Parameter);
  2931.  
  2932.                             GoodParameter = L"";
  2933.  
  2934.                             FOR (Iterator = 0U; Iterator < wcslen(Parameter); Iterator++)
  2935.                             {
  2936.                                 IF (Parameter[Iterator] == '@')
  2937.                                 {
  2938.                                     GoodParameter += ',';
  2939.  
  2940.                                     CONTINUE;
  2941.                                 }
  2942.  
  2943.                                 GoodParameter += Parameter[Iterator];
  2944.                             }
  2945.  
  2946.                             fwprintf_s(File, L"\t\t\t\t<Param name=\"%ls\" />\n", GoodParameter.c_str());
  2947.    
  2948.                             Parameter = wcstok_s(NULL, L",", &Context);
  2949.                         }
  2950.                     }
  2951.  
  2952.                     fwprintf_s(File, L"\t\t\t</Overload>\n");
  2953.                     fwprintf_s(File, L"\t\t</KeyWord>\n");
  2954.                 }
  2955.             }
  2956.         }
  2957.     }
  2958.  
  2959.     VOID PushDefinitionToFile(FILE * File, PCHAR Buffer)
  2960.     {
  2961.         IF (File AND Buffer)
  2962.         {
  2963.             STATIC PCHAR Function = NULL;
  2964.  
  2965.             Function = StripFirstWordFromBufferDefinition(Buffer);
  2966.  
  2967.             IF (Function AND Function[0U])
  2968.             {
  2969.                 STATIC PCHAR FunctionName = NULL;
  2970.  
  2971.                 FunctionName = GetFunctionNameDefinition(Function);
  2972.  
  2973.                 IF (FunctionName AND FunctionName[0U])
  2974.                 {
  2975.                     STATIC PCHAR Parameters = NULL;
  2976.                     STATIC PCHAR Context = NULL;
  2977.                     STATIC PCHAR FunctionType = NULL;
  2978.  
  2979.                     IF (strchr(FunctionName, ':'))
  2980.                     {
  2981.                         FunctionType = Trim(strtok_s(FunctionName, ":", &Context));
  2982.                         FunctionName = strtok_s(NULL, ":", &Context);
  2983.                     }
  2984.  
  2985.                     ELSE
  2986.                     {
  2987.                         FunctionType = NULL;
  2988.                     }
  2989.  
  2990.                     fprintf_s(File, "\t\t<KeyWord name=\"%s\" func=\"yes\">\n", FunctionName);
  2991.  
  2992.                     IF (FunctionType)
  2993.                     {
  2994.                         Hattrick::Log("Processing '%s' definition, named '%s'...", FunctionType, FunctionName);
  2995.                     }
  2996.  
  2997.                     ELSE
  2998.                     {
  2999.                         Hattrick::Log("Processing definition, named '%s'...", FunctionName);
  3000.                     }
  3001.  
  3002.                     Definitions++;
  3003.  
  3004.                     IF (FunctionType)
  3005.                     {
  3006.                         fprintf_s(File, "\t\t\t<Overload retVal=\"%s:\" >\n", FunctionType);
  3007.                     }
  3008.  
  3009.                     ELSE
  3010.                     {
  3011.                         fprintf_s(File, "\t\t\t<Overload retVal=\"\" >\n");
  3012.                     }
  3013.  
  3014.                     Parameters = GetParametersDefinition(Function);
  3015.  
  3016.                     IF (Parameters AND Parameters[0U])
  3017.                     {
  3018.                         STATIC std::string GoodParameter = "";
  3019.  
  3020.                         STATIC PCHAR Parameter = NULL;
  3021.  
  3022.                         STATIC SIZE_T Iterator = 0U;
  3023.  
  3024.                         Parameter = strtok_s(Parameters, ",", &Context);
  3025.  
  3026.                         WHILE (Parameter)
  3027.                         {
  3028.                             Parameter = Trim(Parameter);
  3029.  
  3030.                             GoodParameter = "";
  3031.  
  3032.                             FOR (Iterator = 0U; Iterator < strlen(Parameter); Iterator++)
  3033.                             {
  3034.                                 IF (Parameter[Iterator] == '@')
  3035.                                 {
  3036.                                     GoodParameter += ',';
  3037.  
  3038.                                     CONTINUE;
  3039.                                 }
  3040.  
  3041.                                 GoodParameter += Parameter[Iterator];
  3042.                             }
  3043.  
  3044.                             fprintf_s(File, "\t\t\t\t<Param name=\"%s\" />\n", GoodParameter.c_str());
  3045.    
  3046.                             Parameter = strtok_s(NULL, ",", &Context);
  3047.                         }
  3048.                     }
  3049.  
  3050.                     fprintf_s(File, "\t\t\t</Overload>\n");
  3051.                     fprintf_s(File, "\t\t</KeyWord>\n");
  3052.                 }
  3053.             }
  3054.         }
  3055.     }
  3056. };
  3057.  
  3058. VOID FilesEnumeration(PWCHAR File, LPARAM Flag)
  3059. {
  3060.     STATIC WCHAR FileName[256U] = { (WCHAR)L'\0' };
  3061.  
  3062.     STATIC FILE * Handle = NULL;
  3063.  
  3064.     Hattrick::StringAppend(FileName, SIZEOF(FileName), L"include\\");
  3065.     Hattrick::StringAppend(FileName, SIZEOF(FileName), File);
  3066.  
  3067.     _wfopen_s(&Handle, FileName, L"r");
  3068.  
  3069.     Hattrick::Log(L"Opening '%ls' file...", File);
  3070.  
  3071.     IF (Handle)
  3072.     {
  3073.         STATIC CHAR Buffer[2048U] = { '\0' };
  3074.  
  3075.         STATIC PCHAR CleanBuffer = NULL;
  3076.  
  3077.         STATIC SIZE_T Iterator = 0U;
  3078.  
  3079.         STATIC BOOL CommentStarted = FALSE;
  3080.  
  3081.         Hattrick::Log(L"Opened '%ls' file...", File);
  3082.  
  3083.         WHILE (!feof(Handle))
  3084.         {
  3085.             Buffer[0U] = '\0';
  3086.  
  3087.             fgets(Buffer, SIZEOF(Buffer), Handle);
  3088.  
  3089.             CleanBuffer = Hattrick::Trim(Buffer);
  3090.  
  3091.             IF (CleanBuffer AND CleanBuffer[0U])
  3092.             {
  3093.                 IF (strstr(CleanBuffer, "/*") AND !strstr(CleanBuffer, "*/"))
  3094.                 {
  3095.                     CommentStarted = TRUE;
  3096.  
  3097.                     CONTINUE;
  3098.                 }
  3099.  
  3100.                 ELSE IF (strstr(CleanBuffer, "*/"))
  3101.                 {
  3102.                     CommentStarted = FALSE;
  3103.                 }
  3104.  
  3105.                 IF (CommentStarted)
  3106.                 {
  3107.                     CONTINUE;
  3108.                 }
  3109.  
  3110.                 ELSE IF (_strnicmp(CleanBuffer, "native", 6U) == 0U)
  3111.                 {
  3112.                     Hattrick::PushNativeToFile(Hattrick::Output, CleanBuffer);
  3113.                 }
  3114.  
  3115.                 ELSE IF (_strnicmp(CleanBuffer, "forward", 7U) == 0U)
  3116.                 {
  3117.                     Hattrick::PushForwardToFile(Hattrick::Output, CleanBuffer);
  3118.                 }
  3119.  
  3120.                 ELSE IF (_strnicmp(CleanBuffer, "stock", 5U) == 0U AND !strstr(CleanBuffer, "operator"))
  3121.                 {
  3122.                     Hattrick::PushStockToFile(Hattrick::Output, CleanBuffer);
  3123.                 }
  3124.  
  3125.                 ELSE IF (_strnicmp(CleanBuffer, "define", 6U) == 0U)
  3126.                 {
  3127.                     Hattrick::PushDefinitionToFile(Hattrick::Output, CleanBuffer);
  3128.                 }
  3129.  
  3130.                 ELSE IF (isalpha(CleanBuffer[0U]) OR isdigit(CleanBuffer[0U]) OR CleanBuffer[0U] == '_')
  3131.                 {
  3132.                     FOR (Iterator = 0U; Iterator < 16U; Iterator++)
  3133.                     {
  3134.                         IF (strncmp(&CleanBuffer[Iterator], "FUNC", 4U) == 0U)
  3135.                         {
  3136.                             Hattrick::PushStockToFile(Hattrick::Output, CleanBuffer);
  3137.  
  3138.                             BREAK;
  3139.                         }
  3140.                     }
  3141.                 }
  3142.             }
  3143.         }
  3144.  
  3145.         fclose(Handle);
  3146.  
  3147.         Hattrick::Log(L"File '%ls' has been closed...", File);
  3148.     }
  3149.  
  3150.     ELSE
  3151.     {
  3152.         Hattrick::Log(L"File '%ls' could not be opened...");
  3153.     }
  3154.  
  3155.     FileName[0U] = (WCHAR)L'\0';
  3156. }
  3157.  
  3158. BOOL WINAPI WindowsEnumeration(HWND Window, LPARAM Parameter)
  3159. {
  3160.     IF (Window)
  3161.     {
  3162.         STATIC WCHAR Title[1024U] = { (WCHAR)L'\0' };
  3163.  
  3164.         GetWindowTextW(Window, Title, SIZEOF(Title) / SIZEOF(WCHAR));
  3165.  
  3166.         IF (Title[0U] AND wcsstr(Title, L"AMXX Natives' Parser for Notepad++.exe") AND !wcsstr(Title, L"Visual Studio"))
  3167.         {
  3168.             Hattrick::Log(L"Found '%ls' window, hiding...", Title);
  3169.  
  3170.             SetWindowPos(Window, NULL, 200U, 200U, 200U, 200U, SWP_HIDEWINDOW | SWP_ASYNCWINDOWPOS);
  3171.         }
  3172.     }
  3173.  
  3174.     RETURN TRUE;
  3175. }
  3176.  
  3177. INT main(VOID)
  3178. {
  3179.     STATIC WCHAR Directory[1024U] = { (WCHAR)L'\0' };
  3180.  
  3181.     _wunlink(L"journal.log");
  3182.  
  3183.     Hattrick::OpenJournal(TRUE);
  3184.  
  3185.     Hattrick::Log(L"Starting program...");
  3186.     Hattrick::Log(L"Opening journal...");
  3187.     Hattrick::Log(L"Enumerating windows to hide program's window...");
  3188.  
  3189.     EnumWindows(WindowsEnumeration, NULL);
  3190.  
  3191.     Hattrick::Log(L"Finished enumerating windows...");
  3192.     Hattrick::Log(L"Getting current directory...");
  3193.  
  3194.     GetModuleFileNameW(NULL, Directory, SIZEOF(Directory) / SIZEOF(WCHAR));
  3195.  
  3196.     Hattrick::Log(L"Truncating current directory by the last '%ls' character...", L"\\");
  3197.  
  3198.     Hattrick::StringTruncateRight(Directory, (WCHAR)L'\\');
  3199.  
  3200.     Hattrick::Log(L"Appending '%ls' string to the current directory...", L"\\include");
  3201.  
  3202.     Hattrick::StringAppend(Directory, SIZEOF(Directory), L"\\include");
  3203.  
  3204.     Hattrick::Log(L"Checking for '%ls' directory...", Directory);
  3205.  
  3206.     IF (!Hattrick::IsFolder(Directory))
  3207.     {
  3208.         Hattrick::Log(L"Creating '%ls' directory...", Directory);
  3209.  
  3210.         _wmkdir(Directory);
  3211.  
  3212.         Hattrick::Log(L"Exiting with 'EXIT_FAILURE' code...");
  3213.         Hattrick::Log(L"Closing journal...");
  3214.  
  3215.         Hattrick::CloseJournal();
  3216.  
  3217.         RETURN EXIT_FAILURE;
  3218.     }
  3219.  
  3220.     Hattrick::Log(L"Folder '%ls' is alright...", Directory);
  3221.  
  3222.     fopen_s(&Hattrick::Output, "sma.xml", "w+");
  3223.  
  3224.     Hattrick::Log(L"Opening 'sma.xml' file...");
  3225.  
  3226.     IF (Hattrick::Output)
  3227.     {
  3228.         Hattrick::Log(L"File 'sma.xml' has been opened...");
  3229.         Hattrick::Log(L"Writing basics to 'sma.xml' file...");
  3230.  
  3231.         Hattrick::StringAppend(Directory, SIZEOF(Directory), L"\\*");
  3232.  
  3233.         fprintf_s(Hattrick::Output, "<?xml version=\"1.0\" encoding=\"Windows-1252\" ?>\n");
  3234.         fprintf_s(Hattrick::Output, "<NotepadPlus>\n");
  3235.         fprintf_s(Hattrick::Output, "\t<AutoComplete language=\"SMA\">\n");
  3236.         fprintf_s(Hattrick::Output, "\t\t<Environment ignoreCase=\"no\" startFunc=\"(\" stopFunc=\")\" paramSeparator=\", \" terminal=\"; \" additionalWordChar=\"\"/>\n");
  3237.  
  3238.         Hattrick::Log(L"Enumerating all 'INC' files from folder...");
  3239.  
  3240.         Hattrick::EnumerateFiles(NULL, Directory, L"INC", FilesEnumeration);
  3241.  
  3242.         fprintf_s(Hattrick::Output, "\t</AutoComplete>\n");
  3243.         fprintf_s(Hattrick::Output, "</NotepadPlus>");
  3244.  
  3245.         Hattrick::Log(L"Got %d natives...", Hattrick::Natives);
  3246.         Hattrick::Log(L"Got %d stocks...", Hattrick::Stocks);
  3247.         Hattrick::Log(L"Got %d forwards...", Hattrick::Forwards);
  3248.         Hattrick::Log(L"Got %d definitions...", Hattrick::Definitions);
  3249.  
  3250.         fclose(Hattrick::Output);
  3251.  
  3252.         Hattrick::Log(L"File 'sma.xml' has been closed...");
  3253.  
  3254.         _wunlink(L"C:\\Program Files\\Notepad++\\plugins\\APIs\\sma.xml");
  3255.         _wunlink(L"C:\\Program Files (x86)\\Notepad++\\plugins\\APIs\\sma.xml");
  3256.  
  3257.         _wunlink(L"D:\\Program Files\\Notepad++\\plugins\\APIs\\sma.xml");
  3258.         _wunlink(L"D:\\Program Files (x86)\\Notepad++\\plugins\\APIs\\sma.xml");
  3259.  
  3260.         Hattrick::Log(L"Tried to erase existing 'sma.xml' file to Notepad++'s location...");
  3261.  
  3262.         CopyFileA("sma.xml", "C:\\Program Files\\Notepad++\\plugins\\APIs\\sma.xml", FALSE);
  3263.         CopyFileA("sma.xml", "C:\\Program Files (x86)\\Notepad++\\plugins\\APIs\\sma.xml", FALSE);
  3264.  
  3265.         CopyFileA("sma.xml", "D:\\Program Files\\Notepad++\\plugins\\APIs\\sma.xml", FALSE);
  3266.         CopyFileA("sma.xml", "D:\\Program Files (x86)\\Notepad++\\plugins\\APIs\\sma.xml", FALSE);
  3267.  
  3268.         Hattrick::Log(L"Tried to transfer 'sma.xml' file to the Notepad++'s location...");
  3269.         Hattrick::Log(L"Exiting with 'EXIT_SUCCESS' code...");
  3270.         Hattrick::Log(L"Closing journal...");
  3271.  
  3272.         Hattrick::CloseJournal();
  3273.  
  3274.         RETURN EXIT_SUCCESS;
  3275.     }
  3276.  
  3277.     Hattrick::Log(L"Failed to open 'sma.xml' file...");
  3278.     Hattrick::Log(L"Exiting with 'EXIT_FAILURE' code...");
  3279.  
  3280.     Hattrick::CloseJournal();
  3281.  
  3282.     RETURN EXIT_FAILURE;
  3283. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement