// *************************************************
//      Made with BCX BASIC To C/C++ Translator
//            Version 8.3.8 (07/31/2026)
// *************************************************
//    Translated for compiling with a C++ Compiler
// *************************************************
 
#ifndef __cplusplus
  #error A C++ compiler is required
#endif
 
#ifdef _MSC_VER
  #ifndef _CRT_SECURE_NO_WARNINGS
    #define _CRT_SECURE_NO_WARNINGS
  #endif
#endif
 
// Windows API headers
#include <windows.h>    // Core Windows API
#include <windowsx.h>   // Windows API macros and functions
#include <commctrl.h>   // Common Controls
#include <commdlg.h>    // Common Dialogs
#include <direct.h>     // Directory handling
#include <locale.h>     // Locale handling
#include <mmsystem.h>   // Multimedia
#include <ole2.h>       // OLE 2.0 functionality
#include <oleauto.h>    // OLE Automation
#include <olectl.h>     // OLE Controls
#include <richedit.h>   // Rich Edit Control
#include <shellapi.h>   // Shell API
#include <shlobj.h>     // Shell Objects
#include <shlwapi.h>    // Shell lightweight utility functions
#include <tchar.h>      // Unicode/ANSI character mapping
#include <urlmon.h>     // URL Monikers
#include <wchar.h>      // Wide character support
#include <wctype.h>     // Wide character classification
#include <wininet.h>    // Internet
#include <winsock.h>    // Windows Sockets (Winsock 1.1)
 
// ISO C Standard Library headers
#include <ctype.h>      // Character classification
#include <math.h>       // Mathematical functions
#include <setjmp.h>     // Non-local jumps
#include <stdarg.h>     // Variable arguments
#include <stddef.h>     // Common definitions
#include <stdio.h>      // Input/output
#include <stdlib.h>     // General utilities
#include <string.h>     // String handling
#include <time.h>       // Date and time
#include <errno.h>      // Error numbers
 
// C99 Standard headers
#include <stdbool.h>    // Boolean type
#include <inttypes.h>   // Integer types
 
// POSIX headers
#include <fcntl.h>      // File control options
 
// Windows-specific headers
#include <process.h>    // Process control functions
#include <io.h>         // Low-level I/O (Windows POSIX subset)
#include <conio.h>      // Console I/O (Windows-specific)
 
// *************************************************
//               System Defined Macros
// *************************************************
 
#define BCXSTRSIZE                           2048
 
// *************************************************
//            Application Defined Macros
// *************************************************
#define __BCX__                              TRUE
#define c_BCX_COLORS                         TRUE
#define c_BCXSTRINGS                         2048
#define c_VERSION                            "8.3.8 (07/31/2026)"
#define c_BCX_STR_MAIN_PROG                  "Main Program"
#define c_BCX_STR_RUNTIME                    "Runtime Functions"
#define c_BCX_STR_VBS_STRUCTS                "VBScript Support Structures"
#define c_BCX_STR_SYS_CONST                  "Runtime Library Macros"
#define c_BCX_STR_STD_MACROS                 "Runtime Library Macros"
#define c_BCX_STR_SYS_VARS                   "Runtime Library Variables"
#define c_BCX_STR_STD_PROTOS                 "Runtime Library Function Prototypes"
#define c_BCX_STR_USR_CONST                  "Application Macros"
#define c_BCX_STR_USR_TYPES                  "Application Types And Unions"
#define c_BCX_STR_USR_VARS                   "Application Global Variables"
#define c_BCX_STR_USR_PROCS                  "Application Subs and Functions"
#define c_BCX_STR_USR_PROTOS                 "Application Function Prototypes"
#define m_IAm(X)                             ((X)!=1)
#define m_IAmNot(X)                          ((X)==0)
#define m_IDont(X)                           ((X)==0)
#define m_GetAsPosF(S,E)                     GetAsPos((S),(E),(1))
#define m_GetAsPosB(S,E)                     GetAsPos((S),(E),(-1))
#define m_iMatchLft(A,B)                     iMatch((A),(B),(0))
#define m_iMatchWrd(A,B)                     iMatch((A),(B),(1))
#define m_iMatchRgt(A,B)                     iMatch((A),(B),(2))
#define m_WordsInTable(A)                    (sizeof(A)/sizeof(A[0]))
#define m_GetBrkPairPos(S,E)                 GetBracketPair((S),(E),(1))
#define m_IVAL(A)                            atol((PCHAR)(A))
#define c_FULLSET                            " ;().=,{}<>+-[]*/':|&?^"
#define c_PADSIZE                            1
#define c_MaxTypes                           2048
#define c_MaxElements                        128
#define c_MaxLocalVars                       16384
#define c_MaxGlobalVars                      16384
#define c_MaxLib                             64
#define c_MaxSrcLen                          0x100000
#define c_SglQt                              39
#define c_DblQt                              34
#define c_LPar                               40
#define c_RPar                               41
#define c_Comma                              44
#define c_LtBkt                              91
#define c_RtBkt                              93
#define c_vt_VarMin                          2
#define c_vt_VarMax                          vt_VARIANT
#define c_SizeOfName                         64
#define UDT_COM_NAMES_STORAGE_CLASS          struct _UDT_COM_NAMES_STORAGE*
#define c_MaxComStk                          256
#define c_MaxParamToken                      64
#define c_COM_Stack_Size                     64
#define c_COM_Max_Gl_Objs                    64
#define c_COM_Max_Lc_Objs                    64
#define c_COM_Max_Withs                      32
#define c_CommaPos                           128
#define UDT_ARG_COMMAS_STORAGE_CLASS         struct _UDT_ARG_COMMAS_STORAGE*
#define c_VARTYPES                           "%$#!@`"
#define UDT_SELECT_CASE_ATTRIBUTES_CLASS     struct _UDT_SELECT_CASE_ATTRIBUTES*
#define c_MaxNestedSelects                   32
#define c_NOTFOUND                           (-1)
#define UDT_KEYWORD_EMITTER_CLASS            struct _UDT_KEYWORD_EMITTER*
#define UDT_ARG_TYPE_CLASS                   struct _UDT_ARG_TYPE*
#define c_MaxProtoType                       8192
#define c_SizeOfCondition                    512
#define UDT_PROTOTYPE_STORAGE_CLASS          struct _UDT_PROTOTYPE_STORAGE*
#define c_SizeOfElementName                  64
#define UDT_ELEMENT_STORAGE_CLASS            struct _UDT_ELEMENT_STORAGE*
#define c_SizeOfVarName                      64
#define UDT_USER_TYPES_STORAGE_CLASS         struct _UDT_USER_TYPES_STORAGE*
#define c_SizeOfLabel                        10
#define UDT_LOOP_STORAGE_CLASS               struct _UDT_LOOP_STORAGE*
#define c_SizeOfVarDim                       128
#define c_SizeOfVarCondDef                   128
#define c_SizeOfVarModule                    300
#define UDT_VARINFO_STORAGE_CLASS            struct _UDT_VARINFO_STORAGE*
#define UDT_VARCODE_ATTRIBUTES_CLASS         struct _UDT_VARCODE_ATTRIBUTES*
#define UDT_COM_VARIANT_NAMES_CLASS          struct _UDT_COM_VARIANT_NAMES*
#define UDT_VARIANT_CAST_DEF_CLASS           struct _UDT_VARIANT_CAST_DEF*
#define UDT_CASTS_CLASS                      struct _UDT_CASTS*
#define c_MaxStk                             8192
#define c_MaxByref                           128
#define c_MaxDLLDecl                         1024
#define c_MaxLoopLocal                       512
#define c_MaxFiles                           512
#define c_MaxMacros                          2048
#define c_MaxBaseTypeDefs                    16
#define c_MaxSingleLineIFLines               256
#define c_MaxSplitLines                      256
#define c_MaxOnEntry                         256
#define c_MaxOnExit                          256
#define c_MaxLocalDynArr                     256
#define c_MaxGlobalDyna                      256
#define c_MaxDynaStr                         256
#define c_MaxStartSub                        32
#define c_MaxExitSub                         32
#define c_MaxClassNames                      1024
#define c_SizeOfDllDecl                      512
#define c_SizeOfLoadlibs                     512
#define c_MaxLoadlibs                        128
#define c_MaxHFiles                          128
#define c_MaxLocalInBlocks                   16
#define UDT_SUB_FUNC_TOKENS_CLASS            struct _UDT_SUB_FUNC_TOKENS*
#define UDT_FUNC_NAME_TYPE_CLASS             struct _UDT_FUNC_NAME_TYPE*
#define c_PrependVarSize                     8
#define c_WithVarSize                        8

// *************************************************
//                   Microsoft VC++
// *************************************************

#ifndef DECLSPEC_UUID
  #if(_MSC_VER >= 1100) && defined(__cplusplus)
    #define DECLSPEC_UUID(x)  __declspec(uuid(x))
  #else
    #define DECLSPEC_UUID(x)
  #endif
#endif
#if (_MSC_VER >= 1900)            // earlier versions untested
   #include <intrin.h>
      #ifndef _rdtsc
         #define _rdtsc __rdtsc   // MSVC uses 2 underscores
      #endif
#endif

// *************************************************
//                  GCC and CLANG
// *************************************************

#if defined(__GNUC__) || defined(__clang__)
   #ifndef __BCPLUSPLUS__
      #include <x86intrin.h>
   #endif
#endif

// *************************************************
//                  Embarcadero C++
// *************************************************

#if defined(__BCPLUSPLUS__)
      #include<malloc.h>
      #if defined (_clang__)
          #include <mmintrin.h>
      #endif
      #define _kbhit kbhit
      #ifndef _rdtsc
         #define _rdtsc __rdtsc  // Uses 2 underscores
      #endif
#endif

#if !defined(__LCC__)
    #define overloaded
#else
    #define overloaded overloaded
#endif

// *************************************************
// Instruct Linker to Search Object/Import Libraries
// *************************************************

#if !defined(__GNUC__) && !defined(__TINYC__)
   #if !(defined(__BCPLUSPLUS__) && defined(_WIN64))
    #pragma comment(lib,"kernel32.lib")
    #pragma comment(lib,"user32.lib")
    #pragma comment(lib,"gdi32.lib")
    #pragma comment(lib,"comctl32.lib")
    #pragma comment(lib,"advapi32.lib")
    #pragma comment(lib,"winspool.lib")
    #pragma comment(lib,"shell32.lib")
    #pragma comment(lib,"msimg32.lib")
    #pragma comment(lib,"ole32.lib")
    #pragma comment(lib,"oleaut32.lib")
    #pragma comment(lib,"uuid.lib")
    #pragma comment(lib,"odbc32.lib")
    #pragma comment(lib,"odbccp32.lib")
    #pragma comment(lib,"winmm.lib")
    #pragma comment(lib,"comdlg32.lib")
    #pragma comment(lib,"imagehlp.lib")
    #pragma comment(lib,"version.lib")
    #pragma comment(lib,"wininet.lib")
    #pragma comment(lib,"urlmon.lib")
  #endif
#endif
 
// *************************************************
//          Application GLOBAL Enumerations
// *************************************************

enum
  {
    vt_UNKNOWN,
    vt_STRLIT,
    vt_INTEGER,
    vt_SINGLE,
    vt_DOUBLE,
    vt_LDOUBLE,
    vt_LLONG,
    vt_STRVAR,
    vt_DECFUNC,
    vt_NUMBER,
    vt_FILEPTR,
    vt_UDT,
    vt_STRUCT,
    vt_UNION,
    vt_PSTR,
    vt_BOOL,
    vt_CHAR,
    vt_SCHAR,
    vt_PSTRPTR,
    vt_PCHAR,
    vt_CHARPTR,
    vt_VOID,
    vt_LONG,
    vt_WORD,
    vt_DWORD,
    vt_FARPROC,
    vt_PBYTE,
    vt_LRESULT,
    vt_BYTE,
    vt_SHORT,
    vt_SSHORT,
    vt_USHORT,
    vt_UINT,
    vt_ULONG,
    vt_ULONGLONG,
    vt_HWND,
    vt_HDC,
    vt_COLORREF,
    vt_HANDLE,
    vt_HINSTANCE,
    vt_BITMAPINFO,
    vt_HBITMAP,
    vt_WNDCLASSEX,
    vt_HFONT,
    vt_CONSTRDESTR,
    vt_VARIANT_BOOL,
    vt__VARIANT_BOOL,
    vt_SCODE,
    vt_CY,
    vt_DATE,
    vt_BSTR,
    vt_IUnknown,
    vt_IDispatch,
    vt_SAFEARRAY,
    vt_PVOID,
    vt_DECIMAL,
    vt_DOCINFO,
    vt_LOGFONT,
    vt_TEXTMETRIC,
    vt_WINBOOL,
    vt_VARIANT
  };

enum
  {
    OSUnknown = (-2),
    OSError   = (-1),
    OS_3x,
    OS_95,
    OS_98,
    OS_ME,
    OS_NT3,
    OS_2000,
    OS_XP,
    OS_XP_Pro_x64,
    OS_Server_2003,
    OS_Home_Server,
    OS_Server_2003_R2,
    OS_Vista,
    OS_Server_2008,
    OS_Server_2008_R2,
    OS_Win_7,
    OS_Server_2012,
    OS_Win_8,
    OS_Win_81,
    OS_Server_2012_R2,
    OS_Win_10,
    OS_Server_2016,
    OS_Win_11,
    OS_Server_2019,
    OS_Server_2022
  };

enum
  {
    eFunctionType = (1),
    eSubType
  };

enum
  {
    ePart,
    eFull
  };

enum
  {
    ImDim       = 0x0001,
    ImLocal     = 0x0002,
    ImRaw       = 0x0004,
    ImStatic    = 0x0008,
    ImAuto      = 0x0010,
    ImRegister  = 0x0020,
    ImCPPPrvDim = 0x0040
  };

enum
  {
    mt_ProcessSetCommand,
    mt_FuncSubDecC_Dec,
    mt_FuncSubDecC_DecAParam,
    mt_FuncSubDecC_DecNoParam,
    mt_Opts,
    mt_OptsAParam,
    mt_OptsNoParam,
    mt_OverLoad,
    mt_OverLoadAParam,
    mt_OverLoadNoParam,
    mt_ConsDes,
    mt_ConsDesAParam,
    mt_ConsDesNoParam
  };

enum
  {
    eDoNothing,
    eStartSysVariables,
    eDoSysVariables,
    eStartUserVariables,
    eDoUserVariables,
    eStartMacros,
    eDoMacros,
    eStartStdProtos,
    eDoStdProtos,
    eStartUserProtos,
    eDoUserProtos,
    eStartUserConst,
    eDoUserConst,
    eStartSysConst,
    eDoSysConst,
    eDoMainProgram,
    eDoUserProcs,
    eStartUserTypes,
    eDoUserTypes
  };

enum
  {
    comvt_BAD = (-1),
    comvt_TRUE,
    comvt_FALSE,
    comvt_BOOL,
    comvt__VARIANT_BOOL,
    comvt_BSTR,
    comvt_STRVAR,
    comvt_R4,
    comvt_R8,
    comvt_R8_LITERAL,
    comvt_CY,
    comvt_DATE,
    comvt_DISPATCH,
    comvt_PVOID,
    comvt_ERROR,
    comvt_VARIANT,
    comvt_UNKNOWN,
    comvt_DECIMAL,
    comvt_I1,
    comvt_UI1,
    comvt_I2,
    comvt_UI2,
    comvt_I4,
    comvt_I4_LITERAL,
    comvt_UI4,
    comvt_I8,
    comvt_UI8,
    comvt_INT,
    comvt_UINT,
    comvt_VOID,
    comvt_OBJECT,
    comvt_EMPTY,
    comvt_NULL,
    comvt_HRESULT,
    comvt_PTR,
    comvt_SAFEARRAY,
    comvt_CARRAY,
    comvt_USERDEFINED,
    comvt_PSTR,
    comvt_PWSTR,
    comvt_RECORD,
    comvt_INT_PTR,
    comvt_UINT_PTR,
    comvt_FILETIME,
    comvt_BLOB,
    comvt_STREAM,
    comvt_STORAGE,
    comvt_STREAMED_OBJECT,
    comvt_STORED_OBJECT,
    comvt_BLOB_OBJECT,
    comvt_CF,
    comvt_CLSID,
    comvt_VERSIONED_STREAM,
    comvt_BSTR_BLOB,
    comvt_NAMED_ARGUMENT,
    comvt_CAST,
    comvt_DEFAULT,
    comvt_VECTOR   = 0x1000,
    comvt_ARRAY    = 0x2000,
    comvt_BYREF    = 0x4000,
    comvt_TYPEMASK = 0x0FFF,
    comvt_ILLEGAL  = 0xFFFF
  };

enum
  {
    ePrinterGroup   = 0x0001,
    eFontGroup      = 0x0002,
    eClassName      = 0x0004,
    eBCX_hInstance  = 0x0008
  };

enum
  {
    lt_DOLOOP = 1,
    lt_DOWHILELOOP,
    lt_DOUNTILLOOP,
    lt_WHILEWEND,
    lt_FORNEXT,
    lt_SELECT,
    lt_FORXNEXT
  };

enum
  {
    eExitingMoreThan1Loop = 1
  };

enum
  {
    eWI_CPPWord       = 0x0001,
    eWI_ReplaceWord   = 0x0002,
    eWI_NoFixup       = 0x0004,
    eWI_Directive     = 0x0008,
    eWI_Transform     = 0x0010,
    eWI_Position1     = 0x0020,
    eWI_Reserve10     = 0x0040,
    eWI_Reserve09     = 0x0080,
    eWI_Reserve08     = 0x0100,
    eWI_Reserve07     = 0x0200,
    eWI_Reserve06     = 0x0400,
    eWI_Reserve05     = 0x0800,
    eWI_Reserve04     = 0x1000,
    eWI_Reserve03     = 0x2000,
    eWI_Reserve02     = 0x4000,
    eWI_Reserve01     = 0x8000
  };
 
// *************************************************
//      Runtime Library Function Prototypes
// *************************************************
 
int     Cint (double);
int     EoF (FILE*);
char*   NamePathFromFP (FILE*);
PWORD   lpwAlign (PWORD);
void    InfoBox (PCTSTR, PCTSTR, int=170, int=170);
LRESULT CALLBACK CB_InfoBox (HWND, UINT, WPARAM, LPARAM);
void    cls (void);
void    color (int, int=0);
void    PushColors (void);
void    PopColors  (void);
void    locate (int, int, int=1, int=12);
int     Pos (void);
int     Csrlin (void);
void    midstr (char*, int, int, char *);
char*   BCX_TempStr (size_t);
char*   sziif (int, PCTSTR, PCTSTR);
char*   Using (PCTSTR, long double);
char*   TempFileName (PCTSTR, PCTSTR);
char*   AppExePath (void);
char*   vchr (int,...);
char*   lcase (PCTSTR);
char*   ucase (PCTSTR);
char*   mid (PCTSTR, int, int=-1);
char*   ltrim (PCTSTR, char=32);
char*   rtrim (PCTSTR, char=32);
char*   trim (PCTSTR);
char*   strim (PCTSTR);
char*   left (PCTSTR, int);
char*   right (PCTSTR, int);
char*   cpad (PCTSTR, int, int=32);
char*   rpad (PCTSTR, int, int=32);
char*   lpad (PCTSTR, int, int=32);
char*   stringx (int, int);
char*   repeat (int, PCTSTR);
char*   extract (PCTSTR, PCTSTR);
char*   remain (PCTSTR, PCTSTR);
char*   command (int=-1);
char*   mcase (PCTSTR);
char*   replace (PCTSTR, PCTSTR, PCTSTR);
char*   iReplace (PCTSTR, PCTSTR, PCTSTR);
char*   RemoveAny (PCTSTR, PCTSTR);
void    BCX_Sleep (int);
char*   space (int a);
char*   str (double, int=0);
char*   RegString (HKEY, PCTSTR, PCTSTR);
void    CreateRegString (HKEY, PCTSTR, PCTSTR, PCTSTR);
char*   findfirst (PCTSTR);
char*   LookAhead (FILE*, int=1);
char*   curdir (void);
char*   tempdir (void);
char*   Environ (PCTSTR);
char*   date (int=0);
char*   isodate (int=0);
char*   BcxSplitPath (PCTSTR, int);
char*   BcxPath (void);
char*   LccPath (void);
char*   PellesPath (void);
char*   StrToken (PCTSTR, PCTSTR, int);
char*   RemoveStr (PCTSTR, PCTSTR);
char*   IRemoveStr (PCTSTR, PCTSTR);
char*   timef (int=0, int=0);
char*   join(int, PCTSTR, ...);
char*   enc (PCTSTR, int=0, int=0);
char*   _stristr_(PCTSTR, PCTSTR);
char*   DeDupeSort(const char*);
int     DeDupeCompare(const void*, const void*);
int     InstrRev (PCTSTR, PCTSTR, int=0, int=0);
int     bcx_stricmp (PCTSTR cs, PCTSTR ct);
int     instr (PCTSTR, PCTSTR, int=1, int=0);
int     iinstr (PCTSTR, PCTSTR, int=1);
int     InstrAny (PCTSTR, PCTSTR, int=1);
int     inchr (PCTSTR, PCTSTR);
int     like (PCTSTR, PCTSTR);
int     LeftStr  (PCTSTR, PCTSTR, int=0);
int     RightStr (PCTSTR, PCTSTR, int=0);
int     tally (PCTSTR, PCTSTR, int=0);
BOOL    Exist   (PCTSTR);
BOOL    Exist_A (PCTSTR);
BOOL    Exist_B (PCTSTR);
double  iif (int, double, double);
unsigned long long int  lof (PCTSTR);
unsigned char*  MakeLCaseTbl (void);
unsigned char*  MakeUCaseTbl (void);
 
// *************************************************
//       Application Defined Types And Unions
// *************************************************

typedef struct _UDT_COM_NAMES_STORAGE
{
  char  com_VarName[c_SizeOfName];
  BOOL  initialized;
}UDT_COM_NAMES_STORAGE, *LPUDT_COM_NAMES_STORAGE, *UDT_COM_NAMES_STORAGE_PTR;

typedef struct _UDT_ARG_COMMAS_STORAGE
{
  int NumArgs;
  int CommaPos[c_CommaPos];
}UDT_ARG_COMMAS_STORAGE, *LPUDT_ARG_COMMAS_STORAGE, *UDT_ARG_COMMAS_STORAGE_PTR;

typedef struct _UDT_SELECT_CASE_ATTRIBUTES
{
  char  CaseStk[BCXSTRSIZE];
  int  CaseElseFlag;
  int  CaseFlag;
  int  iStartCase;
  int  NoBreak;
  int  iJumpTo;
}UDT_SELECT_CASE_ATTRIBUTES, *LPUDT_SELECT_CASE_ATTRIBUTES, *UDT_SELECT_CASE_ATTRIBUTES_PTR;

typedef struct _UDT_KEYWORD_EMITTER
{
  PTCHAR  pszWord;
  int  iType;
  int   (__cdecl *Emitter)(char *,PINT);
}UDT_KEYWORD_EMITTER, *LPUDT_KEYWORD_EMITTER, *UDT_KEYWORD_EMITTER_PTR;

typedef struct _UDT_ARG_TYPE
{
  char  Arg[BCXSTRSIZE];
  int  ArgType;
}UDT_ARG_TYPE, *LPUDT_ARG_TYPE, *UDT_ARG_TYPE_PTR;

typedef struct _UDT_PROTOTYPE_STORAGE
{
  char  Condition[c_SizeOfCondition];
  int  CondLevel;
  char  Prototype[BCXSTRSIZE];
}UDT_PROTOTYPE_STORAGE, *LPUDT_PROTOTYPE_STORAGE, *UDT_PROTOTYPE_STORAGE_PTR;

typedef struct _UDT_ELEMENT_STORAGE
{
  int  ElementType;
  int  ElementID;
  int  ElementDynaPtr;
  char  ElementName[c_SizeOfElementName];
}UDT_ELEMENT_STORAGE, *LPUDT_ELEMENT_STORAGE, *UDT_ELEMENT_STORAGE_PTR;

typedef struct _UDT_USER_TYPES_STORAGE
{
  char  VarName[c_SizeOfVarName];
  int  TypeofDef;
  int  EleCnt;
  struct _UDT_ELEMENT_STORAGE  Elements[c_MaxElements];
}UDT_USER_TYPES_STORAGE, *LPUDT_USER_TYPES_STORAGE, *UDT_USER_TYPES_STORAGE_PTR;

typedef struct _UDT_LOOP_STORAGE
{
  int  iLoopType;
  int  iLoopLine;
  int  iJumpTo;
  char  szUseNeedLabel[c_SizeOfLabel];
}UDT_LOOP_STORAGE, *LPUDT_LOOP_STORAGE, *UDT_LOOP_STORAGE_PTR;

typedef struct _UDT_VARINFO_STORAGE
{
  int  VarLine;
  int  VarType;
  int  VarDef;
  int  VarPntr;
  int  VarSF;
  int  VarExtn;
  int  VarCondLevel;
  int  VarEmitFlag;
  int  VarConstant;
  char  VarName[c_SizeOfVarName];
  char  VarDim[c_SizeOfVarDim];
  char  VarModule[c_SizeOfVarModule];
  char  VarCondDef[c_SizeOfVarCondDef];
}UDT_VARINFO_STORAGE, *LPUDT_VARINFO_STORAGE, *UDT_VARINFO_STORAGE_PTR;

typedef struct _UDT_VARCODE_ATTRIBUTES
{
  int  VarNo;
  int  Methd;
  int  IsPtrFlag;
  int  IsExported;
  int  UseInLine;
  char  Header[BCXSTRSIZE];
  char  Proto[BCXSTRSIZE];
  char  Functype[BCXSTRSIZE];
  char  StaticOut[BCXSTRSIZE];
  char  Token[BCXSTRSIZE];
  char  AsToken[BCXSTRSIZE];
}UDT_VARCODE_ATTRIBUTES, *LPUDT_VARCODE_ATTRIBUTES, *UDT_VARCODE_ATTRIBUTES_PTR;

typedef struct _UDT_COM_VARIANT_NAMES
{
  PTCHAR  sNAME;
  int  iTYPE;
  int  iPTRS;
}UDT_COM_VARIANT_NAMES, *LPUDT_COM_VARIANT_NAMES, *UDT_COM_VARIANT_NAMES_PTR;

typedef struct _UDT_VARIANT_CAST_DEF
{
  PTCHAR  pszCAST;
  int  iCASTID;
}UDT_VARIANT_CAST_DEF, *LPUDT_VARIANT_CAST_DEF, *UDT_VARIANT_CAST_DEF_PTR;

typedef struct _UDT_CASTS
{
  PTCHAR  pszCAST;
  PTCHAR  pszVAL;
}UDT_CASTS, *LPUDT_CASTS, *UDT_CASTS_PTR;

typedef UINT_PTR (CALLBACK *CPP_FARPROC)(PCHAR);

typedef struct _UDT_SUB_FUNC_TOKENS
{
  int  iTRAN_FLAG;
  PTCHAR  pszFunctionName;
  PTCHAR  pszFunctionXName;
  int  iWordInfo;
  int  iCOM;
}UDT_SUB_FUNC_TOKENS, *LPUDT_SUB_FUNC_TOKENS, *UDT_SUB_FUNC_TOKENS_PTR;

typedef struct _UDT_FUNC_NAME_TYPE
{
    char FunctionName[BCXSTRSIZE];
    char FunctionType[BCXSTRSIZE];
}UDT_FUNC_NAME_TYPE, *LPUDT_FUNC_NAME_TYPE, *UDT_FUNC_NAME_TYPE_PTR;
 
// *************************************************
//             Runtime Library Variables
// *************************************************
 
static char    TAB [2]={9,0};      // Horz Tab
static char    LF  [2]={10,0};     // Line Feed
static char    SPC [2]={32,0};     // Space
static char    DQ  [2]={34,0};     // Double-Quote
static char    DDQ [3]={34,34,0};  // Double-Double-Quote
static char    CRLF[3]={13,10,0};  // Carr Rtn & Line Feed
static COORD   cursor;             // holds coordinates of cursor
static HANDLE  hConsole;           // handle of console window
static int     color_fg = 7;       // forground color set to default
static int     color_bg = 0;       // background color set to default
static int     color_pshpop;       // Push / Pop Color storage
static unsigned char*  LowCase;
static unsigned char*  UprCase;
static HANDLE  fffn_FileHandle;
static WIN32_FIND_DATA fffn_FindData;

// *************************************************
//          Application Global Variables
// *************************************************

static int    ComNdx;
static int    LinesWritten;
static int    DebugModeOff;
static int    MacroCount;
static int    ByrefCnt;
static int    LoopLocalCnt;
static int    LoopTypeCnt;
static int    FileNdx;
static FILE   *FP_WRITE;
static int    iDoWhile;
static int    iLoopCond;
static int    GlobalVarCnt;
static int    TypeDefsCnt;
static int    GlobalDynaCnt;
static int    LocalVarCnt;
static int    LocalDynArrCnt;
static int    LocalDynaCnt;
static int    CombineRes;
static int    FPtrNdx;
static int    UmQt;
static int    SplitCnt;
static int    SplitCur;
static int    StartNdx;
static int    ExitNdx;
static int    UseCpp;
static int    UseCpphdr;
static int    UseIO;
static int    InNameSpace;
static int    InClass;
static int    InCppTypeDef;
static int    iClassCnt;
static int    IsVirtual;
static int    UsingTemplate;
static int    WasAClass;
static int    HasVector;
static int    NO_VKKEYS;
static int    NO_BORLAND;
static int    NO_GCCCLANG;
static int    NO_LCCWIN;
static int    NO_LIBS;
static int    NO_MSVC;
static int    NO_PELLES;
static int    UseInLine;
static int    CallBackFlag;
static int    Comma;
static int    CurrentFuncType;
static int    DoCountLines;
static int    DllCnt;
static int    LoadLibsCnt;
static float  Elapsed;
static int    EndOfProgram;
static int    EntryCnt;
static int    ErrFile;
static int    ExitSubFunc;
static int    ForceMainToFunc;
static int    g_SubFuncPtr;
static int    HFileCnt;
static int    InBlock;
static int    InConditional;
static int    Indent;
static int    InDialogEvt;
static int    InfoBoxWarn;
static int    InFunction;
static int    Inject_Local_Bcx_RetVal;
static int    InMain;
static int    InWinMain;
static int    IsCallBack;
static int    ModDialogEvt;
static int    UseCProto;
static int    InTypeDef;
static int    NoTypeDeclare;
static int    InsertComments;
static int    IsAuto;
static int    IsDim;
static int    IsLocal;
static int    IsRaw;
static int    IsRegister;
static int    IsStatic;
static int    IsStdFunc;
static int    KillCFile;
static int    LastCmd;
static int    LinesRead;
static int    MakeDLL;
static int    Ndx;
static BOOL   NoMain;
static BOOL   NoDllMain;
static BOOL   OkayToSend;
static BOOL   OptimizerEnabled;
static BOOL   OptimizerFirstSetting;
static int    OptionBase;
static BOOL   PassOne;
static int    ProtoCnt;
static int    StateIdx;
static BOOL   PPFlag;

static HINSTANCE PPDLL_HANDLE;

static CPP_FARPROC PPProc;

static int    Use_LoadLibraryError;
static BOOL   Use_Project;
static BOOL   Gen_Header;
static BOOL   NoRT;
static BOOL   Quiet;
static BOOL   WarningFlag;
static BOOL   ZapFlag;
static BOOL   ReDirect;
static FILE   *SaveFP_WRITENum;
static int    ShowStatus;
static int    SrcCnt;
static int    SrcFlag;
static int    TraceFlag;
static BOOL   TestForBcxIni;
static int    g_FoundLocalDynArray;
static int    iEmitVarGroup;
static int    For_Next_Error_Detected;
static int    Statements;
static int    IgnoreStrCase;
static int    TestState;
static int    TranslateSlash;
static int    Use_BcxTempStr;
static int    Use_BCX_stricmp;
static int    UseStdCall;
static int    UseImportExport;
static int    Use_LCaseTbl;
static int    Use_UCaseTbl;
static int    WinHeaders;
static int    XitCount;
static int    Use_GUINoMain;
static int    Use_MDIGUINoMain;
static int    Use_Wingui;
static int    Use_MainEvent;
static int    Use_Mdigui;
static int    Use_ShowModal;
static int    Use_EndModal;
static int    Use_BCX_MsgPump;
static int    Use_BCX_MDI_MsgPump;
static int    Use_BCX_Wnd;
static int    Use_BCX_FrameWnd;
static int    Use_BCX_SetBkGrdBrush;
static int    Use_BCX_SetClassStyle;
static int    Use_BCX_SetIcon;
static int    Use_BCX_SetIconSm;
static int    Use_BCX_SetMetric;
static int    Use_BCX_InitGUI;
static int    Use_BCX_RegWnd;
static int    Use_BCX_SetCursor;
static int    Use_AnsiToWide;
static int    Use_Asinh;
static int    Use_Acosh;
static int    Use_AppActivate;
static int    Use_Atanh;
static int    Use_Asc;
static int    Use_AppExeName;
static int    Use_AppExePath;
static int    Use_Bff;
static int    Use_Boolstr;
static int    Use_Bnot;
static int    Use_BCX_Blit;
static int    Use_BCX_Blit_Stretch;
static int    Use_BCX_Blit_Sprite;
static int    Use_BCX_Buffer;
static int    Use_BCX_BmpWidth;
static int    Use_BCX_BmpHeight;
static int    Use_BCX_Class_Info;
static int    Use_BCX_LoadBMP;
static int    Use_BCX_LoadImage;
static int    Use_BCX_Control;
static int    Use_BCX_Colordlg;
static int    Use_BCX_Cursor;
static int    Use_BCX_Fontdlg;
static int    Use_BCX_Floodfill;
static int    Use_BCX_Get;
static int    Use_BCX_Get_Window_Width;
static int    Use_BCX_Get_Window_Height;
static int    Use_BcxSplitPath;
static int    Use_BCX_Path;
static int    Use_BCX_Put;
static int    Use_BCX_Preset;
static int    Use_BCX_Pset;
static int    Use_BCX_Polar_Pset;
static int    Use_BCX_Line;
static int    Use_BCX_Polar_Line;
static int    Use_BCX_Lineto;
static int    Use_BCX_Circle;
static int    Use_BCX_Triangle;
static int    Use_BCX_Gradient;
static int    Use_BCX_Ellipse;
static int    Use_BCX_Rectangle;
static int    Use_BCX_Resize;
static int    Use_BCX_Roundrect;
static int    Use_BCX_Getpixel;
static int    Use_BCX_Arc;
static int    Use_BCX_OlePicture;
static int    Use_BCX_Pie;
static int    Use_BCX_Polygon;
static int    Use_BCX_PolyBezier;
static int    Use_BCX_Polyline;
static int    Use_BCX_Print;
static int    Use_BCX_Printex;
static int    Use_BCX_Tile;
static int    Use_BCX_Slider;
static int    Use_BCX_Splitter;
static int    Use_BCX_Tab;
static int    Use_BCX_Toolbar;
static int    Use_BCX_UpDown;
static int    Use_BCX_Get_UpDown;
static int    Use_Bin;
static int    Use_Bin2dec;
static int    Use_ByteAt;
static int    Use_Cast;
static int    Use_Cvd;
static int    Use_Cvld;
static int    Use_Cvi;
static int    Use_Cvl;
static int    Use_Cvs;
static int    Use_Cdbl;
static int    Use_Cldbl;
static int    Use_Csng;
static int    Use_Clear;
static int    Use_Clip_Getbitmap;
static int    Use_Clip_Setbitmap;
static int    Use_Clip_Gettext;
static int    Use_Clip_Gettextsize;
static int    Use_Clip_Reset;
static int    Use_Clip_Settext;
static int    Use_Chrtoutf8;
static int    Use_Cbool;
static int    Use_Cint;
static int    Use_Clng;
static int    Use_Cls;
static int    Use_Color;
static int    Use_Command;
static int    Use_ComboBoxLoadFile;
static int    Use_Console;
static int    Use_Consolesize;
static int    Use_ContainedIn;
static int    Use_Cpad;
static int    Use_Static;
static int    Use_CreateRegInt;
static int    Use_CreateRegString;
static int    Use_Crlf;
static int    Use_Csrlin;
static int    Use_Curdir;
static int    Use_Cursor;
static int    Use_Date;
static int    Use_DrawStr;
static int    Use_IsoDate;
static int    Use_Datacount;
static int    Use_Del;
static int    Use_DeleteRegKey;
static int    Use_Diskfree;
static int    Use_Diskused;
static int    Use_Disksize;
static int    Use_Doevents;
static int    Use_Download;
static int    Use_Downloadtostr;
static int    Use_Draw;
static int    Use_Dynacall;
static int    Use_DynacallA;
static int    Use_DynacallCommon;
static int    Use_DynamicA;
static int    Use_DrawTransBMP;
static int    Use_Elf;
static int    Use_Enclose;
static int    Use_Environ;
static int    Use_EnumFile;
static int    Use_Eof;
static int    Use_EqualTo;
static int    Use_Exist;
static int    Use_ExitCode;
static int    Use_Extract;
static int    Use_ExtractAny;
static int    Use_LeanAndMean;
static int    Use_Lclick;
static int    Use_LoadFile;
static int    Use_ForEach;
static int    Use_Format;
static int    Use_FillArray;
static int    Use_FirstInstance;
static int    Use_Findfirst;
static int    Use_Findnext;
static int    Use_Lookahead;
static int    Use_FindInType;
static int    Use_Fix;
static int    Use_FileLocked;
static int    Use_Frac;
static int    Use_Fracl;
static int    Use_Freefile;
static int    Use_Get;
static int    Use_Getaddr;
static int    Use_Setaddr;
static int    Use_GetBmp;
static int    Use_Gethttpfilesize;
static int    Use_SetDimension;
static int    Use_GetDimension;
static int    Use_Getdrive;
static int    Use_Getfilename;
static int    Use_GetSaveAsFilename;
static int    Use_Getattr;
static int    Use_GetResource;
static int    Use_GetSpecialFolder;
static int    Use_GetSpecialFolderex;
static int    Use_GetTextSize;
static int    Use_GenFree;
static int    Use_GoSub;
static int    Use_Hex;
static int    Use_Hex2Dec;
static int    Use_Hook;
static int    Use_Iif;
static int    Use_Inputbuffer;
static int    Use_Inkey;
static int    Use_InkeyD;
static int    Use_Inputbox;
static int    Use_Infobox;
static int    Use_BoxCommon;
static int    Use_Isptr;
static int    Use_Ins;
static int    Use_Instr;
static int    Use_IInstr;
static int    Use_InstrAny;
static int    Use_IInstrAny;
static int    Use_Like_Instr;
static int    Use_Inchr;
static int    Use_iReplace;
static int    Use_IReplaceAny;
static int    Use_IRemove;
static int    Use_IRemoveAny;
static int    Use_Instrrev;
static int    Use_Imod;
static int    Use_Istrue;
static int    Use_Isfalse;
static int    Use_Isnull;
static int    Use_Notnull;
static int    Use_Iszero;
static int    Use_Issystem;
static int    Use_Ishidden;
static int    Use_Isreadonly;
static int    Use_Isfolder;
static int    Use_Isfile;
static int    Use_Join;
static int    Use_Keypress;
static int    Use_KBinput;
static int    Use_Lcase;
static int    Use_LccPath;
static int    Use_PellesPath;
static int    Use_Ldouble;
static int    Use_Left;
static int    Use_LeftStr;
static int    Use_Like;
static int    Use_LineinputKB;
static int    Use_ListBoxLoadFile;
static int    Use_Loc;
static int    Use_Longestline;
static int    Use_Locate;
static int    Use_Lof;
static int    Use_Lpad;
static int    Use_Ltrim;
static int    Use_Mcase;
static int    Use_Mid;
static int    Use_Midstr;
static int    Use_Msgbox;
static int    Use_Mkd;
static int    Use_Mkld;
static int    Use_Mki;
static int    Use_Mkl;
static int    Use_Mks;
static int    Use_Mkpath;
static int    Use_Min;
static int    Use_Modstyle;
static int    Use_Max;
static int    Use_Mouse_sx;
static int    Use_Mouse_sy;
static int    Use_Mouse_cx;
static int    Use_Mouse_cy;
static int    Use_NamePathFromFP;
static int    Use_Nextlinelen;
static int    Use_Now;
static int    Use_Notzero;
static int    Use_NotEqualTo;
static int    Use_Numqsortdint;
static int    Use_Numqsortaint;
static int    Use_Numqsortdfloat;
static int    Use_Numqsortafloat;
static int    Use_Numqsortddouble;
static int    Use_Numqsortadouble;
static int    Use_Idxqsort;
static int    Use_IdxqsortSt;
static int    Use_PtrqsortSt;
static int    Use_PushPopColors;
static int    Use_Oct;
static int    Use_Overloaded;
static int    Use_OSVersion;
static int    Use_Panel;
static int    Use_Pause;
static int    Use_PeekStr;
static int    Use_Pos;
static int    Use_Printer;
static int    Use_ProgressBar;
static int    Use_Proto;
static int    Use_Put;
static int    Use_QBColor;
static int    Use_DegToRad;
static int    Use_RadToDeg;
static int    Use_Randomize;
static int    Use_Read;
static int    Use_Readnum;
static int    Use_Rec;
static int    Use_RecCount;
static int    Use_Remain;
static int    Use_RemainAny;
static int    Use_Remove;
static int    Use_Repeat;
static int    Use_Replace;
static int    Use_ReplaceAny;
static int    Use_RemoveAny;
static int    Use_Reverse;
static int    Use_Right;
static int    Use_RightStr;
static int    Use_Rpad;
static int    Use_Rclick;
static int    Use_Rnd;
static int    Use_Rnd2;
static int    Use_Exp;
static int    Use_Retain;
static int    Use_Round;
static int    Use_Rtrim;
static int    Use_Run;
static int    Use_SaveBmp;
static int    Use_Scan;
static int    Use_Screen;
static int    Use_Setattr;
static int    Use_Seteof;
static int    Use_SearchPath;
static int    Use_Set_BCX_Bitmap;
static int    Use_Set_BCX_Bitmap2;
static int    Use_Set_BCX_BmpButton;
static int    Use_Set_BCX_Icon;
static int    Use_Sgn;
static BOOL   Use_SingleFile;
static int    Use_Sleep;
static int    Use_Sound;
static int    Use_Space;
static int    Use_Split;
static int    Use_DSplit;
static int    Use_StartupCode;
static int    Use_Stristr;
static int    Use_Str;
static int    Use_Strl;
static int    Use_Strim;
static int    Use_String;
static int    Use_Strptr;
static int    Use_Strqsorta;
static int    Use_Strqsortas;
static int    Use_Strqsortd;
static int    Use_Strqsortds;
static int    Use_Strqsorts;
static int    Use_Strtoken;
static int    Use_DynStrqsorta;
static int    Use_DynStrqsortas;
static int    Use_DynStrqsortd;
static int    Use_DynStrqsortds;
static int    Use_DynAlphaNumericA;
static int    Use_DynAlphaNumericD;
static int    Use_AlphaNumericA;
static int    Use_AlphaNumericD;
static int    Use_AlphaNumeric;
static int    Use_RegExist;
static int    Use_RegInt;
static int    Use_RegString;
static int    Use_Resource;
static int    Use_GenResFile;
static int    Use_Swap;
static int    Use_Sysdir;
static int    Use_SysMacros;
static int    Use_SysStr;
static int    Use_sziif;
static int    Use_Tally;
static int    Use_Tempdir;
static int    Use_TempFileName;
static int    Use_Textmode;
static int    Use_Threads;
static int    Use_Time;
static int    Use_Timer;
static int    Use_Tix;
static int    Use_Treeview;
static int    Use_Trim;
static int    Use_Ucase;
static int    Use_Using;
static int    Use_Ubound;
static int    Use_Utf8tochr;
static int    Use_Unwrap;
static int    Use_VChr;
static int    Use_VBS;
static int    Use_Verify;
static int    Use_Val;
static int    Use_Vall;
static int    Use_WideToAnsi;
static int    Use_Vscroll;
static int    Use_Hscroll;
static int    Use_Newbmp;
static int    Use_Makebmp;
static int    Use_Makehdc;
static int    Use_Windir;
static int    Use_Wrap;
static int    Use_BCX_Input;
static int    Use_BCX_ToolTip;
static int    Use_Bitmap;
static int    Use_Blackrect;
static int    Use_BmpButton;
static int    Use_SplitButton;
static int    Use_Button;
static int    Use_Center;
static int    Use_Checkbox;
static int    Use_Combobox;
static int    Use_Datepick;
static int    Use_Edit;
static int    Use_BCXMDialog;
static int    Use_BCXDialog;
static int    Use_BCXDialogCommon;
static int    Use_Form;
static int    Use_GetText;
static int    Use_Grayrect;
static int    Use_Group;
static int    Use_Hide;
static int    Use_Icon;
static int    Use_Label;
static int    Use_Listbox;
static int    Use_Listview;
static int    Use_PlayWav;
static int    Use_Radio;
static int    Use_Refresh;
static int    Use_Richedit;
static int    Use_SetColor;
static int    Use_Setclientsize;
static int    Use_SetFont;
static int    Use_SetFormColor;
static int    Use_SetText;
static int    Use_Show;
static int    Use_Status;
static int    Use_Whiterect;
static int    Use_BEL;
static int    Use_BS;
static int    Use_CR;
static int    Use_DDQ;
static int    Use_DQ;
static int    Use_EF;
static int    Use_ESC;
static int    Use_FF;
static int    Use_LF;
static int    Use_NUL;
static int    Use_SPC;
static int    Use_TAB;
static int    Use_VT;
static int    ProcessingCOM_Set;
static int    COM_gl_names_index;
static int    COM_lc_names_index;
static int    COM_gl_names_free_index;
static int    COM_lc_names_free_index;
static int    COM_FOREACH_enumerator;
static int    Use_COM;
static int    Use_COM_Collections;
static int    Use_UNICODE;
static int    Use_MULTITHREADED_SW;
static int    COM_build_trace_code;
static int    COM_open_WITH_statement;
static int    Use_COM_CLSID;
static int    Use_COM_CreateObject;
static int    Use_COM_DispatchObject;
static int    Use_COM_GetObject;
static int    Use_COM_GetProperty;
static int    Use_COM_InvokeMethod;
static int    Use_COM_SetProperty;
static int    Use_COM_SafeArray;
static int    Use_COM_UsesConversion;
static int    Use_SafeArrays;
static char   *FuncStrNames;
static char   *FuncSglNames;
static char   *FuncDblNames;
static char   *CurLine;
static char   *gTmpStr;
static char   *Src;
static char   *AbortSrc;
static char   *IF_Stmt_Tank;
static char   *WarnMsg;
static char   *RmLibs;
static FILE   *SourceFile;
static FILE   *FP2;
static FILE   *FP_CCODE;
static FILE   *FP_SYSCST;
static FILE   *FP3;
static FILE   *FP_UDT;
static FILE   *FP_DAT;
static FILE   *FP_CST;
static FILE   *FP_HDR;
static FILE   *FP_RES;
static FILE   *FP_ENU;
static FILE   *FP_OVR;
static FILE   *FP_SET;
static FILE   *FP_DEF;
static long   ppret;
static FILE   *FP1;
static FILE   *FPScan;
static FILE   *IncFP;

static UDT_FUNC_NAME_TYPE FunctionNameType;

static FILE   *FP_W;
static FILE   *FP_HeaderFile;
static FILE   *FP_R;
static FILE   *fpErr;
static FILE   *FPDEF;
static int    TransformSigil;
static int    PrependCnt;
static int    WithCnt;
static int    AuxLocalDynArrayCount;
static FILE   *FP99;
static FILE   *PJ1;
static FILE   *PJ2;
static FILE   *ResIn;
static FILE   *ResOut;
static FILE   *UserResIn;
static FILE   *FPUSE;
static FILE   *FPFLAGS;
static char   ComStk[c_MaxComStk][BCXSTRSIZE];
static char   ParamToken[c_MaxParamToken][BCXSTRSIZE];

static UDT_SELECT_CASE_ATTRIBUTES SelectState[c_MaxNestedSelects];

static char   ConstMacro[c_MaxMacros][BCXSTRSIZE];
static char   ByrefVars[c_MaxByref][BCXSTRSIZE];
static int    LoopLocalVar[c_MaxLoopLocal];

static UDT_LOOP_STORAGE LoopType[c_MaxLoopLocal];

static FILE   *FPtr[c_MaxFiles];
static char   FileNames[c_MaxFiles][BCXSTRSIZE];
static int    LineNum[c_MaxFiles];
static int    BaseTypeDefsCnt[c_MaxBaseTypeDefs];
static char   TypeDefName[c_MaxBaseTypeDefs][BCXSTRSIZE];
static char   UserResFile[BCXSTRSIZE];
static char   ResCompiler[BCXSTRSIZE];
static char   Stk[c_MaxStk][BCXSTRSIZE];
static char   Vchr_Stk[c_MaxStk][BCXSTRSIZE];

static UDT_PROTOTYPE_STORAGE ProtoType[c_MaxProtoType];

static char   SrcStk[c_MaxSingleLineIFLines][BCXSTRSIZE];
static char   SplitStk[c_MaxSplitLines][BCXSTRSIZE];
static char   SrcTmp[BCXSTRSIZE];
static char   Entry[c_MaxOnEntry][BCXSTRSIZE];
static char   Xit[c_MaxOnExit][BCXSTRSIZE];
static char   LocalDynArrName[c_MaxLocalDynArr][BCXSTRSIZE];
static char   GlobalDynaStr[c_MaxGlobalDyna][BCXSTRSIZE];
static char   DynaStr[c_MaxDynaStr][BCXSTRSIZE];
static char   StartSub[c_MaxStartSub][BCXSTRSIZE];
static char   ExitSub[c_MaxExitSub][BCXSTRSIZE];
static char   Library[c_MaxLib][BCXSTRSIZE];
static int    GlobalVarHash[c_MaxGlobalVars];

static UDT_VARINFO_STORAGE GlobalVars[c_MaxGlobalVars];

static UDT_VARINFO_STORAGE LocalVars[c_MaxLocalVars];

static UDT_USER_TYPES_STORAGE TypeDefs[c_MaxTypes];

static char   InClassName[BCXSTRSIZE];
static char   ClassNames[c_MaxClassNames][BCXSTRSIZE];
static char   InClassPP[BCXSTRSIZE];
static char   szVirtual[BCXSTRSIZE];
static char   Accelerator[BCXSTRSIZE];
static char   CallType[BCXSTRSIZE];
static int    LabelGenerator=1000;
static char   CaseVar[BCXSTRSIZE];
static char   Cmd[BCXSTRSIZE];
static char   Compiler[BCXSTRSIZE];
static char   CmdLineConst[BCXSTRSIZE];
static char   CmdLineFileOut[BCXSTRSIZE];
static char   DimType[BCXSTRSIZE];
static char   DllDecl[c_MaxDLLDecl][c_SizeOfDllDecl];
static char   Loadlibs[c_MaxLoadlibs][c_SizeOfLoadlibs];
static char   szFile[BCXSTRSIZE];
static char   Filnam[BCXSTRSIZE];
static char   FunctionName[BCXSTRSIZE];
static char   szFileHandle[BCXSTRSIZE];
static char   HFiles[c_MaxHFiles][BCXSTRSIZE];
static char   HFile[BCXSTRSIZE];
static char   InIfDef[BCXSTRSIZE];
static int    UseFileTest=TRUE;
static int    LocalInBlock[c_MaxLocalInBlocks];
static char   Keyword1[BCXSTRSIZE];
static char   Linker[BCXSTRSIZE];
static char   Project[BCXSTRSIZE];
static char   LibraryErrorLog[BCXSTRSIZE];
static char   Project_Main[BCXSTRSIZE];
static char   Project_Path[BCXSTRSIZE];
static char   Scoot[BCXSTRSIZE];
static char   FileIn[BCXSTRSIZE];
static char   FileOut[BCXSTRSIZE];
static char   FileOutCopy[BCXSTRSIZE];
static char   FileErr[BCXSTRSIZE];
static char   g_Injection[BCXSTRSIZE];
static char   Res_File[BCXSTRSIZE];
static char   ResFileOut[BCXSTRSIZE];
static char   gszType[BCXSTRSIZE];
static char   Var[BCXSTRSIZE];
static char   ConstLastDef[BCXSTRSIZE];
static char   UserBcxStrSize[BCXSTRSIZE];
static char   GUIIcon[BCXSTRSIZE];
static char   GUIMetric[BCXSTRSIZE];
static char   cppFile[BCXSTRSIZE];
static char   prcFile[BCXSTRSIZE];
static char   udtFile[BCXSTRSIZE];
static char   datFile[BCXSTRSIZE];
static char   UsrFile[BCXSTRSIZE];
static char   SysFile[BCXSTRSIZE];
static char   ovrFile[BCXSTRSIZE];
static char   hdrFile[BCXSTRSIZE];
static char   setFile[BCXSTRSIZE];
static char   resFile[BCXSTRSIZE];
static char   enuFile[BCXSTRSIZE];
static char   defFile[BCXSTRSIZE];
static int    ComSwitchON=FALSE;

static UDT_COM_NAMES_STORAGE COM_gl_names[c_COM_Max_Gl_Objs+1];

static UDT_COM_NAMES_STORAGE COM_lc_names[c_COM_Max_Lc_Objs+1];

static char   COM_with_temp_str_name[BCXSTRSIZE];
static int    iRIndex[97][2];
static char   Version[BCXSTRSIZE];
static char   Copyright[BCXSTRSIZE];
static char   BcxPctEqual[BCXSTRSIZE];
static char   BcxUpEqual[BCXSTRSIZE];
static char   BcxAndEqual[BCXSTRSIZE];
static char   BcxOrEqual[BCXSTRSIZE];
static char   BcxLLEqual[BCXSTRSIZE];
static char   BcxRREqual[BCXSTRSIZE];
static char   BKSLASH1[BCXSTRSIZE];
static char   BKSLASH2[BCXSTRSIZE];
static char   BKSLASH4[BCXSTRSIZE];
static char   DQUOT[BCXSTRSIZE];
static char   DDQUOT[BCXSTRSIZE];
static char   IncludeFileNames[c_MaxFiles][BCXSTRSIZE];
static int    FilesFound=1;
static int    MSMap[128];
static char   PrependVar[c_PrependVarSize][BCXSTRSIZE];
static char   WithVar[c_WithVarSize][BCXSTRSIZE];
static char   AuxLocalDynArray[1024][BCXSTRSIZE];
static int    Use_Overloaded_Macro=TRUE;
static char   gCurrentFunction[BCXSTRSIZE];
 
// *************************************************
//               Runtime Library Macros
// *************************************************
 
#define FOR_EACH(i, a) {for(UINT i=0; i<sizeof((a))/sizeof((a)[0]); i++){
#define NEXT_EACH }}
#define EXIT_EACH break;
#define CAST(to_type,old_obj) ((to_type)(old_obj))
#define READNUM(a) (double)atof((DATA[(a)-1]))
#define FDRV   2
#define FPATH  4
#define FNAME  8
#define FEXT  16
#define ISTRUE 0!=
#define NOTZERO 0!=
#define NOTNULL(A)(*(A)!=0)
#define ISNULL(A)(*(A)==0)
#define ISFALSE 0==
#define ISZERO 0==
#define BYTE_AT(B)(B)
#define ubound_s(t)(int)(sizeof((t))/sizeof((t[0]))-1)
#define ubound_d(i)(int)(_msize((i))/sizeof(i[0])-3)
#define ubound(x)((int)ubound_s(x)<2?ubound_d(x):ubound_s(x))
#define Clear(arg)memset(&arg,0,sizeof(arg))
#define imod(a,b)((a)%(b))
#define HIDEHWND(Window)ShowWindow(Window,SW_HIDE)
#define GET(A,B,C)fread((B),1,(C),(A))
#define VAL(a)val_func((a))
 
// *************************************************
//        Application Function Prototypes
// *************************************************
 
int      main (int,PCHAR*);
void     Early_Transforms (void);
void     Final_Transforms (void);
int      Im_A_String_Var (char *);
int      Im_Dim_StrVar (char *,int);
int      Im_Single_Dim_StrVar (char *);
int      Im_Multi_Dim_StrVar (char *);
int      Im_UDT_Double (char *);
int      Im_UDT_Single (char *);
int      Im_UDT_String (char *);
int      GetUDT_MemberType (char *);
int      iMatchTwoNQ (char * ,char * ,char * = " ");
char     *iReplace_NQ (char *,char *,char *);
void     ScanFunctionNames (char *);
void     ScanIncludeFiles (char *);
char     *Replace_ANY_Keyword (char * ,char *);
void     StrCatOperTransform (void);
char     *VB2BCX (char *);
void     ScanFuncNamesTypes (char *);
char     *BeautifyCode (char *);
void     Convert_Chr2VChr (void);
int      CountChrArguments (int);
void     ProcessInjection (void);
void     SplitDimAssignment (void);
void     NormalizeStrConcat (void);
void     RBForTransform (void);
void     StripExtraDefWndProcs (void);
int      iMatch (PCTSTR,PCTSTR,int);
int      iMatchNQ (char * ,char *);
int      GetBracketPair (int,int,int);
int      GetAsPos (int,int,int);
void     BuildStr (int,int,char *);
char     *No_Sigil (char *);
void     BuildDelimStr (int,int,char *);
void     BuildCleanStr (int,int,char *);
void     WriteCleanTokens (int,int);
int      HasThisToken (char *);
int      FoundMacro (void);
void     Process_ASC_Function (int);
void     ActivityFlags (void);
void     DisplayStatus (void);
char     *GetVarTypeName (int);
void     LoopErrorMsg (void);
char     *LoopTypeName (int);
void     MakeFreeGlobals (void);
void     ProcessSetCommand (int);
void     EnableProject (void);
int      SubVarType (int);
char     *PrintWriteFormat (int);
void     InputBufferFlags (void);
void     CommonInputCode (char * ,char *);
void     FinishingTouches (void);
void     AssembleParts (void);
int      CheckForMain (char * ,BOOL);
char     *RemoveExtension (char *);
int      CheckGlobal (char * ,int*);
int      CheckLocal (char * ,int*);
int      CheckType (char *);
void     ExportStringConst (void);
void     ExportInternalConst (void);
int      RestrictedWords (char *);
int      DataType (char *);
void     CloseAll (void);
void     RemoveAll (char * ,PCTSTR,int= 0);
void     Warning_ID (int,int= 0);
void     Warning (char * ,int= 0);
ULONG    HashNumber (char *);
void     AddLibrary (char *);
void     RemoveLibrary (char *);
void     AddGlobal (char * ,int,int= 0,char * = "",int= 0,int= 0,int= 0,int= 0,int= 0);
void     AddLocal (char * ,int,int= 0,char * = "",int= 0,int= 0,int= 0,int= 0);
BOOL     IsDecimalNumber (char *);
BOOL     IsRadixLiteral (char * ,int* = NULL);
int      IsQuoted (char *);
void     StripTabs (void);
void     PushFileIO (void);
void     PopFileIO (void);
void     CheckMatchedPairs (void);
void     ClearIfThenStacks (void);
void     AddExpressionToStack (char *);
void     Add2SplitLines (char *);
void     PostProcess (void);
void     Inject (char *);
int      Convert2SimpleFunction (int);
void     PreParse (char *);
void     FuncSubTemplate (int);
void     TokenSubstitutions (int);
void     LShiftStk (int);
void     RShiftStk (int);
void     InsertOptionalParens (int);
void     JoinStrings (int,int);
void     Transforms (void);
UDT_VARINFO_STORAGE*  FindVarInfo (char * ,int*);
int      LookupVarType (char * ,PINT);
int      GetNextVarType (int);
int      GetPrevVarType (int,int);
int      LocateJoiner (int);
int      JoinStrTest (int,int);
void     TransformOperator  (char * ,char *);
void     FixUps (void);
int      IsAllowedContext (char *);
void     RemEmptyTokens (void);
void     FuncSubDecs1 (char * ,int,int,UDT_VARCODE_ATTRIBUTES*);
void     FuncSubDecs2 (char * ,int,UDT_VARCODE_ATTRIBUTES* ,int,int*);
void     FuncSubDecs3 (UDT_VARCODE_ATTRIBUTES* ,int,int);
void     AddTypeDefs (char * ,int);
int      CheckTypeDefs (char *);
void     GetTypeInfo (char * ,int* ,int* ,int*);
void     AddTypedefElement (int,int,char * ,char * ,int= 0);
char     *GetElement (int,int* ,int* ,int);
int      GetElementInfo (int* ,int* ,char *);
void     Process_Option_Base (void);
long     IsValidName (char *);
void     ValidateVarName (char *);
void     PointerFix (void);
void     DimDynaString (char * ,int,int);
void     AddDynamicGlobal (PCHAR);
int      SubFuncTest (void);
int      Ctor_Dtor_Detected (int);
int      DimSubFunc (int);
void     InBlockReSet (void);
void     InBlockSet (void);
void     AddSpace (int);
void     Display_Version_and_Compiler (void);
char     *Compiler_Used (void);
void     KillFiles (void);
void     Abort (char *);
void     BumpDown (char *);
void     BumpUp (void);
PCHAR    FixBrackets (char * ,int);
void     PushSelectState (char *);
void     PopSelectState (char *);
void     Commandline_Defines (FILE*);
void     Emit_UserDirectives (FILE*);
void     User_Global_Enum_Blocks (FILE*);
void     System_Defined_Constants (FILE*);
void     User_Defined_Constants (FILE*);
void     User_Defined_Types_And_Unions (FILE*);
void     User_Data_Statements (FILE*);
void     User_Global_Variables (FILE*);
int      GetNumArgs (int,int* = NULL);
void     GetVarCode (UDT_VARCODE_ATTRIBUTES* ,PCHAR);
void     User_Global_Initialized_Arrays (FILE*);
void     User_Overloaded_SubsFunctions (FILE*);
void     User_Global_Set_Statements (FILE*);
void     User_Prototypes (FILE*);
void     AddMacros (FILE*);
int      JoinLines (char *);
void     Sanitize_Code (char *);
void     ProcSingleLineIf (int*);
int      SplitLines (char *);
int      SpecialCaseHandler (char *);
void     FastLexer (PCTSTR,PCTSTR,PCTSTR,int= 1);
void     InsertTokens (int,int,...);
void     AppendTokens (int,...);
void     Emit_ExportDef (char *);
char     *GetArg (int,UDT_ARG_COMMAS_STORAGE*);
int      SepFuncArgs (int,UDT_ARG_COMMAS_STORAGE* ,int);
PSTR     MakeDecProto (UDT_ARG_COMMAS_STORAGE* ,int= 2,int= Ndx,int= FALSE);
void     AsmUnknownStructs (int);
void     CheckForASC (void);
void     Make_Stricmp_Map (void);
void     Emit_IfCond (char * ,int);
void     Emit_Global (FILE*,int,int,char * ,char * ,char * ,char *);
void     InitReservedWordsLookup (void);
UDT_SUB_FUNC_TOKENS*  GetWordInfo (char *);
int      FindWord (char * ,UDT_KEYWORD_EMITTER* ,int);
void     FixAnyArrays (char *);
void     Translate (void);
void     FixVector (void);
void     Function_Main_Support (void);
int      Emit_FolderDriveProcs (char * ,PINT);
int      Emit_FunctionReturn (char * ,PINT);
int      Emit_Msgbox (char * ,PINT);
int      Emit_BcxSetFont (char * ,PINT);
int      Emit_BcxSetLabelColor (char * ,PINT);
int      Emit_BcxSetEditColor (char * ,PINT);
int      Emit_Hscroll (char * ,PINT);
int      Emit_Vscroll (char * ,PINT);
int      Emit_InsertMenuProc (char * ,PINT);
int      Emit_MdiGuiProcs (char * ,PINT);
int      Emit_FileIO (char * ,PINT);
int      Emit_FileManagementProcs (char * ,PINT);
int      Emit_LineInputProcs (char * ,PINT);
int      Emit_FinputProcs (char * ,PINT);
int      Emit_GetProcs (char * ,PINT);
int      Emit_PutProcs (char * ,PINT);
int      Emit_FprintProcs (char * ,PINT);
int      Emit_SeekProcs (char * ,PINT);
int      Emit_SetEofProcs (char * ,PINT);
int      Emit_FwriteProcs (char * ,PINT);
int      Emit_StringProcs (char * ,PINT);
int      Emit_MathProcs (char * ,PINT);
int      Emit_ConsoleOnlyProcs (char * ,PINT);
int      ValidExitStatement (void);
int      Emit_ControlFlow (char * ,PINT);
int      Emit_KeyboardProcs (char * ,PINT);
int      Emit_QsortIdxProcs (char * ,PINT);
int      Emit_QsortProcs (char * ,PINT);
int      Emit_template (char * ,PINT);
void     AddProto (char *);
int      Emit_Const (char * ,PINT);
int      Emit_Redim (char * ,PINT);
int      Emit_Extern (char * ,PINT);
int      Emit_Run (char * ,PINT);
int      Emit_Shell (char * ,PINT);
int      Emit_Data (char * ,PINT);
int      Emit_Declare (char * ,PINT);
int      Emit_Auto (char * ,PINT);
int      Emit_Dim (char * ,PINT);
int      Emit_Local (char * ,PINT);
int      Emit_PrivateDim (char * ,PINT);
int      Emit_Raw (char * ,PINT);
int      Emit_Register (char * ,PINT);
int      Emit_Static (char * ,PINT);
int      Emit_Clear (char * ,PINT);
int      Emit_Swap (char * ,PINT);
int      Emit_PrinterProcs (char * ,PINT);
int      Emit_Free (char * ,PINT);
int      Emit_Dynamic (char * ,PINT);
void     DimVar (int);
int      Emit_CPP_EndClass (char * ,PINT);
int      Emit_CPP_Namespace (char * ,PINT);
int      Emit_CPP_Class (char * ,PINT);
void     Emit_CPP_AccessSpecifier (char *);
int      Emit_CPP_Public (char * ,PINT);
int      Emit_CPP_Asm (char * ,PINT);
int      Emit_CPP_Protected (char * ,PINT);
int      Emit_CPP_Private (char * ,PINT);
int      Emit_CPP_EndNamespace (char * ,PINT);
int      Emit_CPP_Try (char * ,PINT);
int      Emit_CPP_EndTry (char * ,PINT);
int      Emit_CPP_Throw (char * ,PINT);
int      Emit_CPP_Catch (char * ,PINT);
int      Emit_CPP_Delete (char * ,PINT);
int      Emit_DialogBox (char * ,PINT);
char     *Emit_Conditional_Operator_Repair (char *);
int      Emit_ConditionalCompilation (char * ,PINT);
int      Emit_Shared_Global (char * ,PINT);
int      Emit_EndFuncSub (char * ,PINT);
int      Emit_Union (char * ,PINT);
int      Emit_Type (char * ,PINT);
int      Emit_PPType (char * ,PINT);
void     GetParameterASHelper (int,int,int,int);
void     GetParameter (PINT,UDT_VARCODE_ATTRIBUTES* ,int,int,int);
int      Emit_OptFuncSub (char * ,PINT);
int      Emit_OverLoadFuncSub (char * ,PINT);
int      ClassProto (PCHAR);
int      Emit_ConDes (char * ,PINT);
int      Emit_Implied (char * ,PINT);
int      Emit_FuncSub (char * ,PINT);
void     Emit_BCXVariables (void);
void     AddBCX_hInstance (void);
void     AddClassName (void);
void     Emit_PrinterVariables (void);
void     AddFontVariables (void);
void     AddBcxFontVar (void);
void     AddPenSizeVariables (void);
void     AddGrafixVariables (void);
void     AddGUIGlobals (void);
void     ProcessMsgCracker (void);
void     ProcessCmdHandler (void);
void     ProcessMsgHandler (void);
void     ProcessMsgHandlerEnd (void);
int      Doinclude (char * ,PINT);
void     Generate_Goto (int,int);
int      Doaccelerator (char * ,PINT);
int      Doasm (char * ,PINT);
int      Dobcx_resource (char * ,PINT);
int      Dobcxversion (char * ,PINT);
int      Doccode (char * ,PINT);
int      Docom_op (char * ,PINT);
int      Docomment (char * ,PINT);
int      Dofillstring (char * ,PINT);
int      DoWarningsOn (char * ,PINT);
int      DoWarningsOff (char * ,PINT);
int      DoZap (char * ,PINT);
int      Docompiler (char * ,PINT);
int      DoBcxStrSize (char * ,PINT);
int      Docpp (char * ,PINT);
int      Docpphdr (char * ,PINT);
int      Docproto (char * ,PINT);
int      Dodefine (char * ,PINT);
int      Dodll (char * ,PINT);
int      Dofiletest (char * ,PINT);
int      Dofsstatic (char * ,PINT);
int      Dogenfree (char * ,PINT);
int      Doheader (char * ,PINT);
int      Dointerface (char * ,PINT);
int      Doiprint (char * ,PINT);
int      DoCase_offon (char * ,PINT);
int      Doleanandmean (char * ,PINT);
int      Doliberror (char * ,PINT);
int      Dolibrary (char * ,PINT);
int      Dolinker (char * ,PINT);
int      Domultithread (char * ,PINT);
int      DoNoBorland (char * ,PINT);
int      DoNoGccClang (char * ,PINT);
int      DoNoLccwin (char * ,PINT);
int      DoNoLibs (char * ,PINT);
int      DoNoMsvc (char * ,PINT);
int      DoNoPelles (char * ,PINT);
int      DoNoVkkeys (char * ,PINT);
int      Donoini (char * ,PINT);
int      Donoio (char * ,PINT);
int      Doremovelib (char * ,PINT);
int      Donomain (char * ,PINT);
int      Donowin (char * ,PINT);
int      Doonentry (char * ,PINT);
int      Doonexit (char * ,PINT);
int      Dooptimizer (char * ,PINT);
int      Dopack (char * ,PINT);
int      Dopp (char * ,PINT);
int      Doprj (char * ,PINT);
int      Doproject (char * ,PINT);
int      Dorems (char * ,PINT);
int      Doresource (char * ,PINT);
int      Dosource (char * ,PINT);
int      Dostdcall (char * ,PINT);
int      Dotest (char * ,PINT);
int      Dotrace (char * ,PINT);
int      Dotypedef (char * ,PINT);
int      IMAX (int,int);
int      IMIN (int,int);
void     StdProtos (FILE*);
void     Add_Com_Global_Var (char *);
void     Add_Com_Local_Var (char *);
int      IsVariableComObject (char *);
void     Free_Com_Objects (BOOL);
BOOL     Find_COM_statement (char *);
void     COM_Parse_GetProperty (char * ,char *);
void     COM_Parse_SetProperty (char * ,char * ,int);
int      GetParameterTokens (char *);
int      Com_Make_Param_List (char * ,int);
int      ComParamType (char * ,int*);
void     ConvertCast (char * ,char * ,char *);
void     COM_Parse_Method (char * ,char *);
void     ParseCom (char *);
void     Add2ComStk (char *);
char     *Make_COM_Trace_Lines (char *);
void     Emit_Prolog (FILE*);
void     Emit_Main_Function (void);
void     Emit_Epilog (void);
void     Emit_CompilerDefines (void);
void     Emit_System_Vars (FILE*);
void     Emit_Assignments (int*);
void     Emit_RuntimeFunctions (FILE*);
void     Emit_RT_Dynacall (FILE*);
void     Emit_RT_StringCore (FILE*);
void     Emit_RT_StringUtils (FILE*);
void     Emit_RT_FileDialogs (FILE*);
void     Emit_RT_FormatPath1 (FILE*);
void     Emit_RT_FormatPath2 (FILE*);
void     Emit_RT_FileAttrClip1 (FILE*);
void     Emit_RT_FileAttrClip2 (FILE*);
void     Emit_RT_SortDynamic (FILE*);
void     Emit_RT_SplitConsole (FILE*);
void     Emit_RT_Controls1 (FILE*);
void     Emit_RT_Controls2 (FILE*);
void     Emit_RT_Graphics1 (FILE*);
void     Emit_RT_Graphics2 (FILE*);
void     Emit_RT_SystemCOM1 (FILE*);
void     Emit_RT_SystemCOM2 (FILE*);
void     Emit_COM_SupportTypes (FILE*);
void     Emit_COM_StandardSet (FILE*);
void     Emit_COM_GetObject (FILE*);
void     Emit_COM_DispatchObject (FILE*);
void     Emit_COM_GetProperty (FILE*);
void     Emit_COM_SetProperty (FILE*);
void     Emit_COM_InvokeMethod (FILE*);
void     Emit_COM_SafeArray (FILE*);
void     Emit_COM_UsesConversion (FILE*);
void     Emit_COM_TraceCalls (FILE*);
void     Emit_BCX_SafeArray (FILE*);
void     Emit_COM_CreateObject (FILE*);
void     Emit_VBScript_Support (void);
void     Emit_Optimize (char * ,char * ,PCTSTR= "");
void     Emit_InputCode (void);
void     Emit_FileInputCode (void);
void     Emit_OSVersionEnum (void);
void     Emit_MDI_MsgPump (void);
void     Emit_GUI_MsgPump (void);
void     Emit_WinGUIMain (char * ,char * ,char *);
void     Emit_MDICode (FILE*);
void     Emit_ProjectSupport (void);
void     Emit_Libs (void);
void     Emit_ResourceFile (void);
void     SetUsed (void);
void     SetFlags (void);
 
// *************************************************
//         Application GLOBAL SET Statements
// *************************************************
 
static PCHAR VarTypeLookup[]=
  {
 "int","int","char *","double","float","FILE *","long double"
};

static UDT_COM_VARIANT_NAMES VariantList[]=
  {
 {"bVal",vt_BYTE,0},
 {"bool",vt__VARIANT_BOOL,0},
 {"boolVal",vt_VARIANT_BOOL,0},
 {"bstrVal",vt_BSTR,0},
 {"byref",vt_PVOID,0},
 {"cVal",vt_CHAR,0},
 {"cyVal",vt_CY,0},
 {"date",vt_DATE,0},
 {"dblVal",vt_DOUBLE,0},
 {"fltVal",vt_SINGLE,0},
 {"iVal",vt_SHORT,0},
 {"intVal",vt_INTEGER,0},
 {"lVal",vt_LONG,0},
 {"llVal",vt_LLONG,0},
 {"parray",vt_SAFEARRAY,1},
 {"pbVal",vt_BYTE,1},
 {"pbool",vt__VARIANT_BOOL,1},
 {"pboolVal",vt_VARIANT_BOOL,1},
 {"pbstrVal",vt_BSTR,1},
 {"pcVal",vt_CHAR,1},
 {"pcyVal",vt_CY,1},
 {"pdate",vt_DATE,1},
 {"pdblVal",vt_DOUBLE,1},
 {"pdecVal",vt_DECIMAL,1},
 {"pdispVal",vt_IDispatch,1},
 {"pfltVal",vt_SINGLE,1},
 {"piVal",vt_SHORT,1},
 {"pintVal",vt_INTEGER,1},
 {"plVal",vt_LONG,1},
 {"pllVal",vt_LLONG,1},
 {"pparray",vt_SAFEARRAY,2},
 {"ppdispVal",vt_IDispatch,2},
 {"ppunkVal",vt_IUnknown,2},
 {"pscode",vt_SCODE,1},
 {"puiVal",vt_USHORT,1},
 {"pulVal",vt_ULONG,1},
 {"pullVal",vt_ULONGLONG,1},
 {"punkVal",vt_IUnknown,1},
 {"pvarVal",vt_VARIANT,1},
 {"scode",vt_SCODE,0},
 {"uiVal",vt_USHORT,0},
 {"uintVal",vt_UINT,0},
 {"ulVal",vt_ULONG,0},
 {"ullVal",vt_ULONGLONG,0},
 {NULL,0,0}
};

static UDT_VARIANT_CAST_DEF ptVCasts[]=
  {
 {"VT_BOOL",comvt_BOOL},
 {"VT_BSTR",comvt_BSTR},
 {"VT_CY",comvt_CY},
 {"VT_DATE",comvt_DATE},
 {"VT_DECIMAL",comvt_DECIMAL},
 {"VT_DISPATCH",comvt_DISPATCH},
 {"VT_ERROR",comvt_ERROR},
 {"VT_I1",comvt_I1},
 {"VT_I2",comvt_I2},
 {"VT_I4",comvt_I4},
 {"VT_I8",comvt_I8},
 {"VT_INT",comvt_INT},
 {"VT_R4",comvt_R4},
 {"VT_R8",comvt_R8},
 {"VT_UI1",comvt_UI1},
 {"VT_UI2",comvt_UI2},
 {"VT_UI4",comvt_UI4},
 {"VT_UI8",comvt_UI8},
 {"VT_UINT",comvt_UINT},
 {"VT_UNKNOWN",comvt_UNKNOWN},
 {NULL,0}
};

static UDT_CASTS ptCCasts[]=
  {
 {"BYTE","bVal"},
 {"CHAR","cVal"},
 {"DOUBLE","dblVal"},
 {"FLOAT","fltVal"},
 {"IDispatch","pdispVal"},
 {"INT","intVal"},
 {"IUnknown","punkVal"},
 {"LONG","lVal"},
 {"LONGLONG","llVal"},
 {"PVOID","byref"},
 {"SHORT","iVal"},
 {"UINT","uintVal"},
 {"ULONG","ulVal"},
 {"ULONGLONG","ullVal"},
 {"USHORT","uiVal"},
 {NULL,NULL}
};

static char   ConstTypes[][BCXSTRSIZE]=
  {
 "byte",
 "char",
 "double",
 "dword",
 "float",
 "int",
 "integer",
 "llong",
 "long",
 "longlong",
 "sbyte",
 "short",
 "single",
 "ubyte",
 "uchar",
 "uint",
 "uint64",
 "ulong",
 "ulonglong",
 "ushort"
};

static UDT_KEYWORD_EMITTER tBcxWords[]=
  {
 {"_ftelli64",vt_LLONG,NULL},
 {"abs",vt_DOUBLE,NULL},
 {"acos",vt_DOUBLE,NULL},
 {"acosh",vt_DOUBLE,NULL},
 {"acosl",vt_LDOUBLE,NULL},
 {"asin",vt_DOUBLE,NULL},
 {"asinh",vt_DOUBLE,NULL},
 {"asinl",vt_LDOUBLE,NULL},
 {"atan",vt_DOUBLE,NULL},
 {"atan2",vt_DOUBLE,NULL},
 {"atanh",vt_DOUBLE,NULL},
 {"atanl",vt_LDOUBLE,NULL},
 {"band",vt_DECFUNC,NULL},
 {"bin2dec",vt_INTEGER,NULL},
 {"bor",vt_DECFUNC,NULL},
 {"cos",vt_DOUBLE,NULL},
 {"cosh",vt_DOUBLE,NULL},
 {"cosl",vt_LDOUBLE,NULL},
 {"csrlin",vt_DECFUNC,NULL},
 {"cursorx",vt_DECFUNC,NULL},
 {"cursory",vt_DECFUNC,NULL},
 {"cvd",vt_DOUBLE,NULL},
 {"cvld",vt_LDOUBLE,NULL},
 {"cvs",vt_SINGLE,NULL},
 {"degtorad",vt_DOUBLE,NULL},
 {"dsplit",vt_DECFUNC,NULL},
 {"exist",vt_DECFUNC,NULL},
 {"exp",vt_DOUBLE,NULL},
 {"expl",vt_LDOUBLE,NULL},
 {"fabs",vt_DOUBLE,NULL},
 {"fabsf",vt_SINGLE,NULL},
 {"fabsl",vt_LDOUBLE,NULL},
 {"findfirstinstance",vt_DECFUNC,NULL},
 {"fint",vt_INTEGER,NULL},
 {"fix",vt_DECFUNC,NULL},
 {"frac",vt_DOUBLE,NULL},
 {"fracl",vt_LDOUBLE,NULL},
 {"freefile",vt_FILEPTR,NULL},
 {"getattr",vt_DECFUNC,NULL},
 {"hex2dec",vt_INTEGER,NULL},
 {"hypot",vt_DOUBLE,NULL},
 {"hypotl",vt_LDOUBLE,NULL},
 {"iif",vt_DOUBLE,NULL},
 {"iinstr",vt_DECFUNC,NULL},
 {"inchr",vt_DECFUNC,NULL},
 {"instr",vt_DECFUNC,NULL},
 {"instrany",vt_DECFUNC,NULL},
 {"instrrev",vt_DECFUNC,NULL},
 {"isfile",vt_INTEGER,NULL},
 {"isfolder",vt_INTEGER,NULL},
 {"ishidden",vt_INTEGER,NULL},
 {"isreadonly",vt_INTEGER,NULL},
 {"issystem",vt_INTEGER,NULL},
 {"kbhit",vt_DECFUNC,NULL},
 {"keypress()",vt_DECFUNC,NULL},
 {"labs",vt_LONG,NULL},
 {"llabs",vt_LLONG,NULL},
 {"lof",vt_DOUBLE,NULL},
 {"log",vt_DOUBLE,NULL},
 {"log10",vt_DOUBLE,NULL},
 {"log10l",vt_LDOUBLE,NULL},
 {"logl",vt_LDOUBLE,NULL},
 {"max",vt_DOUBLE,NULL},
 {"min",vt_DOUBLE,NULL},
 {"msgbox",vt_DECFUNC,NULL},
 {"pi",vt_DOUBLE,NULL},
 {"pos",vt_DECFUNC,NULL},
 {"pow",vt_DOUBLE,NULL},
 {"powl",vt_LDOUBLE,NULL},
 {"qbcolor",vt_DECFUNC,NULL},
 {"radtodeg",vt_DOUBLE,NULL},
 {"rnd",vt_SINGLE,NULL},
 {"rnd2",vt_DOUBLE,NULL},
 {"round",vt_DOUBLE,NULL},
 {"screen",vt_DECFUNC,NULL},
 {"sgn",vt_DECFUNC,NULL},
 {"sin",vt_DOUBLE,NULL},
 {"sinh",vt_DOUBLE,NULL},
 {"sinl",vt_LDOUBLE,NULL},
 {"sizeof",vt_DECFUNC,NULL},
 {"split",vt_DECFUNC,NULL},
 {"sqrt",vt_DOUBLE,NULL},
 {"sqrtl",vt_LDOUBLE,NULL},
 {"strlen",vt_DECFUNC,NULL},
 {"tally",vt_DECFUNC,NULL},
 {"tan",vt_DOUBLE,NULL},
 {"tanh",vt_DOUBLE,NULL},
 {"tanl",vt_LDOUBLE,NULL},
 {"textmode",vt_DOUBLE,NULL},
 {"timer",vt_SINGLE,NULL},
 {"tix_now",vt_DOUBLE,NULL},
 {"val",vt_DOUBLE,NULL},
 {"vall",vt_LDOUBLE,NULL}
};

static UDT_KEYWORD_EMITTER tTypes[]=
  {
 {"bitmapinfo",vt_BITMAPINFO,NULL},
 {"bool",vt_BOOL,NULL},
 {"boolean",vt_BOOL,NULL},
 {"bstr",vt_BSTR,NULL},
 {"byte",vt_BYTE,NULL},
 {"char",vt_CHAR,NULL},
 {"colorref",vt_COLORREF,NULL},
 {"double",vt_DOUBLE,NULL},
 {"dword",vt_DWORD,NULL},
 {"farproc",vt_FARPROC,NULL},
 {"file",vt_FILEPTR,NULL},
 {"float",vt_SINGLE,NULL},
 {"handle",vt_HANDLE,NULL},
 {"hbitmap",vt_HBITMAP,NULL},
 {"hdc",vt_HDC,NULL},
 {"hfont",vt_HFONT,NULL},
 {"hwnd",vt_HWND,NULL},
 {"int",vt_INTEGER,NULL},
 {"ldouble",vt_LDOUBLE,NULL},
 {"llong",vt_LLONG,NULL},
 {"long",vt_LONG,NULL},
 {"longlong",vt_LLONG,NULL},
 {"lpbyte",vt_PBYTE,NULL},
 {"lpstr",vt_PSTR,NULL},
 {"lresult",vt_LRESULT,NULL},
 {"pchar",vt_PCHAR,NULL},
 {"schar",vt_SCHAR,NULL},
 {"short",vt_SHORT,NULL},
 {"sshort",vt_SSHORT,NULL},
 {"string",vt_STRVAR,NULL},
 {"uint",vt_UINT,NULL},
 {"uint64",vt_ULONGLONG,NULL},
 {"ulong",vt_ULONG,NULL},
 {"ulonglong",vt_ULONGLONG,NULL},
 {"ushort",vt_USHORT,NULL},
 {"variant",vt_VARIANT,NULL},
 {"void",vt_VOID,NULL},
 {"winbool",vt_WINBOOL,NULL},
 {"wndclassex",vt_WNDCLASSEX,NULL}
};

static UDT_KEYWORD_EMITTER atEmitWords[]=
  {
 {"_chdir",0,Emit_FolderDriveProcs},
 {"_mkdir",0,Emit_FolderDriveProcs},
 {"_rmdir",0,Emit_FolderDriveProcs},
 {"asm",0,Emit_CPP_Asm},
 {"auto",0,Emit_Auto},
 {"bcx_set_edit_color",0,Emit_BcxSetEditColor},
 {"bcx_set_font",0,Emit_BcxSetFont},
 {"bcx_set_label_color",0,Emit_BcxSetLabelColor},
 {"beginblock",0,Emit_ControlFlow},
 {"call",0,Emit_ControlFlow},
 {"case",0,Emit_ControlFlow},
 {"caseelse",0,Emit_ControlFlow},
 {"catch",0,Emit_CPP_Catch},
 {"chdir",0,Emit_FolderDriveProcs},
 {"class",0,Emit_CPP_Class},
 {"clear",0,Emit_Clear},
 {"close",0,Emit_FileIO},
 {"cls",0,Emit_ConsoleOnlyProcs},
 {"color",0,Emit_ConsoleOnlyProcs},
 {"const",0,Emit_Const},
 {"constructor",0,Emit_ConDes},
 {"continue",0,Emit_ControlFlow},
 {"copyfile",0,Emit_FileManagementProcs},
 {"data",0,Emit_Data},
 {"declare",0,Emit_Declare},
 {"decr",0,Emit_MathProcs},
 {"delay",0,Emit_ConsoleOnlyProcs},
 {"delete",0,Emit_CPP_Delete},
 {"destructor",0,Emit_ConDes},
 {"dialogbox",0,Emit_DialogBox},
 {"dim",0,Emit_Dim},
 {"do",0,Emit_ControlFlow},
 {"dynamic",0,Emit_Dynamic},
 {"ejectpage",0,Emit_PrinterProcs},
 {"else",0,Emit_ControlFlow},
 {"elseif",0,Emit_ControlFlow},
 {"end",0,Emit_ControlFlow},
 {"endblock",0,Emit_ControlFlow},
 {"endclass",0,Emit_CPP_EndClass},
 {"endconstructor",0,Emit_ConDes},
 {"enddestructor",0,Emit_ConDes},
 {"endfunction",0,Emit_EndFuncSub},
 {"endif",0,Emit_ControlFlow},
 {"endnamespace",0,Emit_CPP_EndNamespace},
 {"endpptype",0,Emit_PPType},
 {"endprepend",0,Emit_ControlFlow},
 {"endprogram",0,Emit_ControlFlow},
 {"endrepeat",0,Emit_ControlFlow},
 {"endselect",0,Emit_ControlFlow},
 {"endsub",0,Emit_EndFuncSub},
 {"endtemplate",0,Emit_template},
 {"endtry",0,Emit_CPP_EndTry},
 {"endtype",0,Emit_Type},
 {"endunion",0,Emit_Union},
 {"endwhile",0,Emit_ControlFlow},
 {"endwith",0,Emit_ControlFlow},
 {"exit",0,Emit_ControlFlow},
 {"extern",0,Emit_Extern},
 {"fallthrough",0,Emit_ControlFlow},
 {"finput",0,Emit_FinputProcs},
 {"flush",0,Emit_FileIO},
 {"for",0,Emit_ControlFlow},
 {"fprint",0,Emit_FprintProcs},
 {"free",0,Emit_Free},
 {"function",0,Emit_FuncSub},
 {"functionreturn",0,Emit_FunctionReturn},
 {"fwrite",0,Emit_FwriteProcs},
 {"global",0,Emit_Shared_Global},
 {"gosub",0,Emit_ControlFlow},
 {"goto",0,Emit_ControlFlow},
 {"gui",0,Emit_MdiGuiProcs},
 {"if",0,Emit_ControlFlow},
 {"impfunction",0,Emit_Implied},
 {"incr",0,Emit_MathProcs},
 {"input",0,Emit_KeyboardProcs},
 {"insertmenu",0,Emit_InsertMenuProc},
 {"kill",0,Emit_FileManagementProcs},
 {"lineinput",0,Emit_LineInputProcs},
 {"local",0,Emit_Local},
 {"locate",0,Emit_ConsoleOnlyProcs},
 {"loop",0,Emit_ControlFlow},
 {"lprint",0,Emit_PrinterProcs},
 {"mdigui",0,Emit_MdiGuiProcs},
 {"midstr",0,Emit_StringProcs},
 {"mkdir",0,Emit_FolderDriveProcs},
 {"msgbox",0,Emit_Msgbox},
 {"namespace",0,Emit_CPP_Namespace},
 {"next",0,Emit_ControlFlow},
 {"open",0,Emit_FileIO},
 {"optfunction",0,Emit_OptFuncSub},
 {"optsub",0,Emit_OptFuncSub},
 {"overloadedfunction",0,Emit_OverLoadFuncSub},
 {"overloadedsub",0,Emit_OverLoadFuncSub},
 {"panel",0,Emit_ConsoleOnlyProcs},
 {"pptype",0,Emit_PPType},
 {"prepend",0,Emit_ControlFlow},
 {"print",0,Emit_ConsoleOnlyProcs},
 {"printerclose",0,Emit_PrinterProcs},
 {"printeropen",0,Emit_PrinterProcs},
 {"private",0,Emit_CPP_Private},
 {"privatedim",0,Emit_PrivateDim},
 {"privatefunction",0,Emit_FuncSub},
 {"privatesub",0,Emit_FuncSub},
 {"protected",0,Emit_CPP_Protected},
 {"public",0,Emit_CPP_Public},
 {"publicfunction",0,Emit_FuncSub},
 {"publicsub",0,Emit_FuncSub},
 {"qsort",0,Emit_QsortProcs},
 {"qsortidx",0,Emit_QsortIdxProcs},
 {"raw",0,Emit_Raw},
 {"record",0,Emit_FileIO},
 {"redim",0,Emit_Redim},
 {"register",0,Emit_Register},
 {"rename",0,Emit_FileManagementProcs},
 {"repeat",0,Emit_ControlFlow},
 {"return",0,Emit_ControlFlow},
 {"rmdir",0,Emit_FolderDriveProcs},
 {"run",0,Emit_Run},
 {"seek",0,Emit_SeekProcs},
 {"select",0,Emit_ControlFlow},
 {"seteof",0,Emit_SetEofProcs},
 {"shared",0,Emit_Shared_Global},
 {"shell",0,Emit_Shell},
 {"sprint",0,Emit_PrinterProcs},
 {"static",0,Emit_Static},
 {"sub",0,Emit_FuncSub},
 {"swap",0,Emit_Swap},
 {"template",0,Emit_template},
 {"textmode",0,Emit_ConsoleOnlyProcs},
 {"throw",0,Emit_CPP_Throw},
 {"try",0,Emit_CPP_Try},
 {"type",0,Emit_Type},
 {"union",0,Emit_Union},
 {"wend",0,Emit_ControlFlow},
 {"while",0,Emit_ControlFlow},
 {"with",0,Emit_ControlFlow},
 {"write",0,Emit_ConsoleOnlyProcs},
 {"xfor",0,Emit_ControlFlow},
 {"xnext",0,Emit_ControlFlow},
 {"~else",0,Emit_ConditionalCompilation},
 {"~elseif",0,Emit_ConditionalCompilation},
 {"~endif",0,Emit_ConditionalCompilation},
 {"~get",0,Emit_GetProcs},
 {"~hscroll",0,Emit_Hscroll},
 {"~if",0,Emit_ConditionalCompilation},
 {"~ifdef",0,Emit_ConditionalCompilation},
 {"~ifndef",0,Emit_ConditionalCompilation},
 {"~pragmaoptimizeoff",0,Emit_ConditionalCompilation},
 {"~pragmaoptimizeon",0,Emit_ConditionalCompilation},
 {"~put",0,Emit_PutProcs},
 {"~vscroll",0,Emit_Vscroll}
};

static UDT_KEYWORD_EMITTER tDirectives[]=
  {
 {"#include",0,Doinclude},
 {"$accelerator",0,Doaccelerator},
 {"$asm",0,Doasm},
 {"$bcx_resource",0,Dobcx_resource},
 {"$bcxstrsize",0,DoBcxStrSize},
 {"$bcxversion",0,Dobcxversion},
 {"$case_off",0,DoCase_offon},
 {"$case_on",0,DoCase_offon},
 {"$ccode",0,Doccode},
 {"$com_off",0,Docom_op},
 {"$com_on",0,Docom_op},
 {"$com_trace",0,Docom_op},
 {"$comment",0,Docomment},
 {"$compiler",0,Docompiler},
 {"$cpp",0,Docpp},
 {"$cpphdr",0,Docpphdr},
 {"$cproto",0,Docproto},
 {"$define",0,Dodefine},
 {"$dll",0,Dodll},
 {"$filetest",0,Dofiletest},
 {"$fill",0,Dofillstring},
 {"$fsstatic",0,Dofsstatic},
 {"$genfree",0,Dogenfree},
 {"$header",0,Doheader},
 {"$include",0,Doinclude},
 {"$interface",0,Dointerface},
 {"$iprint_off",0,Doiprint},
 {"$iprint_on",0,Doiprint},
 {"$leanandmean",0,Doleanandmean},
 {"$liberror",0,Doliberror},
 {"$library",0,Dolibrary},
 {"$linker",0,Dolinker},
 {"$mt",0,Domultithread},
 {"$multi",0,Domultithread},
 {"$no_borland",0,DoNoBorland},
 {"$no_gcc_clang",0,DoNoGccClang},
 {"$no_lccwin",0,DoNoLccwin},
 {"$no_libs",0,DoNoLibs},
 {"$no_msvc",0,DoNoMsvc},
 {"$no_pelles",0,DoNoPelles},
 {"$no_vkkeys",0,DoNoVkkeys},
 {"$nodllmain",0,Dodll},
 {"$noini",0,Donoini},
 {"$noio",0,Donoio},
 {"$nolibrary",0,Doremovelib},
 {"$nomain",0,Donomain},
 {"$nowin",0,Donowin},
 {"$onentry",0,Doonentry},
 {"$onexit",0,Doonexit},
 {"$optimizer",0,Dooptimizer},
 {"$pack",0,Dopack},
 {"$pp",0,Dopp},
 {"$prj",0,Doprj},
 {"$prjuse",0,Doprj},
 {"$project",0,Doproject},
 {"$rems",0,Dorems},
 {"$resource",0,Doresource},
 {"$source",0,Dosource},
 {"$stdcall",0,Dostdcall},
 {"$test",0,Dotest},
 {"$trace",0,Dotrace},
 {"$typedef",0,Dotypedef},
 {"$warnings",0,DoWarningsOn},
 {"$warnings_off",0,DoWarningsOff},
 {"$warnings_on",0,DoWarningsOn},
 {"$zap",0,DoZap}
};

static char VarConst[2][8]=
  {
 "",
 "const "
};

static char VarStorage[6][18]=
  {
 "static ",
 "extern ",
 "",
 "static volatile ",
 "extern volatile ",
 "volatile "
};

static UDT_SUB_FUNC_TOKENS BCXWords[]=
  {
 {1,"#include","#include",8,comvt_BAD},
 {1,"$accelerator","",8,comvt_BAD},
 {1,"$asm","",8,comvt_BAD},
 {1,"$bcx_resource","",8,comvt_BAD},
 {1,"$bcxstrsize","",8,comvt_BAD},
 {1,"$bcxversion","",8,comvt_BAD},
 {1,"$case_off","",8,comvt_BAD},
 {1,"$case_on","",8,comvt_BAD},
 {1,"$ccode","",8,comvt_BAD},
 {1,"$com_off","",8,comvt_BAD},
 {1,"$com_on","",8,comvt_BAD},
 {1,"$com_trace","",8,comvt_BAD},
 {1,"$comment","",8,comvt_BAD},
 {1,"$compiler","",8,comvt_BAD},
 {1,"$cpp","",8,comvt_BAD},
 {1,"$cpphdr","",8,comvt_BAD},
 {1,"$cproto","",8,comvt_BAD},
 {1,"$debug","",8,comvt_BAD},
 {1,"$define","",8,comvt_BAD},
 {1,"$dll","",8,comvt_BAD},
 {1,"$else","~else",2,comvt_BAD},
 {1,"$elseif","~elseif",2,comvt_BAD},
 {1,"$endif","",0,comvt_BAD},
 {1,"$filetest","",8,comvt_BAD},
 {1,"$fill","",8,comvt_BAD},
 {1,"$fsstatic","",8,comvt_BAD},
 {1,"$genfree","",8,comvt_BAD},
 {1,"$header","",8,comvt_BAD},
 {1,"$hscroll","~hscroll",2,comvt_BAD},
 {1,"$if","",0,comvt_BAD},
 {1,"$ifdef","",0,comvt_BAD},
 {1,"$ifndef","",0,comvt_BAD},
 {1,"$include","",8,comvt_BAD},
 {1,"$interface","",8,comvt_BAD},
 {1,"$iprint_off","",8,comvt_BAD},
 {1,"$iprint_on","",8,comvt_BAD},
 {1,"$lcc$","$LCC$",2,comvt_BAD},
 {1,"$leanandmean","",8,comvt_BAD},
 {1,"$liberror","",8,comvt_BAD},
 {1,"$library","",8,comvt_BAD},
 {1,"$linker","",8,comvt_BAD},
 {1,"$mt","",8,comvt_BAD},
 {1,"$multi","",8,comvt_BAD},
 {1,"$no_borland","",8,comvt_BAD},
 {1,"$no_gcc_clang","",8,comvt_BAD},
 {1,"$no_lccwin","",8,comvt_BAD},
 {1,"$no_libs","",8,comvt_BAD},
 {1,"$no_msvc","",8,comvt_BAD},
 {1,"$no_pelles","",8,comvt_BAD},
 {1,"$no_vkkeys","",8,comvt_BAD},
 {1,"$nodllmain","",8,comvt_BAD},
 {1,"$noini","",8,comvt_BAD},
 {1,"$noio","",8,comvt_BAD},
 {1,"$nolibrary","",8,comvt_BAD},
 {1,"$nomain","",8,comvt_BAD},
 {1,"$nowin","",8,comvt_BAD},
 {1,"$onentry","",8,comvt_BAD},
 {1,"$onexit","",8,comvt_BAD},
 {1,"$optimizer","",8,comvt_BAD},
 {1,"$pack","",8,comvt_BAD},
 {1,"$pp","",8,comvt_BAD},
 {1,"$prj","",8,comvt_BAD},
 {1,"$prjuse","",8,comvt_BAD},
 {1,"$project","",8,comvt_BAD},
 {1,"$rems","",8,comvt_BAD},
 {1,"$resource","",8,comvt_BAD},
 {1,"$source","",8,comvt_BAD},
 {1,"$stdcall","",8,comvt_BAD},
 {1,"$test","",8,comvt_BAD},
 {1,"$trace","",8,comvt_BAD},
 {1,"$typedef","",8,comvt_BAD},
 {1,"$vscroll","~vscroll",2,comvt_BAD},
 {1,"$warnings","",8,comvt_BAD},
 {1,"$warnings_off","",8,comvt_BAD},
 {1,"$warnings_on","",8,comvt_BAD},
 {1,"$zap","",8,comvt_BAD},
 {1,"_asm","_asm",2,comvt_BAD},
 {1,"_bool","_Bool",2,comvt_BAD},
 {1,"abs","fabs",2,comvt_R8},
 {1,"acos","acos",2,comvt_R8},
 {1,"acosh","acosh",2,comvt_R8},
 {1,"acosl","acosl",2,comvt_BAD},
 {1,"addressof","",0,comvt_BAD},
 {1,"alias","alias",2,comvt_BAD},
 {1,"and","",0,comvt_BAD},
 {1,"andalso","",0,comvt_BAD},
 {1,"ansitowide","",0,comvt_BAD},
 {1,"appactivate","",0,comvt_BAD},
 {1,"append","",0,comvt_BAD},
 {1,"appexename$","",0,comvt_BAD},
 {1,"appexepath$","",0,comvt_BAD},
 {1,"argc","argc",2,comvt_BAD},
 {1,"argv","argv",2,comvt_BAD},
 {1,"argv$","argv$",2,comvt_BAD},
 {1,"arraygetelement","",0,comvt_BAD},
 {1,"arrayputelement","",0,comvt_BAD},
 {1,"as","",0,comvt_BAD},
 {3,"asc","",0,comvt_BAD},
 {1,"ascending","",0,comvt_BAD},
 {1,"asciiz","string",2,comvt_BAD},
 {1,"asin","asin",2,comvt_R8},
 {1,"asinh","asinh",2,comvt_R8},
 {1,"asinl","asinl",2,comvt_BAD},
 {1,"asm","",1,comvt_BAD},
 {1,"atan","atan",2,comvt_R8},
 {1,"atan2","atan2",2,comvt_R8},
 {1,"atanh","atanh",2,comvt_R8},
 {1,"atanl","atanl",2,comvt_R8},
 {1,"atn","atan",2,comvt_R8},
 {1,"atn2","atan2",2,comvt_R8},
 {1,"atnl","atanl",2,comvt_R8},
 {1,"auto","auto",2,comvt_BAD},
 {3,"band","",0,comvt_BAD},
 {1,"base","base",2,comvt_BAD},
 {1,"bcopy","",0,comvt_BAD},
 {1,"bcx_addtab","BCX_AddTab",2,comvt_BAD},
 {1,"bcx_arc","",0,comvt_BAD},
 {1,"bcx_bitmap","",0,comvt_BAD},
 {1,"bcx_blackrect","",0,comvt_BAD},
 {1,"bcx_bmpbutton","",0,comvt_BAD},
 {1,"bcx_bmpheight","",0,comvt_BAD},
 {1,"bcx_bmpwidth","",0,comvt_BAD},
 {1,"bcx_buffer_start","",0,comvt_BAD},
 {1,"bcx_buffer_stop","",0,comvt_BAD},
 {1,"bcx_button","",0,comvt_BAD},
 {1,"bcx_checkbox","",0,comvt_BAD},
 {1,"bcx_circle","",0,comvt_BAD},
 {1,"bcx_classname$","BCX_ClassName$",2,comvt_BAD},
 {1,"bcx_clsid$","",0,comvt_BAD},
 {1,"bcx_colordlg","",0,comvt_BAD},
 {1,"bcx_combobox","",0,comvt_BAD},
 {1,"bcx_console","",0,comvt_BAD},
 {1,"bcx_control","",0,comvt_BAD},
 {1,"bcx_cursor","",0,comvt_BAD},
 {1,"bcx_datepick","",0,comvt_BAD},
 {1,"bcx_dialog","",0,comvt_BAD},
 {1,"bcx_dispatchobject","",0,comvt_BAD},
 {1,"bcx_edit","",0,comvt_BAD},
 {1,"bcx_ellipse","",0,comvt_BAD},
 {1,"bcx_floodfill","",0,comvt_BAD},
 {1,"bcx_font","",0,comvt_BAD},
 {1,"bcx_fontdlg","",0,comvt_BAD},
 {1,"bcx_form","",0,comvt_BAD},
 {1,"bcx_framewnd","",0,comvt_BAD},
 {1,"bcx_get","",0,comvt_BAD},
 {1,"bcx_get_com_error_code","",0,comvt_BAD},
 {1,"bcx_get_com_error_desc$","BCX_GET_COM_ERROR_DESC()",2,comvt_BAD},
 {1,"bcx_get_com_status","BCX_GET_COM_STATUS",2,comvt_BAD},
 {1,"bcx_get_com_success","BCX_GET_COM_SUCCESS()",2,comvt_BAD},
 {1,"bcx_get_text$","",0,comvt_BAD},
 {1,"bcx_get_updown","",0,comvt_BAD},
 {1,"bcx_get_window_height","",0,comvt_BAD},
 {1,"bcx_get_window_width","",0,comvt_BAD},
 {1,"bcx_getpixel","",0,comvt_BAD},
 {1,"bcx_gradient","",0,comvt_BAD},
 {1,"bcx_grayrect","",0,comvt_BAD},
 {1,"bcx_group","",0,comvt_BAD},
 {1,"bcx_hinstance","BCX_hInstance",2,comvt_BAD},
 {1,"bcx_icon","",0,comvt_BAD},
 {1,"bcx_initgui","",0,comvt_BAD},
 {1,"bcx_input","",0,comvt_BAD},
 {1,"bcx_label","",0,comvt_BAD},
 {1,"bcx_line","",0,comvt_BAD},
 {1,"bcx_lineto","",0,comvt_BAD},
 {1,"bcx_listbox","",0,comvt_BAD},
 {1,"bcx_listview","",0,comvt_BAD},
 {1,"bcx_loadbmp","",0,comvt_BAD},
 {1,"bcx_loadimage","",0,comvt_BAD},
 {1,"bcx_mdi_msgpump","",0,comvt_BAD},
 {1,"bcx_mdialog","",0,comvt_BAD},
 {1,"bcx_mdichild","BCX_MDICHILD",2,comvt_BAD},
 {1,"bcx_mdiclass","BCX_MDICLASS",2,comvt_BAD},
 {1,"bcx_mdiclient","BCX_MDICLIENT",2,comvt_BAD},
 {1,"bcx_msgpump","",0,comvt_BAD},
 {1,"bcx_ole_height","",0,comvt_BAD},
 {1,"bcx_ole_width","",0,comvt_BAD},
 {1,"bcx_olepicture","",0,comvt_BAD},
 {1,"bcx_pensize","",0,comvt_BAD},
 {1,"bcx_penstyle","",0,comvt_BAD},
 {1,"bcx_pie","",0,comvt_BAD},
 {1,"bcx_polar_line","",0,comvt_BAD},
 {1,"bcx_polar_pset","",0,comvt_BAD},
 {1,"bcx_polybezier","",0,comvt_BAD},
 {1,"bcx_polygon","",0,comvt_BAD},
 {1,"bcx_polyline","",0,comvt_BAD},
 {1,"bcx_popconsolesize","",0,comvt_BAD},
 {1,"bcx_preset","",0,comvt_BAD},
 {1,"bcx_print","",0,comvt_BAD},
 {1,"bcx_printex","",0,comvt_BAD},
 {1,"bcx_progressbar","",0,comvt_BAD},
 {1,"bcx_pset","",0,comvt_BAD},
 {1,"bcx_pushconsolesize","",0,comvt_BAD},
 {1,"bcx_put","",0,comvt_BAD},
 {1,"bcx_radio","",0,comvt_BAD},
 {1,"bcx_rectangle","",0,comvt_BAD},
 {1,"bcx_regwnd","",0,comvt_BAD},
 {1,"bcx_remtab","BCX_RemTab",2,comvt_BAD},
 {1,"bcx_resource","",0,comvt_BAD},
 {1,"bcx_richedit","",0,comvt_BAD},
 {1,"bcx_roundrect","",0,comvt_BAD},
 {1,"bcx_scalex","BCX_ScaleX",2,comvt_BAD},
 {1,"bcx_scaley","BCX_ScaleY",2,comvt_BAD},
 {1,"bcx_set_edit_color","",0,comvt_BAD},
 {1,"bcx_set_font","",0,comvt_BAD},
 {1,"bcx_set_form_color","",0,comvt_BAD},
 {1,"bcx_set_label_color","",0,comvt_BAD},
 {1,"bcx_set_text","",0,comvt_BAD},
 {1,"bcx_setbkgrdbrush","",0,comvt_BAD},
 {1,"bcx_setclassstyle","",0,comvt_BAD},
 {1,"bcx_setcolor","",0,comvt_BAD},
 {1,"bcx_setconsolesize","",0,comvt_BAD},
 {1,"bcx_setcursor","",0,comvt_BAD},
 {1,"bcx_seticon","",0,comvt_BAD},
 {1,"bcx_seticonsm","",0,comvt_BAD},
 {1,"bcx_setmetric","",0,comvt_BAD},
 {1,"bcx_setsplitpos","",0,comvt_BAD},
 {1,"bcx_show_com_errors","BCX_SHOW_COM_ERRORS",2,comvt_BAD},
 {1,"bcx_slider","",0,comvt_BAD},
 {1,"bcx_splitbutton","",0,comvt_BAD},
 {1,"bcx_splitbutton_additem","BCX_SplitButton_AddItem",2,comvt_BAD},
 {1,"bcx_splitbutton_addseparator","BCX_SplitButton_AddSeparator",2,comvt_BAD},
 {1,"bcx_splitbutton_setitems","BCX_SplitButton_SetItems",2,comvt_BAD},
 {1,"bcx_splitter","",0,comvt_BAD},
 {1,"bcx_status","",0,comvt_BAD},
 {1,"bcx_stricmp","",0,comvt_BAD},
 {1,"bcx_tab","",0,comvt_BAD},
 {1,"bcx_tabselect","",0,comvt_BAD},
 {1,"bcx_tempstr","BCX_TempStr",2,comvt_BAD},
 {1,"bcx_thread","",0,comvt_BAD},
 {1,"bcx_threadend","",0,comvt_BAD},
 {1,"bcx_threadkill","",0,comvt_BAD},
 {1,"bcx_threadresume","",0,comvt_BAD},
 {1,"bcx_threadsuspend","",0,comvt_BAD},
 {1,"bcx_threadwait","",0,comvt_BAD},
 {1,"bcx_tile","",0,comvt_BAD},
 {1,"bcx_toolbar","",0,comvt_BAD},
 {1,"bcx_tooltip","",0,comvt_BAD},
 {1,"bcx_treeview","",0,comvt_BAD},
 {1,"bcx_updown","",0,comvt_BAD},
 {1,"bcx_version$","",0,comvt_BAD},
 {1,"bcx_whiterect","",0,comvt_BAD},
 {1,"bcx_wnd","",0,comvt_BAD},
 {1,"bcx_wndclass","",0,comvt_BAD},
 {1,"bcxfont","BcxFont",2,comvt_BAD},
 {1,"bcxlib","BCXLIB",2,comvt_BAD},
 {1,"bcxpath$","",0,comvt_BAD},
 {1,"bcxsplitpath$","",0,comvt_BAD},
 {1,"bcxstrsize","BCXSTRSIZE",0,comvt_BAD},
 {1,"beep","Beep",2,comvt_BAD},
 {1,"begin","",0,comvt_BAD},
 {1,"bel$","",0,comvt_BAD},
 {1,"bff$","",0,comvt_BAD},
 {1,"bin$","",0,comvt_BAD},
 {1,"bin2dec","",0,comvt_I4},
 {1,"binary","",0,comvt_BAD},
 {3,"bnot","",0,comvt_BAD},
 {1,"bool","",0,comvt_BAD},
 {1,"bool$","",0,comvt_BAD},
 {1,"boolean","",0,comvt_BAD},
 {3,"bor","",0,comvt_BAD},
 {1,"bs$","",0,comvt_BAD},
 {1,"byref","",0,comvt_BAD},
 {1,"byte","unsigned char",2,comvt_BAD},
 {1,"byte_at","",0,comvt_BAD},
 {1,"c_declare","",0,comvt_BAD},
 {1,"call","",0,comvt_BAD},
 {1,"callback","",0,comvt_BAD},
 {1,"callwindowproc","",0,comvt_BAD},
 {1,"case","",0,comvt_BAD},
 {1,"catch","catch",3,comvt_BAD},
 {1,"cbctl","LOWORD(wParam)",2,comvt_BAD},
 {1,"cbctlmsg","HIWORD(wParam)",2,comvt_BAD},
 {1,"cbhndl","hWnd",2,comvt_BAD},
 {1,"cbhwnd","hWnd",2,comvt_BAD},
 {1,"cblparam","lParam",2,comvt_BAD},
 {1,"cbmsg","Msg",2,comvt_BAD},
 {1,"cbnmcode","((LPNMHDR)lParam)->code",2,comvt_BAD},
 {1,"cbnmhwnd","((LPNMHDR)lParam)->hwndFrom",2,comvt_BAD},
 {1,"cbnmid","((LPNMHDR)lParam)->idFrom",2,comvt_BAD},
 {1,"cbool","",0,comvt_BAD},
 {1,"cbwparam","wParam",2,comvt_BAD},
 {1,"cdbl","",0,comvt_BAD},
 {1,"ceil","ceil",2,comvt_BAD},
 {1,"center","",0,comvt_BAD},
 {1,"char","char",2,comvt_BAD},
 {1,"chdir","_chdir",2,comvt_BAD},
 {1,"chdrive","_chdir",2,comvt_BAD},
 {1,"chr$","",0,comvt_BAD},
 {1,"chrtoutf8$","",0,comvt_BAD},
 {1,"cint","",0,comvt_BAD},
 {1,"class","class",3,comvt_BAD},
 {1,"cldbl","",0,comvt_BAD},
 {1,"clear","",0,comvt_BAD},
 {1,"clipboard_getbitmap","",0,comvt_BAD},
 {1,"clipboard_gettext","",0,comvt_BAD},
 {1,"clipboard_gettextsize","",0,comvt_BAD},
 {1,"clipboard_reset","",0,comvt_BAD},
 {1,"clipboard_setbitmap","",0,comvt_BAD},
 {1,"clipboard_settext","",0,comvt_BAD},
 {1,"clng","",0,comvt_BAD},
 {1,"close","",0,comvt_BAD},
 {1,"close#","close",2,comvt_BAD},
 {1,"closedialog","",0,comvt_BAD},
 {1,"cls","",0,comvt_BAD},
 {1,"color","",0,comvt_BAD},
 {1,"color_bg","",0,comvt_BAD},
 {1,"color_fg","",0,comvt_BAD},
 {1,"colorref","COLORREF",2,comvt_BAD},
 {1,"com","COM",2,comvt_BAD},
 {1,"comboboxloadfile","",0,comvt_BAD},
 {1,"command$","",0,comvt_BAD},
 {1,"concat","",0,comvt_BAD},
 {1,"const","const",2,comvt_BAD},
 {1,"const_cast","const_cast",3,comvt_BAD},
 {1,"constructor","",1,comvt_BAD},
 {1,"containedin","",0,comvt_BAD},
 {1,"continue","continue",2,comvt_BAD},
 {1,"control","HWND",2,comvt_BAD},
 {1,"conwin","GetConsoleWindow()",2,comvt_BAD},
 {1,"copyfile","copyfile",2,comvt_BAD},
 {1,"cos","cos",2,comvt_R8},
 {1,"cosh","cosh",2,comvt_R8},
 {1,"cosl","cosl",2,comvt_BAD},
 {1,"cpad$","",0,comvt_BAD},
 {1,"cr$","",0,comvt_BAD},
 {1,"createobject","",0,comvt_BAD},
 {1,"createregint","",0,comvt_BAD},
 {1,"createregstring","",0,comvt_BAD},
 {1,"crlf$","",0,comvt_BAD},
 {1,"csng","",0,comvt_BAD},
 {1,"csrlin","",0,comvt_BAD},
 {1,"curdir$","",0,comvt_BAD},
 {1,"currency","CURRENCY",2,comvt_BAD},
 {1,"cursorx","",0,comvt_BAD},
 {1,"cursory","",0,comvt_BAD},
 {1,"cvd","",0,comvt_BAD},
 {1,"cvi","",0,comvt_BAD},
 {1,"cvl","",0,comvt_BAD},
 {1,"cvld","",0,comvt_BAD},
 {1,"cvs","",0,comvt_BAD},
 {1,"data","",0,comvt_BAD},
 {1,"data$","DATA$",2,comvt_BAD},
 {1,"date$","",0,comvt_BAD},
 {1,"ddq$","",0,comvt_BAD},
 {1,"declare","",16,comvt_BAD},
 {1,"decr","decr",2,comvt_BAD},
 {1,"degtorad","",0,comvt_BAD},
 {1,"del$","",0,comvt_BAD},
 {1,"delay","delay",2,comvt_BAD},
 {1,"delete","delete",3,comvt_BAD},
 {1,"deleteregkey","",0,comvt_BAD},
 {1,"descending","",0,comvt_BAD},
 {1,"destroysafearray","DestroySafeArray",0,comvt_BAD},
 {1,"destructor","",1,comvt_BAD},
 {1,"dialog","",0,comvt_BAD},
 {1,"dialogbox","DialogBox",2,comvt_BAD},
 {1,"dim","dim",2,comvt_BAD},
 {1,"diskfree","DiskFree",0,comvt_BAD},
 {1,"disksize","DiskSize",0,comvt_BAD},
 {1,"diskused","DiskUsed",0,comvt_BAD},
 {1,"do","do",2,comvt_BAD},
 {1,"doevents","",0,comvt_BAD},
 {1,"double","double",2,comvt_BAD},
 {1,"download","",0,comvt_BAD},
 {1,"downloadtostr","",0,comvt_BAD},
 {1,"dpi","dpi",2,comvt_BAD},
 {1,"dq$","",0,comvt_BAD},
 {1,"draw","",0,comvt_BAD},
 {1,"drawtransbmp","",0,comvt_BAD},
 {1,"dsplit","",0,comvt_BAD},
 {1,"dwl_dlgproc","DWLP_DLGPROC",2,comvt_BAD},
 {1,"dwl_msgresult","DWLP_MSGRESULT",2,comvt_BAD},
 {1,"dwl_user","DWLP_USER",2,comvt_BAD},
 {1,"dword","ULONG",2,comvt_BAD},
 {1,"dynamic","dynamic",2,comvt_BAD},
 {1,"dynamic_cast","dynamic_cast",3,comvt_BAD},
 {1,"editloadfile","",0,comvt_BAD},
 {1,"ejectpage","ejectpage",2,comvt_BAD},
 {1,"else","else",2,comvt_BAD},
 {1,"elseif","",0,comvt_BAD},
 {1,"enc$","",0,comvt_BAD},
 {1,"end","",0,comvt_BAD},
 {1,"enddraw","",0,comvt_BAD},
 {1,"endif","endif",2,comvt_BAD},
 {1,"endmodal","",0,comvt_BAD},
 {1,"enum","",0,comvt_BAD},
 {1,"environ$","",0,comvt_BAD},
 {1,"eof","",0,comvt_BAD},
 {1,"eof$","",0,comvt_BAD},
 {1,"equalto","",0,comvt_BAD},
 {1,"esc$","",0,comvt_BAD},
 {1,"events","events",0,comvt_BAD},
 {1,"exist","",0,comvt_BAD},
 {1,"exit","exit",2,comvt_BAD},
 {1,"exit_each","EXIT_EACH",2,comvt_BAD},
 {1,"exp","",0,comvt_R8},
 {1,"explicit","explicit",3,comvt_BAD},
 {1,"export","export",2,comvt_BAD},
 {1,"extern","extern",2,comvt_BAD},
 {1,"extract$","",0,comvt_BAD},
 {1,"extractany$","",0,comvt_BAD},
 {1,"fallthrough","fallthrough",2,comvt_BAD},
 {1,"false","",0,comvt_BAD},
 {1,"farproc","FARPROC",2,comvt_BAD},
 {1,"ff$","",0,comvt_BAD},
 {1,"file","FILE",2,comvt_BAD},
 {1,"filecopy","copyfile",2,comvt_BAD},
 {1,"filelocked","",0,comvt_BAD},
 {1,"fillarray","",0,comvt_BAD},
 {1,"findfirst$","",0,comvt_BAD},
 {1,"findfirstinstance","",0,comvt_BAD},
 {1,"findintype","",0,comvt_BAD},
 {1,"findnext$","",0,comvt_BAD},
 {1,"finput","finput",2,comvt_BAD},
 {1,"fint","",0,comvt_INT},
 {1,"fix","",0,comvt_R4},
 {1,"float","float",2,comvt_BAD},
 {1,"floor","floor",2,comvt_BAD},
 {1,"flush","flush",2,comvt_BAD},
 {1,"for","",0,comvt_BAD},
 {1,"for_each","",0,comvt_BAD},
 {1,"format$","",0,comvt_BAD},
 {1,"formload","FormLoad",2,comvt_BAD},
 {1,"fprint","fprint",2,comvt_BAD},
 {1,"frac","",0,comvt_R8},
 {1,"fracl","",0,comvt_BAD},
 {1,"free","free",2,comvt_BAD},
 {1,"freefile","",0,comvt_BAD},
 {1,"freeglobals","FreeGlobals",2,comvt_BAD},
 {1,"freelibrary","FreeLibrary",2,comvt_BAD},
 {1,"friend","",1,comvt_BAD},
 {1,"from","from",2,comvt_BAD},
 {1,"funcname$","__func__$",2,comvt_BAD},
 {1,"function","",0,comvt_BAD},
 {1,"fwrite","fwrite",2,comvt_BAD},
 {1,"gcl_hbrbackground","GCLP_HBRBACKGROUND",2,comvt_BAD},
 {1,"gcl_hcursor","GCLP_HCURSOR",2,comvt_BAD},
 {1,"gcl_hicon","GCLP_HICON",2,comvt_BAD},
 {1,"gcl_hiconsm","GCLP_HICONSM",2,comvt_BAD},
 {1,"gcl_hmodule","GCLP_HMODULE",2,comvt_BAD},
 {1,"gcl_menuname","GCLP_MENUNAME",2,comvt_BAD},
 {1,"gcl_wndproc","GCLP_WNDPROC",2,comvt_BAD},
 {1,"get","~get",2,comvt_BAD},
 {1,"get$","~get",2,comvt_BAD},
 {1,"getaddr$","",0,comvt_BAD},
 {1,"getattr","",0,comvt_BAD},
 {1,"getbmp","",0,comvt_BAD},
 {1,"getbvalue","GetBValue",2,comvt_BAD},
 {1,"getch","_getch",2,comvt_BAD},
 {1,"getdimension","",0,comvt_BAD},
 {1,"getdlgitem","GetDlgItem",2,comvt_BAD},
 {1,"getdrive","",0,comvt_BAD},
 {1,"getfilename$","",0,comvt_BAD},
 {1,"getgvalue","GetGValue",2,comvt_BAD},
 {1,"gethttpfilesize","",0,comvt_BAD},
 {1,"getobject","",0,comvt_BAD},
 {1,"getprocaddress","",0,comvt_BAD},
 {1,"getresource","",0,comvt_BAD},
 {1,"getrvalue","GetRValue",2,comvt_BAD},
 {1,"getsaveasfilename","",0,comvt_BAD},
 {1,"getspecialfolder","",0,comvt_BAD},
 {1,"getspecialfolder$","",0,comvt_BAD},
 {1,"getspecialfolderex$","",0,comvt_BAD},
 {1,"gettextsize","",0,comvt_BAD},
 {1,"getwindowlong","GetWindowLongPtr",2,comvt_BAD},
 {1,"global","global",2,comvt_BAD},
 {1,"gosub","gosub",2,comvt_BAD},
 {1,"goto","goto",2,comvt_BAD},
 {1,"gui","gui",2,comvt_BAD},
 {1,"gwl_hinstance","GWLP_HINSTANCE",2,comvt_BAD},
 {1,"gwl_hwndparent","GWLP_HWNDPARENT",2,comvt_BAD},
 {1,"gwl_id","GWLP_ID",2,comvt_BAD},
 {1,"gwl_userdata","GWLP_USERDATA",2,comvt_BAD},
 {1,"gwl_wndproc","GWLP_WNDPROC",2,comvt_BAD},
 {1,"hex$","",0,comvt_BAD},
 {1,"hex2dec","",0,comvt_I4},
 {1,"hibyte","HIBYTE",2,comvt_BAD},
 {1,"hide","",0,comvt_BAD},
 {1,"hiword","HIWORD",2,comvt_BAD},
 {1,"hypot","hypot",2,comvt_R8},
 {1,"hypotl","hypotl",2,comvt_R8},
 {1,"iabs","abs",2,comvt_BAD},
 {1,"icompare","",0,comvt_BAD},
 {1,"icon","icon",2,comvt_BAD},
 {1,"if","if",16,comvt_BAD},
 {1,"iif","",0,comvt_R8},
 {1,"iif$","",0,comvt_BAD},
 {1,"iinstr","",0,comvt_BAD},
 {1,"iinstrany","",0,comvt_BAD},
 {1,"imod","",0,comvt_BAD},
 {1,"impfunction","impfunction",3,comvt_BAD},
 {1,"in","in",0,comvt_BAD},
 {1,"inchr","",0,comvt_R4},
 {1,"incr","incr",2,comvt_BAD},
 {1,"infobox","",0,comvt_BAD},
 {1,"initsafearray","InitSafeArray",0,comvt_BAD},
 {1,"inkey","",0,comvt_BAD},
 {1,"inkey$","",0,comvt_BAD},
 {1,"inline","",1,comvt_BAD},
 {1,"inp","",0,comvt_BAD},
 {1,"input","",0,comvt_BAD},
 {1,"inputbox$","",0,comvt_BAD},
 {1,"inputbuffer$","InputBuffer$",0,comvt_BAD},
 {1,"ins$","",0,comvt_BAD},
 {1,"instat","_kbhit()",2,comvt_BAD},
 {1,"instr","",0,comvt_R4},
 {1,"instrany","",0,comvt_BAD},
 {1,"instrrev","",0,comvt_R4},
 {1,"int","int",2,comvt_BAD},
 {1,"integer","int",2,comvt_BAD},
 {1,"iremove","",16,comvt_BAD},
 {1,"iremove$","",0,comvt_BAD},
 {1,"iremoveany$","",0,comvt_BAD},
 {1,"ireplace","",16,comvt_BAD},
 {1,"ireplace$","",0,comvt_BAD},
 {1,"ireplaceany$","",0,comvt_BAD},
 {1,"is","is",2,comvt_BAD},
 {1,"isdigit","isdigit",2,comvt_BAD},
 {1,"isobject","ISOBJECT",2,comvt_BAD},
 {1,"isodate","",0,comvt_BAD},
 {1,"isptr","",0,comvt_BAD},
 {1,"ispunct","ispunct",2,comvt_BAD},
 {1,"iswxdigit","iswxdigit",2,comvt_BAD},
 {1,"iterate","continue",2,comvt_BAD},
 {1,"join$","",0,comvt_BAD},
 {1,"keypress","",0,comvt_BAD},
 {1,"kill","kill",2,comvt_BAD},
 {1,"labs","labs",2,comvt_BAD},
 {1,"land","",0,comvt_BAD},
 {3,"lcase$","",0,comvt_BAD},
 {1,"lccpath$","",0,comvt_BAD},
 {1,"ldouble","",0,comvt_BAD},
 {1,"left$","",0,comvt_BAD},
 {1,"leftstr","",0,comvt_BAD},
 {1,"len","(int)strlen",2,comvt_R4},
 {1,"lf$","",0,comvt_BAD},
 {1,"lib","lib",2,comvt_BAD},
 {1,"libmain","dllmain",2,comvt_BAD},
 {1,"like","",0,comvt_BAD},
 {1,"like_instr","",0,comvt_BAD},
 {1,"line","",0,comvt_BAD},
 {1,"listboxloadfile","",0,comvt_BAD},
 {1,"llabs","llabs",2,comvt_BAD},
 {1,"load_dll","LoadLibrary",2,comvt_BAD},
 {1,"loadfile$","",0,comvt_BAD},
 {1,"loadlibrary","LoadLibrary",2,comvt_BAD},
 {1,"lobyte","LOBYTE",2,comvt_BAD},
 {1,"loc","",0,comvt_BAD},
 {1,"local","",0,comvt_BAD},
 {1,"locate","",0,comvt_BAD},
 {1,"lof","",0,comvt_R8},
 {1,"log","log",2,comvt_R8},
 {1,"log10","log10",2,comvt_R8},
 {1,"log10l","log10l",2,comvt_BAD},
 {1,"logl","logl",2,comvt_BAD},
 {1,"long","long",2,comvt_BAD},
 {1,"longest","",0,comvt_BAD},
 {1,"longlong","LONGLONG",2,comvt_BAD},
 {1,"lookahead","",0,comvt_BAD},
 {1,"loop","loop",2,comvt_BAD},
 {1,"lor","",0,comvt_BAD},
 {1,"loword","LOWORD",2,comvt_BAD},
 {1,"lpad$","",0,comvt_BAD},
 {1,"lpbyte","PBYTE",2,comvt_BAD},
 {1,"lprint","",0,comvt_BAD},
 {1,"lpstr","PSTR",2,comvt_BAD},
 {1,"lresult","LRESULT",2,comvt_BAD},
 {1,"ltoa","_ltoa",2,comvt_BAD},
 {1,"ltrim$","",0,comvt_BAD},
 {1,"macro","const",2,comvt_BAD},
 {1,"main","main",2,comvt_BAD},
 {1,"makedword","MAKELONG",2,comvt_BAD},
 {1,"makeintresource","MAKEINTRESOURCE",2,comvt_BAD},
 {1,"makelong","MAKELONG",2,comvt_BAD},
 {1,"makeword","MAKEWORD",2,comvt_BAD},
 {1,"max","",0,comvt_R8},
 {3,"mcase$","",0,comvt_BAD},
 {1,"mdigui","mdigui",2,comvt_BAD},
 {1,"me","",0,comvt_BAD},
 {1,"memicmp","_memicmp",2,comvt_BAD},
 {1,"memsize","_msize",2,comvt_BAD},
 {1,"mid$","",0,comvt_BAD},
 {1,"min","",0,comvt_R8},
 {1,"mkd$","",0,comvt_BAD},
 {1,"mkdir","_mkdir",2,comvt_BAD},
 {1,"mki$","",0,comvt_BAD},
 {1,"mkl$","",0,comvt_BAD},
 {1,"mkld$","",0,comvt_BAD},
 {1,"mks$","",0,comvt_BAD},
 {1,"mod","fmod",2,comvt_BAD},
 {1,"modstyle","",0,comvt_BAD},
 {1,"mouse_cx","",0,comvt_BAD},
 {1,"mouse_cy","",0,comvt_BAD},
 {1,"mouse_sx","",0,comvt_BAD},
 {1,"mouse_sy","",0,comvt_BAD},
 {1,"msgbox","",0,comvt_BAD},
 {1,"namespace","namespace",3,comvt_BAD},
 {1,"nest","nest",2,comvt_BAD},
 {1,"new","",1,comvt_BAD},
 {1,"newbmp","",0,comvt_BAD},
 {1,"next","next",34,comvt_BAD},
 {1,"next_each","",0,comvt_BAD},
 {1,"nextlinelen","",0,comvt_BAD},
 {1,"nosort","WS_CHILD|WS_VISIBLE|WS_VSCROLL",2,comvt_BAD},
 {1,"not","",0,comvt_BAD},
 {1,"notequalto","",0,comvt_BAD},
 {1,"nothing","",0,comvt_BAD},
 {1,"now$","",0,comvt_BAD},
 {1,"nul$","",0,comvt_BAD},
 {1,"null","NULL",2,comvt_BAD},
 {1,"object","",0,comvt_BAD},
 {1,"oct$","",0,comvt_BAD},
 {1,"on","on",0,comvt_BAD},
 {1,"open","",0,comvt_BAD},
 {1,"operator","",0,comvt_BAD},
 {1,"option","option",2,comvt_BAD},
 {1,"optional","optional",2,comvt_BAD},
 {1,"or","",0,comvt_BAD},
 {1,"orelse","",0,comvt_BAD},
 {1,"osversion","",0,comvt_BAD},
 {1,"outp","",0,comvt_BAD},
 {1,"output","",0,comvt_BAD},
 {1,"outpw","",0,comvt_BAD},
 {1,"overloaded","",0,comvt_BAD},
 {1,"panel","",0,comvt_BAD},
 {1,"pause","",0,comvt_BAD},
 {1,"pchar","PCHAR",2,comvt_BAD},
 {1,"peek$","",0,comvt_BAD},
 {1,"pellespath$","",0,comvt_BAD},
 {1,"pi","",0,comvt_BAD},
 {1,"pixels","pixels",2,comvt_BAD},
 {1,"playwav","",0,comvt_BAD},
 {1,"poke","memcpy",2,comvt_BAD},
 {1,"popcolors","",0,comvt_BAD},
 {1,"pos","",0,comvt_R4},
 {1,"pow","pow",2,comvt_R8},
 {1,"powl","powl",2,comvt_BAD},
 {1,"pptype","pptype",2,comvt_BAD},
 {1,"prepend","prepend",2,comvt_BAD},
 {1,"preserve","PRESERVE",2,comvt_BAD},
 {1,"print","",0,comvt_BAD},
 {1,"print#","fprint",2,comvt_BAD},
 {1,"printer","",0,comvt_BAD},
 {1,"private","",1,comvt_BAD},
 {1,"program","program",2,comvt_BAD},
 {1,"property","property",3,comvt_BAD},
 {1,"protected","",1,comvt_BAD},
 {1,"ps_dash","PS_DASH",2,comvt_BAD},
 {1,"ps_dashdot","PS_DASHDOT",2,comvt_BAD},
 {1,"ps_dashdotdot","PS_DASHDOTDOT",2,comvt_BAD},
 {1,"ps_dot","PS_DOT",2,comvt_BAD},
 {1,"ps_solid","PS_SOLID",2,comvt_BAD},
 {1,"pstr","PSTR",2,comvt_BAD},
 {1,"ptr","",0,comvt_BAD},
 {1,"public","",1,comvt_BAD},
 {1,"pushcolors","",0,comvt_BAD},
 {1,"put","~put",2,comvt_BAD},
 {1,"put$","~put",2,comvt_BAD},
 {1,"qbcolor","",0,comvt_BAD},
 {1,"qsort","qsort",2,comvt_BAD},
 {1,"qsortidx","qsortidx",2,comvt_BAD},
 {1,"radtodeg","",0,comvt_BAD},
 {1,"randomize","",0,comvt_BAD},
 {1,"raw","raw",2,comvt_BAD},
 {1,"read","",0,comvt_BAD},
 {1,"read$","",0,comvt_BAD},
 {1,"rec","",0,comvt_BAD},
 {1,"reccount","",0,comvt_BAD},
 {1,"reclen","reclen",2,comvt_BAD},
 {1,"record","record",2,comvt_BAD},
 {1,"redim","redim",2,comvt_BAD},
 {1,"refresh","",0,comvt_BAD},
 {1,"regexist","",0,comvt_BAD},
 {1,"regint","",0,comvt_BAD},
 {1,"register","register",2,comvt_BAD},
 {1,"regstring$","",0,comvt_BAD},
 {1,"reinterpret_cast","reinterpret_cast",3,comvt_BAD},
 {1,"release","",0,comvt_BAD},
 {1,"rem","rem",0,comvt_BAD},
 {1,"remain$","",0,comvt_BAD},
 {1,"remainany$","",0,comvt_BAD},
 {1,"remove","remove",18,comvt_BAD},
 {1,"remove$","",0,comvt_BAD},
 {1,"removeany$","",0,comvt_BAD},
 {1,"rename","rename",2,comvt_BAD},
 {1,"repeat","repeat",0,comvt_BAD},
 {1,"repeat$","",0,comvt_BAD},
 {1,"replace","replace",18,comvt_BAD},
 {1,"replace$","",0,comvt_BAD},
 {1,"replaceany$","",0,comvt_BAD},
 {1,"resume","",0,comvt_BAD},
 {1,"retain$","",0,comvt_BAD},
 {1,"return","return",2,comvt_BAD},
 {1,"reverse$","",0,comvt_BAD},
 {1,"rewind","",0,comvt_BAD},
 {1,"right$","",0,comvt_BAD},
 {1,"rightstr","",0,comvt_BAD},
 {1,"rmdir","_rmdir",2,comvt_BAD},
 {1,"rnd","",0,comvt_R4},
 {1,"rnd2","",0,comvt_R4},
 {1,"round","",0,comvt_R8},
 {1,"rpad$","",0,comvt_BAD},
 {1,"rtrim$","",0,comvt_BAD},
 {1,"run","",0,comvt_BAD},
 {1,"savebmp","",0,comvt_BAD},
 {1,"scanerror","ScanError",2,comvt_BAD},
 {1,"schar","signed char",2,comvt_BAD},
 {1,"screen","",0,comvt_BAD},
 {1,"searchpath$","",0,comvt_BAD},
 {1,"seek","seek",2,comvt_BAD},
 {1,"select","select",2,comvt_BAD},
 {1,"sendmessage","",0,comvt_BAD},
 {1,"set","",0,comvt_BAD},
 {1,"set_bcx_bitmap","",0,comvt_BAD},
 {1,"set_bcx_bitmap2","",0,comvt_BAD},
 {1,"set_bcx_bmpbutton","",0,comvt_BAD},
 {1,"set_bcx_icon","",0,comvt_BAD},
 {1,"setaddr","",0,comvt_BAD},
 {1,"setattr","",0,comvt_BAD},
 {1,"setdialogscale","SetDialogScale",2,comvt_BAD},
 {1,"setdimension","",0,comvt_BAD},
 {1,"seteof","SetEof",2,comvt_BAD},
 {1,"setmode","_setmode",2,comvt_BAD},
 {1,"setwindowlong","SetWindowLongPtr",2,comvt_BAD},
 {1,"setwindowrtftext","",0,comvt_BAD},
 {1,"sgn","",0,comvt_R4},
 {1,"shared","shared",2,comvt_BAD},
 {1,"shell","shell",2,comvt_BAD},
 {1,"shl","",0,comvt_BAD},
 {1,"short","short",2,comvt_BAD},
 {1,"show","",0,comvt_BAD},
 {1,"showmodal","",0,comvt_BAD},
 {1,"shr","",0,comvt_BAD},
 {1,"sin","sin",2,comvt_R8},
 {1,"single","float",2,comvt_BAD},
 {1,"sinh","sinh",2,comvt_R8},
 {1,"sinl","sinl",2,comvt_BAD},
 {1,"size_t","size_t",2,comvt_R4},
 {1,"sizeof","sizeof",2,comvt_R4},
 {1,"sleep","",0,comvt_BAD},
 {1,"sndmsg","",0,comvt_BAD},
 {1,"sound","",0,comvt_BAD},
 {1,"space$","",0,comvt_BAD},
 {1,"spc$","",0,comvt_BAD},
 {1,"split","",0,comvt_BAD},
 {1,"splitbarbg","SplitBarBG",2,comvt_BAD},
 {1,"splitbarfg","SplitBarFG",2,comvt_BAD},
 {1,"sprint","sprint",2,comvt_BAD},
 {1,"sqr","sqrt",2,comvt_R8},
 {1,"sqrl","sqrtl",2,comvt_BAD},
 {1,"sqrt","sqrt",2,comvt_R8},
 {1,"sqrtl","sqrtl",2,comvt_BAD},
 {1,"sshort","signed short",2,comvt_BAD},
 {1,"startdraw","",0,comvt_BAD},
 {1,"static","static",2,comvt_BAD},
 {1,"static_cast","static_cast",3,comvt_BAD},
 {1,"stdcall","",0,comvt_BAD},
 {1,"step","",0,comvt_BAD},
 {1,"str$","",0,comvt_BAD},
 {1,"str2variant","",0,comvt_BAD},
 {1,"strarray","PCHAR*",2,comvt_BAD},
 {1,"strim$","",0,comvt_BAD},
 {1,"string","string",2,comvt_BAD},
 {1,"string$","",0,comvt_BAD},
 {1,"strl$","",0,comvt_BAD},
 {1,"strptr","",0,comvt_BAD},
 {1,"strtoken$","",0,comvt_BAD},
 {1,"struct","struct",0,comvt_BAD},
 {1,"sub","sub",0,comvt_BAD},
 {1,"swap","",0,comvt_BAD},
 {1,"sysdir$","",0,comvt_BAD},
 {1,"sysstr","",0,comvt_BAD},
 {1,"szlabel","",0,comvt_BAD},
 {1,"szlabel$","",0,comvt_BAD},
 {1,"tab$","",0,comvt_BAD},
 {1,"tally","",0,comvt_R4},
 {1,"tan","tan",2,comvt_R8},
 {1,"tanh","tanh",2,comvt_R8},
 {1,"tanl","tanl",2,comvt_BAD},
 {1,"tempdir$","",0,comvt_BAD},
 {1,"tempfilename$","",0,comvt_BAD},
 {1,"template","template",2,comvt_BAD},
 {1,"textmode","",0,comvt_BAD},
 {1,"then","",0,comvt_BAD},
 {1,"this","this",3,comvt_BAD},
 {1,"throw","throw",3,comvt_BAD},
 {1,"time$","",0,comvt_BAD},
 {1,"timer","",0,comvt_R4},
 {1,"to","to",0,comvt_BAD},
 {1,"trim$","",0,comvt_BAD},
 {1,"true","",0,comvt_BAD},
 {1,"try","try",3,comvt_BAD},
 {1,"type","type",2,comvt_BAD},
 {1,"typeid","typeid$",3,comvt_BAD},
 {1,"typename","",1,comvt_BAD},
 {1,"ubound","",0,comvt_BAD},
 {1,"ubound_d","",0,comvt_BAD},
 {1,"ubound_s","",0,comvt_BAD},
 {1,"ubyte","unsigned char",2,comvt_BAD},
 {3,"ucase$","",0,comvt_BAD},
 {1,"uchar","UCHAR",2,comvt_BAD},
 {1,"uint","UINT",2,comvt_BAD},
 {1,"uint64","UINT64",2,comvt_BAD},
 {1,"ulong","ULONG",2,comvt_BAD},
 {1,"ulonglong","ULONGLONG",2,comvt_BAD},
 {1,"uncom","UNCOM",0,comvt_BAD},
 {1,"union","union",2,comvt_BAD},
 {1,"until","",0,comvt_BAD},
 {1,"unwrap$","",0,comvt_BAD},
 {1,"ushort","USHORT",2,comvt_BAD},
 {1,"using","using",3,comvt_BAD},
 {1,"using$","",0,comvt_BAD},
 {1,"utf8tochr","",0,comvt_BAD},
 {1,"val","",0,comvt_R8},
 {1,"vall","",0,comvt_BAD},
 {1,"variant","VARIANT",2,comvt_BAD},
 {1,"variant2str","",0,comvt_BAD},
 {1,"vbs_addcode","",0,comvt_BAD},
 {1,"vbs_error$","",0,comvt_BAD},
 {1,"vbs_eval_num","",0,comvt_BAD},
 {1,"vbs_eval_num#","",0,comvt_BAD},
 {1,"vbs_eval_str$","",0,comvt_BAD},
 {1,"vbs_reset","",0,comvt_BAD},
 {1,"vbs_run_script","",0,comvt_BAD},
 {1,"vbs_start","",0,comvt_BAD},
 {1,"vbs_stop","",0,comvt_BAD},
 {1,"vchr$","",0,comvt_BAD},
 {1,"vector","",0,comvt_BAD},
 {1,"verify","",0,comvt_BAD},
 {1,"virtual","",1,comvt_BAD},
 {1,"vt$","",0,comvt_BAD},
 {1,"wchar","WCHAR",2,comvt_BAD},
 {1,"wend","wend",2,comvt_BAD},
 {1,"while","",0,comvt_BAD},
 {1,"widetoansi$","",0,comvt_BAD},
 {1,"winbool","winbool",2,comvt_BAD},
 {1,"windir$","",0,comvt_BAD},
 {1,"winmain","",0,comvt_BAD},
 {1,"with","",0,comvt_BAD},
 {1,"wndproc","",0,comvt_BAD},
 {1,"word","WORD",2,comvt_BAD},
 {1,"wrap$","",0,comvt_BAD},
 {1,"write","write",2,comvt_BAD},
 {1,"wstring","PWSTR",2,comvt_BAD},
 {3,"xor","",0,comvt_BAD},
 {1,"zzzz","zzzz",0,comvt_BAD}
};
 
// *************************************************
//                 Runtime Functions
// *************************************************
 
char *BCX_TempStr(size_t iBytes)
{
  static int StrCnt;
  static char *StrFunc[2048];
  static CRITICAL_SECTION cs;
  static LONG initialized = 0;
  // Thread-safe one-time initialization
  if (InterlockedCompareExchange(&initialized, 1, 0) == 0) {
      InitializeCriticalSection(&cs);
  }
  // Allocating memory before locking reduces lock duration and blocking.
  char *newStr = (char *)calloc(iBytes + 1, sizeof(char));
  if (!newStr) return NULL;
  EnterCriticalSection(&cs);
      StrCnt = (StrCnt + 1) & 2047;
      if (StrFunc[StrCnt]) {
        free(StrFunc[StrCnt]);
      }
      StrFunc[StrCnt] = newStr;
  LeaveCriticalSection(&cs);
  return StrFunc[StrCnt];
}

char *left (PCTSTR szSrc, int length)
{
  size_t tmplen = strlen(szSrc);
  if (length < 1) return BCX_TempStr(1);
  if (length < (int)tmplen) tmplen = length;
  char *strtmp = BCX_TempStr(tmplen);
  return (char*)memcpy(strtmp, szSrc, tmplen);
}

char *right (PCTSTR szSrc, int length)
{
  size_t tmplen = strlen(szSrc);
  if (length < 1) return BCX_TempStr(1);
  if ((size_t)length >= tmplen) return strcpy(BCX_TempStr(tmplen), szSrc);
  return strcpy(BCX_TempStr(length), szSrc + (tmplen - length));
}

char *cpad (PCTSTR szStr, int i_Max, int c)
{
  char  fill[2]={0}; fill[0] = (char) c;
  char *szTmp = BCX_TempStr(i_Max);
  size_t Half = (i_Max/2) + (strlen(szStr)/2);
  strcpy(szTmp, szStr);
  while((int)strlen(szTmp) < (int)Half)
  {
    strcpy(szTmp, join(2, fill, szTmp));
  }
  while((int)strlen(szTmp)<i_Max)
  {
    strcat(szTmp, fill);
  }
  szTmp[i_Max] = 0;
  return szTmp;
}

char *rpad (PCTSTR szStr, int L, int c)
{
  char *strtmp;
  int s = (int)strlen(szStr);
  if ((L-s) < 1) return (char*)szStr;
  strtmp = BCX_TempStr(strlen(szStr)+L);
  strcpy (strtmp, szStr);
  memset (&strtmp[s], c, (L-s));
  return strtmp;
}

char *lpad (PCTSTR szStr, int L, int c)
{
  char *strtmp;
  int s = L-(int)strlen(szStr);
  if (s < 1) return (char*)szStr;
  strtmp = BCX_TempStr(L);
  memset (strtmp, c, s);
  return strcat(strtmp, szStr);
}

char *mid (PCTSTR szSrc, int start, int length)
{
  char *strtmp;
  int tmplen = (int)strlen(szSrc);
  if (start > tmplen||start < 1) return BCX_TempStr(1);
  if (length < 0 || length > (tmplen-start) + 1)
    length = (tmplen-start) + 1;
  strtmp = BCX_TempStr(length);
  return (char*)memcpy(strtmp, &szSrc[start - 1], length);
}

char *trim (PCTSTR szSrc)
{
  if (0 == szSrc[0]) return (char*)szSrc;
  while(*szSrc == 32 || (*szSrc >= 9 && *szSrc <= 13)) szSrc++;
  size_t i = strlen(szSrc);
  while(i > 0 && (szSrc[i-1] == 32 || (szSrc[i-1] >= 9 && szSrc[i-1] <= 13))) i--;
  char *strtmp = BCX_TempStr(i);
  return (char*)memcpy(strtmp, szSrc, i);
}

char *ltrim (PCTSTR szSrc, char c)
{
  if (0 == szSrc[0]) return (char*) szSrc;
  while(*szSrc==32 || (*szSrc >= 9 && *szSrc <= 13) || *szSrc == c) szSrc++;
  char *strtmp = BCX_TempStr(strlen(szSrc));
  return strcpy(strtmp, szSrc);
}

char *rtrim (PCTSTR szSrc, char c)
{
  if (0 == szSrc[0]) return (char*)szSrc;
  size_t i = strlen(szSrc);
  while(i > 0 && (szSrc[i-1]==32 || (szSrc[i-1]>=9 && szSrc[i-1]<=13) || szSrc[i-1]==c)) i--;
  char *strtmp = BCX_TempStr(i);
  return (char*)memcpy(strtmp, szSrc, i);
}

char *strim (PCTSTR szSrc)
{
  if (0 == szSrc[0]) return (char*) szSrc;
  char *strtmp = BCX_TempStr(strlen(szSrc));
  char *dst = strtmp;
  while (isspace((unsigned char)*szSrc)) szSrc++;
  do
  {
    while (*szSrc && !isspace((unsigned char)*szSrc)) *dst++ = *szSrc++;
    if (*szSrc)
    {
      *dst++ = *szSrc++;
      while (isspace((unsigned char)*szSrc)) szSrc++;
    }
  }
  while (*szSrc);
  if (isspace((unsigned char)*(--dst))) *dst = 0;
  return strtmp;
}

char *command (int nArg)
{
  int ii = 0;
  char *c = NULL, *retstr, *s = GetCommandLine();
  if (nArg < ii) // return entire commandline
  {
    while(*s && *s != 32)
    {
      if (*s == 34) while(*++s && *s != 34);
      s++;
    }
    while(isspace((unsigned char)*s))s++;
    retstr = BCX_TempStr(strlen(s)+1);
    strcpy(retstr, s);
    if (*(retstr + strlen(retstr)-1)==20) *retstr=0;
    return retstr;
  }
  while(ii <= nArg)
  {
    while(isspace((unsigned char)*s)) s++; // skip whitespace
    c = s;
    if (*s == 34) {              // argument starts a quote
      while(*++s && *s != 34)    // skip until next quote
        ;                        // Do NOT remove this semicolon
      if (*s) s++;               // skip quote itself
    }
    else
    {
      while(*s && *s != 32) s++;
    }
    ii++;
  }
  if (*c == 34)
  {
    c++;                       // skip leading quote
    if (*(s-1) == 34) s--;     // skip any trailing quotes
  }
  retstr = BCX_TempStr((int)(s - c) + 1);
  strncpy(retstr, c,(int)(s - c));
  retstr[s-c]=0;
  return retstr;
}

char *extract (PCTSTR strSrc, PCTSTR strPattern)
{
  PCTSTR szMatch;
  char *strtmp = BCX_TempStr(strlen(strSrc));
  if (*strPattern != 0)
  {
    szMatch = strstr(strSrc, strPattern);
    if (szMatch) return (char*)memcpy(strtmp, strSrc, szMatch-strSrc);
  }
  return strcpy(strtmp, strSrc);
}

char *remain (PCTSTR strSrc, PCTSTR strPattern)
{
  PCTSTR p = strstr(strSrc, strPattern);
  if (p)
  {
    p += (strlen(strPattern));
    return (char*)p;
  }
  return (char*)strSrc;
}

char *replace(PCTSTR szMain, PCTSTR szFind, PCTSTR szRepl)
{
   size_t LenPat, LenRep, iTmp, iChange;
   char *strtmp, *cp_p, *cp_q, *cp_r;
 
   if (!szFind || !*szFind)
      return (char*) szMain;
 
   LenRep = strlen(szRepl);
   LenPat = strlen(szFind);
 
   for (iTmp = 0, cp_p = (char*)szMain; (cp_q = strstr(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)
      iTmp += (int)(cp_q - cp_p) + LenRep;
   iTmp += strlen(cp_p);
 
   strtmp = BCX_TempStr(iTmp);
   if (!strtmp)
      return NULL;
 
   for (cp_r = strtmp, cp_p = (char*)szMain; (cp_q = strstr(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)
   {
      iChange = (int)(cp_q - cp_p);
      memcpy(cp_r, cp_p, iChange);
      cp_r += iChange;
      strcpy(cp_r, szRepl);
      cp_r += LenRep;
   }
   strcpy(cp_r, cp_p);
 
   return strtmp;
}

char *iReplace(PCTSTR szMain, PCTSTR szFind, PCTSTR szRepl)
{
   size_t LenPat, LenRep, tmpsz, iChange;
   char *strtmp, *cp_p, *cp_q, *cp_r;
 
   if (!szFind || !*szFind)
      return (char*)szMain;
 
   LenRep = (int)strlen(szRepl);
   LenPat = (int)strlen(szFind);
 
   for (tmpsz = 0, cp_p = (char*)szMain; (cp_q = _stristr_(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)
      tmpsz += (int)(cp_q - cp_p) + LenRep;
   tmpsz += strlen(cp_p);
 
   strtmp = BCX_TempStr(tmpsz);
   if (!strtmp)
      return NULL;
 
   for (cp_r = strtmp, cp_p = (char*)szMain; (cp_q = _stristr_(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)
   {
      iChange = (int)(cp_q - cp_p);
      memcpy(cp_r, cp_p, iChange);
      cp_r += iChange;
      strcpy(cp_r, (char*)szRepl);
      cp_r += LenRep;
   }
   strcpy(cp_r, cp_p);
 
   return strtmp;
}

char *RemoveAny (PCTSTR MainStr, PCTSTR CharsToRemove)
{
   char *BCX_RetStr = NULL;
   char ResultStr[BCXSTRSIZE]={0};
   int i = 0;
   int j = 0;
   int MainLen  = (int)strlen(MainStr);
   int CharsLen = (int)strlen(CharsToRemove);
   int CharToRemoveFlag[255]={0};
   int ResultLen = 0;
   // Set flags for characters to be removed
   for (j = 0; j < CharsLen; j++) {
       CharToRemoveFlag[(unsigned char)CharsToRemove[j]] = 1;
   }
   for (i = 0; i < MainLen; i++) {
       if (CharToRemoveFlag[(unsigned char)MainStr[i]] == 0) {
           ResultStr[ResultLen++] = MainStr[i];
       }
   }
   ResultStr[ResultLen] = 0; // Null-terminate
   BCX_RetStr = BCX_TempStr(ResultLen);
   strcpy(BCX_RetStr, ResultStr);
   return BCX_RetStr;
}

void BCX_Sleep (int Milliseconds)
{
  static UINT Initialized;
  static UINT OriginalPeriod;
  static UINT CallCount;
  // If called with 0, explicitly reset timer resolution and exit
  if(Milliseconds <= 0 || CallCount >=65535){
      if(Initialized){
          timeEndPeriod(OriginalPeriod);
          Initialized = FALSE;
        }
      return;
    }
  // Set timer resolution to 1 ms if not already initialized
  if(!Initialized){
      TIMECAPS  tMinRes;
      timeGetDevCaps(&tMinRes,sizeof(TIMECAPS));
      OriginalPeriod = tMinRes.wPeriodMin;
      timeBeginPeriod(OriginalPeriod); // Typically sets to 1 ms
      Initialized = TRUE;
    }
  Sleep(Milliseconds);
}

char *findfirst (PCTSTR szSrc)
{
  char *strtmp = BCX_TempStr(BCXSTRSIZE);
  if (fffn_FileHandle) FindClose(fffn_FileHandle);
  fffn_FileHandle = FindFirstFile(szSrc, &fffn_FindData);
  if (fffn_FileHandle != INVALID_HANDLE_VALUE)
    strcpy(strtmp, fffn_FindData.cFileName);
  else
    fffn_FileHandle = 0;
  return strtmp;
}

char *LookAhead(FILE *FilePointer, int NumLines) {
    char *EmptyStr = "";
    char *BCX_RetStr = NULL;
    fpos_t CurrentPosition;
    char FetchLine[BCXSTRSIZE] = {0};
    int Counter;
 
    // Validate inputs
    if (FilePointer == NULL || NumLines <= 0 || ferror(FilePointer)) {
        BCX_RetStr = BCX_TempStr(1);
        if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);
        return BCX_RetStr;
    }
 
    // Save current file position
    if (fgetpos(FilePointer, &CurrentPosition) != 0) {
        BCX_RetStr = BCX_TempStr(1);
        if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);
        return BCX_RetStr;
    }
 
    // Read lines
    for (Counter = 1; Counter <= NumLines; Counter++) {
        FetchLine[0] = '\0';
        if (fgets(FetchLine, BCXSTRSIZE, FilePointer) == NULL) {
            fsetpos(FilePointer, &CurrentPosition); // Restore position
            BCX_RetStr = BCX_TempStr(1);
            if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);
            return BCX_RetStr;
        }
    }
 
    // Remove newline characters
    FetchLine[strcspn(FetchLine, "\r\n")] = '\0';
 
    // Restore file position
    fsetpos(FilePointer, &CurrentPosition);
 
    // Allocate and copy the result
    BCX_RetStr = BCX_TempStr(strlen(FetchLine));
    if (BCX_RetStr) {
        strcpy(BCX_RetStr, FetchLine);
    } else {
        BCX_RetStr = BCX_TempStr(1);
        if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);
    }
 
    return BCX_RetStr;
}

char *ucase (PCTSTR szStr)
{
  return CharUpperA(strcpy(BCX_TempStr(strlen(szStr)), szStr));
}

char *lcase (PCTSTR szStr)
{
  return CharLowerA(strcpy(BCX_TempStr(strlen(szStr)), szStr));
}

char *mcase (PCTSTR szStr)
{
  char *strtmp = BCX_TempStr(strlen(szStr)+1);
  char *s = strtmp;
  CharLowerA(strcpy(strtmp, szStr));
  while(*s)
  {
    if (islower(*s))
    {
      *s-=32;
      while(isalpha(*++s));
    }
    s++;
  }
  return strtmp;
}

char *RemoveStr (PCTSTR szSrc, PCTSTR RemoveMe)
{
  char *strtmp, *pp, *dd;
  int  tmplen;
  strtmp = dd = BCX_TempStr(strlen(szSrc));
  if ((!RemoveMe) || (!*RemoveMe)) return strcpy(strtmp, szSrc);
  pp = strstr((char*)szSrc, (char*)RemoveMe); tmplen = (int)strlen(RemoveMe);
  while (pp)
  {
    memcpy (dd, szSrc, pp-szSrc);
    dd+= (pp - szSrc);
    szSrc = pp + tmplen;
    pp = strstr((char*)szSrc,(char*)RemoveMe);
  }
  strcpy (dd, (char*)szSrc);
  return strtmp;
}

char *IRemoveStr (PCTSTR szSrc, PCTSTR RemoveMe)
{
  char *strtmp, *pp, *dd;
  int  tmplen;
  strtmp = dd = BCX_TempStr(strlen(szSrc));
  if (!RemoveMe || !*RemoveMe) return strcpy(strtmp, szSrc);
  pp = _stristr_(szSrc, RemoveMe); tmplen = (int)strlen(RemoveMe);
  while(pp)
  {
    memcpy (dd, szSrc, pp-szSrc);
    dd+= (pp - szSrc);
    szSrc =  pp + tmplen;
    pp = _stristr_(szSrc, RemoveMe);
  }
  strcpy (dd, szSrc);
  return strtmp;
}

char *BCX_Format_Double(double d_, int leading_space)
{
  char *s = BCX_TempStr(64);
  if (leading_space)
    snprintf(s, 64, "% .15f", d_);
  else
    snprintf(s, 64, "%.15f", d_);
  char *dot = strchr(s, '.');
  if (dot) {
    char *end = s + strlen(s) - 1;
    while (end > dot && *end == '0') *end-- = 0;
    if (end == dot) *end = 0;
  }
  return s;
}

char *str(double d_, int nospc)
{
  return BCX_Format_Double(d_, !nospc);
}

char *curdir (void)
{
  char *strtmp = BCX_TempStr(BCXSTRSIZE);
  GetCurrentDirectory (BCXSTRSIZE-1, strtmp);
  return strtmp;
}

double val_func(PCTSTR s) {
   if (!s) return 0;
 
   // 1. Skip leading whitespace
   while (*s == 32 || *s == 9 || *s == 10 || *s == 13) s++;
   if (*s == 0) return 0;
 
   // 2. Handle BASIC &H, &O, &B
   if (*s == '&') {
       s++;
       int type = toupper((unsigned char)*s);
       if (type) s++;
       char *endptr;
       if (type == 'H') return (double)strtoll(s, &endptr, 16);
       if (type == 'O') return (double)strtoll(s, &endptr, 8);
       if (type == 'B') return (double)strtoll(s, &endptr, 2);
       return 0; 
   }
 
   // 3. Handle C-style 0x Hex
   if (*s == '0' && (toupper((unsigned char)*(s + 1)) == 'X')) {
       char *endptr;
       return (double)strtoll(s, &endptr, 16);
   }
 
   // 4. Handle standard numbers (with internal whitespace stripping)
   char buffer[256];
   int j = 0;
   int has_decimal = 0, has_exponent = 0;
 
   while (*s && j < 254) {
       if (*s == 32 || *s == 9) { s++; continue; }
 
       char c = *s;
       if (isdigit((unsigned char)c) || c == '-' || c == '+') {
           buffer[j++] = c;
       } else if (c == '.' && !has_decimal && !has_exponent) {
           buffer[j++] = c;
           has_decimal = 1;
       } else if (toupper((unsigned char)c) == 'E' && !has_exponent) {
           buffer[j++] = 'E';
           has_exponent = 1;
           if (*(s + 1) == '-' || *(s + 1) == '+') buffer[j++] = *(++s);
       } else {
           break; 
       }
       s++;
   }
   buffer[j] = 0;
   return (j > 0) ? atof(buffer) : 0;
}

char *tempdir (void)
{
   char *strtmp = BCX_TempStr(BCXSTRSIZE);
   GetTempPath (BCXSTRSIZE-1, strtmp);
   return strtmp;
}

char *repeat(int count, PCTSTR szArg)
{
   if (!szArg || count <= 0)
   {
      char *strtmp = BCX_TempStr(1);
      if (strtmp) *strtmp = 0;
      return strtmp;
   }
   size_t len = strlen(szArg);
   char *strtmp = BCX_TempStr((count * len) + 1);
   char *p = strtmp;
 
   while (count-- > 0) {
       memcpy(p, szArg, len);
       p += len;
   }
   *p = 0;
 
   return strtmp;
}

char *stringx (int count_, int szArg)
{
   if (count_<1) return BCX_TempStr(1);
   char *strtmp = BCX_TempStr(count_);
   return (char*)memset(strtmp, szArg, count_);
}

char *space (int count)
{
   if (count<1) return BCX_TempStr(1);
   char *strtmp = BCX_TempStr(count);
   return (char*)memset(strtmp, 32, count);
}

char *timef (int t, int u)
{
   time_t elapse_time;
   struct tm *tp;
   char *strtmp = BCX_TempStr(256);
   time (&elapse_time);
   if (u==0)
     tp = localtime(&elapse_time);
   else
     tp = gmtime(&elapse_time);
   switch (t)
   {
   case 0:
     strftime(strtmp, 256, "%H:%M:%S", tp); break;
   case 1:
     strftime(strtmp, 256, "%H", tp); break;
   case 2:
     strftime(strtmp, 256, "%M", tp); break;
   case 3:
     strftime(strtmp, 256, "%S", tp); break;
   case 4:
     strftime(strtmp, 256, "%p", tp); break;
   case 5:
     strftime(strtmp, 256, "%Y", tp); break;
   case 6:
     strftime(strtmp, 256, "%m", tp); break;
   case 7:
     strftime(strtmp, 256, "%d", tp); break;
   case 8:
     strftime(strtmp, 256, "%A", tp); break;
   case 9:
     strftime(strtmp, 256, "%w", tp); break;
   case 10:
     strftime(strtmp, 256, "%j", tp); break;
   case 11:
     strftime(strtmp, 256, "%U", tp); break;
   case 12:
     strftime(strtmp, 256, "%I:%M:%S %p", tp); break;
   }
   return strtmp;
}

char *enc (PCTSTR Arg_A, int L, int R)
{
  size_t tmplen = strlen(Arg_A);
  char *BCX_RetStr = BCX_TempStr(tmplen+3);
  memcpy(BCX_RetStr+1, Arg_A, tmplen);
  *BCX_RetStr = (char)((L==0) ? 34 : L);
  BCX_RetStr[++tmplen] = (char)((R==0) ? *BCX_RetStr : R);
  BCX_RetStr[++tmplen] = 0;
  return BCX_RetStr;
}

char *vchr(int charcount, ...)
{
  int c = 0, ii = charcount;
  char *s_ = BCX_TempStr(charcount + 1);
  va_list marker;
  s_[ii] = 0;
  va_start(marker, charcount);
  while (ii-- > 0) s_[c++] = (char) va_arg(marker, int);
  va_end(marker);
  return s_;
}

char *join(int ArgCount, PCTSTR Str1, ...)
{
  va_list  ap={0};
  PSTR BCX_RetStr = NULL;
  PSTR currentStr = NULL;
  int i;
  size_t totalLen;
  totalLen = strlen(Str1);
                                      //  Calc memory reqmnt
  va_start(ap,Str1);
  for(i=1; i<=ArgCount-1; i++)
    {
      currentStr = va_arg(ap,PSTR);
      if(strlen(currentStr)>0) {
          totalLen += (int)strlen(currentStr);
        }
    }
  va_end(ap);
                                      //  Allocate memory
  BCX_RetStr = BCX_TempStr(totalLen);
  if(BCX_RetStr == 0) {
      return NULL;                    //   Not a good sign :-(
    }
                                      //   Init result with Str1
  strcpy(BCX_RetStr,Str1);
                                      //   Concat remainiing strings
  va_start(ap,Str1);
  for(i=1; i<=ArgCount-1; i++)
    {
      currentStr = va_arg(ap,PSTR);
      if((int)strlen(currentStr)>0) {
          strcat(BCX_RetStr,currentStr);
        }
    }
  va_end(ap);
  return BCX_RetStr;
}

char* Environ(PCTSTR szStr)
{
  char *strtmp;
  DWORD len;
  len = GetEnvironmentVariable(szStr, NULL, 0);   // ask Windows for the real size first
  if (len == 0)
    {
      strtmp = BCX_TempStr(1);
      *strtmp = 0;
      return strtmp;
    }
  strtmp = BCX_TempStr(len);                      // request only what's actually needed
  GetEnvironmentVariable(szStr, strtmp, len);
  return strtmp;
}
char *date (int tz)
{
  time_t elapse_time;
  struct tm *tp;
  char *strtmp = BCX_TempStr(24);
  time(&elapse_time);
  if (tz == 0)
    tp = localtime(&elapse_time);
  else
    tp = gmtime(&elapse_time);
  strftime(strtmp, 24, "%m-%d-%Y", tp);
  return strtmp;
}

char *isodate (int tz)
{
  time_t elapse_time;
  struct tm *tp;
  char *strtmp = BCX_TempStr(24);
  time(&elapse_time);
  if (tz == 0)
    tp = localtime(&elapse_time);
  else
    tp = gmtime(&elapse_time);
  strftime(strtmp, 24, "20%y-%m-%d", tp);
  return strtmp;
}

char *AppExePath (void)
{
  char *strtmp = BCX_TempStr (BCXSTRSIZE);
  int ii;
  ii = GetModuleFileName(GetModuleHandle(0), strtmp, BCXSTRSIZE);
  while(ii && strtmp[ii] != 0x5C)
    ii--;
  strtmp[ii+1] = 0;
  return strtmp;
}

char *TempFileName (PCTSTR szFolder, PCTSTR szPrefix)
{
  char *strtmp = BCX_TempStr (BCXSTRSIZE);
  GetTempFileName(szFolder, szPrefix, 0, strtmp);
  return strtmp;
}

char *Using(PCTSTR szMask, long double Num)
{
  int CntDec = 0;    // Count the number of "0" to left pad the result
  int Decimals = 0;  // Count ALL digits RIGHT of the decimal point
  int Dollar = 0;    // Flag to LEFT prepend "$" symbol
  int Percent = 0;   // Flag to append "%" symbol (does NOT scale value)
  int SN = 0;        // Flag to use Sci Notation 
  int Spaces = 0;    // Flag for using spaces padding
  int Zeros = 0;     // Flag for using zero padding 
  int Commas = 0;    // Flag for thousands separators (mask contains comma)
 
  char *BCX_RetStr = BCX_TempStr(256);
  char Buf_1[256]={0};
  PCTSTR p = szMask;
  int len;
 
  // First pass: analyze the format mask
 
  while (*p)
  {
    if (*p == 36)  Dollar++;      // $
    if (Dollar>1)  Dollar=1;      // Restrict
    if (*p == 37)  Percent++;     // %
    if (Percent>1) Percent=1;     // Restrict
    if (*p == 32)  Spaces++;      // Space
    if (*p == 44)  Commas = 1;    // Comma in mask
 
    // Track zero padding before decimal
    if (*p == 48 && !CntDec)  Zeros++;
 
    // Count decimal places (spaces, # or 0 after decimal point)
    if ((*p == 32 || *p == 35 || *p == 48) && CntDec)  Decimals++;
 
    if (*p == 46)  CntDec = 1;    // Decimal point
 
    if (*p == 94)  SN++;          // ^ is for scientific notation
 
    p++;
  }
 
  // Second pass: Assemble the resulting string
 
  if (SN)                         // Process SN and return
  {
    char Tmp[64]={0};
    
    // Per manual: SN always uses full double precision; mask details ignored.
    sprintf(Tmp, "%.15E", (double)Num);
    
    // Strip trailing zeros from the mantissa (e.g. 1.2300000E+07-> 1.23E+07)
    while (instr(Tmp, "0E"))
      strcpy(Tmp, replace(Tmp, "0E", "E"));
    
    // MSVC may emit 3-digit exponents (E+007), so collapse the leading zero
    // only when followed by a non-zero digit. Preserve normal 2-digit form.
    {
      char *e = strstr(Tmp, "E+00");
      if (e && e[4] >= '1' && e[4] <= '9')
        memmove(e + 3, e + 4, strlen(e + 4) + 1);
      e = strstr(Tmp, "E-00");
      if (e && e[4] >= '1' && e[4] <= '9')
        memmove(e + 3, e + 4, strlen(e + 4) + 1);
    }
    strcpy(BCX_RetStr, Tmp);
    return BCX_RetStr;
  }
 
  // Format the number with specified decimals
  sprintf(Buf_1, "%1.*Lf", Decimals, Num);
 
  // Find integer part length
  char *decimal_pos = strchr(Buf_1, '.');
  int num_int_digits = decimal_pos ? (int)(decimal_pos - Buf_1) : (int)strlen(Buf_1);
 
  // Adjust for negative sign
  int has_negative = (Buf_1[0] == '-');
  if (has_negative)
    num_int_digits--;
 
  // Initialize the return string
  memset(BCX_RetStr, 0, 256);
 
  int zero_pad = 0;
 
  // Calculate zero padding (apply only if needed)
  if (Zeros > 0 && Zeros > num_int_digits)
    zero_pad = Zeros - num_int_digits;
 
  // Position for the start of the number
  int pos = Dollar + Spaces + zero_pad;
 
  // Copy the number to the return string
  if (has_negative)
  {
    if (Zeros > 0)
    {
      // With zero padding, negative goes before zeros
      BCX_RetStr[Dollar + Spaces] = '-';
      strcpy(BCX_RetStr + pos, Buf_1 + 1);
    }
    else
    {
      // Without zero padding, negative stays with number
      strcpy(BCX_RetStr + pos, Buf_1);
    }
  }
  else
  {
    strcpy(BCX_RetStr + pos, Buf_1);
  }
 
  // Add commas for thousands (only if mask requested them)
  if (Commas)
  {
    char temp[256]={0};
    strcpy(temp, BCX_RetStr);
 
    // Find where the number starts after any potential padding
    int number_start = Dollar + Spaces + zero_pad;
 
    // Handle negative sign position for proper comma placement
    if (has_negative && Zeros == 0)
      number_start++; // Skip past the negative sign for comma placement
 
    // Find integer part end
    decimal_pos = strchr(temp, '.');
    int int_end = decimal_pos ? (int)(decimal_pos - temp) : (int)strlen(temp);
 
    // Add commas working backwards, but never insert a comma right after the negative sign
    for (int i = int_end - 3; i > number_start; i -= 3)
    {
      // Ensure we don't place a comma immediately after a negative sign
      if (i > number_start && !(temp[i-1] == '-'))
      {
        memmove(temp + i + 1, temp + i, (int)strlen(temp + i) + 1);
        temp[i] = ',';
      }
    }
 
    strcpy(BCX_RetStr, temp);
  }
 
  // Add dollar sign
  if (Dollar)
  {
    if (Num >= 0)
    {
      BCX_RetStr[Spaces] = '$';
    }
    else
    {
      if (Zeros > 0)
      {
        // With zero padding: move negative, then add dollar
        BCX_RetStr[Spaces] = '-';
        BCX_RetStr[Spaces + 1] = '$';
        
        // Remove duplicate negative sign
        for (int i = pos; i < (int)strlen(BCX_RetStr); i++)
        {
          if (BCX_RetStr[i] == '-')
          {
            memmove(BCX_RetStr + i, BCX_RetStr + i + 1, (int)strlen(BCX_RetStr + i));
            break;
          }
        }
      }
      else
      {
        // Without zero padding: dollar then negative
        BCX_RetStr[Spaces] = '$';
      }
    }
  }
 
  // Fill leading spaces
  if (Spaces)
    memset(BCX_RetStr, ' ', Spaces);
 
  // Fill zeros after spaces but only if needed
  for (int i = 0; i < zero_pad; i++)
    BCX_RetStr[Dollar + Spaces + i] = '0';
 
  // Add percent sign if needed (suffix only, does NOT scale value)
  if (Percent)
  {
    len = (int)strlen(BCX_RetStr);
    BCX_RetStr[len] = '%';
    BCX_RetStr[len + 1] = 0;
  }
  return BCX_RetStr;
}

int bcx_stricmp (PCTSTR szOne, PCTSTR szTwo)
{
  char  c1 [BCXSTRSIZE];
  char  c2 [BCXSTRSIZE];
  strcpy(c1,szOne);
  strcpy(c2,szTwo);
  CharUpperA(c1);
  CharUpperA(c2);
  int counter=0;
  for(;;)
  {
    if(c1[counter]^c2[counter])
    {
      if(c1[counter]>c2[counter])
        return  1;
      return -1;
    }
    if(!c1[counter]) return 0;
    counter++;
  }
}

char *_stristr_(PCTSTR Haystack, PCTSTR Needle)
{
  int mi = (-1);
  while(Needle[++mi])
  {
    if (Haystack[mi]==0) return 0;
    if (UprCase[(unsigned char)Haystack[mi]] != UprCase[(unsigned char)Needle[mi]])
    {
      Haystack++;
      mi = (-1);
    }
  }
  return (char*)Haystack;
}

char *sziif (int cond, PCTSTR szOne, PCTSTR szTwo)
{
  if (cond!=0) return (char*)szOne;
  return (char*)szTwo;
}

char *BcxSplitPath (PCTSTR FPath, int mask)
{
  if (!FPath) return BCX_TempStr(1);
  char *BCX_RetStr = BCX_TempStr(strlen(FPath));
  char tmp[MAX_PATH*4];
  _splitpath(FPath, tmp, &tmp[MAX_PATH], &tmp[MAX_PATH*2], &tmp[MAX_PATH*3]);
  if (mask & FDRV) strcat(BCX_RetStr, tmp);
  if (mask & FPATH)strcat(BCX_RetStr, &tmp[MAX_PATH]);
  if (mask & FNAME)strcat(BCX_RetStr, &tmp[MAX_PATH*2]);
  if (mask & FEXT) strcat(BCX_RetStr, &tmp[MAX_PATH*3]);
  return BCX_RetStr;
}

char *BcxPath (void)
{
  char *BCX_RegPath=BCX_TempStr (BCXSTRSIZE);
  strcpy(BCX_RegPath,RegString
         (HKEY_LOCAL_MACHINE,"Software\\Bcx-32\\Bcx\\Settings","Path"));
  if (BCX_RegPath[0] == 0)
    strcpy(BCX_RegPath,RegString
           (HKEY_CURRENT_USER,"Software\\Bcx-32\\Bcx\\Settings","Path"));
  if (BCX_RegPath[0] == 0)
    return strcpy(BCX_RegPath,"Not Found");
  return BCX_RegPath;
}

char *LccPath (void)
{
  char *BCX_RetStr={0};
  static char LCC_Reg     [BCXSTRSIZE];
  static char LCC_RegPath [BCXSTRSIZE];
  strcpy(LCC_Reg,"Software\\lcc\\lcclnk\\");
  strcpy(LCC_RegPath,(char*)RegString(HKEY_LOCAL_MACHINE, LCC_Reg,"libpath"));
  if (LCC_RegPath[0] == 0)
  {
    strcpy(LCC_RegPath, (char*)RegString(HKEY_CURRENT_USER, LCC_Reg,"libpath"));
  }
  if (strcmp(LCC_RegPath,"")!=0)
  {
    BCX_RetStr = BCX_TempStr(260);
    return strcpy(BCX_RetStr, (char*)left(LCC_RegPath, InstrRev(LCC_RegPath,"\\")));
  }
  else
  {
    BCX_RetStr=BCX_TempStr(strlen(LCC_RegPath));
    return strcpy(BCX_RetStr,LCC_RegPath);
  }
}

char *PellesPath (void)
{
  char *BCX_RetStr={0};
  static char Pelles_Reg     [BCXSTRSIZE];
  static char Pelles_RegPath [BCXSTRSIZE];
  strcpy(Pelles_Reg,"Software\\Pelle Orinius\\PellesC\\Directories\\");
  strcpy(Pelles_RegPath,(char*)RegString(HKEY_LOCAL_MACHINE,Pelles_Reg,"PathDirs"));
  if (Pelles_RegPath[0]==0)
  {
    strcpy(Pelles_RegPath,(char*)RegString(HKEY_CURRENT_USER,Pelles_Reg,"PathDirs"));
  }
  if (strcmp(Pelles_RegPath,"")!=0)
  {
    BCX_RetStr=BCX_TempStr(256);
    return strcpy(BCX_RetStr,(char*)left(Pelles_RegPath,InstrRev(Pelles_RegPath,"\\")));
  }
  else
  {
    BCX_RetStr = BCX_TempStr(strlen(Pelles_RegPath));
    return strcpy(BCX_RetStr, Pelles_RegPath);
  }
}

char *RegString (HKEY hKey, PCTSTR RegPath, PCTSTR SubKey)
{
  char *Result = BCX_TempStr (BCXSTRSIZE);
  int BufferLen = BCXSTRSIZE;
  if (!RegOpenKeyEx(hKey,RegPath,0,KEY_QUERY_VALUE,&hKey))
  {
    RegQueryValueEx(hKey,SubKey,0,0,(PBYTE)Result,(PDWORD)&BufferLen);
  }
  RegCloseKey(hKey);
  return Result;
}

void CreateRegString (HKEY HK, PCTSTR Key, PCTSTR VarName, PCTSTR Value)
{
  HKEY  hKey;
  char  Buff[100]={0};
  ULONG  Result;
  RegCreateKeyEx(HK,Key,0,Buff,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&hKey,&Result);
  RegSetValueEx(hKey,VarName,0,REG_SZ,(PBYTE)Value,(ULONG)strlen(Value)+1);
  RegCloseKey(hKey);
}

char *StrToken (PCTSTR Source, PCTSTR TokenChar, int n)
{
  char *BCX_RetStr = NULL;
  char *RetVal = NULL;
  PCTSTR Copy = NULL;
  int Posn = 0;
  int Find = 0;
  int LenSrc = (int)strlen(Source);
  Copy = Source;
  if (tally(Source,TokenChar)==0)
  {
    BCX_RetStr=BCX_TempStr(1);
    return BCX_RetStr;
  }
  if (n==1)
  {
    BCX_RetStr = BCX_TempStr(LenSrc);
    strcpy(BCX_RetStr,(char*)extract(Source,TokenChar));
    return BCX_RetStr;
  }
  if (n>tally(Source,TokenChar)+1)
  {
    BCX_RetStr=BCX_TempStr(1);
    return BCX_RetStr;
  }
  while(*Copy)
  {
    if (*Copy==TokenChar[0]) Find++;
    if (Find==n) break;
    Copy++;
    Posn++;
  }
  if (n==tally(Source,TokenChar)+1)
  {
    Posn=LenSrc;
    Copy=Source+Posn;
    while(*Copy && Source[Posn]!=TokenChar[0])
    {
      Posn--;
      Copy--;
    }
  }
  RetVal = (char*)calloc(LenSrc+1,sizeof(char));
  strcpy(RetVal,(char*)mid(Source,1,Posn));
  strcpy(RetVal,(char*)mid(RetVal,InstrRev(RetVal,TokenChar)));
  BCX_RetStr=BCX_TempStr(LenSrc);
  strcpy(BCX_RetStr,(char*)RemoveStr(RetVal,(char*)TokenChar));
  if (RetVal)free(RetVal);
  return BCX_RetStr;
}

int EoF(FILE *filstream) {
    int c;
    // Validate file stream
    if (filstream == NULL || ferror(filstream)) {
        return -1; // Indicate error
    }
    // Read a character
    c = fgetc(filstream);
    if (c == EOF) {
        if (ferror(filstream)) {
            return -1; // File error
        }
        return 1; // True EOF
    }
    // Push back the character if it was not EOF
    if (ungetc(c, filstream) == EOF) {
        return -1; // ungetc failed
    }
    return 0; // Not EOF
}

char *NamePathFromFP (FILE *FP)
{
  char *BCX_RetStr={0};
  char *szTmp={0};
  szTmp = (char*)calloc(2048, 1);
  if(GetFinalPathNameByHandle((HANDLE)_get_osfhandle(_fileno(FP)),szTmp,2047,0))
  {
    strcpy(szTmp, szTmp+4);
  }
  BCX_RetStr = BCX_TempStr(strlen(szTmp));
  strcpy(BCX_RetStr,szTmp);
  if (szTmp)
  {
    free(szTmp);
    szTmp = NULL;
  }
  return BCX_RetStr;
}

int Cint (double Arg_A)
{
  return (Arg_A >= 0 ? (int)(Arg_A + 0.5) : (int)(Arg_A - 0.5));
}

int instr(PCTSTR Haystack, PCTSTR Needle, int offset, int sensflag)
{
  if(offset == 0) {return 0;}
  PCTSTR s;
  if (!Haystack||!*Haystack||!Needle||!*Needle||offset>(int)strlen(Haystack)) return 0;
  if (sensflag)
    s = _stristr_(offset > 0 ? Haystack + offset - 1 : Haystack, Needle);
  else
    s = strstr(offset > 0 ? Haystack + offset - 1 : Haystack, Needle);
  return s ? (int)(s-Haystack)+1 : 0;
}

int iinstr(PCTSTR Haystack, PCTSTR Needle, int offset)
{
  if(offset == 0) return 0;
  PCTSTR s;
  if (!Haystack||!*Haystack||!Needle||!*Needle||offset>=(int)strlen(Haystack)) return 0;
    s = _stristr_(offset > 0 ? Haystack + offset-1 : Haystack, Needle);
  return s ? (int)(s-Haystack)+1 : 0;
}

int DeDupeCompare(const void *a, const void *b) {
    return (*(char*)a - *(char*)b);
}
 
char* DeDupeSort(const char* input) {
    int CharFreq[256]={0}; 
    int length = (int)strlen(input);
    char *result = (char*)malloc(length + 1);
    int index = 0;
 
    // Iterate over each character in the input string
    for (int i = 0; i < length; i++) {
        unsigned char ch = input[i];
        if (CharFreq[ch] == 0) { // If character not encountered before
            CharFreq[ch] = 1;
            result[index++] = ch; // Add character to the result
        }
    }
    result[index] = 0;  
    qsort(result, index, sizeof(char), DeDupeCompare);
    return result; 
}

int InstrAny (PCTSTR Main, PCTSTR Words, int Start)
{
  char Buffer[BCXSTRSIZE];
  strcpy (Buffer, DeDupeSort(Words));
  int BufLen = (int)strlen(Buffer);
  for(int i = 1; i <= BufLen; i++)
  {
    int Found = instr(Main, mid(Buffer, i, 1), Start, 0);
    if (Found) return Found;
  }
return 0;
}

int InstrRev (PCTSTR Haystack, PCTSTR Needle, int offset, int sens)
{
  int sl, pl, ox;
  int (*cmp)(PCTSTR, PCTSTR, size_t);
  if (!Haystack || !Needle)  return 0;
  sl = (int)strlen(Haystack); pl  = (int)strlen(Needle);
  if (offset > sl || 0 == sl || 0 == pl || (ox = sl - pl) < 0)
     return 0;
  if (offset <= 0)
     offset = ox ;
  else if (offset >= pl)
     offset = offset - pl ;
  else
     return 0;
  cmp = (sens ? _strnicmp : strncmp);
  do
  {
     if (cmp(Haystack + offset , Needle, pl) == 0)
        return offset+1;
  }
  while (offset--);
  return 0;
}

unsigned char* MakeLCaseTbl (void)
{
  static unsigned char tbl[257];
  int ii; for (ii = 0; ii < 256; ii++)
  tbl[ii] = (unsigned char) ii;
  tbl[0] = 1;
  tbl[256] = 0;
  CharLowerA((char *)tbl);
  tbl[0] = 0;
  return tbl;
}

unsigned char* MakeUCaseTbl (void)
{
  static unsigned char tbl[257];
  int ii; for (ii = 0; ii < 256; ii++)
  tbl[ii] = (unsigned char) ii;
  tbl[0] = 1;
  tbl[256] = 0;
  CharUpperA((char *)tbl);
  tbl[0] = 0;
  return tbl;
}

int inchr (PCTSTR Haystack, PCTSTR Needle)
{
  PCTSTR Idx = Haystack;
  while(*Idx)
  {
    if (*Idx == *Needle) return (int)(Idx-Haystack)+1;
    Idx++;
  }
  return 0;
}

BOOL Exist (PCTSTR szFilePath)
{
    if (!szFilePath || !*szFilePath) return FALSE;

    if (_tcschr(szFilePath, _T('*')) || _tcschr(szFilePath, _T('?')))
        return Exist_A(szFilePath);

    return Exist_B(szFilePath);
}
 
BOOL Exist_A (PCTSTR szFilePath)
{
    WIN32_FIND_DATA W32FindData;
    HANDLE hFind = FindFirstFile(szFilePath, &W32FindData);
    if (hFind == INVALID_HANDLE_VALUE) 
        return FALSE;
 
    FindClose(hFind);
    return TRUE;
}
 
BOOL Exist_B (PCTSTR szFilePath)
{
    WIN32_FILE_ATTRIBUTE_DATA fileInfo;
    if (GetFileAttributesEx(szFilePath, GetFileExInfoStandard, &fileInfo))
    {
        // Returns TRUE if path exists (file or directory)
        return TRUE; 
    }
    return FALSE;
}

int tally (PCTSTR Haystack, PCTSTR Needle, int sensflag)
{
  if (!*Needle) return 0;
  if (!*Haystack) return 0;
  size_t mlen = strlen(Needle);
  int iCount = 0;
  PCTSTR p = (0 == sensflag ? strstr(Haystack, Needle) : _stristr_(Haystack, Needle));
  while (p)
  {
    iCount++;
    p += mlen;
    p = (0 == sensflag ? strstr(p, Needle) : _stristr_(p, Needle));
  }
  return iCount;
}

void locate (int row, int col, int show, int shape)
{
  CONSOLE_CURSOR_INFO cci;
  memset (&cci, 0, sizeof(CONSOLE_CURSOR_INFO));
  cursor.X = (SHORT)col-1;
  cursor.Y = (SHORT)row-1;
  SetConsoleCursorPosition(hConsole, cursor);
  cci.bVisible = show;
  cci.dwSize   = shape;
  SetConsoleCursorInfo(hConsole, &cci);
}

int Pos (void)
{
  HANDLE  hStdOut;
  CONSOLE_SCREEN_BUFFER_INFO csbi;
  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
  hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  GetConsoleScreenBufferInfo(hStdOut, &csbi);
  return csbi.dwCursorPosition.X+1;
}

int Csrlin (void)
{
  HANDLE  hStdOut;
  CONSOLE_SCREEN_BUFFER_INFO csbi;
  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
  hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  GetConsoleScreenBufferInfo(hStdOut, &csbi);
  return csbi.dwCursorPosition.Y+1;
}

void cls(void)
{
    ULONG cCharsWritten;
    COORD coordScreen = { 0, 0 };
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    ULONG dwConSize;
    WORD attr;
 
    // Get current screen buffer info
    GetConsoleScreenBufferInfo(hConsole, &csbi);
 
    // Calculate the console screen size
    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
 
    // Fill the console with spaces
    FillConsoleOutputCharacter(hConsole, (TCHAR)' ', dwConSize, coordScreen, &cCharsWritten);
 
    // Fill the console with the current text and background colors
    attr = (WORD)color_fg + (WORD)color_bg * 16;
    FillConsoleOutputAttribute(hConsole, attr, dwConSize, coordScreen, &cCharsWritten);
 
#ifndef __LCC__
    // Clear the scrollback buffer by resizing the console buffer
    SMALL_RECT rect;
    rect.Left = 0;
    rect.Top = 0;
    rect.Right = csbi.dwSize.X;
    rect.Bottom = csbi.dwSize.Y-1;
    SetConsoleWindowInfo(hConsole, TRUE, &rect);
    SetConsoleScreenBufferSize(hConsole, csbi.dwSize);
#endif
 
    locate(1, 1, 1);
}

void color(int fg, int bg)
{
  if (bg == (-1))
  {
    SetConsoleTextAttribute(hConsole, (WORD)fg + (WORD)color_bg * 16);
  }
  else
  {
    SetConsoleTextAttribute(hConsole, (WORD)fg + (WORD)bg * 16);
  }
  color_fg = fg;
  if (bg!=(-1)) color_bg = bg;
}

void PushColors (void)
{
  CONSOLE_SCREEN_BUFFER_INFO csbi;
  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));
  if(0==GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
  {
    color_pshpop = 7;
  }
  else
  {
    color_pshpop = csbi.wAttributes;
  }
}

void PopColors (void)
{
  if(color_pshpop == 0)
  {
    color (7,0);
    color_fg = 7;
    color_bg = 0;
  }
  else
  {
    SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),(WORD)color_pshpop);
    color_fg = (color_pshpop & 0x0F);
    color_bg = (color_pshpop & 0xF0) / 16;
  }
}

void midstr (char *szSrc, int st, int length, char *rep)
{
  int srclen = (int)strlen(szSrc);
  if (st > srclen++ || st<1) return;
  int replen = (int)strlen(rep);
  if (replen < length || length==(-1)) length = replen;
  if ((st+length) > srclen) length = srclen-st;
  memcpy(&szSrc[st-1], rep, length);
}

int like (PCTSTR Haystack, PCTSTR Needle)
{
  while (*Needle)
  {
    if (*Needle == '#')
    {
      if (! *Haystack) return false;
      if (! isdigit(*Haystack)) return false;
      ++Haystack;
      ++Needle;
    }
    else if (*Needle == '?')
    {
      if (! *Haystack) return false;
      ++Haystack;
      ++Needle;
    }
    else if (*Needle == '*')
    {
      if (like(Haystack, Needle + 1)) return true;
      if (*Haystack && like(Haystack + 1, Needle))
        return true;
      return false;
    }
    else if ((*Haystack++ | 32) != (*Needle++ | 32)) return false; // case-insensitive
  }
  return !*Haystack && !*Needle;
}

unsigned long long int lof (PCTSTR FName)
{
  WIN32_FILE_ATTRIBUTE_DATA fad;
  if (!GetFileAttributesEx(FName, GetFileExInfoStandard, &fad))
    return 0;
  LARGE_INTEGER size;
  size.HighPart = fad.nFileSizeHigh;
  size.LowPart = fad.nFileSizeLow;
  return size.QuadPart;
}

double iif (int cond, double tp, double fp)
{
  if (cond!=0) return tp;
  return fp;
}

int LeftStr (PCTSTR Haystack, PCTSTR Needle, int Insensitive)
{
  if (0 == Insensitive)
  {
    if (strcmp(left(Haystack, (int)strlen(Needle)), Needle)==0)
      return 1;
    else
      return 0;
  }
  if (strcmp(lcase(left(Haystack, (int)strlen(Needle))), lcase(Needle))==0)
    return 1;
  else
    return 0;
}

int RightStr (PCTSTR Haystack, PCTSTR Needle, int Insensitive)
{
  if (0 == Insensitive)
  {
    if (strcmp(right(Haystack, (int)strlen(Needle)), Needle) == 0)
      return 1;
    else
      return 0;
  }
  if (strcmp(lcase(right(Haystack,(int)strlen(Needle))), lcase(Needle))==0)
    return 1;
  else
    return 0;
}

void InfoBox(PCTSTR Title, PCTSTR xValue, int xSize, int ySize)
{
  PSTR Value = _strdup(xValue);
  if((int)strlen(Value)>32500) Value[32500] = 0;
 
  LPDLGITEMTEMPLATE lpdit;
  LPDLGTEMPLATE lpdt;
  HINSTANCE hInst;
  HGLOBAL hgbl;
  PWORD lpw;
  PWSTR lpwsz;
  int nchar;
  int ID_EDIT = 101;
  int ID_OKAY = 102;
  // *************************************
  hgbl=GlobalAlloc(GMEM_ZEROINIT, 0xFFFF);
  lpdt=(LPDLGTEMPLATE)GlobalLock(hgbl);
  // *************************************
  //  Create the InfoBox Window
  // *************************************
  lpdt->style = WS_VISIBLE|DS_NOFAILCREATE|WS_BORDER|DS_CENTER|DS_SETFONT;
  lpdt->cdit = 2;
  lpdt->cx = (SHORT)xSize;
  lpdt->cy = (SHORT)ySize + 10;
  lpw = (PWORD)(lpdt+1);
  *lpw++ = 0;
  *lpw++ = 0;
  lpwsz = (PWSTR)lpw;
  nchar = MultiByteToWideChar(CP_ACP, 0, Title, -1, lpwsz, 2*(int)strlen(Title) + 1);
  lpw +=  nchar;
  *lpw++ = DEFAULT_PITCH;
  lpwsz = (PWSTR)lpw;
  nchar = MultiByteToWideChar(CP_ACP, 0, "Courier", -1, lpwsz, 15);
  lpw +=  nchar;
  // ********************************
  //  Create the OKAY button.
  // ********************************
  lpw   = lpwAlign(lpw);
  lpdit = (LPDLGITEMTEMPLATE)lpw;
  lpdit->x  = (SHORT)(xSize* 0.5)-24;
  lpdit->y  = (SHORT)ySize - 29;
  lpdit->cx = (SHORT)40;
  lpdit->cy = (SHORT)12;
  lpdit->id = (SHORT)ID_OKAY;
  lpdit->style = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP;
  lpw = (PWORD)(lpdit+1);
  *lpw++ = 0xFFFF;
  *lpw++ = 0x0080;
  lpwsz  = (PWSTR)lpw;
  nchar  = MultiByteToWideChar(CP_ACP, 0, "Okay", -1, lpwsz, 9);
  lpw +=  nchar;
  lpw = lpwAlign(lpw);
  *lpw++ = 0;
  // ************************************
  //  Create the Read-Only EDIT control
  // ************************************
  lpw   = (PWORD)lpwAlign(lpw);
  lpdit = (LPDLGITEMTEMPLATE)lpw;
  lpdit->x  =  4;
  lpdit->y  =  8;
  lpdit->cx = (SHORT)xSize-9;
  lpdit->cy = (SHORT)ySize-40;
  lpdit->id = (SHORT)ID_EDIT;
  lpdit->style = WS_VISIBLE|WS_VSCROLL|ES_AUTOHSCROLL|WS_CHILD|
                 ES_READONLY|ES_MULTILINE|ES_WANTRETURN|WS_HSCROLL;
  lpw    = (PWORD)(lpdit+1);
  *lpw++ = 0xFFFF;
  *lpw++ = 0x0081;
  lpwsz  = (PWSTR)lpw;
  nchar  = MultiByteToWideChar(CP_ACP, 0, Value, -1, lpwsz, 2*(int)strlen(Value) + 1);
  lpw   += nchar;
  lpw    = lpwAlign(lpw);
  *lpw++ = 0;
  // ********************************
  GlobalUnlock(hgbl);
  hInst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(0, GWLP_HINSTANCE);
  DialogBoxIndirect (hInst, (LPDLGTEMPLATE)hgbl, GetActiveWindow(), (DLGPROC)CB_InfoBox);
  GlobalFree(hgbl);
}

LRESULT CALLBACK CB_InfoBox(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
  UNREFERENCED_PARAMETER(lParam);
  int ID_OKAY = 102;
  if (Msg == WM_INITDIALOG)
      return TRUE;

  if (Msg == WM_COMMAND && LOWORD(wParam) == ID_OKAY)
      EndDialog(hWnd, 0);

  if (Msg == WM_CLOSE)
      EndDialog(hWnd, 0);
  return 0;
}

PWORD lpwAlign(PWORD lpIn)
{
  return (PWORD)((((uintptr_t)lpIn) + 3) & (~3));
}

// *************************************************
//            User's Subs and Functions
// *************************************************

int main (int argc,PCHAR* argv)
{
  hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
  LowCase = MakeLCaseTbl();
  UprCase = MakeUCaseTbl();
  FuncStrNames=(char*)calloc(c_MaxSrcLen, 1);
  FuncSglNames=(char*)calloc(c_MaxSrcLen, 1);
  FuncDblNames=(char*)calloc(c_MaxSrcLen, 1);
  CurLine=(char*)calloc(c_MaxSrcLen, 1);
  gTmpStr=(char*)calloc(c_MaxSrcLen, 1);
  Src=(char*)calloc(c_MaxSrcLen, 1);
  AbortSrc=(char*)calloc(c_MaxSrcLen, 1);
  IF_Stmt_Tank=(char*)calloc(c_MaxSrcLen, 1);
  WarnMsg=(char*)calloc(32767, 1);
  RmLibs=(char*)calloc(32767, 1);
  strcpy(BcxPctEqual,"{BcxPctEqual}");
  strcpy(BcxUpEqual,"{BcxUpEqual}");
  strcpy(BcxAndEqual,"{BcxAndEqual}");
  strcpy(BcxOrEqual,"{BcxOrEqual}");
  strcpy(BcxLLEqual,"{BcxLLEqual}");
  strcpy(BcxRREqual,"{BcxRREqual}");
  strcpy(Version, join(3,Version,SPC,enc(isodate(),40,41)));
  strcpy(Version,replace(Version,"-","/"));
  strcpy(Copyright, join(3,"BCX BASIC to C/C++ Translator (c) 1999-",right(date(),4)," by Kevin Diggins"));
  InitReservedWordsLookup();
  DebugModeOff=TRUE;
  InMain=TRUE;
  OkayToSend=TRUE;
  OptimizerEnabled=TRUE;
  OptimizerFirstSetting=TRUE;
  TranslateSlash=TRUE;
  Use_SingleFile=TRUE;
  WinHeaders=TRUE;
  strcpy(BKSLASH1,vchr(1,92));
  strcpy(BKSLASH2,vchr(2,92,92));
  strcpy(BKSLASH4,vchr(4,92,92,92,92));
  strcpy(DQUOT,vchr(3,34,34,34));
  strcpy(DDQUOT,vchr(4,34,34,34,34));
  PPFlag=FALSE;
  PPProc=NULL;
  PPDLL_HANDLE=NULL;
  if(Pos()==1&&Csrlin()==1&&ISNULL(command(-1))){
      HIDEHWND(GetConsoleWindow());
      strcpy(Copyright, join(4,Copyright,CRLF,CRLF,cpad(join(2,"Version ",c_VERSION),100)));
      MessageBox (GetActiveWindow(),(join(6,space(10),Copyright,CRLF,CRLF,space(12),ltrim(Compiler_Used()))),"",MB_SYSTEMMODAL );
      fflush(stdout);
      ExitProcess(0);
    }
  if(ISNULL(command(-1))){
      printf("\n");
      printf("%s\n",Copyright);
      Display_Version_and_Compiler();
      printf("\n");
      printf("%s\n"," Usage: BC infile [.bas] [options]");
      printf("%s\n"," [-b]   Build using user-defined bat file .. ex -b:c:\\bat\\pw.bat");
      printf("%s\n"," [-cpp] Generate C++ compatible code with .cpp extension");
      printf("%s\n"," [-d]   DEFINE a constant ... ex. BC MyFile -D:MyConst[=SomeValue]");
      printf("%s\n"," [-e]   Write ERRORS to BCX.ERR file");
      printf("%s\n"," [-f]   Output FILENAME... ex. BC MyFile -f:C:\\MyFiles\\MyFile.c");
      printf("%s\n"," [-i]   Send Warnings and Errors to INFOBOX");
      printf("%s\n"," [-k]   KILL the generated BCX generated 'C' file");
      printf("%s\n"," [-m]   Enable eMbedded BCX code in the C translation");
      printf("%s\n"," [-n]   Enable NO RUNTIME Code Generation");
      printf("%s\n"," [-o]   OUTPUT a copy of the generated C file to STDOUT");
      printf("%s\n"," [-q]   QUIET - No output to screen during translation");
      printf("%s\n"," [-r]   Update BCX Path variable in the Windows REGISTRY");
      printf("%s\n"," [-s]   Show STATUS of translation by line number");
      printf("%s\n"," [-u]   Turn UNICODE Support ON");
      printf("%s\n"," [-v]   Show BCX version and build information");
      printf("%s\n"," [-w]   Enable BCX WARNINGS during translation and all compiler warnings.");
      printf("%s\n"," [-x]   EXCLUDE Win32 Headers from the resulting C file");
      printf("%s\n"," [-z]   ZAP (remove DEFAULT headers and libraries from the resulting C file");
      fflush(stdout);
      ExitProcess(0);
    }
  if(bcx_stricmp(command(-1),"-r")==0){
      CreateRegString(HKEY_LOCAL_MACHINE,"Software\\Bcx-32\\Bcx\\Settings","Path",AppExePath());
      CreateRegString(HKEY_CURRENT_USER,"Software\\Bcx-32\\Bcx\\Settings","Path",AppExePath());
      printf("%s%s\n","      BCX Path set to ",BcxPath());
      fflush(stdout);
      ExitProcess(0);
    }
  if(bcx_stricmp(command(-1),"-v")==0){
      printf("\n");
      printf("%s\n",Copyright);
      Display_Version_and_Compiler();
      fflush(stdout);
      ExitProcess(0);
    }
  for(int i=2; i<=argc-1; i++)
    {
      strcpy(gTmpStr,lcase(argv[i]));
      if(instr(gTmpStr,"-b")){
          if(c_MaxOnExit==XitCount ){
              Abort("Maximum $OnExit exceeded.");
            }
          XitCount++;
          strcpy(Xit[XitCount], join(3,mid(argv[i],4),SPC,enc(extract(command(1),"."))));
        }
      if(strcmp(gTmpStr,"-c")==0){
          UseCpp=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-cpp")==0){
          UseCpp=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-e")==0){
          ErrFile=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-h")==0){
          Gen_Header=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-i")==0){
          InfoBoxWarn=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-q")==0){
          Quiet=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-k")==0){
          KillCFile=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-m")==0){
          SrcFlag=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-n")==0){
          NoRT=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-o")==0){
          ReDirect=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-s")==0){
          ShowStatus=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-u")==0){
          Use_UNICODE=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-z")==0){
          ZapFlag=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-w")==0){
          TestState=WarningFlag=TRUE;
          goto L1001;
        }
      if(strcmp(gTmpStr,"-x")==0){
          WinHeaders=FALSE;
        }

L1001:;

      if(m_iMatchLft(gTmpStr,"-f:")){
          strcpy(CmdLineFileOut,mid(argv[i],4));
        }
      if(m_iMatchLft(gTmpStr,"-d:")){
          strcpy(CmdLineConst, join(3,CmdLineConst,mid(argv[i],4),vchr(1,1)));
        }
    }
  if(ShowStatus ){
      cls();
    }
  if(!Quiet ){
      if(c_BCX_COLORS ){
          PushColors();
        }
      if(c_BCX_COLORS ){
          color(11,0 );
        }
      printf("\n");
      printf("%s\n",Copyright);
      Display_Version_and_Compiler();
      if(c_BCX_COLORS ){
          PopColors();
        }
    }
  if(inchr(command(1),".")){
      strcpy(Cmd,command(1));
    }
  else
    {
      strcpy(Cmd, join(2,extract(command(1),"."),".bas"));
    }
  strcpy(Cmd,findfirst(Cmd));
  if(inchr(Cmd,"*")||inchr(Cmd,"?")){
      strcpy(Cmd,findfirst(Cmd));
    }
  strcpy(FileIn,Cmd);
  if(ISNULL(CmdLineFileOut)){
      strcpy(FileOut, join(2,left(Cmd,InstrRev(Cmd,".",0)-1),".out"));
    }
  else
    {
      strcpy(FileOut,CmdLineFileOut);
    }
  strcpy(FileErr, join(2,left(Cmd,InstrRev(Cmd,".",0)-1),".err"));
  if(Exist(FileErr)){
      system(join(2,"DEL ",FileErr));
    }
  if(DebugModeOff ){
      strcpy(gTmpStr,tempdir());
      strcpy(cppFile,TempFileName(gTmpStr,"ccode"));
      strcpy(prcFile,TempFileName(gTmpStr,"prc"));
      strcpy(udtFile,TempFileName(gTmpStr,"udt"));
      strcpy(datFile,TempFileName(gTmpStr,"dat"));
      strcpy(UsrFile,TempFileName(gTmpStr,"cst"));
      strcpy(SysFile,TempFileName(gTmpStr,"syscst"));
      strcpy(ovrFile,TempFileName(gTmpStr,"ovr"));
      strcpy(hdrFile,TempFileName(gTmpStr,"hdr"));
      strcpy(setFile,TempFileName(gTmpStr,"set"));
      strcpy(resFile,TempFileName(gTmpStr,"res"));
      strcpy(enuFile,TempFileName(gTmpStr,"enu"));
      strcpy(defFile,TempFileName(gTmpStr,"def"));
    }
  else
    {
      strcpy(gTmpStr,AppExePath());
      strcpy(cppFile, join(2,gTmpStr,"ccode_debug.txt"));
      strcpy(prcFile, join(2,gTmpStr,"prc_debug.txt"));
      strcpy(udtFile, join(2,gTmpStr,"udt_debug.txt"));
      strcpy(datFile, join(2,gTmpStr,"dat_debug.txt"));
      strcpy(UsrFile, join(2,gTmpStr,"cst_debug.txt"));
      strcpy(SysFile, join(2,gTmpStr,"syscst_debug.txt"));
      strcpy(ovrFile, join(2,gTmpStr,"ovr_debug.txt"));
      strcpy(hdrFile, join(2,gTmpStr,"hdr_debug.txt"));
      strcpy(setFile, join(2,gTmpStr,"set_debug.txt"));
      strcpy(resFile, join(2,gTmpStr,"res_debug.txt"));
      strcpy(enuFile, join(2,gTmpStr,"enu_debug.txt"));
      strcpy(defFile, join(2,gTmpStr,"def_debug.txt"));
    }
  ScanIncludeFiles(FileIn);
  for(int j=0; j<=FilesFound; j++)
    {
      ScanFunctionNames(IncludeFileNames[j]);
    }
  if((SourceFile=fopen(FileIn, "rb"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileIn); exit(1);
   }
  if((FP2=fopen(FileOut, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
   }
  FP_WRITE=FP2;
  if((FP_CCODE=fopen(cppFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", cppFile); exit(1);
   }
  if((FP_SYSCST=fopen(SysFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", SysFile); exit(1);
   }
  if((FP3=fopen(prcFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", prcFile); exit(1);
   }
  if((FP_UDT=fopen(udtFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", udtFile); exit(1);
   }
  if((FP_DAT=fopen(datFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", datFile); exit(1);
   }
  if((FP_CST=fopen(UsrFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", UsrFile); exit(1);
   }
  if((FP_HDR=fopen(hdrFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", hdrFile); exit(1);
   }
  if((FP_RES=fopen(resFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", resFile); exit(1);
   }
  if((FP_ENU=fopen(enuFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", enuFile); exit(1);
   }
  if((FP_OVR=fopen(ovrFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", ovrFile); exit(1);
   }
  if((FP_SET=fopen(setFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", setFile); exit(1);
   }
  if((FP_DEF=fopen(defFile, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", defFile); exit(1);
   }
  ExportStringConst();
  FileNdx=1;
  strcpy(FileNames[FileNdx],FileIn);
  LineNum[FileNdx]=0;
  if(NoRT==TRUE ){
      EnableProject();
    }
  Emit_Main_Function();
  ClearIfThenStacks();
  if(UseCpp==TRUE ){
      int iTmp;
      Docpp("",&(iTmp));
    }

READSRCLINE:;

  while(!EoF(SourceFile)||SplitCnt){
      if(SplitCnt==0 ){
          Src[0]=0;
          fgets(Src, 2048 , SourceFile);
            if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
              {
               Src[strcspn(Src,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Src);
                exit(1);
              }
          LineNum[FileNdx]++;
          strcpy(Src,ltrim(Src));
          if(Src[0]==0 ){
              continue;
            }
          if(InFunction ){
              if(InsertComments ){
                  if(*Src==c_SglQt ){
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,"//",(PCHAR)(Src+1));
                      *Src=0;
                      continue;
                    }
                  if(m_iMatchLft(Src,"rem ")){
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,"//",(PCHAR)(Src+3));
                      *Src=0;
                      continue;
                    }
                }
            }
          Sanitize_Code(Src);
          if(Src[0]==0 ){
              continue;
            }
          if(JoinLines(Src)){
              continue;
            }
          if(iMatchNQ(Src,"[")){
              FixBrackets(Src,0);
            }
          if(PPFlag ){
              ppret= CAST (long,PPProc(Src));
              if(ppret==0 ){
                  Abort(Src);
                }
            }
          if(ISFALSE FoundMacro()){
              if(SplitLines(Src)){
                  SplitCur++;
                  strcpy(Src,ltrim(SplitStk[SplitCur]));
                }
            }
        }
      else
        {
          SplitCur++;
          strcpy(Src,ltrim(SplitStk[SplitCur]));
        }
      Early_Transforms();
      if(SplitCur==SplitCnt ){
          SplitCur=SplitCnt=0;
        }
      strcpy(AbortSrc,Src);
      if(*Src==33 ){
          if(InFunction||InClass||InNameSpace||InTypeDef ){
              fprintf(FP_WRITE,"%s\n",mid(Src,2));
            }
          else
            {
              if(InMain ){
                  fprintf(FP2,"%s\n",mid(Src,2));
                }
              else
                {
                  fprintf(FP_CST,"%s\n",mid(Src,2));
                }
            }
          continue;
        }
      CheckMatchedPairs();
      if((SrcFlag)||(ShowStatus)||(TraceFlag&&InFunction)){
          ActivityFlags();
        }
      if(ISNULL(Src)){
          continue;
        }
      Translate();
      if(iMatchNQ(Src,"dyn")){
          if(like(Src,"*dim*dynamic*[*")){
              ProcessInjection();
            }
        }
      if(Inject_Local_Bcx_RetVal==TRUE ){
          PassOne=TRUE;
          Inject("LOCAL Bcx_RetVal AS INT");
          PassOne=TRUE;
          Inject_Local_Bcx_RetVal=FALSE;
        }
    }
     fflush(FP_WRITE);
  if(FPtrNdx ){
      PopFileIO();
      goto READSRCLINE;
    }
  Emit_CompilerDefines();
  if(TestForBcxIni==FALSE ){
      TestForBcxIni=TRUE;
      strcpy(szFile, join(2,curdir(),"\\bcx.ini"));
      if(!Exist(szFile)){
          strcpy(szFile, join(2,AppExePath(),"bcx.ini"));
        }
      if(Exist(szFile)){
          PushFileIO();
          if((SourceFile=fopen(szFile, "rb"))==0)
           {
          fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", szFile); exit(1);
           }
          if(FileNdx==c_MaxFiles-1 ){
              Abort("Maximum Include Files exceeded.");
            }
          FileNdx++;
          strcpy(FileNames[FileNdx],szFile);
          LineNum[FileNdx]=0;
          goto READSRCLINE;
        }
    }
  if(LoopTypeCnt ){
      LoopErrorMsg();
    }
  if(Indent ){
      printf("%s\n",repeat(80,"_"));
      printf("%s%s%s\n","Possible missing END IF before END of program (",str(Indent,1),")");
      printf("%s\n",repeat(80,"_"));
    }
  if(Use_VBS ){
      Emit_VBScript_Support();
    }
  if(NO_LIBS==FALSE ){
      if(ZapFlag==FALSE ){
          if(Use_Project==FALSE ){
              static int Pass_1;
              if(Pass_1==FALSE ){
                  Pass_1++;
                  AddLibrary("kernel32.lib");
                  AddLibrary("user32.lib");
                  AddLibrary("gdi32.lib");
                  AddLibrary("comctl32.lib");
                  AddLibrary("advapi32.lib");
                  AddLibrary("winspool.lib");
                  AddLibrary("shell32.lib");
                  AddLibrary("Msimg32.lib");
                  AddLibrary("ole32.lib");
                  AddLibrary("oleaut32.lib");
                  AddLibrary("uuid.lib");
                  AddLibrary("odbc32.lib");
                  AddLibrary("odbccp32.lib");
                  AddLibrary("winmm.lib");
                  AddLibrary("comdlg32.lib");
                  AddLibrary("imagehlp.lib");
                  AddLibrary("version.lib");
                  AddLibrary("wininet.lib");
                  AddLibrary("urlmon.lib");
                }
            }
        }
    }
  if(Use_GenFree&&GlobalDynaCnt ){
      MakeFreeGlobals();
    }
  Emit_Libs();
  ExportInternalConst();
  Emit_Epilog();
  CloseAll();
  AssembleParts();
  Emit_ResourceFile();
  if(ShowStatus ){
      cls();
    }
  if(Use_Project&&Gen_Header ){
      Emit_ProjectSupport();
    }
  if(WarnMsg[0]!=0 ){
      if(InfoBoxWarn ){
          InfoBox("Warnings! :",WarnMsg,GetSystemMetrics(SM_CXSCREEN)/4,GetSystemMetrics(SM_CYSCREEN)/4);
        }
      else
        {
          printf("%s%s%s\n","Warnings! :",CRLF,WarnMsg);
        }
    }
  Final_Transforms();
  PostProcess();
  if(!Quiet ){
      LinesRead+=(LineNum[1]);
      Elapsed=(float)clock()/(float)CLOCKS_PER_SEC;
      if(c_BCX_COLORS ){
          color(11,0 );
        }
      printf("%s","[Lines In:");
      if(c_BCX_COLORS ){
          color(14,0 );
        }
      printf(" %d ",(int)LinesRead);
      if(c_BCX_COLORS ){
          color(11,0 );
        }
      printf("%s","] [Lines Out:");
      if(c_BCX_COLORS ){
          color(14,0 );
        }
      printf(" %d ",(int)LinesWritten);
      if(c_BCX_COLORS ){
          color(11,0 );
        }
      printf("%s","] ");
      printf("%s","[Statements:");
      if(c_BCX_COLORS ){
          color(14,0 );
        }
      printf(" %d ",(int)Statements);
      if(c_BCX_COLORS ){
          color(11,0 );
        }
      printf("%s","] [Time: ");
      if(c_BCX_COLORS ){
          color(14,0 );
        }
      printf("%s",Using("#.##",Elapsed));
      if(c_BCX_COLORS ){
          color(11,0 );
        }
      printf("%s\n"," Sec's]");
      char Tmp[BCXSTRSIZE]={0};
      strcpy(Tmp, join(2,"BCX translated [",RemoveStr(mcase(FileIn),SPC)));
      strcpy(Tmp, join(4,Tmp,"] to [",RemoveStr(mcase(FileOut),SPC),"]"));
      if(UseCpp ){
          strcat(Tmp," for a C++ Compiler");
        }
      else
        {
          strcat(Tmp," for a C Compiler");
        }
      if(Use_Project ){
          strcat(Tmp," with No Runtime");
        }
      if(c_BCX_COLORS ){
          color(10,0 );
        }
      printf("%s\n",Tmp);
      printf("\n");
      if(c_BCX_COLORS ){
          PopColors();
        }
    }
  if(KillCFile ){
      DeleteFile ((FileOut));
    }
  KillFiles();
  return EXIT_SUCCESS;
}

void Early_Transforms ()
{
  if(iMatchNQ(Src," = ")){
      if(m_iMatchLft(Src,"dim")||m_iMatchLft(Src,"local")||m_iMatchLft(Src,"static")||m_iMatchLft(Src,"raw")||m_iMatchLft(Src,"shared")||m_iMatchLft(Src,"global")){
          FastLexer(Src,SPC,c_FULLSET);
          if(bcx_stricmp(Stk[3],"STRING")==0){
              LShiftStk(2);
              LShiftStk(2);
              strcpy(Stk[2], join(2,Stk[2],"$"));
            }
          if(bcx_stricmp(Stk[4],"STRING")==0){
              LShiftStk(2);
              LShiftStk(2);
              LShiftStk(2);
              strcpy(Stk[2], join(2,Stk[2],"$"));
            }
          if(bcx_stricmp(Stk[1],"dim")==0  &&  bcx_stricmp(Stk[2],"raw")==0){
              LShiftStk(1);
            }
          if(bcx_stricmp(Stk[1],"dim")==0  &&  bcx_stricmp(Stk[2],"static")==0){
              LShiftStk(1);
            }
          if(bcx_stricmp(Stk[1],"dim")==0  &&  bcx_stricmp(Stk[2],"shared")==0){
              LShiftStk(1);
            }
          int IsDecl=FALSE;
          if(Ndx>=2 ){
              char VarName[BCXSTRSIZE];
              strcpy(VarName,No_Sigil(Stk[2]));
              int FirstChar=*VarName;
              if(FirstChar==95||isalpha(FirstChar)){
                  IsDecl=TRUE;
                  if(Ndx>=3 ){
                      if(m_iMatchWrd(Stk[3],"as")){
                          IsDecl=TRUE;
                        }
                      else
                        {
                          int LastChar=(UCHAR)*(right(VarName,1));
                          if(iMatchNQ(c_VARTYPES,vchr(1,LastChar))){
                              IsDecl=TRUE;
                            }
                          else
                            {
                              if(Ndx>=3&&*Stk[3]==61 ){
                                  IsDecl=TRUE;
                                }
                              else
                                {
                                  IsDecl=FALSE;
                                }
                            }
                        }
                    }
                }
            }
          if(IsDecl ){
              SplitDimAssignment();
              return;
            }
        }
    }
  if(iMatchNQ(Src,"=")){
      if(iMatchNQ(Src,"%=")){
          strcpy(Src,replace(Src,"%=",BcxPctEqual));
        }
      if(iMatchNQ(Src,"^=")){
          strcpy(Src,replace(Src,"^=",BcxUpEqual));
        }
      if(iMatchNQ(Src,"<<=")){
          strcpy(Src,replace(Src,"<<=",BcxLLEqual));
        }
      if(iMatchNQ(Src,">>=")){
          strcpy(Src,replace(Src,">>=",BcxRREqual));
        }
      if(iMatchNQ(Src,"&=")){
          strcpy(Src,replace(Src,"&=",BcxAndEqual));
        }
      if(iMatchNQ(Src,"|=")){
          strcpy(Src,replace(Src,"|=",BcxOrEqual));
        }
    }
  if(iMatchNQ(Src,"xfor")==FALSE ){
      if(like(Src,"*xfor*+=*")==FALSE ){
          if(iMatchNQ(Src,"=+")&&!iMatchNQ(Src,"=++")){
              Abort(" [=+] looks like a typo.");
            }
          if(iMatchNQ(Src,"+=")){
              char  LeftSide[BCXSTRSIZE]={0};
              char  RightSide[BCXSTRSIZE]={0};
              int  i={0};
              int  j={0};
              FastLexer(Src,SPC,c_FULLSET);
              if(*Stk[1]==33 ){
                  return;
                }
              if(bcx_stricmp(Stk[1],"if")==0){
                  for(i=2; i<=Ndx; i++)
                    {
                      if(bcx_stricmp(Stk[i],"then")==0){
                          goto L1004;
                        }
                    }
L1004:;
                  for(j=1; j<=i; j++)
                    {
                      strcpy(LeftSide, join(3,LeftSide,SPC,Stk[j]));
                    }
                  for(j=i+1; j<=Ndx; j++)
                    {
                      strcat(RightSide,Stk[j]);
                    }
                  FastLexer(RightSide,SPC,c_FULLSET);
                }
              StrCatOperTransform();
              BuildDelimStr(1,Ndx,Src);
              if(*LeftSide ){
                  strcpy(Src,trim(join(3,LeftSide,SPC,Src)));
                }
            }
        }
    }
  strcpy(Src, join(2,SPC,Src));
  if(iMatchNQ(Src,"il")){
      if(like(Src,"*loop*while*")||like(Src,"*do*until*")||like(Src,"*loop*until*")){
          FastLexer(Src,SPC,c_FULLSET);
          if(!inchr(Stk[3],"$")&&Im_A_String_Var(Stk[3])){
              strcat(Stk[3],"$");
              strcpy(Src,SPC);
              for(int i=1; i<=Ndx; i++)
                {
                  strcpy(Src, join(3,Src,Stk[i],SPC));
                }
              strcpy(Src, join(2,SPC,Src));
            }
        }
      if(like(Src,"*while*")){
          FastLexer(Src,SPC,c_FULLSET);
          if(inchr(Stk[2],"$")==0&&Im_A_String_Var(Stk[2])){
              strcat(Stk[2],"$");
              strcpy(Src,SPC);
              for(int i=1; i<=Ndx; i++)
                {
                  strcpy(Src, join(3,Src,Stk[i],SPC));
                }
              strcpy(Src, join(2,SPC,Src));
            }
        }
    }
  if(iMatchNQ(Src,".szlabel")||iMatchNQ(Src,".szlabel$")){
      strcpy(Src,iReplace(Src,".szlabel",".szLabel$"));
      strcpy(Src,iReplace(Src,"bcx_splitbuttondata","BCX_SPLITBUTTONDATA"));
    }
  if(iMatchNQ(Src,"bcx_splitbuttondata")){
      strcpy(Src,iReplace(Src,"bcx_splitbuttondata","BCX_SPLITBUTTONDATA"));
    }
  if(UseCpp==FALSE ){
      if(iMatchNQ(Src,"<iostream>")){
          UseCpp=TRUE;
          goto NEXTTEST;
        }
      if(iMatchNQ(Src," delete ")){
          UseCpp=TRUE;
          goto NEXTTEST;
        }
      if(iMatchNQ(Src," std::cout ")){
          UseCpp=TRUE;
          goto NEXTTEST;
        }
      if(iMatchNQ(Src," std::cin ")){
          UseCpp=TRUE;
          goto NEXTTEST;
        }
      if(iMatchNQ(Src," class ")){
          UseCpp=TRUE;
          goto NEXTTEST;
        }
      if(iMatchNQ(Src," interface ")){
          UseCpp=TRUE;
          goto NEXTTEST;
        }

NEXTTEST:;

      if(iMatchNQ(Src," inline ")){
          if(like(Src,"*inline*function*")||like(Src,"*inline*sub*")){
              UseCpp=TRUE;
            }
        }
      if(like(Src,"*HANDLE_MSG*")){
          UseCpp=FALSE;
          UseInLine=FALSE;
        }
      if(iMatchNQ(Src," namespace ")){
          UseCpp=TRUE;
        }
      if(iMatchNQ(Src," template ")){
          UseCpp=TRUE;
        }
      if(iMatchNQ(Src," pptype ")){
          UseCpp=TRUE;
        }
      if(iMatchNQ(Src," ator ")){
          if(like(Src,"*function*operator*")){
              UseCpp=TRUE;
            }
        }
      if(!iMatchNQ(Src," binary ")){
          if(iMatchNQ(Src," new ")){
              UseCpp=TRUE;
            }
        }
    }
  if(UseCpp==TRUE ){
      if(iMatchNQ(Src,"propget")){
          strcpy(Src,iReplace_NQ(Src,"propget","FUNCTION"));
        }
      if(iMatchNQ(Src,"propset")){
          strcpy(Src,iReplace_NQ(Src,"propset","SUB"));
        }
      if(iMatchNQ(Src,"property")){
          char szTmp[BCXSTRSIZE];
          strcpy(szTmp, join(3,SPC,Src,SPC));
          if(iinstr(szTmp," property ")){
              strcpy(Src,iReplace_NQ(Src,"property","SUB"));
            }
        }
      if(iMatchNQ(Src,"method")){
          char szTmp[BCXSTRSIZE];
          strcpy(szTmp, join(3,SPC,Src,SPC));
          if(iinstr(szTmp," method ")||iinstr(szTmp," method=")){
              strcpy(Src,iReplace_NQ(Src,"method","FUNCTION"));
            }
        }
    }
  if(UseCpp==TRUE ){
      if(iMatchNQ(Src,"rbfor")||iMatchNQ(Src,"rbnext")||iMatchNQ(Src,"rbexit")){
          RBForTransform();
        }
    }
  if(iMatchNQ(Src,"band")){
      if(like(Src,"*select*case*band*")){
          char szTmp[BCXSTRSIZE];
          strcpy(szTmp,trim(strim(Src)));
          if(like(szTmp,"select case band*")){
              strcpy(Src,iReplace_NQ(Src," band ",SPC));
              strcpy(Src, join(3,Src,SPC,"&&"));
            }
        }
    }
  if(iMatchNQ(Src,"const")){
      if(like(Src,"*dim*as*const*")){
          FastLexer(Src,SPC,c_FULLSET);
          if(bcx_stricmp(Stk[1],"dim")==0  &&  bcx_stricmp(Stk[2],"as")==0  &&  bcx_stricmp(Stk[3],"const")==0){
              strcpy(Src,replace(Src," [","["));
              strcpy(Src,replace(Src," ]","]"));
            }
        }
    }
  if(iMatchNQ(Src,"const")){
      FastLexer(Src,SPC,c_FULLSET);
      if(bcx_stricmp(Stk[1],"const")==0){
          FOR_EACH(i,ConstTypes);
          if(bcx_stricmp(Stk[2],ConstTypes[i])==0){
              strcpy(Src, join(2,"DIM AS ",Src));
              EXIT_EACH;
            }
          NEXT_EACH;
        }
    }
  if(iMatchTwoNQ(Src,"input "," #")==TRUE ){
      if(iMatchNQ(Src,"line ")==FALSE ){
          if(iMatchNQ(Src,"open ")==FALSE ){
              if(iMatchNQ(Src,"as ")==FALSE ){
                  strcpy(Src,iReplace_NQ(Src," input "," finput "));
                }
            }
        }
    }
  if(iMatchTwoNQ(Src,"print "," #")==TRUE ){
      if(iMatchNQ(Src,"using$")==FALSE ){
          if(iMatchNQ(Src,"lprint")==FALSE ){
              strcpy(Src,iReplace_NQ(Src," print "," fprint "));
            }
        }
    }
  if(iMatchNQ(Src,"print")){
      FastLexer(Src,SPC,c_FULLSET);
      for(int i=1; i<=Ndx; i++)
        {
          if(bcx_stricmp(Stk[i],"print")==0){
              if(CheckType(Stk[i+1])==vt_FILEPTR ){
                  strcpy(Src,iReplace_NQ(Src," print "," fprint "));
                }
            }
        }
    }
  if(iMatchNQ(Src," comset ")){
      strcpy(Src,iReplace(Src," comset "," SET "));
    }
  if(iMatchNQ(Src,"asciiz")){
      strcpy(Src,iReplace(Src,"asciiz","string"));
    }
  if(instr(Src,DDQUOT)){
      Use_DDQ=TRUE;
      strcpy(Src,replace(Src,DDQUOT," DDQ$ "));
    }
  if(instr(Src,DQUOT)){
      Use_DQ=TRUE;
      strcpy(Src,replace(Src,DQUOT," DQ$ "));
    }
  if(iMatchNQ(Src," $pragma ")){
      strcpy(Src,iReplace_NQ(Src,"$pragma ","!#pragma "));
    }
  if(iMatchNQ(Src," ANY ")){
      if(iMatchNQ(Src,"EXTRACT$")){
          strcpy(Src,iReplace(Src,"EXTRACT$","$TCARTXE"));
          strcpy(Src,Replace_ANY_Keyword(Src,"$TCARTXE"));
          strcpy(Src,iReplace(Src,"$TCARTXEANY"," EXTRACTANY$ "));
          Use_ExtractAny=Use_BcxTempStr=TRUE;
        }
      if(iMatchNQ(Src,"IINSTR")){
          strcpy(Src,iReplace(Src,"IINSTR","RTSNI2I"));
          strcpy(Src,Replace_ANY_Keyword(Src,"RTSNI2I"));
          strcpy(Src,iReplace(Src,"RTSNI2IANY"," IINSTRANY "));
          Use_IInstrAny=Use_IInstr=TRUE;
        }
      if(iMatchNQ(Src,"IREMOVE$")){
          strcpy(Src,iReplace(Src,"IREMOVE$","$EVOMERI"));
          strcpy(Src,Replace_ANY_Keyword(Src,"$EVOMERI"));
          strcpy(Src,iReplace(Src,"$EVOMERIANY"," IREMOVEANY$ "));
          Use_IRemoveAny=Use_BcxTempStr=TRUE;
        }
      if(iMatchNQ(Src,"IREPLACE$")){
          strcpy(Src,iReplace(Src,"IREPLACE$","$ECALPERI"));
          strcpy(Src,Replace_ANY_Keyword(Src,"$ECALPERI"));
          strcpy(Src,iReplace(Src,"$ECALPERIANY"," IREPLACEANY$ "));
          Use_IReplaceAny=Use_BcxTempStr=TRUE;
        }
      if(iMatchNQ(Src,"REMAIN$")){
          strcpy(Src,iReplace(Src,"REMAIN$","$NIAMER"));
          strcpy(Src,Replace_ANY_Keyword(Src,"$NIAMER"));
          strcpy(Src,iReplace(Src,"$NIAMERANY"," REMAINANY$ "));
          Use_RemainAny=Use_BcxTempStr=TRUE;
        }
      if(iMatchNQ(Src,"INSTR")){
          strcpy(Src,Replace_ANY_Keyword(Src,"INSTR"));
        }
      if(iMatchNQ(Src,"REMOVE$")){
          strcpy(Src,Replace_ANY_Keyword(Src,"REMOVE$"));
        }
      if(iMatchNQ(Src,"REPLACE$")){
          strcpy(Src,Replace_ANY_Keyword(Src,"REPLACE$"));
        }
      strcpy(Src,iReplace(Src,"REMOVE$ANY"," REMOVEANY$ "));
      strcpy(Src,iReplace(Src,"REPLACE$ANY"," REPLACEANY$ "));
      strcpy(Src,iReplace(Src,"REMAIN$ANY"," REMAINANY$ "));
      strcpy(Src,iReplace(Src,"INSTRANY"," INSTRANY "));
      strcpy(Src,iReplace(Src,"EXTRACT$ANY"," EXTRACTANY$ "));
    }
  if(like(Src,"*end*while*")){
      char Tmp[BCXSTRSIZE];
      strcpy(Tmp,Src);
      strcpy(Tmp,IRemoveStr(Tmp,"end"));
      strcpy(Tmp,IRemoveStr(Tmp,"while"));
      if(strcmp(ltrim(Tmp),"")==0){
          strcpy(Src,"WEND");
        }
    }
  if(iMatchNQ(Src,"local")&&iMatchNQ(Src,"dynamic")){
      int lhs=iinstr(Src,"local");
      int rhs=iinstr(Src,"dynamic");
      if((rhs>lhs)&&lhs>0 ){
          strcpy(Src,iReplace(Src,"local","DIM"));
        }
    }
  strcpy(Src,trim(Src));
}

void Final_Transforms ()
{
  char clangOld[BCXSTRSIZE];
  strcpy(clangOld,vchr(18,93,91,66,67,88,83,84,82,83,73,90,69,93,61,123,48,125,59));
  char clangNew[BCXSTRSIZE];
  strcpy(clangNew,vchr(20,93,91,66,67,88,83,84,82,83,73,90,69,93,61,123,123,48,125,125,59));
  char Dll_Orig[BCXSTRSIZE];
  strcpy(Dll_Orig,vchr(30,67,95,69,88,80,79,82,84,32,105,110,116,32,95,95,115,116,100,99,97,108,108,32,68,108,108,77,97,105,110));
  char Dll_Repl[BCXSTRSIZE];
  strcpy(Dll_Repl,vchr(41,95,95,100,101,99,108,115,112,101,99,40,100,108,108,101,120,112,111,114,116,41,32,66,79,79,76,32,87,73,78,65,80,73,32,68,108,108,77,97,105,110));
  char QQF[BCXSTRSIZE];
  strcpy(QQF,vchr(12,99,104,97,114,42,32,32,61,32,68,81,36));
  char QQR[BCXSTRSIZE];
  strcpy(QQR,vchr(11,99,104,97,114,42,32,32,61,32,68,81));
  char BandAid[BCXSTRSIZE];
  strcpy(BandAid,vchr(4,38,38,61,61));
  StripExtraDefWndProcs();
  int ZapBCXSTRSIZE=0;
  ULONGLONG  filesize=lof(FileOut);
  char *Buffer;
  Buffer=(char*)calloc((ULONG)filesize, 1);
  if((FP1=fopen(FileOut, "rb+"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
   }
  GET(FP1,Buffer,filesize );
  if(FP1)
   {
     fclose(FP1);
     FP1=NULL;
   }
  if(tally(Buffer,"BCXSTRSIZE")==1 ){
      ZapBCXSTRSIZE=TRUE;
    }
  if((FP1=fopen(FileOut, "rb"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
   }
  if((FP2=fopen("$Bcx$Temp$File$", "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", "$Bcx$Temp$File$"); exit(1);
   }
  char Source[BCXSTRSIZE]={0};
  while(!EoF(FP1)){
      Source[0]=0;
      fgets(Source, 2048 , FP1);
        if(feof(FP1) || (Source[strlen(Source)-1]==10))
          {
           Source[strcspn(Source,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP1));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Source);
            exit(1);
          }
      if(iinstr(Source,"Equal}")){
          if(iMatchNQ(Source,BcxPctEqual)){
              strcpy(Source,replace(Source,BcxPctEqual,"%="));
            }
          if(iMatchNQ(Source,BcxUpEqual)){
              strcpy(Source,replace(Source,BcxUpEqual,"^="));
            }
          if(iMatchNQ(Source,BcxLLEqual)){
              strcpy(Source,replace(Source,BcxLLEqual,"<<="));
            }
          if(iMatchNQ(Source,BcxRREqual)){
              strcpy(Source,replace(Source,BcxRREqual,">>="));
            }
          if(iMatchNQ(Source,BcxAndEqual)){
              strcpy(Source,replace(Source,BcxAndEqual,"&="));
            }
          if(iMatchNQ(Source,BcxOrEqual)){
              strcpy(Source,replace(Source,BcxOrEqual,"|="));
            }
        }
      if(LeftStr(Source,"LRESULT CALLBACK WndProc (HWND hWnd,")){
          fprintf(FP2,"%s\n",Source);
          Source[0]=0;
          fgets(Source, 2048 , FP1);
            if(feof(FP1) || (Source[strlen(Source)-1]==10))
              {
               Source[strcspn(Source,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Source);
                exit(1);
              }
          fprintf(FP2,"%s\n",Source);
          Source[0]=0;
          fgets(Source, 2048 , FP1);
            if(feof(FP1) || (Source[strlen(Source)-1]==10))
              {
               Source[strcspn(Source,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Source);
                exit(1);
              }
          if(instr(Source,"Bcx_RetVal")==0 ){
              fprintf(FP2,"%s\n","  LRESULT Bcx_RetVal={0};");
              fprintf(FP2,"%s\n",Source);
              strcpy(Source,SPC);
            }
        }
      if(ZapBCXSTRSIZE&&instr(Source,"BCXSTRSIZE")){
          continue;
        }
      strcpy(Source,replace(Source,clangOld,clangNew));
      if(strcmp(ltrim(Source),"")==0  && strcmp(ltrim(LookAhead(FP1)),"")==0){
          continue;
        }
      if(strcmp(ltrim(Source),"")==0  && strcmp(ltrim(LookAhead(FP1)),"#endif")==0){
          continue;
        }
      if(instr(Source,"BCX_RetStr")){
          if(like(Source,"*char*BCX_RetStr={0};")&&like(trim(LookAhead(FP1)),"*char*BCX_RetStr={0};")){
              *Source=0;
            }
        }
      strcpy(Source,replace(Source,vchr(1,15),":"));
      strcpy(Source,replace(Source,QQF,QQR));
      if(instr(Source,"DllMain")){
          strcpy(Source,replace(Source,Dll_Orig,Dll_Repl));
        }
      if(LeftStr(Source,"#define  3.14")){
          printf("%s\n","CONST PI was detected in your program.");
          printf("%s\n","PI is a BCX reserved word and cannot be re-defined.");
          printf("%s\n","You must update your source code to remove this error.");
          *Source=0;
        }
      if(UserBcxStrSize[0]!=0&&LeftStr(Source,"#define BCXSTRSIZE")){
          strcpy(Source, join(2,"#define BCXSTRSIZE ",UserBcxStrSize));
        }
      strcpy(Source,replace(Source,vchr(3,61,45,32),vchr(4,32,61,32,45)));
      strcpy(Source,replace(Source,vchr(3,32,45,62),vchr(2,45,62)));
      if(iMatchNQ(Source,BandAid)){
          if(like(Source,"*if(*")){
              strcpy(Source,replace(Source,BandAid," & "));
            }
        }
      strcpy(Source,replace(Source,vchr(4,40,41,40,41),vchr(2,40,40)));
      strcpy(Source,replace(Source,vchr(10,70,73,76,69,32,32,32,42,32,32),"FILE   *"));
      if(instr(Source,"char*")){
          strcpy(Source,replace(Source,"char* ,","char*,"));
        }
      if(inchr(Source,"(")){
          strcpy(Source,iReplace_NQ(Source,"( ","("));
        }
      if(iMatchNQ(Source,"PostQuitMessage(0);")&&Use_Sound ){
          strcpy(Source, join(3,"       midiOutClose (hMidi);",LF,Source));
        }
      if(iMatchNQ(Source,"BCXEQEQ")){
          strcpy(Source,replace(Source,"BCXEQEQ","=="));
        }
      fprintf(FP2,"%s\n",Source);
      LinesWritten++;
    }
  _fcloseall();
  DeleteFile ((FileOut));
  MoveFile ("$Bcx$Temp$File$",FileOut );
  if (Buffer) {free(Buffer);}
}

int Im_A_String_Var (char* A)
{
  int idx;
  int t;
  t=LookupVarType(A,&(idx));
  if(t==vt_SCHAR||t==vt_CHAR||t==vt_STRVAR ){
      return TRUE;
    }
  else
    {
      return FALSE;
    }
}

int Im_Dim_StrVar (char *A,int bMulti)
{
  int  i;
  i=1;
  while(*GlobalVars[i].VarName){
      if(strcmp(GlobalVars[i].VarName,A)==0){
          if(strcmp(GetVarTypeName(GlobalVars[i].VarType),"char *")==0){
              if(bMulti ){
                  if(tally(GlobalVars[i].VarDim,"]")>1 ){
                      return TRUE;
                    }
                }
              else
                {
                  if(tally(GlobalVars[i].VarDim,"]")==1 ){
                      return TRUE;
                    }
                }
            }
        }
      i++;
    }
  i=1;
  while(*LocalVars[i].VarName){
      if(strcmp(LocalVars[i].VarName,A)==0){
          if(strcmp(GetVarTypeName(LocalVars[i].VarType),"char *")==0){
              if(bMulti ){
                  if(tally(LocalVars[i].VarDim,"]")>1 ){
                      return TRUE;
                    }
                }
              else
                {
                  if(tally(LocalVars[i].VarDim,"]")==1 ){
                      return TRUE;
                    }
                }
            }
        }
      i++;
    }
  return FALSE;
}

int Im_Single_Dim_StrVar (char* A)
{
  return Im_Dim_StrVar(A,FALSE);
}

int Im_Multi_Dim_StrVar (char* A)
{
  return Im_Dim_StrVar(A,TRUE);
}

int Im_UDT_Double (char* szArg)
{
  int  et;
  et=GetUDT_MemberType(szArg);
  return   ((et==vt_DOUBLE)|(et==vt_LDOUBLE));
}

int Im_UDT_Single (char* szArg)
{
  int  et;
  et=(GetUDT_MemberType(szArg)==vt_SINGLE);
  return et;
}

int Im_UDT_String (char* szArg)
{
  int  et;
  et=GetUDT_MemberType(szArg);
  return   ((et==vt_STRVAR)|(et==vt_PCHAR)|(et==vt_PSTR)|(et==vt_CHARPTR)|(et==vt_SCHAR)|(et==vt_CHAR));
}

int GetUDT_MemberType (char* szArg)
{
  char CopyArg[BCXSTRSIZE];
  char Member[BCXSTRSIZE];
  char segName[BCXSTRSIZE];
  char VarName[BCXSTRSIZE];
  int  br;
  int  datType;
  int  firstDot;
  int  found;
  int  lastDot;
  int  segEnd;
  int  segStart;
  int  udtIdx;
  int  varidx;
  strcpy(CopyArg,No_Sigil(szArg));
  firstDot=inchr(CopyArg,".");
  if(firstDot==0 ){
      return vt_UNKNOWN;
    }
  strcpy(VarName,extract(CopyArg,"."));
  lastDot=InstrRev(CopyArg,".");
  strcpy(Member,mid(CopyArg,lastDot+1));
  br=inchr(Member,"[");
  if(br ){
      strcpy(Member,left(Member,br-1));
    }
  udtIdx=0;
  datType=CheckLocal(VarName,&(varidx));
  if(datType==vt_UDT||datType==vt_STRUCT ){
      udtIdx=LocalVars[varidx].VarDef;
    }
  else
    {
      datType=CheckGlobal(VarName,&(varidx));
      if(datType==vt_UDT||datType==vt_STRUCT ){
          udtIdx=GlobalVars[varidx].VarDef;
        }
    }
  if(udtIdx==0 ){
      return vt_UNKNOWN;
    }
  segStart=firstDot+1;
  while(segStart<lastDot){
      segEnd=inchr(mid(CopyArg,segStart),".");
      if(segEnd==0 ){
          goto L1013;
        }
      strcpy(segName,mid(CopyArg,segStart,segEnd-1));
      br=inchr(segName,"[");
      if(br ){
          strcpy(segName,left(segName,br-1));
        }
      found=FALSE;
      for(int z=0; z<=TypeDefs[udtIdx].EleCnt-1; z++)
        {
          if(strcmp(TypeDefs[udtIdx].Elements[z].ElementName,segName)==0){
              udtIdx=TypeDefs[udtIdx].Elements[z].ElementID;
              found=TRUE;
              goto L1014;
            }
        }
L1014:;
      if(!found ){
          return vt_UNKNOWN;
        }
      if(udtIdx==0 ){
          return vt_UNKNOWN;
        }
      segStart+=segEnd;
    }
L1013:;
  for(int z=0; z<=TypeDefs[udtIdx].EleCnt-1; z++)
    {
      if(strcmp(TypeDefs[udtIdx].Elements[z].ElementName,Member)==0){
          int elType=TypeDefs[udtIdx].Elements[z].ElementType;
          int elPtr=TypeDefs[udtIdx].Elements[z].ElementDynaPtr;
          if(elType==vt_CHAR&&elPtr>0 ){
              return vt_STRVAR;
            }
          else if(elType==vt_SCHAR&&elPtr>0 ){
              return vt_STRVAR;
            }
          else
            {
              return elType;
            }
        }
    }
  return vt_UNKNOWN;
}

int iMatchTwoNQ (char* Buffer,char* First,char* Second)
{
  int Position=instr(Buffer,First,1,1);
  if(Position==0 ){
      return FALSE;
    }
  int LEN_Buffer=(int)strlen(Buffer);
  int LEN_First=(int)strlen(First);
  int LEN_Second=(int)strlen(Second);
  if(instr(mid(Buffer,1,Position+LEN_First),DQ)){
      return FALSE;
    }
  for(int i=Position; i<=LEN_Buffer; i++)
    {
      if(*Buffer+i==32 ){
          continue;
        }
      if(instr(mid(Buffer,i,LEN_Second),Second,1,1)){
          return TRUE;
        }
    }
  return FALSE;
}

char * iReplace_NQ (char *Haystack,char *Needle,char *Repl)
{
  char  *BCX_RetStr={0};
  long  i={0};
  long  lastPos={0};
  char  LeftPart[BCXSTRSIZE]={0};
  char  RightPart[BCXSTRSIZE]={0};
  char  NewString[BCXSTRSIZE]={0};
  strcpy(NewString,Haystack);
  i=iMatchNQ(NewString,Needle);
  while(i>0){
      if(i<=lastPos ){
          goto L1017;
        }
      strcpy(LeftPart,mid(NewString,1,i-1));
      strcpy(RightPart,mid(NewString,i+(int)strlen(Needle)));
      strcpy(NewString, join(3,LeftPart,Repl,RightPart));
      lastPos=i+(int)strlen(Repl)-1;
      i=iMatchNQ(NewString,Needle);
    }
L1017:;
  BCX_RetStr = BCX_TempStr(strlen(NewString));
  strcpy(BCX_RetStr,NewString);
  return BCX_RetStr;
}

void ScanFunctionNames (char* SrcFile)
{
  char SrcCode[BCXSTRSIZE]={0};
  char FunkName[BCXSTRSIZE]={0};
  if((FPScan=fopen(SrcFile, "rb"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", SrcFile); exit(1);
   }
  while(!EoF(FPScan)){
      SrcCode[0]=0;
      fgets(SrcCode, 2048 , FPScan);
        if(feof(FPScan) || (SrcCode[strlen(SrcCode)-1]==10))
          {
           SrcCode[strcspn(SrcCode,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FPScan));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",SrcCode);
            exit(1);
          }
      strcpy(SrcCode,replace(SrcCode,"("," ("));
      strcpy(SrcCode,extract(SrcCode,":"));
      strcpy(SrcCode,trim(SrcCode));
      if(LeftStr(SrcCode,"declare ",1)){
          strcpy(SrcCode,mid(SrcCode,9));
        }
      if(LeftStr(SrcCode,"c_declare ",1)){
          strcpy(SrcCode,mid(SrcCode,11));
        }
      if(LeftStr(SrcCode,"function ",1)){
          strcpy(SrcCode,mid(SrcCode,9));
          strcpy(SrcCode,trim(SrcCode));
          strcpy(SrcCode,strim(SrcCode));
          strcat(SrcCode,SPC);
          if(strcmp(mid(SrcCode,1,1),"=")==0  || strcmp(mid(SrcCode,1,2)," =")==0){
              *SrcCode=0;
            }
          if(*SrcCode ){
              strcpy(FunkName,extract(SrcCode,SPC));
              if(*FunkName ){
                  strcpy(SrcCode,trim(mid(SrcCode,(int)strlen(FunkName)+1)));
                  if(RightStr(FunkName,"$")){
                      if(!instr(FuncStrNames,FunkName)){
                          strcpy(FuncStrNames, join(4,FuncStrNames,SPC,FunkName,SPC));
                        }
                    }
                  if(RightStr(FunkName,"!")){
                      if(!instr(FuncSglNames,FunkName)){
                          strcpy(FuncSglNames, join(4,FuncSglNames,SPC,FunkName,SPC));
                        }
                    }
                  if(RightStr(FunkName,"#")){
                      if(!instr(FuncDblNames,FunkName)){
                          strcpy(FuncDblNames, join(4,FuncDblNames,SPC,FunkName,SPC));
                        }
                    }
                  if(RightStr(SrcCode,"as single",1)){
                      if(!instr(FuncSglNames,FunkName)){
                          strcpy(FuncSglNames, join(4,FuncSglNames,SPC,FunkName,"! "));
                        }
                    }
                  if(RightStr(SrcCode,"as double",1)){
                      if(!instr(FuncDblNames,FunkName)){
                          strcpy(FuncDblNames, join(4,FuncDblNames,SPC,FunkName,"# "));
                        }
                    }
                  if(RightStr(SrcCode,"as string",1)){
                      if(!instr(FuncStrNames,FunkName)){
                          strcpy(FuncStrNames, join(4,FuncStrNames,SPC,FunkName,"$ "));
                        }
                    }
                }
            }
        }
    }
  if(FPScan)
   {
     fclose(FPScan);
     FPScan=NULL;
   }
}

void ScanIncludeFiles (char* FileName)
{
  long  i=0;
  char ThisFile[BCXSTRSIZE]={0};
  strcpy(IncludeFileNames[0],FileName);
  while(i<FilesFound){
      if(Exist(IncludeFileNames[i])){
          if((IncFP=fopen(IncludeFileNames[i], "rb"))==0)
           {
          fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", IncludeFileNames[i]); exit(1);
           }
          while(!EoF(IncFP)){
              ThisFile[0]=0;
              fgets(ThisFile, 2048 , IncFP);
                if(feof(IncFP) || (ThisFile[strlen(ThisFile)-1]==10))
                  {
                   ThisFile[strcspn(ThisFile,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(IncFP));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",ThisFile);
                    exit(1);
                  }
              strcpy(ThisFile,ucase(trim(ThisFile)));
              if(LeftStr(ThisFile,"$INCLUDE")){
                  strcpy(ThisFile,trim(extract(ThisFile,"'")));
                  strcpy(ThisFile,iReplace(ThisFile,"$BCX$",BcxPath()));
                  strcpy(ThisFile,RemoveStr(ThisFile,"$INCLUDE"));
                  if(inchr(ThisFile,"<")){
                      char Tmp[BCXSTRSIZE]={0};
                      strcpy(ThisFile,RemoveAny(ThisFile,"<>"));
                      strcpy(ThisFile,trim(ThisFile));
                      strcpy(Tmp,trim(Environ("BCXLIB")));
                      if(Tmp[0]!=0 ){
                          strcpy(ThisFile, join(2,Environ("BCXLIB"),ThisFile));
                        }
                      else
                        {
                          Abort("ENVIRON$(BCXLIB) is not SET");
                        }
                    }
                  strcpy(ThisFile,RemoveStr(ThisFile,DQ));
                  strcpy(ThisFile,trim(extract(ThisFile,"'")));
                  strcpy(IncludeFileNames[FilesFound],ThisFile);
                  FilesFound++;
                }
            }
        }
      if(IncFP)
       {
         fclose(IncFP);
         IncFP=NULL;
       }
      i++;
    }
  FilesFound--;
}

char * Replace_ANY_Keyword (char* Input,char* Keyword)
{
  char  *BCX_RetStr={0};
  int BracketBalance={0};
  int FoundANY={0};
  int FunctionStartPos={0};
  int IsInsideFunction={0};
  int i={0};
  char Result[BCXSTRSIZE]={0};
  char Token[BCXSTRSIZE]={0};
  FastLexer(Input,"","= &()[]{}',+-*/<>?;.|:^");
  while(i<=Ndx){
      strcpy(Token,Stk[i]);
      if(bcx_stricmp(Token,Keyword)==0){
          IsInsideFunction=TRUE;
          FunctionStartPos=(int)strlen(Result)+(int)strlen(SPC);
          strcpy(Result, join(3,Result,SPC,Token));
        }
      else
        {
          if(strcmp(Token,"(")==0){
              BracketBalance++;
              strcpy(Result, join(3,Result,SPC,Token));
            }
          else if(strcmp(Token,")")==0){
              BracketBalance--;
              strcpy(Result, join(3,Result,SPC,Token));
              if(BracketBalance==0&&FoundANY==TRUE ){
                  char A[BCXSTRSIZE]={0};
                  char B[BCXSTRSIZE]={0};
                  char C[BCXSTRSIZE]={0};
                  strcpy(A,mid(Result,1,FunctionStartPos-1));
                  strcpy(B,ucase(join(2,Keyword,"any")));
                  strcpy(C,mid(Result,1+FunctionStartPos+(int)strlen(Keyword)));
                  strcpy(Result, join(3,A,B,C));
                  FoundANY=FALSE;
                  IsInsideFunction=FALSE;
                }
            }
          else
            {
              if(IsInsideFunction && strcmp(lcase(Token),"any")==0){
                  FoundANY=TRUE;
                }
              else
                {
                  if((int)strlen(Token)>0 ){
                      strcpy(Result, join(3,Result,SPC,Token));
                    }
                }
            }
        }
      i++;
    }
  Ndx=0;
  strcpy(Result,replace(Result," (","("));
  strcpy(Result,replace(Result,"( ","("));
  strcpy(Result,replace(Result," )",")"));
  strcpy(Result,replace(Result,") ",")"));
  strcpy(Result,replace(Result,")+",") + "));
  strcpy(Result,replace(Result," [ ","["));
  strcpy(Result,replace(Result," ] ","]"));
  strcpy(Result,replace(Result," ]","]"));
  BCX_RetStr=trim(Result);
  return BCX_RetStr;
}

void StrCatOperTransform ()
{
  int  index={0};
  int  InString={0};
  int  ParenDepth={0};
  char QuoteChar[BCXSTRSIZE]={0};
  char Tmp[BCXSTRSIZE]={0};
  for(int i=2; i<=Ndx-1; i++)
    {
      if(strcmp(Stk[i],DQ)==0){
          if(InString==FALSE ){
              InString=TRUE;
              strcpy(QuoteChar,Stk[i]);
            }
          else if(strcmp(Stk[i],DQ)==0){
              InString=FALSE;
            }
        }
      if(InString==FALSE ){
          if(strcmp(Stk[i],"+")==0  && strcmp(Stk[i+1],"=")==0){
              *Tmp=0;
              ParenDepth=0;
              index=i-1;
              while(index>0){
                  if(strcmp(Stk[index],")")==0){
                      ParenDepth+=1;
                      strcpy(Tmp, join(2,Stk[index],Tmp));
                    }
                  else if(strcmp(Stk[index],"(")==0){
                      ParenDepth-=1;
                      strcpy(Tmp, join(2,Stk[index],Tmp));
                      if(ParenDepth<0 ){
                          strcpy(Tmp,mid(Tmp,2));
                          goto L1023;
                        }
                    }
                  else if(ParenDepth==0&&(strcmp(Stk[index],SPC)==0  || strcmp(Stk[index],",")==0  || strcmp(Stk[index],"=")==0)){
                      goto L1023;
                    }
                  else
                    {
                      strcpy(Tmp, join(2,Stk[index],Tmp));
                    }
                  index-=1;
                }
L1023:;
              for(index=Ndx; index>=i+1; index+=-1)
                {
                  strcpy(Stk[index+1],Stk[index]);
                }
              strcpy(Stk[i],"=");
              strcpy(Stk[i+1],Tmp);
              strcpy(Stk[i+2],"+");
              Ndx+=1;
              goto L1022;
            }
        }
    }
L1022:;
}

char * VB2BCX (char* strArg)
{
  char  *BCX_RetStr={0};
  char  AllTypes[BCXSTRSIZE]={0};
  char  dtype[BCXSTRSIZE]={0};
  char  stepp[BCXSTRSIZE]={0};
  char  strArgCopy[BCXSTRSIZE]={0};
  char  v[BCXSTRSIZE]={0};
  char  t[BCXSTRSIZE]={0};
  int  p={0};
  int  q={0};
  int  r={0};
  strcpy(AllTypes,"SINGLE DOUBLE FLOAT INTEGER INT LONG LLONG LONGLONG UINT UINT64 ULONG ULONGLONG CHAR UCHAR BYTE ");
  strcat(AllTypes,"UBYTE SBYTE SHORT USHORT SIZE_T SSIZE_T INT8_T INT16_T INT32_T INT64_T UINT8_T UINT16_T UINT32_T UINT64_T");
  strcpy(strArgCopy,trim(strArg));
  if(LeftStr(strArgCopy,"FOR ",1)==FALSE ){
      BCX_RetStr = BCX_TempStr(strlen(strArgCopy));
      strcpy(BCX_RetStr,strArgCopy);
      return BCX_RetStr;
    }
  p=iinstr(strArgCopy," AS ");
  if(p ){
      q=instr(strArgCopy,"=",p+4);
      if(q==0 ){
          BCX_RetStr = BCX_TempStr(strlen(strArgCopy));
          strcpy(BCX_RetStr,strArgCopy);
          return BCX_RetStr;
        }
      strcpy(dtype,trim(mid(strArgCopy,p+4,q-(p+4))));
      strcpy(v,trim(mid(strArgCopy,5,p-5)));
      strcpy(t,mid(strArgCopy,q+1));
      if(iinstr(AllTypes,dtype)==0 ){
          BCX_RetStr = BCX_TempStr(strlen(strArgCopy));
          strcpy(BCX_RetStr,strArgCopy);
          return BCX_RetStr;
        }
      r=iinstr(t," STEP ");
      if(r ){
          strcpy(stepp,mid(t,r));
          strcpy(t,left(t,r-1));
        }
      else
        {
          *stepp=0;
        }
      BCX_RetStr=join(7,"FOR ",dtype,SPC,v," = ",trim(t),stepp);
      return BCX_RetStr;
    }
  else
    {
      BCX_RetStr = BCX_TempStr(strlen(strArgCopy));
      strcpy(BCX_RetStr,strArgCopy);
      return BCX_RetStr;
    }
}

void ScanFuncNamesTypes (char* LineOfCode)
{
  *FunctionNameType.FunctionName=0;
  *FunctionNameType.FunctionType=0;
  int  p1={0};
  char FunkHeader[BCXSTRSIZE]={0};
  char FunkName[BCXSTRSIZE]={0};
  char FunkType[BCXSTRSIZE]={0};
  char localLine[BCXSTRSIZE]={0};
  char tmp[BCXSTRSIZE]={0};
  strcpy(localLine,LineOfCode);
  char kw[BCXSTRSIZE];
  char kwList[8][BCXSTRSIZE];
  strcpy(kwList[0],"optional");
  strcpy(kwList[1],"overloaded");
  strcpy(kwList[2],"inline");
  strcpy(kwList[3],"uint_ptr");
  strcpy(kwList[4],"int_ptr");
  strcpy(kwList[5],"lresult");
  strcpy(kwList[6],"callback");
  strcpy(kwList[7]," export");
  for(int i=0; i<=7; i++)
    {
      strcpy(kw,kwList[i]);
      if(iinstr(localLine,kw)){
          strcpy(localLine,IRemoveStr(localLine,kw));
          strcpy(localLine,trim(localLine));
        }
    }
  if(strcmp(lcase(left(localLine,8)),"function")==0){
      strcpy(tmp,mid(localLine,9));
      strcpy(tmp,ltrim(tmp));
      if(strcmp(left(tmp,1),"=")==0){
          return;
        }
    }
  if(strcmp(lcase(left(localLine,8)),"function")!=0){
      return;
    }
  strcpy(FunkHeader,trim(mid(localLine,9)));
  p1=inchr(FunkHeader,"(");
  if(p1 ){
      strcpy(FunkName,trim(left(FunkHeader,p1-1)));
      int i={0};
      int j={0};
      int k={0};
      p1=0;
      for(i=1; i<=(int)strlen(FunkHeader)-4; i++)
        {
          if(strcmp(mid(FunkHeader,i,1),")")==0){
              j=i+1;
              while(j<=(int)strlen(FunkHeader) && strcmp(mid(FunkHeader,j,1),SPC)==0){
                  j+=1;
                }
              if(strcmp(lcase(mid(FunkHeader,j,2)),"as")==0){
                  k=j+2;
                  while(k<=(int)strlen(FunkHeader) && strcmp(mid(FunkHeader,k,1),SPC)==0){
                      k+=1;
                    }
                  p1=k-1;
                  goto L1026;
                }
            }
        }
L1026:;
      if(p1 ){
          strcpy(FunkType,trim(mid(FunkHeader,p1+1)));
        }
      else
        {
          strcpy(FunkType,"INTEGER");
        }
    }
  else
    {
      int  asPos={0};
      asPos=0;
      for(int i=1; i<=(int)strlen(FunkHeader)-2; i++)
        {
          if(strcmp(mid(lcase(FunkHeader),i,2),"as")==0){
              char before[BCXSTRSIZE]={0};
              char after[BCXSTRSIZE]={0};
              strcpy(before,mid(FunkHeader,i-1,1));
              strcpy(after,mid(FunkHeader,i+2,1));
              if((i==1 || strcmp(before,SPC)==0)  && (strcmp(after,SPC)==0  || (i+2)>(int)strlen(FunkHeader))){
                  asPos=i;
                  goto L1029;
                }
            }
        }
L1029:;
      if(asPos ){
          strcpy(FunkName,trim(left(FunkHeader,asPos-1)));
          strcpy(FunkType,trim(mid(FunkHeader,asPos+2)));
        }
      else
        {
          strcpy(FunkName,trim(FunkHeader));
          strcpy(FunkType,"INTEGER");
        }
    }
  if(instr(FunkType,"INTEGER")){
      if(inchr(FunkName,"$")){
          strcpy(FunkType,"STRING");
        }
      if(inchr(FunkName,"!")){
          strcpy(FunkType,"SINGLE");
        }
      if(inchr(FunkName,"#")){
          strcpy(FunkType,"DOUBLE");
        }
      if(inchr(FunkName,"%")){
          strcpy(FunkType,"INTEGER");
        }
    }
  if(strcmp(FunkName,"Name$")==0){
      return;
    }
  if(strcmp(FunkName,"Type$")==0){
      return;
    }
  if(inchr(FunkName,"=")){
      return;
    }
  if(strcmp(ltrim(FunkName),"")==0){
      return;
    }
  strcpy(FunctionNameType.FunctionName,trim(FunkName));
  strcpy(FunkType,trim(FunkType));
  if(strcmp(right(FunkType,2)," &")==0){
      strcpy(FunkType,RemoveStr(FunkType,"&"));
      strcpy(FunkType, join(2,"static ",FunkType));
    }
  strcpy(FunctionNameType.FunctionType,FunkType);
}

char * BeautifyCode (char *src)
{
  char  *BCX_RetStr={0};
  unsigned char  c={0};
  char  ch[BCXSTRSIZE]={0};
  char  cleaned[BCXSTRSIZE]={0};
  int  inQuote={0};
  char  out[BCXSTRSIZE]={0};
  for(long i=0; i<=(int)strlen(src)-1; i++)
    {
      c=(UCHAR)*(mid(src,i+1,1));
      if(c==34 ){
          inQuote=!inQuote;
          strcat(cleaned,vchr(1,c));
        }
      else if(inQuote ){
          strcat(cleaned,vchr(1,c));
        }
      else
        {
          if(c<=32 ){
              if((int)strlen(cleaned)>0 ){
                  if(strcmp(right(cleaned,1),SPC)!=0){
                      strcat(cleaned,SPC);
                    }
                }
            }
          else
            {
              strcat(cleaned,vchr(1,c));
            }
        }
    }
  inQuote=0;
  for(long i=1; i<=(int)strlen(cleaned); i++)
    {
      strcpy(ch,mid(cleaned,i,1));
      if(strcmp(ch,DQ)==0){
          inQuote=!inQuote;
          strcat(out,ch);
        }
      else if(inQuote ){
          strcat(out,ch);
        }
      else
        {
          if(strcmp(ch,"=")==0  || strcmp(ch,"(")==0  || strcmp(ch,")")==0  || strcmp(ch,",")==0  || strcmp(ch,";")==0  || strcmp(ch,"|")==0  || strcmp(ch,"[")==0  || strcmp(ch,"]")==0  || strcmp(ch,"{")==0  || strcmp(ch,"}")==0  || strcmp(ch,"<")==0  || strcmp(ch,">")==0){
              while((int)strlen(out)>0 && strcmp(right(out,1),SPC)==0){
                  strcpy(out,left(out,(int)strlen(out)-1));
                }
              strcat(out,ch);
              while(i<(int)strlen(cleaned) && strcmp(mid(cleaned,i+1,1),SPC)==0){
                  i++;
                }
            }
          else
            {
              strcat(out,ch);
            }
        }
    }
  BCX_RetStr = BCX_TempStr(strlen(out));
  strcpy(BCX_RetStr,out);
  return BCX_RetStr;
}

void Convert_Chr2VChr ()
{
  int  NewIndex={0};
  int  ArgCount={0};
  int  i={0};
  i=1;
  while(i<=Ndx){
      NewIndex++;
      strcpy(Vchr_Stk[NewIndex],Stk[i]);
      if((i<Ndx) && strcmp(lcase(Stk[i]),"chr$")==0){
          if(strcmp(Stk[i+1],"(")==0){
              strcpy(Vchr_Stk[NewIndex],"VCHR$");
              i++;
              NewIndex++;
              strcpy(Vchr_Stk[NewIndex],Stk[i]);
              ArgCount=CountChrArguments(i+1);
              NewIndex++;
              strcpy(Vchr_Stk[NewIndex],str(ArgCount));
              if(ArgCount>0 ){
                  NewIndex++;
                  strcpy(Vchr_Stk[NewIndex],",");
                }
            }
        }
      i++;
    }
  for(i=1; i<=NewIndex; i++)
    {
      strcpy(Stk[i],Vchr_Stk[i]);
    }
  Ndx=NewIndex;
}

int CountChrArguments (int StartPos)
{
  int  i={0};
  int  ParenDepth={0};
  int  ArgCount={0};
  BOOL  HasContent={0};
  i=StartPos;
  while(i<=Ndx){
      if(strcmp(Stk[i],"(")==0){
          ParenDepth+=1;
          HasContent=TRUE;
          goto L1038;
        }
      if(strcmp(Stk[i],")")==0){
          if(ParenDepth==0 ){
              if(HasContent ){
                  ArgCount+=1;
                }
              return ArgCount;
            }
          else
            {
              ParenDepth-=1;
              HasContent=TRUE;
            }
          goto L1038;
        }
      if(strcmp(Stk[i],",")==0){
          if(ParenDepth==0 ){
              if(HasContent ){
                  ArgCount+=1;
                }
              HasContent=FALSE;
            }
          else
            {
              HasContent=TRUE;
            }
        }
      else
        {
          if(strcmp(ltrim(Stk[i]),"")!=0){
              HasContent=TRUE;
            }
        }

L1038:;

      i+=1;
    }
  return ArgCount;
}

void ProcessInjection ()
{
  static char Prev_gCurrentFunction[BCXSTRSIZE];
  if(strcmp(Prev_gCurrentFunction,gCurrentFunction)==0){
      return;
    }
  if(InFunction&&g_FoundLocalDynArray ){
      if(!InTypeDef&&!InCppTypeDef ){
          ScanFuncNamesTypes(gCurrentFunction);
          if((int)strlen(FunctionNameType.FunctionName) && strcmp(lcase(FunctionNameType.FunctionType),"string")!=0){
              strcpy(g_Injection, join(2,"DIM Bcx_RetVal AS",SPC));
              strcat(g_Injection,FunctionNameType.FunctionType);
              PassOne=TRUE;
              Inject(g_Injection);
              PassOne=TRUE;
              strcpy(Prev_gCurrentFunction,gCurrentFunction);
            }
        }
    }
}

void SplitDimAssignment ()
{
  int  FirstChar={0};
  int  HasRaw={0};
  int  iAsPos={0};
  int  iEqualPos={0};
  int  IsDimKeyword={0};
  int  iVarNamePos={0};
  int  LastOrig={0};
  char  Assignment[BCXSTRSIZE]={0};
  char  DeclPart[BCXSTRSIZE]={0};
  char  OrigVar[BCXSTRSIZE]={0};
  char  TestName[BCXSTRSIZE]={0};
  char  VarName[BCXSTRSIZE]={0};
  char  VarType[BCXSTRSIZE]={0};
  if(!m_iMatchWrd(Stk[1],"dim")&&!m_iMatchWrd(Stk[1],"local")&&!m_iMatchWrd(Stk[1],"static")&&!m_iMatchWrd(Stk[1],"raw")&&!m_iMatchWrd(Stk[1],"shared")&&!m_iMatchWrd(Stk[1],"global")){
      return;
    }
  iEqualPos=0;
  int ParenCount=0;
  for(int i=2; i<=Ndx; i++)
    {
      if(strcmp(Stk[i],"(")==0){
          ParenCount++;
        }
      if(strcmp(Stk[i],")")==0){
          ParenCount--;
        }
      if(ParenCount==0&&*Stk[i]==61 ){
          iEqualPos=i;
          goto L1039;
        }
    }
L1039:;
  if(iEqualPos==0 ){
      return;
    }
  HasRaw=FALSE;
  for(int i=1; i<=iEqualPos-1; i++)
    {
      if(m_iMatchWrd(Stk[i],"raw")){
          HasRaw=TRUE;
          goto L1040;
        }
    }
L1040:;
  iAsPos=0;
  for(int i=iEqualPos-1; i>=2; i+=-1)
    {
      if(m_iMatchWrd(Stk[i],"as")){
          iAsPos=i;
          goto L1041;
        }
    }
L1041:;
  if(iAsPos>0 ){
      strcpy(VarType,Stk[iAsPos+1]);
      iVarNamePos=0;
      for(int i=2; i<=iEqualPos-1; i++)
        {
          if(i==iAsPos||i==iAsPos+1 ){
              continue;
            }
          strcpy(TestName,No_Sigil(Stk[i]));
          FirstChar=*TestName;
          if((isalpha(FirstChar)||FirstChar==95)){
              char LowerName[BCXSTRSIZE];
              strcpy(LowerName,lcase(TestName));
              if(strcmp(LowerName,"dim")!=0  && strcmp(LowerName,"local")!=0  && strcmp(LowerName,"static")!=0  && strcmp(LowerName,"raw")!=0  && strcmp(LowerName,"global")!=0  && strcmp(LowerName,"shared")!=0  && strcmp(LowerName,"as")!=0  && strcmp(LowerName,"ptr")!=0  && strcmp(LowerName,"int")!=0  && strcmp(LowerName,"long")!=0  && strcmp(LowerName,"double")!=0  && strcmp(LowerName,"float")!=0  && strcmp(LowerName,"string")!=0  && strcmp(LowerName,"char")!=0){
                  iVarNamePos=i;
                  strcpy(VarName,TestName);
                  goto L1042;
                }
            }
        }
L1042:;
      if(VarName[0]==0 ){
          strcpy(VarName,No_Sigil(Stk[iAsPos-1]));
          iVarNamePos=iAsPos-1;
        }
    }
  else
    {
      if(m_iMatchWrd(Stk[2],"raw")){
          iVarNamePos=3;
        }
      else
        {
          iVarNamePos=2;
        }
      strcpy(VarName,No_Sigil(Stk[iVarNamePos]));
      int LastChar=(UCHAR)*(right(VarName,1));
      if(inchr(c_VARTYPES,vchr(1,LastChar))){
          strcpy(VarType,VarTypeLookup[inchr(c_VARTYPES,vchr(1,LastChar))]);
        }
      else
        {
          strcpy(VarType,"int");
        }
    }
  *Assignment=0;
  for(int i=iEqualPos+1; i<=Ndx; i++)
    {
      strcpy(Assignment, join(3,Assignment,Stk[i],SPC));
    }
  strcpy(Assignment,trim(Assignment));
  IsDimKeyword=m_iMatchWrd(Stk[1],"dim");
  strcpy(DeclPart, join(2,Stk[1],SPC));
  if(IsDimKeyword&&!HasRaw ){
      strcat(DeclPart,"RAW ");
    }
  for(int i=2; i<=iEqualPos-1; i++)
    {
      strcpy(DeclPart, join(3,DeclPart,Stk[i],SPC));
    }
  strcpy(DeclPart,trim(DeclPart));
  char AssignVarName[BCXSTRSIZE];
  if(iAsPos>0 ){
      strcpy(AssignVarName,VarName);
      if(iVarNamePos>0 ){
          strcpy(OrigVar,Stk[iVarNamePos]);
          LastOrig=(UCHAR)*(right(OrigVar,1));
          if(inchr(c_VARTYPES,vchr(1,LastOrig))){
              strcat(AssignVarName,vchr(1,LastOrig));
            }
        }
    }
  else
    {
      strcpy(AssignVarName,Stk[iVarNamePos]);
    }
  if(iAsPos==0&&inchr(c_VARTYPES,vchr(1,(UCHAR)*(right(Stk[iVarNamePos],1))))==0 ){
      return;
    }
  strcpy(Src, join(5,DeclPart," : ",AssignVarName," = ",Assignment));
  SplitLines(Src);
  *Src=0;
  Ndx=0;
}

void NormalizeStrConcat ()
{
  for(long k=1; k<=Ndx-1; k++)
    {
      if(strcmp(Stk[k],"+")!=0){
          continue;
        }
      char NextToken[BCXSTRSIZE];
      strcpy(NextToken,Stk[k+1]);
      if(strcmp(NextToken,"+")==0){
          continue;
        }
      if(strcmp(left(NextToken,1),DQ)==0){
          strcpy(Stk[k],"&");
          continue;
        }
      if(instr(FuncStrNames,join(2,SPC,NextToken))){
          strcpy(Stk[k],"&");
          strcpy(Stk[k+1], join(2,Stk[k+1],"$"));
          continue;
        }
      if(inchr(NextToken,"$")){
          strcpy(Stk[k],"&");
          continue;
        }
      if(isdigit(*NextToken)){
          continue;
        }
      if(Im_UDT_String(NextToken)){
          strcpy(Stk[k],"&");
          strcpy(Stk[k+1], join(2,Stk[k+1],"$"));
          continue;
        }
      if(inchr(NextToken,".")){
          if(Im_UDT_Single(NextToken)){
              continue;
            }
          if(Im_UDT_Double(NextToken)){
              continue;
            }
          int  varid={0};
          int  vtype={0};
          vtype=CheckLocal(NextToken,&(varid));
          if(vtype==vt_UNKNOWN ){
              vtype=CheckGlobal(NextToken,&(varid));
            }
          if(vtype==vt_UNKNOWN ){
              strcpy(Stk[k],"&");
              strcpy(Stk[k+1], join(2,Stk[k+1],"$"));
            }
          continue;
        }
      int  varid={0};
      int  vtype={0};
      vtype=CheckLocal(NextToken,&(varid));
      if(vtype==vt_UNKNOWN ){
          vtype=CheckGlobal(NextToken,&(varid));
        }
      if(vtype==vt_STRVAR||vtype==vt_CHAR||vtype==vt_SCHAR ){
          strcpy(Stk[k],"&");
        }
    }
}

void RBForTransform ()
{
  char Kopy[BCXSTRSIZE];
  strcpy(Kopy,trim(Src));
  if(LeftStr(Kopy,"rbfor",1)){
      strcpy(Src,iReplace_NQ(Src,"AUTO","auto"));
      strcpy(Src,iReplace_NQ(Src,"rbfor","! for "));
      strcat(Src," { ");
    }
  if(LeftStr(Kopy,"rbnext",1)){
      strcpy(Src,"}");
    }
  if(LeftStr(Kopy,"rbexit",1)){
      strcpy(Src,"break");
    }
}

void StripExtraDefWndProcs ()
{
  char Source[BCXSTRSIZE];
  char CurrLin[BCXSTRSIZE];
  char PrevLin[BCXSTRSIZE];
  if((FP1=fopen(FileOut, "rb"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
   }
  if((FP2=fopen("$Bcx$Temp$File$", "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", "$Bcx$Temp$File$"); exit(1);
   }
  while(!EoF(FP1)){
      Source[0]=0;
      fgets(Source, 2048 , FP1);
        if(feof(FP1) || (Source[strlen(Source)-1]==10))
          {
           Source[strcspn(Source,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP1));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Source);
            exit(1);
          }
      strcpy(CurrLin,left(ltrim(Source),20));
      if(strcmp(CurrLin,"return DefWindowProc")!=0){
          fprintf(FP2,"%s\n",Source);
          strcpy(PrevLin,left(ltrim(Source),7));
          continue;
        }
      if(strcmp(CurrLin,"return DefWindowProc")==0  && strcmp(PrevLin,"return ")!=0){
          fprintf(FP2,"%s\n",Source);
        }
      strcpy(PrevLin,left(ltrim(Source),7));
    }
  if(FP1)
   {
     fclose(FP1);
     FP1=NULL;
   }
  if(FP2)
   {
     fclose(FP2);
     FP2=NULL;
   }
  DeleteFile ((FileOut));
  MoveFile ("$Bcx$Temp$File$",FileOut );
}

int iMatch (PCTSTR  Arg,PCTSTR  MatchStr,int mt)
{
  int  L1;
  int  L2;
  if(mt==2 ){
      L1=(int)strlen(Arg);
      L2=(int)strlen(MatchStr);
      if(L1<L2 ){
          return FALSE;
        }
      Arg=(Arg+L1)-L2;
    }
  while(*MatchStr){
      if(ISNULL(Arg)){
          return FALSE;
        }
      if((*Arg|32)!=(*MatchStr|32)){
          return FALSE;
        }
      Arg++;
      MatchStr++;
    }
  if(mt&&NOTNULL(Arg)){
      return FALSE;
    }
  else
    {
      return TRUE;
    }
}

int iMatchNQ (char* Arg,char* MatchStr)
{
  int mi=0;
  PCHAR  a;
  a=Arg;
  while(MatchStr[mi]){
      if(*a==c_DblQt ){
          mi=0;
          while(*(++a)!=c_DblQt){
              if(*a==0 ){
                  return FALSE;
                }
            }
        }
      if(a[mi]==0 ){
          return FALSE;
        }
      if((a[mi]|32)!=(MatchStr[mi]|32)){
          a++;
          mi=(-1);
        }
      mi++;
    }
  return  CAST (int,(a-Arg)+1);
}

int GetBracketPair (int iStart,int iEnd,int iDir)
{
  for(int i=iStart; (iDir>=0 ? i<=iEnd : i>=iEnd); i+=iDir)
    {
      if(*Stk[i]==91&&*Stk[i+1]==93 ){
          return i;
        }
    }
  return 0;
}

int GetAsPos (int iStart,int iEnd,int iDir)
{
  for(int i=iStart; (iDir>=0 ? i<=iEnd : i>=iEnd); i+=iDir)
    {
      if(m_iMatchWrd(Stk[i],"as")){
          return i;
        }
    }
  return 0;
}

void BuildStr (int iStart,int iEnd,char* szBuild)
{
  *szBuild=0;
  for(int i=iStart; i<=iEnd; i++)
    {
      strcat(szBuild,Stk[i]);
    }
}

char * No_Sigil (char *StringArg)
{
  char  *BCX_RetStr={0};
  char LTmp[BCXSTRSIZE];
  if(iMatchNQ(StringArg,"%")){
      if(strcmp(trim(StringArg),"%")==0){
          BCX_RetStr = BCX_TempStr(strlen(" % "));
          strcpy(BCX_RetStr," % ");
          return BCX_RetStr;
        }
    }
  if(iMatchNQ(StringArg,"!=")){
      BCX_RetStr = BCX_TempStr(strlen(StringArg));
      strcpy(BCX_RetStr,StringArg);
      return BCX_RetStr;
    }
  strcpy(LTmp,StringArg);
  RemoveAll(LTmp,c_VARTYPES,1);
  BCX_RetStr = BCX_TempStr(strlen(LTmp));
  strcpy(BCX_RetStr,LTmp);
  return BCX_RetStr;
}

void BuildDelimStr (int iStart,int iEnd,char* szBuild)
{
  *szBuild=0;
  for(int i=iStart; i<=iEnd; i++)
    {
      if((int)strlen(Stk[i])==0 ){
          continue;
        }
      if(strcmp(Stk[i],"!")==0){
          strcat(szBuild," ! ");
          continue;
        }
      if(*Stk[i]==95 ){
          strcpy(szBuild, join(3,szBuild,SPC,Stk[i]));
        }
      else
        {
          strcat(szBuild,Stk[i]);
          if((int)strlen(Stk[i])==1&&ispunct(*Stk[i])){
              continue;
            }
        }
      if(*Stk[2]==61 ){
          continue;
        }
      if(i==iEnd ){
          continue;
        }
      if((int)strlen(Stk[i+1])==1&&ispunct(*Stk[i+1])){
          continue;
        }
      strcat(szBuild,SPC);
    }
  if(RightStr(szBuild," , 1);")){
      strcpy(szBuild,replace(szBuild," , 1);",", 1);"));
    }
}

void BuildCleanStr (int iStart,int iEnd,char* szBuild)
{
  BuildDelimStr(iStart,iEnd,szBuild);
  strcpy(szBuild,No_Sigil(szBuild));
}

void WriteCleanTokens (int iStart,int iEnd)
{
  char LTmp[BCXSTRSIZE];
  BuildCleanStr(iStart,iEnd,LTmp);
  fprintf(FP_WRITE,"%s\n",LTmp);
}

int HasThisToken (char* sToken)
{
  int ThisToken=0;
    {
    int  j;
    for(j=1; j<=Ndx && m_IAmNot(ThisToken); j++)
      {
        ThisToken=m_iMatchWrd(Stk[j],sToken);
      }
      }
  return ThisToken;
}

int FoundMacro ()
{
  int IsMacro=FALSE;
  FastLexer(Src," (","");
  char szMacroCheck[BCXSTRSIZE];
  strcpy(szMacroCheck,lcase(Stk[1]));
  if(iMatchNQ("handle_msg handle_cmd bcx_resource msghandler cmdhandler end",szMacroCheck)){
      if(strcmp(szMacroCheck,"handle_msg")==0){
          CheckMatchedPairs();
          ProcessMsgCracker();
          IsMacro=TRUE;
          goto L1055;
        }
      if(strcmp(szMacroCheck,"handle_cmd")==0){
          CheckMatchedPairs();
          ProcessCmdHandler();
          IsMacro=TRUE;
          goto L1055;
        }
      if(strcmp(szMacroCheck,"bcx_resource")==0){
          Use_GenResFile=TRUE;
          fprintf(FP_RES,"%s\n",mid(Src,14));
          IsMacro=TRUE;
          goto L1055;
        }
      if(strcmp(szMacroCheck,"msghandler")==0  || strcmp(szMacroCheck,"cmdhandler")==0){
          Inject_Local_Bcx_RetVal=TRUE;
          CheckMatchedPairs();
          ProcessMsgHandler();
          IsMacro=TRUE;
          goto L1055;
        }
      if(strcmp(szMacroCheck,"end")==0){
          if(ISTRUE(m_iMatchWrd(Stk[2],"handler"))){
              CheckMatchedPairs();
              ProcessMsgHandlerEnd();
              IsMacro=TRUE;
            }
        }

L1055:;

    }
  if(IsMacro==TRUE ){
      *Src=0;
    }
  return IsMacro;
}

void Process_ASC_Function (int St_idx)
{
  int i={0};
  int j=GetNumArgs(St_idx+2,&(i));
  if(*Stk[St_idx+2]==*DQ ){
      if(j||*Stk[St_idx+3]!=41 ){
          strcpy(Stk[St_idx],"asc");
          Use_Asc=Use_Proto=TRUE;
        }
      else
        {
          if(strcmp(Stk[St_idx+2],DDQ)==0){
              strcpy(Stk[St_idx],"0");
            }
          else
            {
              strcpy(Stk[St_idx],str(CAST (double,(UCHAR)*(Stk[St_idx+2]+1)),TRUE));
            }
          *Stk[St_idx+1]=0;
          *Stk[St_idx+2]=0;
          *Stk[St_idx+3]=0;
        }
    }
  else
    {
      if(j>0 ){
          strcpy(Stk[i],"+");
        }
      strcpy(Stk[St_idx],"(UCHAR)*");
    }
}

void ActivityFlags ()
{
  if(ShowStatus ){
      DisplayStatus();
    }
  if(ISTRUE(TraceFlag&&InFunction)){
      if(ISFALSE(m_iMatchLft(Src,"$trace"))){
          if(ISFALSE(m_iMatchLft(Src,"end "))&&ISZERO(iMatchNQ(Src,"function"))){
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n","// [",trim(FileNames[FileNdx])," - ",str(LineNum[FileNdx],1),"] ",Src);
              char Tmp[BCXSTRSIZE]={0};
              strcpy(Tmp,trim(FileNames[FileNdx]));
              strcpy(Tmp,replace(Tmp,BKSLASH1,BKSLASH2));
              strcpy(Tmp, join(5,SPC,Tmp," - ",str(LineNum[FileNdx])," \\n"));
              strcpy(Tmp, join(3,"printf(",enc(Tmp),");"));
              fprintf(FP_WRITE,"%s\n",Tmp);
            }
        }
    }
  if(SrcFlag ){
      if(ISFALSE(m_iMatchLft(Src,"$sourc"))&&*Src!=33 ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n","// [",trim(FileNames[FileNdx])," - ",str(LineNum[FileNdx],1),"] ",Src);
        }
    }
}

void DisplayStatus ()
{
  locate(5,1,0 );
  printf("%s\n",space(150));
  locate(5,1,0 );
  printf("%s%s%s %d \n","Processing Module: ",trim(FileNames[FileNdx])," - Line:",(int)LineNum[FileNdx]);
  locate(6,1,0 );
  printf("%s\n",space(1000));
  if(c_BCX_COLORS ){
      color(10,0 );
    }
  locate(6,1,0 );
  printf("%s\n",strim(AbortSrc));
  if(c_BCX_COLORS ){
      color(13,0 );
    }
  locate(10,1,0 );
  printf("%s\n","Press any key to cancel");
  BCX_Sleep(25);
  if(_kbhit()){
      _fcloseall();
      BCX_Sleep(100);
      DeleteFile (("BC.out"));
      DeleteFile (("BC.c"));
      DeleteFile (("BC.cpp"));
      PopColors();
      printf("%s\n","Cancelled by user. Unfinished translation files removed.");
      fflush(stdout);
      ExitProcess(0);
    }
  PopColors();
}

char * GetVarTypeName (int i)
{
  char  *BCX_RetStr={0};
  char A[BCXSTRSIZE];
  if(i==vt_INTEGER ){
      strcpy(A,"int");
      goto L1056;
    }
  if(i==vt_STRVAR ){
      strcpy(A,"char *");
      goto L1056;
    }
  if(i==vt_STRLIT ){
      strcpy(A,"STRLIT");
      goto L1056;
    }
  if(i==vt_UNKNOWN ){
      strcpy(A,"UNKNOWN");
      goto L1056;
    }
  if(i==vt_SINGLE ){
      strcpy(A,"float");
      goto L1056;
    }
  if(i==vt_DOUBLE ){
      strcpy(A,"double");
      goto L1056;
    }
  if(i==vt_LDOUBLE ){
      strcpy(A,"LDOUBLE");
      goto L1056;
    }
  if(i==vt_DECFUNC ){
      strcpy(A,"DECFUNC");
      goto L1056;
    }
  if(i==vt_NUMBER ){
      strcpy(A,"NUMBER");
      goto L1056;
    }
  if(i==vt_FILEPTR ){
      strcpy(A,"FILE*");
      goto L1056;
    }
  if(i==vt_UDT ){
      strcpy(A,"struct");
      goto L1056;
    }
  if(i==vt_STRUCT ){
      strcpy(A,"struct");
      goto L1056;
    }
  if(i==vt_UNION ){
      strcpy(A,"union");
      goto L1056;
    }
  if(i==vt_PSTR ){
      strcpy(A,"PSTR");
      goto L1056;
    }
  if(i==vt_BSTR ){
      strcpy(A,"BSTR");
      goto L1056;
    }
  if(i==vt_BOOL ){
      strcpy(A,"BOOL");
      goto L1056;
    }
  if(i==vt_CHAR ){
      strcpy(A,"char");
      goto L1056;
    }
  if(i==vt_SCHAR ){
      strcpy(A,"signed char");
      goto L1056;
    }
  if(i==vt_PSTRPTR ){
      strcpy(A,"PSTR *");
      goto L1056;
    }
  if(i==vt_CHARPTR ){
      strcpy(A,"char");
      goto L1056;
    }
  if(i==vt_PCHAR ){
      strcpy(A,"PCHAR");
      goto L1056;
    }
  if(i==vt_VOID ){
      strcpy(A,"void");
      goto L1056;
    }
  if(i==vt_LONG ){
      strcpy(A,"long");
      goto L1056;
    }
  if(i==vt_DWORD ){
      strcpy(A,"ULONG");
      goto L1056;
    }
  if(i==vt_FARPROC ){
      strcpy(A,"FARPROC");
      goto L1056;
    }
  if(i==vt_PBYTE ){
      strcpy(A,"PBYTE");
      goto L1056;
    }
  if(i==vt_LRESULT ){
      strcpy(A,"LRESULT");
      goto L1056;
    }
  if(i==vt_BYTE ){
      strcpy(A,"BYTE");
      goto L1056;
    }
  if(i==vt_SHORT ){
      strcpy(A,"short");
      goto L1056;
    }
  if(i==vt_USHORT ){
      strcpy(A,"USHORT");
      goto L1056;
    }
  if(i==vt_SSHORT ){
      strcpy(A,"signed short");
      goto L1056;
    }
  if(i==vt_COLORREF ){
      strcpy(A,"COLORREF");
      goto L1056;
    }
  if(i==vt_UINT ){
      strcpy(A,"UINT");
      goto L1056;
    }
  if(i==vt_ULONG ){
      strcpy(A,"ULONG");
      goto L1056;
    }
  if(i==vt_ULONGLONG ){
      strcpy(A,"ULONGLONG");
      goto L1056;
    }
  if(i==vt_LLONG ){
      strcpy(A,"long long");
      goto L1056;
    }
  if(i==vt_HWND ){
      strcpy(A,"HWND");
      goto L1056;
    }
  if(i==vt_HANDLE ){
      strcpy(A,"HANDLE");
      goto L1056;
    }
  if(i==vt_HINSTANCE ){
      strcpy(A,"HINSTANCE");
      goto L1056;
    }
  if(i==vt_HDC ){
      strcpy(A,"HDC");
      goto L1056;
    }
  if(i==vt_SAFEARRAY ){
      strcpy(A,"SAFEARRAY");
      goto L1056;
    }
  if(i==vt_VARIANT ){
      strcpy(A,"VARIANT");
      goto L1056;
    }
  if(i==vt_WNDCLASSEX ){
      strcpy(A,"WNDCLASSEX");
      goto L1056;
    }
  if(i==vt_HFONT ){
      strcpy(A,"HFONT");
      goto L1056;
    }
  if(i==vt_DOCINFO ){
      strcpy(A,"DOCINFO");
      goto L1056;
    }
  if(i==vt_LOGFONT ){
      strcpy(A,"LOGFONT");
      goto L1056;
    }
  if(i==vt_TEXTMETRIC ){
      strcpy(A,"TEXTMETRIC");
      goto L1056;
    }
  if(i==vt_WINBOOL ){
      strcpy(A,"BOOL");
      goto L1056;
    }
  if(i==vt_BITMAPINFO ){
      strcpy(A,"BITMAPINFO");
      goto L1056;
    }
  if(i==vt_HBITMAP ){
      strcpy(A,"HBITMAP");
      goto L1056;
    }
  if(i==vt_CY ){
      strcpy(A,"CY");
      goto L1056;
    }
  if(i==vt_DATE ){
      strcpy(A,"DATE");
      goto L1056;
    }
  if(i==vt_DECIMAL ){
      strcpy(A,"DECIMAL");
      goto L1056;
    }
  if(i==vt_IDispatch ){
      strcpy(A,"IDispatch");
      goto L1056;
    }
  if(i==vt_IUnknown ){
      strcpy(A,"IUnknown");
      goto L1056;
    }
  if(i==vt_PVOID ){
      strcpy(A,"PVOID");
      goto L1056;
    }
  if(i==vt_SCODE ){
      strcpy(A,"SCODE");
      goto L1056;
    }
  if(i==vt_WORD ){
      strcpy(A,"WORD");
      goto L1056;
    }
  if(i==vt_VARIANT_BOOL ){
      strcpy(A,"VARIANT_BOOL");
    }
  else
    {
      *A=0;
    }

L1056:;

  BCX_RetStr = BCX_TempStr(strlen(A));
  strcpy(BCX_RetStr,A);
  return BCX_RetStr;
}

void LoopErrorMsg ()
{
  char sError[BCXSTRSIZE];
  if(LoopTypeCnt>1 ){
      strcpy(sError,"Multiple loop errors, innermost starting at");
    }
  else
    {
      strcpy(sError,"Loop error starting at");
    }
  strcpy(sError, join(3,sError,str(LoopType[LoopTypeCnt].iLoopLine),SPC));
  if(LoopType[LoopTypeCnt].iLoopType==lt_DOLOOP ){
      strcat(sError,"DO without LOOP");
      goto L1057;
    }
  if(LoopType[LoopTypeCnt].iLoopType==lt_DOWHILELOOP||LoopType[LoopTypeCnt].iLoopType==lt_DOUNTILLOOP ){
      strcat(sError,"DO CONDITION without LOOP");
      goto L1057;
    }
  if(LoopType[LoopTypeCnt].iLoopType==lt_WHILEWEND ){
      strcat(sError,"WHILE without WEND");
      goto L1057;
    }
  if(LoopType[LoopTypeCnt].iLoopType==lt_FORNEXT ){
      strcat(sError,"FOR without NEXT");
      goto L1057;
    }
  if(LoopType[LoopTypeCnt].iLoopType==lt_SELECT ){
      strcat(sError,"SELECT without END SELECT");
      goto L1057;
    }
  if(LoopType[LoopTypeCnt].iLoopType==lt_FORXNEXT ){
      strcat(sError,"XFOR without XNEXT");
    }

L1057:;

  Abort(sError);
}

char * LoopTypeName (int iLoopType)
{
  char  *BCX_RetStr={0};
  char sLoopType[BCXSTRSIZE];
  if(iLoopType==lt_DOLOOP ){
      strcpy(sLoopType,"DO");
      goto L1058;
    }
  if(iLoopType==lt_DOWHILELOOP||iLoopType==lt_DOUNTILLOOP ){
      strcpy(sLoopType,"DO CONDITION");
      goto L1058;
    }
  if(iLoopType==lt_WHILEWEND ){
      strcpy(sLoopType,"WHILE");
      goto L1058;
    }
  if(iLoopType==lt_FORNEXT ){
      strcpy(sLoopType,"FOR");
      goto L1058;
    }
  if(iLoopType==lt_SELECT ){
      strcpy(sLoopType,"SELECT");
      goto L1058;
    }
  if(iLoopType==lt_FORXNEXT ){
      strcpy(sLoopType,"XFOR");
    }
  else
    {
      *sLoopType=0;
    }

L1058:;

  BCX_RetStr = BCX_TempStr(strlen(sLoopType));
  strcpy(BCX_RetStr,sLoopType);
  return BCX_RetStr;
}

void MakeFreeGlobals ()
{
  strcpy(Src,"SUB FreeGlobals");
  PassOne=TRUE;
  Inject(Src);
  while(GlobalDynaCnt){
      fprintf(FP_WRITE,"%s%s%s\n",SPC,SPC,GlobalDynaStr[GlobalDynaCnt]);
      GlobalDynaCnt--;
    }
  strcpy(Src,"END SUB");
  PassOne=TRUE;
  Inject(Src);
}

void ProcessSetCommand (int GS)
{
  struct _UDT_VARCODE_ATTRIBUTES  VarCode;
  int id;
  int ii;
  int iIsConst;
  int IsPointer;
  int iThisToken;
  int iFoundEqual;
  int SetString;
  int vt1;
  char szIsConst[BCXSTRSIZE];
  char LTmp[BCXSTRSIZE];
  char CVar[BCXSTRSIZE];
  char L_DimType[BCXSTRSIZE];
  FILE*  SaveFP;
  VarCode.UseInLine=UseInLine;
  VarCode.IsPtrFlag=0;
  SaveFP=FP_WRITE;
  SetString=0;
  if(InNameSpace||InClass ){
      FP_WRITE=FP_UDT;
    }
  else if(InFunction==FALSE ){
      FP_WRITE=FP_SET;
    }
  if(iMatchNQ(Src,"$")&&tally(Src,"[")>1 ){
      strcpy(Src,strim(Src));
      strcpy(Src,IRemoveStr(Src,"as string"));
      strcpy(Src,IRemoveStr(Src,"as char"));
      strcat(Src," AS char");
    }
  strcat(Src,"=");
  PassOne=TRUE;
  PreParse(Src);
  FixUps();
  *gszType=0;
  *szIsConst=0;
  iThisToken=m_GetAsPosF(1,Ndx);
  if(iThisToken ){
      *Stk[iThisToken++]=0;
      strcpy(gszType,Stk[iThisToken]);
      if(m_iMatchWrd(gszType,"const")){
          strcpy(szIsConst,"const ");
          *Stk[iThisToken++]=0;
          strcpy(gszType,Stk[iThisToken]);
        }
      *Stk[iThisToken]=0;
    }
  if(ISNULL(gszType)){
      strcpy(gTmpStr,Stk[2]);
      SetString=DataType(gTmpStr);
      VarCode.Methd=mt_ProcessSetCommand;
      strcpy(VarCode.Token,gTmpStr);
      VarCode.VarNo=SetString;
      GetVarCode(&(VarCode),"set command");
      if(GS ){
          fprintf(FP_WRITE,"%s%s",Scoot,RemoveStr(VarCode.StaticOut,"static "));
        }
      else
        {
          fprintf(FP_WRITE,"%s%s",Scoot,VarCode.StaticOut);
        }
      *LTmp=0;
      strcpy(CVar,No_Sigil(Stk[2]));
      ValidateVarName(CVar);
      vt1=DataType(Stk[2]);
      BuildStr(3,Ndx,LTmp);
      if(vt1==vt_STRVAR&&NOTNULL(LTmp)){
          strcat(LTmp,"[BCXSTRSIZE]");
        }
      if(InFunction==FALSE ){
          AddGlobal(CVar,vt1,0,LTmp,0,0,0,1);
        }
      else
        {
          AddLocal(CVar,vt1,0,LTmp,0,0,1);
        }
    }
  else
    {
      strcpy(CVar,No_Sigil(Stk[2]));
      if(GS ){
          fprintf(FP_WRITE,"%s%s%s%s%s",Scoot,szIsConst,gszType,SPC,CVar);
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s",Scoot,"static ",szIsConst,gszType,SPC,CVar);
        }
      if(*szIsConst ){
          iIsConst=1;
        }
      else
        {
          iIsConst=0;
        }
      strcpy(L_DimType,RemoveStr(gszType,"*"));
      GetTypeInfo(gszType,&(IsPointer), &id, &vt1);
      if(vt1==vt_STRVAR ){
          strcat(L_DimType,"[BCXSTRSIZE]");
        }
      if(InFunction==FALSE ){
          AddGlobal(CVar,vt1,id,L_DimType,IsPointer,0,0,1,iIsConst);
        }
      else
        {
          AddLocal(CVar,vt1,id,L_DimType,IsPointer,0,1,iIsConst);
        }
    }
  iThisToken=2;
  iFoundEqual=FALSE;
  for(;;)
    {
      iThisToken++;
      if(*Stk[iThisToken]==61 ){
          iFoundEqual=TRUE;
        }
      if(SetString==vt_STRVAR&&iFoundEqual ){
          fprintf(FP_WRITE,"%s","[BCXSTRSIZE]=");
        }
      else
        {
          fprintf(FP_WRITE,"%s",Stk[iThisToken]);
        }
      if(*Stk[iThisToken]==61 ){
          goto L1060;
        }
      if(iThisToken==Ndx ){
          goto L1060;
        }
    }
L1060:;
  fprintf(FP_WRITE,"%s\n","");
  fprintf(FP_WRITE,"%s\n","  {");
  while(!EoF(SourceFile)){
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      Sanitize_Code(Src);
      if(JoinLines(Src)){
          continue;
        }
      PassOne=TRUE;
      PreParse(Src);
      PassOne=FALSE;
      if(m_iMatchWrd(Src,"endset")){
          goto L1061;
        }
      TokenSubstitutions(2);
      if(*Src ){
          fprintf(FP_WRITE,"%s",SPC);
          for(ii=1; ii<=Ndx; ii++)
            {
              fprintf(FP_WRITE,"%s",No_Sigil(Stk[ii]));
            }
          fprintf(FP_WRITE,"%s\n","");
        }
    }
L1061:;
  fprintf(FP_WRITE,"%s\n","};");
  fprintf(FP_WRITE,"%s\n","");
  *Src=0;
  FP_WRITE=SaveFP;
}

void EnableProject ()
{
  static int iWasHere;
  if(iWasHere ){
      return;
    }
  char cHFn[BCXSTRSIZE];
  iWasHere++;
  strcpy(Project_Main,trim(RemoveStr(mid(Src,9),DQ)));
  strcpy(Project_Main,extract(Project_Main,"'"));
  strcpy(Project_Main,extract(Project_Main,"."));
  Use_Project=TRUE;
  if(inchr(command(1),vchr(1,92))){
      strcpy(cHFn,mid(command(1),InstrRev(command(1),vchr(1,92),0)+1));
    }
  else
    {
      strcpy(cHFn,command(1));
    }
  if(inchr(cHFn,".")){
      strcpy(cHFn,mid(cHFn,1,InstrRev(cHFn,".",0)-1));
    }
  fprintf(FP_HDR,"%s%s%s\n","#define __BCX_HEADER_",ucase(cHFn),"__");
}

int SubVarType (int TokenNum)
{
  int j=0;
  int iVarType=CheckLocal(Stk[TokenNum],&(j));
  if(iVarType==vt_CHAR||iVarType==vt_SCHAR ){
      if(*LocalVars[j].VarDim!=91&&LocalVars[j].VarPntr==0 ){
          iVarType=vt_INTEGER;
        }
    }
  else
    {
      if(iVarType==vt_UNKNOWN ){
          iVarType=CheckGlobal(Stk[TokenNum],&(j));
          if(iVarType==vt_CHAR||iVarType==vt_SCHAR ){
              if(*GlobalVars[j].VarDim!=91&&GlobalVars[j].VarPntr==0 ){
                  iVarType=vt_INTEGER;
                }
            }
        }
    }
  j=(UCHAR)*(right(Stk[TokenNum],1));
  if(iVarType==vt_STRVAR||iVarType==vt_CHAR||iVarType==vt_SCHAR ){
      if(j!=36 ){
          strcpy(Stk[TokenNum], join(2,Stk[TokenNum],"$"));
        }
      goto L1063;
    }
  if(iVarType==vt_INTEGER ){
      if(j!=37 ){
          strcpy(Stk[TokenNum], join(2,Stk[TokenNum],"%"));
        }
      goto L1063;
    }
  if(iVarType==vt_SINGLE ){
      if(j!=33 ){
          strcpy(Stk[TokenNum], join(2,Stk[TokenNum],"!"));
        }
      goto L1063;
    }
  if(iVarType==vt_DOUBLE ){
      if(j!=35 ){
          strcpy(Stk[TokenNum], join(2,Stk[TokenNum],"#"));
        }
      goto L1063;
    }
  if(iVarType==vt_LDOUBLE ){
      if(j!=96 ){
          strcpy(Stk[TokenNum], join(2,Stk[TokenNum],"`"));
        }
    }

L1063:;

  return iVarType;
}

char * PrintWriteFormat (int DoWrite)
{
  char  *BCX_RetStr={0};
  char Arg[BCXSTRSIZE];
  int Argcount;
  char Frmat[BCXSTRSIZE];
  int iThisToken;
  int iVarType;
  char LZZ[BCXSTRSIZE];
  int SuppressCRLF;
  int NextArgcount;
  char PWF_Cast[BCXSTRSIZE];
  char Tmp[BCXSTRSIZE];
  struct _UDT_ARG_TYPE  Stak[128];
  int x;
  char Testing[BCXSTRSIZE]={0};
  int Dot={0};
  SuppressCRLF=FALSE;
  NextArgcount=1;
  Argcount=0;
  *Frmat=0;
  *Arg=0;
  *LZZ=0;
  if(strcmp(Stk[Ndx],";")==0){
      SuppressCRLF=TRUE;
      Ndx--;
    }
  if(Ndx==1 ){
      goto PRINTWRITELABEL;
    }
  Stak[1].ArgType=(-1);
  iThisToken=2;
  for(int i=1; i<=Ndx; i++)
    {
      if(strcmp(Stk[i],"(int)strlen")==0){
          strcpy(Stk[i],"strlen");
        }
    }
  for(int i=2; i<=Ndx; i++)
    {
      if(Im_UDT_String(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"$"));
        }
      if(Im_UDT_Single(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"!"));
        }
      if(Im_UDT_Double(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
    }
  for(int i=2; i<=Ndx; i++)
    {
      x=CheckType(Stk[i]);
      if(x==vt_STRVAR||x==vt_PCHAR||x==vt_CHARPTR ){
          strcpy(Stk[i], join(2,Stk[i],"$"));
          goto L1067;
        }
      if(x==vt_SINGLE ){
          strcpy(Stk[i], join(2,Stk[i],"!"));
          goto L1067;
        }
      if(x==vt_DOUBLE ){
          strcpy(Stk[i], join(2,Stk[i],"#"));
          goto L1067;
        }
      if(x==vt_LDOUBLE ){
          strcpy(Stk[i], join(2,Stk[i],"`"));
        }

L1067:;

    }
  for(int i=2; i<=Ndx; i++)
    {
      strcpy(Testing, join(4,SPC,No_Sigil(Stk[i]),"$",SPC));
      Dot=iMatchNQ(Stk[i],".");
      if(Dot ){
          strcpy(Testing, join(2,SPC,mid(Testing,Dot+2)));
        }
      if(instr(FuncStrNames,Testing)){
          if(!iMatchNQ(Stk[i],"$")){
              strcpy(Stk[i], join(2,Stk[i],"$"));
            }
        }
    }
  for(int i=2; i<=Ndx; i++)
    {
      strcpy(Testing, join(4,SPC,No_Sigil(Stk[i]),"!",SPC));
      Dot=iMatchNQ(Stk[i],".");
      if(Dot ){
          strcpy(Testing, join(2,SPC,mid(Testing,Dot+2)));
        }
      if(instr(FuncSglNames,Testing)){
          if(!iMatchNQ(Stk[i],"!")){
              strcpy(Stk[i], join(2,Stk[i],"!"));
            }
        }
    }
  for(int i=2; i<=Ndx; i++)
    {
      strcpy(Testing, join(4,SPC,No_Sigil(Stk[i]),"#",SPC));
      Dot=iMatchNQ(Stk[i],".");
      if(Dot ){
          strcpy(Testing, join(2,SPC,mid(Testing,Dot+2)));
        }
      if(instr(FuncDblNames,Testing)){
          if(!iMatchNQ(Stk[i],"#")){
              strcpy(Stk[i], join(2,Stk[i],"#"));
            }
        }
    }
  while(iThisToken<=Ndx){
      strcpy(Tmp,No_Sigil(Stk[iThisToken]));
      if(strcmp(Tmp,"BCX_DynaCallA")!=0  && strcmp(Tmp,"BCX_DynaCallB")!=0){
          iVarType=SubVarType(iThisToken);
          if(Stak[NextArgcount].ArgType==(-1)){
              if(iVarType==vt_CHAR||iVarType==vt_SCHAR||iVarType==vt_STRVAR||iVarType==vt_INTEGER||iVarType==vt_SINGLE||iVarType==vt_DOUBLE||iVarType==vt_LDOUBLE ){
                  Stak[NextArgcount].ArgType=iVarType;
                }
            }
          if(*Stk[iThisToken]==40 ){
              int iCnt=0;
              for(;;)
                {
                  if(*Stk[iThisToken]==40 ){
                      iCnt++;
                    }
                  if(*Stk[iThisToken]==41 ){
                      iCnt--;
                    }
                  strcat(Arg,Stk[iThisToken]);
                  iThisToken++;
                  if(iCnt<=0||iThisToken>=Ndx ){
                      goto L1073;
                    }
                }
L1073:;
            }
          if(*Stk[iThisToken]==91 ){
              int iCnt=0;
              for(;;)
                {
                  if(*Stk[iThisToken]==91 ){
                      iCnt++;
                    }
                  if(*Stk[iThisToken]==93 ){
                      iCnt--;
                    }
                  strcat(Arg,Stk[iThisToken]);
                  iThisToken++;
                  if(*Stk[iThisToken]==91&&iCnt==0 ){
                      continue;
                    }
                  if(iCnt<=0||iThisToken>=Ndx ){
                      goto L1074;
                    }
                }
L1074:;
            }
          if(*Stk[iThisToken]==59||*Stk[iThisToken]==44||*Stk[iThisToken]==38 ){
              Argcount++;
              NextArgcount++;
              strcpy(Stak[Argcount].Arg,Arg);
              Stak[NextArgcount].ArgType=(-1);
              *Arg=0;
              iThisToken++;
            }
          else
            {
              strcat(Arg,Stk[iThisToken]);
              iThisToken++;
            }
        }
      else
        {
          strcat(Arg,Stk[iThisToken]);
          iThisToken++;
        }
    }
  Argcount++;
  NextArgcount++;
  strcpy(Stak[Argcount].Arg,Arg);
  *Arg=0;
  for(iThisToken=1; iThisToken<=Argcount; iThisToken++)
    {
      iVarType=Stak[iThisToken].ArgType;
      if(iVarType==(-1)){
          strcpy(LZZ,extract(Stak[iThisToken].Arg,"("));
          iVarType=DataType(LZZ);
        }
      if(iVarType==vt_INTEGER ){
          if(iMatchNQ(LZZ,".")==0 ){
              int indx={0};
              int A=CheckLocal(LZZ,&(indx));
              if(A==vt_UNKNOWN ){
                  A=CheckGlobal(LZZ,&(indx));
                  if(A!=vt_UNKNOWN ){
                      iVarType=GlobalVars[indx].VarType;
                    }
                }
              else
                {
                  iVarType=LocalVars[indx].VarType;
                }
            }
        }
      if(iVarType==vt_STRLIT||iVarType==vt_STRVAR||iVarType==vt_CHAR||iVarType==vt_SCHAR ){
          if(DoWrite ){
              strcpy(Frmat, join(7,Frmat,"\\",DQ,"%s","\\",DQ,","));
            }
          else
            {
              strcat(Frmat,"%s");
            }
          if(LeftStr(LZZ,"BCX_DynaCall")){
              strcpy(Arg, join(3,Arg,",(char*)",Stak[iThisToken].Arg));
            }
          else
            {
              strcpy(Arg, join(3,Arg,",",Stak[iThisToken].Arg));
            }
          goto L1076;
        }
      if(iVarType==vt_DOUBLE||iVarType==vt_NUMBER||iVarType==vt_DECFUNC ){
          if(DoWrite ){
              strcat(Frmat,"%s,");
              strcpy(Arg, join(4,Arg,",BCX_Format_Double((double)",Stak[iThisToken].Arg,",0)"));
            }
          else
            {
              strcat(Frmat,"%s");
              strcpy(Arg, join(4,Arg,",BCX_Format_Double((double)",Stak[iThisToken].Arg,",1)"));
            }
          Use_Str=Use_BcxTempStr=TRUE;
          goto L1076;
        }
      if(iVarType==vt_INTEGER ){
          if(DoWrite ){
              strcat(Frmat,"%d ,");
            }
          else
            {
              strcat(Frmat," %d ");
            }
          strcpy(Arg, join(3,Arg,",(int)",Stak[iThisToken].Arg));
          goto L1076;
        }
      if(iVarType==vt_LLONG ){
          if(DoWrite ){
              strcat(Frmat,"%lli,");
            }
          else
            {
              strcat(Frmat,"% lli");
            }
          strcpy(Arg, join(3,Arg,",(long long)",Stak[iThisToken].Arg));
          goto L1076;
        }
      if(iVarType==vt_ULONGLONG ){
          if(DoWrite ){
              strcat(Frmat,"%llu,");
            }
          else
            {
              strcat(Frmat,"% llu");
            }
          strcpy(Arg, join(3,Arg,",(unsigned long long)",Stak[iThisToken].Arg));
          goto L1076;
        }
      if(iVarType==vt_SINGLE ){
          if(DoWrite ){
              strcat(Frmat,"%.7G,");
            }
          else
            {
              strcat(Frmat,"% .7G");
            }
          strcpy(Arg, join(3,Arg,",(float)",Stak[iThisToken].Arg));
          goto L1076;
        }
      if(iVarType==vt_LDOUBLE ){
          if(DoWrite ){
              strcat(Frmat,"%.19LG,");
            }
          else
            {
              strcat(Frmat,"% .19LG");
            }
          Use_Ldouble=TRUE;
          strcpy(Arg, join(3,Arg,",(LDOUBLE)",Stak[iThisToken].Arg));
          goto L1076;
        }
      if(iVarType==vt_BOOL ){
          if(DoWrite ){
              strcat(Frmat,"%d,");
            }
          else
            {
              strcat(Frmat,"% d");
            }
          strcpy(Arg, join(3,Arg,",",Stak[iThisToken].Arg));
        }
      else
        {
          if((UCHAR)*(Stak[iThisToken].Arg)==40 ){
              if(m_iMatchLft(Stak[iThisToken].Arg,"(*")&&instr(Stak[iThisToken].Arg,").")){
                  if(DoWrite ){
                      strcat(Frmat,"%d ,");
                    }
                  else
                    {
                      strcat(Frmat," %d ");
                    }
                  strcpy(Arg, join(3,Arg,",(int)",Stak[iThisToken].Arg));
                  continue;
                }
              *LZZ=0;
              strcat(Arg,",");
              for(;;)
                {
                  int iParentheses=inchr(Stak[iThisToken].Arg,")");
                  strcpy(PWF_Cast,mid(Stak[iThisToken].Arg,1,iParentheses++));
                  strcpy(Stak[iThisToken].Arg,trim(mid(Stak[iThisToken].Arg,iParentheses)));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"char*","char *"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"integer","int"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"ldouble","LDOUBLE"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"llong","long long"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"long long","long long"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"longlong","long long"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"lpstr","char *"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"single","float"));
                  strcpy(PWF_Cast,iReplace(PWF_Cast,"ulonglong","unsigned long long"));
                  if(ISNULL(LZZ)){
                      if(iMatchNQ("(char *)(int)(float)(double)(LDOUBLE)(long long)(unsigned long long)",PWF_Cast)){
                          strcpy(LZZ,PWF_Cast);
                        }
                      else
                        {
                          strcpy(LZZ,"(double)");
                          strcpy(PWF_Cast, join(2,LZZ,PWF_Cast));
                        }
                      RemoveAll(LZZ,"()");
                      strcpy(LZZ,iReplace(LZZ,"char *","%s"));
                      strcpy(LZZ,iReplace(LZZ,"double","% .15G "));
                      strcpy(LZZ,iReplace(LZZ,"float","% .7G "));
                      strcpy(LZZ,iReplace(LZZ,"int","% d "));
                      strcpy(LZZ,iReplace(LZZ,"ldouble","% .19LG "));
                      strcpy(LZZ,iReplace(LZZ,"long long","% lli "));
                      strcpy(LZZ,iReplace(LZZ,"unsigned long long","% llu "));
                    }
                  strcat(Arg,PWF_Cast);
                  if(!((UCHAR)*(Stak[iThisToken].Arg)==c_LPar)){
                      goto L1077;
                    }
                }
L1077:;
              strcat(Arg,Stak[iThisToken].Arg);
              strcat(Frmat,LZZ);
              if(DoWrite ){
                  strcat(Frmat,",");
                }
            }
          else
            {
              if(DoWrite ){
                  strcat(Frmat,"%G,");
                }
              else
                {
                  strcat(Frmat,"% G");
                  strcpy(Arg, join(3,Arg,",(float)",Stak[iThisToken].Arg));
                }
            }
        }

L1076:;

    }
  if(DoWrite ){
      strcpy(Frmat,left(Frmat,(int)strlen(Frmat)-1));
    }

PRINTWRITELABEL:;

  if(SuppressCRLF==FALSE ){
      strcat(Frmat,"\\n");
    }
  BCX_RetStr=join(4,"printf(",enc(Frmat),No_Sigil(Arg),");");
  return BCX_RetStr;
}

void InputBufferFlags ()
{
  if(!Use_Inputbuffer ){
      Use_Inputbuffer=TRUE;
      Use_BcxTempStr=TRUE;
      Use_Scan=TRUE;
      Use_Proto=TRUE;
      Use_Split=TRUE;
      Use_Replace=TRUE;
      Use_Remove=TRUE;
      Use_Mid=TRUE;
      Use_Left=TRUE;
      Use_Instr=TRUE;
      Use_Stristr=TRUE;
      Use_UCaseTbl=TRUE;
    }
}

void CommonInputCode (char* Frmat,char* Arg)
{
  int Argcount=0;
  int iThisToken;
  int iVarType;
  char szParamToken[BCXSTRSIZE];
  char Stak[128][BCXSTRSIZE];
  Clear(Stak);
  InputBufferFlags();
  *Arg=0;
  *Frmat=0;
  iThisToken=1;
  while(iThisToken<=Ndx){
      if(strcmp(Stk[iThisToken],",")==0){
          Argcount++;
          strcpy(Stak[Argcount],Arg);
          *Arg=0;
          iThisToken++;
        }
      else
        {
          strcat(Arg,Stk[iThisToken]);
          iThisToken++;
          if(iThisToken<Ndx ){
              int iCnt=tally(Arg,"[")-tally(Arg,"]");
              while(iCnt){
                  strcat(Arg,Stk[iThisToken]);
                  iThisToken++;
                  iCnt=tally(Arg,"[")-tally(Arg,"]");
                }
            }
        }
    }
  Argcount++;
  strcpy(Stak[Argcount],Arg);
  *Arg=0;
  fprintf(FP_WRITE,"%s",Scoot);
  for(iThisToken=1; iThisToken<=Argcount; iThisToken++)
    {
      strcpy(szParamToken,Stak[iThisToken]);
      iVarType=CheckType(szParamToken);
      if(iVarType==vt_UDT||iVarType==vt_STRUCT||iVarType==vt_UNION ){
          iVarType=DataType(szParamToken);
        }
      else
        {
          int iCnt=inchr(szParamToken,"[");
          if(iCnt ){
              *(--iCnt+szParamToken)=0;
            }
          iVarType=DataType(szParamToken);
        }
      strcpy(szParamToken,No_Sigil(Stak[iThisToken]));
      if(Im_UDT_String(szParamToken)){
          iVarType=vt_STRVAR;
        }
      if(Im_UDT_Single(szParamToken)){
          iVarType=vt_SINGLE;
        }
      if(Im_UDT_Double(szParamToken)){
          iVarType=vt_DOUBLE;
        }
      int x;
      for(int i=2; i<=Ndx; i++)
        {
          x=CheckType(szParamToken);
          if(x==vt_STRVAR ){
              iVarType=vt_STRVAR;
              goto L1082;
            }
          if(x==vt_PCHAR ){
              iVarType=vt_STRVAR;
              goto L1082;
            }
          if(x==vt_PSTR ){
              iVarType=vt_STRVAR;
              goto L1082;
            }
          if(x==vt_CHARPTR ){
              iVarType=vt_STRVAR;
              goto L1082;
            }
          if(x==vt_SINGLE ){
              iVarType=vt_SINGLE;
              goto L1082;
            }
          if(x==vt_DOUBLE ){
              iVarType=vt_DOUBLE;
              goto L1082;
            }
          if(x==vt_LDOUBLE ){
              iVarType=vt_LDOUBLE;
            }

L1082:;

        }
      if(iVarType==vt_STRVAR ){
          strcat(Frmat,"%s");
          strcpy(Arg, join(3,Arg,",",szParamToken));
          fprintf(FP_WRITE,"%s%s%s","*",trim(szParamToken),"=0, ");
          goto L1083;
        }
      if(iVarType==vt_INTEGER ){
          strcat(Frmat,"%d");
          strcpy(Arg, join(3,Arg,",&",szParamToken));
          fprintf(FP_WRITE,"%s%s",szParamToken,"=0, ");
          goto L1083;
        }
      if(iVarType==vt_SINGLE ){
          strcat(Frmat,"%g");
          strcpy(Arg, join(3,Arg,",&",szParamToken));
          fprintf(FP_WRITE,"%s%s",szParamToken,"=0, ");
          goto L1083;
        }
      if(iVarType==vt_DOUBLE ){
          strcat(Frmat,"%lG");
          strcpy(Arg, join(3,Arg,",&",szParamToken));
          fprintf(FP_WRITE,"%s%s",szParamToken,"=0, ");
          goto L1083;
        }
      if(iVarType==vt_LDOUBLE ){
          strcat(Frmat,"%lG");
          strcpy(Arg, join(3,Arg,",&",szParamToken));
          fprintf(FP_WRITE,"%s%s",szParamToken,"=0, ");
        }
      else
        {
          strcat(Frmat,"%d");
          strcpy(Arg, join(3,Arg,",&",szParamToken));
          fprintf(FP_WRITE,"%s%s",szParamToken,"=0, ");
        }

L1083:;

    }
}

void FinishingTouches ()
{
  if(Use_Project==FALSE ){
      int Accum=Use_BCXMDialog;
      Accum+=(Use_BCXDialog);
      Accum+=(Use_BCX_Control);
      Accum+=(Use_BCX_FrameWnd);
      Accum+=(Use_BCX_InitGUI);
      Accum+=(Use_BCX_Input);
      Accum+=(Use_BCX_OlePicture);
      Accum+=(Use_BCX_RegWnd);
      Accum+=(Use_BCX_SetCursor);
      Accum+=(Use_BCX_SetIcon);
      Accum+=(Use_BCX_SetIconSm);
      Accum+=(Use_BCX_Slider);
      Accum+=(Use_BCX_Splitter);
      Accum+=(Use_BCX_Tab);
      Accum+=(Use_BCX_Toolbar);
      Accum+=(Use_BCX_UpDown);
      Accum+=(Use_BCX_Wnd);
      Accum+=(Use_Bitmap);
      Accum+=(Use_Blackrect);
      Accum+=(Use_BmpButton);
      Accum+=(Use_Button);
      Accum+=(Use_Checkbox);
      Accum+=(Use_Combobox);
      Accum+=(Use_Datepick);
      Accum+=(Use_Edit);
      Accum+=(Use_Form);
      Accum+=(Use_Grayrect);
      Accum+=(Use_Group);
      Accum+=(Use_Icon);
      Accum+=(Use_Label);
      Accum+=(Use_Listbox);
      Accum+=(Use_Listview);
      Accum+=(Use_ProgressBar);
      Accum+=(Use_Radio);
      Accum+=(Use_Richedit);
      Accum+=(Use_Set_BCX_Icon);
      Accum+=(Use_Treeview);
      Accum+=(Use_Whiterect);
      if(Accum ){
          AddBCX_hInstance();
          AddFontVariables();
        }
    }
}

void AssembleParts ()
{
  char LTmp1[BCXSTRSIZE]={0};
  char P1[BCXSTRSIZE]={0};
  char P2[BCXSTRSIZE]={0};
  char P3[BCXSTRSIZE]={0};
  char P4[BCXSTRSIZE]={0};
  char P5[BCXSTRSIZE]={0};
  char P6[BCXSTRSIZE]={0};
  char P7[BCXSTRSIZE]={0};
  char P8[BCXSTRSIZE]={0};
  DoCountLines=TRUE;
  FinishingTouches();
  if(Exist("$WRK$.TXT")){
      DeleteFile (("$WRK$.TXT"));
    }
  MoveFile (FileOut,"$WRK$.TXT" );
  if(ISNULL(CmdLineFileOut)){
      if(UseCpp ){
          strcpy(gTmpStr, join(2,extract(FileOut,"."),".cpp"));
          DeleteFile ((gTmpStr));
          strcpy(FileOut,gTmpStr);
        }
      else
        {
          strcpy(gTmpStr, join(2,extract(FileOut,"."),".c"));
          DeleteFile ((gTmpStr));
          strcpy(FileOut,gTmpStr);
        }
    }
  if((FP_W=fopen(FileOut, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
   }
  Emit_Prolog(FP_W);
  Commandline_Defines(FP_W);
  System_Defined_Constants(FP_W);
  User_Defined_Constants(FP_W);
  Emit_UserDirectives(FP_W);
  User_Global_Enum_Blocks(FP_W);
  if(Use_Project==FALSE ){
      if(Use_SingleFile==FALSE ){
          if((FP_HeaderFile=fopen(HFile, "w"))==0)
           {
          fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", HFile); exit(1);
           }
        }
    }
  StdProtos(FP_W);
  User_Defined_Types_And_Unions(FP_W);
  Emit_System_Vars(FP_W);
  if(Use_COM ){
      Emit_COM_SupportTypes(FP_W);
    }
  User_Global_Variables(FP_W);
  User_Data_Statements(FP_W);
  AddMacros(FP_W);
  User_Prototypes(FP_W);
  User_Global_Initialized_Arrays(FP_W);
  User_Overloaded_SubsFunctions(FP_W);
  User_Global_Set_Statements(FP_W);
  if(Use_SingleFile==FALSE ){
      if(FP_HeaderFile)
       {
         fclose(FP_HeaderFile);
         FP_HeaderFile=NULL;
       }
    }
  if(Use_SingleFile==TRUE&&Use_Project==FALSE ){
      Emit_RuntimeFunctions(FP_W);
    }
  else
    {
      if(Use_Project==FALSE ){
          SetFlags();
        }
    }
  BOOL  bMain=(Use_Wingui+MakeDLL+NoMain);
  BOOL  bMainOut;
  bMainOut=FALSE;
  if(lof(cppFile)){
      fprintf(FP_W,"%s\n","");
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s\n","//                   User's C code");
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s\n","");
      if((FP_R=fopen(cppFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", cppFile); exit(1);
       }
      while(!EoF(FP_R)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , FP_R);
            if(feof(FP_R) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP_R));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          fprintf(FP_W,"%s\n",LTmp1);
        }
      if(FP_R)
       {
         fclose(FP_R);
         FP_R=NULL;
       }
    }
  if(Exist(prcFile)&&lof(prcFile)>2 ){
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s\n","//            User's Subs and Functions");
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s\n","");
      if(UseCpp ){
          strcpy(P1,vchr(6,99,111,117,116,60,60));
          strcpy(P2,vchr(8,99,111,117,116,32,60,60,32));
          strcpy(P3,vchr(5,99,105,110,60,60));
          strcpy(P4,vchr(7,99,105,110,32,60,60,32));
          strcpy(P5,vchr(7,60,60,115,116,100,58,58));
          strcpy(P6,vchr(9,32,60,60,32,115,116,100,58,58));
          strcpy(P7,vchr(6,60,60,101,110,100,108));
          strcpy(P8,vchr(8,32,60,60,32,101,110,100,108));
        }
      if((FP_R=fopen(prcFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", prcFile); exit(1);
       }
      while(!EoF(FP_R)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , FP_R);
            if(feof(FP_R) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP_R));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          if(UseCpp ){
              strcpy(LTmp1,replace(LTmp1,P1,P2));
              strcpy(LTmp1,replace(LTmp1,P3,P4));
              strcpy(LTmp1,replace(LTmp1,P5,P6));
              strcpy(LTmp1,replace(LTmp1,P7,P8));
            }
          fprintf(FP_W,"%s\n",LTmp1);
          if(bMainOut ){
              continue;
            }
          bMainOut=CheckForMain(LTmp1,bMain);
        }
      if(FP_R)
       {
         fclose(FP_R);
         FP_R=NULL;
       }
    }
  if(Use_Wingui==FALSE&&NoMain==FALSE ){
      fprintf(FP_W,"%s\n","");
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s%s\n","//                  ",c_BCX_STR_MAIN_PROG);
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s\n","");
    }
  if((FP_R=fopen("$WRK$.TXT", "rb"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", "$WRK$.TXT"); exit(1);
   }
  while(!EoF(FP_R)){
      LTmp1[0]=0;
      fgets(LTmp1, 2048 , FP_R);
        if(feof(FP_R) || (LTmp1[strlen(LTmp1)-1]==10))
          {
           LTmp1[strcspn(LTmp1,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP_R));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",LTmp1);
            exit(1);
          }
      if(iMatchNQ(LTmp1,"int main")){
          if(bMain ){
              continue;
            }
        }
      fprintf(FP_W,"%s%s\n",Scoot,LTmp1);
      if(bMainOut ){
          continue;
        }
      bMainOut=CheckForMain(LTmp1,bMain);
    }
  if(FP_R)
   {
     fclose(FP_R);
     FP_R=NULL;
   }
  DeleteFile (("$WRK$.TXT"));
  if(FP_W)
   {
     fclose(FP_W);
     FP_W=NULL;
   }
  DoCountLines=FALSE;
}

int CheckForMain (char* ArgStr,BOOL bMain)
{
  int bMainOut=FALSE;
  char LTmp1[BCXSTRSIZE]={0};
  char LZZ[BCXSTRSIZE]={0};
  if(iMatchNQ(ArgStr,"main")){
      strcpy(LZZ,ltrim(ArgStr));
      strcpy(Scoot,space(2));
      if(LeftStr(LZZ,"int main")||LeftStr(LZZ,"int WINAPI WinMain")||LeftStr(LZZ,"__declspec(dllexport) BOOL WINAPI DllMain")||like(LZZ,"*__stdcall*DllMain*(HINSTANCE *,*")){
          if(bMain==FALSE ){
              fprintf(FP_W,"%s\n","{");
            }
          if(bMain ){
              LTmp1[0]=0;
              fgets(LTmp1, 2048 , FP_R);
                if(feof(FP_R) || (LTmp1[strlen(LTmp1)-1]==10))
                  {
                   LTmp1[strcspn(LTmp1,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP_R));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",LTmp1);
                    exit(1);
                  }
              fprintf(FP_W,"%s\n",LTmp1);
            }
          if(Use_Console ){
              fprintf(FP_W,"%s%s\n",Scoot,"hConsole=GetStdHandle(STD_OUTPUT_HANDLE);");
            }
          if(Use_StartupCode ){
              fprintf(FP_W,"%s%s\n",Scoot,"int BCX_SUCode=BCX_StartupCode_();  // execute user's startup code");
            }
          if(Use_ExitCode ){
              fprintf(FP_W,"%s%s\n",Scoot,"int BCX_EXCode=BCX_ExitCode_();     // Prepare for user's exit code");
            }
          if(Use_LCaseTbl ){
              fprintf(FP_W,"%s%s\n",Scoot,"LowCase = MakeLCaseTbl();");
            }
          if(Use_UCaseTbl ){
              fprintf(FP_W,"%s%s\n",Scoot,"UprCase = MakeUCaseTbl();");
            }
          if(DllCnt ){
              char szLoadLibHandle[BCXSTRSIZE]={0};
              char LTmp[BCXSTRSIZE]={0};
              int i={0};
              fprintf(FP_W,"%s%s\n",Scoot,"");
              fprintf(FP_W,"%s%s\n",Scoot,"// **********[ DLL Declarations ]**********");
              fprintf(FP_W,"%s%s\n",Scoot,"");
              if(Use_LoadLibraryError ){
                  fprintf(FP_W,"%s%s\n",Scoot,"FILE   *FPLoadLibraryErrorLog;");
                  char Op[BCXSTRSIZE];
                  strcpy(Op,enc("w"));
                  if(UseFileTest ){
                      fprintf(FP_W,"%s%s%s%s%s%s\n",Scoot,"if((FPLoadLibraryErrorLog=fopen(",LibraryErrorLog,", ",Op,"))==0)");
                      fprintf(FP_W,"%s%s\n",Scoot," {");
                      strcpy(LTmp,enc("Error: Cannot Access File or File Not Found. %s\\n"));
                      fprintf(FP_W,"%s%s%s%s%s%s\n",Scoot,"fprintf(stderr, ",LTmp,", ",LibraryErrorLog,"); exit(1);");
                      fprintf(FP_W,"%s%s\n",Scoot," }");
                    }
                  else
                    {
                      fprintf(FP_W,"%s%s%s%s%s%s\n",Scoot,"FPLoadLibraryErrorLog = fopen(",enc(LibraryErrorLog),", ",Op,");");
                    }
                }
              strcpy(LTmp,enc("[%s %s] Failed to load %s\\n"));
              for(i=1; i<=LoadLibsCnt; i++)
                {
                  strcpy(szLoadLibHandle, join(2,"H_",ucase(RemoveExtension(Loadlibs[i]))));
                  if((inchr(szLoadLibHandle,"-"))||(inchr(szLoadLibHandle,"."))){
                      strcpy(szLoadLibHandle,replace(szLoadLibHandle,"-.","_"));
                      strcpy(szLoadLibHandle,replace(szLoadLibHandle,"-","_"));
                    }
                  fprintf(FP_W,"%s%s%s%s%s%s\n",Scoot,"HMODULE  ",szLoadLibHandle," = LoadLibrary(",enc(Loadlibs[i]),");");
                  if(Use_LoadLibraryError ){
                      fprintf(FP_W,"%s%s%s%s\n",Scoot,"if(",szLoadLibHandle,"==NULL) {");
                      fprintf(FP_W,"%s%s%s%s%s%s\n",Scoot,"  fprintf(FPLoadLibraryErrorLog, ",LTmp,", date(), timef(0,0), ",enc(Loadlibs[i]),");");
                      fprintf(FP_W,"%s%s\n",Scoot,"  }");
                    }
                }
              strcpy(LTmp,enc("[%s %s] Failed to find process %s\\n"));
              for(i=1; i<=DllCnt; i++)
                {
                  fprintf(FP_W,"%s%s\n",Scoot,DllDecl[i]);
                  if(Use_LoadLibraryError ){
                      int iEQ=inchr(DllDecl[i],"=")-1;
                      char szProcAddress[BCXSTRSIZE];
                      strcpy(szProcAddress,left(DllDecl[i],iEQ));
                      fprintf(FP_W,"%s%s%s%s\n",Scoot,"if(",szProcAddress,"==NULL) {");
                      fprintf(FP_W,"%s%s%s%s%s%s\n",Scoot,"  fprintf(FPLoadLibraryErrorLog, ",LTmp,",date(),timef(0,0),",enc(szProcAddress),");");
                      fprintf(FP_W,"%s%s\n",Scoot,"  }");
                    }
                }
              if(Use_LoadLibraryError ){
                  fprintf(FP_W,"%s%s\n",Scoot,"fclose(FPLoadLibraryErrorLog);");
                }
              fprintf(FP_W,"%s%s\n",Scoot,"");
              fprintf(FP_W,"%s%s\n",Scoot,"// ****************************************");
              fprintf(FP_W,"%s%s\n",Scoot,"");
            }
          bMainOut=TRUE;
        }
    }
  return bMainOut;
}

char * RemoveExtension (char *f)
{
  char  *BCX_RetStr={0};
  int  i;
  int dotPosition=inchr(f,".");
  if(dotPosition ){
      i=InstrRev(f,".",0)-1;
    }
  else
    {
      i=(int)strlen(f);
    }
  BCX_RetStr=left(f,i);
  return BCX_RetStr;
}

int CheckGlobal (char* szVariable,int* varidx)
{
  ULONGLONG  iHasValue;
  int iTokenLoc;
  char szTemp[BCXSTRSIZE];
  int iBrack;
  strcpy(szTemp,szVariable);
  RemoveAll(szTemp,"%$#!@`&*( )",1);
  iBrack=inchr(szTemp,"[");
  if(iBrack ){
      *(--iBrack+szTemp)=0;
    }
  iHasValue=HashNumber(szTemp);
  while(GlobalVarHash[iHasValue]){
      iTokenLoc=GlobalVarHash[iHasValue];
      if(strcmp(szTemp,GlobalVars[iTokenLoc].VarName)==0){
          (*varidx)=iTokenLoc;
          return GlobalVars[iTokenLoc].VarType;
        }
      iHasValue++;
      iHasValue=imod(iHasValue,c_MaxGlobalVars);
    }
  return vt_UNKNOWN;
}

int CheckLocal (char* szVariable,int* varidx)
{
  char szTemp[BCXSTRSIZE];
  int iBrack;
  int iTokenLoc;
  if(LocalVarCnt ){
      strcpy(szTemp,szVariable);
      RemoveAll(szTemp,"%$#!@`&*( )",1);
      iBrack=inchr(szTemp,"[");
      if(iBrack ){
          *(--iBrack+szTemp)=0;
        }
      for(iTokenLoc=LocalVarCnt; iTokenLoc>=1; iTokenLoc+=-1)
        {
          if(strcmp(szTemp,LocalVars[iTokenLoc].VarName)==0){
              (*varidx)=iTokenLoc;
              return LocalVars[iTokenLoc].VarType;
            }
        }
    }
  return vt_UNKNOWN;
}

int CheckType (char* ParamStr)
{
  int varid={0};
  char Keyword[BCXSTRSIZE];
  strcpy(Keyword,trim(lcase(ParamStr)));
  int i=FindWord(Keyword,tTypes,m_WordsInTable(tTypes));
  if(i!=c_NOTFOUND ){
      return tTypes[i].iType;
    }
  i=CheckLocal(ParamStr,&(varid));
  if(i==vt_UNKNOWN ){
      i=CheckGlobal(ParamStr,&(varid));
      if(i==vt_UNKNOWN ){
          i=CheckTypeDefs(ParamStr);
          if(i ){
              i=TypeDefs[i].TypeofDef;
            }
        }
    }
  return i;
}

void ExportStringConst ()
{
  FILE*  FP_SAVE;
  FP_SAVE=FP_CST;
  FP_CST=FP_SYSCST;
  strcpy(Src, join(2,"MACRO BCXSTRSIZE=",str(c_BCXSTRINGS)));
  PassOne=TRUE;
  Inject(Src);
  FP_CST=FP_SAVE;
}

void ExportInternalConst ()
{
  if(Use_FillArray ){
      FILE*  FP_SAVE;
      FP_SAVE=FP_CST;
      FP_CST=FP_SYSCST;
      strcpy(Src,"MACRO vt_INTEGER =  2");
      PassOne=TRUE;
      Inject(Src);
      strcpy(Src,"MACRO vt_SINGLE  =  3");
      PassOne=TRUE;
      Inject(Src);
      strcpy(Src,"MACRO vt_DOUBLE  =  4");
      PassOne=TRUE;
      Inject(Src);
      strcpy(Src,"MACRO vt_LDOUBLE =  5");
      PassOne=TRUE;
      Inject(Src);
      FP_CST=FP_SAVE;
    }
}

int RestrictedWords (char *ParamStr)
{
  if(strcmp(ParamStr,"CmdLine")==0  || strcmp(ParamStr,"CmdShow")==0  || strcmp(ParamStr,"hInst")==0  || strcmp(ParamStr,"hPrev")==0  || strcmp(ParamStr,"hWnd")==0  || strcmp(ParamStr,"lParam")==0  || strcmp(ParamStr,"Msg")==0  || strcmp(ParamStr,"wParam")==0  || strcmp(ParamStr,"vt_INTEGER")==0  || strcmp(ParamStr,"vt_SINGLE")==0  || strcmp(ParamStr,"vt_DOUBLE")==0  || strcmp(ParamStr,"vt_LDOUBLE")==0){
      return 1;
    }
  else
    {
      return 0;
    }
}

int DataType (char *ParamStr)
{
  char Keyword[BCXSTRSIZE];
  int i;
  if(ParamStr[0]==c_DblQt ){
      return vt_STRLIT;
    }
  if(iMatchNQ(ParamStr,"$")){
      return vt_STRVAR;
    }
  if(IsDecimalNumber(ParamStr)){
      return vt_NUMBER;
    }
  i=CheckTypeDefs(ParamStr);
  if(i ){
      return TypeDefs[i].TypeofDef;
    }
  strcpy(Keyword,lcase(ParamStr));
  i=FindWord(Keyword,tBcxWords,m_WordsInTable(tBcxWords));
  if(i!=c_NOTFOUND ){
      return tBcxWords[i].iType;
    }
  if(iMatchNQ(ParamStr,"%")){
      return vt_INTEGER;
    }
  if(iMatchNQ(ParamStr,"!")){
      return vt_SINGLE;
    }
  if(iMatchNQ(ParamStr,"#")){
      return vt_DOUBLE;
    }
  if(iMatchNQ(ParamStr,"^")){
      return vt_DOUBLE;
    }
  if(iMatchNQ(ParamStr,"`")){
      return vt_LDOUBLE;
    }
  if(m_iMatchRgt(ParamStr,"@")){
      return vt_FILEPTR;
    }
  if(iMatchNQ(ParamStr,SPC)){
      return vt_UDT;
    }
  if(m_iMatchLft(ParamStr,"_")){
      return vt_INTEGER;
    }
  if(isalpha(ParamStr[0])){
      return vt_INTEGER;
    }
  if(CAST (UINT,ParamStr[0])>127 ){
      return vt_INTEGER;
    }
  return vt_UNKNOWN;
}

void CloseAll ()
{
  if(PPDLL_HANDLE ){
      FreeLibrary(PPDLL_HANDLE);
      PPDLL_HANDLE=NULL;
      PPProc=NULL;
    }
  _fcloseall();
}

void RemoveAll (char* Haystack,PCTSTR  Needles,int qtflag)
{
  PCHAR  C=Haystack;
  PCHAR  pmc=NULL;
  while(NOTNULL(Haystack)){
      if(qtflag ){
          if(*Haystack==c_DblQt ){
              *(C++)=*Haystack;
              while(*(++Haystack)!=c_DblQt){
                  *(C++)=*Haystack;
                  if(ISNULL(Haystack)){
                      return;
                    }
                }
              *(C++)=*(Haystack++);
              continue;
            }
        }
      pmc= CAST (PCHAR,Needles);
      while(*pmc){
          if(*(pmc++)==*Haystack ){
              goto SKIP;
            }
        }
      *(C++)=*Haystack;

SKIP:;

      Haystack++;
    }
  *C=0;
}

void Warning_ID (int iWarning,int WarnLvl)
{
  if(iWarning==eExitingMoreThan1Loop ){
      Warning("Exiting more than one loop",WarnLvl);
    }
}

void Warning (char* ParmStr,int WarnLvl)
{
  FILE*  fErr={0};
  if(WarnLvl ){
      strcpy(WarnMsg, join(7,WarnMsg," Line",str(LineNum[FileNdx])," in Module: ",trim(FileNames[FileNdx])," - ",ParmStr));
    }
  else
    {
      strcat(WarnMsg,ParmStr);
    }
  strcpy(WarnMsg, join(3,WarnMsg,CRLF,CRLF));
  if(ErrFile ){
      if((fErr=fopen(FileErr, "a"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileErr); exit(1);
       }
      fprintf(fErr,"%s%s\n","WARNING ",ParmStr);
      if(fErr)
       {
         fclose(fErr);
         fErr=NULL;
       }
    }
}

ULONG HashNumber (char* Str2Hash)
{
  PCHAR  StrgPtr;
  StrgPtr=Str2Hash;
  ULONG  hash;
  hash=5381;
  UCHAR  c={0};
  while(*StrgPtr){
      c=*StrgPtr;
      hash=((hash<<5)+hash)+c;
      StrgPtr++;
    }
  return  CAST (ULONG,imod(hash,c_MaxGlobalVars));
}

void AddLibrary (char* LibName)
{
  static int nTimes;
  int nLibNdx={0};
  char TempLibName[BCXSTRSIZE]={0};
  strcpy(TempLibName,lcase(LibName));
  if(!inchr(TempLibName,DQ)&&!inchr(TempLibName,"<")){
      strcpy(TempLibName,enc(TempLibName,60,62));
    }
  if(nTimes==0 ){
      for(int i=0; i<=c_MaxLib-1; i++)
        {
          *Library[i]=0;
        }
      nTimes++;
      strcpy(Library[0],TempLibName);
      return;
    }
  nLibNdx=0;
  while(NOTNULL(Library[nLibNdx])){
      if(strcmp(Library[nLibNdx],TempLibName)==0){
          return;
        }
      nLibNdx++;
    }
  if(nLibNdx<c_MaxLib-1 ){
      strcpy(Library[nLibNdx],TempLibName);
    }
  else
    {
      Abort(join(2,"Max libraries exceeded. Currently c_MaxLib set to",str(c_MaxLib)));
    }
}

void RemoveLibrary (char* LibName)
{
  if(!instr(RmLibs,LibName,1,1)){
      strcpy(RmLibs, join(3,RmLibs,",",lcase(LibName)));
    }
}

void AddGlobal (char* GlobalName,int GlobalType,int GlobalDef,char* GlobalDim,int GlobalPtr,int GlobalFS,int GlobalExtn,int iEmitted,int iConst)
{
  char FirstVar[BCXSTRSIZE];
  char SecondVar[BCXSTRSIZE];
  char Warn[BCXSTRSIZE];
  ULONGLONG  GlobalNameHash;
  struct _UDT_VARINFO_STORAGE*  ptGlobal;
  int s;
  if(Use_Project==TRUE ){
      if(GlobalExtn==0 ){
          GlobalExtn+=(2);
        }
    }
  if(RestrictedWords(GlobalName)&&TestState ){
      strcpy(Warn, join(3,"Restricted Word ",GlobalName," on Line"));
      strcpy(Warn, join(4,Warn,str(LineNum[FileNdx])," in Module: ",trim(FileNames[FileNdx])));
      Warning(Warn);
    }
  GlobalNameHash=HashNumber(GlobalName);
  while(GlobalVarHash[GlobalNameHash]){
      s=GlobalVarHash[GlobalNameHash];
      ptGlobal=&(GlobalVars[s]);
      if(strcmp(GlobalName,ptGlobal->VarName)==0){
          if(InConditional==0||(InConditional>0 && strcmp(InIfDef,ptGlobal->VarCondDef)==0)){
              if(ptGlobal->VarType!=GlobalType || strcmp(GlobalDim,ptGlobal->VarDim)!=0  || ptGlobal->VarDef!=GlobalDef ){
                  *FirstVar=0;
                  strcpy(FirstVar, join(4,FirstVar,"Line",str(LineNum[FileNdx])," in Module: "));
                  strcpy(FirstVar, join(4,FirstVar,trim(FileNames[FileNdx])," : ",GlobalName));
                  strcpy(FirstVar, join(4,FirstVar,GlobalDim," as ",GetVarTypeName(GlobalType)));
                  strcpy(FirstVar, join(3,FirstVar,SPC,TypeDefs[GlobalDef].VarName));
                  *SecondVar=0;
                  strcpy(SecondVar, join(4,SecondVar,"Line",str(ptGlobal->VarLine)," in Module: "));
                  strcpy(SecondVar, join(4,SecondVar,ptGlobal->VarModule," : ",GlobalName));
                  strcpy(SecondVar, join(4,SecondVar,ptGlobal->VarDim," as ",GetVarTypeName(ptGlobal->VarType)));
                  strcpy(SecondVar, join(3,SecondVar,SPC,TypeDefs[ptGlobal->VarDef].VarName));
                  strcpy(Warn, join(4,"Two Variables ",FirstVar," previously defined at ",SecondVar));
                  Warning(Warn);
                }
              return;
            }
        }
      GlobalNameHash=imod(GlobalNameHash+1,c_MaxGlobalVars);
    }
  GlobalVarCnt++;
  if(GlobalVarCnt==c_MaxGlobalVars ){
      Abort("Maximum Global Variables reached.");
    }
  ptGlobal=&(GlobalVars[GlobalVarCnt]);
  strcpy(ptGlobal->VarName,GlobalName);
  ptGlobal->VarType=GlobalType;
  ptGlobal->VarDef=GlobalDef;
  strcpy(ptGlobal->VarDim,GlobalDim);
  ptGlobal->VarLine=LineNum[FileNdx];
  ptGlobal->VarPntr=GlobalPtr;
  ptGlobal->VarSF=GlobalFS;
  ptGlobal->VarEmitFlag=iEmitted;
  strcpy(ptGlobal->VarModule,trim(FileNames[FileNdx]));
  ptGlobal->VarExtn=GlobalExtn;
  ptGlobal->VarCondLevel=InConditional;
  ptGlobal->VarConstant=iConst;
  strcpy(ptGlobal->VarCondDef,InIfDef);
  GlobalVarHash[GlobalNameHash]=GlobalVarCnt;
}

void AddLocal (char* LocalName,int LocalType,int LocalDef,char* LocalDim,int LocalPtr,int LocalFS,int iEmitted,int iConst)
{
  int varid=0;
  char FirstVar[BCXSTRSIZE];
  char SecondVar[BCXSTRSIZE];
  char Warn[BCXSTRSIZE];
  int s;
  if(LocalVarCnt&&TestState ){
      if(CheckGlobal(LocalName,&(varid))!=vt_UNKNOWN ){
          if(LocalDef ){
              *FirstVar=0;
              strcpy(FirstVar, join(3,FirstVar,"Line",str(LineNum[FileNdx])));
              strcpy(FirstVar, join(3,FirstVar," in Module: ",trim(FileNames[FileNdx])));
              strcpy(FirstVar, join(5,FirstVar," : ",LocalName,LocalDim," as "));
              strcat(FirstVar,TypeDefs[LocalDef].VarName);
            }
          else
            {
              *FirstVar=0;
              strcpy(FirstVar, join(3,FirstVar,"Line",str(LineNum[FileNdx])));
              strcpy(FirstVar, join(3,FirstVar," in Module: ",trim(FileNames[FileNdx])));
              strcpy(FirstVar, join(5,FirstVar," : ",LocalName,LocalDim," as "));
              strcat(FirstVar,GetVarTypeName(LocalType));
            }
          if(GlobalVars[varid].VarDef ){
              *SecondVar=0;
              strcpy(SecondVar, join(3,SecondVar,"Line",str(GlobalVars[varid].VarLine)));
              strcpy(SecondVar, join(3,SecondVar," in Module: ",GlobalVars[varid].VarModule));
              strcpy(SecondVar, join(4,SecondVar," : ",LocalName,GlobalVars[varid].VarDim));
              strcpy(SecondVar, join(3,SecondVar," as ",TypeDefs[GlobalVars[varid].VarDef].VarName));
            }
          else
            {
              *SecondVar=0;
              strcpy(SecondVar, join(3,SecondVar,"Line",str(GlobalVars[varid].VarLine)));
              strcpy(SecondVar, join(3,SecondVar," in Module: ",GlobalVars[varid].VarModule));
              strcpy(SecondVar, join(4,SecondVar," : ",LocalName,GlobalVars[varid].VarDim));
              strcpy(SecondVar, join(3,SecondVar," as ",GetVarTypeName(GlobalVars[varid].VarType)));
            }
          strcpy(Warn, join(5,"Local Variable ",FirstVar,CRLF,"Has Same Name as Global ",SecondVar));
          Warning(Warn);
        }
      for(s=1; s<=LocalVarCnt; s++)
        {
          if(strcmp(LocalName,LocalVars[s].VarName)==0){
              if(LocalVars[s].VarType!=LocalType || strcmp(LocalDim,LocalVars[s].VarDim)!=0  || LocalVars[s].VarDef!=LocalDef ){
                  *FirstVar=0;
                  strcpy(FirstVar, join(3,FirstVar,"Line",str(LineNum[FileNdx])));
                  strcpy(FirstVar, join(3,FirstVar," in Module: ",trim(FileNames[FileNdx])));
                  strcpy(FirstVar, join(5,FirstVar," : ",LocalName,LocalDim," as "));
                  strcpy(FirstVar, join(3,FirstVar,GetVarTypeName(LocalType),SPC));
                  strcat(FirstVar,TypeDefs[LocalDef].VarName);
                  *SecondVar=0;
                  strcpy(SecondVar, join(4,SecondVar,"Line",str(LocalVars[s].VarLine)," in Module: "));
                  strcpy(SecondVar, join(4,SecondVar,LocalVars[s].VarModule," : ",LocalName));
                  strcpy(SecondVar, join(3,SecondVar,LocalVars[s].VarDim," as "));
                  strcpy(SecondVar, join(3,SecondVar,GetVarTypeName(LocalVars[s].VarType),SPC));
                  strcat(SecondVar,TypeDefs[LocalVars[s].VarDef].VarName);
                  strcpy(Warn, join(4,"Two Variables ",FirstVar," previously defined at ",SecondVar));
                  Warning(Warn);
                }
              return;
            }
        }
    }
  LocalVarCnt++;
  if(LocalVarCnt==c_MaxLocalVars ){
      strcpy(Warn,"Maximum Local Variables reached.");
      Abort(Warn);
    }
  strcpy(LocalVars[LocalVarCnt].VarName,LocalName);
  LocalVars[LocalVarCnt].VarType=LocalType;
  LocalVars[LocalVarCnt].VarDef=LocalDef;
  strcpy(LocalVars[LocalVarCnt].VarDim,LocalDim);
  LocalVars[LocalVarCnt].VarLine=LineNum[FileNdx];
  LocalVars[LocalVarCnt].VarPntr=LocalPtr;
  LocalVars[LocalVarCnt].VarSF=LocalFS;
  LocalVars[LocalVarCnt].VarEmitFlag=iEmitted;
  LocalVars[LocalVarCnt].VarConstant=iConst;
  strcpy(LocalVars[LocalVarCnt].VarModule,trim(FileNames[FileNdx]));
}

BOOL IsDecimalNumber (char *szNumber)
{
  int  i={0};
  int  HasDigit={0};
  int  HasE={0};
  int  HasMinus={0};
  int  HasPlus={0};
  int  HasDecimal={0};
  BOOLEAN  digitAfterE={0};
  BOOLEAN  prevWasE={0};
  if(ISNULL(szNumber)){
      return FALSE;
    }
  if(iMatchNQ(szNumber,SPC)){
      return FALSE;
    }
  if(szNumber[0]==43 ){
      HasPlus++;
      i++;
    }
  else if(szNumber[0]==45 ){
      HasMinus++;
      i++;
    }
  while(szNumber[i]){
      if(szNumber[i]>=48&&szNumber[i]<=57 ){
          HasDigit++;
          if(HasE>0 ){
              digitAfterE=TRUE;
            }
          prevWasE=FALSE;
        }
      else if(szNumber[i]==46 ){
          HasDecimal++;
          if(HasDecimal>1||HasE>0 ){
              return FALSE;
            }
          prevWasE=FALSE;
        }
      else if(szNumber[i]==69||szNumber[i]==101 ){
          HasE++;
          if(HasE>1||HasDigit==0 ){
              return FALSE;
            }
          prevWasE=TRUE;
        }
      else if(szNumber[i]==43 ){
          HasPlus++;
          if(!prevWasE&&i>0 ){
              return FALSE;
            }
          if(HasPlus>2 ){
              return FALSE;
            }
          prevWasE=FALSE;
        }
      else if(szNumber[i]==45 ){
          HasMinus++;
          if(!prevWasE&&i>0 ){
              return FALSE;
            }
          if(HasMinus>2 ){
              return FALSE;
            }
          prevWasE=FALSE;
        }
      else if((szNumber[i]==76||szNumber[i]==108)&&szNumber[i+1]==0 ){
          prevWasE=FALSE;
        }
      else
        {
          return FALSE;
        }
      i++;
    }
  if(i==0 ){
      return FALSE;
    }
  i--;
  if(szNumber[i]==43||szNumber[i]==45 ){
      return FALSE;
    }
  if(HasDigit==0 ){
      return FALSE;
    }
  if(HasE>0&&!digitAfterE ){
      return FALSE;
    }
  return TRUE;
}

BOOL IsRadixLiteral (char* szArg,int* RadixBase)
{
  if(RadixBase ){
      *RadixBase=0;
    }
  if(ISNULL(szArg)){
      return 0;
    }
  if(iMatchNQ(szArg,SPC)){
      return 0;
    }
  if((int)strlen(szArg)<3 ){
      return 0;
    }
  char InputStr[BCXSTRSIZE]={0};
  char Prefix[BCXSTRSIZE]={0};
  char Digits[BCXSTRSIZE]={0};
  char ValidDigits[BCXSTRSIZE]={0};
  int  DetectedBase={0};
  strcpy(InputStr,lcase(szArg));
  strcpy(Prefix,left(InputStr,2));
  strcpy(Digits,mid(InputStr,3));
  if(strcmp(Prefix,"0x")==0  || strcmp(Prefix,"&h")==0){
      DetectedBase=16;
      strcpy(ValidDigits,"0123456789abcdef");
      goto L1102;
    }
  if(strcmp(Prefix,"0o")==0  || strcmp(Prefix,"&o")==0){
      DetectedBase=8;
      strcpy(ValidDigits,"01234567");
      goto L1102;
    }
  if(strcmp(Prefix,"0b")==0  || strcmp(Prefix,"&b")==0){
      DetectedBase=2;
      strcpy(ValidDigits,"01");
    }
  else
    {
      return 0;
    }

L1102:;

  for(int i=1; i<=(int)strlen(Digits); i++)
    {
      if(iMatchNQ(ValidDigits,mid(Digits,i,1))==0 ){
          return 0;
        }
    }
  if(RadixBase ){
      *RadixBase=DetectedBase;
    }
  return TRUE;
}

int IsQuoted (char *A)
{
  int ArgLen=(int)strlen(A);
  if(ArgLen<2 ){
      return 0;
    }
  if(A[0]==34&&A[ArgLen-1]==34 ){
      return 1;
    }
  else
    {
      return 0;
    }
}

void StripTabs ()
{
  PCHAR  pszSrc;
  pszSrc=Src;
  int iQuoteFlag=0;
  while(*pszSrc){
      if(*pszSrc==c_DblQt ){
          iQuoteFlag=iQuoteFlag^1;
        }
      if(*pszSrc==9&&!iQuoteFlag ){
          *pszSrc=32;
        }
      pszSrc++;
    }
}

void PushFileIO ()
{
  FPtr[++FPtrNdx]=SourceFile;
}

void PopFileIO ()
{
  if(FPtrNdx>0 ){
      if(SourceFile)
       {
         fclose(SourceFile);
         SourceFile=NULL;
       }
      LinesRead+=(LineNum[FileNdx--]);
      SourceFile=FPtr[FPtrNdx--];
    }
}

void CheckMatchedPairs ()
{
  int CountR=0;
  int CountS=0;
  BOOL  DoCount;
  DoCount=TRUE;
  PCHAR  pszSrc;
  pszSrc=Src;
  while(*pszSrc){
      if(*pszSrc==c_DblQt ){
          DoCount=!DoCount;
        }
      if(DoCount ){
          if(*pszSrc==c_LPar ){
              CountR++;
              goto L1106;
            }
          if(*pszSrc==c_RPar ){
              CountR--;
              goto L1106;
            }
          if(*pszSrc==c_LtBkt ){
              CountS++;
              goto L1106;
            }
          if(*pszSrc==c_RtBkt ){
              CountS--;
            }

L1106:;

        }
      pszSrc++;
    }
  if(!DoCount ){
      Abort("Unmatched Quotes");
    }
  if(CountS ){
      Abort("Unmatched []");
    }
  if(CountR ){
      Abort("Unmatched ()");
    }
}

void ClearIfThenStacks ()
{
  for(long i=0; i<=c_MaxSingleLineIFLines-1; i++)
    {
      *SrcStk[i]=0;
    }
  SrcCnt=0;
}

void AddExpressionToStack (char* szAssembledExpression)
{
  if(SrcCnt==c_MaxSingleLineIFLines-1 ){
      Abort("Single line conversion to multi-line stack exceeds limit.");
    }
  strcpy(SrcStk[++SrcCnt],szAssembledExpression);
}

void Add2SplitLines (char* szSplitLine)
{
  if(SplitCnt==c_MaxSplitLines-1 ){
      Abort("Maximum line splitting exceeded.");
    }
  strcpy(SplitStk[++SplitCnt],szSplitLine);
}

void PostProcess ()
{
  if(ReDirect==TRUE ){
      char LTmp1[BCXSTRSIZE];
      if((FP1=fopen(FileOut, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
       }
      while(!EoF(FP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , FP1);
            if(feof(FP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          printf("%s\n",LTmp1);
        }
      CloseAll();
    }
  strcpy(FileOutCopy,FileOut);
  strcpy(FileOutCopy,extract(FileOutCopy,"."));
  for(int A=1; A<=EntryCnt; A++)
    {
      strcpy(Cmd,RemoveStr(Entry[A],DQ));
      strcpy(Cmd,replace(Cmd,BKSLASH4,BKSLASH2));
      strcpy(Cmd,iReplace(Cmd,"$FILE$",FileOutCopy));
      strcpy(Cmd,iReplace(Cmd,"$PELLES$\\",PellesPath()));
      strcpy(Cmd,iReplace(Cmd,"$PELLES$",PellesPath()));
      strcpy(Cmd,iReplace(Cmd,"$LCC$\\",LccPath()));
      strcpy(Cmd,iReplace(Cmd,"$LCC$",LccPath()));
      strcpy(Cmd,iReplace(Cmd,"$BCX$\\",BcxPath()));
      strcpy(Cmd,iReplace(Cmd,"$BCX$",BcxPath()));
      printf("%s%s\n","Shelling Out To:",Cmd);
      system(Cmd);
    }
  if(NOTNULL(Compiler)){
      strcpy(Compiler,trim(RemoveStr(Compiler,DQ)));
      if(inchr(Compiler,SPC)){
          strcpy(Compiler, join(3,enc(extract(Compiler,SPC)),SPC,remain(Compiler,SPC)));
        }
      else
        {
          strcpy(Compiler,enc(Compiler));
        }
      strcpy(Compiler,replace(Compiler,BKSLASH4,BKSLASH2));
      strcpy(Compiler,iReplace(Compiler,"$FILE$",FileOutCopy));
      strcpy(Compiler,iReplace(Compiler,"$PELLES$\\",PellesPath()));
      strcpy(Compiler,iReplace(Compiler,"$PELLES$",PellesPath()));
      strcpy(Compiler,iReplace(Compiler,"$LCC$\\",LccPath()));
      strcpy(Compiler,iReplace(Compiler,"$LCC$",LccPath()));
      strcpy(Compiler,replace(Compiler,DDQ,DQ));
      printf("%s%s\n","Shelling Out To:",Compiler);
      system(Compiler);
    }
  if(NOTNULL(ResCompiler)){
      strcpy(ResCompiler,enc(ResCompiler));
      strcpy(ResCompiler, join(3,ResCompiler,SPC,Res_File));
      strcpy(ResCompiler,iReplace(ResCompiler,"$PELLES$\\",PellesPath()));
      strcpy(ResCompiler,iReplace(ResCompiler,"$PELLES$",PellesPath()));
      strcpy(ResCompiler,iReplace(ResCompiler,"$LCC$\\",LccPath()));
      strcpy(ResCompiler,iReplace(ResCompiler,"$LCC$",LccPath()));
      strcpy(ResCompiler,iReplace(ResCompiler,"$FILE$",FileOutCopy));
      strcpy(ResCompiler,replace(ResCompiler,BKSLASH4,BKSLASH2));
      strcpy(ResCompiler,replace(ResCompiler,DDQ,DQ));
      printf("%s%s\n","Shelling Out To:",ResCompiler);
      system(ResCompiler);
    }
  if(NOTNULL(Linker)){
      strcpy(Linker,trim(RemoveStr(Linker,DQ)));
      if(inchr(Linker,SPC)){
          strcpy(Linker, join(5,DQ,extract(Linker,SPC),DQ,SPC,remain(Linker,SPC)));
        }
      else
        {
          strcpy(Linker,enc(Linker));
        }
      strcpy(Linker,iReplace(Linker,"$PELLES$\\",PellesPath()));
      strcpy(Linker,iReplace(Linker,"$PELLES$",PellesPath()));
      strcpy(Linker,iReplace(Linker,"$LCC$\\",LccPath()));
      strcpy(Linker,iReplace(Linker,"$LCC$",LccPath()));
      strcpy(Linker,iReplace(Linker,"$FILE$",FileOutCopy));
      strcpy(Linker,replace(Linker,BKSLASH4,BKSLASH2));
      strcpy(Linker,replace(Linker,DDQ,DQ));
      if(Use_Resource ){
          strcpy(ResFileOut, join(2,extract(Res_File,"."),".res"));
          strcpy(Linker, join(3,Linker,SPC,ResFileOut));
        }
      printf("%s%s\n","Shelling Out To:",Linker);
      system(Linker);
    }
  char szSave[BCXSTRSIZE];
  strcpy(szSave,FileOut);
  strcpy(FileOut,extract(FileOut,"."));
  for(int A=1; A<=XitCount; A++)
    {
      strcpy(Cmd,RemoveStr(Xit[A],DQ));
      strcpy(Cmd,iReplace(Cmd,"$FILE$",FileOutCopy));
      strcpy(Cmd,iReplace(Cmd,"$PELLES$\\",PellesPath()));
      strcpy(Cmd,iReplace(Cmd,"$PELLES$",PellesPath()));
      strcpy(Cmd,iReplace(Cmd,"$LCC$\\",LccPath()));
      strcpy(Cmd,iReplace(Cmd,"$LCC$",LccPath()));
      strcpy(Cmd,iReplace(Cmd,"$BCX$\\",BcxPath()));
      strcpy(Cmd,iReplace(Cmd,"$BCX$",BcxPath()));
      strcpy(Cmd,replace(Cmd,BKSLASH4,BKSLASH2));
      strcpy(Cmd,replace(Cmd,DDQ,DQ));
      printf("%s%s\n","Shelling Out To:",Cmd);
      system(Cmd);
    }
  strcpy(FileOut,szSave);
}

void Inject (char* szArg)
{
  char *szLine;
  szLine=(char*)calloc(c_MaxSrcLen, 1);
  strcpy(szLine,szArg);
  PreParse(szLine);
  FixUps();
  Function_Main_Support();
  if (szLine) {free(szLine);}
}

int Convert2SimpleFunction (int Tmp)
{
  int iLParen=Tmp+1;
  int iRParen=Tmp+2;
  int iRetVal=0;
  if(strcmp(Stk[iLParen],"(")==0  && strcmp(Stk[iRParen],")")==0){
      *Stk[iLParen]=0;
      *Stk[iRParen]=0;
      iRetVal++;
    }
  return iRetVal;
}

void PreParse (char* Statement)
{
  int i={0};
  int j={0};
  int InIF={0};
  int InXFOR={0};
  int Gapflag={0};
  char LTmp[BCXSTRSIZE]={0};
  if(Statement[0]==0 ){
      Ndx=0;
      return;
    }
  int RadixFlag={0};
  FastLexer(Statement,""," =()[]{}',+-*/<>?;.|:^");
  for(int ii=1; ii<=Ndx; ii++)
    {
      int  RadixBase={0};
      if(IsRadixLiteral(Stk[ii],&(RadixBase))){
          RadixFlag=TRUE;
          if(RadixBase==16 ){
              strcpy(Stk[ii],iReplace(Stk[ii],"&h","0x"));
              goto L1112;
            }
          if(RadixBase==8 ){
              strcpy(Stk[ii],str(VAL(join(2,"&o",mid(Stk[ii],3)))));
              goto L1112;
            }
          if(RadixBase==2 ){
              strcpy(Stk[ii],iReplace(Stk[ii],"&b","0b"));
            }

L1112:;

        }
    }
  if(RadixFlag==TRUE ){
      *Statement=0;
      for(int ii=1; ii<=Ndx; ii++)
        {
          strcat(Statement,Stk[ii]);
        }
    }
  int AmpFlag={0};
  if(Im_A_String_Var(Stk[1])){
      for(long k=2; k<=Ndx-1; k++)
        {
          if(*Stk[k]==0 ){
              goto L1114;
            }
          if(strcmp(Stk[k],"]")==0  && strcmp(Stk[k+1],"+")==0){
              strcpy(Stk[k+1],"&");
              AmpFlag=TRUE;
            }
        }
L1114:;
    }
  if(AmpFlag==TRUE ){
      *Statement=0;
      for(int ii=1; ii<=Ndx; ii++)
        {
          strcat(Statement,Stk[ii]);
        }
      AmpFlag=FALSE;
    }
  FastLexer(Statement,SPC,c_FULLSET);
  while(++i<20){
      *Stk[i+Ndx]=0;
    }
  for(int ii=1; ii<=Ndx; ii++)
    {
      if(*Stk[ii]==38&&*Stk[ii+1]==38 ){
          strcpy(Stk[ii],"and");
          LShiftStk(ii+1);
        }
    }
  if(m_iMatchWrd(Stk[1],"end")){
      strcpy(LTmp,enc(lcase(Stk[2]),(UCHAR)*(SPC)));
      if(iMatchNQ(" events , mdievents , mdichildevents ",LTmp)){
          strcpy(Stk[1], join(2,Stk[1],lcase(Stk[2])));
          if(m_iMatchWrd(Stk[3],"main")){
              Use_MainEvent=TRUE;
            }
          Ndx=1;
          strcpy(Src,Stk[1]);
          return;
        }
      if(strcmp(Stk[2],"=")!=0  && Ndx==2 ){
          if(m_iMatchWrd(Stk[2],"dialog")){
              strcpy(Stk[2],"function");
            }
          strcpy(Stk[1], join(2,"end",lcase(Stk[2])));
          Ndx=1;
          strcpy(Src,Stk[1]);
          return;
        }
    }
  if(m_iMatchWrd(Stk[1],"end")&&m_iMatchWrd(Stk[2],"prepend")){
      strcpy(Stk[1],"endprepend");
      strcpy(Src,Stk[1]);
      Ndx=1;
      return;
    }
  if(m_iMatchWrd(Stk[1],"end")&&m_iMatchWrd(Stk[2],"with")){
      strcpy(Stk[1],"endwith");
      strcpy(Src,Stk[1]);
      Ndx=1;
      return;
    }
  int iP=1;
  if(m_iMatchWrd(Stk[iP],"public")||m_iMatchWrd(Stk[iP],"private")){
      iP++;
    }
  if((m_iMatchWrd(Stk[iP],"function")||m_iMatchWrd(Stk[iP],"catch")||m_iMatchWrd(Stk[iP],"sub"))&&iMatchNQ(Statement,"*")){
        {
        int  ii;
        int  jjj;
        for(ii=2,jjj=1; ii<Ndx-1 && jjj; ii++)
          {
            jjj=m_GetAsPosF(ii,Ndx-2);
            if(jjj ){
                ii=jjj;
                if(m_iMatchWrd(Stk[ii+1],"const")){
                    ii++;
                  }
                while(strcmp(Stk[ii+2],"*")==0){
                    strcpy(Stk[ii+2],"PTR");
                    ii++;
                  }
              }
          }
          }
      BuildDelimStr(1,Ndx,Src);
      FastLexer(Src,SPC,c_FULLSET);
      strcpy(Statement,Src);
    }
  Gapflag=FALSE;
  for(i=1; i<=Ndx; i++)
    {
      if(IsDecimalNumber(Stk[i])&&BYTE_AT(Stk[i][1])>0 ){
          strcpy(Keyword1,right(Stk[i],1));
          if(*Keyword1==69||*Keyword1==101 ){
              strcpy(Stk[i], join(2,Stk[i],Stk[i+1]));
              strcpy(Stk[i], join(2,Stk[i],Stk[i+2]));
              *Stk[i+1]=0;
              *Stk[i+2]=0;
              if(strcmp(Stk[i-1],"-")==0){
                  strcpy(Stk[i-1], join(2,Stk[i-1],Stk[i]));
                  *Stk[i]=0;
                }
              Gapflag=TRUE;
            }
        }
    }
  if(Gapflag==TRUE ){
      RemEmptyTokens();
    }
  for(i=1; i<=Ndx; i++)
    {
      strcpy(Keyword1,lcase(Stk[i]));
      if(Keyword1[1]){
          if(strcmp(Keyword1,"not")==0){
              strcpy(Stk[i],"!");
              goto L1122;
            }
          if(strcmp(Keyword1,"is")==0){
              strcpy(Stk[i],"=");
              goto L1122;
            }
          if(strcmp(Keyword1,"xor")==0){
              strcpy(Stk[i],"xor");
              goto L1122;
            }
          if(strcmp(Keyword1,"if")==0  || strcmp(Keyword1,"iif")==0  || strcmp(Keyword1,"iif$")==0  || strcmp(Keyword1,"case")==0  || strcmp(Keyword1,"elseif")==0  || strcmp(Keyword1,"while")==0){
              InIF=1;
              if(strcmp(Keyword1,"case")==0  && m_iMatchWrd(Stk[i+1],"else")){
                  strcpy(Stk[i],"caseelse");
                  *Stk[i+1]=0;
                  Gapflag=TRUE;
                }
              else
                {
                  strcpy(Stk[i],Keyword1);
                }
              goto L1122;
            }
          if(strcmp(Keyword1,"$if")==0  || strcmp(Keyword1,"$ifdef")==0){
              InIF=1;
              goto L1122;
            }
          if(strcmp(Keyword1,"$endif")==0){
              InIF=0;
              goto L1122;
            }
          if(strcmp(Keyword1,"xfor")==0){
              InXFOR=1;
              goto L1122;
            }
          if(strcmp(Keyword1,"until")==0){
              InIF=InXFOR;
              InXFOR=0;
              goto L1122;
            }
          if(strcmp(Keyword1,"by")==0){
              InIF=0;
              goto L1122;
            }
          if(strcmp(Keyword1,"then")==0){
              InIF=0;
              goto L1122;
            }
          if(strcmp(Keyword1,"byval")==0  || strcmp(Keyword1,"let")==0){
              *Stk[i]=0;
              Gapflag=TRUE;
              goto L1122;
            }
          if(strcmp(Keyword1,"shl")==0){
              strcpy(Stk[i],"<<");
              goto L1122;
            }
          if(strcmp(Keyword1,"shr")==0){
              strcpy(Stk[i],">>");
              goto L1122;
            }
          if(strcmp(Keyword1,"byref")==0){
              if(!m_iMatchWrd(Stk[1],"declare")&&!m_iMatchWrd(Stk[1],"c_declare")){
                  if(ByrefCnt==c_MaxByref-1 ){
                      Abort("Maxium number of BYREFs reached.");
                    }
                  strcpy(ByrefVars[++ByrefCnt],Stk[i+1]);
                }
              int iDontHaveAs=TRUE;
              for(j=i; j<=Ndx; j++)
                {
                  if(m_iMatchWrd(Stk[j],"as")){
                      iDontHaveAs=FALSE;
                    }
                  if(strcmp(Stk[j+1],",")==0  || strcmp(Stk[j+1],")")==0){
                      strcpy(Stk[j],"PTR");
                      if(iDontHaveAs ){
                          InsertTokens(j-1,2,"as",VarTypeLookup[inchr(c_VARTYPES,right(ByrefVars[ByrefCnt],1))]);
                        }
                      goto L1123;
                    }
                  strcpy(Stk[j],Stk[j+1]);
                }
L1123:;
              goto L1122;
            }
          if(strcmp(Keyword1,"and")==0){
              if(InIF ){
                  strcpy(Stk[i],"&&");
                }
              else
                {
                  strcpy(Stk[i],"&");
                }
              goto L1122;
            }
          if(strcmp(Keyword1,"or")==0){
              if(InIF ){
                  strcpy(Stk[i],"||");
                }
              else
                {
                  strcpy(Stk[i],"|");
                }
              goto L1122;
            }
          if(strcmp(Keyword1,"procedure")==0){
              strcpy(Stk[i],"sub");
            }
          else
            {
              if(PassOne ){
                  if(strcmp(Keyword1,enc(vchr(1,92)))==0){
                      if(*Stk[i+1]!=c_DblQt ){
                          strcpy(Stk[i],"chr$");
                          InsertTokens(i,3,"(","92",")");
                          i+=(3);
                        }
                      else
                        {
                          strcpy(Stk[i], join(2,Stk[i],Stk[i+1]));
                          *Stk[i+1]=0;
                          Gapflag=TRUE;
                        }
                    }
                  else
                    {
                      if(TranslateSlash ){
                          strcpy(Stk[i],replace(Stk[i],BKSLASH1,BKSLASH2));
                        }
                    }
                }
            }

L1122:;

        }
      else
        {
          if((UCHAR)*(Keyword1)==38 ){
              if(inchr("+&,(=",Stk[i-1])&&*Stk[i+1]!=46 ){
                  strcpy(Stk[i+1], join(2," &",Stk[i+1]));
                  *Stk[i]=0;
                  Gapflag=TRUE;
                }
              goto L1124;
            }
          if((UCHAR)*(Keyword1)==63 ){
              if(bcx_stricmp(Stk[1],"IF")==0){
                  goto L1124;
                }
              if(Use_GUINoMain||Use_MDIGUINoMain||Use_Wingui ){
                  strcpy(Stk[i],"msgbox");
                  if(strcmp(Stk[i+1],"")==0){
                      strcpy(Stk[i+1],enc(""));
                      Ndx++;
                    }
                }
              else
                {
                  if(i==1||(i>1 && strcmp(Stk[i-1],":")==0)){
                      strcpy(Stk[i],"print");
                    }
                }
              goto L1124;
            }
          if((UCHAR)*(Keyword1)==45 ){
              if((UCHAR)*(Stk[i+1])==62 ){
                  strcpy(Stk[i], join(2,"->",Stk[i+2]));
                  *Stk[++i]=0;
                  *Stk[++i]=0;
                  Gapflag=TRUE;
                }
              goto L1124;
            }
          if((UCHAR)*(Keyword1)==46 ){
              if((UCHAR)*(Stk[i+1])==46&&(UCHAR)*(Stk[i+2])==46 ){
                  strcpy(Stk[i],"...");
                  *Stk[i+1]=0;
                  *Stk[i+2]=0;
                  Gapflag=TRUE;
                }
              if(IsDecimalNumber(Stk[i-1])){
                  strcpy(Stk[i], join(2,Stk[i-1],"."));
                  *Stk[i-1]=0;
                  Gapflag=TRUE;
                }
              if(!inchr(",)=<>*/+-^",Stk[i+1])){
                  strcpy(Stk[i], join(2,Stk[i],Stk[i+1]));
                  *Stk[++i]=0;
                  Gapflag=TRUE;
                }
            }

L1124:;

        }
    }
  if(Gapflag==TRUE ){
      RemEmptyTokens();
    }
  if(PassOne==TRUE ){
      char lszTmp[BCXSTRSIZE];
      *lszTmp=0;
      if(InFunction ){
          for(i=1; i<=Ndx; i++)
            {
              for(j=1; j<=ByrefCnt; j++)
                {
                  if(m_iMatchLft(Stk[i]," &")){
                      strcpy(lszTmp,Stk[i]+2);
                    }
                  else
                    {
                      strcpy(lszTmp,Stk[i]);
                    }
                  if(strcmp(No_Sigil(lszTmp),No_Sigil(ByrefVars[j]))==0){
                      if(i>2 ){
                          if(inchr("+-^%*/|&<=>,",Stk[i-2]) && strcmp(Stk[i-1],"*")==0){
                              *Stk[i-1]=0;
                              Gapflag=TRUE;
                            }
                          if(m_iMatchLft(Stk[i]," &")){
                              strcpy(Stk[i],Stk[i]+2);
                              goto L1126;
                            }
                        }
                      else if(i==2 ){
                          if(strcmp(Stk[i-1],"*")==0){
                              *Stk[i-1]=0;
                              Gapflag=1;
                            }
                        }
                      strcpy(Stk[i], join(2,"*",Stk[i]));
                      if(strcmp(Stk[i-1],"(")!=0  || strcmp(Stk[i+1],")")!=0){
                          strcpy(Stk[i],enc(Stk[i],40,41));
                        }
                      goto L1126;
                    }
                }
L1126:;
            }
        }
      if(Gapflag==TRUE ){
          RemEmptyTokens();
        }
    }
  if(m_iMatchWrd(Stk[1],"dim")){
      if(m_iMatchWrd(Stk[Ndx-1],"static")){
          strcpy(Stk[1],"static");
          strcpy(Stk[Ndx-1],Stk[Ndx]);
          Ndx--;
        }
    }
  strcpy(Keyword1,lcase(Stk[1]));
  if(InTypeDef&&!InClass ){
      char lsz[BCXSTRSIZE];
      *lsz=0;
      strcpy(lsz,enc(Keyword1,(UCHAR)*(SPC)));
      if(iMatchNQ(" end dim declare type union ",lsz)==0 ){
          int iCnt=0;
          int iFnd=0;
          if(MacroCount ){
              for(iCnt=0; iCnt<MacroCount; iCnt++)
                {
                  if(strcmp(Stk[1],ConstMacro[iCnt])==0){
                      iFnd=TRUE;
                    }
                }
            }
          if(iFnd==FALSE ){
              InsertTokens(0,1,"dim");
            }
        }
    }
  if(!InTypeDef&&!InCppTypeDef ){
      int Res={0};
      char lszTemp[BCXSTRSIZE]={0};
      char Storage[BCXSTRSIZE]={0};
      strcpy(Storage," dim local global raw static shared dynamic auto register extern ");
      strcpy(lszTemp,enc(Keyword1,(UCHAR)*(SPC)));
      if(iMatchNQ(Storage,lszTemp)){
          Res=1;
        }
      strcpy(lszTemp,enc(lcase(Stk[2]),(UCHAR)*(SPC)));
      if(iMatchNQ(Storage,lszTemp)){
          Res=2;
        }
      if(Res>0 ){
          i=Ndx;
          while(i>1 && strcmp(Stk[i],")")!=0){
              if(m_iMatchWrd(Stk[i],"as")){
                  if(m_iMatchWrd(Stk[i+1],"function")){
                      if(i+1==Ndx ){
                          *Stk[i]=0;
                        }
                      *Stk[i+1]=0;
                      InsertTokens(Res,1,"function");
                    }
                  else if(m_iMatchWrd(Stk[i+1],"sub")){
                      if(i+1==Ndx ){
                          *Stk[i]=0;
                        }
                      *Stk[i+1]=0;
                      InsertTokens(Res,1,"sub");
                    }
                  RemEmptyTokens();
                  goto L1128;
                }
              i--;
            }
L1128:;
        }
    }
  if(InTypeDef||m_iMatchWrd(Stk[1],"declare")||m_iMatchWrd(Stk[1],"c_declare")){
      if(m_iMatchWrd(Stk[2],"sub")||m_iMatchWrd(Stk[2],"function")){
          for(int mm=2; mm<=Ndx; mm++)
            {
              if(m_iMatchLft(Stk[mm],"as")&&m_iMatchWrd(Stk[mm+1],"string")){
                  if(*Stk[mm+2]!=42 ){
                      strcpy(Stk[mm+1],"char *");
                    }
                }
            }
        }
    }
}

void FuncSubTemplate (int Tmp)
{
  int  iConc=++Tmp;
  if(strcmp(Stk[++Tmp],"<")!=0){
      return;
    }
    {
    int  i;
    int  NotFnd;
    for(i=Tmp,NotFnd=TRUE; NotFnd==TRUE && i<=Ndx; i++)
      {
        if(strcmp(Stk[i],"(")==0){
            NotFnd=FALSE;
          }
        else
          {
            if(strcmp(Stk[i],",")==0){
                strcpy(Stk[i],vchr(1,18));
              }
            strcpy(Stk[iConc], join(2,Stk[iConc],Stk[i]));
            *Stk[i]=0;
          }
      }
      }
  RemEmptyTokens();
}

void TokenSubstitutions (int iSubLoc)
{
  int  A;
  int  i;
  int  iAlphaIdx;
  int  j;
  int  Tmp;
  char Keyword[BCXSTRSIZE];
  int CompToken;
  int NoTrans;
  struct _UDT_SUB_FUNC_TOKENS*  tpBCX;
  i=m_GetAsPosF(1,Ndx);
  if(i ){
      if(m_iMatchWrd(Stk[i+1],"string")){
          if(strcmp(Stk[i+2],"*")==0){
              strcpy(Stk[i],"[");
              strcpy(Stk[i+1],Stk[i+3]);
              strcpy(Stk[i+2],"]");
              strcpy(Stk[i+3],"as");
              Ndx++;
              strcpy(Stk[Ndx],"char");
            }
        }
    }
  Convert_Chr2VChr();
  if(InFunction==FALSE ){
      for(i=1; i<=Ndx; i++)
        {
          if(m_iMatchWrd(Stk[i],"global")){
              strcpy(Stk[i],"dim");
            }
        }
    }
  A=FALSE;
  if(m_iMatchWrd(Stk[1],"pptype")==0 ){
      for(Tmp=1; Tmp<=Ndx; Tmp++)
        {
          if(*Stk[Tmp]==48&&!m_iMatchWrd(mid(Stk[Tmp],2,1),"b")&&!m_iMatchWrd(mid(Stk[Tmp],2,1),"x")&&!m_iMatchWrd(mid(Stk[Tmp],2,1),".")&&!m_iMatchWrd(mid(Stk[Tmp],2,1),"l")){
              strcpy(Stk[Tmp],ltrim(Stk[Tmp],48));
              if(ISNULL(Stk[Tmp])){
                  strcpy(Stk[Tmp],"0");
                }
            }
          if(m_iMatchWrd(Stk[Tmp],"xor")){
              strcpy(Stk[Tmp],"^");
            }
          else
            {
              if(strcmp(Stk[Tmp],"=")==0){
                  if(*Stk[Tmp+1]==62 ){
                      strcpy(Stk[Tmp],">");
                      strcpy(Stk[Tmp+1],"=");
                    }
                  if(*Stk[Tmp+1]==60 ){
                      strcpy(Stk[Tmp],"<");
                      strcpy(Stk[Tmp+1],"=");
                    }
                  goto L1133;
                }
              if(strcmp(Stk[Tmp],"<")==0){
                  if(*Stk[Tmp+1]==62 ){
                      strcpy(Stk[Tmp],"!=");
                      *Stk[Tmp+1]=0;
                      A=TRUE;
                    }
                  goto L1133;
                }
              if(strcmp(Stk[Tmp],">")==0){
                  if(*Stk[Tmp+1]==60 ){
                      strcpy(Stk[Tmp],"!=");
                      *Stk[Tmp+1]=0;
                      A=TRUE;
                    }
                  goto L1133;
                }
              if(strcmp(Stk[Tmp],"!")==0){
                  if(*Stk[Tmp+1]==61 ){
                      strcpy(Stk[Tmp],"!=");
                      *Stk[Tmp+1]=0;
                      A=TRUE;
                    }
                }

L1133:;

            }
        }
    }
  if(A==TRUE ){
      RemEmptyTokens();
    }
  CompToken=0;
  for(Tmp=1; Tmp<=Ndx; Tmp++)
    {
      A=LookupVarType(Stk[Tmp],&(i));
      if(A==vt_STRUCT||A==vt_UDT||A==vt_UNION ){
          CompToken=1;
        }
      if(m_iMatchWrd(Stk[Tmp],"int") && strcmp(Stk[Tmp+1],"(")==0){
          strcpy(Stk[Tmp],"int");
        }
      if(m_iMatchWrd(Stk[Tmp],"int") && strcmp(Stk[Tmp+1],"(")==0  && strcmp(Stk[Tmp+2],")")!=0){
          strcpy(Stk[Tmp],"floor");
        }
      else if(m_iMatchWrd(Stk[Tmp],"integer")){
          strcpy(Stk[Tmp],"int");
        }
      else
        {
          if(m_iMatchWrd(Stk[Tmp],"fint") && strcmp(Stk[Tmp+1],")")==0){
              strcpy(Stk[Tmp],"int");
            }
        }
    }
  NoTrans=0;
  for(Tmp=1; Tmp<=Ndx; Tmp++)
    {
      if(NoTrans==1 ){
          goto L1135;
        }
      strcpy(Keyword,lcase(Stk[Tmp]));
      tpBCX=GetWordInfo(Keyword);
      if(tpBCX ){
          if((tpBCX->iTRAN_FLAG  &  iSubLoc)!=iSubLoc ){
              continue;
            }
          if((tpBCX->iWordInfo  &  eWI_ReplaceWord)){
              if((tpBCX->iWordInfo  &  eWI_Position1)==0 ){
                  strcpy(Stk[Tmp],tpBCX->pszFunctionXName);
                  continue;
                }
              else if(Tmp==1 ){
                  strcpy(Stk[Tmp],tpBCX->pszFunctionXName);
                  continue;
                }
            }
        }
      iAlphaIdx=inchr("abcdefghijklmnopqrstuvwxyz$",Keyword);
      if(iAlphaIdx==1 ){
          if(strcmp(Keyword,"acosh")==0){
              strcpy(Stk[Tmp],"acosh");
              Use_Acosh=Use_Proto=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"addressof")==0){
              strcpy(Stk[Tmp+1], join(2,"&",Stk[Tmp+1]));
              *Stk[Tmp]=0;
              goto L1137;
            }
          if(strcmp(Keyword,"appactivate")==0){
              strcpy(Stk[Tmp],"AppActivate");
              Use_AppActivate=Use_BcxTempStr=Use_Instr=Use_Stristr=TRUE;
              Use_Lcase=Use_Left=Use_UCaseTbl=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"appexename$")==0){
              strcpy(Stk[Tmp],"AppExeName$()");
              Use_AppExeName=Use_BcxTempStr=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"appexepath$")==0){
              strcpy(Stk[Tmp],"AppExePath$()");
              Convert2SimpleFunction(Tmp);
              Use_AppExePath=Use_BcxTempStr=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"ansitowide")==0  || strcmp(Keyword,"ansitowide$")==0  || strcmp(Keyword,"a2w$")==0  || strcmp(Keyword,"a2w")==0){
              strcpy(Stk[Tmp],"AnsiToWide");
              Use_AnsiToWide=Use_BcxTempStr=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"andalso")==0){
              strcpy(Stk[Tmp]," &&");
              goto L1137;
            }
          if(strcmp(Keyword,"asc")==0){
              Process_ASC_Function(Tmp);
              goto L1137;
            }
          if(strcmp(Keyword,"arrayputelement")==0){
              char sTmp[BCXSTRSIZE]={0};
              Add2SplitLines("BEGINBLOCK");
              strcpy(sTmp, join(3,"DIM RAW lIndex[",Stk[Tmp+6],"] = {"));
              for(i=Tmp+8; i<=Ndx-1; i++)
                {
                  strcat(sTmp,Stk[i]);
                }
              Add2SplitLines(join(2,sTmp,"} AS long"));
              strcpy(Stk[Tmp],"SafeArrayPutElement");
              *sTmp=0;
              for(i=1; i<=Tmp+3; i++)
                {
                  strcat(sTmp,Stk[i]);
                }
              Add2SplitLines(join(4,sTmp,"lIndex,(void *)&",Stk[Tmp+4],")"));
              Add2SplitLines("ENDBLOCK");
              Ndx=0;
              goto L1137;
            }
          if(strcmp(Keyword,"arraygetelement")==0){
              char sTmp[BCXSTRSIZE]={0};
              Add2SplitLines("BEGINBLOCK");
              strcpy(sTmp, join(3,"DIM RAW lIndex[",Stk[Tmp+6],"] = {"));
              for(i=Tmp+8; i<=Ndx-1; i++)
                {
                  strcat(sTmp,No_Sigil(Stk[i]));
                }
              Add2SplitLines(join(2,sTmp,"} AS long"));
              strcpy(Stk[Tmp],"SafeArrayGetElement");
              *sTmp=0;
              for(i=1; i<=Tmp+3; i++)
                {
                  strcat(sTmp,No_Sigil(Stk[i]));
                }
              Add2SplitLines(join(4,sTmp,"lIndex,(void *)&",No_Sigil(Stk[Tmp+4]),")"));
              Add2SplitLines("ENDBLOCK");
              Ndx=0;
              goto L1137;
            }
          if(strcmp(Keyword,"asinh")==0){
              strcpy(Stk[Tmp],"asinh");
              Use_Asinh=Use_Proto=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"atanh")==0){
              strcpy(Stk[Tmp],"atanh");
              Use_Atanh=Use_Proto=TRUE;
              goto L1137;
            }
          if(strcmp(Keyword,"auto")==0){
              if(m_iMatchWrd(Stk[Tmp+1],"local")){
                  strcpy(Stk[Tmp],"dim");
                  strcpy(Stk[Tmp+1],"raw");
                }
              else
                {
                  strcpy(Stk[Tmp],"auto");
                }
              goto L1137;
            }
          if(strcmp(Keyword,"acode$")==0  || strcmp(Keyword,"acode")==0){
              strcpy(Stk[Tmp],"$$WideToAnsi$");
              Use_WideToAnsi=Use_BcxTempStr=TRUE;
            }

L1137:;

          goto L1136;
        }
      if(iAlphaIdx==2 ){
          if(strcmp(Keyword,"bcopy")==0){
              *Stk[1]=0;
              for(i=Tmp+1; i<=Ndx; i++)
                {
                  if(m_iMatchWrd(Stk[i],"to")){
                      goto L1143;
                    }
                  strcpy(Stk[1], join(2,Stk[1],Stk[i]));
                  strcpy(Stk[1], join(2,Stk[1],vchr(1,1)));
                }
L1143:;
              *Stk[2]=0;
              for(i=i+1; i<=Ndx; i++)
                {
                  strcpy(Stk[2], join(2,Stk[2],Stk[i]));
                  strcpy(Stk[2], join(2,Stk[2],vchr(1,1)));
                }
              *Src=0;
              strcpy(Src, join(7,Src,"memmove",vchr(1,1),"((char*)",vchr(1,1),"&",vchr(1,1)));
              strcpy(Src, join(6,Src,Stk[2],",(const char*)",vchr(1,1),"&",vchr(1,1)));
              strcpy(Src, join(8,Src,Stk[1],",",vchr(1,1),"sizeof",vchr(1,1),"(",vchr(1,1)));
              strcpy(Src, join(5,Src,Stk[2],")",vchr(1,1),")"));
              strcpy(Src,RemoveStr(Src,"&*"));
              FastLexer(Src,vchr(1,1),"");
              goto L1142;
            }
          if(strcmp(Keyword,"begin")==0){
              Inject_Local_Bcx_RetVal=TRUE;
              if(m_iMatchWrd(Stk[Tmp+1],"events")||m_iMatchWrd(Stk[Tmp+1],"mdievents")||m_iMatchWrd(Stk[Tmp+1],"mdichildevents")){
                  if(Indent ){
                      printf("%s\n",repeat(80,"_"));
                      printf("%s\n","Possible missing END IF before start of BEGIN");
                      printf("%s\n",repeat(80,"_"));
                    }
                  if(Ndx==3 ){
                      strcpy(Src, join(3,"FUNCTION|",Stk[Tmp+2],"(hWnd|AS|HWND,Msg|AS|UINT,wParam|AS|WPARAM,lParam|AS|LPARAM)|AS|LRESULT|CALLBACK"));
                    }
                  else
                    {
                      strcpy(Src,"FUNCTION|WndProc(hWnd|AS|HWND,Msg|AS|UINT,wParam|AS|WPARAM,lParam|AS|LPARAM)|AS|LRESULT|CALLBACK");
                    }
                  FastLexer(Src,"|",",()");
                  Use_Wingui=TRUE;
                  return;
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bel$")==0){
              strcpy(Stk[Tmp],"BEL$");
              Use_BEL=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bs$")==0){
              strcpy(Stk[Tmp],"BS$");
              Use_BS=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcxstrsize")==0){
              strcpy(Stk[Tmp],"BCXSTRSIZE");
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_dynacall")==0){
              strcpy(Stk[Tmp],"BCX_DynaCallA");
              Use_DynacallCommon=Use_DynacallA=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_font")==0){
              strcpy(Stk[Tmp],ucase(Stk[Tmp]));
              char temp[BCXSTRSIZE]={0};
              int iNextToken=Tmp+1;
              strcpy(Stk[iNextToken],No_Sigil(Stk[iNextToken]));
              strcpy(temp,ucase(Stk[iNextToken]));
              if(strcmp(temp,".NAME")==0){
                  strcpy(Stk[iNextToken],".lf.lfFaceName$");
                  goto L1145;
                }
              if(strcmp(temp,".BOLD")==0){
                  strcpy(Stk[iNextToken],".lf.lfWeight");
                  goto L1145;
                }
              if(strcmp(temp,".UNDERLINE")==0){
                  strcpy(Stk[iNextToken],".lf.lfUnderline");
                  goto L1145;
                }
              if(strcmp(temp,".STRIKEOUT")==0){
                  strcpy(Stk[iNextToken],".lf.lfStrikeOut");
                  goto L1145;
                }
              if(strcmp(temp,".ITALIC")==0){
                  strcpy(Stk[iNextToken],".lf.lfItalic");
                  goto L1145;
                }
              if(strcmp(temp,".CHARSET")==0){
                  strcpy(Stk[iNextToken],".lf.lfCharSet");
                  goto L1145;
                }
              if(strcmp(temp,".SIZE")==0  || strcmp(temp,".RGB")==0){
                  strcpy(Stk[iNextToken],temp);
                }

L1145:;

              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setcursor")==0){
              strcpy(Stk[Tmp],"BCX_SetCursor");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_SetCursor=Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_msgpump")==0){
              strcpy(Stk[Tmp],"BCX_MsgPump");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_MsgPump=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_wnd")==0){
              strcpy(Stk[Tmp],"BCX_Wnd");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Wnd=Use_BCX_InitGUI=Use_BCX_SetMetric=Use_BCX_RegWnd=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_framewnd")==0){
              strcpy(Stk[Tmp],"BCX_FrameWnd");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_FrameWnd=Use_BCX_RegWnd=Use_BCX_InitGUI=Use_BCX_SetMetric=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setbkgrdbrush")==0){
              strcpy(Stk[Tmp],"BCX_SetBkGrdBrush");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_SetBkGrdBrush=Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setclassstyle")==0){
              strcpy(Stk[Tmp],"BCX_SetClassStyle");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_SetClassStyle=Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_seticon")==0){
              strcpy(Stk[Tmp],"BCX_SetIcon");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_SetIcon=Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_seticonsm")==0){
              strcpy(Stk[Tmp],"BCX_SetIconSm");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_SetIconSm=Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setmetric")==0){
              strcpy(Stk[Tmp],"BCX_SetMetric");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_SetMetric=Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_initgui")==0){
              strcpy(Stk[Tmp],"BCX_InitGUI");
              Use_BCX_InitGUI=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_regwnd")==0){
              strcpy(Stk[Tmp],"BCX_RegWnd");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_RegWnd=Use_BCX_InitGUI=Use_BCX_SetMetric=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_mdi_msgpump")==0){
              strcpy(Stk[Tmp],"BCX_MDI_MsgPump");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_MDI_MsgPump=TRUE;
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_wndclass")==0){
              strcpy(Stk[Tmp],"BCX_WndClass");
              AddGUIGlobals();
              goto L1142;
            }
          if(strcmp(Keyword,"bcxsplitpath$")==0){
              strcpy(Stk[Tmp],"$$BcxSplitPath$");
              Use_BcxSplitPath=Use_BcxTempStr=TRUE;
              Use_SysMacros=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcxpath$")==0){
              strcpy(Stk[Tmp],"BcxPath$()");
              Convert2SimpleFunction(Tmp);
              Use_BCX_Path=Use_RegString=TRUE;
              Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_pensize")==0){
              strcpy(Stk[Tmp],"BCX_Pensize");
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_penstyle")==0){
              strcpy(Stk[Tmp],"BCX_Penstyle");
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_arc")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Arc");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Arc=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_pie")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Pie");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Pie=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_bitmap")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Bitmap");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Bitmap=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_blit")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Blit");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Blit=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_blit_stretch")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Blit_Stretch");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Blit_Stretch=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_blit_sprite")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Blit_Sprite");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Blit_Sprite=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_buffer")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_BUFFER");
              Use_BCX_Buffer=Use_Proto=TRUE;
              AddGrafixVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_buffer_start")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_BUFFER_START");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Buffer=Use_Proto=TRUE;
              AddGrafixVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_buffer_stop")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_BUFFER_STOP");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Buffer=Use_Proto=TRUE;
              AddGrafixVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_olepicture")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_OlePicture");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_OlePicture=Use_GetResource=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_ole_width")==0){
              strcpy(Stk[Tmp],"BCX_OLE_WIDTH");
              Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_ole_height")==0){
              strcpy(Stk[Tmp],"BCX_OLE_HEIGHT");
              Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_blackrect")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_BlackRect");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Blackrect=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_button")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Button");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Button=Use_GetTextSize=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_bmpbutton")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_BmpButton");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BmpButton=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_splitbutton")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_SplitButton");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_SplitButton=Use_GetTextSize=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_bmpwidth")==0){
              strcpy(Stk[Tmp],"BCX_BmpWidth");
              Use_BCX_BmpWidth=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_bmpheight")==0){
              strcpy(Stk[Tmp],"BCX_BmpHeight");
              Use_BCX_BmpHeight=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_checkbox")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Checkbox");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Checkbox=Use_GetTextSize=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_combobox")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Combobox");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Combobox=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_console")==0){
              strcpy(Stk[Tmp],"hConsole");
              Use_Console=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_com_error")==0){
              strcpy(Stk[Tmp],"COM_BCX_ERROR");
              ComSwitchON=Use_COM=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_control")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Control");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Control=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_colordlg")==0){
              strcpy(Stk[Tmp],"BCX_ColorDlg");
              if(!inchr(Src,"(")){
                  strcpy(Stk[Tmp], join(2,Stk[Tmp],"()"));
                }
              Use_BCX_Colordlg=Use_Hook=Use_BcxTempStr=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_cursor")==0){
              strcpy(Stk[Tmp],"BCX_Cursor");
              Use_BCX_Cursor=Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_datepick")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_DatePick");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Datepick=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_edit")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Edit");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Edit=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_circle")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Circle");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Circle=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_ellipse")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Ellipse");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Ellipse=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_mdialog")==0){
              AddBcxFontVar();
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              if(InWinMain&&!Use_BCXMDialog ){
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"BCX_hInstance = hInst;");
                  iEmitVarGroup=iEmitVarGroup|(eFontGroup|eBCX_hInstance);
                }
              strcpy(Stk[Tmp],"BCX_MDialog");
              if(Tmp==3 ){
                  strcpy(Stk[Tmp+1],"((DLGPROC)");
                }
              Use_BCXDialogCommon=Use_BCXMDialog=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_dialog")==0){
              AddBcxFontVar();
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              strcpy(Stk[Tmp],"BCX_Dialog");
              if(Tmp==3 ){
                  strcpy(Stk[Tmp+1],"((DLGPROC)");
                }
              Use_BCXDialogCommon=Use_BCXDialog=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_form")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Form");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Form=Use_Proto=Use_MainEvent=TRUE;
              if(!Use_BCX_Class_Info ){
                  Use_BCX_Class_Info=TRUE;
                  iEmitVarGroup=iEmitVarGroup|(eFontGroup|eClassName);
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_fontdlg")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_FontDlg");
              if(Tmp==Ndx ){
                  strcpy(Stk[Tmp], join(2,Stk[Tmp],"()"));
                }
              Use_BCX_Fontdlg=TRUE;
              Use_Hook=Use_BcxTempStr=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_floodfill")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_FloodFill");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Floodfill=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_get")==0){
              strcpy(Stk[Tmp],"BCX_Get");
              Use_BCX_Get=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_get_window_height")==0){
              strcpy(Stk[Tmp],"BCX_Get_Window_Height");
              Use_BCX_Get_Window_Height=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_get_window_width")==0){
              strcpy(Stk[Tmp],"BCX_Get_Window_Width");
              Use_BCX_Get_Window_Width=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_get_text$")==0){
              strcpy(Stk[Tmp],"$$BCX_Get_Text$");
              Use_GetText=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_getpixel")==0){
              strcpy(Stk[Tmp],"BCX_Getpixel");
              Use_BCX_Getpixel=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_gradient")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Gradient");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Gradient=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_grayrect")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_GrayRect");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Grayrect=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_group")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Group");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Group=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_icon")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Icon");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Icon=Use_GetResource=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_input")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Input");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Input=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_label")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Label");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Label=Use_GetTextSize=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_line")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Line");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Line=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_polar_line")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Polar_Line");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Line=Use_Proto=TRUE;
              Use_BCX_Polar_Line=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_lineto")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Lineto");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Lineto=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_triangle")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Triangle");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Triangle=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_listbox")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Listbox");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Listbox=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_listview")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_ListView");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Listview=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_loadbmp")==0){
              strcpy(Stk[Tmp],"BCX_LoadBMP");
              Use_BCX_LoadBMP=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_loadimage")==0){
              strcpy(Stk[Tmp],"BCX_LoadImage");
              Use_BCX_LoadImage=Use_GetResource=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_print")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Print");
              Use_BCX_Print=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_printex")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Printex");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Printex=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_polygon")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Polygon");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Polygon=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_polybezier")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_PolyBezier");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_PolyBezier=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_polyline")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Polyline");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Polyline=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_preset")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Preset");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Preset=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_pset")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Pset");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Pset=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_polar_pset")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Polar_Pset");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Pset=Use_Proto=TRUE;
              Use_BCX_Polar_Pset=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_polar_line")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Polar_Line");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Line=Use_Proto=TRUE;
              Use_BCX_Polar_Line=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_progressbar")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_ProgressBar");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_ProgressBar=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_put")==0){
              strcpy(Stk[Tmp],"BCX_Put");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Put=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_radio")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Radio");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Radio=Use_GetTextSize=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_rectangle")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Rectangle");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Rectangle=Use_BcxTempStr=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_resize")==0){
              strcpy(Stk[Tmp],"BCX_RESIZE");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Resize=Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_richedit")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_RichEdit");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Richedit=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_roundrect")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Roundrect");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Roundrect=Use_Proto=TRUE;
              AddPenSizeVariables();
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_slider")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Slider");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Slider=Use_Label=Use_GetTextSize=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_splitter")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Splitter");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Splitter=Use_Proto=Use_Modstyle=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setsplitpos")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_SetSplitPos");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Splitter=Use_Proto=Use_Modstyle=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_tab")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Tab");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Tab=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_toolbar")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Toolbar");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_Toolbar=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_updown")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_UpDown");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_UpDown=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_version$")==0){
              strcpy(Stk[Tmp],enc(Version));
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_get_updown")==0){
              strcpy(Stk[Tmp],"BCX_Get_UpDown");
              Use_BCX_Get_UpDown=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_set_form_color")==0){
              strcpy(Stk[Tmp],"BCX_Set_Form_Color");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_SetFormColor=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setclientsize")==0){
              Use_Setclientsize=Use_Proto=TRUE;
              strcpy(Stk[Tmp],"BCX_SetClientSize");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_set_font")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Set_Font");
              Use_SetFont=Use_Proto=TRUE;
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setcolor")==0){
              strcpy(Stk[Tmp],"Set_Color");
              int iPCnt=GetNumArgs(Tmp+2);
              if(iPCnt==1 ){
                  InsertTokens(Ndx-1,4,",","(HDC)wParam",",","(HWND)lParam");
                }
              else if(iPCnt==2 ){
                  InsertTokens(Ndx-1,2,",","(HWND)lParam");
                }
              Use_SetColor=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_set_text")==0){
              strcpy(Stk[Tmp],"BCX_Set_Text");
              Use_SetText=Use_Proto=TRUE;
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_status")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Status");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Status=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_stricmp")==0){
              strcpy(Stk[Tmp],"bcx_stricmp");
              Use_BCX_stricmp=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_setconsolesize")==0){
              strcpy(Stk[Tmp],"BCX_SetConsoleSize");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Consolesize=Use_Console=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_pushconsolesize")==0){
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  strcpy(Stk[Tmp],"BCX_PushConsoleSize()");
                }
              Use_Consolesize=Use_Console=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_popconsolesize")==0){
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  strcpy(Stk[Tmp],"BCX_PopConsoleSize()");
                }
              Use_Consolesize=Use_Console=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_tabselect")==0){
              strcpy(Stk[Tmp],"BCX_TabSelect(hWnd, lParam)");
              Use_BCX_Tab=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_tile")==0){
              Use_BCX_Tile=Use_Proto=TRUE;
              strcpy(Stk[Tmp],"BCX_Tile");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_thread")==0  || strcmp(Keyword,"bcx_threadwait")==0  || strcmp(Keyword,"bcx_threadsuspend")==0  || strcmp(Keyword,"bcx_threadresume")==0  || strcmp(Keyword,"bcx_threadkill")==0  || strcmp(Keyword,"bcx_threadend")==0){
              strcpy(Stk[Tmp],ucase(Stk[Tmp]));
              Use_Threads=Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_tooltip")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_ToolTip");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BCX_ToolTip=Use_Proto=TRUE;
              AddGlobal("BCX_hWnd_ToolTip",vt_HWND);
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_tempstr")==0){
              strcpy(Stk[Tmp],"BCX_TempStr");
              Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_treeview")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_Treeview");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Treeview=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_whiterect")==0){
              AddBcxFontVar();
              strcpy(Stk[Tmp],"BCX_WhiteRect");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Whiterect=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_clsid$")==0){
              strcpy(Stk[Tmp],"BCX_CLSID$");
              Use_Proto=Use_BcxTempStr=TRUE;
              Use_COM_CLSID=Use_AnsiToWide=Use_WideToAnsi=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bcx_dispatchobject")==0){
              Use_BcxTempStr=TRUE;
              ComSwitchON=Use_COM=TRUE;
              Use_COM_CreateObject=TRUE;
              Use_COM_DispatchObject=TRUE;
              Use_COM_GetObject=TRUE;
              Use_COM_GetProperty=TRUE;
              Use_COM_InvokeMethod=TRUE;
              Use_COM_SafeArray=TRUE;
              Use_COM_SetProperty=TRUE;
              Use_COM_UsesConversion=TRUE;
              char szObj[BCXSTRSIZE]={0};
              strcpy(szObj,"&");
              char szUnknown[BCXSTRSIZE]={0};
              char szRelease[BCXSTRSIZE]={0};
              int  iTobj={0};
              iTobj=1;
              while(strcmp(Stk[iTobj],"=")!=0){
                  strcat(szObj,Stk[iTobj]);
                  iTobj++;
                }
              iTobj=Tmp+2;
              while(strcmp(Stk[iTobj],",")!=0  && strcmp(Stk[iTobj],")")!=0){
                  strcat(szUnknown,Stk[iTobj]);
                  iTobj++;
                }
              if(strcmp(Stk[iTobj],")")==0){
                  strcpy(szRelease,"TRUE");
                }
              else
                {
                  strcpy(szRelease,Stk[iTobj+1]);
                }
              strcpy(Stk[1],"BCX_DispatchObject");
              strcpy(Stk[2],"(");
              strcpy(Stk[3],szUnknown);
              strcpy(Stk[4],",");
              strcpy(Stk[5],szObj);
              strcpy(Stk[6],",");
              strcpy(Stk[7],szRelease);
              strcpy(Stk[8],")");
              Ndx=8;
              goto L1142;
            }
          if(strcmp(Keyword,"bff$")==0){
              strcpy(Stk[Tmp],"$$BFF$");
              Use_Bff=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bin$")==0){
              strcpy(Stk[Tmp],"$$Bin$");
              Use_Bin=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bin2dec")==0){
              strcpy(Stk[Tmp],"Bin2Dec");
              Use_Bin2dec=Use_Proto=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bool$")==0){
              strcpy(Stk[Tmp],"$$BoolStr$");
              Use_Boolstr=Use_BcxTempStr=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bool")==0){
              strcpy(Stk[Tmp],"BOOL");
              goto L1142;
            }
          if(strcmp(Keyword,"boolean")==0){
              strcpy(Stk[Tmp],"BOOLEAN");
              goto L1142;
            }
          if(strcmp(Keyword,"band")==0){
              if(*Stk[Tmp+1]==61 ){
                  strcpy(Stk[Tmp+1],"&=");
                  *Stk[Tmp]=0;
                }
              else
                {
                  strcpy(Stk[Tmp]," & ");
                }
              goto L1142;
            }
          if(strcmp(Keyword,"bnot")==0){
              strcpy(Stk[Tmp]," BNOT ");
              Use_Bnot=Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"byte_at")==0){
              strcpy(Stk[Tmp],"BYTE_AT");
              Use_ByteAt=Use_SysMacros=TRUE;
              goto L1142;
            }
          if(strcmp(Keyword,"bor")==0){
              if(*Stk[Tmp+1]==61 ){
                  strcpy(Stk[Tmp+1],"|=");
                  *Stk[Tmp]=0;
                }
              else
                {
                  strcpy(Stk[Tmp],"|");
                }
            }

L1142:;

          goto L1136;
        }
      if(iAlphaIdx==3 ){
          if(strcmp(Keyword,"case")==0){
              int nBrace={0};
              int CntMarker=2;
              j=0;
              for(i=2; i<=Ndx; i++)
                {
                  if(inchr("([",Stk[i])){
                      nBrace++;
                    }
                  if(inchr(")]",Stk[i])){
                      nBrace--;
                    }
                  if(strcmp(Stk[i],",")==0){
                      if(nBrace==0 ){
                          CntMarker=i+1;
                        }
                    }
                  if(m_iMatchWrd(Stk[i],"to")){
                      j=1;
                      strcpy(Stk[i], join(3,"&&",vchr(1,1),"<="));
                      strcpy(Stk[CntMarker], join(3,">=",vchr(1,1),Stk[CntMarker]));
                    }
                }
              if(j==1 ){
                  *Src=0;
                  for(i=1; i<=Ndx; i++)
                    {
                      strcpy(Src, join(3,Src,Stk[i],vchr(1,1)));
                    }
                  FastLexer(Src,vchr(1,1),"");
                }
              goto L1148;
            }
          if(strcmp(Keyword,"cast")==0){
              strcpy(Stk[Tmp]," CAST ");
              Use_Cast=Use_SysMacros=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"callback")==0){
              strcpy(Stk[Tmp],"CALLBACK");
              if(Tmp==1 ){
                  if(Ndx>5 ){
                      Warning("Extra Callback code truncated",1);
                    }
                  strcpy(Src, join(3,"FUNCTION|",Stk[3],"(hWnd|AS|HWND,Msg|AS|UINT,wParam|AS|WPARAM,lParam|AS|LPARAM)|AS|LRESULT|CALLBACK"));
                  FastLexer(Src,"|",",()");
                  CallBackFlag=TRUE;
                }
              goto L1148;
            }
          if(strcmp(Keyword,"callwindowproc")==0){
              strcpy(Stk[Tmp],"CallWindowProc");
              if(strcmp(Stk[Tmp+3],"WNDPROC")!=0){
                  InsertTokens(Tmp+1,3,"(","WNDPROC",")");
                }
              goto L1148;
            }
          if(strcmp(Keyword,"com")==0){
              strcpy(Stk[Tmp],"COM");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              ComSwitchON=Use_COM=TRUE;
              Use_COM_CreateObject=TRUE;
              Use_COM_DispatchObject=TRUE;
              Use_COM_GetObject=TRUE;
              Use_COM_GetProperty=TRUE;
              Use_COM_InvokeMethod=TRUE;
              Use_COM_SafeArray=TRUE;
              Use_COM_SetProperty=TRUE;
              Use_COM_UsesConversion=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"createobject")==0){
              ComSwitchON=Use_COM_UsesConversion=Use_COM_CreateObject=Use_COM=TRUE;
              if(strcmp(Stk[2],"[")==0){
                  int iii=2;
                  while(strcmp(Stk[iii],"=")!=0){
                      strcpy(Stk[1], join(2,Stk[1],Stk[iii]));
                      *Stk[iii]=0;
                      iii++;
                    }
                  RemEmptyTokens();
                }
              strcpy(Stk[3],Stk[5]);
              sprintf(Stk[5],"&%s",Stk[1]);
              strcpy(Stk[1],"BCX_CreateObject");
              strcpy(Stk[2],"(");
              strcpy(Stk[4],",");
              goto L1148;
            }
          if(strcmp(Keyword,"concat")==0){
              strcpy(Stk[Tmp],"strcat");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1148;
            }
          if(strcmp(Keyword,"containedin")==0){
              strcpy(Stk[Tmp],"containedin");
              Use_ContainedIn=Use_BCX_stricmp=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cr$")==0){
              strcpy(Stk[Tmp],"CR$");
              Use_CR=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"close")==0){
              int iNextToken=Tmp+1;
              if(*Stk[iNextToken]==35 ){
                  strcpy(Stk[iNextToken],mid(Stk[iNextToken],2));
                }
              goto L1148;
            }
          if(strcmp(Keyword,"closedialog")==0){
              Ndx=1;
              if(ModDialogEvt ){
                  strcpy(Stk[Ndx],"EndDialog(hWnd,0)");
                }
              else
                {
                  strcpy(Stk[Ndx],"DestroyWindow(hWnd)");
                }
              goto L1148;
            }
          if(strcmp(Keyword,"cvd")==0){
              strcpy(Stk[Tmp],"CVD");
              Use_Cvd=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cvi")==0){
              strcpy(Stk[Tmp],"CVI");
              Use_Cvi=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cvl")==0){
              strcpy(Stk[Tmp],"CVL");
              Use_Cvl=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cvld")==0){
              strcpy(Stk[Tmp],"CVLD");
              Use_Cvld=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cvs")==0){
              strcpy(Stk[Tmp],"CVS");
              Use_Cvs=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"chrtoutf8$")==0){
              strcpy(Stk[Tmp],"ChrToUtf8$");
              Use_Chrtoutf8=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"crlf$")==0){
              strcpy(Stk[Tmp],"CRLF$");
              Use_Crlf=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"createregstring")==0){
              strcpy(Stk[Tmp],"CreateRegString");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_CreateRegString=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"createregint")==0){
              strcpy(Stk[Tmp],"CreateRegInt");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_CreateRegInt=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cdbl")==0){
              strcpy(Stk[Tmp],"CDBL");
              Use_Cdbl=Use_SysMacros=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"center")==0){
              strcpy(Stk[Tmp],"Center");
              Use_Center=Use_Proto=TRUE;
              if(Ndx>=2 && strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1148;
            }
          if(strcmp(Keyword,"cint")==0){
              strcpy(Stk[Tmp],"Cint");
              Use_Cint=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cldbl")==0){
              strcpy(Stk[Tmp],"CLDBL");
              Use_Cldbl=Use_SysMacros=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clng")==0){
              strcpy(Stk[Tmp],"CLNG");
              Use_Clng=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clipboard_gettext")==0  || strcmp(Keyword,"clipboard_gettext$")==0){
              strcpy(Stk[Tmp],"Clipboard_GetText$()");
              Convert2SimpleFunction(Tmp);
              Use_Clip_Gettext=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clipboard_getbitmap")==0){
              strcpy(Stk[Tmp],"Clipboard_GetBitmap()");
              Convert2SimpleFunction(Tmp);
              Use_Clip_Getbitmap=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clipboard_gettextsize")==0){
              strcpy(Stk[Tmp],"Clipboard_GetTextSize()");
              Convert2SimpleFunction(Tmp);
              Use_Clip_Gettextsize=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clipboard_settext")==0){
              strcpy(Stk[Tmp],"Clipboard_SetText");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Clip_Settext=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clipboard_setbitmap")==0){
              strcpy(Stk[Tmp],"Clipboard_SetBitmap");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Clip_Setbitmap=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"clipboard_reset")==0){
              strcpy(Stk[Tmp],"Clipboard_Reset");
              Use_Clip_Reset=Use_SysMacros=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cls")==0){
              strcpy(Stk[Tmp],"cls");
              Use_Cls=TRUE;
              Use_Locate=Use_Console=Use_Proto=Use_Cursor=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"color")==0  || strcmp(Keyword,"color_fg")==0  || strcmp(Keyword,"color_bg")==0){
              strcpy(Stk[Tmp],lcase(Stk[Tmp]));
              Use_Color=Use_Console=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"command$")==0){
              Use_Command=Use_BcxTempStr=TRUE;
              strcpy(Stk[Tmp],"command$(-1)");
              if(strcmp(Stk[Tmp+1],"(")==0){
                  strcpy(Stk[Tmp],"command$");
                }
              goto L1148;
            }
          if(strcmp(Keyword,"comboboxloadfile")==0){
              strcpy(Stk[Tmp],"ComboBoxLoadFile");
              Use_ComboBoxLoadFile=TRUE;
              Use_BcxTempStr=TRUE;
              Use_Proto=TRUE;
              Use_Trim=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cbool")==0){
              strcpy(Stk[Tmp],"CBOOL");
              Use_Cbool=Use_SysMacros=TRUE;
              int iii={0};
              int t={0};
              int expos=0;
              struct _UDT_ARG_COMMAS_STORAGE  funcPtr;
              Clear(funcPtr);
              if(SepFuncArgs(Tmp+1,&(funcPtr),TRUE)==0 ){
                  Abort("No argument specified in CBOOL");
                }
              for(iii=funcPtr.CommaPos[0]; iii<=funcPtr.CommaPos[1]; iii++)
                {
                  t=inchr("!<>=",Stk[iii]);
                  if(t ){
                      if(t<4 ){
                          if(strcmp(Stk[iii+1],"=")==0){
                              strcpy(Stk[iii], join(2,Stk[iii],Stk[iii+1]));
                              *Stk[iii+1]=0;
                            }
                          else if(t==1 && strcmp(Stk[iii],"!=")!=0){
                              continue;
                            }
                        }
                      else
                        {
                          if(strcmp(Stk[iii+1],"=")!=0){
                              strcpy(Stk[iii],"==");
                            }
                        }
                      expos=iii;
                      goto L1152;
                    }
                }
L1152:;
              t=DataType(Stk[expos-1]);
              if(t==vt_STRLIT||t==vt_STRVAR ){
                  if(expos ){
                      strcpy(Stk[Tmp+1], join(2,Stk[Tmp+1],"strcmp("));
                      strcpy(Stk[funcPtr.CommaPos[1]], join(3,")",Stk[expos],"0)"));
                      strcpy(Stk[expos],",");
                      *Src=0;
                      for(iii=1; iii<=Ndx; iii++)
                        {
                          strcat(Src,Stk[iii]);
                          strcat(Src,SPC);
                        }
                      FastLexer(Src,SPC,"(),");
                    }
                }
              goto L1148;
            }
          if(strcmp(Keyword,"csng")==0){
              strcpy(Stk[Tmp],"CSNG");
              Use_Csng=Use_SysMacros=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cpad$")==0){
              strcpy(Stk[Tmp],"cpad$");
              Use_Cpad=Use_Join=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"cursorx")==0){
              strcpy(Stk[Tmp],"Pos()");
              Use_Pos=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"csrlin")==0  || strcmp(Keyword,"cursory")==0){
              strcpy(Stk[Tmp],"Csrlin()");
              Use_Csrlin=Use_Proto=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"curdir$")==0){
              strcpy(Stk[Tmp],"curdir$()");
              Convert2SimpleFunction(Tmp);
              Use_Curdir=Use_BcxTempStr=TRUE;
              goto L1148;
            }
          if(strcmp(Keyword,"c_declare")==0){
              strcpy(CallType,"__cdecl ");
              strcpy(Stk[Tmp],"declare");
              if(m_iMatchWrd(Stk[4],"lib")){
                  NoTypeDeclare=FALSE;
                }
              else
                {
                  NoTypeDeclare=TRUE;
                }
            }

L1148:;

          goto L1136;
        }
      if(iAlphaIdx==4 ){
          if(strcmp(Keyword,"datacount")==0){
              strcpy(Stk[Tmp],"DATACOUNT");
              Use_Datacount=Use_SysMacros=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"declare")==0){
              strcpy(CallType,"__stdcall ");
              strcpy(Stk[Tmp],"declare");
              if(!m_iMatchWrd(Stk[4],"lib")){
                  NoTypeDeclare=TRUE;
                }
              else
                {
                  NoTypeDeclare=FALSE;
                }
              goto L1154;
            }
          if(strcmp(Keyword,"degtorad")==0){
              strcpy(Stk[Tmp],"DegToRad");
              Use_DegToRad=Use_SysMacros=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"dq$")==0){
              strcpy(Stk[Tmp],"DQ$");
              Use_DQ=Use_BcxTempStr=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"ddq$")==0){
              strcpy(Stk[Tmp],"DDQ$");
              Use_DDQ=Use_BcxTempStr=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"data")==0){
              NoTrans=1;
              goto L1154;
            }
          if(strcmp(Keyword,"date$")==0){
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  strcpy(Stk[Tmp],"date$()");
                }
              else
                {
                  strcpy(Stk[Tmp],"date$");
                }
              Use_Date=Use_BcxTempStr=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"del$")==0){
              strcpy(Stk[Tmp],"del$");
              Use_Del=Use_BcxTempStr=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"deleteregkey")==0){
              strcpy(Stk[Tmp],"DeleteRegKey");
              Use_DeleteRegKey=Use_BcxTempStr=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"diskfree")==0){
              strcpy(Stk[Tmp],"(UINT64) DiskFree");
              Use_Diskfree=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"diskused")==0){
              strcpy(Stk[Tmp],"(UINT64) DiskUsed");
              Use_Diskused=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"disksize")==0){
              strcpy(Stk[Tmp],"(UINT64) DiskSize");
              Use_Disksize=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"dialog")==0){
              Inject_Local_Bcx_RetVal=TRUE;
              if(m_iMatchWrd(Stk[1],"begin")){
                  if(Ndx==4&&m_iMatchWrd(Stk[3],"as")){
                      InDialogEvt=Use_BCXDialogCommon=TRUE;
                    }
                  else if(Ndx==5&&m_iMatchWrd(Stk[4],"as")){
                      ModDialogEvt=Use_BCXDialogCommon=TRUE;
                    }
                  else
                    {
                      Abort("Malformed Begin Dialog");
                    }
                  strcpy(Src, join(3,"function ",Stk[Ndx],"(hWnd AS HWND,Msg AS UINT,wParam AS WPARAM,lParam AS LPARAM) AS INT_PTR CALLBACK"));
                  FastLexer(Src,SPC,"(),");
                }
              goto L1154;
            }
          if(strcmp(Keyword,"destroysafearray")==0){
              strcpy(Stk[Tmp],"DestroySafeArray");
              Use_SafeArrays=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"doevents")==0){
              strcpy(Stk[Tmp],"DoEvents()");
              Convert2SimpleFunction(Tmp);
              Use_Doevents=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"drawtransbmp")==0){
              strcpy(Stk[Tmp],"DrawTransBMP");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_DrawTransBMP=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"draw")==0){
              strcpy(Stk[Tmp],"Draw");
              if(Tmp==Ndx ){
                  Abort("DRAW command expects a string argument");
                }
              AddPenSizeVariables();
              Use_BCX_Floodfill=Use_BCX_Line=Use_BCX_Lineto=Use_BCX_Preset=TRUE;
              Use_BcxTempStr=Use_Bitmap=Use_DSplit=Use_Draw=Use_DrawStr=TRUE;
              Use_DynamicA=Use_Instr=Use_Left=Use_Mid=Use_Proto=Use_QBColor=TRUE;
              Use_Remove=Use_Replace=Use_Stristr=Use_UCaseTbl=Use_Ucase=Use_Val=TRUE;
              Use_SysMacros=Use_Val=TRUE;
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1154;
            }
          if(strcmp(Keyword,"download")==0){
              if(Tmp==Ndx ){
                  Abort("DOWNLOAD command expects two string arguments");
                }
              strcpy(Stk[Tmp],"Download");
              Use_Download=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"downloadtostr")==0  || strcmp(Keyword,"downloadtostr$")==0){
              if(Tmp==Ndx ){
                  Abort("DOWNLOADTOSTR command expects one string arguments");
                }
              strcpy(Stk[Tmp],"DownloadToStr");
              Use_Downloadtostr=Use_Download=TRUE;
              Use_LoadFile=Use_BcxTempStr=Use_Lof=TRUE;
              Use_Exist=Use_TempFileName=TRUE;
              Use_LoadFile=Use_Get=Use_Tempdir=TRUE;
              Use_SysMacros=Use_Proto=TRUE;
              goto L1154;
            }
          if(strcmp(Keyword,"dsplit")==0){
              strcpy(Stk[Tmp],"DSplit");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BcxTempStr=TRUE;
              Use_UCaseTbl=TRUE;
              Use_Stristr=TRUE;
              Use_Proto=TRUE;
              Use_DSplit=TRUE;
              Use_Remove=TRUE;
              Use_Mid=TRUE;
              Use_Left=TRUE;
              Use_Instr=TRUE;
              Use_Replace=TRUE;
            }

L1154:;

          goto L1136;
        }
      if(iAlphaIdx==5 ){
          if(strcmp(Keyword,"enddraw")==0){
              strcpy(Stk[Tmp],"EndDraw");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Draw=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"endmodal")==0){
              strcpy(Stk[Tmp],"EndModal");
              Use_Show=Use_SysMacros=Use_ShowModal=Use_EndModal=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"editloadfile")==0){
              strcpy(Stk[Tmp],"EditLoadFile");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BcxTempStr=TRUE;
              Use_SysMacros=TRUE;
              Use_Elf=TRUE;
              Use_Exist=TRUE;
              Use_Get=TRUE;
              Use_Lof=TRUE;
              Use_Proto=TRUE;
              Use_Join=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"enc$")==0){
              strcpy(Stk[Tmp],"$$enc$");
              Use_Enclose=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"extract$")==0){
              strcpy(Stk[Tmp],"$$extract$");
              Use_Extract=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"extractany$")==0){
              strcpy(Stk[Tmp],"$$extractany$");
              Use_ExtractAny=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"eof$")==0){
              strcpy(Stk[Tmp],"EF$");
              Use_EF=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"eof")==0){
              strcpy(Stk[Tmp],"EoF");
              Use_Eof=Use_BcxTempStr=TRUE;
              strcpy(Stk[Tmp+2],RemoveStr(Stk[Tmp+2],"#"));
              if(strcmp(Stk[Tmp+2],"")==0){
                  Abort("Bad EOF Argument");
                }
              if(DataType(Stk[Tmp+2])==vt_NUMBER ){
                  strcpy(Stk[Tmp+2], join(2,"FP",Stk[Tmp+2]));
                }
              goto L1155;
            }
          if(strcmp(Keyword,"equalto")==0){
              strcpy(Stk[Tmp]," EqualTo ");
              Use_EqualTo=Use_SysMacros=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"esc$")==0){
              strcpy(Stk[Tmp],"ESC$");
              Use_ESC=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"enum")==0){
              int iNamedEnum=0;
              if(Tmp==3 ){
                  iNamedEnum=m_iMatchWrd(Stk[Tmp-1],"as");
                }
              else
                {
                  if(Ndx==3 ){
                      iNamedEnum=m_iMatchWrd(Stk[Tmp+1],"as");
                    }
                }
              if(Ndx==1||iNamedEnum ){
                  Use_EnumFile=TRUE;
                  char szNameOfEnum[BCXSTRSIZE]={0};
                  int EnumFlag=FALSE;
                  fprintf(FP_ENU,"%s\n","");
                  if(iNamedEnum ){
                      if(Tmp==3 ){
                          strcpy(szNameOfEnum,Stk[Tmp-2]);
                          fprintf(FP_ENU,"%s%s\n","typedef enum _",szNameOfEnum);
                        }
                      else
                        {
                          strcpy(szNameOfEnum,Stk[Tmp+2]);
                          fprintf(FP_ENU,"%s%s\n","typedef enum _",szNameOfEnum);
                        }
                      strcpy(szNameOfEnum, join(2,SPC,szNameOfEnum));
                    }
                  else
                    {
                      *szNameOfEnum=0;
                      fprintf(FP_ENU,"%s\n","enum");
                    }
                  fprintf(FP_ENU,"%s\n","  {");
                  *Src=0;
                  while(!m_iMatchLft(Src,"end ")){
                      if(EoF(SourceFile)){
                          Abort("Unbalanced ENUM");
                        }
                      Src[0]=0;
                      fgets(Src, 2048 , SourceFile);
                        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
                          {
                           Src[strcspn(Src,"\r\n")] = 0;
                          }
                         else
                          {
                            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
                            printf("%s\n","The actual truncated line of text:");
                            printf("%s",Src);
                            exit(1);
                          }
                      LineNum[FileNdx]++;
                      Sanitize_Code(Src);
                      if(m_iMatchLft(Src,"$comme")){
                          int ccc;
                          Docomment(Src,&(ccc));
                          continue;
                        }
                      strcpy(Src,trim(Src));
                      if(ISNULL(Src)){
                          continue;
                        }
                      if(LeftStr(join(2,Src,SPC),"end ",TRUE)){
                          goto L1156;
                        }
                      else
                        {
                          if(EnumFlag==FALSE ){
                              EnumFlag=TRUE;
                            }
                          else
                            {
                              fprintf(FP_ENU,"%s\n",",");
                            }
                        }
                      fprintf(FP_ENU,"%s%s","    ",rtrim(Src));
                    }
L1156:;
                  *Src=0;
                  Ndx=0;
                  fprintf(FP_ENU,"%s\n","");
                  fprintf(FP_ENU,"%s%s%s\n","  }",szNameOfEnum,";\n");
                  return;
                }
              int iEquallLoc=Tmp+2;
              if(strcmp(Stk[iEquallLoc],"=")==0){
                  strcpy(Stk[Tmp],"enum ");
                  InsertTokens(iEquallLoc-1,2,"{",Stk[Tmp+1]);
                  strcpy(Stk[++Ndx],"}");
                  return;
                }
              strcpy(Stk[1],"enum {");
              for(j=2; j<=Ndx; j++)
                {
                  strcpy(Stk[1], join(2,Stk[1],Stk[j]));
                }
              strcpy(Stk[1], join(2,Stk[1],"}"));
              Ndx=1;
              goto L1155;
            }
          if(strcmp(Keyword,"environ$")==0){
              strcpy(Stk[Tmp],"Environ$");
              Use_Environ=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"exist")==0){
              strcpy(Stk[Tmp],"Exist");
              Use_Exist=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1155;
            }
          if(strcmp(Keyword,"exp")==0){
              strcpy(Stk[Tmp],"Exp");
              Use_Exp=Use_Proto=TRUE;
            }

L1155:;

          goto L1136;
        }
      if(iAlphaIdx==6 ){
          if(strcmp(Keyword,"for_each")==0){
              strcpy(Stk[Tmp],"FOR_EACH");
              Use_ForEach=Use_SysMacros=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"ff$")==0){
              strcpy(Stk[Tmp],"FF$");
              Use_FF=Use_BcxTempStr=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"function")==0){
              if(strcmp(Stk[Tmp+1],"=")==0){
                  if(strcmp(Stk[Tmp+2],DDQ)==0){
                      strcpy(Stk[Tmp+2],"NUL$");
                    }
                  strcpy(Stk[Tmp],"functionreturn");
                }
              else
                {
                  strcpy(Stk[Tmp],"function");
                  if(UseCpp||UseCpphdr ){
                      FuncSubTemplate(Tmp);
                    }
                }
              goto L1158;
            }
          if(strcmp(Keyword,"false")==0){
              strcpy(Stk[Tmp],"FALSE");
              goto L1158;
            }
          if(strcmp(Keyword,"findintype")==0){
              strcpy(Stk[Tmp],"FindInType");
              Use_FindInType=Use_Proto=Use_BCX_stricmp=TRUE;
              char StMem[BCXSTRSIZE];
              char StName[BCXSTRSIZE];
              char VarName[BCXSTRSIZE];
              struct _UDT_ARG_COMMAS_STORAGE  funcPtr;
              Clear(funcPtr);
              SepFuncArgs(Tmp,&(funcPtr),TRUE);
              strcpy(StMem,remain(No_Sigil(GetArg(2,&(funcPtr))),"."));
              strcpy(VarName,extract(No_Sigil(GetArg(2,&(funcPtr))),"."));
              for(j=funcPtr.CommaPos[1]+1; j<=funcPtr.CommaPos[2]-1; j++)
                {
                  *Stk[j]=0;
                }
              if(CheckLocal(VarName,&(i))!=vt_UNKNOWN ){
                  strcpy(StName,TypeDefs[LocalVars[i].VarDef].VarName);
                }
              else if(CheckGlobal(VarName,&(i))!=vt_UNKNOWN ){
                  strcpy(StName,TypeDefs[GlobalVars[i].VarDef].VarName);
                }
              j=funcPtr.CommaPos[1]+1;
              strcpy(Stk[j], join(9,"(char*)",VarName," + offsetof(",StName,",",StMem,"), sizeof(",StName,")"));
              goto L1158;
            }
          if(strcmp(Keyword,"fillarray")==0){
              strcpy(Stk[Tmp],"fillarray");
              Use_FillArray=TRUE;
              Use_Proto=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"findfirst$")==0){
              strcpy(Stk[Tmp],"findfirst$");
              Use_Findfirst=Use_BcxTempStr=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"findfirstinstance")==0){
              strcpy(Stk[Tmp],"FindFirstInstance");
              Use_FirstInstance=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"findnext$")==0){
              strcpy(Stk[Tmp],"findnext$()");
              Convert2SimpleFunction(Tmp);
              Use_Findnext=Use_BcxTempStr=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"fint")==0){
              strcpy(Stk[Tmp],"FINT");
              goto L1158;
            }
          if(strcmp(Keyword,"fix")==0){
              strcpy(Stk[Tmp],"FIX");
              Use_Fix=Use_SysMacros=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"filelocked")==0){
              strcpy(Stk[Tmp],"FileLocked");
              Use_FileLocked=Use_Proto=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"format$")==0){
              strcpy(Stk[Tmp],"Format$");
              Use_Format=Use_BcxTempStr=Use_Proto=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"ftell")==0){
              strcpy(Stk[Tmp],"_ftelli64");
              for(int f=Tmp+1; f<=Ndx; f++)
                {
                  strcpy(Stk[f],RemoveStr(Stk[f],"#"));
                  if(ISNULL(Stk[f])){
                      Abort("Bad or Missing FTELL Argument");
                    }
                  if(DataType(Stk[f])==vt_NUMBER ){
                      strcpy(Stk[f], join(2,"FP",Stk[f]));
                      if(FindVarInfo(Stk[f],&(f))==NULL ){
                          AddGlobal(Stk[f],vt_FILEPTR);
                          return;
                        }
                    }
                }
              goto L1158;
            }
          if(strcmp(Keyword,"frac")==0){
              strcpy(Stk[Tmp],"FRAC");
              Use_Fix=Use_Frac=Use_SysMacros=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"fracl")==0){
              strcpy(Stk[Tmp],"FRACL");
              Use_Fix=Use_Fracl=Use_SysMacros=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"freefile")==0){
              strcpy(Stk[Tmp],"FreeFile()");
              Use_Freefile=Use_Proto=TRUE;
              goto L1158;
            }
          if(strcmp(Keyword,"function")==0){
              if(bcx_stricmp(Stk[2],"main")==0){
                  NoMain=TRUE;
                }
            }

L1158:;

          goto L1136;
        }
      if(iAlphaIdx==7 ){
          if(strcmp(Keyword,"getdimension")==0){
              strcpy(Stk[Tmp],"GetDimension");
              Use_GetDimension=Use_Proto=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getobject")==0){
              if(Ndx<7 ){
                  ComSwitchON=TRUE;
                  Use_COM=TRUE;
                  Use_COM_CreateObject=TRUE;
                  Use_COM_DispatchObject=TRUE;
                  Use_COM_GetObject=TRUE;
                  Use_COM_GetProperty=TRUE;
                  Use_COM_InvokeMethod=TRUE;
                  Use_COM_SafeArray=TRUE;
                  Use_COM_SetProperty=TRUE;
                  Use_COM_UsesConversion=TRUE;
                  strcpy(Stk[3],Stk[5]);
                  sprintf(Stk[5],"&%s",Stk[1]);
                  strcpy(Stk[1],"BCX_GetObject");
                  strcpy(Stk[2],"(");
                  strcpy(Stk[4],",");
                }
              goto L1161;
            }
          if(strcmp(Keyword,"getprocaddress")==0){
              char GlobalName[BCXSTRSIZE]={0};
              int s={0};
              ULONGLONG  GlobalNameHash={0};
              char Atemp[BCXSTRSIZE]={0};
              strcpy(GlobalName,Stk[Tmp-2]);
              GlobalNameHash=HashNumber(GlobalName);
              while(GlobalVarHash[GlobalNameHash]){
                  s=GlobalVarHash[GlobalNameHash];
                  struct _UDT_VARINFO_STORAGE*  ptGlobal;
                  ptGlobal=&(GlobalVars[s]);
                  if(strcmp(GlobalName,ptGlobal->VarName)==0){
                      strcpy(Atemp,TypeDefs[ptGlobal->VarDef].VarName);
                      if(ptGlobal->VarPntr ){
                          strcat(Atemp," *");
                        }
                    }
                  GlobalNameHash=imod(GlobalNameHash+1,c_MaxGlobalVars);
                }
              if(Atemp[0]==0 ){
                  char LocalName[BCXSTRSIZE]={0};
                  strcpy(LocalName,Stk[Tmp-2]);
                  if(LocalVarCnt ){
                      for(int yy=1; yy<=LocalVarCnt; yy++)
                        {
                          if(strcmp(LocalName,LocalVars[yy].VarName)==0){
                              strcpy(Atemp,TypeDefs[LocalVars[yy].VarDef].VarName);
                              if(LocalVars[yy].VarPntr ){
                                  strcat(Atemp," *");
                                }
                              goto L1163;
                            }
                        }
L1163:;
                    }
                }
              if(Atemp[0]!=0 ){
                  strcpy(Stk[Tmp], join(3,"(",Atemp,")GetProcAddress"));
                }
              else
                {
                  strcpy(Stk[Tmp],"GetProcAddress");
                }
              goto L1161;
            }
          if(strcmp(Keyword,"getaddr$")==0){
              strcpy(Stk[Tmp],"GetAddr$");
              Use_Getaddr=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getattr")==0){
              strcpy(Stk[Tmp],"GETATTR");
              Use_Getattr=Use_SysMacros=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"gethttpfilesize")==0){
              strcpy(Stk[Tmp],"GetHttpFileSize");
              Use_Gethttpfilesize=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"gettextsize")==0){
              strcpy(Stk[Tmp],"GetTextSize");
              Use_GetTextSize=Use_Proto=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getc")==0){
              strcpy(Stk[Tmp],"getc");
              strcpy(Stk[Tmp+2],RemoveStr(Stk[Tmp+2],"#"));
              if(DataType(Stk[Tmp+2])==vt_NUMBER ){
                  strcpy(Stk[Tmp+2], join(2,"FP",Stk[Tmp+2]));
                }
              goto L1161;
            }
          if(strcmp(Keyword,"getbmp")==0){
              strcpy(Stk[Tmp],"GetBmp");
              Use_GetBmp=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getdrive")==0){
              strcpy(Stk[Tmp],"_getdrive()");
              Convert2SimpleFunction(Tmp);
              Use_Getdrive=Use_Proto=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getfilename$")==0){
              strcpy(Stk[Tmp],"$$GetFileName$");
              Use_Getfilename=Use_Hook=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getsaveasfilename$")==0){
              strcpy(Stk[Tmp],"GetSaveAsFileName$");
              Use_GetSaveAsFilename=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getresource")==0){
              strcpy(Stk[Tmp],"GetResource");
              Use_GetResource=Use_Proto=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getspecialfolder$")==0  || strcmp(Keyword,"getspecialfolder")==0){
              strcpy(Stk[Tmp],"$$GetSpecialFolder$");
              Use_GetSpecialFolder=TRUE;
              Use_Proto=Use_BcxTempStr=TRUE;
              goto L1161;
            }
          if(strcmp(Keyword,"getspecialfolderex$")==0){
              strcpy(Stk[Tmp],"GetSpecialFolderEx$");
              Use_GetSpecialFolderex=TRUE;
              Use_Proto=Use_BcxTempStr=TRUE;
              Use_WideToAnsi=TRUE;
            }

L1161:;

          goto L1136;
        }
      if(iAlphaIdx==8 ){
          if(strcmp(Keyword,"hex$")==0){
              strcpy(Stk[Tmp],"hex$");
              Use_Hex=Use_BcxTempStr=TRUE;
              goto L1164;
            }
          if(strcmp(Keyword,"hex2dec")==0){
              strcpy(Stk[Tmp],"Hex2Dec");
              Use_Hex2Dec=Use_Proto=TRUE;
              goto L1164;
            }
          if(strcmp(Keyword,"hide")==0){
              strcpy(Stk[Tmp],"HIDEHWND");
              Use_Hide=Use_SysMacros=TRUE;
              if(Ndx>=2 && strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
            }

L1164:;

          goto L1136;
        }
      if(iAlphaIdx==9 ){
          if(strcmp(Keyword,"icompare")==0){
              strcpy(Stk[Tmp],"bcx_stricmp");
              Use_BCX_stricmp=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"instr")==0){
              strcpy(Stk[Tmp],"instr");
              Use_Instr=Use_Proto=TRUE;
              Use_Stristr=Use_UCaseTbl=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"iinstr")==0){
              strcpy(Stk[Tmp],"iinstr");
              Use_IInstr=Use_Proto=TRUE;
              Use_Stristr=Use_UCaseTbl=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"instrany")==0){
              strcpy(Stk[Tmp],"InstrAny");
              Use_InstrAny=Use_Instr=Use_Proto=TRUE;
              Use_Mid=Use_BcxTempStr=Use_Stristr=Use_UCaseTbl=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"iinstrany")==0){
              strcpy(Stk[Tmp],"IInstrAny");
              Use_IInstrAny=Use_IInstr=Use_Proto=TRUE;
              Use_Mid=Use_BcxTempStr=Use_Stristr=Use_UCaseTbl=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"inchr")==0){
              strcpy(Stk[Tmp],"inchr");
              Use_Inchr=Use_Proto=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"imod")==0){
              strcpy(Stk[Tmp],"imod");
              Use_Imod=Use_SysMacros=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"iif")==0){
              strcpy(Stk[Tmp],"iif");
              Use_Iif=Use_Proto=TRUE;
              for(i=Tmp+1; i<=Ndx; i++)
                {
                  if(strcmp(Stk[i],"=")==0){
                      if(strcmp(Stk[i-1],"<")!=0  && strcmp(Stk[i-1],">")!=0){
                          strcpy(Stk[i],"BCXEQEQ");
                        }
                    }
                }
              goto L1165;
            }
          if(strcmp(Keyword,"iif$")==0){
              strcpy(Stk[Tmp],"sziif$");
              Use_sziif=Use_Proto=TRUE;
              for(i=Tmp+1; i<=Ndx; i++)
                {
                  if(strcmp(Stk[i],"=")==0){
                      if(strcmp(Stk[i-1],"<")!=0  && strcmp(Stk[i-1],">")!=0){
                          strcpy(Stk[i],"BCXEQEQ");
                        }
                    }
                }
              goto L1165;
            }
          if(strcmp(Keyword,"initsafearray")==0){
              strcpy(Stk[Tmp],"InitSafeArray");
              Use_SafeArrays=TRUE;
              strcpy(Stk[Tmp+2], join(2,"&",Stk[Tmp+2]));
              goto L1165;
            }
          if(strcmp(Keyword,"inkey")==0){
              Use_BcxTempStr=Use_Proto=Use_InkeyD=TRUE;
              strcpy(Stk[Tmp],"inkeyd()");
              Convert2SimpleFunction(Tmp);
              goto L1165;
            }
          if(strcmp(Keyword,"inkey$")==0){
              Use_BcxTempStr=Use_Proto=Use_Inkey=TRUE;
              strcpy(Stk[Tmp],"inkey$()");
              Convert2SimpleFunction(Tmp);
              goto L1165;
            }
          if(strcmp(Keyword,"inline")==0){
              if(Tmp==1 ){
                  *Stk[1]=0;
                  UseInLine=TRUE;
                  RemEmptyTokens();
                  Tmp--;
                }
              goto L1165;
            }
          if(strcmp(Keyword,"inputbox$")==0){
              strcpy(Stk[Tmp],"InputBox$");
              Use_BoxCommon=Use_Inputbox=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"infobox")==0){
              strcpy(Stk[Tmp],"InfoBox");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_BoxCommon=Use_Infobox=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"ins$")==0){
              strcpy(Stk[Tmp],"ins$");
              Use_Ins=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"instrrev")==0){
              strcpy(Stk[Tmp],"InstrRev");
              Use_Instrrev=Use_Proto=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isodate$")==0){
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  strcpy(Stk[Tmp],"isodate$()");
                }
              else
                {
                  strcpy(Stk[Tmp],"isodate$");
                }
              Use_IsoDate=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isptr")==0){
              strcpy(Stk[Tmp],"IsPtr");
              Use_Isptr=Use_SysMacros=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"istrue")==0){
              strcpy(Stk[Tmp],"ISTRUE");
              Use_Istrue=Use_SysMacros=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isfalse")==0){
              strcpy(Stk[Tmp],"ISFALSE");
              Use_Isfalse=Use_SysMacros=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"iszero")==0){
              strcpy(Stk[Tmp],"ISZERO");
              Use_Iszero=Use_SysMacros=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isnull")==0){
              strcpy(Stk[Tmp],"ISNULL");
              Use_Isnull=Use_SysMacros=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"issystem")==0){
              strcpy(Stk[Tmp],"issystem");
              Use_Issystem=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"ishidden")==0){
              strcpy(Stk[Tmp],"ishidden");
              Use_Ishidden=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isreadonly")==0){
              strcpy(Stk[Tmp],"isreadonly");
              Use_Isreadonly=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isfile")==0){
              strcpy(Stk[Tmp],"isfile");
              Use_Isfile=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"isfolder")==0){
              strcpy(Stk[Tmp],"isfolder");
              Use_Isfolder=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"ireplace$")==0){
              strcpy(Stk[Tmp],"iReplace$");
              Use_iReplace=Use_Stristr=Use_BcxTempStr=TRUE;
              Use_UCaseTbl=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"ireplaceany$")==0){
              strcpy(Stk[Tmp],"IReplaceAny$");
              Use_IReplaceAny=Use_BcxTempStr=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"iremove$")==0){
              strcpy(Stk[Tmp],"IRemoveStr$");
              Use_IRemove=Use_BcxTempStr=TRUE;
              Use_Stristr=Use_UCaseTbl=TRUE;
              goto L1165;
            }
          if(strcmp(Keyword,"iremoveany$")==0){
              strcpy(Stk[Tmp],"IRemoveAny$");
              Use_IRemoveAny=Use_BcxTempStr=TRUE;
            }

L1165:;

          goto L1136;
        }
      if(iAlphaIdx==10 ){
          if(strcmp(Keyword,"join$")==0){
              strcpy(Stk[Tmp],"$$join$");
              Use_Join=Use_BcxTempStr=TRUE;
            }
          goto L1136;
        }
      if(iAlphaIdx==11 ){
          if(strcmp(Keyword,"keypress")==0){
              strcpy(Stk[Tmp],"keypress()");
              Convert2SimpleFunction(Tmp);
              Use_Keypress=Use_Proto=TRUE;
            }
          goto L1136;
        }
      if(iAlphaIdx==12 ){
          if(strcmp(Keyword,"land")==0){
              strcpy(Stk[Tmp]," &&");
              goto L1170;
            }
          if(strcmp(Keyword,"lor")==0){
              strcpy(Stk[Tmp]," ||");
              goto L1170;
            }
          if(strcmp(Keyword,"local")==0){
              if(m_iMatchWrd(Stk[Tmp+1],"dynamic")){
                  strcpy(Stk[Tmp],"dim");
                }
              goto L1170;
            }
          if(strcmp(Keyword,"lccpath$")==0){
              strcpy(Stk[Tmp],"LccPath$()");
              Convert2SimpleFunction(Tmp);
              Use_LccPath=Use_RegString=Use_Instrrev=TRUE;
              Use_Left=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"loadfile$")==0){
              strcpy(Stk[Tmp],"$$LoadFile$");
              Use_LoadFile=Use_Get=Use_BcxTempStr=TRUE;
              Use_SysMacros=Use_Exist=Use_Lof=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"listboxloadfile")==0){
              strcpy(Stk[Tmp],"ListBoxLoadFile");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_ListBoxLoadFile=TRUE;
              Use_GetTextSize=TRUE;
              Use_Proto=TRUE;
              Use_Trim=TRUE;
              Use_String=TRUE;
              Use_BcxTempStr=TRUE;
              Use_Eof=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"lf$")==0){
              strcpy(Stk[Tmp],"LF$");
              Use_LF=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"line")==0){
              if(m_iMatchWrd(Stk[Tmp+1],"input")){
                  strcpy(Stk[Tmp],"lineinput");
                  j=Tmp+4;
                  *Stk[Tmp+1]=0;
                  for(i=Tmp+2; i<=Ndx; i++)
                    {
                      if(*Stk[i]==44 ){
                          j=i+1;
                          goto L1171;
                        }
                      strcpy(Stk[Tmp+1], join(2,Stk[Tmp+1],Stk[i]));
                      *Stk[i]=0;
                    }
L1171:;
                  for(i=j; i<=Ndx; i++)
                    {
                      strcpy(Stk[Tmp+2], join(2,Stk[Tmp+2],Stk[i]));
                    }
                }
              goto L1170;
            }
          if(strcmp(Keyword,"lcase$")==0){
              if(iSubLoc==2 ){
                  if(strcmp(Stk[Tmp+1],"(")==0){
                      Abort("'lcase' can only be used as a Function Pointer when in a SET");
                    }
                  strcpy(Stk[Tmp],"lcase");
                }
              else
                {
                  strcpy(Stk[Tmp],"$$lcase$");
                }
              Use_Lcase=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"ldouble")==0){
              strcpy(Stk[Tmp],"LDOUBLE");
              Use_Ldouble=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"left$")==0){
              strcpy(Stk[Tmp],"$$left$");
              Use_Left=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"leftstr")==0){
              strcpy(Stk[Tmp],"LeftStr");
              Use_LeftStr=Use_Left=Use_Lcase=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"lprint")==0){
              strcpy(Stk[Tmp],"lprint");
              if(Tmp==Ndx ){
                  Ndx++;
                  strcpy(Stk[Ndx],enc(""));
                }
              goto L1170;
            }
          if(strcmp(Keyword,"lpad$")==0){
              strcpy(Stk[Tmp],"$$lpad$");
              Use_Lpad=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"ltrim$")==0){
              strcpy(Stk[Tmp],"$$ltrim$");
              Use_Ltrim=Use_BcxTempStr=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"lof")==0){
              strcpy(Stk[Tmp],"lof");
              Use_Lof=Use_Proto=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"like")==0){
              strcpy(Stk[Tmp],"like");
              Use_Like=Use_Proto=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"lclick")==0){
              strcpy(Stk[Tmp],"lClick()");
              Convert2SimpleFunction(Tmp);
              Use_Lclick=Use_Proto=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"like_instr")==0){
              strcpy(Stk[Tmp],"Like_Instr");
              Use_Like_Instr=Use_Ucase=Use_BcxTempStr=Use_Proto=Use_Mid=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"loc")==0){
              int Tmp2=Tmp+2;
              if(DataType(Stk[Tmp2])==vt_NUMBER ){
                  strcpy(Stk[Tmp2], join(2,"FP",Stk[Tmp2]));
                }
              strcpy(Stk[Tmp2],RemoveStr(Stk[Tmp2],"#"));
              strcpy(Stk[Tmp], join(5,"loc(",Stk[Tmp2],",",Stk[Tmp2],"len)"));
              *Stk[Tmp+1]=0;
              *Stk[Tmp2]=0;
              *Stk[Tmp+3]=0;
              Use_Loc=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"locate")==0){
              strcpy(Stk[Tmp],"locate");
              Use_Locate=Use_Console=Use_Proto=Use_Cursor=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"longestline")==0){
              strcpy(Stk[Tmp],"LongestLine");
              Use_Longestline=Use_Eof=Use_Proto=TRUE;
              goto L1170;
            }
          if(strcmp(Keyword,"lookahead$")==0){
              strcpy(Stk[Tmp],"LookAhead$");
              strcpy(Stk[Tmp+2],RemoveStr(Stk[Tmp+2],"#"));
              if(DataType(Stk[Tmp+2])==vt_NUMBER ){
                  strcpy(Stk[Tmp+2], join(2,"FP",Stk[Tmp+2]));
                }
              Use_Lookahead=Use_NamePathFromFP=Use_Eof=Use_Proto=Use_BcxTempStr=TRUE;
            }

L1170:;

          goto L1136;
        }
      if(iAlphaIdx==13 ){
          if(strcmp(Keyword,"makebmp")==0){
              strcpy(Stk[Tmp],"MakeBmp");
              Use_Makebmp=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"makehdc")==0){
              strcpy(Stk[Tmp],"MakeHdc");
              Use_Makehdc=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"me")==0){
              strcpy(Stk[Tmp],"Me");
              int Tmp1=Tmp+1;
              if(*Stk[Tmp1]==46 ){
                  if(InFunction ){
                      strcpy(Stk[Tmp1], join(2,"->",mid(Stk[Tmp1],2)));
                    }
                }
              goto L1173;
            }
          if(strcmp(Keyword,"mkd$")==0){
              if(Tmp>2 ){
                  if(inchr(Stk[Tmp-2],"$")&&*Stk[Tmp-1]==61 ){
                      strcpy(Stk[1], join(2,"memcpy(",Stk[1]));
                      strcpy(Stk[Tmp-1],",");
                      strcpy(Stk[++Ndx],",9)");
                    }
                }
              strcpy(Stk[Tmp],"MKD");
              Use_Mkd=Use_BcxTempStr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mki$")==0){
              if(Tmp>2 ){
                  if(inchr(Stk[Tmp-2],"$")&&*Stk[Tmp-1]==61 ){
                      strcpy(Stk[1], join(2,"memcpy(",Stk[1]));
                      strcpy(Stk[Tmp-1],",");
                      strcpy(Stk[++Ndx],",3)");
                    }
                }
              strcpy(Stk[Tmp],"MKI");
              Use_Mki=Use_BcxTempStr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mkl$")==0){
              if(Tmp>2 ){
                  if(inchr(Stk[Tmp-2],"$")&&*Stk[Tmp-1]==61 ){
                      strcpy(Stk[1], join(2,"memcpy(",Stk[1]));
                      strcpy(Stk[Tmp-1],",");
                      strcpy(Stk[++Ndx],",5)");
                    }
                }
              strcpy(Stk[Tmp],"MKL");
              Use_Mkl=Use_BcxTempStr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mkld$")==0){
              if(Tmp>2 ){
                  if(inchr(Stk[Tmp-2],"$")&&*Stk[Tmp-1]==61 ){
                      strcpy(Stk[1], join(2,"memcpy(",Stk[1]));
                      strcpy(Stk[Tmp-1],",");
                      strcpy(Stk[++Ndx],",11)");
                    }
                }
              strcpy(Stk[Tmp],"MKLD");
              Use_Mkld=Use_BcxTempStr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mks$")==0){
              if(Tmp>2 ){
                  if(inchr(Stk[Tmp-2],"$")&&*Stk[Tmp-1]==61 ){
                      strcpy(Stk[1], join(2,"memcpy(",Stk[1]));
                      strcpy(Stk[Tmp-1],",");
                      strcpy(Stk[++Ndx],",5)");
                    }
                }
              strcpy(Stk[Tmp],"MKS");
              Use_Mks=Use_BcxTempStr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mid$")==0){
              if(Tmp>1 ){
                  strcpy(Stk[Tmp],"$$mid$");
                  Use_Mid=Use_BcxTempStr=TRUE;
                }
              else
                {
                  strcpy(Stk[Tmp],"midstr");
                  Use_Midstr=TRUE;
                }
              goto L1173;
            }
          if(strcmp(Keyword,"min")==0){
              strcpy(Stk[Tmp],"MIN");
              Use_Min=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"max")==0){
              strcpy(Stk[Tmp],"MAX");
              Use_Max=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mcase$")==0){
              if(iSubLoc==2 ){
                  if(strcmp(Stk[Tmp+1],"(")==0){
                      Abort("'mcase' can only be used as a Function Pointer when in a SET");
                    }
                  strcpy(Stk[Tmp],"mcase");
                }
              else
                {
                  strcpy(Stk[Tmp],"$$mcase$");
                }
              Use_Mcase=Use_BcxTempStr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mkpath")==0){
              strcpy(Stk[Tmp],"MkPath");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Mkpath=Use_VChr=Use_Instr=Use_Mid=TRUE;
              Use_Join=Use_Split=Use_Replace=Use_UCaseTbl=TRUE;
              Use_Proto=Use_Remove=Use_BcxTempStr=Use_Stristr=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"modstyle")==0){
              strcpy(Stk[Tmp],"ModStyle");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Modstyle=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mouse_sx")==0){
              strcpy(Stk[Tmp],"MOUSE_SX");
              Use_Mouse_sx=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mouse_sy")==0){
              strcpy(Stk[Tmp],"MOUSE_SY");
              Use_Mouse_sy=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mouse_cx")==0){
              strcpy(Stk[Tmp],"MOUSE_CX");
              Use_Mouse_cx=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"mouse_cy")==0){
              strcpy(Stk[Tmp],"MOUSE_CY");
              Use_Mouse_cy=Use_Proto=TRUE;
              goto L1173;
            }
          if(strcmp(Keyword,"msgbox")==0){
              int Tmm1=Tmp-1;
              if(strcmp(Stk[Tmm1],"=")==0  || m_iMatchWrd(Stk[Tmm1],"if")||m_iMatchWrd(Stk[Tmm1],"elseif")){
                  strcpy(Stk[Tmp],"MsgBox");
                  Use_Msgbox=Use_Proto=TRUE;
                }
            }

L1173:;

          goto L1136;
        }
      if(iAlphaIdx==14 ){
          if(strcmp(Keyword,"next_each")==0){
              Use_ForEach=Use_SysMacros=TRUE;
              strcpy(Stk[Tmp],"NEXT_EACH");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  goto L1174;
                }
              Tmp++;
              for(;;)
                {
                  if(Tmp>Ndx ){
                      goto L1175;
                    }
                  *Stk[Tmp]=0;
                  Tmp++;
                }
L1175:;
              goto L1174;
            }
          if(strcmp(Keyword,"new")==0){
              if(m_iMatchWrd(Stk[Tmp-1],"binary")){
                  goto L1174;
                }
              UseCpp=TRUE;
              strcpy(Stk[Tmp],"new ");
              goto L1174;
            }
          if(strcmp(Keyword,"newbmp")==0){
              strcpy(Stk[Tmp],"NewBmp()");
              Use_Newbmp=Use_Proto=TRUE;
              goto L1174;
            }
          if(strcmp(Keyword,"nextlinelen")==0){
              strcpy(Stk[Tmp],"NextLineLen");
              Use_Nextlinelen=Use_Proto=TRUE;
              goto L1174;
            }
          if(strcmp(Keyword,"nothing")==0){
              ComSwitchON=Use_COM=TRUE;
              char sObj[BCXSTRSIZE]={0};
              int ii=2;
              strcpy(sObj, join(2,"&",Stk[1]));
              while(strcmp(Stk[ii],"=")!=0){
                  strcat(sObj,Stk[ii]);
                  ii++;
                }
              strcpy(Stk[1],"BCX_SetNothing");
              strcpy(Stk[2],"(");
              strcpy(Stk[3],sObj);
              strcpy(Stk[4],")");
              Ndx=4;
              goto L1174;
            }
          if(strcmp(Keyword,"notzero")==0){
              strcpy(Stk[Tmp],"NOTZERO");
              Use_Notzero=Use_SysMacros=TRUE;
              goto L1174;
            }
          if(strcmp(Keyword,"notnull")==0){
              strcpy(Stk[Tmp],"NOTNULL");
              Use_Notnull=Use_SysMacros=TRUE;
              goto L1174;
            }
          if(strcmp(Keyword,"notequalto")==0){
              strcpy(Stk[Tmp]," NotEqualTo ");
              Use_NotEqualTo=Use_SysMacros=TRUE;
              goto L1174;
            }
          if(strcmp(Keyword,"nul$")==0){
              strcpy(Stk[Tmp],"NUL$");
              Use_NUL=Use_BcxTempStr=TRUE;
              goto L1174;
            }
          if(strcmp(Keyword,"now$")==0){
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  strcpy(Stk[Tmp],"now$()");
                }
              else
                {
                  strcpy(Stk[Tmp],"now$");
                }
              Use_Now=Use_BcxTempStr=TRUE;
            }

L1174:;

          goto L1136;
        }
      if(iAlphaIdx==15 ){
          if(strcmp(Keyword,"object")==0){
              ComSwitchON=Use_COM=Use_BcxTempStr=TRUE;
              strcpy(Stk[Tmp],"OBJECT");
              goto L1177;
            }
          if(strcmp(Keyword,"open")==0){
              for(A=Tmp+1; A<=Ndx; A++)
                {
                  if(*Stk[A]==35 ){
                      strcpy(Stk[A],mid(Stk[A],2));
                      goto L1178;
                    }
                }
L1178:;
              goto L1177;
            }
          if(strcmp(Keyword,"oct$")==0){
              strcpy(Stk[Tmp],"oct$");
              Use_Oct=Use_BcxTempStr=TRUE;
              goto L1177;
            }
          if(strcmp(Keyword,"or")==0  || strcmp(Keyword,"orelse")==0){
              strcpy(Stk[Tmp]," || ");
              goto L1177;
            }
          if(strcmp(Keyword,"osversion")==0){
              strcpy(Stk[Tmp],"OSVersion()");
              Convert2SimpleFunction(Tmp);
              Emit_OSVersionEnum();
              Use_OSVersion=Use_Proto=TRUE;
            }

L1177:;

          goto L1136;
        }
      if(iAlphaIdx==16 ){
          if(strcmp(Keyword,"pellespath$")==0){
              strcpy(Stk[Tmp],"PellesPath$()");
              Convert2SimpleFunction(Tmp);
              Use_PellesPath=Use_RegString=Use_Instrrev=TRUE;
              Use_Left=Use_BcxTempStr=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"putc")==0){
              strcpy(Stk[Tmp],"putc");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              strcpy(Stk[Tmp+2],RemoveStr(Stk[Tmp+2],"#"));
              if(DataType(Stk[Tmp+2])==vt_NUMBER ){
                  strcpy(Stk[Tmp+2], join(2,"FP",Stk[Tmp+2]));
                }
              char fp[BCXSTRSIZE]={0};
              strcpy(fp,Stk[Tmp+2]);
              LShiftStk(Tmp+2);
              LShiftStk(Tmp+2);
              strcpy(Stk[Ndx],",");
              Ndx++;
              strcpy(Stk[Ndx],fp);
              Ndx++;
              strcpy(Stk[Ndx],")");
              goto L1179;
            }
          if(strcmp(Keyword,"printer")==0){
              int Tmp1=Tmp+1;
              if(*Stk[Tmp1]){
                  if(m_iMatchWrd(Stk[Tmp1],"open")){
                      strcpy(Stk[Tmp],"printeropen");
                    }
                  if(m_iMatchWrd(Stk[Tmp1],"ejectpage")){
                      strcpy(Stk[Tmp],"ejectpage");
                    }
                  if(m_iMatchWrd(Stk[Tmp1],"close")){
                      strcpy(Stk[Tmp],"printerclose");
                    }
                  if(m_iMatchWrd(Stk[Tmp],"printer")){
                      Abort(join(3,"Unknown word '",Stk[Tmp1],"' with printer"));
                    }
                  LShiftStk(Tmp1);
                }
              else
                {
                  Ndx=0;
                }
              Use_Printer=Use_Proto=TRUE;
              iEmitVarGroup=iEmitVarGroup|ePrinterGroup;
              Use_Mid=Use_Left=TRUE;
              Use_Extract=Use_Str=Use_BcxTempStr=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"print")==0){
              if(*Stk[Tmp+1]==35 ){
                  strcpy(Stk[Tmp],"fprint");
                  strcpy(Stk[Tmp+1],mid(Stk[Tmp+1],2));
                }
              goto L1179;
            }
          if(strcmp(Keyword,"ptr")==0){
              strcpy(Stk[Tmp-1], join(2,Stk[Tmp-1],"*"));
              *Stk[Tmp]=0;
              if(Tmp==Ndx ){
                  Ndx--;
                  while(tally(Stk[Ndx],"*")==(int)strlen(Stk[Ndx])){
                      strcpy(Stk[Ndx-1], join(2,Stk[Ndx-1],Stk[Ndx]));
                      *Stk[Ndx]=0;
                      Ndx--;
                    }
                }
              else
                {
                  i=Tmp-1;
                  while(tally(Stk[i],"*")==(int)strlen(Stk[i])){
                      strcpy(Stk[i-1], join(2,Stk[i-1],Stk[i]));
                      *Stk[i--]=0;
                    }
                }
              goto L1179;
            }
          if(strcmp(Keyword,"panel")==0){
              strcpy(Stk[Tmp],"panel");
              Use_Panel=Use_Console=Use_Proto=Use_Cursor=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"pause")==0){
              strcpy(Stk[Tmp],"Pause()");
              Convert2SimpleFunction(Tmp);
              Use_Pause=Use_Proto=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"peek$")==0){
              strcpy(Stk[Tmp],"$$peekstr$");
              Use_PeekStr=Use_BcxTempStr=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"pi")==0){
              strcpy(Stk[Tmp],"3.141592653589793");
              goto L1179;
            }
          if(strcmp(Keyword,"playwav")==0){
              strcpy(Stk[Tmp],"PlayWav");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_PlayWav=Use_GetResource=Use_Proto=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"pos")==0){
              strcpy(Stk[Tmp],"Pos()");
              Use_Pos=Use_Proto=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"pushcolors")==0){
              strcpy(Stk[Tmp],"PushColors()");
              Use_PushPopColors=Use_Color=Use_Console=Use_Proto=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"popcolors")==0){
              strcpy(Stk[Tmp],"PopColors()");
              Use_PushPopColors=Use_Color=Use_Console=Use_Proto=TRUE;
              goto L1179;
            }
          if(strcmp(Keyword,"private")==0){
              if(m_iMatchWrd(Stk[Tmp+1],"const")){
                  strcpy(Stk[Tmp],"enum ");
                  strcpy(Stk[Tmp+1], join(2,Stk[Tmp+2],"{"));
                  Ndx++;
                  strcpy(Stk[Ndx],"}");
                }
              else
                {
                  strcpy(Stk[1],"private");
                }
            }

L1179:;

          goto L1136;
        }
      if(iAlphaIdx==17 ){
          if(strcmp(Keyword,"qbcolor")==0){
              strcpy(Stk[Tmp],"qbcolor");
              Use_QBColor=Use_Proto=TRUE;
            }
          goto L1136;
        }
      if(iAlphaIdx==18 ){
          if(strcmp(Keyword,"rgb")==0){
              strcpy(Stk[Tmp],"RGB");
              goto L1183;
            }
          if(strcmp(Keyword,"read")==0){
              strcpy(Stk[Tmp],"READNUM");
              Use_Readnum=Use_SysMacros=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"read$")==0){
              strcpy(Stk[Tmp],"READ$");
              Use_Read=Use_SysMacros=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rewind")==0){
              strcpy(Stk[Tmp],"rewind");
              int Tmp2=Tmp+2;
              if(DataType(Stk[Tmp2])==vt_NUMBER ){
                  strcpy(Stk[Tmp2], join(2,"FP",Stk[Tmp2]));
                }
              goto L1183;
            }
          if(strcmp(Keyword,"remove$")==0){
              strcpy(Stk[Tmp],"$$RemoveStr$");
              Use_Remove=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"replace$")==0){
              strcpy(Stk[Tmp],"$$replace$");
              Use_Replace=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"replaceany$")==0){
              strcpy(Stk[Tmp],"ReplaceAny$");
              Use_ReplaceAny=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"removeany$")==0){
              strcpy(Stk[Tmp],"RemoveAny$");
              Use_RemoveAny=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"right$")==0){
              strcpy(Stk[Tmp],"$$right$");
              Use_Right=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rightstr")==0){
              strcpy(Stk[Tmp],"RightStr");
              Use_RightStr=Use_Right=Use_Lcase=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rclick")==0){
              strcpy(Stk[Tmp],"rClick()");
              Convert2SimpleFunction(Tmp);
              Use_Rclick=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"randomize")==0){
              strcpy(Stk[Tmp],"randomize");
              Use_Randomize=TRUE;
              Use_Proto=TRUE;
              if(Ndx==1 ){
                  Use_Timer=TRUE;
                  strcpy(Stk[1],"randomize(timer())");
                }
              if(Ndx==2 && strcmp(Stk[2],"timer")==0){
                  Use_Timer=TRUE;
                  Ndx=1;
                  strcpy(Stk[1],"randomize(timer())");
                }
              if(Ndx>=2 && strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1183;
            }
          if(strcmp(Keyword,"rec")==0){
              int Tmp2=Tmp+2;
              if(DataType(Stk[Tmp2])==vt_NUMBER ){
                  strcpy(Stk[Tmp2], join(2,"FP",Stk[Tmp2]));
                }
              strcpy(Stk[Tmp2],RemoveStr(Stk[Tmp2],"#"));
              strcpy(Stk[Tmp], join(5,"rec(",Stk[Tmp2],",",Stk[Tmp2],"len)"));
              *Stk[Tmp+1]=0;
              *Stk[Tmp2]=0;
              *Stk[Tmp+3]=0;
              Use_Rec=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"reccount")==0){
              char length[BCXSTRSIZE]={0};
              int Tmp2=Tmp+2;
              if(DataType(Stk[Tmp2])==vt_NUMBER ){
                  strcpy(Stk[Tmp2], join(2,"FP",Stk[Tmp2]));
                }
              strcpy(Stk[Tmp2],RemoveStr(Stk[Tmp2],"#"));
              strcpy(Stk[Tmp],"reccount");
              strcpy(length, join(2,Stk[Tmp2],"len)"));
              for(i=Tmp+1; i<=Ndx; i++)
                {
                  if(*Stk[i]==41 ){
                      *Stk[i]=0;
                      goto L1184;
                    }
                  strcpy(Stk[Tmp], join(2,Stk[Tmp],Stk[i]));
                  *Stk[i]=0;
                }
L1184:;
              strcpy(Stk[Tmp], join(3,Stk[Tmp],",",length));
              Use_RecCount=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"refresh")==0){
              strcpy(Stk[Tmp],"Refresh");
              Use_Refresh=Use_SysMacros=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"radtodeg")==0){
              strcpy(Stk[Tmp],"RadToDeg");
              Use_RadToDeg=Use_SysMacros=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"regstring$")==0){
              strcpy(Stk[Tmp],"$$RegString$");
              Convert2SimpleFunction(Tmp);
              Use_RegString=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"regexist")==0){
              strcpy(Stk[Tmp],"RegExist");
              Convert2SimpleFunction(Tmp);
              Use_RegExist=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"regint")==0){
              strcpy(Stk[Tmp],"RegInt");
              Convert2SimpleFunction(Tmp);
              Use_RegInt=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"remain$")==0){
              strcpy(Stk[Tmp],"$$remain$");
              Use_Remain=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"remainany$")==0){
              strcpy(Stk[Tmp],"$$remainany$");
              Use_RemainAny=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"retain$")==0){
              strcpy(Stk[Tmp],"$$Retain$");
              Use_Retain=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"repeat$")==0){
              strcpy(Stk[Tmp],"$$repeat$");
              Use_Repeat=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"reverse$")==0){
              strcpy(Stk[Tmp],"$$reverse$");
              Use_Reverse=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rnd")==0){
              strcpy(Stk[Tmp],"rnd()");
              Convert2SimpleFunction(Tmp);
              Use_Rnd=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rnd2")==0){
              strcpy(Stk[Tmp],"rnd2");
              Use_Rnd2=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"round")==0){
              strcpy(Stk[Tmp],"Round");
              Use_Round=Use_Proto=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rpad$")==0){
              strcpy(Stk[Tmp],"$$rpad$");
              Use_Rpad=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"rtrim$")==0){
              strcpy(Stk[Tmp],"$$rtrim$");
              Use_Rtrim=Use_BcxTempStr=TRUE;
              goto L1183;
            }
          if(strcmp(Keyword,"run")==0){
              strcpy(Stk[Tmp],"Run");
              Use_Run=Use_Proto=TRUE;
            }

L1183:;

          goto L1136;
        }
      if(iAlphaIdx==19 ){
          if(strcmp(Keyword,"setdimension")==0){
              strcpy(Stk[Tmp],"SetDimension");
              Use_SetDimension=Use_Proto=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"spc$")==0){
              strcpy(Stk[Tmp],"SPC$");
              Use_SPC=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"startdraw")==0){
              strcpy(Stk[Tmp],"StartDraw");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Draw=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"str$")==0){
              strcpy(Stk[Tmp],"$$str$");
              Use_Str=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"strl$")==0){
              strcpy(Stk[Tmp],"$$strl$");
              Use_Strl=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"str2variant")==0){
              Add2SplitLines(join(3,"COM_AS2WS(",Stk[Tmp+2],")"));
              Add2SplitLines(join(2,Stk[Tmp+4],".vt = VT_BSTR"));
              Add2SplitLines(join(2,Stk[Tmp+4],".bstrVal = SysAllocString(COM_PWSTR_temp)"));
              Ndx=0;
              goto L1185;
            }
          if(strcmp(Keyword,"searchpath$")==0){
              strcpy(Stk[Tmp],"$$SEARCHPATH$");
              Use_SearchPath=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"sendmessage")==0  || strcmp(Keyword,"sndmsg")==0){
              if(!m_iMatchWrd(Stk[1],"const")){
                  if(strcmp(Stk[Tmp+1],"(")!=0){
                      InsertOptionalParens(Tmp+1);
                    }
                  strcpy(Stk[Tmp],"SendMessage");
                  Comma=i=0;
                  A=Tmp+1;
                  for(;;)
                    {
                      if(A>Ndx ){
                          Abort("Malformed SendMessage");
                        }
                      A++;
                      if(inchr("([{",Stk[A])){
                          i++;
                        }
                      if(inchr(")]}",Stk[A])){
                          i--;
                        }
                      if(NOTZERO(i)){
                          continue;
                        }
                      if(*Stk[A]==44 ){
                          if(Comma==0 ){
                              if(ISFALSE(m_iMatchWrd(Stk[A+2],"UINT"))){
                                  InsertTokens(A,3,"(","UINT",")");
                                }
                            }
                          else if(Comma==1 ){
                              if(ISFALSE(m_iMatchWrd(Stk[A+2],"WPARAM"))){
                                  InsertTokens(A,3,"(","WPARAM",")");
                                }
                            }
                          else if(Comma==2 ){
                              if(ISFALSE(m_iMatchWrd(Stk[A+2],"LPARAM"))){
                                  InsertTokens(A,3,"(","LPARAM",")");
                                }
                              goto L1186;
                            }
                          Comma++;
                        }
                    }
L1186:;
                }
              goto L1185;
            }
          if(strcmp(Keyword,"savebmp")==0){
              strcpy(Stk[Tmp],"SaveBmp");
              Use_SaveBmp=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"setaddr")==0){
              strcpy(Stk[Tmp],"SetAddr");
              Use_Setaddr=Use_Proto=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"set_bcx_bitmap")==0){
              strcpy(Stk[Tmp],"Set_BCX_Bitmap");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Set_BCX_Bitmap=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"set_bcx_bitmap2")==0){
              strcpy(Stk[Tmp],"Set_BCX_Bitmap2");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Set_BCX_Bitmap2=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"set_bcx_bmpbutton")==0){
              strcpy(Stk[Tmp],"Set_BCX_BmpButton");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Set_BCX_BmpButton=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"set_bcx_icon")==0){
              strcpy(Stk[Tmp],"Set_BCX_Icon");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Proto=TRUE;
              Use_Set_BCX_Icon=Use_GetResource=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"screen")==0){
              strcpy(Stk[Tmp],"Screen");
              Use_Screen=Use_Proto=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"setattr")==0){
              strcpy(Stk[Tmp],"SETATTR");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Setattr=Use_SysMacros=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"setwindowrtftext")==0){
              strcpy(Stk[Tmp],"SetWindowRTFText");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Richedit=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"sgn")==0){
              strcpy(Stk[Tmp],"sgn");
              Use_Sgn=Use_Proto=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"show")==0){
              strcpy(Stk[Tmp],"SHOWHWND");
              Use_Show=Use_SysMacros=TRUE;
              if(Ndx>=2 && strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              goto L1185;
            }
          if(strcmp(Keyword,"sleep")==0){
              if(Ndx==1 ){
                  strcpy(Stk[1],"keypress()");
                  Use_Keypress=Use_Proto=TRUE;
                }
              else
                {
                  Use_Sleep=TRUE;
                  strcpy(Stk[Tmp],"BCX_Sleep");
                  if(Ndx>=2 && strcmp(Stk[Tmp+1],"(")!=0){
                      InsertOptionalParens(Tmp+1);
                    }
                }
              goto L1185;
            }
          if(strcmp(Keyword,"showmodal")==0){
              strcpy(Stk[Tmp],"ShowModal");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Show=Use_SysMacros=Use_ShowModal=Use_EndModal=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"space$")==0){
              strcpy(Stk[Tmp],"$$space$");
              Use_Space=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"sound")==0){
              strcpy(Stk[Tmp],"Sound");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Sound=Use_Round=Use_Str=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"split")==0){
              strcpy(Stk[Tmp],"Split");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Proto=TRUE;
              Use_BcxTempStr=TRUE;
              Use_UCaseTbl=TRUE;
              Use_Stristr=TRUE;
              Use_Split=TRUE;
              Use_Remove=TRUE;
              Use_Mid=TRUE;
              Use_Left=TRUE;
              Use_Instr=TRUE;
              Use_Replace=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"strim$")==0){
              strcpy(Stk[Tmp],"$$strim$");
              Use_Strim=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"string$")==0){
              strcpy(Stk[Tmp],"$$stringx$");
              Use_String=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"strptr")==0){
              strcpy(Stk[Tmp],"STRPTR");
              Use_Strptr=Use_SysMacros=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"strtoken$")==0){
              strcpy(Stk[Tmp],"StrToken$");
              Use_Strtoken=Use_BcxTempStr=Use_Mid=Use_Left=Use_Extract=TRUE;
              Use_Instr=Use_Instrrev=Use_Stristr=Use_Tally=Use_Remove=TRUE;
              Use_UCaseTbl=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"sub")==0){
              if(bcx_stricmp(Stk[2],"main")==0){
                  NoMain=TRUE;
                  strcpy(Stk[1],"function");
                }
              goto L1185;
            }
          if(strcmp(Keyword,"swap")==0){
              strcpy(Stk[Tmp],"swap");
              Use_Swap=Use_Proto=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"sysdir$")==0){
              strcpy(Stk[Tmp],"$$sysdir$()");
              Convert2SimpleFunction(Tmp);
              Use_Sysdir=Use_BcxTempStr=TRUE;
              goto L1185;
            }
          if(strcmp(Keyword,"sysstr")==0){
              strcpy(Stk[Tmp],"SysStr");
              Use_SysStr=Use_Proto=TRUE;
            }

L1185:;

          goto L1136;
        }
      if(iAlphaIdx==20 ){
          if(strcmp(Keyword,"tab$")==0){
              strcpy(Stk[Tmp],"TAB$");
              Use_TAB=Use_BcxTempStr=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"true")==0){
              strcpy(Stk[Tmp],"TRUE");
              goto L1187;
            }
          if(strcmp(Keyword,"trim$")==0){
              strcpy(Stk[Tmp],"$$trim$");
              Use_Trim=Use_BcxTempStr=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"tally")==0){
              strcpy(Stk[Tmp],"tally");
              Use_Tally=Use_UCaseTbl=Use_Stristr=Use_Proto=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"tempdir$")==0){
              strcpy(Stk[Tmp],"$$tempdir$()");
              Convert2SimpleFunction(Tmp);
              Use_Tempdir=Use_BcxTempStr=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"tempfilename$")==0){
              strcpy(Stk[Tmp],"$$TempFileName$");
              Use_TempFileName=Use_BcxTempStr=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"textmode")==0){
              strcpy(Stk[Tmp],"TextMode");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              Use_Textmode=Use_Proto=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"time$")==0){
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  strcpy(Stk[Tmp],"$$timef$()");
                }
              else
                {
                  strcpy(Stk[Tmp],"$$timef$");
                }
              Convert2SimpleFunction(Tmp);
              Use_Time=Use_BcxTempStr=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"timer")==0){
              strcpy(Stk[Tmp],"timer()");
              Convert2SimpleFunction(Tmp);
              Use_Timer=Use_Proto=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"tix_start")==0){
              strcpy(Stk[Tmp],"TIX_START()");
              Convert2SimpleFunction(Tmp);
              Use_Tix=Use_Proto=TRUE;
              goto L1187;
            }
          if(strcmp(Keyword,"tix_now")==0){
              strcpy(Stk[Tmp],"TIX_NOW()");
              Convert2SimpleFunction(Tmp);
              Use_Tix=Use_Proto=TRUE;
            }

L1187:;

          goto L1136;
        }
      if(iAlphaIdx==21 ){
          if(strcmp(Keyword,"ucase$")==0){
              if(iSubLoc==2 ){
                  if(strcmp(Stk[Tmp+1],"(")==0){
                      Abort("'ucase' can only be used as a Function Pointer when in a SET");
                    }
                  strcpy(Stk[Tmp],"ucase");
                }
              else
                {
                  strcpy(Stk[Tmp],"$$ucase$");
                }
              Use_Ucase=Use_BcxTempStr=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"unwrap$")==0){
              strcpy(Stk[Tmp],"$$unwrap$");
              Use_Unwrap=Use_BcxTempStr=Use_Left=Use_Right=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"ubound")==0){
              strcpy(Stk[Tmp],"ubound");
              Use_Ubound=Use_SysMacros=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"ubound_d")==0){
              strcpy(Stk[Tmp],"ubound_d");
              Use_Ubound=Use_SysMacros=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"ubound_s")==0){
              strcpy(Stk[Tmp],"ubound_s");
              Use_Ubound=Use_SysMacros=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"ucode$")==0  || strcmp(Keyword,"ucode")==0){
              strcpy(Stk[Tmp],"$$AnsiToWide$");
              Use_AnsiToWide=Use_BcxTempStr=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"utf8tochr$")==0){
              strcpy(Stk[Tmp],"UTF8toCHR$");
              Use_Utf8tochr=Use_BcxTempStr=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"uncom")==0){
              Use_AnsiToWide=Use_WideToAnsi=Use_BcxTempStr=TRUE;
              strcpy(Stk[Tmp],"UNCOM");
              if(strcmp(Stk[Tmp+1],"(")!=0){
                  InsertOptionalParens(Tmp+1);
                }
              ComSwitchON=TRUE;
              Use_COM=TRUE;
              Use_COM_CreateObject=TRUE;
              Use_COM_DispatchObject=TRUE;
              Use_COM_GetObject=TRUE;
              Use_COM_GetProperty=TRUE;
              Use_COM_InvokeMethod=TRUE;
              Use_COM_SafeArray=TRUE;
              Use_COM_SetProperty=TRUE;
              Use_COM_UsesConversion=TRUE;
              goto L1188;
            }
          if(strcmp(Keyword,"using$")==0){
              strcpy(Stk[Tmp],"$$Using$");
              Use_Using=Use_Instr=Use_Stristr=Use_Replace=Use_BcxTempStr=Use_UCaseTbl=Use_LCaseTbl=TRUE;
            }

L1188:;

          goto L1136;
        }
      if(iAlphaIdx==22 ){
          if(strcmp(Keyword,"val")==0){
              strcpy(Stk[Tmp],"VAL");
              Use_Val=Use_SysMacros=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"vall")==0){
              strcpy(Stk[Tmp],"VALL");
              Use_Vall=Use_SysMacros=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"variant2str")==0){
              Add2SplitLines("BEGINBLOCK");
              Add2SplitLines(join(3,"DIM RAW sBuf[wlen(",Stk[Tmp+2],".bstrVal)+2] AS char"));
              Add2SplitLines(join(3,"wstrcpy(sBuf,",Stk[Tmp+2],".bstrVal)"));
              Add2SplitLines("COM_WS2AS(sBuf)");
              Add2SplitLines(join(2,Stk[Tmp+4]," = COM_psz_tmp$"));
              Add2SplitLines("ENDBLOCK");
              Ndx=0;
              Use_COM_UsesConversion=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"varptr")==0){
              strcpy(Stk[Tmp+1], join(2,"&",Stk[Tmp+1]));
              *Stk[Tmp]=0;
              goto L1189;
            }
          if(strcmp(Keyword,"vchr$")==0){
              strcpy(Stk[Tmp],"$$vchr$");
              Use_VChr=Use_BcxTempStr=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"vt$")==0){
              strcpy(Stk[Tmp],"VT$");
              Use_VT=Use_BcxTempStr=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"virtual")==0){
              if(Tmp==1 ){
                  strcpy(Stk[Tmp],"dim");
                  IsVirtual=TRUE;
                  int ii=Ndx;
                  while(strcmp(Stk[ii],")")!=0){
                      ii--;
                    }
                  ii++;
                  if(m_iMatchWrd(Stk[Ndx],"stdcall")){
                      int iNdx=Ndx-1;
                      if(m_iMatchWrd(Stk[iNdx],"as")){
                          iNdx--;
                        }
                      if(ii<=iNdx ){
                          BuildDelimStr(ii,iNdx,szVirtual);
                        }
                      else
                        {
                          *szVirtual=0;
                        }
                    }
                  else
                    {
                      if(ii<=Ndx ){
                          BuildDelimStr(ii,Ndx,szVirtual);
                        }
                      else
                        {
                          *szVirtual=0;
                        }
                    }
                }
              goto L1189;
            }
          if(strcmp(Keyword,"vector")==0){
              if(strcmp(Stk[Tmp+1],"<")==0){
                  strcpy(Stk[Tmp],"vector");
                  HasVector=TRUE;
                }
              goto L1189;
            }
          if(strcmp(Keyword,"verify")==0){
              strcpy(Stk[Tmp],"Verify");
              Use_Verify=Use_Mid=Use_BcxTempStr=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"vbs_addcode")==0  || strcmp(Keyword,"vbs_run_script")==0  || strcmp(Keyword,"vbs_eval_str$")==0){
              strcpy(Stk[Tmp],ucase(Stk[Tmp]));
              Use_VBS=Use_BcxTempStr=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"vbs_eval_num")==0  || strcmp(Keyword,"vbs_eval_num#")==0){
              strcpy(Stk[Tmp],"VBS_EVAL_NUM#");
              Use_VBS=Use_BcxTempStr=TRUE;
              goto L1189;
            }
          if(strcmp(Keyword,"vbs_start")==0  || strcmp(Keyword,"vbs_stop")==0  || strcmp(Keyword,"vbs_reset")==0  || strcmp(Keyword,"vbs_error$")==0){
              Use_VBS=Use_BcxTempStr=TRUE;
              strcpy(Stk[Tmp], join(2,ucase(Stk[Tmp]),"()"));
              Convert2SimpleFunction(Tmp);
            }

L1189:;

          goto L1136;
        }
      if(iAlphaIdx==23 ){
          if(strcmp(Keyword,"wrap$")==0){
              strcpy(Stk[Tmp],"$$wrap$");
              Use_Wrap=Use_BcxTempStr=TRUE;
              goto L1191;
            }
          if(strcmp(Keyword,"widetoansi$")==0  || strcmp(Keyword,"widetoansi")==0  || strcmp(Keyword,"w2a$")==0  || strcmp(Keyword,"w2a")==0){
              strcpy(Stk[Tmp],"$$WideToAnsi$");
              Use_WideToAnsi=Use_BcxTempStr=TRUE;
              goto L1191;
            }
          if(strcmp(Keyword,"windir$")==0){
              strcpy(Stk[Tmp],"$$windir$()");
              Convert2SimpleFunction(Tmp);
              Use_Windir=Use_BcxTempStr=TRUE;
              goto L1191;
            }
          if(strcmp(Keyword,"wndproc")==0){
              if(Tmp==2&&Ndx<6 ){
                  strcpy(Src,"FUNCTION|WndProc(hWnd|AS|HWND,Msg|AS|UINT,wParam|AS|WPARAM,lParam|AS|LPARAM)|AS|CALLBACK|LRESULT");
                  FastLexer(Src,"|",",()");
                  Use_Wingui=TRUE;
                  CallBackFlag=TRUE;
                }
              goto L1191;
            }
          if(strcmp(Keyword,"winmain")==0){
              Use_Wingui=InWinMain=TRUE;
              if(Tmp==2&&Ndx<6 ){
                  strcpy(Src,"FUNCTION|WinMain(hInst|AS|HINSTANCE,hPrev|AS|HINSTANCE,CmdLine|AS|PSTR,CmdShow|AS|int)AS|int WINAPI");
                  FastLexer(Src,"|",",()");
                }
              else
                {
                  strcpy(Stk[Tmp],"WinMain");
                }
            }

L1191:;

          goto L1136;
        }
      if(iAlphaIdx==26 ){
          if(strcmp(Keyword,"zstring")==0){
              if(m_iMatchWrd(Stk[Tmp+1],"ptr")){
                  strcpy(Stk[Tmp],"char");
                  Tmp++;
                  strcpy(Stk[Tmp-1], join(2,Stk[Tmp-1],"*"));
                  *Stk[Tmp]=0;
                  if(Tmp==Ndx ){
                      Ndx--;
                      while(tally(Stk[Ndx],"*")==(int)strlen(Stk[Ndx])){
                          strcpy(Stk[Ndx-1], join(2,Stk[Ndx-1],Stk[Ndx]));
                          *Stk[Ndx]=0;
                          Ndx--;
                        }
                    }
                  else
                    {
                      i=Tmp-1;
                      while(tally(Stk[i],"*")==(int)strlen(Stk[i])){
                          strcpy(Stk[i-1], join(2,Stk[i-1],Stk[i]));
                          *Stk[i]=0;
                          i--;
                        }
                    }
                }
              strcpy(Stk[Tmp],"string");
            }
          goto L1136;
        }
      if(iAlphaIdx==27 ){
          if(strcmp(Keyword,"$ifndef")==0){
              strcpy(Stk[Tmp],"~ifndef");
              InConditional++;
              goto L1195;
            }
          if(strcmp(Keyword,"$ifdef")==0){
              strcpy(Stk[Tmp],"~ifdef");
              InConditional++;
              goto L1195;
            }
          if(strcmp(Keyword,"$if")==0){
              strcpy(Stk[Tmp],"~if");
              InConditional++;
              goto L1195;
            }
          if(strcmp(Keyword,"$endif")==0){
              strcpy(Stk[Tmp],"~endif");
              InConditional--;
              if(InConditional<0 ){
                  Abort("Too many $ENDIFs");
                }
            }

L1195:;

        }

L1136:;

    }
L1135:;
  RemEmptyTokens();
  if(PrependCnt ){
      i=PrependCnt;
      while(i){
          if(!m_iMatchWrd(Stk[1],"with")&&!m_iMatchWrd(Stk[1],"prepend")&&!m_iMatchWrd(Stk[1],"endwith")&&!m_iMatchWrd(Stk[1],"endprepend")){
              InsertTokens(0,1,PrependVar[i]);
            }
          i--;
        }
    }
  if(WithCnt ){
      int WithVarPositions[32]={0};
      int PrefixedPositions[32]={0};
      for(i=1; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],WithVar[WithCnt])==0){
              WithVarPositions[i]=TRUE;
            }
        }
      i=Ndx;
      while(i){
          if(LeftStr(Stk[i],"->")||(*Stk[i]==46&&!IsDecimalNumber(Stk[i]+1))){
              if(strcmp(WithVar[WithCnt],"Me")==0  && *Stk[i]==46 ){
                  if(InFunction ){
                      strcpy(Stk[i], join(2,"->",mid(Stk[i],2)));
                    }
                }
              strcpy(Stk[i], join(2,WithVar[WithCnt],Stk[i]));
              PrefixedPositions[i]=TRUE;
            }
          i--;
        }
      if(strcmp(WithVar[WithCnt],"Me")!=0){
          for(i=2; i<=Ndx; i++)
            {
              if(PrefixedPositions[i]==TRUE ){
                  int IsChain=FALSE;
                  if(PrefixedPositions[i-1]==TRUE||WithVarPositions[i-1]==TRUE ){
                      IsChain=TRUE;
                    }
                  else if((int)strlen(Stk[i-1])>0 ){
                      UCHAR  LastCh;
                      LastCh=Stk[i-1][(int)strlen(Stk[i-1])-1];
                      if(LastCh==93||LastCh==41 ){
                          IsChain=TRUE;
                        }
                      else if(isalnum(LastCh)||LastCh==95 ){
                          char PrevLower[BCXSTRSIZE];
                          strcpy(PrevLower,lcase(Stk[i-1]));
                          if(GetWordInfo(PrevLower)==NULL ){
                              IsChain=TRUE;
                            }
                        }
                    }
                  if(IsChain ){
                      strcpy(Stk[i],RemoveStr(Stk[i],WithVar[WithCnt]));
                    }
                }
            }
        }
      for(i=1; i<=Ndx; i++)
        {
          if(WithVarPositions[i]==TRUE ){
              strcpy(Stk[i],WithVar[WithCnt]);
            }
        }
    }
  if(PrependCnt ){
      BuildDelimStr(1,Ndx,Src);
      PreParse(Src);
    }
  if(CompToken==1 ){
      strcpy(Keyword,lcase(Stk[1]));
      if(strcmp(Keyword,"dim")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"local")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"global")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"static")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"shared")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"raw")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"dynamic")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"free")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"redim")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"sub")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"function")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"overloaded")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"callback")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"public")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"declare")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"c_declare")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"auto")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"register")==0){
          CompToken=0;
          goto L1201;
        }
      if(strcmp(Keyword,"extern")==0){
          CompToken=0;
        }
      else
        {
          AsmUnknownStructs(1);
        }

L1201:;

    }
}

void LShiftStk (int ToCell)
{
  if(Ndx<=0||ToCell<0||ToCell>Ndx ){
      return;
    }
  Ndx--;
  for(int i=ToCell; i<=Ndx; i++)
    {
      strcpy(Stk[i],Stk[i+1]);
    }
  *Stk[Ndx+1]=0;
}

void RShiftStk (int FromCell)
{
  if(FromCell<0||FromCell>Ndx||Ndx>=ubound(Stk)){
      return;
    }
  Ndx++;
  for(int i=Ndx; i>=FromCell; i+=-1)
    {
      strcpy(Stk[i],Stk[i-1]);
    }
  *Stk[FromCell]=0;
}

void InsertOptionalParens (int StartCell)
{
  RShiftStk(StartCell);
  strcpy(Stk[StartCell],"(");
  Ndx++;
  strcpy(Stk[Ndx],")");
}

void JoinStrings (int iThisToken,int inIF)
{
  int sj=iThisToken;
  int DoJoin=0;
  int InBrace=0;
  int OnlyPara=0;
  int j=0;
  int vt=0;
  char szToken[BCXSTRSIZE];
  *szToken=0;
  while(iThisToken<=Ndx){
      strcpy(szToken,Stk[iThisToken]);
      if(!j&&!OnlyPara&&!InBrace ){
          vt=DataType(szToken);
          if(vt==vt_INTEGER ){
              vt=GetNextVarType(iThisToken);
            }
          if(vt==vt_STRVAR||vt==vt_STRLIT ){
              sj=iThisToken;
              iThisToken++;
              continue;
            }
        }
      strcpy(szToken,lcase(szToken));
      if(strcmp(szToken,"&")==0){
          if(OnlyPara ){
              goto L1205;
            }
          vt=DataType(Stk[iThisToken+1]);
          if(vt==vt_INTEGER ){
              vt=GetNextVarType(iThisToken+1);
            }
          if(vt!=vt_STRVAR&&vt!=vt_STRLIT ){
              vt=DataType(Stk[iThisToken-1]);
              if(vt==vt_INTEGER ){
                  vt=GetPrevVarType(iThisToken-1,1);
                }
            }
          if(vt==vt_STRVAR||vt==vt_STRLIT ){
              j++;
              strcpy(Stk[iThisToken],",");
              *szToken=0;
            }
          goto L1205;
        }
      if(strcmp(szToken,"[")==0){
          InBrace++;
          goto L1205;
        }
      if(strcmp(szToken,"]")==0){
          InBrace--;
          goto L1205;
        }
      if(strcmp(szToken,"(")==0){
          if(strcmp(Stk[iThisToken+1],"*")!=0){
              JoinStrings(iThisToken+1,inIF);
              int iBuildHere=iThisToken-1;
              while(strcmp(Stk[iThisToken],")")!=0){
                  strcpy(Stk[iBuildHere], join(3,Stk[iBuildHere],Stk[iThisToken],SPC));
                  *Stk[iThisToken]=0;
                  iThisToken++;
                }
              strcpy(Stk[iBuildHere], join(2,Stk[iBuildHere],Stk[iThisToken]));
              *Stk[iThisToken]=0;
            }
          goto L1205;
        }
      if(strcmp(szToken,")")==0){
          if(j ){
              strcpy(Stk[sj], join(4,"join$(",str(j+1,TRUE),",",Stk[sj]));
              j=sj;
              while(++j<iThisToken){
                  strcpy(Stk[sj], join(2,Stk[sj],Stk[j]));
                  *Stk[j]=0;
                }
              strcpy(Stk[sj], join(2,Stk[sj],")"));
            }
          return;
        }
      if(strcmp(szToken,"||")==0){
          strcpy(Stk[iThisToken],"or");
          DoJoin=TRUE;
          goto L1205;
        }
      if(strcmp(szToken,"&&")==0){
          strcpy(Stk[iThisToken],"and");
          DoJoin=TRUE;
          goto L1205;
        }
      if(strcmp(szToken,"then")==0  || strcmp(szToken,"for")==0  || strcmp(szToken,"xfor")==0){
          DoJoin=TRUE;
          goto L1205;
        }
      if(strcmp(szToken,"=")==0){
          if(!inIF ){
              OnlyPara=TRUE;
            }
          else
            {
              DoJoin=TRUE;
            }
          goto L1205;
        }
      if(strcmp(szToken,"if")==0  || strcmp(szToken,"elseif")==0  || strcmp(szToken,"while")==0){
          inIF=TRUE;
          sj=iThisToken+1;
          goto L1205;
        }
      if(strcmp(szToken,"sprint")==0  || strcmp(szToken,"lprint")==0  || strcmp(szToken,"fprint")==0  || strcmp(szToken,"fprintf")==0  || strcmp(szToken,"print")==0  || strcmp(szToken,"print#")==0){
          OnlyPara=TRUE;
        }
      else
        {
          if(LeftStr(Stk[iThisToken],"].")||LeftStr(Stk[iThisToken],"]->")){
              InBrace--;
            }
        }

L1205:;

      if((DoJoin||inchr(",+-*/^;:<>~|&",szToken))&&!OnlyPara&&!InBrace ){
          DoJoin=0;
          if(j ){
              strcpy(Stk[sj], join(4,"join$(",str(j+1,1),",",Stk[sj]));
              j=sj;
              while(++j<iThisToken){
                  strcpy(Stk[sj], join(2,Stk[sj],Stk[j]));
                  *Stk[j]=0;
                }
              strcpy(Stk[sj], join(2,Stk[sj],")"));
            }
          j=0;
          sj=iThisToken+1;
        }
      iThisToken++;
    }
  if(j ){
      strcpy(Stk[sj], join(4,"join$(",str(j+1,1),",",trim(Stk[sj])));
      j=sj;
      while(++j<=iThisToken){
          strcpy(Stk[sj], join(2,Stk[sj],trim(Stk[j])));
          *Stk[j]=0;
        }
      strcpy(Stk[sj], join(2,Stk[sj],")"));
    }
}

void Transforms ()
{
  int a;
  int i;
  char Keyword[BCXSTRSIZE];
  struct _UDT_SUB_FUNC_TOKENS*  tpBCX;
  strcpy(Keyword,lcase(Stk[1]));
  tpBCX=GetWordInfo(Keyword);
  if(tpBCX ){
      if((tpBCX->iWordInfo  &  eWI_Transform)==0 ){
          return;
        }
    }
  else
    {
      return;
    }
  char *LTmp;
  LTmp=(char*)calloc(c_MaxSrcLen, 1);
  a=inchr("abcdefghijklmnopqrstuvwxyz$",Keyword);
  if(a==4 ){
      if(strcmp(Keyword,"declare")==0  && m_iMatchWrd(Stk[4],"lib")){
          char szAlias[BCXSTRSIZE];
          int kk;
          int idx=-1;
          strcpy(Stk[5],RemoveStr(Stk[5],DQ));
          for(kk=1; kk<=LoadLibsCnt; kk++)
            {
              if(strcmp(Stk[5],Loadlibs[kk])==0){
                  idx=kk;
                  goto L1211;
                }
            }
L1211:;
          if(idx<0 ){
              if(c_MaxLoadlibs==++LoadLibsCnt ){
                  Abort("Maximum number of LIBs that can be loaded exceeded.");
                }
              strcpy(Loadlibs[LoadLibsCnt],Stk[5]);
            }
          if(m_iMatchWrd(Stk[6],"alias")){
              strcpy(szAlias,Stk[7]);
              *Stk[6]=0;
              *Stk[7]=0;
            }
          else
            {
              strcpy(szAlias,enc(ucase(Stk[3])));
            }
          DllCnt++;
          if(DllCnt>=c_MaxDLLDecl ){
              Abort("Maximum number of declarations exceeded.");
            }
          char mod_name[BCXSTRSIZE]={0};
          strcpy(mod_name,ucase(RemoveExtension(Stk[5])));
          if(inchr(mod_name,"-")||inchr(mod_name,".")){
              strcpy(mod_name,replace(mod_name,"-.","_"));
              strcpy(mod_name,replace(mod_name,"-","_"));
            }
          *DllDecl[DllCnt]=0;
          strcpy(DllDecl[DllCnt], join(3,DllDecl[DllCnt],No_Sigil(Stk[3]),"=(BCXFPROT"));
          strcpy(DllDecl[DllCnt], join(3,DllDecl[DllCnt],str(DllCnt,TRUE),")GetProcAddress(H_"));
          strcpy(DllDecl[DllCnt], join(5,DllDecl[DllCnt],mod_name,", ",szAlias,");"));
          *Stk[4]=0;
          *Stk[5]=0;
        }
      if (LTmp) {free(LTmp);}
      return;
    }
  if(a==9 ){
      if(strcmp(Keyword,"iremove")==0){
          char Mat[BCXSTRSIZE];
          char Fat[BCXSTRSIZE];
          for(i=2; i<=Ndx; i++)
            {
              if(m_iMatchWrd(Stk[i],"from")){
                  *Stk[i]=0;
                  goto L1212;
                }
            }
L1212:;
          BuildStr(2,i,Mat);
          BuildStr(i,Ndx,Fat);
          if(inchr(Fat,"$")==0 ){
              strcat(Fat,"$");
            }
          if(inchr(Mat,"$")==0 ){
              strcat(Mat,"$");
            }
          strcpy(LTmp, join(5,"=iremove$(",Fat,",",Mat,")"));
          FastLexer(Fat," ()","");
          strcpy(LTmp, join(2,Stk[Ndx],LTmp));
          PreParse(LTmp);
          TokenSubstitutions(1);
          Function_Main_Support();
          Ndx=0;
          if (LTmp) {free(LTmp);}
          return;
        }
      if(strcmp(Keyword,"ireplace")==0){
          if(Ndx<6 ){
              Abort("Problem with IREPLACE statement");
            }
          int W;
          int I;
          char VV[BCXSTRSIZE];
          char RR[BCXSTRSIZE];
          char WW[BCXSTRSIZE];
          for(W=2; W<=Ndx; W++)
            {
              if(m_iMatchWrd(Stk[W],"with")){
                  *Stk[W]=0;
                  goto L1213;
                }
            }
L1213:;
          for(I=2; I<=Ndx; I++)
            {
              if(m_iMatchWrd(Stk[I],"in")){
                  *Stk[I]=0;
                  goto L1214;
                }
            }
L1214:;
          BuildStr(I+1,Ndx,VV);
          BuildStr(2,W,RR);
          BuildStr(W+1,I,WW);
          if(inchr(VV,"$")==0 ){
              strcat(VV,"$");
            }
          if(inchr(RR,"$")==0 ){
              strcat(RR,"$");
            }
          if(inchr(WW,"$")==0 ){
              strcat(WW,"$");
            }
          strcpy(LTmp, join(7,"=ireplace$(",VV,",",RR,",",WW,")"));
          FastLexer(VV," ()","");
          strcpy(LTmp, join(2,Stk[Ndx],LTmp));
          PreParse(LTmp);
          TokenSubstitutions(1);
          Function_Main_Support();
          Ndx=0;
        }
      if (LTmp) {free(LTmp);}
      return;
    }
  if(a==18 ){
      if(strcmp(Keyword,"remove")==0){
          char Mat[BCXSTRSIZE];
          char Fat[BCXSTRSIZE];
          for(i=2; i<=Ndx && !m_iMatchWrd(Stk[i],"from"); i++)
            {
            }
          if(i>Ndx ){
              Abort("Malformed REMOVE statement.");
            }
          BuildStr(2,i-1,Mat);
          BuildStr(i+1,Ndx,Fat);
          if(inchr(Fat,"$")==0 ){
              strcat(Fat,"$");
            }
          if(inchr(Mat,"$")==0 ){
              strcat(Mat,"$");
            }
          strcpy(LTmp, join(5,"=remove$(",Fat,",",Mat,")"));
          FastLexer(Fat," ()","");
          strcpy(LTmp, join(2,Stk[Ndx],LTmp));
          PreParse(LTmp);
          TokenSubstitutions(1);
          Function_Main_Support();
          Ndx=0;
          if (LTmp) {free(LTmp);}
          return;
        }
      if(strcmp(Keyword,"replace")==0){
          if(Ndx<6 ){
              Abort("Problem with REPLACE statement");
            }
          int W;
          int I;
          char VV[BCXSTRSIZE];
          char RR[BCXSTRSIZE];
          char WW[BCXSTRSIZE];
          for(W=2; W<=Ndx; W++)
            {
              if(m_iMatchWrd(Stk[W],"with")){
                  *Stk[W]=0;
                  goto L1216;
                }
            }
L1216:;
          for(I=2; I<=Ndx; I++)
            {
              if(m_iMatchWrd(Stk[I],"in")){
                  *Stk[I]=0;
                  goto L1217;
                }
            }
L1217:;
          if(I<W||W==0 ){
              Abort("Malformed REPLACE statement");
            }
          BuildStr(I+1,Ndx,VV);
          BuildStr(2,W,RR);
          BuildStr(W+1,I,WW);
          if(inchr(VV,"$")==0 ){
              strcat(VV,"$");
            }
          if(inchr(RR,"$")==0 ){
              strcat(RR,"$");
            }
          if(inchr(WW,"$")==0 ){
              strcat(WW,"$");
            }
          strcpy(LTmp, join(8,VV,"=replace$(",VV,",",RR,",",WW,")"));
          PreParse(LTmp);
          TokenSubstitutions(1);
          Function_Main_Support();
          Ndx=0;
        }
      if (LTmp) {free(LTmp);}
      return;
    }
  if (LTmp) {free(LTmp);}
}

UDT_VARINFO_STORAGE* FindVarInfo (char* szToken,int* varid)
{
  int  i;
  i=CheckLocal(szToken,&(*varid));
  if(i!=vt_UNKNOWN ){
      return &(LocalVars[(*varid)]);
    }
  else if(CheckGlobal(szToken,&(*varid))!=vt_UNKNOWN ){
      return &(GlobalVars[(*varid)]);
    }
  else
    {
      return NULL;
    }
}

int LookupVarType (char* szToken,PINT  pVarid)
{
  int  i;
  i=CheckLocal(szToken,pVarid);
  if(i==vt_UNKNOWN ){
      i=CheckGlobal(szToken,pVarid);
    }
  return i;
}

int GetNextVarType (int iLoc)
{
  int  vt1;
  int  cvt1;
  int  Tmp;
  int  k;
  cvt1=CheckType(Stk[iLoc]);
  if(cvt1==0 ){
      vt1=DataType(Stk[iLoc]);
    }
  else
    {
      if(cvt1==vt_UDT||cvt1==vt_STRUCT ){
          if(*Stk[iLoc+1]==91 ){
              for(Tmp=iLoc+2,k=1; Tmp<=Ndx && k; Tmp++)
                {
                  if(*Stk[Tmp]==91 ){
                      k++;
                    }
                  if(*Stk[Tmp]==93 ){
                      k--;
                    }
                }
              vt1=DataType(Stk[Tmp]);
            }
          else
            {
              vt1=DataType(Stk[iLoc+1]);
            }
        }
      else
        {
          if(cvt1==vt_CHAR||cvt1==vt_SCHAR ){
              int  varid;
              struct _UDT_VARINFO_STORAGE*  vi;
              vi=FindVarInfo(Stk[iLoc],&(varid));
              if(vi ){
                  cvt1=Cint(iif(*(vi->VarDim),vt_STRVAR,DataType(Stk[iLoc])));
                }
              else
                {
                  cvt1=DataType(Stk[iLoc]);
                }
            }
          vt1=cvt1;
        }
    }
  return vt1;
}

int GetPrevVarType (int iLoc,int iEarly)
{
  int  vt;
  int  Tmp;
  int  k;
  if(strcmp(Stk[iLoc],")")==0  || strcmp(Stk[iLoc],"]")==0){
      for(Tmp=iLoc-1,k=1; Tmp>=iEarly && k; Tmp--)
        {
          if(*Stk[Tmp]==41 ){
              k++;
            }
          if(*Stk[Tmp]==93 ){
              k++;
            }
          if(*Stk[Tmp]==40 ){
              k--;
            }
          if(*Stk[Tmp]==91 ){
              k--;
            }
        }
      vt=DataType(Stk[Tmp]);
    }
  else
    {
      vt=DataType(Stk[iLoc]);
      if(vt==vt_INTEGER ){
          vt=CheckType(Stk[iLoc]);
        }
      if(vt==vt_CHAR||vt==vt_SCHAR ){
          int  varid;
          struct _UDT_VARINFO_STORAGE*  vi;
          vi=FindVarInfo(Stk[iLoc],&(varid));
          if(vi&&*(vi->VarDim)){
              vt=vt_STRVAR;
            }
        }
    }
  return vt;
}

int LocateJoiner (int iStart)
{
  while(iStart<Ndx){
      if((strcmp(Stk[iStart],"&")==0)  || ((strcmp(Stk[iStart],"+")==0)  && (strcmp(Stk[iStart+1],"+")!=0))){
          return iStart;
        }
      iStart++;
    }
  return 0;
}

int JoinStrTest (int iStart,int iEarly)
{
  int Plus2Amp;
  int vtLeft;
  int vtRight;
  int iJoiner;
  int iDoJoin;
  iDoJoin=0;
  Plus2Amp=iMatchNQ(Stk[iStart++],"&");
  iJoiner=LocateJoiner(iStart);
  if(iJoiner==0 ){
      return iDoJoin;
    }
  vtLeft=GetPrevVarType(iJoiner-1,iEarly);
  vtRight=GetNextVarType(iJoiner+1);
  if(vtLeft==vt_STRVAR||vtLeft==vt_STRLIT||vtLeft==vt_PSTR||vtLeft==vt_PSTRPTR||vtLeft==vt_PCHAR ){
      vtLeft=1;
    }
  else
    {
      vtLeft=0;
    }
  if(vtRight==vt_STRVAR||vtRight==vt_STRLIT||vtRight==vt_PSTR||vtRight==vt_PSTRPTR||vtRight==vt_PCHAR ){
      vtRight=1;
    }
  else
    {
      vtRight=0;
    }
  if(vtLeft&&vtRight ){
      strcpy(Stk[iJoiner],"&");
      Plus2Amp=TRUE;
      iEarly=iJoiner+1;
    }
  iStart=iJoiner+1;
  if(iStart<Ndx ){
      iDoJoin=JoinStrTest(iStart,iEarly)|Plus2Amp;
    }
  else
    {
      iDoJoin=Plus2Amp;
    }
  return iDoJoin;
}

void TransformOperator  (char* OpName,char* Subname)
{
  if(HasThisToken(OpName)==FALSE ){
      return;
    }
  int B={0};
  int Insert1={0};
  int Insert2={0};
  for(int i=1; i<=Ndx-1; i++)
    {
      if(strcmp(Stk[i],"-")==0){
          int IS_Unary=FALSE;
          if(i==1 ){
              IS_Unary=TRUE;
            }
          else
            {
              char Prev[BCXSTRSIZE];
              strcpy(Prev,Stk[i-1]);
              if(strcmp(Prev,"=")==0  || strcmp(Prev,"(")==0  || strcmp(Prev,",")==0  || strcmp(Prev,"^")==0  || strcmp(Prev,"*")==0  || strcmp(Prev,"/")==0  || strcmp(Prev,"+")==0  || strcmp(Prev,"-")==0){
                  IS_Unary=TRUE;
                }
            }
          if(IS_Unary ){
              strcpy(Stk[i], join(2,"-",Stk[i+1]));
              *Stk[i+1]=0;
              LShiftStk(i+1);
              i--;
            }
        }
    }
  for(int i=Ndx; i>=1; i+=-1)
    {
      if(bcx_stricmp(Stk[i],"MOD")==0){
          strcpy(Stk[i],"mod");
        }
      if(bcx_stricmp(Stk[i],"IMOD")==0){
          strcpy(Stk[i],"imod");
        }
      int ProcessThis=FALSE;
      if(strcmp(OpName,"^")==0  && strcmp(Stk[i],"^")==0  && strcmp(Stk[i+1],"=")!=0){
          ProcessThis=TRUE;
        }
      if(strcmp(OpName,"mod")==0  && strcmp(Stk[i],"mod")==0  && strcmp(Stk[i+1],"(")!=0  && strcmp(Stk[i-1],"=")!=0){
          ProcessThis=TRUE;
        }
      if(strcmp(OpName,"imod")==0  && strcmp(Stk[i],"imod")==0  && strcmp(Stk[i+1],"(")!=0  && strcmp(Stk[i-1],"=")!=0){
          ProcessThis=TRUE;
        }
      if(!ProcessThis ){
          continue;
        }
      Insert1=i-1;
      B=0;
      while(strcmp(Stk[Insert1],"=")!=0){
          if(*Stk[Insert1]==93||*Stk[Insert1]==41 ){
              B++;
            }
          if(*Stk[Insert1]==91||*Stk[Insert1]==40 ){
              B--;
            }
          if(B==0 ){
              goto L1225;
            }
          Insert1--;
        }
L1225:;
      if(*Stk[Insert1]==91 ){
          Insert1--;
        }
      if(*Stk[Insert1]==61 ){
          Insert1++;
        }
      if(*Stk[Insert1]==40 ){
          B=DataType(Stk[Insert1-1]);
          if(B==vt_INTEGER||B==vt_SINGLE||B==vt_DOUBLE ){
              if(ISFALSE(m_iMatchWrd(Stk[Insert1-1],"print"))){
                  Insert1--;
                }
            }
        }
      Insert1--;
      strcpy(Stk[i],",");
      Insert2=i+1;
      B=DataType(Stk[Insert2]);
      if(B==vt_INTEGER||B==vt_SINGLE||B==vt_DOUBLE ){
          if(*Stk[Insert2+1]==40||*Stk[Insert2+1]==91 ){
              Insert2++;
            }
        }
      B=0;
      while(Insert2<=Ndx){
          if(*Stk[Insert2]==91||*Stk[Insert2]==40 ){
              B++;
            }
          if(*Stk[Insert2]==93||*Stk[Insert2]==41 ){
              B--;
            }
          if(B==0 ){
              goto L1226;
            }
          Insert2++;
        }
L1226:;
      InsertTokens(Insert2,1,")");
      InsertTokens(Insert1,2,Subname,"(");
    }
  for(int i=1; i<=Ndx; i++)
    {
      if(bcx_stricmp(Stk[i],"-MOD")==0){
          strcpy(Stk[i],"-fmod");
        }
      if(bcx_stricmp(Stk[i],"-IMOD")==0){
          strcpy(Stk[i],"-imod");
        }
    }
}

void FixUps ()
{
  int  A={0};
  int  B={0};
  int  i={0};
  int  j={0};
  int  CommaCnt={0};
  int  AmpCnt={0};
  char  LTmp[BCXSTRSIZE]={0};
  char  LStk1[BCXSTRSIZE]={0};
  char  LStk2[BCXSTRSIZE]={0};
  char  Var1[BCXSTRSIZE]={0};
  PassOne=FALSE;
  if(!m_iMatchWrd(Stk[1],"function")){
      if(JoinStrTest(1,1)){
          int k;
          int temp;
          j=0;
          k=0;
          AmpCnt=0;
          for(temp=1; temp<Ndx && (j==0||k==0); temp++)
            {
              if(strcmp(Stk[temp],"&")==0){
                  A=GetNextVarType(temp+1);
                  if(A==vt_STRVAR||A==vt_STRLIT ){
                      AmpCnt++;
                      if(ISZERO(k)){
                          k=temp;
                        }
                    }
                }
              else
                {
                  A=LookupVarType(Stk[temp],&(i));
                  if(A==vt_STRUCT||A==vt_UDT||A==vt_UNION ){
                      j=1;
                    }
                }
            }
          if(AmpCnt>1 ){
              Use_Join=Use_BcxTempStr=TRUE;
            }
          if(k ){
              if(j ){
                  AsmUnknownStructs(0);
                }
              JoinStrings(1,0);
              BuildDelimStr(1,Ndx,Src);
              PreParse(Src);
            }
        }
    }
  if(UseCpp ){
      if(iMatchNQ(Src,"->lpVtbl")){
          for(int tt=1; tt<=Ndx; tt++)
            {
              if(m_iMatchRgt(Stk[tt],"->lpVtbl")){
                  strcpy(Stk[tt],extract(Stk[tt],"->lpVtbl"));
                  if((strcmp(Stk[tt+3],Stk[tt-1])==0  || strcmp(Stk[tt+3],Stk[tt])==0)  && strcmp(Stk[tt+3],")")!=0){
                      *Stk[tt+3]=0;
                      if(strcmp(Stk[tt+4],",")==0){
                          *Stk[tt+4]=0;
                        }
                    }
                }
            }
          RemEmptyTokens();
        }
    }
  if(InTypeDef ){
      for(int tt=1; tt<=Ndx; tt++)
        {
          if(bcx_stricmp(Stk[tt],"PSTR")==0){
              strcpy(Stk[tt],"PTCHAR");
            }
        }
      for(int tt=1; tt<=Ndx; tt++)
        {
          if(bcx_stricmp(Stk[tt],"PCHAR")==0){
              strcpy(Stk[tt],"PTCHAR");
            }
        }
      for(int tt=1; tt<=Ndx-1; tt++)
        {
          if(bcx_stricmp(Stk[tt],"CHAR")==0  &&  bcx_stricmp(Stk[tt+1],"PTR")==0){
              strcpy(Stk[tt],"PTCHAR");
              LShiftStk(tt+1);
            }
        }
    }
  TransformOperator("^","pow");
  TransformOperator("mod","mod");
  TransformOperator("imod","imod");
  TokenSubstitutions(1);
  if(Ndx==0 ){
      return;
    }
  if(Ndx==3&&ISZERO(WithCnt)){
      if(*Stk[2]==43&&*Stk[3]==43 ){
          fprintf(FP_WRITE,"%s%s%s\n",Scoot,No_Sigil(Stk[1]),"++;");
          Ndx=0;
          Statements++;
          return;
        }
      if(*Stk[2]==45&&*Stk[3]==45 ){
          fprintf(FP_WRITE,"%s%s%s\n",Scoot,No_Sigil(Stk[1]),"--;");
          Ndx=0;
          Statements++;
          return;
        }
      if(*Stk[1]==43&&*Stk[2]==43 ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"++",No_Sigil(Stk[3]),";");
          Ndx=0;
          Statements++;
          return;
        }
      if(*Stk[1]==45&&*Stk[2]==45 ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"--",No_Sigil(Stk[3]),";");
          Ndx=0;
          Statements++;
          return;
        }
    }
  IsCallBack=0;
  if(m_iMatchWrd(Stk[Ndx],"callback")){
      IsCallBack=1;
      *Stk[Ndx--]=0;
    }
  Transforms();
  if(Ndx==0 ){
      return;
    }
  if(m_iMatchWrd(Stk[1],"function")||m_iMatchWrd(Stk[1],"impfunction")){
      if(m_iMatchWrd(Stk[Ndx-2],"as") && strcmp(Stk[Ndx],")")!=0){
          if(ISFALSE(m_iMatchWrd(Stk[Ndx],"export"))&&ISFALSE(m_iMatchWrd(Stk[Ndx],"stdcall"))){
              strcpy(Stk[Ndx-1], join(3,Stk[Ndx-1],SPC,Stk[Ndx]));
              Ndx--;
            }
        }
    }
  int iP=1;
  if(m_iMatchLft(Stk[1],"public")||m_iMatchLft(Stk[1],"private")){
      iP++;
    }
  if(m_iMatchWrd(Stk[iP],"function")||m_iMatchWrd(Stk[iP],"sub")){
      int offset;
      int LastBrk=Ndx-2;
      for(i=Ndx; i>=3; i+=-1)
        {
          if(*Stk[i]==41 ){
              LastBrk=i;
              goto L1233;
            }
        }
L1233:;
        {
        int  jjj;
        for(i=3,jjj=1; i<=LastBrk && jjj; i++)
          {
            offset=2;
            jjj=m_GetAsPosF(i,LastBrk);
            if(jjj ){
                i=jjj;
                if((i<LastBrk) && strcmp(Stk[i+offset],"=")!=0){
                    if(m_iMatchWrd(Stk[i+1],"function")){
                        offset=3;
                      }
                    if(ISFALSE(inchr(Stk[i+offset],")"))&&ISFALSE(inchr(Stk[i+offset],","))){
                        if(NOTZERO((int)strlen(Stk[i+offset]))&&ISFALSE(m_iMatchWrd(Stk[i+3],"as"))){
                            strcpy(Stk[i+offset-1], join(3,Stk[i+offset-1],SPC,Stk[i+offset]));
                            *Stk[i+offset]=0;
                          }
                      }
                  }
              }
          }
          }
    }
  if(ISFALSE(m_iMatchWrd(Stk[1],"declare"))){
      for(i=1; i<=Ndx; i++)
        {
          if(m_iMatchWrd(Stk[i],"lib")){
              if(strcmp(Stk[i-1],"(")==0  && (DataType(Stk[i+1])==vt_STRLIT||DataType(Stk[i+1])==vt_STRVAR)){
                  j=GetNumArgs(i+2);
                  strcpy(LTmp,"BCX_DynaCallB");
                  if(ISFALSE(m_iMatchWrd(Stk[1],"print"))){
                      if(DataType(Stk[i-2])==vt_STRVAR||DataType(Stk[1])==vt_STRVAR ){
                          strcpy(LTmp, join(2,"(char*)",LTmp));
                        }
                    }
                  strcpy(Var1,right(Stk[i-2],1));
                  if(inchr(c_VARTYPES,Var1)){
                      strcat(LTmp,Var1);
                      strcpy(Stk[i],enc(left(Stk[i-2],(int)strlen(Stk[i-2])-1)));
                    }
                  else
                    {
                      strcpy(Stk[i],enc(Stk[i-2]));
                    }
                  strcpy(Stk[i-2],LTmp);
                  for(B=Ndx+3; B>=i+3; B+=-1)
                    {
                      strcpy(Stk[B],Stk[B-3]);
                    }
                  strcpy(Stk[i+2],Stk[i+1]);
                  strcpy(Stk[i+1],",");
                  strcpy(Stk[i+3],",");
                  strcpy(Stk[i+4],str(j,1));
                  strcpy(Stk[i+5],sziif(j,",",")"));
                  Ndx+=(3);
                  Use_DynacallCommon=Use_Dynacall=Use_BcxTempStr=Use_Proto=TRUE;
                }
            }
        }
    }
  strcpy(LStk1,lcase(Stk[1]));
  strcpy(LStk2,lcase(Stk[2]));
  if(strcmp(LStk1,"open")==0){
      for(A=2; A<=Ndx; A++)
        {
          if(m_iMatchWrd(Stk[A],"binary")){
              goto L1237;
            }
        }
L1237:;
      if(A==Ndx ){
          return;
        }
      if(A<Ndx ){
          A++;
          strcpy(Var1,lcase(Stk[A]));
          if(strcmp(Var1,"new")==0){
              strcpy(Stk[A-1],"binarynew");
              LShiftStk(A);
              return;
            }
          if(strcmp(Var1,"append")==0){
              strcpy(Stk[A-1],"binaryappend");
              LShiftStk(A);
              return;
            }
          if(strcmp(Var1,"input")==0){
              strcpy(Stk[A-1],"binaryinput");
              LShiftStk(A);
              return;
            }
          if(strcmp(Var1,"output")==0){
              strcpy(Stk[A-1],"binaryoutput");
              LShiftStk(A);
              return;
            }
        }
    }
  if(strcmp(LStk1,"option")==0){
      if(strcmp(LStk2,"base")==0){
          OptionBase=m_IVAL(Stk[3]);
          Ndx=0;
          return;
        }
    }
  if(strcmp(LStk1,"dim")==0){
      strcpy(LTmp,enc(LStk2,(UCHAR)*(SPC)));
      if(iMatchNQ(" shared , dynamic , raw , local , auto , register , static ",LTmp)){
          strcpy(Stk[1],LStk2);
          strcpy(LStk1,LStk2);
          LShiftStk(2);
        }
      return;
    }
  if(strcmp(LStk1,"public")==0){
      if(strcmp(LStk2,"function")==0  || strcmp(LStk2,"sub")==0){
          if(InClass ){
              strcat(LStk1,LStk2);
              strcpy(Stk[1],LStk1);
            }
          else
            {
              strcpy(Stk[1],LStk2);
            }
          LShiftStk(2);
        }
      return;
    }
  if(strcmp(LStk1,"private")==0){
      if(strcmp(LStk2,"function")==0  || strcmp(LStk2,"sub")==0){
          if(InClass ){
              strcat(LStk1,LStk2);
              strcpy(Stk[1],LStk1);
            }
          else
            {
              Use_Static=TRUE;
              strcpy(Stk[1],LStk2);
            }
          LShiftStk(2);
        }
      return;
    }
  if(strcmp(LStk1,"onexit")==0){
      if(strcmp(LStk2,"sub")==0){
          Use_ExitCode=Use_Proto=TRUE;
          if(c_MaxExitSub==++ExitNdx ){
              Abort("Maximum number of exit calls exceeded.");
            }
          strcpy(ExitSub[ExitNdx],Stk[3]);
          strcpy(Stk[1],LStk2);
          strcpy(LStk1,LStk2);
          LShiftStk(2);
        }
      return;
    }
  if(strcmp(LStk1,"onstart")==0){
      if(strcmp(LStk2,"sub")==0){
          Use_StartupCode=Use_Proto=TRUE;
          if(c_MaxStartSub==++StartNdx ){
              Abort("Maximum number of startup calls exceeded.");
            }
          strcpy(StartSub[StartNdx],Stk[3]);
          strcpy(Stk[1],LStk2);
          strcpy(LStk1,LStk2);
          LShiftStk(2);
          return;
        }
      Abort("ONSTART syntax error, can only be used with a SUB.");
    }
  if(strcmp(LStk1,"overloaded")==0){
      if(strcmp(LStk2,"function")==0){
          strcpy(Stk[1],"overloadedfunction");
          strcpy(LStk1,"overloadedfunction");
          LShiftStk(2);
          if(strcmp(Stk[2],"=")!=0){
              OkayToSend=TRUE;
            }
          return;
        }
      if(strcmp(LStk2,"sub")==0){
          strcpy(Stk[1],"overloadedsub");
          LShiftStk(2);
          return;
        }
    }
  if(strcmp(LStk1,"function")==0){
      if(m_iMatchWrd(Stk[3],"optional")){
          strcpy(Stk[1],"optfunction");
          strcpy(LStk1,"optfunction");
          LShiftStk(3);
          if(strcmp(Stk[2],"=")!=0){
              OkayToSend=TRUE;
            }
          return;
        }
    }
  if(UseCpp==FALSE ){
      if(strcmp(LStk1,"function")==0){
          if(strcmp(Stk[2],"=")!=0){
              for(int ij=3; ij<=Ndx; ij++)
                {
                  if(strcmp(Stk[ij],"=")==0){
                      strcpy(Stk[1],"optfunction");
                      strcpy(LStk1,"optfunction");
                      OkayToSend=TRUE;
                      return;
                    }
                }
            }
        }
    }
  if(strcmp(LStk1,"sub")==0){
      if(m_iMatchWrd(Stk[3],"optional")){
          strcpy(LStk1,"optsub");
          strcpy(Stk[1],"optsub");
          LShiftStk(3);
          return;
        }
    }
  if(UseCpp==FALSE ){
      if(strcmp(LStk1,"sub")==0){
          for(int ij=2; ij<=Ndx; ij++)
            {
              if(strcmp(Stk[ij],"=")==0){
                  strcpy(Stk[1],"optsub");
                  strcpy(LStk1,"optsub");
                  return;
                }
            }
        }
    }
  if(strcmp(LStk1,"end")==0){
      if(strcmp(Stk[2],"=")!=0){
          strcpy(Stk[1], join(2,LStk1,LStk2));
          if(Ndx==2 ){
              Ndx=1;
              return;
            }
          else
            {
              if(m_iMatchWrd(Stk[3],"as")){
                  *Stk[2]=0;
                  RemEmptyTokens();
                  return;
                }
            }
        }
    }
  if(strcmp(LStk1,"function")==0){
      if(strcmp(Stk[2],"=")!=0){
          OkayToSend=TRUE;
        }
    }
  if(strcmp(LStk1,"midstr")==0){
      if(inchr(Stk[3],DQ)){
          Abort("MID$ statement string argument cannot be a literal");
        }
      CommaCnt=0;
      for(i=1; i<=Ndx; i++)
        {
          if(*Stk[i]==44 ){
              CommaCnt++;
            }
          else if(strcmp(Stk[i],"=")==0){
              if(CommaCnt<2 ){
                  strcpy(Stk[i],"-1,");
                }
              else
                {
                  *Stk[i]=0;
                }
              strcpy(Stk[i-1],",");
              Ndx++;
              strcpy(Stk[Ndx],")");
              goto L1240;
            }
        }
L1240:;
    }
  if(strcmp(LStk1,"endevents")==0  || strcmp(LStk1,"endmdievents")==0  || strcmp(LStk1,"endmdichildevents")==0){
      char szError[BCXSTRSIZE];
      if(Use_Vscroll||Use_Hscroll ){
          Use_Max=Use_Min=TRUE;
          strcpy(Src,"GLOBAL BCX_siX AS SCROLLINFO");
          Inject(Src);
          strcpy(Src,"GLOBAL BCX_siY AS SCROLLINFO");
          Inject(Src);
          strcpy(Src,"GLOBAL BCX_DynaScroll AS INT");
          Inject(Src);
          fprintf(FP_WRITE,"%s %d %s\n","static  int BCX_ViewWidth =",(int)Use_Hscroll,";");
          fprintf(FP_WRITE,"%s %d %s\n","static  int BCX_ViewHeight =",(int)Use_Vscroll,";");
          fprintf(FP_WRITE,"%s\n","static  int BCX_SmallChangeX;");
          fprintf(FP_WRITE,"%s\n","static  int BCX_SmallChangeY;");
          fprintf(FP_WRITE,"%s\n","static  int BCX_LargeChangeX;");
          fprintf(FP_WRITE,"%s\n","static  int BCX_LargeChangeY;");
          fprintf(FP_WRITE,"%s\n","static  int BCX_ScrollInit;");
          fprintf(FP_WRITE,"%s\n","");
          fprintf(FP_WRITE,"%s\n","  if(!BCX_ScrollInit)");
          fprintf(FP_WRITE,"%s\n","   {");
          fprintf(FP_WRITE,"%s\n","     BCX_siY.cbSize=sizeof(BCX_siY);");
          fprintf(FP_WRITE,"%s\n","     BCX_siX.cbSize=sizeof(BCX_siX);");
          fprintf(FP_WRITE,"%s\n","     BCX_siY.fMask=SIF_ALL;");
          fprintf(FP_WRITE,"%s\n","     BCX_siX.fMask=SIF_ALL;");
          fprintf(FP_WRITE,"%s\n","     BCX_siX.nMax=BCX_ViewWidth;");
          fprintf(FP_WRITE,"%s\n","     BCX_siY.nMax=BCX_ViewHeight;");
          fprintf(FP_WRITE,"%s\n","     BCX_SmallChangeX=1;");
          fprintf(FP_WRITE,"%s\n","     BCX_LargeChangeX=20;");
          fprintf(FP_WRITE,"%s\n","     BCX_SmallChangeY=1;");
          fprintf(FP_WRITE,"%s\n","     BCX_LargeChangeY=20;");
          fprintf(FP_WRITE,"%s\n","     BCX_siY.nPage=1;");
          fprintf(FP_WRITE,"%s\n","     BCX_siX.nPage=1;");
          fprintf(FP_WRITE,"%s\n","     SetScrollInfo(hWnd,SB_VERT,&BCX_siY,TRUE);");
          fprintf(FP_WRITE,"%s\n","     SetScrollInfo(hWnd,SB_HORZ,&BCX_siX,TRUE);");
          fprintf(FP_WRITE,"%s\n","     BCX_DynaScroll=TRUE;");
          fprintf(FP_WRITE,"%s\n","     BCX_ScrollInit=TRUE;");
          fprintf(FP_WRITE,"%s\n","   }");
          fprintf(FP_WRITE,"%s\n"," if(Msg==WM_HSCROLL||Msg==WM_VSCROLL||Msg==WM_SIZE)");
          fprintf(FP_WRITE,"%s\n","   {");
          fprintf(FP_WRITE,"%s\n","     BCX_Scroll(hWnd,Msg,wParam,lParam,BCX_LargeChangeX,");
          fprintf(FP_WRITE,"%s\n","     BCX_LargeChangeY,BCX_SmallChangeX,BCX_SmallChangeY,");
          fprintf(FP_WRITE,"%s\n","     BCX_ViewWidth,BCX_ViewHeight,BCX_DynaScroll);");
          fprintf(FP_WRITE,"%s\n","   }");
        }
      if(ISFALSE(Use_BCX_Class_Info)){
          Use_BCX_Class_Info=TRUE;
          iEmitVarGroup=iEmitVarGroup|(eFontGroup|eClassName);
        }
      if(strcmp(LStk1,"endmdichildevents")!=0  && Use_MainEvent ){
          Use_MainEvent=FALSE;
          fprintf(FP_WRITE,"%s\n","  if(Msg==WM_DESTROY)");
          fprintf(FP_WRITE,"%s\n","    {");
          fprintf(FP_WRITE,"%s\n","       OleUninitialize();");
          fprintf(FP_WRITE,"%s\n","       CoUninitialize();");
          fprintf(FP_WRITE,"%s\n","       PostQuitMessage(0);");
          fprintf(FP_WRITE,"%s\n","       return EXIT_SUCCESS;");
          fprintf(FP_WRITE,"%s\n","    }");
        }
      if(strcmp(LStk1,"endevents")==0){
          fprintf(FP_WRITE,"%s\n","Bcx_RetVal = DefWindowProc(hWnd,Msg,wParam,lParam);");
          fprintf(FP_WRITE,"%s\n","return Bcx_RetVal; // endevents");
        }
      else if(strcmp(LStk1,"endmdievents")==0){
          fprintf(FP_WRITE,"%s\n","Bcx_RetVal = DefFrameProc(hWnd,BCX_hwndMDIClient,Msg,wParam,lParam);");
          fprintf(FP_WRITE,"%s\n","return Bcx_RetVal;");
        }
      else if(strcmp(LStk1,"endmdichildevents")==0){
          fprintf(FP_WRITE,"%s\n","Bcx_RetVal = DefMDIChildProc(hWnd,Msg,wParam,lParam);");
          fprintf(FP_WRITE,"%s\n","return Bcx_RetVal;");
        }
      fprintf(FP_WRITE,"%s\n","}\n\n");
      sprintf(szError,"Too many unindents for END %s",ucase(LStk1+3));
      BumpDown(szError);
      if(Indent ){
          printf("%s\n",repeat(80,"_"));
          printf("%s%s\n","Possible missing END IF before END ",ucase(mid(LStk1,4)));
          printf("%s\n",repeat(80,"_"));
        }
      Ndx=0;
      InFunction=FALSE;
      return;
    }
  if(strcmp(Stk[2],":")==0){
      if(Ndx==2 ){
          strcpy(LTmp,enc(LStk1,(UCHAR)*(SPC)));
          if(iMatchNQ(" public , private , protected ",LTmp)==0 ){
              strcpy(Stk[1], join(2,ucase(Stk[1]),":"));
              Ndx=1;
            }
          return;
        }
    }
  if(m_iMatchWrd(Stk[3],"createwindow")){
      Comma=0;
      for(A=4; A<=Ndx; A++)
        {
          if(strcmp(Stk[A],",")==0){
              Comma++;
            }
          if(strcmp(Stk[A],",")==0){
              if(Comma==8 ){
                  strcpy(Stk[A],",(HMENU)(UINT_PTR)");
                  Comma++;
                }
            }
        }
    }
  if(m_iMatchWrd(Stk[3],"createwindowex")){
      Comma=0;
      for(A=4; A<=Ndx; A++)
        {
          if(strcmp(Stk[A],",")==0){
              Comma++;
            }
          if(strcmp(Stk[A],",")==0){
              if(Comma==9 ){
                  strcpy(Stk[A],",(HMENU)(UINT_PTR)");
                  Comma++;
                }
            }
        }
    }
  if(*Stk[Ndx]==42 ){
      strcpy(Stk[Ndx-1], join(2,Stk[Ndx-1],"*"));
      Ndx--;
    }
  if(m_iMatchWrd(Stk[3],"setwindowlong")||m_iMatchWrd(Stk[3],"setwindowlongptr")){
      Comma=0;
      strcpy(Stk[3],"(WNDPROC)(LONG_PTR)SetWindowLongPtr");
      for(A=4; A<=Ndx; A++)
        {
          if(strcmp(Stk[A],",")==0){
              Comma++;
            }
          if(strcmp(Stk[A],",")==0){
              if(Comma==2 ){
                  strcpy(Stk[A],",(LONG_PTR)");
                  Comma++;
                }
            }
        }
      return;
    }
  if(TestState==TRUE ){
      char Tmp[BCXSTRSIZE]={0};
      if(LastCmd==0 ){
          if(*Stk[1]==42 ){
              strcpy(Tmp,No_Sigil(Stk[2]));
            }
          else
            {
              strcpy(Tmp,No_Sigil(Stk[1]));
            }
          if(LeftStr(Tmp,"*")){
              strcpy(Tmp,mid(Tmp,2));
            }
          i=inchr(Tmp,".");
          if(i==0 ){
              i=iMatchNQ(Tmp,"->");
            }
          if(i>0 ){
              if(WithCnt ){
                  strcpy(Tmp,WithVar[WithCnt]);
                }
              else
                {
                  strcpy(Tmp,left(Tmp,i-1));
                }
            }
          if(inchr(Tmp,"[")){
              strcpy(Tmp,extract(Tmp,"["));
            }
          if(FindVarInfo(Tmp,&(j))==NULL ){
              strcpy(Tmp,lcase(Tmp));
              if(strcmp(Stk[2],"=")==0  && IsAllowedContext(Tmp)&&iMatchNQ(Src,"->")==0 ){
                  Warning(join(6,"Assignment before Declaration in Line ",str(LineNum[FileNdx])," in Module: ",trim(FileNames[FileNdx]),": ",Src));
                }
            }
        }
    }
}

int IsAllowedContext (char* Tmp)
{
  if(strcmp(Tmp,"functionreturn")==0){
      return FALSE;
    }
  if(strcmp(Tmp,"bcx_retstr")==0){
      return FALSE;
    }
  if(strcmp(Tmp,"end")==0){
      return FALSE;
    }
  return TRUE;
}

void RemEmptyTokens ()
{
  int i;
  int j;
  for(i=1; i<=Ndx; i++)
    {
      if(ISNULL(Stk[i])){
          j=i;
          while(ISNULL(Stk[j])&&(j<Ndx)){
              j++;
            }
          if(ISNULL(Stk[j])){
              goto L1244;
            }
          strcpy(Stk[i],Stk[j]);
          *Stk[j]=0;
        }
    }
L1244:;
  Ndx=i-1;
}

void FuncSubDecs1 (char* s,int iStart,int iEnd,UDT_VARCODE_ATTRIBUTES*  ptVar)
{
  int iBrktPairLoc;
  int iEmpty;
  if(m_iMatchRgt(Stk[iStart],s)){
      if(DataType(Stk[iStart+1])==vt_STRVAR ){
          Abort(join(3,"Invalid ",s," name"));
        }
    }
  for(iEmpty=FALSE,iBrktPairLoc=m_GetBrkPairPos(iStart,iEnd); iBrktPairLoc; iBrktPairLoc=m_GetBrkPairPos(iBrktPairLoc,iEnd))
    {
      int iVarLoc=iBrktPairLoc-1;
      if(m_iMatchWrd(Stk[iBrktPairLoc+2],"as")){
          strcpy(Stk[iBrktPairLoc+3], join(2,Stk[iBrktPairLoc+3],"*"));
          *Stk[iBrktPairLoc++]=0;
          *Stk[iBrktPairLoc]=0;
          iEmpty=TRUE;
        }
      else if(strcmp(Stk[iBrktPairLoc+2],"[")==0){
          while(iBrktPairLoc<=iEnd){
              if(m_iMatchWrd(Stk[iBrktPairLoc],"as")){
                  goto L1247;
                }
              if(m_iMatchRgt(Stk[iVarLoc],"]")&&inchr(",)=",Stk[iBrktPairLoc])){
                  goto L1247;
                }
              strcpy(Stk[iVarLoc], join(2,Stk[iVarLoc],Stk[iBrktPairLoc]));
              *Stk[iBrktPairLoc++]=0;
              iEmpty=TRUE;
            }
L1247:;
        }
      else
        {
          int iDataType=DataType(Stk[iVarLoc]);
          strcpy(Stk[iVarLoc],No_Sigil(Stk[iVarLoc]));
          if(iDataType==vt_STRVAR ){
              InsertTokens(iBrktPairLoc+1,5,"[","BCXSTRSIZE","]","as","char");
              iEnd+=(5);
            }
          else
            {
              strcpy(Stk[iBrktPairLoc++],"as");
              strcpy(Stk[iBrktPairLoc], join(2,GetVarTypeName(iDataType),"*"));
            }
        }
    }
  if(m_iMatchWrd(Stk[iEnd],"export")){
      Ndx--;
      ptVar->IsExported=TRUE;
      if(UseStdCall ){
          strcpy(CallType,"__stdcall ");
        }
      else
        {
          strcpy(CallType,"__cdecl ");
        }
    }
  if(iEmpty ){
      RemEmptyTokens();
    }
}

void FuncSubDecs2 (char* s,int methd,UDT_VARCODE_ATTRIBUTES*  VarCode,int iFirstToken,int* iLastToken)
{
  if(m_iMatchRgt(Stk[iFirstToken],s)){
      if(m_iMatchWrd(Stk[*iLastToken-1],"as")){
          Abort(join(2,"Attempted type assignment to ",s));
        }
      VarCode->IsPtrFlag=0;
      CurrentFuncType=vt_VOID;
    }
  else
    {
      if(m_iMatchWrd(Stk[(*iLastToken)-1],"as")){
          CurrentFuncType=CheckType(Stk[*iLastToken]);
          strcpy(VarCode->Token,Stk[iFirstToken+1]);
          strcpy(VarCode->AsToken,Stk[*iLastToken]);
          VarCode->IsPtrFlag=tally(Stk[*iLastToken],"*");
          *Stk[(*iLastToken)--]=0;
          *Stk[(*iLastToken)--]=0;
        }
      else
        {
          if(Ctor_Dtor_Detected(1)){
              CurrentFuncType=vt_CONSTRDESTR;
            }
          else
            {
              CurrentFuncType=DataType(Stk[iFirstToken+1]);
            }
          strcpy(VarCode->Token,Stk[iFirstToken+1]);
          VarCode->IsPtrFlag=tally(Stk[iFirstToken+1],"*");
          *VarCode->AsToken=0;
        }
    }
  strcpy(VarCode->Proto," (");
  strcpy(VarCode->Header," (");
  *VarCode->Functype=0;
  VarCode->Methd=methd;
  VarCode->VarNo=CurrentFuncType;
  GetVarCode(VarCode,"FuncSubDecs2");
}

void FuncSubDecs3 (UDT_VARCODE_ATTRIBUTES*  varcode,int iLast,int iExtended)
{
  if(*Stk[iLast-1]==46 ){
      strcpy(Stk[iLast-1],"...");
    }
  strcpy(varcode->Header,rtrim(varcode->Header));
  strcat(varcode->Header,")");
  if(UseCpp==FALSE ){
      strcpy(varcode->Header,replace(varcode->Header,"()","(void)"));
    }
  if(iExtended ){
      strcpy(varcode->Header, join(5,varcode->Functype,"(*",varcode->Token,")",varcode->Header));
    }
  else
    {
      strcpy(varcode->Header, join(3,varcode->Functype,varcode->Token,varcode->Header));
    }
  if(varcode->Methd==2 ){
      strcpy(varcode->Proto,rtrim(varcode->Proto));
      if(m_iMatchRgt(varcode->Proto,",")){
          midstr(varcode->Proto,(int)strlen(varcode->Proto),-1,")");
        }
      else
        {
          strcat(varcode->Proto,")");
        }
      strcpy(varcode->Proto,replace(varcode->Proto,"()","(void)"));
      if(iExtended ){
          strcpy(varcode->Proto, join(3,varcode->Functype,"(*)",varcode->Proto));
        }
      else
        {
          strcpy(varcode->Proto, join(4,varcode->Functype,varcode->Token,varcode->Proto,";"));
        }
    }
  if(varcode->UseInLine ){
      strcpy(varcode->Header, join(2,"inline ",varcode->Header));
      strcpy(varcode->Proto, join(2,"inline ",varcode->Proto));
    }
  UseInLine=FALSE;
  if(varcode->IsExported ){
      UseImportExport=TRUE;
      strcpy(varcode->Proto, join(2,"C_EXPORT ",varcode->Proto));
      strcpy(varcode->Header, join(2,"C_EXPORT ",varcode->Header));
    }
  strcpy(varcode->Proto,replace(varcode->Proto," . ","."));
  strcpy(varcode->Header,replace(varcode->Header," . ","."));
}

void AddTypeDefs (char* sTypeDefName,int TDef)
{
  TypeDefsCnt++;
  if(TypeDefsCnt==c_MaxTypes ){
      Abort("Exceeded TYPE Limits.");
    }
  strcpy(TypeDefs[TypeDefsCnt].VarName,sTypeDefName);
  TypeDefs[TypeDefsCnt].TypeofDef=TDef;
  TypeDefs[TypeDefsCnt].EleCnt=0;
}

int CheckTypeDefs (char *ParmStr)
{
  if(TypeDefsCnt>0 ){
      for(int i=1; i<=TypeDefsCnt; i++)
        {
          if(strcmp(ParmStr,TypeDefs[i].VarName)==0){
              return i;
            }
        }
    }
  return 0;
}

void GetTypeInfo (char* szArg,int* IsPointer,int* UdtIdx,int* vtCode)
{
  char Var1[BCXSTRSIZE];
  (*IsPointer)=tally(szArg,"*");
  strcpy(Var1,trim(RemoveStr(szArg,"*")));
  if(RightStr(Var1,"_CLASS")){
      strcpy(Var1,left(Var1,(int)strlen(Var1)-6));
    }
  (*vtCode)=CheckType(Var1);
  if((*vtCode)==vt_UNKNOWN ){
      AddTypeDefs(Var1,vt_UDT);
      (*vtCode)=vt_UDT;
    }
  (*UdtIdx)=0;
  if((*vtCode)==vt_STRUCT||(*vtCode)==vt_UNION||(*vtCode)==vt_UDT ){
      (*UdtIdx)=CheckTypeDefs(Var1);
    }
}

void AddTypedefElement (int WorkingTypeDefsCnt,int ElType,char* EName,char* EType,int EPtr)
{
  struct _UDT_USER_TYPES_STORAGE*  TD;
  TD=&((TypeDefs[WorkingTypeDefsCnt]));
  if(TD->EleCnt==c_MaxElements ){
      Abort("Exceeded TYPE Element Limits.");
    }
  TD->Elements[TD->EleCnt].ElementType=ElType;
  TD->Elements[TD->EleCnt].ElementDynaPtr=EPtr;
  if(ElType==vt_STRUCT||ElType==vt_UNION||ElType==vt_UDT ){
      TD->Elements[TD->EleCnt].ElementID=CheckTypeDefs(EType);
    }
  else
    {
      TD->Elements[TD->EleCnt].ElementID=0;
    }
  strcpy(TD->Elements[TD->EleCnt].ElementName,EName);
  TD->EleCnt=1+TD->EleCnt;
}

char * GetElement (int StartStk,int* vt,int* dimensions,int id)
{
  char  *BCX_RetStr={0};
  int BC=0;
  int i;
  char LZZ[BCXSTRSIZE];
  for(i=StartStk+1; i<=Ndx; i++)
    {
      if(*Stk[i]==91 ){
          BC++;
        }
      else if(*Stk[i]==93 ){
          BC--;
        }
      else
        {
          if(BC==0 ){
              if(m_iMatchLft(Stk[i],"->")||*Stk[i]==46 ){
                  strcpy(LZZ,Stk[i]);
                  RemoveAll(LZZ,"%$#!@`.->( *)",1);
                  (*vt)=GetElementInfo(&(id),&(*dimensions),LZZ);
                  if((*vt)!=vt_STRUCT&&(*vt)!=vt_UNION ){
                      goto L1249;
                    }
                }
            }
        }
    }
L1249:;
  if((*vt)==vt_UDT||(*vt)==vt_UNION||(*vt)==vt_STRUCT ){
      strcpy(LZZ,TypeDefs[id].VarName);
    }
  else
    {
      strcpy(LZZ,GetVarTypeName(*vt));
    }
  BCX_RetStr = BCX_TempStr(strlen(LZZ));
  strcpy(BCX_RetStr,LZZ);
  return BCX_RetStr;
}

int GetElementInfo (int* DefID,int* EPtr,char* Elename)
{
  int id=(*DefID);
  for(int i=0; i<=TypeDefs[id].EleCnt-1; i++)
    {
      if(strcmp(Elename,TypeDefs[id].Elements[i].ElementName)==0){
          (*DefID)=TypeDefs[id].Elements[i].ElementID;
          (*EPtr)=TypeDefs[id].Elements[i].ElementDynaPtr;
          return TypeDefs[id].Elements[i].ElementType;
        }
    }
  return 0;
}

void Process_Option_Base ()
{
  for(int i=1; i<=Ndx; i++)
    {
      if(m_iMatchWrd(Stk[i],"as")){
          strcpy(Stk[i-1],No_Sigil(Stk[i-1]));
        }
      if(strcmp(Stk[i],"=")==0){
          return;
        }
      if(OptionBase ){
          if(*Stk[i]==91&&*Stk[i+1]==93 ){
              continue;
            }
          if(*Stk[i]==91&&*Stk[i+1]!=93 ){
              if(DataType(Stk[i+1])==vt_NUMBER ){
                  strcpy(Stk[i+1],str(OptionBase+VAL(Stk[i+1]),1));
                }
              else
                {
                  strcpy(Stk[i+1], join(3,str(OptionBase,TRUE),"+",Stk[i+1]));
                }
            }
        }
    }
}

long IsValidName (char *szArg)
{
  long  Valid={0};
  long  Length={0};
  UCHAR  FirstChar={0};
  UCHAR  CurrentChar={0};
  PUCHAR  p={0};
  Valid=TRUE;
  Length=(int)strlen(szArg);
  if(Length==0 ){
      Valid=FALSE;
    }
  else
    {
      if(strcmp(szArg,"&")!=0  && !m_iMatchLft(szArg,"(*")){
          p=(PUCHAR)szArg;
          FirstChar=p[0];
          if(!isalpha(FirstChar)&&FirstChar!=95&&FirstChar<=192 ){
              Valid=FALSE;
            }
          else
            {
              for(long i=1; i<=Length-1; i++)
                {
                  CurrentChar=p[i];
                  if(!isalnum(CurrentChar)&&CurrentChar!=95&&CurrentChar<=127 ){
                      Valid=FALSE;
                    }
                }
            }
        }
    }
  return Valid;
}

void ValidateVarName (char* v)
{
  char LZZ[BCXSTRSIZE];
  if(LeftStr(v," #define  3.14159")){
      Abort("PI is predefined in BCX.  You cannot DIM PI ...");
    }
  if(!isalpha(*v)&&*v!=95&&!((unsigned char)*v>192)){
      if(!m_iMatchLft(v,"(*") && strcmp(v,"&")!=0){
          Abort("Invalid String Variable Name");
        }
    }
  if(RestrictedWords(v)&&TestState ){
      strcpy(LZZ, join(3,"Variable ",v," on line"));
      strcpy(LZZ, join(5,LZZ,str(LineNum[FileNdx])," in Module: ",trim(FileNames[FileNdx])," is a Restricted Word"));
      Warning(LZZ);
    }
}

void PointerFix ()
{
  strcpy(Stk[Ndx-1], join(2,Stk[Ndx-1],Stk[Ndx]));
  *Stk[Ndx]=0;
  Ndx--;
  while(tally(Stk[Ndx],"*")==(int)strlen(Stk[Ndx])){
      strcpy(Stk[Ndx-1], join(2,Stk[Ndx-1],Stk[Ndx]));
      *Stk[Ndx]=0;
      Ndx--;
    }
}

void DimDynaString (char* SVar,int DG,int s)
{
  char DS[BCXSTRSIZE];
  strcpy(DS, join(5,"if (",SVar,") {free(",SVar,");}"));
  if(InFunction&&(IsLocal||IsDim||IsRaw||IsAuto||IsRegister)&&DG==0 ){
      if(c_MaxDynaStr==++LocalDynaCnt ){
          Abort("Maximum number of local dynamic allocations exceeded.");
        }
      strcpy(DynaStr[LocalDynaCnt],DS);
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"char *",SVar,";");
      AddLocal(SVar,vt_CHAR,0,"",1);
    }
  else
    {
      if(Use_GenFree ){
          AddDynamicGlobal(DS);
        }
      if(DG==2 ){
          AddGlobal(SVar,vt_CHAR,0,"",1,0,1);
        }
      else
        {
          if(s ){
              AddGlobal(SVar,vt_CHAR,0,"",1,0,2);
            }
          else
            {
              AddGlobal(SVar,vt_CHAR,0,"",1);
            }
        }
    }
  if(DG!=2 ){
      fprintf(FP_WRITE,"%s%s%s",Scoot,SVar,"=(char*)calloc(");
      Ndx++;
      strcpy(Stk[Ndx],", 1);");
      WriteCleanTokens(4,Ndx);
    }
}

void AddDynamicGlobal (PCHAR szGlobalStr)
{
  GlobalDynaCnt++;
  if(c_MaxGlobalDyna==GlobalDynaCnt ){
      Abort("Maximum number of global dynamic arrays exceeded.");
    }
  strcpy(GlobalDynaStr[GlobalDynaCnt],szGlobalStr);
}

int SubFuncTest ()
{
  if(m_iMatchWrd(Stk[2],"function")||m_iMatchWrd(Stk[2],"sub")){
      return 1;
    }
  return 0;
}

int Ctor_Dtor_Detected (int iTokenLoc)
{
  if(m_iMatchWrd(Stk[iTokenLoc],"constructor")||m_iMatchWrd(Stk[iTokenLoc],"destructor")){
      return 1;
    }
  return 0;
}

int DimSubFunc (int iMethod)
{
  BOOL  bOppFound;
  int Funptr=0;
  int i;
  int id;
  int iEqualLoc;
  char LTmp[BCXSTRSIZE];
  *LTmp=0;
  int StartPoint=3;
  char szInit[BCXSTRSIZE];
  char szIsConst[BCXSTRSIZE];
  char szStatic[BCXSTRSIZE];
  char szV[BCXSTRSIZE];
  char szWrk[BCXSTRSIZE];
  int vt;
  int w;
  struct _UDT_ARG_COMMAS_STORAGE  ACS;
  Clear(ACS);
  if(m_iMatchWrd(Stk[Ndx],"stdcall")){
      strcpy(CallType,"__stdcall ");
      *Stk[Ndx--]=0;
      IsStdFunc=TRUE;
    }
  else
    {
      if(InClass||InCppTypeDef ){
          *CallType=0;
        }
      else
        {
          strcpy(CallType,"__cdecl ");
        }
      IsStdFunc=FALSE;
    }
  if(m_iMatchWrd(Stk[3],"operator")){
      for(i=4,bOppFound=FALSE; !bOppFound; i++)
        {
          if(strcmp(Stk[i],"(")==0){
              if(strcmp(Stk[i+1],")")!=0  && strcmp(Stk[i+2],"(")!=0){
                  bOppFound=TRUE;
                }
              if(strcmp(Stk[i+1],")")==0  && i>4 ){
                  bOppFound=TRUE;
                }
            }
          if(!bOppFound ){
              strcpy(Stk[3], join(2,Stk[3],Stk[i]));
              *Stk[i]=0;
            }
        }
    }
  strcpy(szWrk,No_Sigil(Stk[Ndx]));
  if(*szWrk ){
      GetTypeInfo(szWrk,&(w),&(id),&(vt));
      if(vt==vt_WINBOOL ){
          strcpy(Stk[Ndx],iReplace(Stk[Ndx],"WINBOOL","BOOL"));
        }
    }
  SepFuncArgs(3,&(ACS),TRUE);
  StartPoint=IMAX(ACS.CommaPos[0],3);
  if(!InTypeDef&&!InCppTypeDef&&!InClass ){
      g_SubFuncPtr=TRUE;
      if(ACS.NumArgs==0 ){
          i=IMIN(ACS.CommaPos[1]+1,Ndx);
        }
      else
        {
          i=IMIN(ACS.CommaPos[ACS.NumArgs]+1,Ndx);
        }
      if(strcmp(Stk[i],"=")==0){
          *Stk[i++]=0;
          while(!m_iMatchWrd(Stk[i],"as")&&i<=Ndx){
              strcat(LTmp,Stk[i]);
              *Stk[i++]=0;
            }
          RemoveAll(LTmp,"{}",1);
          if(LTmp[0]!=0 ){
              RemEmptyTokens();
            }
        }
      fprintf(FP_UDT,"%s%s%s\n",Scoot,MakeDecProto(&(ACS)),";");
      g_SubFuncPtr=FALSE;
      Ndx=StartPoint;
      *Stk[2]=0;
      if(LTmp[0]!=0 ){
          strcpy(Stk[Ndx++],"=");
          strcpy(Stk[Ndx++],"{");
          strcpy(Stk[Ndx++],No_Sigil(LTmp));
          strcpy(Stk[Ndx++],"}");
        }
      strcpy(Stk[Ndx++],"as");
      strcpy(Stk[Ndx], join(3,No_Sigil(Stk[3]),"_TYPE",stringx(Funptr,42)));
      RemEmptyTokens();
      return FALSE;
    }
  else
    {
      *szV=0;
      *szWrk=0;
      *szStatic=0;
      *szIsConst=0;
      *szInit=0;
      iEqualLoc=Ndx;
      if(IsVirtual ){
          strcpy(szV,"virtual ");
          IsVirtual=FALSE;
        }
      else
        {
          *szV=0;
        }
      while(strcmp(Stk[iEqualLoc],"=")!=0  && iEqualLoc){
          if(strcmp(Stk[iEqualLoc],")")==0){
              goto L1256;
            }
          iEqualLoc--;
        }
L1256:;
      if(strcmp(Stk[iEqualLoc],"=")==0){
          strcpy(szInit,Stk[iEqualLoc++]);
          strcat(szInit,Stk[iEqualLoc++]);
        }
      if(m_iMatchWrd(Stk[Ndx],"const")){
          strcpy(szIsConst,"const");
        }
      else
        {
          *szIsConst=0;
        }
      if(m_iMatchWrd(Stk[1],"static")){
          strcpy(szStatic,"static ");
        }
      else
        {
          *szStatic=0;
        }
      strcpy(szWrk,MakeDecProto(&(ACS)));
      if(iMethod ){
          strcpy(szWrk,trim(mid(szWrk,inchr(szWrk,SPC))));
        }
      if(strcmp(szVirtual,szInit)==0){
          *szInit=0;
        }
      fprintf(FP_UDT,"%s%s%s%s%s%s%s%s\n",Scoot,szV,szStatic,szWrk,szVirtual,szInit,szIsConst,";");
      *szVirtual=0;
    }
  return TRUE;
}

void InBlockReSet ()
{
  LocalVarCnt=LocalInBlock[InBlock];
  InBlock--;
  if(InBlock<0 ){
      Abort("Too many END BLOCKS");
    }
}

void InBlockSet ()
{
  InBlock++;
  if(InBlock==c_MaxLocalInBlocks ){
      Abort("Too many nested BEGINBLOCK/ENDBLOCKs");
    }
  LocalInBlock[InBlock]=LocalVarCnt;
}

void AddSpace (int i)
{
  if(IsValidName(Stk[i])&&IsValidName(Stk[i+1])){
      strcpy(Stk[i], join(2,Stk[i],SPC));
    }
}

void Display_Version_and_Compiler ()
{
  if(c_BCX_COLORS ){
      color(10,0 );
    }
  printf("%s%s%s\n","Version ",c_VERSION,Compiler_Used());
  PopColors();
}

char * Compiler_Used ()
{
  char  *BCX_RetStr={0};
  char Buff[BCXSTRSIZE];
  strcpy(Buff," Compiled using ");
#if defined __BCPLUSPLUS__ 
  strcat(Buff,"Embarcadero C++");
#elif defined __INTEL_LLVM_COMPILER 
  strcat(Buff,"Intel C++ Compiler");
#elif defined __BORLANDC__ 
  strcat(Buff,"Embarcadero C++");
#elif defined __DMC__ 
  strcat(Buff,"Digital Mars C/C++");
#elif defined __POCC__ 
  strcat(Buff,"Pelles C");
#elif defined __LCC__ 
  strcat(Buff,"Lcc-Win32");
#elif defined __clang__ & __MINGW64__
  strcat(Buff,"LLVM-MinGW64 (");
  strcat(Buff,__VERSION__);
  strcat(Buff,")");
#elif defined __MINGW64__ 
  strcat(Buff,"MinGW64 C++ (");
  strcat(Buff,__VERSION__);
  strcat(Buff,")");
#elif defined __MINGW32__ 
  strcat(Buff,"MinGW32 C++ (");
  strcat(Buff,__VERSION__);
  strcat(Buff,")");
#elif defined __clang__ 
  strcat(Buff,"LLVM-Clang (");
  strcat(Buff,str(__clang_major__,1));
  strcat(Buff,".");
  strcat(Buff,str(__clang_minor__,1));
  strcat(Buff,".");
  strcat(Buff,str(__clang_patchlevel__,1));
  strcat(Buff,")");
#elif defined _MSC_VER 
  strcat(Buff,"MS Visual C++ (");
  strcat(Buff,str(_MSC_FULL_VER,1));
  strcat(Buff,")");
#else
  strcat(Buff,"Unknown Compiler");
#endif
#if defined _WIN64 
  strcat(Buff," for 64-bit Windows");
#else
  strcat(Buff," for 32-bit Windows");
#endif
  BCX_RetStr = BCX_TempStr(strlen(Buff));
  strcpy(BCX_RetStr,Buff);
  return BCX_RetStr;
}

void KillFiles ()
{
  if(DebugModeOff ){
      DeleteFile ((hdrFile));
      DeleteFile ((enuFile));
      DeleteFile ((SysFile));
      DeleteFile ((UsrFile));
      DeleteFile ((udtFile));
      DeleteFile ((setFile));
      DeleteFile ((cppFile));
      DeleteFile ((prcFile));
      DeleteFile ((ovrFile));
      DeleteFile ((datFile));
      DeleteFile ((resFile));
    }
}

void Abort (char* AbortStr)
{
  int  i={0};
  int  j={0};
  int  k={0};
  char t[BCXSTRSIZE]={0};
  int varnum={0};
  char frmt[BCXSTRSIZE]={0};
  *WarnMsg=0;
  if(LeftStr(AbortSrc,"$BCXVERSION")){
      strcat(WarnMsg,AbortStr);
    }
  else
    {
      strcpy(WarnMsg, join(4,WarnMsg,AbortStr," at line",str(LineNum[FileNdx])));
      strcpy(WarnMsg, join(4,WarnMsg," in Module: ",trim(FileNames[FileNdx]),CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,"Original line",CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,AbortSrc,CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,"==============",CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,"Current Tokens",CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,"==============",CRLF));
      for(k=1; k<=Ndx; k++)
        {
          j=(int)strlen(Stk[k]);
          if(j<40 ){
              j=40-j;
            }
          else
            {
              j=8-imod(j,8);
            }
          strcpy(frmt,lpad(str(k),3));
          strcpy(WarnMsg, join(6,WarnMsg,frmt,SPC,Stk[k],stringx(j,32),CRLF));
          strcpy(t,No_Sigil(Stk[k]));
          i=CheckLocal(t,&(varnum));
          if(i!=vt_UNKNOWN ){
              strcpy(WarnMsg,trim(WarnMsg));
              strcpy(WarnMsg, join(3,WarnMsg," is a LOCAL defined at line",str(LocalVars[varnum].VarLine)));
              strcpy(WarnMsg, join(4,WarnMsg," in Module: ",LocalVars[varnum].VarModule,CRLF));
            }
          else
            {
              i=CheckGlobal(t,&(varnum));
              if(i!=vt_UNKNOWN ){
                  strcpy(WarnMsg,trim(WarnMsg));
                  strcpy(WarnMsg, join(3,WarnMsg," is a GLOBAL defined at line",str(GlobalVars[varnum].VarLine)));
                  strcpy(WarnMsg, join(3,WarnMsg," in Module: ",GlobalVars[varnum].VarModule));
                  strcpy(WarnMsg, join(5,WarnMsg,SPC,Stk[k],GlobalVars[varnum].VarDim," as "));
                  if(GlobalVars[varnum].VarDef ){
                      strcpy(WarnMsg, join(3,WarnMsg,trim(TypeDefs[GlobalVars[varnum].VarDef].VarName),CRLF));
                    }
                  else
                    {
                      strcpy(WarnMsg, join(3,WarnMsg,trim(GetVarTypeName(GlobalVars[varnum].VarType)),CRLF));
                    }
                }
              else
                {
                  if(*Stk[k]==c_DblQt ){
                      strcpy(WarnMsg,trim(WarnMsg));
                      strcpy(WarnMsg, join(3,WarnMsg," is a string literal",CRLF));
                    }
                }
            }
        }
      strcpy(WarnMsg, join(3,WarnMsg,"===============",CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,"Original Tokens",CRLF));
      strcpy(WarnMsg, join(3,WarnMsg,"===============",CRLF));
      PreParse(AbortSrc);
      for(k=1; k<=Ndx; k++)
        {
          j=(int)strlen(Stk[k]);
          if(j<40 ){
              j=40-j;
            }
          else
            {
              j=8-imod(j,8);
            }
          strcpy(frmt,lpad(str(k),3));
          strcpy(WarnMsg, join(6,WarnMsg,frmt,SPC,Stk[k],stringx(j,32),CRLF));
          strcpy(t,No_Sigil(Stk[k]));
          i=CheckLocal(t,&(varnum));
          if(i!=vt_UNKNOWN ){
              strcpy(WarnMsg,trim(WarnMsg));
              strcpy(WarnMsg, join(3,WarnMsg," is a LOCAL defined at line",str(LocalVars[varnum].VarLine)));
              strcpy(WarnMsg, join(4,WarnMsg," in Module: ",LocalVars[varnum].VarModule,CRLF));
            }
          else
            {
              i=CheckGlobal(t,&(varnum));
              if(i!=vt_UNKNOWN ){
                  strcpy(WarnMsg,trim(WarnMsg));
                  strcpy(WarnMsg, join(3,WarnMsg," is a GLOBAL defined at line",str(GlobalVars[varnum].VarLine)));
                  strcpy(WarnMsg, join(3,WarnMsg," in Module: ",GlobalVars[varnum].VarModule));
                  strcpy(WarnMsg, join(5,WarnMsg,SPC,Stk[k],GlobalVars[varnum].VarDim," as "));
                  if(GlobalVars[varnum].VarDef ){
                      strcpy(WarnMsg, join(3,WarnMsg,TypeDefs[GlobalVars[varnum].VarDef].VarName,CRLF));
                    }
                  else
                    {
                      strcpy(WarnMsg, join(3,WarnMsg,GetVarTypeName(GlobalVars[varnum].VarType),CRLF));
                    }
                }
              else
                {
                  if(*Stk[k]==c_DblQt ){
                      strcpy(WarnMsg,trim(WarnMsg));
                      strcpy(WarnMsg, join(3,WarnMsg," is a string literal",CRLF));
                    }
                }
            }
        }
    }
  strcat(WarnMsg,CRLF);
  CloseAll();
  KillFiles();
  DeleteFile (("$WRK$.TXT"));
  DeleteFile ((FileOut));
  DeleteFile (("$t$e$m$p"));
  if(ErrFile ){
      if((fpErr=fopen(FileErr, "a"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileErr); exit(1);
       }
      fprintf(fpErr,"%s%s %d %s%s\n",AbortStr," at line",(int)LineNum[FileNdx]," in Module: ",trim(FileNames[FileNdx]));
      if(fpErr)
       {
         fclose(fpErr);
         fpErr=NULL;
       }
    }
  if(InfoBoxWarn ){
      InfoBox("Warnings! :",WarnMsg,GetSystemMetrics(SM_CXSCREEN)/4,GetSystemMetrics(SM_CYSCREEN)/4);
    }
  else
    {
      printf("%s%s%s%s%s\n","Error!",CRLF,FileIn,CRLF,WarnMsg);
    }
  fflush(stdout);
  ExitProcess(1);
}

void BumpDown (char* szErr)
{
  Indent-=(2);
  if(Indent<0 ){
      if(ISNULL(szErr)){
          Abort("Unknown Error");
        }
      else
        {
          Abort(szErr);
        }
    }
  strcpy(Scoot,space(Indent));
}

void BumpUp ()
{
  if(Indent<0 ){
      Indent=0;
    }
  Indent+=(2);
  strcpy(Scoot,space(Indent));
}

PCHAR FixBrackets (char* SrcCode,int l)
{
  PCHAR  s;
  s=SrcCode;
  if(l==0 ){
      for(;;)
        {
          if(*s==0 ){
              goto L1260;
            }
          if(*s==c_DblQt ){
              s++;
              while(*s!=c_DblQt){
                  if(*s==0 ){
                      goto L1261;
                    }
                  s++;
                }
L1261:;
            }
          if(*s==c_LtBkt ){
              s++;
              s=FixBrackets(s,1);
            }
          if(*s==c_LPar ){
              s++;
              s=FixBrackets(s,2);
            }
          s++;
        }
L1260:;
      goto L1259;
    }
  if(l==1 ){
      while(*s!=c_RtBkt){
          if(*s==c_DblQt ){
              s++;
              while(*s!=c_DblQt){
                  if(*s==0 ){
                      goto L1263;
                    }
                  s++;
                }
L1263:;
            }
          if(*s==c_LtBkt ){
              s++;
              s=FixBrackets(s,1);
            }
          if(*s==c_LPar ){
              s++;
              s=FixBrackets(s,2);
            }
          if(*s==0 ){
              goto L1262;
            }
          if(*s==c_Comma ){
              *s=1;
            }
          s++;
        }
L1262:;
      goto L1259;
    }
  if(l==2 ){
      while(*s!=c_RPar){
          if(*s==c_DblQt ){
              s++;
              while(*s!=c_DblQt){
                  if(*s==0 ){
                      goto L1265;
                    }
                  s++;
                }
L1265:;
            }
          if(*s==c_LtBkt ){
              s++;
              s=FixBrackets(s,1);
            }
          if(*s==c_LPar ){
              s++;
              s=FixBrackets(s,2);
            }
          if(*s==0 ){
              goto L1264;
            }
          s++;
        }
L1264:;
    }

L1259:;

  if(l==0 ){
      strcpy(SrcCode,replace(SrcCode,vchr(1,1),"]["));
      return SrcCode;
    }
  return s;
}

void PushSelectState (char* SelState)
{
  StateIdx++;
  if(c_MaxNestedSelects==StateIdx ){
      Abort("Maximum nested SELECT/END SELECT reached.");
    }
  strcpy(SelectState[StateIdx].CaseStk,SelState);
}

void PopSelectState (char* SelState)
{
  strcpy(SelState,SelectState[--StateIdx].CaseStk);
}

void Commandline_Defines (FILE* FP_OUTPUT)
{
  if(CmdLineConst[0]!=0 ){
      FILE*  Ftmp;
      char LTmp1[BCXSTRSIZE];
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// ***************************************************");
      fprintf(FP_OUTPUT,"%s\n","//                 Command line Defines");
      fprintf(FP_OUTPUT,"%s\n","// ***************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      Ftmp=FP_CST;
      FP_CST=FP_OUTPUT;
      for(int i=1; i<=tally(CmdLineConst,vchr(1,1)); i++)
        {
          strcpy(LTmp1,StrToken(CmdLineConst,vchr(1,1),i));
          if(ISNULL(LTmp1)){
              goto L1266;
            }
          strcpy(LTmp1, join(2,"MACRO ",LTmp1));
          Inject(LTmp1);
        }
L1266:;
      FP_CST=Ftmp;
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// ***************************************************");
      fprintf(FP_OUTPUT,"%s\n","//              End of Command Line Defines");
      fprintf(FP_OUTPUT,"%s\n","// ***************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
}

void Emit_UserDirectives (FILE* FP_OUTPUT)
{
  if(Exist(hdrFile)){
      char LTmp1[BCXSTRSIZE];
      FILE*  LFP1;
      if((LFP1=fopen(hdrFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", hdrFile); exit(1);
       }
      while(!EoF(LFP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , LFP1);
            if(feof(LFP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(LFP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          fprintf(FP_OUTPUT,"%s\n",LTmp1);
        }
      if(LFP1)
       {
         fclose(LFP1);
         LFP1=NULL;
       }
    }
}

void User_Global_Enum_Blocks (FILE* FP_OUTPUT)
{
  char LTmp1[BCXSTRSIZE];
  FILE*  LFP1;
  if(Exist(enuFile)&&lof(enuFile)>2 ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n","//          Application GLOBAL Enumerations");
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      if((LFP1=fopen(enuFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", enuFile); exit(1);
       }
      while(!EoF(LFP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , LFP1);
            if(feof(LFP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(LFP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          fprintf(FP_OUTPUT,"%s\n",LTmp1);
        }
      if(LFP1)
       {
         fclose(LFP1);
         LFP1=NULL;
       }
    }
}

void System_Defined_Constants (FILE* FP_OUTPUT)
{
  if(Exist(SysFile)&&lof(SysFile)>2 ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n","//               System Defined Macros");
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      if(NO_VKKEYS==FALSE&&ZapFlag==FALSE ){
          fprintf(FP_OUTPUT,"%s\n","#ifndef    VK_0");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_0  0x30");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_1  0x31");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_2  0x32");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_3  0x33");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_4  0x34");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_5  0x35");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_6  0x36");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_7  0x37");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_8  0x38");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_9  0x39");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_A  0x41");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_B  0x42");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_C  0x43");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_D  0x44");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_E  0x45");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_F  0x46");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_G  0x47");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_H  0x48");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_I  0x49");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_J  0x4A");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_K  0x4B");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_L  0x4C");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_M  0x4D");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_N  0x4E");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_O  0x4F");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_P  0x50");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_Q  0x51");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_R  0x52");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_S  0x53");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_T  0x54");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_U  0x55");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_V  0x56");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_W  0x57");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_X  0x58");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_Y  0x59");
          fprintf(FP_OUTPUT,"%s\n","   #define VK_Z  0x5A");
          fprintf(FP_OUTPUT,"%s\n","#endif ");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      char private_Tmp[BCXSTRSIZE];
      FILE*  private_FP1;
      if((private_FP1=fopen(SysFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", SysFile); exit(1);
       }
      while(!EoF(private_FP1)){
          private_Tmp[0]=0;
          fgets(private_Tmp, 2048 , private_FP1);
            if(feof(private_FP1) || (private_Tmp[strlen(private_Tmp)-1]==10))
              {
               private_Tmp[strcspn(private_Tmp,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(private_FP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",private_Tmp);
                exit(1);
              }
          strcpy(private_Tmp,trim(private_Tmp));
          if(private_Tmp[0]!=0 ){
              fprintf(FP_OUTPUT,"%s\n",private_Tmp);
            }
        }
      if(private_FP1)
       {
         fclose(private_FP1);
         private_FP1=NULL;
       }
    }
}

void User_Defined_Constants (FILE* FP_OUTPUT)
{
  char LTmp1[BCXSTRSIZE];
  FILE*  LFP1;
  int Flagged={0};
  if(Exist(UsrFile)&&lof(UsrFile)){
      if((LFP1=fopen(UsrFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", UsrFile); exit(1);
       }
      while(!EoF(LFP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , LFP1);
            if(feof(LFP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(LFP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          if(!Flagged&&(int)strlen(rtrim(LTmp1))>7 ){
              Flagged=TRUE;
              fprintf(FP_OUTPUT,"%s\n",SPC);
              fprintf(FP_OUTPUT,"%s\n","// *************************************************");
              fprintf(FP_OUTPUT,"%s\n","//            Application Defined Macros");
              fprintf(FP_OUTPUT,"%s\n","// *************************************************");
            }
          fprintf(FP_OUTPUT,"%s\n",ltrim(LTmp1));
        }
      if(LFP1)
       {
         fclose(LFP1);
         LFP1=NULL;
       }
    }
}

void User_Defined_Types_And_Unions (FILE* FP_OUTPUT)
{
  char LTmp1[BCXSTRSIZE];
  FILE*  LFP1;
  if(Exist(udtFile)&&lof(udtFile)>2 ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n","//       Application Defined Types And Unions");
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      if((LFP1=fopen(udtFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", udtFile); exit(1);
       }
      while(!EoF(LFP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , LFP1);
            if(feof(LFP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(LFP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          fprintf(FP_OUTPUT,"%s\n",LTmp1);
        }
      if(LFP1)
       {
         fclose(LFP1);
         LFP1=NULL;
       }
    }
}

void User_Data_Statements (FILE* FP_OUTPUT)
{
  char LTmp1[BCXSTRSIZE];
  FILE*  LFP1;
  if(lof(datFile)>0 ){
      if((LFP1=fopen(datFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", datFile); exit(1);
       }
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n","//           Application Data Statements");
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","char * DATA[] =");
      fprintf(FP_OUTPUT,"%s\n","{");
      while(!EoF(LFP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , LFP1);
            if(feof(LFP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(LFP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          fprintf(FP_OUTPUT,"%s",LTmp1);
          if(!EoF(LFP1)){
              fprintf(FP_OUTPUT,"%s\n",",");
            }
        }
      if(LFP1)
       {
         fclose(LFP1);
         LFP1=NULL;
       }
      fprintf(FP_OUTPUT,"%s\n","\n};");
    }
}

void User_Global_Variables (FILE* FP_OUTPUT)
{
  int i;
  char VarName[BCXSTRSIZE];
  char Storage[BCXSTRSIZE];
  char VarDim[BCXSTRSIZE];
  int A;
  char P[BCXSTRSIZE];
  if(GlobalVarCnt||DllCnt ){
      fprintf(FP_W,"%s\n","");
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s%s\n","//          ",c_BCX_STR_USR_VARS);
      fprintf(FP_W,"%s\n","// *************************************************");
      fprintf(FP_W,"%s\n","");
    }
  if(DllCnt ){
      for(int iii=1; iii<=DllCnt; iii++)
        {
          fprintf(FP_W,"%s%s%s%s%s\n","static BCXFPROT",str(iii,1),SPC,extract(DllDecl[iii],"="),";");
        }
    }
  for(i=1; i<=GlobalVarCnt; i++)
    {
      if(GlobalVars[i].VarEmitFlag ){
          continue;
        }
      if(strcmp("",GlobalVars[i].VarDim)==0  && GlobalVars[i].VarCondLevel==0 ){
          *P=0;
          if(GlobalVars[i].VarPntr ){
              strcpy(P,stringx(GlobalVars[i].VarPntr,42));
            }
          A=GlobalVars[i].VarType;
          if(GlobalVars[i].VarSF ){
              strcpy(VarName, join(3,"(*",GlobalVars[i].VarName,")"));
            }
          else
            {
              strcpy(VarName,GlobalVars[i].VarName);
            }
          strcpy(Storage, join(2,VarStorage[GlobalVars[i].VarExtn],VarConst[GlobalVars[i].VarConstant]));
          strcpy(VarDim,GlobalVars[i].VarDim);
          Emit_Global(FP_OUTPUT,A,i,Storage,P,VarName,VarDim);
        }
    }
  for(i=1; i<=GlobalVarCnt; i++)
    {
      if(GlobalVars[i].VarEmitFlag ){
          continue;
        }
      if(strcmp("",GlobalVars[i].VarDim)!=0  && GlobalVars[i].VarCondLevel==0 ){
          if(inchr(GlobalVars[i].VarDim,"{")==0 ){
              *P=0;
              if(GlobalVars[i].VarPntr ){
                  strcpy(P,stringx(GlobalVars[i].VarPntr,42));
                }
              A=GlobalVars[i].VarType;
              if(GlobalVars[i].VarSF ){
                  strcpy(VarName, join(4,"(*",GlobalVars[i].VarName,extract(GlobalVars[i].VarDim,"("),")"));
                  strcpy(VarDim,mid(GlobalVars[i].VarDim,inchr(GlobalVars[i].VarDim,"(")));
                }
              else
                {
                  strcpy(VarName,GlobalVars[i].VarName);
                  strcpy(VarDim,GlobalVars[i].VarDim);
                }
              strcpy(Storage, join(2,VarStorage[GlobalVars[i].VarExtn],VarConst[GlobalVars[i].VarConstant]));
              Emit_Global(FP_OUTPUT,A,i,Storage,P,VarName,VarDim);
            }
        }
    }
  char LastDef[BCXSTRSIZE];
  *LastDef=0;
  int LastLevel=1;
  for(i=1; i<=GlobalVarCnt; i++)
    {
      if(GlobalVars[i].VarEmitFlag ){
          continue;
        }
      if(GlobalVars[i].VarCondLevel ){
          if(ISNULL(LastDef)){
              strcpy(LastDef,GlobalVars[i].VarCondDef);
              LastLevel=GlobalVars[i].VarCondLevel;
              fprintf(FP_OUTPUT,"%s\n",LastDef);
            }
          if(strcmp(LastDef,GlobalVars[i].VarCondDef)!=0){
              if(strcmp(GlobalVars[i].VarCondDef,"#else")==0){
                  while(LastLevel>GlobalVars[i].VarCondLevel){
                      fprintf(FP_OUTPUT,"%s\n","#endif");
                      LastLevel--;
                    }
                  fprintf(FP_OUTPUT,"%s\n","#else");
                  strcpy(LastDef,GlobalVars[i].VarCondDef);
                }
              else
                {
                  while(LastLevel>=GlobalVars[i].VarCondLevel){
                      fprintf(FP_OUTPUT,"%s\n","#endif");
                      LastLevel--;
                    }
                  strcpy(LastDef,GlobalVars[i].VarCondDef);
                  LastLevel=GlobalVars[i].VarCondLevel;
                  fprintf(FP_OUTPUT,"%s\n",LastDef);
                }
            }
          *P=0;
          if(GlobalVars[i].VarPntr ){
              strcpy(P,stringx(GlobalVars[i].VarPntr,42));
            }
          A=GlobalVars[i].VarType;
          if(GlobalVars[i].VarSF ){
              strcpy(VarName, join(3,"(*",GlobalVars[i].VarName,")"));
            }
          else
            {
              strcpy(VarName,GlobalVars[i].VarName);
            }
          strcpy(VarDim,GlobalVars[i].VarDim);
          strcpy(Storage, join(2,VarStorage[GlobalVars[i].VarExtn],VarConst[GlobalVars[i].VarConstant]));
          Emit_Global(FP_OUTPUT,A,i,Storage,P,VarName,VarDim);
        }
    }
  if(*LastDef ){
      while(LastLevel){
          fprintf(FP_OUTPUT,"%s\n","#endif");
          LastLevel--;
        }
    }
}

int GetNumArgs (int Strt,int* NdxPos)
{
  int CountR=0;
  int CountS=0;
  int i=0;
  int j=0;
  int k=1;
  for(i=Strt; i<=Ndx; i++)
    {
      if(*Stk[i]==40 ){
          CountR++;
          k++;
          goto L1281;
        }
      if(*Stk[i]==41 ){
          CountR--;
          k--;
          if(k==0 ){
              goto L1280;
            }
          goto L1281;
        }
      if(*Stk[i]==91 ){
          CountS++;
          goto L1281;
        }
      if(*Stk[i]==93 ){
          CountS--;
          goto L1281;
        }
      if(*Stk[i]==44 ){
          if(CountR==0&&CountS==0 ){
              j++;
              if(NdxPos ){
                  *NdxPos=i;
                }
            }
        }

L1281:;

    }
L1280:;
  return j;
}

void GetVarCode (UDT_VARCODE_ATTRIBUTES*  varcode,PCHAR szWhere)
{
  UNREFERENCED_PARAMETER(szWhere);
  char CB[BCXSTRSIZE];
  char PT[BCXSTRSIZE];
  char PTH[BCXSTRSIZE];
  char VAR[BCXSTRSIZE];
  int vn;
  char RF[BCXSTRSIZE];
  BOOL  bRemoveSplat;
  if(varcode->Methd==mt_ConsDesNoParam||varcode->Methd==mt_FuncSubDecC_DecNoParam||varcode->Methd==mt_OverLoadNoParam ){
      strcat(varcode->Proto,varcode->Token);
      strcat(varcode->Header,varcode->Token);
      return;
    }
  if(varcode->Methd==mt_OptsNoParam ){
      strcat(varcode->Proto,varcode->Token);
      if(strcmp(varcode->Token,",")==0  || InClass || strcmp(varcode->Token,"...")==0){
          strcat(varcode->Header,varcode->Token);
        }
      return;
    }
  if(IsCallBack ){
      strcpy(CB,"CALLBACK ");
    }
  else
    {
      *CB=0;
    }
  if(varcode->Methd==mt_ConsDesAParam ){
      int iSplat=inchr(varcode->AsToken,"*");
      int iLT=inchr(varcode->AsToken,"<");
      int iGT=inchr(varcode->AsToken,">");
      if(iSplat>iLT&&iSplat<iGT ){
          bRemoveSplat=FALSE;
        }
      else
        {
          bRemoveSplat=TRUE;
        }
    }
  else
    {
      bRemoveSplat=TRUE;
    }
  if(((inchr(varcode->Token,"*")||inchr(varcode->AsToken,"*"))&&bRemoveSplat)||varcode->IsPtrFlag ){
      RemoveAll(varcode->Token,"*");
      RemoveAll(varcode->AsToken,"*");
      strcpy(PT, join(2,stringx(varcode->IsPtrFlag,42),SPC));
      strcpy(PTH,PT);
    }
  else
    {
      strcpy(PTH,SPC);
      *PT=0;
    }
  if(inchr(varcode->Token,"&")){
      strcpy(RF," &");
    }
  else
    {
      *RF=0;
    }
  vn=varcode->VarNo;
  strcpy(VAR,GetVarTypeName(vn));
  char pszHead[BCXSTRSIZE];
  char pszProto[BCXSTRSIZE];
  strcpy(pszHead,No_Sigil(varcode->Token));
  strcpy(pszProto,pszHead);
  if(inchr(pszProto,"[")){
      strcpy(pszProto,mid(pszProto,inchr(pszProto,"[")));
    }
  else
    {
      *pszProto=0;
    }
  if(vn==vt_STRVAR ){
      if(varcode->Methd==mt_ProcessSetCommand ){
          strcpy(varcode->StaticOut, join(2,"static char   ",pszHead));
          goto L1283;
        }
      if(varcode->Methd==mt_FuncSubDecC_Dec ){
          strcpy(varcode->Functype, join(2,"char * ",CB));
          goto L1283;
        }
      if(varcode->Methd==mt_FuncSubDecC_DecAParam ){
          if(!inchr(varcode->Token,"[")){
              strcpy(varcode->Header, join(3,varcode->Header,"char *",pszHead));
              strcat(varcode->Proto,"char *");
            }
          else
            {
              strcpy(varcode->Header, join(3,varcode->Header,"char ",RemoveStr(pszHead,"*")));
              strcat(varcode->Proto,"char[][BCXSTRSIZE]");
            }
          goto L1283;
        }
      if(varcode->Methd==mt_Opts ){
          strcpy(varcode->Functype,"char *");
          goto L1283;
        }
      if(varcode->Methd==mt_ConsDesAParam ){
          strcpy(varcode->Header, join(3,varcode->Header,"char *",pszHead));
          strcpy(varcode->Proto, join(3,varcode->Proto,"char *",pszHead));
          goto L1283;
        }
      if(varcode->Methd==mt_OptsAParam ){
          strcpy(varcode->Header, join(3,varcode->Header,"char *",pszHead));
          strcat(varcode->Proto,"char *");
          goto L1283;
        }
      if(varcode->Methd==mt_OverLoad ){
          strcpy(varcode->Functype,"char *");
          goto L1283;
        }
      if(varcode->Methd==mt_OverLoadAParam ){
          strcpy(varcode->Header, join(3,varcode->Header,"char *",pszHead));
        }

L1283:;

      goto L1282;
    }
  if(vn==vt_BOOL||vn==vt_BYTE||vn==vt_COLORREF||vn==vt_DOUBLE||vn==vt_DWORD||vn==vt_FARPROC||vn==vt_HDC||vn==vt_HANDLE||vn==vt_HINSTANCE||vn==vt_HWND||vn==vt_HBITMAP||vn==vt_INTEGER||vn==vt_PCHAR||vn==vt_LONG||vn==vt_PBYTE||vn==vt_LRESULT||vn==vt_SHORT||vn==vt_SINGLE||vn==vt_UINT||vn==vt_ULONG||vn==vt_USHORT||vn==vt_SAFEARRAY||vn==vt_VARIANT||vn==vt_VOID||vn==vt_LDOUBLE||vn==vt_SSHORT||vn==vt_SCHAR||vn==vt_DWORD||vn==vt_WORD||vn==vt_WINBOOL||vn==vt_BSTR ){
      if(varcode->Methd==mt_ProcessSetCommand ){
          strcpy(varcode->StaticOut, join(4,"static ",VAR,SPC,pszHead));
          goto L1284;
        }
      if(varcode->Methd==mt_FuncSubDecC_Dec ){
          strcpy(varcode->Functype, join(3,VAR,PTH,CB));
          goto L1284;
        }
      if(varcode->Methd==mt_FuncSubDecC_DecAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,VAR,RF,PT));
          goto L1284;
        }
      if(varcode->Methd==mt_Opts ){
          strcpy(varcode->Functype, join(2,VAR,PTH));
          goto L1284;
        }
      if(varcode->Methd==mt_OptsAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,VAR,RF,PT));
          goto L1284;
        }
      if(varcode->Methd==mt_ConsDesAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,VAR,PTH,pszHead));
          goto L1284;
        }
      if(varcode->Methd==mt_OverLoad ){
          strcpy(varcode->Functype, join(2,VAR,SPC));
          goto L1284;
        }
      if(varcode->Methd==mt_OverLoadAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
        }

L1284:;

      goto L1282;
    }
  if(vn==vt_FILEPTR ){
      if(varcode->Methd==mt_FuncSubDecC_Dec ){
          strcpy(varcode->Functype, join(3,VAR,PTH,CB));
          goto L1285;
        }
      if(varcode->Methd==mt_FuncSubDecC_DecAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          if(inchr(varcode->Token,"[")){
              strcpy(varcode->Proto, join(5,varcode->Proto,VAR,PT,SPC,pszHead));
            }
          else
            {
              strcpy(varcode->Proto, join(3,varcode->Proto,VAR,PT));
            }
          goto L1285;
        }
      if(varcode->Methd==mt_Opts ){
          strcpy(varcode->Functype, join(2,VAR,PTH));
          goto L1285;
        }
      if(varcode->Methd==mt_OptsAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(3,varcode->Proto,VAR,PT));
          goto L1285;
        }
      if(varcode->Methd==mt_ConsDesAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,VAR,PTH,pszHead));
          goto L1285;
        }
      if(varcode->Methd==mt_OverLoad ){
          strcpy(varcode->Functype, join(2,VAR,SPC));
          goto L1285;
        }
      if(varcode->Methd==mt_OverLoadAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
        }

L1285:;

      goto L1282;
    }
  if(vn==vt_CHAR||vn==vt_SCHAR ){
      if(varcode->Methd==mt_FuncSubDecC_Dec ){
          strcpy(varcode->Functype, join(3,VAR,PTH,CB));
          goto L1286;
        }
      if(varcode->Methd==mt_FuncSubDecC_DecAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(5,varcode->Proto,VAR,PT,SPC,pszProto));
          goto L1286;
        }
      if(varcode->Methd==mt_Opts ){
          strcpy(varcode->Functype, join(2,VAR,PTH));
          goto L1286;
        }
      if(varcode->Methd==mt_OptsAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(5,varcode->Proto,VAR,PT,SPC,pszProto));
          goto L1286;
        }
      if(varcode->Methd==mt_ConsDesAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
          strcpy(varcode->Proto, join(5,varcode->Proto,VAR,PTH,SPC,pszProto));
          goto L1286;
        }
      if(varcode->Methd==mt_OverLoad ){
          strcpy(varcode->Functype, join(2,VAR,SPC));
          goto L1286;
        }
      if(varcode->Methd==mt_OverLoadAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,VAR,PTH,pszHead));
        }

L1286:;

      goto L1282;
    }
  if(vn==vt_UDT||vn==vt_STRUCT||vn==vt_UNION ){
      if(varcode->Methd==mt_ProcessSetCommand ){
          if(vn==vt_UNION ){
              strcpy(varcode->StaticOut, join(2,"static union  ",pszHead));
            }
          else
            {
              strcpy(varcode->StaticOut, join(3,"static struct _",pszHead,SPC));
            }
          goto L1287;
        }
      if(varcode->Methd==mt_FuncSubDecC_Dec ){
          strcpy(varcode->Functype, join(3,varcode->AsToken,PTH,CB));
          goto L1287;
        }
      if(varcode->Methd==mt_FuncSubDecC_DecAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,varcode->AsToken,PTH,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,varcode->AsToken,RF,PT));
          goto L1287;
        }
      if(varcode->Methd==mt_Opts ){
          strcpy(varcode->Functype, join(2,varcode->AsToken,PTH));
          goto L1287;
        }
      if(varcode->Methd==mt_OptsAParam ){
          strcpy(varcode->Header, join(5,varcode->Header,No_Sigil(varcode->AsToken),PTH,SPC,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,No_Sigil(varcode->AsToken),RF,PT));
          goto L1287;
        }
      if(varcode->Methd==mt_ConsDesAParam ){
          strcpy(varcode->Header, join(5,varcode->Header,No_Sigil(varcode->AsToken),PTH,SPC,pszHead));
          strcpy(varcode->Proto, join(5,varcode->Proto,No_Sigil(varcode->AsToken),PTH,SPC,pszHead));
          goto L1287;
        }
      if(varcode->Methd==mt_OverLoad ){
          strcpy(varcode->Functype, join(2,VAR,SPC));
          goto L1287;
        }
      if(varcode->Methd==mt_OverLoadAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,varcode->AsToken,PTH,pszHead));
        }

L1287:;

      goto L1282;
    }
  if(vn==vt_CONSTRDESTR ){
      if(varcode->Methd==mt_ConsDes ){
          strcpy(varcode->Functype, join(3,VAR,PTH,CB));
        }
    }
  else
    {
      if(varcode->Methd==mt_FuncSubDecC_Dec ){
          strcpy(varcode->Functype, join(3,varcode->AsToken,PTH,CB));
          goto L1289;
        }
      if(varcode->Methd==mt_FuncSubDecC_DecAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,varcode->AsToken,PTH,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,varcode->AsToken,RF,PT));
          goto L1289;
        }
      if(varcode->Methd==mt_Opts ){
          strcpy(varcode->Functype, join(2,varcode->AsToken,PTH));
          goto L1289;
        }
      if(varcode->Methd==mt_OptsAParam ){
          strcpy(varcode->Header, join(5,varcode->Header,No_Sigil(varcode->AsToken),PTH,SPC,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,No_Sigil(varcode->AsToken),RF,PT));
          goto L1289;
        }
      if(varcode->Methd==mt_ConsDesAParam ){
          strcpy(varcode->Header, join(4,varcode->Header,No_Sigil(varcode->AsToken),SPC,pszHead));
          strcpy(varcode->Proto, join(4,varcode->Proto,No_Sigil(varcode->AsToken),SPC,pszHead));
        }

L1289:;

    }

L1282:;

}

void User_Global_Initialized_Arrays (FILE* FP_OUTPUT)
{
  static int Banner_Printed;
  char Banner[BCXSTRSIZE];
  char P[BCXSTRSIZE];
  int i;
  int A;
  char VarName[BCXSTRSIZE];
  char VarDim[BCXSTRSIZE];
  char Storage[BCXSTRSIZE];
  char VAR[BCXSTRSIZE];
  for(i=1; i<=GlobalVarCnt; i++)
    {
      if(GlobalVars[i].VarEmitFlag ){
          continue;
        }
      if(NOTNULL(GlobalVars[i].VarDim)&&GlobalVars[i].VarCondLevel==0 ){
          if(inchr(GlobalVars[i].VarDim,"{")){
              if(Banner_Printed==FALSE ){
                  *Banner=0;
                  strcpy(Banner, join(3,Banner,"",LF));
                  strcpy(Banner, join(3,Banner,"// *************************************************",LF));
                  strcpy(Banner, join(3,Banner,"//       Application Global Initialized Arrays",LF));
                  strcpy(Banner, join(3,Banner,"// *************************************************",LF));
                  Banner_Printed=TRUE;
                  fprintf(FP_OUTPUT,"%s\n",Banner);
                }
              *P=0;
              if(GlobalVars[i].VarPntr ){
                  strcpy(P,stringx(GlobalVars[i].VarPntr,42));
                }
              A=GlobalVars[i].VarType;
              if(GlobalVars[i].VarSF ){
                  strcpy(VarName, join(4,"(*",GlobalVars[i].VarName,extract(GlobalVars[i].VarDim,"("),")"));
                  strcpy(VarDim,mid(GlobalVars[i].VarDim,inchr(GlobalVars[i].VarDim,"(")));
                }
              else
                {
                  strcpy(VarName,GlobalVars[i].VarName);
                  strcpy(VarDim,GlobalVars[i].VarDim);
                }
              strcpy(Storage, join(2,VarStorage[GlobalVars[i].VarExtn],VarConst[GlobalVars[i].VarConstant]));
              if(A==vt_STRVAR ){
                  fprintf(FP_OUTPUT,"%s%s%s%s%s\n",Storage,"char    ",VarName,VarDim,";");
                  goto L1291;
                }
              if(A==vt_FILEPTR ){
                  strcpy(GlobalVars[i].VarName,RemoveStr(GlobalVars[i].VarName,"@"));
                  fprintf(FP_OUTPUT,"%s%s%s%s%s\n",Storage,"FILE    *",VarName,VarDim,";");
                  goto L1291;
                }
              if(A==vt_PSTR ){
                  fprintf(FP_OUTPUT,"%s%s%s%s%s%s\n",Storage,"PSTR   ",P,VarName,VarDim,";");
                  goto L1291;
                }
              if(A==vt_UDT||A==vt_STRUCT||A==vt_UNION ){
                  strcpy(VAR,TypeDefs[GlobalVars[i].VarDef].VarName);
                  strcpy(VAR,rpad(VAR,c_PADSIZE));
                  fprintf(FP_OUTPUT,"%s%s%s%s%s%s%s\n",Storage,VAR,SPC,P,VarName,VarDim,";");
                  goto L1291;
                }
              if(A>=c_vt_VarMin&&A<=c_vt_VarMax ){
                  strcpy(VAR,GetVarTypeName(GlobalVars[i].VarType));
                  strcpy(VAR,rpad(VAR,c_PADSIZE));
                  fprintf(FP_OUTPUT,"%s%s%s%s%s%s%s\n",Storage,VAR,SPC,P,VarName,VarDim,";");
                }

L1291:;

            }
        }
    }
}

void User_Overloaded_SubsFunctions (FILE* FP_OUTPUT)
{
  char LZZ[BCXSTRSIZE];
  FILE*  FP_OVR_IN;
  if(Use_Overloaded ){
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n","//       Application Overloaded Subs/Functions");
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      if((FP_OVR_IN=fopen(ovrFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", ovrFile); exit(1);
       }
      while(!EoF(FP_OVR_IN)){
          LZZ[0]=0;
          fgets(LZZ, 2048 , FP_OVR_IN);
            if(feof(FP_OVR_IN) || (LZZ[strlen(LZZ)-1]==10))
              {
               LZZ[strcspn(LZZ,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP_OVR_IN));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LZZ);
                exit(1);
              }
          if(iMatchNQ(LZZ,"overloaded")){
              fprintf(FP_OUTPUT,"%s\n","\n");
            }
          fprintf(FP_OUTPUT,"%s\n",LZZ);
        }
      if(FP_OVR_IN)
       {
         fclose(FP_OVR_IN);
         FP_OVR_IN=NULL;
       }
      fprintf(FP_OUTPUT,"%s\n","\n\n");
    }
}

void User_Global_Set_Statements (FILE* FP_OUTPUT)
{
  char LTmp1[BCXSTRSIZE];
  FILE*  LFP1;
  if(lof(setFile)>0 ){
      if((LFP1=fopen(setFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", setFile); exit(1);
       }
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n","//         Application GLOBAL SET Statements");
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      while(!EoF(LFP1)){
          LTmp1[0]=0;
          fgets(LTmp1, 2048 , LFP1);
            if(feof(LFP1) || (LTmp1[strlen(LTmp1)-1]==10))
              {
               LTmp1[strcspn(LTmp1,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(LFP1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",LTmp1);
                exit(1);
              }
          fprintf(FP_OUTPUT,"%s\n",LTmp1);
        }
      fprintf(FP_OUTPUT,"%s\n",SPC);
      if(LFP1)
       {
         fclose(LFP1);
         LFP1=NULL;
       }
    }
}

void User_Prototypes (FILE* FP_OUTPUT)
{
  char LastDef[BCXSTRSIZE];
  int LastLevel;
  int A;
  if(ProtoCnt ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s%s\n","//        ",c_BCX_STR_USR_PROTOS);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      *LastDef=0;
      LastLevel=1;
      for(A=1; A<=ProtoCnt; A++)
        {
          if(LastDef[0]==0 ){
              strcpy(LastDef,ProtoType[A].Condition);
              LastLevel=ProtoType[A].CondLevel;
              if(Use_SingleFile==FALSE ){
                  if(LastDef[0]!=0 ){
                      fprintf(FP_HeaderFile,"%s\n",LastDef);
                    }
                }
              if(LastDef[0]!=0 ){
                  fprintf(FP_OUTPUT,"%s\n",LastDef);
                }
            }
          if(strcmp(LastDef,ProtoType[A].Condition)!=0){
              if(strcmp(ProtoType[A].Condition,"#else")==0){
                  while(LastLevel>ProtoType[A].CondLevel){
                      if(Use_SingleFile==FALSE ){
                          fprintf(FP_HeaderFile,"%s\n","#endif");
                        }
                      fprintf(FP_OUTPUT,"%s\n","#endif");
                      LastLevel--;
                    }
                  if(Use_SingleFile==FALSE ){
                      fprintf(FP_HeaderFile,"%s\n","#else");
                    }
                  fprintf(FP_OUTPUT,"%s\n","#else");
                  strcpy(LastDef,ProtoType[A].Condition);
                  LastLevel=ProtoType[A].CondLevel;
                }
              else
                {
                  while(LastLevel>=ProtoType[A].CondLevel){
                      if(Use_SingleFile==FALSE ){
                          fprintf(FP_HeaderFile,"%s\n","#endif");
                        }
                      fprintf(FP_OUTPUT,"%s\n","#endif");
                      LastLevel--;
                    }
                  strcpy(LastDef,ProtoType[A].Condition);
                  LastLevel=ProtoType[A].CondLevel;
                  if(Use_SingleFile==FALSE ){
                      if(LastDef[0]!=0 ){
                          fprintf(FP_HeaderFile,"%s\n",LastDef);
                        }
                    }
                  if(LastDef[0]!=0 ){
                      fprintf(FP_OUTPUT,"%s\n",LastDef);
                    }
                }
            }
          if(UseStdCall&&UseCpp ){
              if(LeftStr(ProtoType[A].Prototype,"C_EXPORT ")){
                  Emit_ExportDef(ProtoType[A].Prototype);
                  UseImportExport=TRUE;
                }
            }
          char T[BCXSTRSIZE];
          strcpy(T,extract(ProtoType[A].Prototype,SPC));
          strcpy(T, join(2,rpad(T,c_PADSIZE),SPC));
          strcpy(ProtoType[A].Prototype, join(2,T,remain(ProtoType[A].Prototype,SPC)));
#if defined __MINGW64__ 
          strcpy(ProtoType[A].Prototype,replace(ProtoType[A].Prototype,"char *=","char * ="));
#endif
          char PrettyPrint[BCXSTRSIZE];
          strcpy(PrettyPrint,ProtoType[A].Prototype);
          int idx={0};
          char lhs[BCXSTRSIZE]={0};
          char rhs[BCXSTRSIZE]={0};
          strcpy(PrettyPrint,replace(PrettyPrint,"char*","char *"));
          strcpy(PrettyPrint,replace(PrettyPrint,"char    * ","char *"));
          strcpy(PrettyPrint,replace(PrettyPrint,"char * ","char *"));
          idx=inchr(PrettyPrint,SPC);
          strcpy(lhs,mid(PrettyPrint,1,idx));
          strcpy(rhs,mid(PrettyPrint,idx+1));
          while((int)strlen(lhs)<8){
              strcat(lhs,SPC);
            }
          strcpy(PrettyPrint, join(3,lhs,SPC,rhs));
          if(Use_SingleFile==FALSE ){
              fprintf(FP_HeaderFile,"%s\n",PrettyPrint);
            }
          fprintf(FP_OUTPUT,"%s\n",PrettyPrint);
        }
      if(FPDEF ){
          if(FPDEF)
           {
             fclose(FPDEF);
             FPDEF=NULL;
           }
        }
      if(LastDef[0]!=0 ){
          while(LastLevel>0){
              if(Use_SingleFile==FALSE ){
                  fprintf(FP_HeaderFile,"%s\n","#endif");
                }
              fprintf(FP_OUTPUT,"%s\n","#endif");
              LastLevel--;
            }
        }
    }
}

void AddMacros (FILE* FP_OUTPUT)
{
  if(Use_SysMacros||Use_Wingui ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s%s\n","//               ",c_BCX_STR_STD_MACROS);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  int Accum=Use_Form;
  Accum+=(Use_Button);
  Accum+=(Use_BmpButton);
  Accum+=(Use_SplitButton);
  Accum+=(Use_Edit);
  Accum+=(Use_BCX_Input);
  Accum+=(Use_Label);
  Accum+=(Use_Group);
  Accum+=(Use_Checkbox);
  Accum+=(Use_Radio);
  Accum+=(Use_Combobox);
  Accum+=(Use_Listbox);
  Accum+=(Use_Treeview);
  Accum+=(Use_Blackrect);
  Accum+=(Use_Whiterect);
  Accum+=(Use_Grayrect);
  Accum+=(Use_Datepick);
  Accum+=(Use_Listview);
  Accum+=(Use_BCX_Control);
  Accum+=(Use_BCX_Slider);
  Accum+=(Use_BCX_Tab);
  Accum+=(Use_BCX_Toolbar);
  Accum+=(Use_BCX_UpDown);
  Accum+=(Use_BCX_FrameWnd);
  Accum+=(Use_BCX_Wnd);
  if(Accum ){
      if(!Use_Project ){
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","HFONT GetDefaultFont(void)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","    HFONT result = BcxFont;");
          fprintf(FP_OUTPUT,"%s\n","    if (result == 0) {");
          fprintf(FP_OUTPUT,"%s\n","        NONCLIENTMETRICS ncm;");
          fprintf(FP_OUTPUT,"%s\n","        ncm.cbSize = sizeof(NONCLIENTMETRICS);");
          fprintf(FP_OUTPUT,"%s\n","        if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)) {");
          fprintf(FP_OUTPUT,"%s\n","            BcxFont = CreateFontIndirect(&ncm.lfMessageFont);");
          fprintf(FP_OUTPUT,"%s\n","            result = BcxFont;");
          fprintf(FP_OUTPUT,"%s\n","        } else {");
          fprintf(FP_OUTPUT,"%s\n","            result = (HFONT)GetStockObject(DEFAULT_GUI_FONT);");
          fprintf(FP_OUTPUT,"%s\n","       }");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    return result;");
          fprintf(FP_OUTPUT,"%s\n","}");
          fprintf(FP_OUTPUT,"%s\n","#define DefaultFont GetDefaultFont()");
        }
      else
        {
          fprintf(FP_OUTPUT,"%s\n","#ifndef __BCXFONT_DEFINED__");
          fprintf(FP_OUTPUT,"%s\n","  #define __BCXFONT_DEFINED__");
          fprintf(FP_OUTPUT,"%s\n","HFONT GetDefaultFont(void)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","    HFONT result = BcxFont;");
          fprintf(FP_OUTPUT,"%s\n","    if (result == 0) {");
          fprintf(FP_OUTPUT,"%s\n","        NONCLIENTMETRICS ncm;");
          fprintf(FP_OUTPUT,"%s\n","        ncm.cbSize = sizeof(NONCLIENTMETRICS);");
          fprintf(FP_OUTPUT,"%s\n","        if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)) {");
          fprintf(FP_OUTPUT,"%s\n","            BcxFont = CreateFontIndirect(&ncm.lfMessageFont);");
          fprintf(FP_OUTPUT,"%s\n","            result = BcxFont;");
          fprintf(FP_OUTPUT,"%s\n","        } else {");
          fprintf(FP_OUTPUT,"%s\n","            result = (HFONT)GetStockObject(DEFAULT_GUI_FONT);");
          fprintf(FP_OUTPUT,"%s\n","       }");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    return result;");
          fprintf(FP_OUTPUT,"%s\n","}");
          fprintf(FP_OUTPUT,"%s\n","#define DefaultFont GetDefaultFont()");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","#endif");
        }
      AddBcxFontVar();
    }
  if(Use_SysMacros ){
      if(Use_ForEach ){
          fprintf(FP_OUTPUT,"%s\n","#define FOR_EACH(i, a) {for(UINT i=0; i<sizeof((a))/sizeof((a)[0]); i++){");
          fprintf(FP_OUTPUT,"%s\n","#define NEXT_EACH }}");
          fprintf(FP_OUTPUT,"%s\n","#define EXIT_EACH break;");
        }
      if(Use_Clip_Reset ){
          fprintf(FP_OUTPUT,"%s\n","#define Clipboard_Reset OpenClipboard(NULL),EmptyClipboard(),CloseClipboard();");
        }
      if(Use_Cast ){
          fprintf(FP_OUTPUT,"%s\n","#define CAST(to_type,old_obj) ((to_type)(old_obj))");
        }
      if(Use_Read ){
          fprintf(FP_OUTPUT,"%s\n","#define READ(a) DATA[(a)-1]");
        }
      if(Use_Readnum ){
          fprintf(FP_OUTPUT,"%s\n","#define READNUM(a) (double)atof((DATA[(a)-1]))");
        }
      if(Use_EqualTo ){
          fprintf(FP_OUTPUT,"%s\n","#define EqualTo ==");
        }
      if(Use_NotEqualTo ){
          fprintf(FP_OUTPUT,"%s\n","#define NotEqualTo !=");
        }
      if(Use_BcxSplitPath ){
          fprintf(FP_OUTPUT,"%s\n","#define FDRV   2");
          fprintf(FP_OUTPUT,"%s\n","#define FPATH  4");
          fprintf(FP_OUTPUT,"%s\n","#define FNAME  8");
          fprintf(FP_OUTPUT,"%s\n","#define FEXT  16");
        }
      if(Use_Cbool ){
          fprintf(FP_OUTPUT,"%s\n","#define CBOOL(A)((A)!=0)?1:0");
        }
      if(Use_Istrue ){
          fprintf(FP_OUTPUT,"%s\n","#define ISTRUE 0!=");
        }
      if(Use_Notzero ){
          fprintf(FP_OUTPUT,"%s\n","#define NOTZERO 0!=");
        }
      if(Use_Notnull ){
          fprintf(FP_OUTPUT,"%s\n","#define NOTNULL(A)(*(A)!=0)");
        }
      if(Use_Isnull ){
          fprintf(FP_OUTPUT,"%s\n","#define ISNULL(A)(*(A)==0)");
        }
      if(Use_Isfalse ){
          fprintf(FP_OUTPUT,"%s\n","#define ISFALSE 0==");
        }
      if(Use_Iszero ){
          fprintf(FP_OUTPUT,"%s\n","#define ISZERO 0==");
        }
      if(Use_Isptr ){
          fprintf(FP_OUTPUT,"%s\n","#define IsPtr(a)((ULONG_PTR)(a))");
        }
      if(Use_ByteAt ){
          fprintf(FP_OUTPUT,"%s\n","#define BYTE_AT(B)(B)");
        }
      if(Use_Bnot ){
          fprintf(FP_OUTPUT,"%s\n","#define BNOT ~(int)");
        }
      if(Use_Datacount ){
          fprintf(FP_OUTPUT,"%s\n","#define DATACOUNT(int)(sizeof((DATA))/sizeof((DATA[0])))");
        }
      if(Use_Ubound ){
          fprintf(FP_OUTPUT,"%s\n","#define ubound_s(t)(int)(sizeof((t))/sizeof((t[0]))-1)");
          fprintf(FP_OUTPUT,"%s\n","#define ubound_d(i)(int)(_msize((i))/sizeof(i[0])-3)");
          fprintf(FP_OUTPUT,"%s\n","#define ubound(x)((int)ubound_s(x)<2?ubound_d(x):ubound_s(x))");
        }
      if(Use_Clear ){
          fprintf(FP_OUTPUT,"%s\n","#define Clear(arg)memset(&arg,0,sizeof(arg))");
        }
      if(Use_Imod ){
          fprintf(FP_OUTPUT,"%s\n","#define imod(a,b)((a)%(b))");
        }
      if(Use_BCX_OlePicture ){
          fprintf(FP_OUTPUT,"%s\n","#define BCX_OLE_WIDTH(H)LOWORD(PtrToUlong(GetWindowLongPtr(H,GWLP_USERDATA)))");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_OLE_HEIGHT(H)HIWORD(PtrToUlong(GetWindowLongPtr(H,GWLP_USERDATA)))");
        }
      if(Use_BCX_Resize ){
          fprintf(FP_OUTPUT,"%s\n","#define BCX_RESIZE(hwnd,cx,cy)SetWindowPos(hwnd,NULL,0,0,(cx),(cy),SWP_NOMOVE|SWP_NOREPOSITION|SWP_NOZORDER|SWP_FRAMECHANGED)");
        }
      if(Use_BCX_Cursor ){
          fprintf(FP_OUTPUT,"%s\n","#define BCX_Cursor(x)SetCursor(LoadCursor(NULL,x))");
        }
      if(Use_Refresh ){
          fprintf(FP_OUTPUT,"%s\n","#define Refresh(A)RedrawWindow(A,NULL,NULL,RDW_ERASE|RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_UPDATENOW);");
        }
      if(Use_ShowModal ){
          fprintf(FP_OUTPUT,"%s\n","#define ShowModal(Window)EnableWindow(GetWindow(Window,GW_OWNER),FALSE);SHOWHWNDWindow);");
        }
      if(Use_EndModal ){
          fprintf(FP_OUTPUT,"%s\n","#define EndModal(Window)EnableWindow(GetWindow(Window,GW_OWNER),TRUE);DestroyWindow(Window);");
        }
      if(Use_Show ){
          fprintf(FP_OUTPUT,"%s\n","#define SHOWHWND(Window)RedrawWindow(Window,0,0,0);ShowWindow(Window,SW_SHOW);");
        }
      if(Use_Hide ){
          fprintf(FP_OUTPUT,"%s\n","#define HIDEHWND(Window)ShowWindow(Window,SW_HIDE)");
        }
      if(Use_Get ){
          fprintf(FP_OUTPUT,"%s\n","#define GET(A,B,C)fread((B),1,(C),(A))");
        }
      if(Use_Put ){
          fprintf(FP_OUTPUT,"%s\n","#define PUT(A,B,C)fwrite((B),1,(C),(A))");
        }
      if(Use_Seteof ){
          fprintf(FP_OUTPUT,"%s\n","#define SetEof(A)SetEndOfFile((HANDLE)_get_osfhandle(_fileno((A))))");
        }
      if(Use_Strptr ){
          fprintf(FP_OUTPUT,"%s\n","#define STRPTR(A)(char*)&((A))");
        }
      if(Use_Val ){
          fprintf(FP_OUTPUT,"%s\n","#define VAL(a)val_func((a))");
        }
      if(Use_Vall ){
          fprintf(FP_OUTPUT,"%s\n","#if defined(__LCC__)||defined(__POCC__)||defined(__MINGW32__)||defined(__MINGW64__)");
          fprintf(FP_OUTPUT,"%s\n","   #define VALL(a)(long double)strtold((a),(char**)NULL)");
          fprintf(FP_OUTPUT,"%s\n","#elif defined(__BCPLUSPLUS__)");
          fprintf(FP_OUTPUT,"%s\n","   #define VALL(a)(long double)_strtold((a),(char**)NULL)");
          fprintf(FP_OUTPUT,"%s\n","#else");
          fprintf(FP_OUTPUT,"%s\n","   #define VALL(a)(long double)strtod((a),(char**)NULL)");
          fprintf(FP_OUTPUT,"%s\n","#endif");
        }
      if(Use_Getattr ){
          fprintf(FP_OUTPUT,"%s\n","#define GETATTR(a)(ULONG)GetFileAttributes((a))");
        }
      if(Use_Setattr ){
          fprintf(FP_OUTPUT,"%s\n","#define SETATTR(a,b)(ULONG)SetFileAttributes((a),(b))");
        }
      if(Use_Fix ){
          fprintf(FP_OUTPUT,"%s\n","#define FIX(a)(int)((a))");
        }
      if(Use_Frac ){
          fprintf(FP_OUTPUT,"%s\n","#define FRAC(a)(double)(((a))-FIX((a)))");
          Use_Fix=TRUE;
        }
      if(Use_Fracl ){
          fprintf(FP_OUTPUT,"%s\n","#define FRACL(a)(long double)((a)-FIX((a)))");
          Use_Fix=TRUE;
        }
      if(Use_Csng ){
          fprintf(FP_OUTPUT,"%s\n","#define CSNG(a)(float)((a))");
        }
      if(Use_Cdbl ){
          fprintf(FP_OUTPUT,"%s\n","#define CDBL(a)(double)((a))");
        }
      if(Use_Cldbl ){
          fprintf(FP_OUTPUT,"%s\n","#define CLDBL(a)(long double)((a))");
        }
      if(Use_DegToRad ){
          fprintf(FP_OUTPUT,"%s\n","#define DegToRad(Degrees)((Degrees)*0.017453292519943)");
        }
      if(Use_RadToDeg ){
          fprintf(FP_OUTPUT,"%s\n","#define RadToDeg(Radians)((Radians)*57.29577951308232)");
        }
      if(Use_Threads ){
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","#define BCX_THREAD(a)        (HANDLE)_beginthreadex(0,0,(unsigned int (__stdcall *)(void *))a,0,0,(unsigned int *)&BCX_Thread_ID)");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_THREADWAIT(a)    while(WaitForSingleObject(((void *)a),0)==WAIT_TIMEOUT){}CloseHandle(((void *)a))");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_THREADSUSPEND(a) SuspendThread((void *)a)");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_THREADRESUME(a)  ResumeThread((void *)a)");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_THREADKILL(a)    TerminateThread((void *)a,0); CloseHandle((void *)a)");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_THREADEND        _endthreadex(0)");
          fprintf(FP_OUTPUT,"%s\n","ULONG   BCX_Thread_ID = 0;");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_LineinputKB ){
          fprintf(FP_OUTPUT,"%s\n","#define mIsDynaString(v)(sizeof((v))==4||sizeof((v))==8)?1:0");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","#define mLineInputKB(p,v)\\");
          fprintf(FP_OUTPUT,"%s\n","{\\");
          fprintf(FP_OUTPUT,"%s%s%s\n","   printf(",enc("%s"),",(p));\\");
          fprintf(FP_OUTPUT,"%s\n","   if(mIsDynaString(v))\\");
          fprintf(FP_OUTPUT,"%s\n","       fgets((v), _msize((v)), stdin);\\");
          fprintf(FP_OUTPUT,"%s\n","    else \\");
          fprintf(FP_OUTPUT,"%s\n","       fgets((v), sizeof((v)), stdin);\\");
          fprintf(FP_OUTPUT,"%s\n","   (v)[strlen((v))-1]=0;\\");
          fprintf(FP_OUTPUT,"%s\n","}");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
    }
}

int JoinLines (char* Arg)
{
  strcpy(Arg,rtrim(Arg));
  if(m_iMatchRgt(Arg," _")||m_iMatchRgt(Arg,",_")||m_iMatchRgt(Arg,";_")||m_iMatchRgt(Arg,":_")||m_iMatchRgt(Arg,")_")||m_iMatchRgt(Arg,"(_")||m_iMatchRgt(Arg,"]_")||m_iMatchRgt(Arg,"[_")||m_iMatchRgt(Arg,"}_")||m_iMatchRgt(Arg,"{_")||m_iMatchRgt(Arg,">_")||m_iMatchRgt(Arg,"<_")||m_iMatchRgt(Arg,"+_")||m_iMatchRgt(Arg,"-_")||m_iMatchRgt(Arg,"*_")||m_iMatchRgt(Arg,"/_")||m_iMatchRgt(Arg,"\\_")||m_iMatchRgt(Arg,"^_")||m_iMatchRgt(Arg,"=_")||m_iMatchRgt(Arg,"&_")||m_iMatchRgt(Arg,"|_")||m_iMatchRgt(Arg,"$_")||m_iMatchRgt(Arg,join(2,DQ,"_"))){
      Arg[(int)strlen(Arg)-1]=0;
      strcat(CurLine,Arg);
      return TRUE;
    }
  if(NOTNULL(CurLine)){
      strcpy(Arg, join(2,CurLine,Arg));
      *CurLine=0;
    }
  UmQt=FALSE;
  return FALSE;
}

void Sanitize_Code (char* Arg)
{
  PCHAR  p;
  PCHAR  p2=Arg;
  int asmFlag=0;
  int eStr=0;
  char sub_[BCXSTRSIZE];
  while((*p2>8&&*p2<13)||*p2==32){
      p2++;
    }
  if(*p2==33 ){
      asmFlag=!UmQt;
    }
  p=p2;
  while(*p){
      if(*p==9 ){
          *p=32;
        }
      if(*p==c_DblQt ){
          if(*(p-1)==69 ){
              *(p-1)=1;
              eStr=TRUE;
            }
          while(*(++p)!=c_DblQt){
              if(*p==92&&eStr ){
                  *p=2;
                  if(*(p+1)==48 ){
                      *(p+1)=3;
                      goto L1302;
                    }
                  if(*(p+1)==116 ){
                      *(p+1)=4;
                      goto L1302;
                    }
                  if(*(p+1)==110 ){
                      *(p+1)=5;
                      goto L1302;
                    }
                  if(*(p+1)==114 ){
                      *(p+1)=6;
                      goto L1302;
                    }
                  if(*(p+1)==113 ){
                      *(p+1)=7;
                      goto L1302;
                    }
                  if(*(p+1)==92 ){
                      *(p+1)=8;
                    }

L1302:;

                  p++;
                }
              if(*p==0 ){
                  UmQt=!UmQt;
                  goto L1301;
                }
            }
L1301:;
        }
      if(!UmQt&&!asmFlag ){
          if((*p|32)==114 ){
              if((*(p+1)|32)==101&&(*(p+2)|32)==109&&(*(p+3)==32||*(p+3)==0)){
                  if(p==p2||*(p-1)==58||*(p-1)==32 ){
                      *p=0;
                      goto L1300;
                    }
                }
            }
          if(*p==39||(*p==47&&*(p+1)==47)){
              *p=0;
              goto L1300;
            }
        }
      p++;
    }
L1300:;
  while(p2<p){
      while((*(p-1)>8&&*(p-1)<13)||*(p-1)==32){
          *(--p)=0;
        }
      if(UmQt||asmFlag ){
          goto L1303;
        }
      if(*(p-1)==58&&*(p-2)==32 ){
          p--;
        }
      else
        {
          goto L1303;
        }
    }
L1303:;
  if(eStr ){
      strcpy(p2,RemoveStr(p2,vchr(1,1)));
      strcpy(p2,RemoveStr(p2,vchr(1,2)));
      strcpy(sub_,enc("+CHR$(0)+"));
      strcpy(p2,replace(p2,vchr(1,3),sub_));
      strcpy(sub_,enc("+CHR$(9)+"));
      strcpy(p2,replace(p2,vchr(1,4),sub_));
      strcpy(sub_,enc("+CHR$(10)+"));
      strcpy(p2,replace(p2,vchr(1,5),sub_));
      strcpy(sub_,enc("+CHR$(13)+"));
      strcpy(p2,replace(p2,vchr(1,6),sub_));
      strcpy(sub_,enc("+CHR$(34)+"));
      strcpy(p2,replace(p2,vchr(1,7),sub_));
      strcpy(sub_,enc("+CHR$(92)+"));
      strcpy(p2,replace(p2,vchr(1,8),sub_));
      strcpy(p2,RemoveStr(p2,vchr(3,c_DblQt,c_DblQt,43)));
      strcpy(p2,RemoveStr(p2,vchr(3,43,c_DblQt,c_DblQt)));
    }
  strcpy(Arg,p2);
}

void ProcSingleLineIf (int* ifFlag)
{
  char Tmp[BCXSTRSIZE];
  int ifp;
  int NdIfs;
  static int EFlag;
  if((*ifFlag)==0 ){
      EFlag=0;
    }

REDO:;

  if(SplitCnt==c_MaxSplitLines ){
      Abort("Stack Overflow - Too many statements on one line");
    }
  strcpy(Tmp, join(2,SplitStk[SplitCnt],SPC));
  if(m_iMatchLft(Tmp,"if ")){
      ifp=iMatchNQ(Tmp," then ");
      if(ifp ){
          if(SplitCnt==c_MaxSplitLines-1 ){
              Abort("Stack Overflow - Too many statements on one line");
            }
          strcpy(SplitStk[SplitCnt++],left(Tmp,ifp+4));
          strcpy(SplitStk[SplitCnt],ltrim(Tmp+ifp+4));
          EFlag=IMAX(0,EFlag-1);
          (*ifFlag)++;
          goto REDO;
        }
    }
  else
    {
      if((*ifFlag)){
          if(m_iMatchLft(Tmp,"else ")){

LFTLSE:;

              if(++EFlag>1 ){
                  NdIfs=IMAX(1,(*ifFlag)-1);
                  (*ifFlag)=1;
                  EFlag=0;
                  if(m_iMatchWrd(SplitStk[SplitCnt-1],"else")){
                      SplitCnt--;
                    }
                  if(SplitCnt==c_MaxSplitLines-1 ){
                      Abort("Stack Overflow - Too many statements on one line");
                    }
                    for(int BCX_REPEAT = 1; BCX_REPEAT <= NdIfs; BCX_REPEAT++)
                    {
                      strcpy(SplitStk[SplitCnt++],"END IF");
                    }
                }
              if(SplitCnt==c_MaxSplitLines-1 ){
                  Abort("Stack Overflow - Too many statements on one line");
                }
              strcpy(SplitStk[SplitCnt++],"ELSE");
              strcpy(SplitStk[SplitCnt],trim(Tmp+4));
              goto REDO;
            }
          else
            {
              ifp=iMatchNQ(Tmp," else ");
              if(ifp ){
                  if(SplitCnt==c_MaxSplitLines-1 ){
                      Abort("Stack Overflow - Too many statements on one line");
                    }
                  strcpy(SplitStk[SplitCnt++],rtrim(left(Tmp,ifp-1)));
                  strcpy(Tmp,mid(Tmp,ifp+1));
                  goto LFTLSE;
                }
            }
        }
    }
}

int SplitLines (char* Arg)
{
  PCHAR  p=Arg;
  PCHAR  st=Arg;
  int i={0};
  int IfFlag={0};
  int SpcolonFlag={0};
  int ParaCnt={0};
  if(*p==33||*p==36 ){
      return 0;
    }
  while(*p){
      if(*p==32 ){
          SpcolonFlag=1;
        }
      if(*p==c_DblQt ){
          while(*(++p)!=c_DblQt){
              if(*p==0 ){
                  return SplitCnt;
                }
            }
        }
      if(*p==c_LPar ){
          ParaCnt++;
        }
      if(*p==c_RPar ){
          ParaCnt--;
        }
      if(*p==58 ){
          if(*(p+1)==58 ){
              *p=15;
              *(p+1)=15;
            }
          else
            {
              if(NOTNULL((p+1))||ISTRUE(SpcolonFlag)){
                  while(*st==32){
                      st++;
                    }
                  SplitCnt++;
                  if(SplitCnt==c_MaxSplitLines ){
                      Abort("Stack Overflow - Too many statements on one line");
                    }
                  while(st<p){
                      SplitStk[SplitCnt][i++]=*(st++);
                    }
                  strcpy(SplitStk[SplitCnt],trim(SplitStk[SplitCnt]));
                  SplitStk[SplitCnt][i]=0;
                  if(ParaCnt==0 ){
                      i=0;
                      st++;
                      ProcSingleLineIf(&(IfFlag));
                    }
                  else
                    {
                      SplitCnt--;
                    }
                }
            }
        }
      p++;
    }
  if(SplitCnt>0 ){
      while(*st==32){
          st++;
        }
      SplitCnt++;
      if(SplitCnt==c_MaxSplitLines ){
          Abort("Stack Overflow - Too many statements on one line");
        }
      while(*st){
          SplitStk[SplitCnt][i++]=*(st++);
        }
      SplitStk[SplitCnt][i]=0;
      ProcSingleLineIf(&(IfFlag));
    }
  else
    {
      if(m_iMatchLft(Arg,"if ")&&!m_iMatchRgt(Arg," then")){
          Add2SplitLines(Arg);
          ProcSingleLineIf(&(IfFlag));
        }
    }
  if(IfFlag ){
      while(IfFlag){
          Add2SplitLines("END IF");
          IfFlag--;
        }
    }
  return SplitCnt;
}

int SpecialCaseHandler (char* Param)
{
  int i;
  int j;
  int k;
  int iSrcStkIndex;
  char lsz[BCXSTRSIZE];
  char Arg[BCXSTRSIZE];
  strcpy(Arg,Param);
  if(inchr(Param,"[")||inchr(Param,"]")){
        for(int BCX_REPEAT = 1; BCX_REPEAT <= 2; BCX_REPEAT++)
        {
          strcpy(Arg,replace(Arg,"[ ","["));
          strcpy(Arg,replace(Arg," [","["));
          strcpy(Arg,replace(Arg,"] ","]"));
          strcpy(Arg,replace(Arg," ]","]"));
        }
    }
  if(iMatchNQ(Arg," sub ")||iMatchNQ(Arg," function ")){
      return FALSE;
    }
  strcpy(lsz, join(3,SPC,extract(Arg,SPC),SPC));
  if(iMatchNQ(" dim , local , global , raw , static , shared , dynamic , auto , register , extern ",lsz)){
      FastLexer(Arg,SPC,",&(){}=");
      if(m_iMatchWrd("as",Stk[3])){
          strcpy(lsz, join(3,SPC,lcase(Stk[2]),SPC));
          if(iMatchNQ(" local , raw , static , shared , dynamic , auto , register ",lsz)){
              strcpy(Stk[1],Stk[2]);
              LShiftStk(2);
            }
        }
      if(m_iMatchWrd("as",Stk[2])){
          char szWrk[BCXSTRSIZE];
          int FirstComma;
          int Ignore;
          int b;
          int EqualAt;
          char Tmp[8][BCXSTRSIZE];
          int iFUNC={0};
          BuildDelimStr(1,Ndx,szWrk);
          FastLexer(szWrk,SPC,",&(){}=");
          for(i=3,Ignore=0,FirstComma=0,EqualAt=0; i<=Ndx && FirstComma==0; i++)
            {
              if(*Stk[i]==61&&Ignore==0 ){
                  EqualAt=i;
                }
              if(*Stk[i]==123 ){
                  Ignore++;
                }
              if(*Stk[i]==40 ){
                  Ignore++;
                  if(iFUNC==0 ){
                      iFUNC=i;
                    }
                }
              if(*Stk[i]==41 ){
                  Ignore--;
                }
              if(*Stk[i]==125 ){
                  Ignore--;
                }
              if(*Stk[i]==44&&Ignore==0 ){
                  FirstComma=i;
                }
            }
          if(FirstComma==0 ){
              FirstComma=Ndx+1;
            }
          if(iFUNC ){
              i=iFUNC;
            }
          if(i>EqualAt&&EqualAt ){
              i=EqualAt;
            }
          b=0;
          for(;;)
            {
              i--;
              if(*Stk[i]==125 ){
                  b++;
                }
              if(*Stk[i]==41 ){
                  b++;
                }
              if(*Stk[i]==40 ){
                  b--;
                }
              if(*Stk[i]==123 ){
                  b--;
                }
              if(!(b)){
                  goto L1313;
                }
            }
L1313:;
          if(*Stk[i]==61 ){
              i--;
            }
          if(*Stk[i]==40 ){
              i--;
            }
          if(*Stk[i]==123 ){
              i--;
            }
          if(*Stk[i]==44 ){
              i--;
            }
          int iVecCheck;
          for(j=0,k=2,iVecCheck=0; k<i; j++,k++)
            {
              if(inchr(Stk[k],vchr(1,15))){
                  iVecCheck=1;
                }
              if(iVecCheck ){
                  strcpy(Stk[k],replace(Stk[k],"<",vchr(1,16)));
                }
              if(iVecCheck ){
                  strcpy(Stk[k],replace(Stk[k],",",vchr(1,18)));
                }
              if(iVecCheck ){
                  strcpy(Stk[k],replace(Stk[k],">",vchr(1,17)));
                }
              strcpy(Tmp[j],Stk[k]);
              *Stk[k]=0;
            }
          k=Ndx;
          strcpy(Tmp[0], join(2,SPC,Tmp[0]));
          InsertTokens(Ndx,j,Tmp[0],Tmp[1],Tmp[2],Tmp[3],Tmp[4],Tmp[5],Tmp[6],Tmp[7]);
          Ignore=0;
          while(k>=FirstComma){
              if(*Stk[k]==125 ){
                  Ignore++;
                }
              if(*Stk[k]==41 ){
                  Ignore++;
                }
              if(*Stk[k]==40 ){
                  Ignore--;
                }
              if(*Stk[k]==123 ){
                  Ignore--;
                }
              if(*Stk[k]==44&&!Ignore ){
                  InsertTokens(k-1,j,Tmp[0],Tmp[1],Tmp[2],Tmp[3],Tmp[4],Tmp[5],Tmp[6],Tmp[7]);
                }
              k--;
            }
          RemEmptyTokens();
          BuildDelimStr(1,Ndx,Arg);
          if(InFunction==FALSE&&UseCpp==FALSE ){
              if(LeftStr(Arg,"RAW ",1)){
                  strcpy(Arg, join(2,"STATIC ",mid(Arg,4)));
                }
            }
          FastLexer(Arg,SPC,",(){}=");
        }
      else
        {
            {
            int  t;
            int  iVecCheck;
            for(i=1,t=1,iVecCheck=0; i<Ndx && t; i++)
              {
                t=m_GetAsPosF(i,Ndx);
                if(t ){
                    t++;
                    for(iVecCheck=0; t<=Ndx; t++)
                      {
                        if(*Stk[t]==44&&iVecCheck==0 ){
                            goto L1317;
                          }
                        if(inchr(Stk[t],vchr(1,15))){
                            iVecCheck=1;
                          }
                        if(iVecCheck ){
                            strcpy(Stk[t],replace(Stk[t],"<",vchr(1,16)));
                          }
                        if(iVecCheck ){
                            strcpy(Stk[t],replace(Stk[t],",",vchr(1,18)));
                          }
                        if(iVecCheck ){
                            strcpy(Stk[t],replace(Stk[t],">",vchr(1,17)));
                          }
                      }
L1317:;
                  }
              }
              }
        }
        {
        int  t;
        for(i=1,t=1; i<Ndx && t; i++)
          {
            t=m_GetAsPosF(i,Ndx);
            if(t ){
                i=t;
                strcpy(Stk[i-1],No_Sigil(Stk[i-1]));
              }
          }
          }
      strcpy(Stk[2], join(3,SPC,Stk[2],SPC));
      if(iMatchNQ(" raw , local , dynamic , register , static , shared , auto ",Stk[2])){
          strcpy(Stk[1], join(2,Stk[1],Stk[2]));
          *Stk[2]=0;
        }
      SrcCnt++;
      j=0;
      for(i=1; i<=Ndx; i++)
        {
          if(*Stk[i]==40 ){
              j++;
            }
          if(*Stk[i]==123 ){
              j++;
            }
          if(*Stk[i]==41 ){
              j--;
            }
          if(*Stk[i]==125 ){
              j--;
            }
          if(*Stk[i]==44&&!j ){
              strcpy(Stk[i],Stk[1]);
              SrcCnt++;
            }
          if(SrcCnt==c_MaxSingleLineIFLines ){
              Abort("Single line conversion to multi-line exceeds limit.");
            }
          strcpy(SrcStk[SrcCnt], join(3,SrcStk[SrcCnt],Stk[i],SPC));
        }
      goto PROCESSNEW;
    }
  if(InDialogEvt||ModDialogEvt ){
      if(iMatchNQ(Arg,"WM_INITDIALOG")){
          AddExpressionToStack(Arg);
          AddExpressionToStack("SetDialogScale(hWnd,0)");
          goto PROCESSNEW;
        }
    }
  if(TRUE==m_iMatchLft(Arg,"on ")){
      int Target=0;
      j=0;
      FastLexer(Arg,SPC,",");
      for(i=1; i<=Ndx; i++)
        {
          if(m_iMatchLft(Stk[i],"gosub")||m_iMatchLft(Stk[i],"goto")||m_iMatchLft(Stk[i],"call")){
              Target=i+1;
              goto L1321;
            }
        }
L1321:;
      if(Target==0 ){
          Abort("Malformed ON/GOSUB,GOTO,CALL.");
        }
      AddExpressionToStack("select case ");
      for(i=2; i<=Target-2; i++)
        {
          strcpy(SrcStk[SrcCnt], join(3,SrcStk[SrcCnt],SPC,Stk[i]));
        }
      for(i=Target; i<=Ndx; i++)
        {
          if(*Stk[i]==44 ){
              continue;
            }
          j++;
          AddExpressionToStack(join(2,"case",str(j)));
          AddExpressionToStack(join(3,Stk[Target-1],SPC,Stk[i]));
        }
      AddExpressionToStack("end select");
      goto PROCESSNEW;
    }
  if(TRUE==m_iMatchLft(Arg,"loop ")){
      FastLexer(Arg,SPC,",()");
      if(m_iMatchLft(Stk[2],"until")){
          AddExpressionToStack("if ");
          for(i=3; i<=Ndx; i++)
            {
              strcpy(SrcStk[SrcCnt], join(3,SrcStk[SrcCnt],Stk[i],SPC));
            }
          strcpy(SrcStk[SrcCnt], join(2,SrcStk[SrcCnt]," then"));
          AddExpressionToStack("exit do");
          AddExpressionToStack("end if");
          AddExpressionToStack("loop");
          iLoopCond=1;
          goto PROCESSNEW;
        }
      else if(m_iMatchLft(Stk[2],"while")){
          AddExpressionToStack("if NOT (");
          for(i=3; i<=Ndx; i++)
            {
              strcpy(SrcStk[SrcCnt], join(3,SrcStk[SrcCnt],Stk[i],SPC));
            }
          strcpy(SrcStk[SrcCnt], join(2,SrcStk[SrcCnt],") then"));
          AddExpressionToStack("exit do");
          AddExpressionToStack("end if");
          AddExpressionToStack("loop");
          iLoopCond=1;
          goto PROCESSNEW;
        }
      else
        {
          if(Ndx>1 ){
              Abort(join(3,"UNKNOWN Word ",Stk[2]," After LOOP"));
            }
        }
      goto L1320;
    }
  if(TRUE==m_iMatchLft(Arg,"do ")){
      FastLexer(Arg,SPC,",()");
      if(m_iMatchLft(Stk[2],"until")){
          AddExpressionToStack("do");
          AddExpressionToStack("if ");
          for(i=3; i<=Ndx; i++)
            {
              strcpy(SrcStk[SrcCnt], join(3,SrcStk[SrcCnt],Stk[i],SPC));
            }
          strcpy(SrcStk[SrcCnt], join(2,SrcStk[SrcCnt],"then"));
          AddExpressionToStack("exit do");
          AddExpressionToStack("end if");
          iDoWhile=lt_DOUNTILLOOP;
          goto PROCESSNEW;
        }
      else if(m_iMatchLft(Stk[2],"while")){
          AddExpressionToStack("while ");
          iDoWhile=lt_DOWHILELOOP;
          for(i=3; i<=Ndx; i++)
            {
              strcpy(SrcStk[SrcCnt], join(3,SrcStk[SrcCnt],Stk[i],SPC));
            }
          goto PROCESSNEW;
        }
      else
        {
          if(Ndx>1 ){
              Abort(join(3,"UNKNOWN Word ",Stk[2]," After DO"));
            }
        }
    }

L1320:;

  return FALSE;

PROCESSNEW:;

  Ndx=iSrcStkIndex=0;
  while(SrcCnt){
      strcpy(Arg,SrcStk[++iSrcStkIndex]);
      *SrcStk[iSrcStkIndex]=0;
      SrcCnt--;
      PassOne=TRUE;
      PreParse(Arg);
      PassOne=FALSE;
      FixUps();
      if(Ndx ){
          Function_Main_Support();
        }
    }
  return TRUE;
}

void FastLexer (PCTSTR  Arg,PCTSTR  delim1,PCTSTR  delim2,int TokQuote)
{
  PCHAR  pd1;
  PCHAR  pd2;
  int cnt1;
  int cnt2;
  cnt1=cnt2=0;
  Ndx=1;
  while(Arg[cnt1]){
      if(Arg[cnt1]==c_DblQt ){
          if(cnt2&&TokQuote ){
              Stk[Ndx++][cnt2]=0;
              cnt2=0;
            }
          Stk[Ndx][cnt2]=c_DblQt;
          while(Arg[++cnt1]!=c_DblQt){
              Stk[Ndx][++cnt2]=Arg[cnt1];
              if(Arg[cnt1]==0 ){
                  return;
                }
            }
          Stk[Ndx][++cnt2]=Arg[cnt1];
          if(TokQuote ){
              Stk[Ndx++][++cnt2]=0;
              cnt2=0;
              goto AGAIN;
            }
        }
      pd1= CAST (PCHAR,delim1);
      while(*pd1){
          if(*(pd1++)==Arg[cnt1] ){
              if(cnt2 ){
                  Stk[Ndx++][cnt2]=0;
                  cnt2=0;
                }
              goto AGAIN;
            }
        }
      pd2= CAST (PCHAR,delim2);
      while(*pd2){
          if(*(pd2++)==Arg[cnt1] ){
              if(cnt2 ){
                  Stk[Ndx++][cnt2]=0;
                }
              Stk[Ndx][0]=Arg[cnt1];
              Stk[Ndx++][1]=0;
              cnt2=0;
              goto AGAIN;
            }
        }
      Stk[Ndx][cnt2++]=Arg[cnt1];

AGAIN:;

      cnt1++;
    }
  Stk[Ndx][cnt2]=0;
  if(cnt2==0 ){
      Ndx--;
    }
}

void InsertTokens (int PosAfter,int NumTokens,...)
{
  va_list  ap;
  int i;
  for(i=Ndx; i>=PosAfter+1; i+=-1)
    {
      strcpy(Stk[i+NumTokens],Stk[i]);
    }
  va_start(ap,NumTokens);
  for(i=PosAfter+1; i<=PosAfter+NumTokens; i++)
    {
      strcpy(Stk[i],va_arg(ap,char*));
    }
  va_end(ap);
  Ndx+=(NumTokens);
  *Stk[Ndx+1]=0;
}

void AppendTokens (int NumTokens,...)
{
  va_list  ap;
  va_start(ap,NumTokens);
  for(int i=Ndx+1; i<=Ndx+NumTokens; i++)
    {
      strcpy(Stk[i],va_arg(ap,char*));
    }
  va_end(ap);
  Ndx+=(NumTokens);
  *Stk[Ndx+1]=0;
}

void Emit_ExportDef (char* fs)
{
  static int BeenHere;
  static char fname[BCXSTRSIZE];
  static char Private_FunctionName[BCXSTRSIZE];
  int i={0};
  int sz={0};
  int st=1;
  strcpy(fname, join(2,extract(FileIn,"."),".def"));
  if(!BeenHere ){
      if((FPDEF=fopen(fname, "w"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", fname); exit(1);
       }
       _splitpath(FileIn,NULL,NULL,fname,NULL);
      fprintf(FPDEF,"%s%s\n","LIBRARY ",enc(fname));
      fprintf(FPDEF,"%s\n","EXPORTS");
      BeenHere=TRUE;
    }
  FastLexer(fs,"","(,)");
  while(*Stk[st]!=40){
      st++;
    }
  for(i=st+1; i<=Ndx; i++)
    {
      if(*Stk[i]==41 ){
          goto L1337;
        }
      if(*Stk[i]!=44 ){
          if(inchr(Stk[i],"*")){
              sz+=(4);
              continue;
            }
          if(iMatchNQ(Stk[i],"longlong")||iMatchNQ(Stk[i],"double")||iMatchNQ(Stk[i],"long long")){
              sz+=(8);
              continue;
            }
          if(!inchr(Stk[i],"void")){
              sz+=(4);
            }
        }
    }
L1337:;
  strcpy(Stk[1],trim(Stk[1]));
  strcpy(Private_FunctionName,mid(Stk[1],InstrRev(Stk[1],SPC)+1));
  fprintf(FPDEF,"%s%s%s%s%s\n",Private_FunctionName," = _",Private_FunctionName,"@",str(sz,1));
}

char * GetArg (int ArgNum,UDT_ARG_COMMAS_STORAGE*  funcPtr)
{
  char  *BCX_RetStr={0};
  char RetArg[BCXSTRSIZE];
  *RetArg=0;
  int ArgEnd=funcPtr->CommaPos[ArgNum]-1;
  int ArgStart=funcPtr->CommaPos[ArgNum-1]+1;
  if(ArgNum>=funcPtr->NumArgs ){
      ArgEnd=Ndx;
    }
  for(int i=ArgStart; i<=ArgEnd; i++)
    {
      strcat(RetArg,Stk[i]);
    }
  BCX_RetStr = BCX_TempStr(strlen(RetArg));
  strcpy(BCX_RetStr,RetArg);
  return BCX_RetStr;
}

int SepFuncArgs (int Strt,UDT_ARG_COMMAS_STORAGE*  funcPtr,int functionflag)
{
  int CountR=0;
  int i=Strt;
  if(functionflag ){
      while(i<=Ndx){
          if(*Stk[i]==40 ){
              goto L1339;
            }
          i++;
        }
L1339:;
      Strt=i+1;
      funcPtr->NumArgs=0;
      funcPtr->CommaPos[0]=i;
      if(Strt>Ndx ){
          return 0;
        }
    }
  else
    {
      Strt=2;
      funcPtr->CommaPos[0]=1;
    }
  if(*Stk[Strt]==41 ){
      funcPtr->CommaPos[1]=Strt;
      return 0;
    }
  funcPtr->NumArgs=1;
  for(i=Strt; i<=Ndx; i++)
    {
      if(*Stk[i]==40||*Stk[i]==91 ){
          CountR++;
        }
      else if(*Stk[i]==41||*Stk[i]==93 ){
          if(CountR==0 ){
              funcPtr->CommaPos[funcPtr->NumArgs]=i;
              goto L1340;
            }
          CountR--;
        }
      else if(*Stk[i]==44&&CountR==0 ){
          funcPtr->CommaPos[funcPtr->NumArgs]=i;
          funcPtr->NumArgs++;
          if(funcPtr->NumArgs==c_CommaPos ){
              Abort("Number of arguments exceeds 127");
            }
        }
    }
L1340:;
  if(functionflag==0 ){
      funcPtr->CommaPos[funcPtr->NumArgs]=Ndx;
    }
  return funcPtr->NumArgs;
}

PSTR MakeDecProto (UDT_ARG_COMMAS_STORAGE*  funcPtr,int iStart,int iEnd,int iNoTypeDef)
{
  int OptFlag={0};
  int pointer={0};
  static char Proto[BCXSTRSIZE];
  static int SubFunPtr;
  static char FunType[BCXSTRSIZE];
  int i;
  int ii;
  char AsType[BCXSTRSIZE];
  char OptValue[BCXSTRSIZE];
  char AsArrys[BCXSTRSIZE];
  int FoundAs;
  struct _UDT_ARG_COMMAS_STORAGE  fpp;
  Clear(fpp);
  if(SubFunPtr ){
      goto ARGPARSE;
    }
  *Proto=0;
  *FunType=0;
  if(Ctor_Dtor_Detected(1)){
      *FunType=0;
    }
  else
    {
      if(m_iMatchWrd(Stk[iStart],"sub")){
          strcpy(FunType,"void");
        }
      else if(*Stk[iEnd]==41 ){
          strcpy(FunType,VarTypeLookup[inchr(c_VARTYPES,right(Stk[iStart+1],1))]);
        }
      else
        {
          for(i=iEnd; i>=funcPtr->CommaPos[funcPtr->NumArgs]+1; i+=-1)
            {
              if(m_iMatchWrd(Stk[i],"ptr")||*Stk[i]==42 ){
                  pointer++;
                }
              else if(m_iMatchWrd(Stk[i],"as")){
                  goto L1341;
                }
              else
                {
                  if(*Stk[i]!=0 ){
                      strcpy(FunType, join(3,Stk[i],SPC,FunType));
                    }
                }
            }
L1341:;
          strcpy(FunType,trim(FunType));
        }
    }
  if(ISNULL(FunType)){
      strcpy(Proto, join(2,Stk[iStart],"("));
    }
  else
    {
      if(InTypeDef ){
          char L_Var[BCXSTRSIZE];
          int w;
          int id;
          int vt;
          strcpy(Proto, join(4,FunType,space(2),stringx(pointer,42)," ("));
          strcpy(Proto, join(5,Proto,CallType,"*",No_Sigil(Stk[iStart+1]),")("));
          strcpy(L_Var, join(2,FunType,stringx(pointer,42)));
          GetTypeInfo(L_Var,&(w),&(id),&(vt));
          AddTypedefElement(BaseTypeDefsCnt[InTypeDef],vt,No_Sigil(Stk[iStart+1]),FunType);
        }
      else if(g_SubFuncPtr ){
          if(iNoTypeDef ){
              strcpy(Proto, join(6,FunType," (",CallType,"*",No_Sigil(Stk[iStart+1]),")("));
            }
          else
            {
              strcpy(Proto, join(4,"typedef ",FunType," (",CallType));
              strcpy(Proto, join(4,Proto,"*",No_Sigil(Stk[iStart+1]),"_TYPE)("));
            }
        }
      else if(!NoTypeDeclare&&!InClass&&!InCppTypeDef ){
          strcpy(Proto, join(4,"typedef ",FunType," (",CallType));
          strcpy(Proto, join(4,Proto,"*BCXFPROT",str(DllCnt,1),")("));
        }
      else
        {
          if(UseCProto||InClass||InCppTypeDef ){
              UseCProto=FALSE;
              strcpy(Proto, join(4,FunType,SPC,stringx(pointer,42),SPC));
              strcpy(Proto, join(4,Proto,CallType,No_Sigil(Stk[iStart+1]),"("));
            }
          else
            {
              strcpy(Proto, join(4,"C_IMPORT ",FunType,space(2),stringx(pointer,42)));
              strcpy(Proto, join(5,Proto,SPC,CallType,No_Sigil(Stk[iStart+1]),"("));
              UseImportExport=TRUE;
            }
        }
    }

ARGPARSE:;

  if(funcPtr->NumArgs==0 ){
      if(FunType[0]!=0 ){
          strcat(Proto,"void)");
        }
      else
        {
          strcat(Proto,")");
        }
    }
  else
    {
      for(ii=0; ii<=funcPtr->NumArgs-1; ii++)
        {
          *OptValue=0;
          *AsType=0;
          *AsArrys=0;
          pointer=0;
          FoundAs=0;
          int FirstToken=funcPtr->CommaPos[ii]+1;
          int LastToken=funcPtr->CommaPos[ii+1]-1;
          int NumOfTokens=(LastToken-FirstToken)+1;
          i=inchr(Stk[FirstToken],"[");
          if(i ){
              strcpy(AsArrys,mid(Stk[FirstToken],i));
              Stk[FirstToken][i-1]=0;
            }
          if(NumOfTokens==1 ){
              strcpy(AsType,VarTypeLookup[inchr(c_VARTYPES,right(Stk[FirstToken],1))]);
              if(*AsArrys ){
                  strcpy(AsType,RemoveStr(AsType,"*"));
                }
              else
                {
                  pointer=tally(Stk[FirstToken],"*");
                }
              FoundAs=TRUE;
            }
          else
            {
              for(i=LastToken; i>=FirstToken; i+=-1)
                {
                  if(m_iMatchWrd(Stk[i],"ptr")||*Stk[i]==42 ){
                      pointer++;
                    }
                  else if(m_iMatchWrd(Stk[i],"sub")){
                      SepFuncArgs(funcPtr->CommaPos[ii]+2,&(fpp),TRUE);
                      strcat(Proto,"void (*)(");
                      SubFunPtr=FoundAs=TRUE;
                      MakeDecProto(&(fpp));
                      SubFunPtr=FALSE;
                      goto L1343;
                    }
                  else if(m_iMatchWrd(Stk[i],"function")){
                      SepFuncArgs(funcPtr->CommaPos[ii]+2,&(fpp),TRUE);
                      if(ISNULL(AsType)){
                          strcpy(AsType,VarTypeLookup[inchr(c_VARTYPES,right(Stk[FirstToken],1))]);
                        }
                      strcpy(Proto, join(4,Proto,rtrim(AsType),stringx(pointer,42)," (*)("));
                      pointer=0;
                      *AsType=0;
                      SubFunPtr=FoundAs=TRUE;
                      MakeDecProto(&(fpp));
                      SubFunPtr=FALSE;
                      goto L1343;
                    }
                  else if(m_iMatchWrd(Stk[i],"as")){
                      if(ISNULL(AsType)){
                          Abort(join(2,"No type specified for argument",str(ii+1)));
                        }
                      FoundAs=TRUE;
                      goto L1343;
                    }
                  else if(*Stk[i]==61 ){
                      OptFlag=FoundAs=TRUE;
                      strcpy(OptValue, join(2," =",AsType));
                      *AsType=0;
                      if(i==FirstToken+1 ){
                          strcpy(AsType,VarTypeLookup[inchr(c_VARTYPES,right(Stk[FirstToken],1))]);
                          if(*AsArrys ){
                              strcpy(AsType,RemoveStr(AsType,"*"));
                            }
                          else
                            {
                              pointer=tally(Stk[FirstToken],"*");
                            }
                          goto L1343;
                        }
                    }
                  else
                    {
                      if(*Stk[i]!=46 ){
                          strcpy(AsType, join(3,Stk[i],SPC,AsType));
                        }
                      else
                        {
                          if(*Stk[i-1]==46 ){
                              if(OptFlag ){
                                  Abort("Default value not allowed when using variable arguments");
                                }
                              if(ii!=(funcPtr->NumArgs-1)){
                                  Abort("Variable argument must be the last parameter");
                                }
                              if(funcPtr->NumArgs==1 ){
                                  Abort("Variable argument must be preceded by at least one other parameter");
                                }
                              FoundAs=TRUE;
                            }
                          strcpy(AsType, join(2,Stk[i],AsType));
                        }
                    }
                }
L1343:;
            }
          if(!FoundAs ){
              Abort(join(2,"Malformed argument type in parameter",str(ii+1)));
            }
          if(ii!=funcPtr->NumArgs&&OptFlag&&ISNULL(OptValue)){
              Warning(join(2,"No default value specified for parameter",str(ii+1)),1);
            }
          strcpy(Proto, join(6,Proto,rtrim(AsType),AsArrys,stringx(pointer,42),OptValue,Stk[funcPtr->CommaPos[ii+1]]));
        }
    }
  return Proto;
}

void AsmUnknownStructs (int CompArrays)
{
  int InBrace={0};
  int InStruct={0};
  int i={0};
  char LTmp[BCXSTRSIZE]={0};
  for(i=2; i<=Ndx; i++)
    {
      if(CompArrays ){
          if(*Stk[i]==91 ){
              strcpy(LTmp,Stk[i-1]);
              *Stk[i-1]=0;
              for(;;)
                {
                  strcat(LTmp,Stk[i]);
                  if(*Stk[i]==93 ){
                      InBrace--;
                    }
                  if(*Stk[i]==91 ){
                      InBrace++;
                    }
                  *Stk[i]=0;
                  i++;
                  if(!(InBrace>0&&i<=Ndx)){
                      goto L1345;
                    }
                }
L1345:;
              strcpy(Stk[--i],LTmp);
            }
        }
      if((int)strlen(Stk[i])>1&&!IsDecimalNumber(Stk[i]+1)){
          if(*Stk[i]==46||m_iMatchLft(Stk[i],"->")){
              if(InStruct==0 ){
                  strcpy(Stk[i], join(2,Stk[i-1],Stk[i]));
                  *Stk[i-1]=0;
                  InStruct=i;
                }
              else
                {
                  strcpy(Stk[InStruct], join(2,Stk[InStruct],Stk[i]));
                  *Stk[i]=0;
                }
              continue;
            }
        }
      if(NOTNULL(Stk[i])&&InStruct ){
          InStruct=0;
        }
    }
  RemEmptyTokens();
}

void CheckForASC ()
{
  int Tmp={0};
  int iEmp={0};
  for(Tmp=1; Tmp<=Ndx; Tmp++)
    {
      if(m_iMatchWrd(Stk[Tmp],"asc")){
          iEmp=1;
          Process_ASC_Function(Tmp);
        }
    }
  if(iEmp ){
      RemEmptyTokens();
    }
}

void Make_Stricmp_Map ()
{
  long  MSM_Ndx;
  long  i;
  long  hasBracket;
  MSM_Ndx=0;
  for(i=0; i<=127; i++)
    {
      MSMap[i]=0;
    }
  hasBracket=FALSE;
  for(i=2; i<=Ndx; i++)
    {
      if(instr(Stk[i],"[")>0 ){
          hasBracket=TRUE;
        }
      if(RightStr(Stk[i],"$")==FALSE ){
          if(Im_Multi_Dim_StrVar(Stk[i])){
              strcpy(Stk[i], join(2,Stk[i],"$"));
            }
        }
    }
  if(hasBracket ){
      for(i=2; i<=Ndx; i++)
        {
          if(Im_Single_Dim_StrVar(Stk[i])){
              strcpy(Stk[i],RemoveStr(Stk[i],"$"));
            }
        }
    }
  for(i=1; i<=Ndx; i++)
    {
      if(i<=Ndx-2 ){
          if((*Stk[i]==63&&*Stk[i+1]==63&&*Stk[i+2]==61)||(*Stk[i]==61&&*Stk[i+1]==63&&*Stk[i+2]==63)||(*Stk[i]==63&&*Stk[i+1]==61&&*Stk[i+2]==63)){
              Abort("Combining string operators '?' and '=' is ambiguous");
            }
        }
      if(*Stk[i]==61&&*Stk[i+1]==61 ){
          strcpy(Stk[i],"==");
          LShiftStk(i+1);
        }
      else if(*Stk[i]==63&&*Stk[i+1]==63 ){
          strcpy(Stk[i],"??");
          LShiftStk(i+1);
        }
      else if((*Stk[i]==60&&*Stk[i+1]==61)||(*Stk[i]==61&&*Stk[i+1]==60)){
          strcpy(Stk[i],"<=");
          LShiftStk(i+1);
        }
      else if((*Stk[i]==62&&*Stk[i+1]==61)||(*Stk[i]==61&&*Stk[i+1]==62)){
          strcpy(Stk[i],">=");
          LShiftStk(i+1);
        }
      else if(*Stk[i]==33&&*Stk[i+1]==61 ){
          strcpy(Stk[i],"!=");
          LShiftStk(i+1);
        }
    }
  for(i=1; i<=Ndx; i++)
    {
      if(i<=Ndx-2 ){
          if((*Stk[i]==60 && strcmp(Stk[i+1],"??")==0  && *Stk[i+2]==62)||(*Stk[i]==60&&*Stk[i+1]==62 && strcmp(Stk[i+2],"??")==0)  || (*Stk[i]==62 && strcmp(Stk[i+1],"??")==0  && *Stk[i+2]==60)){
              strcpy(Stk[i],"!??");
              LShiftStk(i+1);
              LShiftStk(i+1);
            }
        }
      if((*Stk[i]==33 && strcmp(Stk[i+1],"??")==0)  || (strcmp(Stk[i],"??")==0  && *Stk[i+1]==33)){
          strcpy(Stk[i],"!??");
          LShiftStk(i+1);
        }
      else if((strcmp(Stk[i],"??")==0  && *Stk[i+1]==62)||(*Stk[i]==62 && strcmp(Stk[i+1],"??")==0)){
          strcpy(Stk[i],">??");
          LShiftStk(i+1);
        }
      else if((strcmp(Stk[i],"??")==0  && *Stk[i+1]==60)||(*Stk[i]==60 && strcmp(Stk[i+1],"??")==0)){
          strcpy(Stk[i],"<??");
          LShiftStk(i+1);
        }
    }
  for(i=1; i<=Ndx; i++)
    {
      if(strcmp(Stk[i],"??")==0){
          strcpy(Stk[i],"=");
          MSMap[++MSM_Ndx]=1;
          goto L1353;
        }
      if(strcmp(Stk[i],"<??")==0){
          strcpy(Stk[i],"<");
          MSMap[++MSM_Ndx]=1;
          goto L1353;
        }
      if(strcmp(Stk[i],">??")==0){
          strcpy(Stk[i],">");
          MSMap[++MSM_Ndx]=1;
          goto L1353;
        }
      if(strcmp(Stk[i],"!??")==0){
          strcpy(Stk[i],"!=");
          MSMap[++MSM_Ndx]=1;
          goto L1353;
        }
      if(strcmp(Stk[i],"=")==0  || strcmp(Stk[i],"<")==0  || strcmp(Stk[i],">")==0  || strcmp(Stk[i],"<=")==0  || strcmp(Stk[i],">=")==0  || strcmp(Stk[i],"!=")==0  || strcmp(Stk[i],"!")==0){
          MSMap[++MSM_Ndx]=2;
        }

L1353:;

    }
}

void Emit_IfCond (char* CondType,int iOutputMethod)
{
  int IsWhile={0};
  int A;
  int B;
  int TestString;
  int ParCnt;
  int Tmp;
  char szTest[BCXSTRSIZE];
  for(int i=2; i<=Ndx; i++)
    {
      if(Im_UDT_String(Stk[i])&&inchr(Stk[i],"$")==0 ){
          strcat(Stk[i],"$");
        }
      if(Im_A_String_Var(Stk[i])&&inchr(Stk[i],"$")==0 && strcmp(Stk[i+1],"[")!=0){
          strcat(Stk[i],"$");
        }
    }
  if(Im_A_String_Var(Stk[2])){
      int ii={0};
      if(*Stk[3]!=91 ){
          ii=TRUE;
        }
      if(ii==TRUE&&inchr(Stk[2],"$")==FALSE ){
          strcpy(Stk[2], join(2,Stk[2],"$"));
        }
    }
  CheckForASC();
  TestString=DataType(Stk[2]);
  if(TestString==vt_STRVAR||TestString==vt_CHAR||TestString==vt_SCHAR ){
      if(strcmp(Stk[4],DDQ)==0){
          strcpy(Stk[2], join(2,No_Sigil(Stk[2]),"[0]"));
          strcpy(Stk[4],"0");
        }
      else
        {
          if(strcmp(Stk[3],"[")==0  && strcmp(Stk[7],DDQ)==0){
              strcpy(Stk[2], join(2,"*",No_Sigil(Stk[2])));
              strcpy(Stk[7],"0");
            }
        }
    }
  if(strcmp(CondType,"while")==0){
      IsWhile=TRUE;
    }
  *IF_Stmt_Tank=0;
  Make_Stricmp_Map();
  if(iOutputMethod==eFull ){
      strcpy(IF_Stmt_Tank, join(3,Scoot,CondType,"("));
    }
  Tmp=2;
  while(strcmp(Stk[Tmp],"(")==0  || strcmp(Stk[Tmp],"!")==0){
      if(iOutputMethod==ePart||iOutputMethod==eFull ){
          strcat(IF_Stmt_Tank,Stk[Tmp]);
        }
      Tmp++;
    }
  TestString=FALSE;
  A=DataType(Stk[Tmp]);
  if(A==vt_STRLIT||A==vt_STRVAR ){
      if(strcmp(Stk[Tmp+1],")")!=0  && ISFALSE(m_iMatchWrd(Stk[Tmp+1],"then"))){
          TestString=TRUE;
          if(iOutputMethod==ePart||iOutputMethod==eFull ){
              strcat(IF_Stmt_Tank,"strcmp(");
            }
        }
    }
  *szTest=0;
  ParCnt=0;
  for(;;)
    {
      if(TestString ){
          if(strcmp(Stk[Tmp],"=")==0){
              strcpy(Stk[Tmp],",");
              strcpy(szTest,")==0");
              ParCnt=0;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],"!=")==0){
              strcpy(Stk[Tmp],",");
              strcpy(szTest,")!=0");
              ParCnt=0;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],">")==0){
              if(strcmp(Stk[Tmp+1],"=")==0){
                  strcpy(Stk[Tmp],",");
                  strcpy(szTest,")>=0");
                  *Stk[Tmp+1]=0;
                }
              else
                {
                  strcpy(Stk[Tmp],",");
                  strcpy(szTest,")==1");
                }
              ParCnt=0;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],"<")==0){
              if(strcmp(Stk[Tmp+1],"=")==0){
                  strcpy(Stk[Tmp],",");
                  strcpy(szTest,")<=0");
                  *Stk[Tmp+1]=0;
                }
              else
                {
                  strcpy(Stk[Tmp],",");
                  strcpy(szTest,")==-1");
                }
              ParCnt=0;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],">=")==0){
              strcpy(Stk[Tmp],",");
              strcpy(szTest,")>=0");
              ParCnt=0;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],"<=")==0){
              strcpy(Stk[Tmp],",");
              strcpy(szTest,")<=0");
              ParCnt=0;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],"(")==0){
              ParCnt++;
              goto L1357;
            }
          if(strcmp(Stk[Tmp],")")==0){
              ParCnt--;
            }

L1357:;

          if((ParCnt<0)&&(strcmp(Stk[Tmp],")")==0)  && (strcmp(szTest,"")!=0)){
              if(iOutputMethod==ePart||iOutputMethod==eFull ){
                  strcpy(IF_Stmt_Tank, join(3,IF_Stmt_Tank,szTest,Stk[Tmp]));
                }
              *szTest=0;
            }
          else
            {
              if(strcmp(Stk[Tmp],"||")==0  || strcmp(Stk[Tmp],"&&")==0){
                  strcpy(Stk[Tmp], join(4,szTest,SPC,Stk[Tmp],SPC));
                  *szTest=0;
                  B=1;
                  while(strcmp(Stk[Tmp+B],"(")==0){
                      strcpy(Stk[Tmp], join(2,Stk[Tmp],"("));
                      *Stk[Tmp+B]=0;
                      B++;
                    }
                  A=DataType(Stk[Tmp+B]);
                  if((A==vt_STRLIT||A==vt_STRVAR) && strcmp(Stk[Tmp+B+1],")")!=0){
                      strcpy(Stk[Tmp], join(2,Stk[Tmp]," strcmp("));
                    }
                  else
                    {
                      if(iOutputMethod==ePart||iOutputMethod==eFull ){
                          strcat(IF_Stmt_Tank,No_Sigil(Stk[Tmp]));
                        }
                      TestString=FALSE;
                      goto NXTTOKEN;
                    }
                }
              if(iOutputMethod==ePart||iOutputMethod==eFull ){
                  strcat(IF_Stmt_Tank,No_Sigil(Stk[Tmp]));
                }
            }
        }
      else
        {
          if(strcmp(Stk[Tmp],"||")==0  || strcmp(Stk[Tmp],"&&")==0){
              B=1;
              while(strcmp(Stk[Tmp+B],"(")==0){
                  strcpy(Stk[Tmp], join(2,Stk[Tmp],"("));
                  *Stk[Tmp+B]=0;
                  B++;
                }
              A=DataType(Stk[Tmp+B]);
              if((A==vt_STRLIT||A==vt_STRVAR) && strcmp(Stk[Tmp+B+1],")")!=0){
                  strcpy(Stk[Tmp], join(2,Stk[Tmp]," strcmp("));
                  TestString=TRUE;
                  *szTest=0;
                  ParCnt=0;
                  if(iOutputMethod==ePart||iOutputMethod==eFull ){
                      strcat(IF_Stmt_Tank,No_Sigil(Stk[Tmp]));
                    }
                  goto NXTTOKEN;
                }
            }
          if(strcmp(Stk[Tmp],"!")==0){
              if(iOutputMethod==ePart||iOutputMethod==eFull ){
                  strcat(IF_Stmt_Tank,Stk[Tmp]);
                }
            }
          else
            {
              if(iOutputMethod==ePart||iOutputMethod==eFull ){
                  strcat(IF_Stmt_Tank,No_Sigil(Stk[Tmp]));
                }
              if(!ispunct(*Stk[Tmp])){
                  if(Tmp<Ndx&&!ispunct(*Stk[Tmp+1])){
                      if(iOutputMethod==ePart||iOutputMethod==eFull ){
                          strcat(IF_Stmt_Tank,SPC);
                        }
                    }
                }
            }
          if(strcmp(Stk[Tmp],"=")==0){
              if(strcmp(Stk[Tmp-1],"<")!=0  && strcmp(Stk[Tmp-1],">")!=0){
                  if(strcmp(Stk[Tmp+1],">")!=0  && strcmp(Stk[Tmp+1],"<")!=0){
                      if(iOutputMethod==ePart||iOutputMethod==eFull ){
                          strcat(IF_Stmt_Tank,"=");
                        }
                    }
                }
            }
        }

NXTTOKEN:;

      Tmp++;
      if(!IsWhile ){
          if(m_iMatchWrd(Stk[Tmp],"then")){
              goto L1356;
            }
          else if(Tmp>Ndx ){
              Abort("If Without THEN");
            }
        }
      if(Tmp>Ndx ){
          goto L1356;
        }
    }
L1356:;
  if(iOutputMethod==eFull ){
      strcpy(IF_Stmt_Tank, join(3,IF_Stmt_Tank,szTest,")"));
      BumpUp();
      strcat(IF_Stmt_Tank,"{");
      BumpUp();
      goto L1360;
    }
  if(iOutputMethod==ePart ){
      strcat(IF_Stmt_Tank,szTest);
    }

L1360:;

  FastLexer(IF_Stmt_Tank,""," =&()[]{}',+-*/<>?;.|:^");
  for(int ii=1; ii<=Ndx-1; ii++)
    {
      if((int)strlen(Stk[ii])==1&&(int)strlen(Stk[ii+1])==1 ){
          if(*Stk[ii]==61 ){
              if(*Stk[ii+1]==61 ){
                  strcpy(Stk[ii],"==");
                  LShiftStk(ii+1);
                }
              goto L1362;
            }
          if(*Stk[ii]==62 ){
              if(*Stk[ii+1]==61 ){
                  strcpy(Stk[ii],">=");
                  LShiftStk(ii+1);
                }
              goto L1362;
            }
          if(*Stk[ii]==60 ){
              if(*Stk[ii+1]==61 ){
                  strcpy(Stk[ii],"<=");
                  LShiftStk(ii+1);
                }
              goto L1362;
            }
          if(*Stk[ii]==33 ){
              if(*Stk[ii+1]==61 ){
                  strcpy(Stk[ii],"!=");
                  LShiftStk(ii+1);
                }
              goto L1362;
            }
          if(*Stk[ii]==38 ){
              if(*Stk[ii+1]==38 ){
                  strcpy(Stk[ii],"&&");
                  LShiftStk(ii+1);
                }
              goto L1362;
            }
          if(*Stk[ii]==124 ){
              if(*Stk[ii+1]==124 ){
                  strcpy(Stk[ii],"||");
                  LShiftStk(ii+1);
                }
            }

L1362:;

        }
    }
  int Map_Idx={0};
  for(int ii=1; ii<=Ndx; ii++)
    {
      if(strcmp(Stk[ii],"strcmp")==0){
          if(MSMap[++Map_Idx]==1 ){
              strcpy(Stk[ii],"bcx_stricmp");
              Use_BCX_stricmp=TRUE;
            }
        }
    }
  *IF_Stmt_Tank=0;
  for(int ii=1; ii<=Ndx; ii++)
    {
      strcat(IF_Stmt_Tank,Stk[ii]);
    }
  if(IgnoreStrCase==TRUE ){
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"strcmp","bcx_stricmp"));
      Use_BCX_stricmp=TRUE;
    }
  strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank," ) {",") {"));
  if(iMatchNQ(IF_Stmt_Tank,"cmp")){
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"||  strcmp","|| strcmp"));
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"&&  strcmp","&& strcmp"));
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"||  stricmp","|| stricmp"));
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"&&  stricmp","&& stricmp"));
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"( strcmp","(strcmp"));
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"( stricmp","(stricmp"));
    }
  if(ISFALSE iMatchNQ(IF_Stmt_Tank,"  || ")){
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"|| "," || "));
    }
  if(ISFALSE iMatchNQ(IF_Stmt_Tank,"  && ")){
      strcpy(IF_Stmt_Tank,replace(IF_Stmt_Tank,"&& "," && "));
    }
  if(iOutputMethod==ePart ){
      fprintf(FP_WRITE,"%s",IF_Stmt_Tank);
    }
  else
    {
      fprintf(FP_WRITE,"%s\n",IF_Stmt_Tank);
    }
}

void Emit_Global (FILE* FP_OUTPUT,int A,int idx,char* Storage,char* P,char* VarName,char* VarDim)
{
  char L_Var[BCXSTRSIZE];
  if(A==vt_FILEPTR ){
      strcpy(VarName,RemoveStr(VarName,"@"));
      fprintf(FP_OUTPUT,"%s%s%s%s%s%s\n",Storage,"FILE   *",P,VarName,VarDim,";");
      goto L1365;
    }
  if(A==vt_UDT||A==vt_STRUCT||A==vt_UNION ){
      strcpy(L_Var,TypeDefs[GlobalVars[idx].VarDef].VarName);
      strcpy(L_Var,rpad(L_Var,c_PADSIZE));
      fprintf(FP_OUTPUT,"%s\n","");
      fprintf(FP_OUTPUT,"%s%s%s%s%s%s%s\n",Storage,L_Var,SPC,P,VarName,VarDim,";");
      fprintf(FP_OUTPUT,"%s\n","");
      goto L1365;
    }
  if(A==vt_PSTR ){
      fprintf(FP_OUTPUT,"%s%s%s%s%s%s\n",Storage,"PSTR ",P,VarName,VarDim,";");
      goto L1365;
    }
  if(A==vt_STRVAR ){
      if(ISNULL(VarDim)){
          strcpy(VarDim,"[BCXSTRSIZE]");
        }
      if(P[0]==0 ){
          strcpy(P, join(2,SPC,SPC));
        }
      fprintf(FP_OUTPUT,"%s%s%s%s%s%s\n",Storage,"char ",P,VarName,VarDim,";");
      goto L1365;
    }
  if(A>=c_vt_VarMin&&A<=c_vt_VarMax ){
      strcpy(L_Var,GetVarTypeName(GlobalVars[idx].VarType));
      strcpy(L_Var,rpad(L_Var,c_PADSIZE));
      while((int)strlen(L_Var)<6){
          strcat(L_Var,SPC);
        }
      fprintf(FP_OUTPUT,"%s%s%s%s%s%s%s\n",Storage,L_Var,SPC,P,VarName,VarDim,";");
    }

L1365:;

}

void InitReservedWordsLookup ()
{
  int  MaxReservedWords={0};
  char sL[BCXSTRSIZE]={0};
  int  iC={0};
  int  iD={0};
  MaxReservedWords=m_WordsInTable(BCXWords);
  for(iC=0; iC<=96; iC++)
    {
      iRIndex[iC][0]=MaxReservedWords-1;
      iRIndex[iC][1]=0;
    }
  for(iC=0; iC<=MaxReservedWords-1; iC++)
    {
      if(strcmp(sL,BCXWords[iC].pszFunctionName)==1){
          Abort(join(7,"Error in BCXWords[], Names out of order",CRLF,sL," comes after ",BCXWords[iC].pszFunctionName,CRLF,"Correct and recompile"));
        }
      strcpy(sL,BCXWords[iC].pszFunctionName);
      iD=(UCHAR)*(sL)-32;
      if(iD<0 ){
          iD=0;
        }
      if(iD>96 ){
          iD=96;
        }
      if(iRIndex[iD][0]>iC ){
          iRIndex[iD][0]=iC;
        }
      if(iRIndex[iD][1]<iC ){
          iRIndex[iD][1]=iC;
        }
    }
  for(iC=0; iC<=96; iC++)
    {
      if(iRIndex[iC][0]>iRIndex[iC][1]){
          iRIndex[iC][0]=iRIndex[iC][1];
        }
      iRIndex[iC][1]++;
    }
  int  iChk;
  int  iSize;
  iSize=m_WordsInTable(tBcxWords)-2;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(tBcxWords[iChk].pszWord,tBcxWords[iChk+1].pszWord)==1){
          Abort(join(4,"Error in SET tBcxWords: ",tBcxWords[iChk].pszWord," comes after ",tBcxWords[iChk+1].pszWord));
        }
    }
  iSize=m_WordsInTable(tTypes)-2;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(tTypes[iChk].pszWord,tTypes[iChk+1].pszWord)==1){
          Abort(join(4,"Error in SET tTypes: ",tTypes[iChk].pszWord," comes after ",tTypes[iChk+1].pszWord));
        }
    }
  iSize=m_WordsInTable(atEmitWords)-2;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(atEmitWords[iChk].pszWord,atEmitWords[iChk+1].pszWord)==1){
          Abort(join(4,"Error in SET atEmitWords: ",atEmitWords[iChk].pszWord," comes after ",atEmitWords[iChk+1].pszWord));
        }
    }
  iSize=m_WordsInTable(tDirectives)-2;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(tDirectives[iChk].pszWord,tDirectives[iChk+1].pszWord)==1){
          Abort(join(4,"Error in SET tDirectives: ",tDirectives[iChk].pszWord," comes after ",tDirectives[iChk+1].pszWord));
        }
    }
  iSize=m_WordsInTable(VariantList)-3;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(VariantList[iChk].sNAME,VariantList[iChk+1].sNAME)==1){
          Abort(join(4,"Error in SET VariantList: ",VariantList[iChk].sNAME," comes after ",VariantList[iChk+1].sNAME));
        }
    }
  iSize=m_WordsInTable(ptVCasts)-3;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(ptVCasts[iChk].pszCAST,ptVCasts[iChk+1].pszCAST)==1){
          Abort(join(4,"Error in SET ptVCasts: ",ptVCasts[iChk].pszCAST," comes after ",ptVCasts[iChk+1].pszCAST));
        }
    }
  iSize=m_WordsInTable(ptCCasts)-3;
  for(iChk=0; iChk<=iSize; iChk++)
    {
      if(strcmp(ptCCasts[iChk].pszCAST,ptCCasts[iChk+1].pszCAST)==1){
          Abort(join(4,"Error in SET ptCCasts: ",ptCCasts[iChk].pszCAST," comes after ",ptCCasts[iChk+1].pszCAST));
        }
    }
}

UDT_SUB_FUNC_TOKENS* GetWordInfo (char* sWord)
{
  int iH;
  int iL;
  int iM;
  int iV;
  iM=(UCHAR)*(sWord)-32;
  if(iM<0 ){
      iM=0;
    }
  if(iM>96 ){
      iM=96;
    }
  iL=iRIndex[iM][0];
  iH=iRIndex[iM][1];
  for(;;)
    {
      iM=(iH+iL)>>1;
      iV=strcmp(BCXWords[iM].pszFunctionName,sWord);
      if(iV==-1 ){
          if(iL!=iH ){
              if(iL==iM ){
                  iL++;
                }
              else
                {
                  iL=iM;
                }
            }
          goto L1378;
        }
      if(iV==0 ){
          return &(BCXWords[iM]);
        }
      if(iV==1 ){
          if(iL!=iH ){
              iH=iM;
            }
        }

L1378:;

      if(iL==iH ){
          goto L1377;
        }
    }
L1377:;
  return NULL;
}

int FindWord (char* sWord,UDT_KEYWORD_EMITTER*  tWordList,int iWordsInTable)
{
  int  iH;
  int  iL;
  int  iM;
  int  iV;
  iL=0;
  iH=iWordsInTable;
  while(iL!=iH){
      iM=(iH+iL)>>1;
      iV=strcmp(tWordList[iM].pszWord,sWord);
      if(iV==-1 ){
          if(iL==iM ){
              return (-1);
            }
          iL=iM;
          goto L1380;
        }
      if(iV==0 ){
          return iM;
        }
      if(iV==1 ){
          if(iL==iM ){
              return (-1);
            }
          iH=iM;
        }

L1380:;

    }
  return (-1);
}

void FixAnyArrays (char* Arg)
{
  int  iMakeNewArg={0};
  int  iAttach={0};
  for(int i=1; i<=Ndx; i++)
    {
      if(m_iMatchWrd(Stk[i],"as")){
          i++;
          iAttach=0;
          if(m_iMatchWrd(Stk[i],"vector")){
              i++;
              if(*Stk[i]==60 ){
                  iAttach=i-1;
                }
            }
          else
            {
              if(m_iMatchWrd(Stk[i+1],"vector")){
                  i+=(2);
                  if(*Stk[i]==60 ){
                      iAttach=i-1;
                    }
                }
            }
          if(iAttach>0 ){
              iMakeNewArg=1;
              for(int j=(iAttach+1); j<=Ndx; j++)
                {
                  if(strcmp(Stk[j],"<")==0){
                      strcpy(Stk[iAttach], join(2,Stk[iAttach],vchr(1,16)));
                      *Stk[j]=0;
                        {
                        int  k;
                        int  iV;
                        for(k=j+1,iV=1; k<=Ndx && iV>0; k++)
                          {
                            if(strcmp(Stk[k],">")==0){
                                iV--;
                                strcpy(Stk[iAttach], join(2,Stk[iAttach],vchr(1,17)));
                                *Stk[k]=0;
                                goto L1384;
                              }
                            if(strcmp(Stk[k],"<")==0){
                                iV++;
                                strcpy(Stk[iAttach], join(2,Stk[iAttach],vchr(1,16)));
                                *Stk[k]=0;
                                goto L1384;
                              }
                            if(strcmp(Stk[k],",")==0){
                                strcpy(Stk[iAttach], join(2,Stk[iAttach],vchr(1,18)));
                                *Stk[k]=0;
                              }
                            else
                              {
                                strcpy(Stk[iAttach], join(2,Stk[iAttach],Stk[k]));
                                *Stk[k]=0;
                              }

L1384:;

                          }
                          }
                    }
                }
            }
        }
    }
  if(iMakeNewArg ){
      char szNewArg[BCXSTRSIZE];
      *szNewArg=0;
      RemEmptyTokens();
      for(int i=1; i<=Ndx; i++)
        {
          strcat(szNewArg,Stk[i]);
          strcat(szNewArg,SPC);
        }
      strcpy(Arg,szNewArg);
    }
}

void Translate ()
{
  struct _UDT_SUB_FUNC_TOKENS*  ptW={0};
  char szWord[BCXSTRSIZE]={0};
  char Scratch[BCXSTRSIZE]={0};
  int iEmitID={0};
  int iDoFixup={0};
  if(m_iMatchLft(Src,"set ")){
      if(ComSwitchON==TRUE ){
          if(inchr(Src,"=")){
              Use_COM=Use_BcxTempStr=TRUE;
            }
          else
            {
              ProcessSetCommand(0);
              return;
            }
        }
      else
        {
          ProcessSetCommand(0);
          return;
        }
    }
  if(m_iMatchLft(Src,"sharedset ")){
      ProcessSetCommand(1);
      return;
    }
  PassOne=TRUE;
  PreParse(Src);
  PassOne=FALSE;
  if(Ndx==0 ){
      return;
    }
  if(bcx_stricmp(Stk[1],"FUNCTION")==0  && strcmp(Stk[2],"=")!=0){
      if(bcx_stricmp(Stk[Ndx],"FLOAT")==0  &&  bcx_stricmp(Stk[Ndx-1],"AS")==0){
          strcpy(Stk[2], join(2,Stk[2],"!"));
          Ndx-=(2);
        }
      if(bcx_stricmp(Stk[Ndx],"SINGLE")==0  &&  bcx_stricmp(Stk[Ndx-1],"AS")==0){
          strcpy(Stk[2], join(2,Stk[2],"!"));
          Ndx-=(2);
        }
      if(bcx_stricmp(Stk[Ndx],"DOUBLE")==0  &&  bcx_stricmp(Stk[Ndx-1],"AS")==0){
          strcpy(Stk[2], join(2,Stk[2],"#"));
          Ndx-=(2);
        }
      if(bcx_stricmp(Stk[Ndx],"STRING")==0  &&  bcx_stricmp(Stk[Ndx-1],"AS")==0){
          strcpy(Stk[2], join(2,Stk[2],"$"));
          Ndx-=(2);
        }
    }
  int ArgsFound={0};
  if(UseCpp==FALSE ){
      TransformSigil=FALSE;
      if(m_iMatchWrd(Stk[1],"SUB")||(m_iMatchWrd(Stk[1],"FUNCTION") && strcmp(Stk[2],"=")!=0)  || m_iMatchWrd(Stk[1],"DECLARE")||m_iMatchWrd(Stk[1],"C_DECLARE")||m_iMatchWrd(Stk[1],"PUBLIC")||m_iMatchWrd(Stk[1],"PRIVATE")){
          for(int zz=1; zz<=Ndx; zz++)
            {
              if(strcmp(Stk[zz],"(")==0){
                  ArgsFound=TRUE;
                }
              if(ArgsFound ){
                  if(RightStr(Stk[zz],"#")){
                      strcpy(Stk[zz],replace(Stk[zz],"#"," AS DOUBLE "));
                      TransformSigil=TRUE;
                    }
                }
              if(ArgsFound ){
                  if(RightStr(Stk[zz],"!")){
                      strcpy(Stk[zz],replace(Stk[zz],"!"," AS SINGLE "));
                      TransformSigil=TRUE;
                    }
                }
              if(ArgsFound ){
                  if(TransformSigil ){
                      for(int yy=1; yy<=Ndx; yy++)
                        {
                          if(strcmp(Stk[yy],"[")==0  && strcmp(Stk[zz+1],"]")==0){
                              strcpy(Stk[yy],"*");
                              *Stk[yy+1]=0;
                            }
                        }
                    }
                }
            }
        }
      if(TransformSigil ){
          *Scratch=0;
          for(int zz=1; zz<=Ndx; zz++)
            {
              strcat(Scratch,Stk[zz]);
              strcat(Scratch,SPC);
            }
          strcpy(Scratch,replace(Scratch,"DOUBLE  as double","DOUBLE"));
          strcpy(Scratch,replace(Scratch,"SINGLE  as single","SINGLE"));
          FastLexer(Scratch,SPC,c_FULLSET);
        }
    }
  for(int i=1; i<=Ndx; i++)
    {
      if(bcx_stricmp(Stk[i],"data")==0  &&  bcx_stricmp(Stk[i+1],"as")==0){
          Abort("DATA is a reserved word ");
        }
    }
  if(UseCpp||UseCpphdr ){
      FixAnyArrays(Src);
    }
  if(ComSwitchON==TRUE ){
      int i;
      int j;
      for(i=1,j=COM_open_WITH_statement; i<=Ndx && j==0; i++)
        {
          if(IsVariableComObject(Stk[i])){
              j=1;
            }
        }
      if(j ){
          if(Find_COM_statement(Src)==TRUE ){
              return;
            }
        }
    }
  if(SpecialCaseHandler(Src)){
      return;
    }
  iDoFixup=TRUE;
  strcpy(szWord,lcase(Stk[1]));
  ptW=GetWordInfo(szWord);
  if(ptW ){
      if((ptW->iWordInfo  &  eWI_Directive)){
          iEmitID=FindWord(szWord,tDirectives,m_WordsInTable(tDirectives));
          if(iEmitID!=c_NOTFOUND ){
              int FuncRetnFlag={0};
              if(tDirectives[iEmitID].Emitter(szWord,&(FuncRetnFlag))==0 ){
                  return;
                }
            }
        }
      if((ptW->iWordInfo  &  eWI_NoFixup)){
          iDoFixup=FALSE;
        }
    }
  if(iDoFixup ){
      FixUps();
      PassOne=FALSE;
    }
  if(Ndx ){
      Function_Main_Support();
      if(iEmitVarGroup ){
          Emit_BCXVariables();
        }
    }
}

void FixVector ()
{
  int Tmp;
  int j;
  int k;
  for(Tmp=2; Tmp<=Ndx; Tmp++)
    {
      if(m_iMatchWrd(Stk[Tmp],"as")){
          if(strcmp(Stk[Tmp+1],"vector")==0){
              Tmp++;
              k=Tmp;
              j=0;
              for(;;)
                {
                  strcpy(Stk[k], join(2,Stk[k],Stk[++Tmp]));
                  if(strcmp(Stk[Tmp],">")==0){
                      j++;
                    }
                  *Stk[Tmp]=0;
                  if(j ){
                      goto L1392;
                    }
                }
L1392:;
            }
        }
    }
  RemEmptyTokens();
}

void Function_Main_Support ()
{
  int EmitAgain=TRUE;
  int FuncRetnFlag={0};
  int iEmitID={0};
  char Lookup[BCXSTRSIZE]={0};
  if(HasVector ){
      FixVector();
      HasVector=FALSE;
    }
  strcpy(Lookup,lcase(Stk[1]));
  if(SelectState[StateIdx].NoBreak&&!m_iMatchLft(Lookup,"case")&&!m_iMatchWrd(Lookup,"endselect")){
      SelectState[StateIdx].NoBreak=0;
    }
  for(int i=1; i<=Ndx; i++)
    {
      if(inchr(Stk[i],vchr(1,15))){
          strcpy(Stk[i],replace(Stk[i],vchr(1,15),":"));
        }
      if(inchr(Stk[i],vchr(1,16))){
          strcpy(Stk[i],replace(Stk[i],vchr(1,16),"<"));
        }
      if(inchr(Stk[i],vchr(1,17))){
          strcpy(Stk[i],replace(Stk[i],vchr(1,17),">"));
        }
      if(inchr(Stk[i],vchr(1,18))){
          strcpy(Stk[i],replace(Stk[i],vchr(1,18),","));
        }
    }
  if(m_iMatchRgt(Stk[1],":")){
      fprintf(FP_WRITE,"%s%s%s%s\n",CRLF,ucase(Stk[1]),";",CRLF);
      return;
    }
  while(EmitAgain==TRUE&&Ndx>0){
      Statements++;
      if(CurrentFuncType==vt_STRVAR&&(InFunction||InCppTypeDef)&&OkayToSend ){
          fprintf(FP_WRITE,"%s%s\n",Scoot,"char  *BCX_RetStr={0};");
          OkayToSend=FALSE;
        }
      strcpy(Lookup,lcase(Stk[1]));
      iEmitID=FindWord(Lookup,atEmitWords,m_WordsInTable(atEmitWords));
      if(iEmitID==c_NOTFOUND ){
          Emit_Assignments(&(FuncRetnFlag));
          EmitAgain=FALSE;
        }
      else
        {
          EmitAgain=atEmitWords[iEmitID].Emitter(Lookup,&(FuncRetnFlag));
        }
    }
  if(FuncRetnFlag==1 ){
      if(NOTZERO(LocalDynaCnt)){
          for(int j=1; j<=LocalDynaCnt; j++)
            {
              fprintf(FP_WRITE,"%s%s\n",Scoot,DynaStr[j]);
            }
        }
      if(AuxLocalDynArrayCount>0 ){
          fprintf(FP_WRITE,"%s\n","");
          while(AuxLocalDynArrayCount>0){
              fprintf(FP_WRITE,"%s%s\n",Scoot,AuxLocalDynArray[AuxLocalDynArrayCount]);
              *AuxLocalDynArray[AuxLocalDynArrayCount]=0;
              AuxLocalDynArrayCount--;
            }
          fprintf(FP_WRITE,"%s\n","");
        }
      fprintf(FP_WRITE,"%s%s\n",Scoot,"return BCX_RetStr;");
    }
  ExitSubFunc=FALSE;
  if(m_iMatchWrd(Stk[1],"exit")){
      if(m_iMatchWrd(Stk[2],"sub")||m_iMatchWrd(Stk[2],"function")){
          ExitSubFunc=TRUE;
        }
    }
}

int Emit_FolderDriveProcs (char* Lookup,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  fprintf(FP_WRITE,"%s%s%s",Scoot,Lookup," (");
  strcpy(Stk[++Ndx],");");
  WriteCleanTokens(2,Ndx);
  return 0;
}

int Emit_FunctionReturn (char* Lookup,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(Lookup);
  if(g_FoundLocalDynArray==TRUE ){
      char LTmp[BCXSTRSIZE]={0};
      if(SelectState[StateIdx].CaseFlag ){
          SelectState[StateIdx].NoBreak=TRUE;
        }
      for(int i=1; i<=Ndx; i++)
        {
          int tmpLen=(int)strlen(Stk[i]);
          if(tmpLen>1 && strcmp(right(Stk[i],1),"!")==0){
              strcpy(Stk[i],RemoveStr(Stk[i],"!"));
            }
          if(tmpLen>1 && strcmp(right(Stk[i],1),"%")==0){
              strcpy(Stk[i],RemoveStr(Stk[i],"%"));
            }
          if(tmpLen>1 && strcmp(right(Stk[i],1),"#")==0){
              strcpy(Stk[i],RemoveStr(Stk[i],"#"));
            }
        }
      for(int i=3; i<=Ndx; i++)
        {
          strcpy(LTmp, join(3,LTmp,Stk[i],SPC));
        }
      strcpy(LTmp,BeautifyCode(trim(LTmp)));
      if(RightStr(LTmp," export",1)){
          strcpy(LTmp,IRemoveStr(LTmp,"export"));
        }
      if(CurrentFuncType==vt_STRVAR ){
          strcpy(LTmp, join(2,"BCX_RetStr$ = ",LTmp));
          *FuncRetnFlag=1;
          Use_BcxTempStr=TRUE;
        }
      else
        {
          strcpy(LTmp, join(2,"Bcx_RetVal = ",LTmp));
          strcpy(Stk[1],"Bcx_RetVal");
          JoinStrings(1,0);
          BuildDelimStr(1,Ndx,LTmp);
          strcpy(LTmp,trim(LTmp));
          strcpy(LTmp,No_Sigil(LTmp));
          strcpy(LTmp,BeautifyCode(LTmp));
          *FuncRetnFlag=2;
        }
      if(*FuncRetnFlag==2 ){
          fprintf(FP_WRITE,"%s%s%s\n",Scoot,LTmp,";");
        }
      if(*FuncRetnFlag==2 ){
          if(NOTZERO(LocalDynaCnt)){
              for(int j=1; j<=LocalDynaCnt; j++)
                {
                  fprintf(FP_WRITE,"%s%s\n",Scoot,DynaStr[j]);
                }
            }
          if(NOTZERO(LocalDynArrCnt)){
              for(int i=1; i<=LocalDynArrCnt; i++)
                {
                  fprintf(FP_WRITE,"%s%s\n",Scoot,LocalDynArrName[i]);
                }
            }
          if(*FuncRetnFlag==2 ){
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"return ",trim(extract(LTmp,"=")),";");
              *LTmp=0;
            }
          LastCmd=2;
        }
      PreParse(LTmp);
      FixUps();
      LastCmd=2;
    }
  else
    {
      char LTmp[BCXSTRSIZE]={0};
      if(SelectState[StateIdx].CaseFlag ){
          SelectState[StateIdx].NoBreak=TRUE;
        }
      for(int iA=3; iA<=Ndx; iA++)
        {
          strcpy(LTmp, join(3,LTmp,Stk[iA],SPC));
        }
      if(CurrentFuncType==vt_STRVAR ){
          strcpy(LTmp, join(2,"BCX_RetStr$ = ",LTmp));
          *FuncRetnFlag=1;
          Use_BcxTempStr=TRUE;
        }
      else
        {
          *FuncRetnFlag=2;
        }
      if(*FuncRetnFlag==2 ){
          if(NOTZERO(LocalDynaCnt)){
              for(int j=1; j<=LocalDynaCnt; j++)
                {
                  fprintf(FP_WRITE,"%s%s\n",Scoot,DynaStr[j]);
                }
            }
          if(NOTZERO(LocalDynArrCnt)){
              for(int i=1; i<=LocalDynArrCnt; i++)
                {
                  fprintf(FP_WRITE,"%s%s\n",Scoot,LocalDynArrName[i]);
                }
            }
          fprintf(FP_WRITE,"%s%s",Scoot,"return ");
          LastCmd=2;
        }
      PreParse(LTmp);
      FixUps();
      LastCmd=0;
    }
  g_FoundLocalDynArray=FALSE;
  return 1;
}

int Emit_Msgbox (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  int i={0};
  int j={0};
  int k={0};
  for(i=2; i<=Ndx; i++)
    {
      if(strcmp(Stk[i],"[")==0){
          j++;
        }
      else if(strcmp(Stk[i],"]")==0){
          j--;
        }
      else if(strcmp(Stk[i],"(")==0){
          j++;
        }
      else if(strcmp(Stk[i],")")==0){
          j--;
        }
      if(j==0 && strcmp(Stk[i],",")==0){
          k++;
        }
    }
  if(k==0 ){
      Ndx++;
      strcpy(Stk[Ndx],",");
      Ndx++;
      strcpy(Stk[Ndx],DDQ);
      k=1;
    }
  if(k==1 ){
      Ndx++;
      strcpy(Stk[Ndx],",");
      Ndx++;
      strcpy(Stk[Ndx],"MB_SYSTEMMODAL");
    }
  fprintf(FP_WRITE,"%s%s",Scoot,"MessageBox (GetActiveWindow(),");
  strcpy(Stk[++Ndx],");");
  WriteCleanTokens(2,Ndx);
  return 0;
}

int Emit_BcxSetFont (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Use_SetFont=TRUE;
  Use_Proto=TRUE;
  if(strcmp(Stk[2],"(")==0){
      LShiftStk(2);
      Ndx--;
    }
  fprintf(FP_WRITE,"%s%s",Scoot,"SendMessage(");
  int i=2;
  for(;;)
    {
      fprintf(FP_WRITE,"%s",No_Sigil(Stk[i]));
      i++;
      if(strcmp(Stk[i],",")==0){
          goto L1405;
        }
      if(i>Ndx ){
          Abort("Malformed BCX_SET_FONT");
        }
    }
L1405:;
  i++;
  fprintf(FP_WRITE,"%s",",(UINT_PTR)WM_SETFONT,");
  fprintf(FP_WRITE,"%s","(WPARAM)BCX_Set_Font(");
  strcpy(Stk[++Ndx],"),1);");
  WriteCleanTokens(i,Ndx);
  return FALSE;
}

int Emit_BcxSetLabelColor (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Use_SetColor=Use_Proto=TRUE;
  if(strcmp(Stk[2],"(")==0){
      LShiftStk(2);
      Ndx--;
    }
  *gTmpStr=0;
  int i;
  for(i=2; i<=Ndx; i++)
    {
      if(strcmp(Stk[i],",")==0){
          goto L1406;
        }
      strcat(gTmpStr,Stk[i]);
    }
L1406:;
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"if((HWND)lParam==",gTmpStr," && Msg==WM_CTLCOLORSTATIC)");
  fprintf(FP_WRITE,"%s%s",Scoot,"return Set_Color(");
  strcpy(Stk[++Ndx],",(HDC)(UINT_PTR)wParam,(HWND)lParam);");
  WriteCleanTokens(i+1,Ndx);
  return FALSE;
}

int Emit_BcxSetEditColor (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Use_SetColor=Use_Proto=TRUE;
  if(strcmp(Stk[2],"(")==0){
      LShiftStk(2);
      Ndx--;
    }
  *gTmpStr=0;
  int iii;
  for(iii=2; iii<=Ndx; iii++)
    {
      if(strcmp(Stk[iii],",")==0){
          goto L1407;
        }
      strcat(gTmpStr,Stk[iii]);
    }
L1407:;
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"if((HWND)lParam==",gTmpStr," && Msg==WM_CTLCOLOREDIT)");
  fprintf(FP_WRITE,"%s%s",Scoot,"return Set_Color(");
  strcpy(Stk[++Ndx],",(HDC)(UINT_PTR)wParam,(HWND)lParam);");
  WriteCleanTokens(iii+1,Ndx);
  return FALSE;
}

int Emit_Hscroll (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Use_Hscroll=m_IVAL(Stk[2]);
  if(Use_Hscroll==0 ){
      Use_Hscroll=TRUE;
    }
  return FALSE;
}

int Emit_Vscroll (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Use_Vscroll=m_IVAL(Stk[2]);
  if(Use_Vscroll==0 ){
      Use_Vscroll=TRUE;
    }
  return FALSE;
}

int Emit_InsertMenuProc (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  int L_Comma=0;
  fprintf(FP_WRITE,"%s%s",Scoot,"InsertMenu");
  for(int A=2; A<=Ndx; A++)
    {
      if(strcmp(Stk[A],",")==0){
          L_Comma++;
        }
      if(strcmp(Stk[A],",")==0){
          if(L_Comma==3 ){
              strcpy(Stk[A],",(UINT_PTR)");
            }
        }
      fprintf(FP_WRITE,"%s",No_Sigil(Stk[A]));
    }
  fprintf(FP_WRITE,"%s\n",";");
  return FALSE;
}

int Emit_MdiGuiProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  if(Ndx<2 ){
      Abort(join(3,"Not Enough Parameters with ",ucase(sWord)," Statement!"));
    }
  if(m_iMatchWrd(Stk[2],"nomain")){
      Use_Wingui=TRUE;
      NoMain=TRUE;
      Use_GUINoMain=TRUE;
      if(m_iMatchWrd(Stk[4],"pixels")){
          strcpy(GUIMetric,"pixels");
        }
      if(m_iMatchWrd(Stk[4],"dpi")){
          strcpy(GUIMetric,"dpi");
        }
      if(m_iMatchWrd(Stk[4],"icon") && strcmp(Stk[6],"")!=0){
          strcpy(GUIIcon, join(3," LoadIcon(BCX_hInstance,MAKEINTRESOURCE(",Stk[6],"));"));
        }
      else if(m_iMatchWrd(Stk[6],"icon") && strcmp(Stk[8],"")!=0){
          strcpy(GUIIcon, join(3," LoadIcon(BCX_hInstance,MAKEINTRESOURCE(",Stk[8],"));"));
        }
      else
        {
          strcpy(GUIIcon," LoadIcon(NULL,IDI_WINLOGO);");
        }
      if(strcmp(sWord,"mdigui")==0){
          Use_Mdigui=TRUE;
          Emit_MDICode(FP_WRITE);
          Use_MDIGUINoMain=TRUE;
          Use_GUINoMain=FALSE;
        }
    }
  else
    {
      Use_Wingui=TRUE;
      char classname[BCXSTRSIZE]={0};
      char metric[BCXSTRSIZE]={0};
      strcpy(classname,Stk[2]);
      if(m_iMatchWrd(Stk[4],"pixels")){
          strcpy(metric,"pixels");
          strcpy(GUIMetric,"pixels");
        }
      if(m_iMatchWrd(Stk[4],"dpi")){
          strcpy(metric,"dpi");
          strcpy(GUIMetric,"dpi");
        }
      if(m_iMatchWrd(Stk[4],"icon") && strcmp(Stk[6],"")!=0){
          strcpy(GUIIcon, join(3," LoadIcon(BCX_hInstance,MAKEINTRESOURCE(",Stk[6],"));"));
        }
      else if(m_iMatchWrd(Stk[6],"icon") && strcmp(Stk[8],"")!=0){
          strcpy(GUIIcon, join(3," LoadIcon(BCX_hInstance,MAKEINTRESOURCE(",Stk[8],"));"));
        }
      else
        {
          strcpy(GUIIcon," LoadIcon(NULL,IDI_WINLOGO);");
        }
      Use_BCX_SetMetric=Use_BCX_InitGUI=Use_BCX_RegWnd=TRUE;
      Emit_WinGUIMain(classname,metric,GUIIcon);
      if(strcmp(sWord,"mdigui")==0){
          Use_Mdigui=TRUE;
          Emit_MDI_MsgPump();
          Emit_MDICode(FP_WRITE);
        }
      else
        {
          Emit_GUI_MsgPump();
        }
    }
  AddGUIGlobals();
  if(!Use_BCX_Class_Info ){
      Use_BCX_Class_Info=TRUE;
      iEmitVarGroup=iEmitVarGroup|(eFontGroup|eClassName);
    }
  return FALSE;
}

int Emit_FileIO (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  if(strcmp(sWord,"flush")==0){
      for(int i=2; i<=Ndx; i++)
        {
          strcpy(Stk[i],RemoveStr(Stk[i],"#"));
          if(ISNULL(Stk[i])){
              Abort("Bad FLUSH Argument");
            }
          if(DataType(Stk[i])==vt_NUMBER ){
              strcpy(Stk[i], join(2,"FP",Stk[i]));
            }
        }
      if(strcmp(Stk[2],"(")==0){
          LShiftStk(2);
          Ndx--;
        }
      int i={0};
      if(FindVarInfo(Stk[2],&(i))==NULL ){
          AddGlobal(Stk[2],vt_FILEPTR);
        }
      *szFileHandle=0;
      for(int j=2; j<=Ndx; j++)
        {
          strcat(szFileHandle,Stk[j]);
        }
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"   fflush(",szFileHandle,");");
      goto L1409;
    }
  if(strcmp(sWord,"close")==0){
      if(Ndx==1 ){
          fprintf(FP_WRITE,"%s%s\n",Scoot,"_fcloseall();");
          goto L1409;
        }
      int Redo={0};
      for(int i=1; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],",")==0){
              strcpy(Stk[i]," : close ");
              Redo=TRUE;
            }
        }
      if(Redo ){
          *Src=0;
          for(int i=1; i<=Ndx; i++)
            {
              strcat(Src,Stk[i]);
              strcat(Src,SPC);
            }
          SplitLines(Src);
          strcpy(Src,ltrim(SplitStk[++SplitCur]));
          FastLexer(Src,SPC,c_FULLSET);
        }
      for(int i=2; i<=Ndx; i++)
        {
          strcpy(Stk[i],RemoveStr(Stk[i],"#"));
          if(*Stk[i]==0 ){
              Abort("Bad CLOSE Argument");
            }
          if(DataType(Stk[i])==vt_NUMBER ){
              strcpy(Stk[i], join(2,"FP",Stk[i]));
            }
        }
      if(strcmp(Stk[2],"(")==0){
          LShiftStk(2);
          Ndx--;
        }
      int i;
      if(FindVarInfo(Stk[2],&(i))==NULL ){
          AddGlobal(Stk[2],vt_FILEPTR);
        }
      *szFileHandle=0;
      for(int j=2; j<=Ndx; j++)
        {
          strcat(szFileHandle,Stk[j]);
        }
      if(UseFileTest ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"if(",szFileHandle,")");
          fprintf(FP_WRITE,"%s%s\n",Scoot," {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"   fclose(",szFileHandle,");");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"   ",szFileHandle,"=NULL;");
          fprintf(FP_WRITE,"%s%s\n",Scoot," }");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"fclose(",szFileHandle,");");
        }
      goto L1409;
    }
  if(strcmp(sWord,"open")==0){
      char Keyword[BCXSTRSIZE];
      char LTmp[BCXSTRSIZE];
      char Op[BCXSTRSIZE];
      int HaveFOR;
      int HaveAS;
      HaveFOR=FALSE;
      HaveAS=FALSE;
      *Op=0;
      for(int iA=1; iA<=Ndx; iA++)
        {
          strcpy(Keyword,lcase(Stk[iA]));
          if(strcmp(Keyword,"open")==0){
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"for")==0){
              *Stk[iA]=0;
              BuildCleanStr(2,iA-1,Filnam);
              HaveFOR=TRUE;
              goto L1417;
            }
          if(strcmp(Keyword,"as")==0){
              *Stk[iA]=0;
              if(DataType(Stk[iA+1])==vt_NUMBER ){
                  strcpy(Stk[iA+1], join(2,"FP",Stk[iA+1]));
                }
              HaveAS=TRUE;
              int i;
              if(FindVarInfo(Stk[iA+1],&(i))==NULL ){
                  AddGlobal(Stk[iA+1],vt_FILEPTR);
                }
              *Var=0;
              for(int j=iA+1; j<=Ndx; j++)
                {
                  if(m_iMatchWrd(Stk[j],"reclen")){
                      goto L1418;
                    }
                  strcat(Var,Stk[j]);
                  *Stk[j]=0;
                }
L1418:;
              strcpy(szFileHandle, join(2,Var,"@"));
              goto L1417;
            }
          if(strcmp(Keyword,"input")==0){
              strcpy(Op,enc("rb"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"output")==0){
              strcpy(Op,enc("w"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"append")==0){
              strcpy(Op,enc("a"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"binary")==0){
              strcpy(Op,enc("rb+"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"binaryappend")==0){
              strcpy(Op,enc("ab+"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"binarynew")==0){
              strcpy(Op,enc("wb+"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"binaryinput")==0){
              strcpy(Op,enc("rb"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"binaryoutput")==0){
              strcpy(Op,enc("rb+"));
              *Stk[iA]=0;
              goto L1417;
            }
          if(strcmp(Keyword,"reclen")==0){
              if(strcmp(Stk[iA+1],"=")==0){
                  for(int j=iA+2; j<=Ndx; j++)
                    {
                      strcpy(Stk[j-1],Stk[j]);
                    }
                  Ndx--;
                }
              strcpy(Var, join(2,extract(No_Sigil(szFileHandle),"["),"len"));
              int i;
              int j;
              char LZZ[BCXSTRSIZE];
              if(CheckLocal(Var,&(i))==vt_UNKNOWN ){
                  AddGlobal(Var,vt_INTEGER);
                }
              else
                {
                  if(CheckLocal(Var,&(i))==vt_UNKNOWN ){
                      AddLocal(Var,vt_INTEGER);
                      strcpy(Var, join(2,"int ",Var));
                    }
                }
              i=CheckType(Stk[iA+1]);
              strcpy(LZZ,lcase(Stk[iA+1]));
              j=FindWord(LZZ,tTypes,m_WordsInTable(tTypes));
              if(i==vt_STRUCT||i==vt_UNION||j==vt_BOOL||j==vt_BYTE||j==vt_CHAR||j==vt_SCHAR||j==vt_COLORREF||j==vt_DOUBLE||j==vt_DWORD||j==vt_SINGLE||j==vt_INTEGER||j==vt_LDOUBLE||j==vt_LLONG||j==vt_SSHORT||j==vt_LONG||j==vt_SHORT||j==vt_UINT||j==vt_ULONG||j==vt_ULONGLONG||j==vt_USHORT||j==vt_VARIANT||j==vt_WINBOOL ){
                  fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,Var," = sizeof(",Stk[iA+1],");");
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,Var," = ",No_Sigil(Stk[iA+1]),";");
                }
              *Stk[iA]=0;
              *Stk[iA+1]=0;
            }

L1417:;

        }
      if(ISNULL(Op)){
          Abort("Syntax Error: Missing FOR in OPEN statement");
        }
      if(m_IDont(HaveFOR)){
          Abort("Syntax Error: Missing FOR in OPEN statement");
        }
      if(m_IDont(HaveAS)){
          Abort("Syntax Error: Missing AS  in OPEN statement");
        }
      if(UseFileTest ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"if((",No_Sigil(szFileHandle),"=fopen(",Filnam,", ",Op,"))==0)");
          fprintf(FP_WRITE,"%s%s\n",Scoot," {");
          strcpy(LTmp,enc("Error: Cannot Access File or File Not Found. %s\\n"));
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"fprintf(stderr, ",LTmp,", ",Filnam,"); exit(1);");
          fprintf(FP_WRITE,"%s%s\n",Scoot," }");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,No_Sigil(szFileHandle),"=fopen(",Filnam,", ",Op,");");
        }
      goto L1409;
    }
  if(strcmp(sWord,"record")==0){
      int numargs={0};
      struct _UDT_ARG_COMMAS_STORAGE  funcPtr;
      Clear(funcPtr);
      if(DataType(Stk[2])==vt_NUMBER ){
          strcpy(Stk[2], join(2,"FP",Stk[2]));
        }
      if(Ndx>1 ){
          numargs=SepFuncArgs(1,&(funcPtr),FALSE);
        }
      if(numargs<1 ){
          Abort("Missing required arguments to RECORD");
        }
      if(numargs>4 ){
          Abort("Too many arguments to RECORD");
        }
      if(numargs==3 ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s\n",Scoot,"_fseeki64 (",GetArg(1,&(funcPtr)),",(",GetArg(2,&(funcPtr)),"-1)*",Stk[2],"len+",GetArg(3,&(funcPtr)),",SEEK_SET);");
        }
      else if(numargs==2 ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"_fseeki64 (",GetArg(1,&(funcPtr)),",(",GetArg(2,&(funcPtr)),"-1)*",Stk[2],"len,SEEK_SET);");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"_fseeki64 (",GetArg(1,&(funcPtr)),",0,SEEK_SET);");
        }
    }

L1409:;

  return 0;
}

int Emit_FileManagementProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  if(strcmp(sWord,"copyfile")==0){
      fprintf(FP_WRITE,"%s%s",Scoot,"CopyFile (");
      char szUS[BCXSTRSIZE];
      strcpy(szUS,ucase(Stk[Ndx]));
      if(strcmp(Stk[Ndx],"1")==0  || strcmp(Stk[Ndx],"0")==0){
          strcpy(Stk[++Ndx],");");
          goto L1421;
        }
      if(strcmp(Stk[Ndx],"TRUE")==0  || strcmp(Stk[Ndx],"FALSE")==0){
          if(UseCpp ){
              strcpy(Stk[Ndx], join(2,lcase(Stk[Ndx]),");"));
            }
          else
            {
              strcpy(Stk[Ndx], join(2,szUS,");"));
            }
        }
      else
        {
          if(UseCpp ){
              strcpy(Stk[++Ndx],",false);");
            }
          else
            {
              strcpy(Stk[++Ndx],",FALSE);");
            }
        }

L1421:;

      WriteCleanTokens(2,Ndx);
      goto L1420;
    }
  if(strcmp(sWord,"kill")==0){
      fprintf(FP_WRITE,"%s%s",Scoot,"DeleteFile (");
      if(Ndx>=2 && strcmp(Stk[2],"(")!=0){
          InsertOptionalParens(2);
        }
      strcpy(Stk[++Ndx],");");
      WriteCleanTokens(2,Ndx);
      goto L1420;
    }
  if(strcmp(sWord,"rename")==0){
      fprintf(FP_WRITE,"%s%s",Scoot,"MoveFile (");
      strcpy(Stk[++Ndx],");");
      WriteCleanTokens(2,Ndx);
    }

L1420:;

  return 0;
}

int Emit_LineInputProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  char Var1[BCXSTRSIZE];
  char Var2[BCXSTRSIZE];
  char CVar[BCXSTRSIZE];
  char L_Handle[BCXSTRSIZE];
  int i=DataType(Stk[2]);
  if(i==vt_STRLIT||i==vt_STRVAR ){
      if(i!=vt_STRLIT ){
          strcpy(Stk[2],No_Sigil(Stk[2]));
        }
      char sC_Stk3[BCXSTRSIZE];
      strcpy(sC_Stk3,No_Sigil(Stk[3]));
      Use_LineinputKB=Use_SysMacros=TRUE;
      fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"mLineInputKB (",Stk[2],", ",sC_Stk3,");");
      return 0;
    }
  Use_NamePathFromFP=Use_BcxTempStr=TRUE;
  strcpy(Stk[2],RemoveStr(Stk[2],"#"));
  if(ISNULL(Stk[2])){
      Abort("Bad LINE INPUT File Handle");
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  strcpy(L_Handle,extract(Stk[2],"["));
  if(FindVarInfo(L_Handle,&(i))==NULL ){
      AddGlobal(L_Handle,vt_FILEPTR);
    }
  strcpy(Var1,No_Sigil(Stk[3]));
  *Var2=0;
  strcpy(CVar,Var1);
  char Optional_Limit[BCXSTRSIZE]={0};
  strcpy(Optional_Limit,mid(Var1,InstrRev(Var1,",")));
  strcpy(Var1,RemoveStr(Var1,Optional_Limit));
  strcpy(CVar,RemoveStr(CVar,Optional_Limit));
  strcpy(Optional_Limit,trim(mid(Optional_Limit,2)));
  if(inchr(Var1,"[")&&inchr(Var1,"]")){
      if(iMatchNQ(Var1,"[++")){
          strcpy(CVar,RemoveStr(CVar,"++"));
        }
      if(iMatchNQ(Var1,"[--")){
          strcpy(CVar,RemoveStr(CVar,"--"));
        }
      if(iMatchNQ(Var1,"++]")){
          strcpy(CVar,RemoveStr(CVar,"++"));
          strcpy(Var2,mid(Var1,inchr(Var1,"[")+1));
          strcpy(Var2,extract(Var2,"]"));
          strcpy(Var1,CVar);
        }
      if(iMatchNQ(Var1,"--]")){
          strcpy(CVar,RemoveStr(CVar,"--"));
          strcpy(Var2,mid(Var1,inchr(Var1,"[")+1));
          strcpy(Var2,extract(Var2,"]"));
          strcpy(Var1,CVar);
        }
    }
  fprintf(FP_WRITE,"%s%s%s\n",Scoot,Var1,"[0]=0;");
  strcpy(Var1,RemoveStr(Var1,"--"));
  strcpy(Var1,RemoveStr(Var1,"++"));
  if(Optional_Limit[0]!=0 ){
      fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"fgets(",Var1,", ",Optional_Limit,", ",No_Sigil(Stk[2]),");");
    }
  else
    {
      fprintf(FP_WRITE,"%s%s%s%s %d %s%s%s\n",Scoot,"fgets(",Var1,",",(int)BCXSTRSIZE,", ",No_Sigil(Stk[2]),");");
    }
  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"  if(feof(",No_Sigil(Stk[2]),") || (",Var1,"[strlen(",Var1,")-1]==10))");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"    {");
  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"     ",Var1,"[strcspn(",Var1,",",enc("\\r\\n"),")] = 0;");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"    }");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"   else");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"    {");
  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"      printf(",enc("%s%d while reading file: %s\\n"),",",enc("Error! - LINE INPUT truncation detected at PROGRAM line: "),",__LINE__-7, NamePathFromFP(",No_Sigil(Stk[2]),"));");
  fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"      printf(",enc("%s\\n"),",",enc("The actual truncated line of text:"),");");
  fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"      printf(",enc("%s"),",",Var1,");");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"      exit(1);");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"    }");
  if(Var2[0]!=0 ){
      fprintf(FP_WRITE,"%s%s\n",Var2,";");
    }
  return 0;
}

int Emit_FinputProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Emit_FileInputCode();
  return 0;
}

int Emit_GetProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  int i;
  Use_Get=TRUE;
  Use_SysMacros=TRUE;
  strcpy(Stk[2],RemoveStr(Stk[2],"#"));
  if(ISNULL(Stk[2])){
      Abort("Bad GET$ Argument");
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  if(FindVarInfo(Stk[2],&(i))==NULL ){
      AddGlobal(Stk[2],vt_FILEPTR);
    }
  fprintf(FP_WRITE,"%s%s",Scoot,"GET(");
  strcpy(Stk[++Ndx],");");
  WriteCleanTokens(2,Ndx);
  return 0;
}

int Emit_PutProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  int i;
  Use_Put=TRUE;
  Use_SysMacros=TRUE;
  strcpy(Stk[2],RemoveStr(Stk[2],"#"));
  if(ISNULL(Stk[2])){
      Abort("Bad PUT$ Argument");
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  if(FindVarInfo(Stk[2],&(i))==NULL ){
      AddGlobal(Stk[2],vt_FILEPTR);
    }
  fprintf(FP_WRITE,"%s%s",Scoot,"PUT(");
  strcpy(Stk[++Ndx],");");
  WriteCleanTokens(2,Ndx);
  return 0;
}

int Emit_FprintProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  static int i;
  static int j;
  static char LZZ[BCXSTRSIZE];
  char L_Handle[BCXSTRSIZE];
  strcpy(Stk[2],RemoveStr(Stk[2],"#"));
  if(ISNULL(Stk[2])){
      Abort("Bad FPRINT Argument");
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  if(m_iMatchWrd(Stk[2],"stderr")){
      strcpy(L_Handle,"stderr");
    }
  else
    {
      if(FindVarInfo(Stk[2],&(i))==NULL ){
          AddGlobal(Stk[2],vt_FILEPTR);
        }
      *L_Handle=0;
      for(j=2; j<=Ndx; j++)
        {
          if(*Stk[j]==44||*Stk[j]==59 ){
              *Stk[j]=0;
              goto L1422;
            }
          strcat(L_Handle,Stk[j]);
          *Stk[j]=0;
        }
L1422:;
      strcat(L_Handle,"@");
    }
  *Stk[2]=0;
  *Stk[3]=0;
  strcpy(LZZ, join(2,"f",PrintWriteFormat(0)));
  strcpy(LZZ, join(4,left(LZZ,8),RemoveStr(L_Handle,"@"),",",mid(LZZ,9)));
  fprintf(FP_WRITE,"%s%s\n",Scoot,LZZ);
  return 0;
}

int Emit_SeekProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  strcpy(Stk[2],RemoveStr(Stk[2],"#"));
  if(ISNULL(Stk[2])){
      Abort("Bad SEEK Argument");
    }
  char Origin[BCXSTRSIZE]={0};
  if(strcmp(ucase(Stk[Ndx]),"SEEK_CUR")==0  || strcmp(ucase(Stk[Ndx]),"SEEK_END")==0  || strcmp(ucase(Stk[Ndx]),"SEEK_SET")==0){
      strcpy(Origin,ucase(Stk[Ndx]));
      Ndx-=(2);
    }
  else
    {
      strcpy(Origin,"SEEK_SET");
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  int i={0};
  if(CheckLocal(Stk[2],&(i))==vt_UNKNOWN ){
      AddGlobal(Stk[2],vt_FILEPTR);
    }
  fprintf(FP_WRITE,"%s%s",Scoot,"_fseeki64(");
  strcpy(Stk[++Ndx], join(3,",",Origin,");"));
  WriteCleanTokens(2,Ndx);
  return 0;
}

int Emit_SetEofProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  Use_SysMacros=Use_Seteof=TRUE;
  int i={0};
  for(i=2; i<=Ndx; i++)
    {
      strcpy(Stk[i],RemoveStr(Stk[i],"#"));
    }
  if(strcmp(Stk[2],"(")==0){
      strcpy(Stk[2],Stk[3]);
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  if(CheckLocal(Stk[2],&(i))==vt_UNKNOWN ){
      AddGlobal(Stk[2],vt_FILEPTR);
    }
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"SetEof(",Stk[2],");");
  return 0;
}

int Emit_FwriteProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UNREFERENCED_PARAMETER(sWord);
  int i;
  char LZZ[BCXSTRSIZE];
  char L_Handle[BCXSTRSIZE];
  strcpy(Stk[2],RemoveStr(Stk[2],"#"));
  if(ISNULL(Stk[2])){
      Abort("Bad WRITE Argument");
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  if(CheckLocal(Stk[2],&(i))==vt_UNKNOWN ){
      AddGlobal(Stk[2],vt_FILEPTR);
    }
  *L_Handle=0;
  for(int j=2; j<=Ndx; j++)
    {
      if(m_iMatchWrd(Stk[j],",")||m_iMatchWrd(Stk[j],";")){
          *Stk[j]=0;
          goto L1425;
        }
      strcat(L_Handle,Stk[j]);
      *Stk[j]=0;
    }
L1425:;
  strcat(L_Handle,"@");
  strcpy(LZZ, join(2,"f",PrintWriteFormat(1)));
  strcpy(LZZ, join(4,left(LZZ,8),No_Sigil(L_Handle),",",mid(LZZ,9)));
  fprintf(FP_WRITE,"%s%s\n",Scoot,LZZ);
  return 0;
}

int Emit_StringProcs (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"midstr")==0){
      *Src=0;
      for(int A=1; A<=Ndx; A++)
        {
          strcat(Src,No_Sigil(Stk[A]));
        }
      fprintf(FP_WRITE,"%s%s%s\n",Scoot,trim(Src),";");
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

int Emit_MathProcs (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"incr")==0){
      int j={0};
      fprintf(FP_WRITE,"%s",Scoot);
      for(int i=2; i<=Ndx; i++)
        {
          if(*Stk[i]==44 ){
              fprintf(FP_WRITE,"%s","+=(");
              j=TRUE;
            }
          else
            {
              fprintf(FP_WRITE,"%s",No_Sigil(Stk[i]));
            }
        }
      fprintf(FP_WRITE,"%s\n",sziif(j,");","++;"));
      goto L1428;
    }
  if(strcmp(sWord,"decr")==0){
      int j={0};
      fprintf(FP_WRITE,"%s",Scoot);
      for(int i=2; i<=Ndx; i++)
        {
          if(*Stk[i]==44 ){
              fprintf(FP_WRITE,"%s","-=(");
              j=TRUE;
            }
          else
            {
              fprintf(FP_WRITE,"%s",No_Sigil(Stk[i]));
            }
        }
      fprintf(FP_WRITE,"%s\n",sziif(j,");","--;"));
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1428:;

  return 0;
}

int Emit_ConsoleOnlyProcs (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"print")==0){
      fprintf(FP_WRITE,"%s%s\n",Scoot,PrintWriteFormat(0));
      goto L1431;
    }
  if(strcmp(sWord,"locate")==0){
      if(NoMain==TRUE||MakeDLL==TRUE ){
          Use_Console=TRUE;
        }
      fprintf(FP_WRITE,"%s%s",Scoot,"locate(");
      strcpy(Stk[++Ndx],");");
      WriteCleanTokens(2,Ndx);
      goto L1431;
    }
  if(strcmp(sWord,"panel")==0){
      if(NoMain==TRUE||MakeDLL==TRUE ){
          Use_Console=TRUE;
        }
      fprintf(FP_WRITE,"%s%s",Scoot,"panel(");
      strcpy(Stk[++Ndx],");");
      WriteCleanTokens(2,Ndx);
      goto L1431;
    }
  if(strcmp(sWord,"cls")==0){
      if(NoMain==TRUE||MakeDLL==TRUE ){
          Use_Console=TRUE;
        }
      fprintf(FP_WRITE,"%s%s\n",Scoot,"cls();");
      goto L1431;
    }
  if(strcmp(sWord,"color")==0){
      if(NoMain==TRUE||MakeDLL==TRUE ){
          Use_Console=TRUE;
        }
      fprintf(FP_WRITE,"%s%s",Scoot,"color(");
      strcpy(Stk[++Ndx],");");
      WriteCleanTokens(2,Ndx);
      goto L1431;
    }
  if(strcmp(sWord,"textmode")==0){
      char LTmp[BCXSTRSIZE];
      BuildCleanStr(2,Ndx,LTmp);
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"TextMode(",LTmp,");");
      goto L1431;
    }
  if(strcmp(sWord,"delay")==0){
      char LTmp[BCXSTRSIZE];
      BuildCleanStr(2,Ndx,LTmp);
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"Sleep(1000*",LTmp,");");
      goto L1431;
    }
  if(strcmp(sWord,"write")==0){
      fprintf(FP_WRITE,"%s%s\n",Scoot,PrintWriteFormat(1));
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1431:;

  return 0;
}

int ValidExitStatement ()
{
  char RightTerm[BCXSTRSIZE]={0};
  strcpy(RightTerm,lcase(Stk[2]));
  if(strcmp(RightTerm,"sub")==0  || strcmp(RightTerm,"function")==0  || strcmp(RightTerm,"for")==0  || strcmp(RightTerm,"xfor")==0  || strcmp(RightTerm,"do")==0  || strcmp(RightTerm,"while")==0  || strcmp(RightTerm,"select")==0  || strcmp(RightTerm,"nest")==0  || strcmp(RightTerm,"loop")==0  || strcmp(RightTerm,"repeat")==0){
      return TRUE;
    }
  return FALSE;
}

int Emit_ControlFlow (char* sWord,PINT  FuncRetnFlag)
{
  static int  iFallThrough;
  if(strcmp(sWord,"exit")==0){
      if(ValidExitStatement()==FALSE ){
          Abort("Expected to find EXIT: sub|function|for|xfor|do|while|select|nest|loop|repeat");
        }
      if(SelectState[StateIdx].CaseFlag ){
          SelectState[StateIdx].NoBreak=TRUE;
        }
      char szL_Stk2[BCXSTRSIZE]={0};
      int iLoops1={0};
      int iLoops2={0};
      for(iLoops1=2; iLoops1<=Ndx; iLoops1++)
        {
          if(*Stk[iLoops1]==44 ){
              continue;
            }
          strcpy(szL_Stk2,lcase(Stk[iLoops1]));
          if(strcmp(szL_Stk2,"sub")==0){
              if(COM_lc_names_index>0 ){
                  Free_Com_Objects(FALSE);
                }
              if(NOTZERO(LocalDynaCnt)){
                  for(int j=1; j<=LocalDynaCnt; j++)
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,DynaStr[j]);
                    }
                }
              if(NOTZERO(LocalDynArrCnt)){
                  for(int i=1; i<=LocalDynArrCnt; i++)
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,LocalDynArrName[i]);
                    }
                }
              fprintf(FP_WRITE,"%s%s\n",Scoot,"return;");
              goto L1435;
            }
          if(strcmp(szL_Stk2,"function")==0){
              if(NOTZERO(LocalDynaCnt)){
                  for(int j=1; j<=LocalDynaCnt; j++)
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,DynaStr[j]);
                    }
                }
              if(NOTZERO(LocalDynArrCnt)){
                  for(int i=1; i<=LocalDynArrCnt; i++)
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,LocalDynArrName[i]);
                    }
                }
              fprintf(FP_WRITE,"%s%s\n",Scoot,"return 0;");
              goto L1435;
            }
          if(strcmp(szL_Stk2,"for")==0){
              static char LszTmp[BCXSTRSIZE];
              static int i;
              for(i=LoopTypeCnt-iLoops2; !(LoopType[i].iLoopType==lt_FORNEXT||i==0);i--)
                {
                }
              if(i ){
                  if(i!=LoopTypeCnt-iLoops2 ){
                      if(TestState ){
                          Warning_ID(eExitingMoreThan1Loop,1);
                        }
                    }
                  iLoops2=LoopTypeCnt-i+1;
                  if(iLoops1==Ndx ){
                      Generate_Goto(i,1);
                    }
                }
              else
                {
                  strcpy(LszTmp,"No FOR to exit from. Inner most loop is ");
                  strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
                  Abort(LszTmp);
                }
              goto L1435;
            }
          if(strcmp(szL_Stk2,"xfor")==0){
              static char LszTmp[BCXSTRSIZE];
              static int i;
              for(i=LoopTypeCnt-iLoops2; !(LoopType[i].iLoopType==lt_FORXNEXT||i==0);i--)
                {
                }
              if(i ){
                  if(i!=LoopTypeCnt-iLoops2 ){
                      if(TestState ){
                          Warning_ID(eExitingMoreThan1Loop,1);
                        }
                    }
                  iLoops2=LoopTypeCnt-i+1;
                  if(iLoops1==Ndx ){
                      Generate_Goto(i,1);
                    }
                }
              else
                {
                  strcpy(LszTmp,"No XFOR to exit from. Inner most loop is ");
                  strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
                  Abort(LszTmp);
                }
              goto L1435;
            }
          if(strcmp(szL_Stk2,"do")==0){
              static char LszTmp[BCXSTRSIZE];
              static int i;
              for(i=LoopTypeCnt-iLoops2; !(LoopType[i].iLoopType==lt_DOLOOP||LoopType[i].iLoopType==lt_DOUNTILLOOP||LoopType[i].iLoopType==lt_DOWHILELOOP||i==0);i--)
                {
                }
              if(i ){
                  if(i!=LoopTypeCnt-iLoops2 ){
                      if(TestState ){
                          Warning_ID(eExitingMoreThan1Loop,1);
                        }
                    }
                  iLoops2=LoopTypeCnt-i+1;
                  if(iLoops1==Ndx ){
                      Generate_Goto(i,1);
                    }
                }
              else
                {
                  strcpy(LszTmp,"No DO to exit from. Inner most loop is ");
                  strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
                  Abort(LszTmp);
                }
              goto L1435;
            }
          if(strcmp(szL_Stk2,"while")==0){
              static char LszTmp[BCXSTRSIZE];
              static int i;
              for(i=LoopTypeCnt-iLoops2; !(LoopType[i].iLoopType==lt_WHILEWEND||i==0);i--)
                {
                }
              if(i ){
                  if(i!=LoopTypeCnt-iLoops2 ){
                      if(TestState ){
                          Warning_ID(eExitingMoreThan1Loop,1);
                        }
                    }
                  iLoops2=LoopTypeCnt-i+1;
                  if(iLoops1==Ndx ){
                      Generate_Goto(i,1);
                    }
                }
              else
                {
                  strcpy(LszTmp,"No WHILE to exit from. Inner most loop is ");
                  strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
                  Abort(LszTmp);
                }
              goto L1435;
            }
          if(strcmp(szL_Stk2,"select")==0){
              static char LszTmp[BCXSTRSIZE];
              static int i;
              for(i=LoopTypeCnt-iLoops2; !(LoopType[i].iLoopType==lt_SELECT||i==0);i--)
                {
                }
              if(i ){
                  if(i!=LoopTypeCnt-iLoops2 ){
                      if(TestState ){
                          Warning_ID(eExitingMoreThan1Loop,1);
                        }
                    }
                  iLoops2=LoopTypeCnt-i+1;
                  if(iLoops1==Ndx ){
                      Generate_Goto(i,1);
                      SelectState[StateIdx].CaseFlag++;
                    }
                }
              else
                {
                  strcpy(LszTmp,"No SELECT to exit from. Inner most loop is ");
                  strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
                  Abort(LszTmp);
                }
              goto L1435;
            }
          if(strcmp(szL_Stk2,"nest")==0){
              static char LszTmp[BCXSTRSIZE];
              static int i;
              if(LoopTypeCnt==0 ){
                  Abort("Too many end loops");
                }
              for(i=LoopTypeCnt-iLoops2; !(LoopType[i].iLoopType!=LoopType[LoopTypeCnt-iLoops2].iLoopType);i--)
                {
                }
              strcpy(LszTmp,"Exiting from nested control loops. Outer to inner control loops are ");
              strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
              if(TestState ){
                  Warning(LszTmp,1);
                }
              i++;
              iLoops2=LoopTypeCnt-i+1;
              if(iLoops1==Ndx ){
                  Generate_Goto(i,1);
                }
            }
          else
            {
              static char LszTmp[BCXSTRSIZE];
              strcpy(LszTmp,"Exiting from a misnamed or unnamed control loop.  Expected: EXIT ");
              strcat(LszTmp,LoopTypeName(LoopType[LoopTypeCnt].iLoopType));
              if(TestState ){
                  Warning(LszTmp,1);
                }
              if(iLoops1==Ndx ){
                  Generate_Goto(LoopTypeCnt-iLoops2,1);
                }
              iLoops2++;
            }

L1435:;

        }
      goto L1433;
    }
  if(strcmp(sWord,"repeat")==0){
      char LTmp[BCXSTRSIZE]={0};
      for(int i=2; i<=Ndx; i++)
        {
          strcat(LTmp,Stk[i]);
        }
      strcpy(LTmp,No_Sigil(LTmp));
      BumpUp();
      if(inchr(Stk[2],"-")){
          if(LeftStr(LTmp,"-")){
              strcpy(LTmp,mid(LTmp,2));
            }
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"for(int BCX_REPEAT = ",LTmp,"; BCX_REPEAT >= 1; BCX_REPEAT--)");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"for(int BCX_REPEAT = 1; BCX_REPEAT <= ",LTmp,"; BCX_REPEAT++)");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
        }
      BumpUp();
      goto L1433;
    }
  if(strcmp(sWord,"endrepeat")==0){
      BumpDown("Too many unindents in REPEAT/END REPEAT");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      BumpDown("Too many unindents in REPEAT/END REPEAT");
      goto L1433;
    }
  if(strcmp(sWord,"while")==0){
      Emit_IfCond("while",eFull);
      if(iDoWhile ){
          LoopType[++LoopTypeCnt].iLoopType=iDoWhile;
        }
      else
        {
          LoopType[++LoopTypeCnt].iLoopType=lt_WHILEWEND;
        }
      LoopType[LoopTypeCnt].iJumpTo=LabelGenerator++;
      *LoopType[LoopTypeCnt].szUseNeedLabel=0;
      iDoWhile=0;
      LoopType[LoopTypeCnt].iLoopLine=LineNum[FileNdx];
      InBlockSet();
      goto L1433;
    }
  if(strcmp(sWord,"wend")==0  || strcmp(sWord,"endwhile")==0){
      InBlockReSet();
      if(LoopTypeCnt==0 ){
          Abort("Too many end loops");
        }
      if(LoopType[LoopTypeCnt].iLoopType!=lt_WHILEWEND ){
          char sErr[BCXSTRSIZE];
          strcpy(sErr, join(4,LoopTypeName(LoopType[LoopTypeCnt].iLoopType)," at",str(LoopType[LoopTypeCnt].iLoopLine)," closed with WEND"));
          Abort(sErr);
        }
      BumpDown("Error in Emit_ControlFlow() CASE wend, endwhile");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      if(LoopType[LoopTypeCnt].szUseNeedLabel[0]!=0 ){
          fprintf(FP_WRITE,"%s\n",LoopType[LoopTypeCnt].szUseNeedLabel);
        }
      LoopTypeCnt--;
      BumpDown("Unbalanced LOOP");
      goto L1433;
    }
  if(strcmp(sWord,"prepend")==0){
      PrependCnt++;
      if(PrependCnt==c_PrependVarSize ){
          Abort("Prepend depth exceeded");
        }
      BuildDelimStr(2,Ndx,PrependVar[PrependCnt]);
      goto L1433;
    }
  if(strcmp(sWord,"endprepend")==0){
      PrependCnt--;
      if(PrependCnt<0 ){
          Abort("Too many END PREPENDs.");
        }
      goto L1433;
    }
  if(strcmp(sWord,"with")==0){
      WithCnt++;
      if(WithCnt==c_WithVarSize ){
          Abort("[With] depth exceeded");
        }
      BuildStr(2,Ndx,WithVar[WithCnt]);
      goto L1433;
    }
  if(strcmp(sWord,"endwith")==0){
      if(COM_open_WITH_statement ){
          if(COM_open_WITH_statement>1 ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_dispatch_storage_index--;");
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_dispatch_at_offset = COM_dispatch_storage[COM_dispatch_storage_index];");
            }
          else
            {
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_dispatch_at_offset = 0;");
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_dispatch_storage_index = 0;");
            }
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_reset_disp_chain(&",COM_with_temp_str_name,");");
          COM_open_WITH_statement--;
        }
      else
        {
          WithCnt--;
        }
      goto L1433;
    }
  if(strcmp(sWord,"goto")==0){
      if(SelectState[StateIdx].CaseFlag ){
          SelectState[StateIdx].NoBreak=TRUE;
        }
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"goto ",ucase(Stk[2]),";");
      goto L1433;
    }
  if(strcmp(sWord,"gosub")==0){
      Use_GoSub=TRUE;
      fprintf(FP_WRITE,"%s%s\n",Scoot,"#if defined(__MINGW64__)");
      fprintf(FP_WRITE,"%s%s",Scoot,"if (__builtin_setjmp(GosubStack[GosubNdx++])==0)");
      fprintf(FP_WRITE,"%s%s%s\n"," goto ",ucase(Stk[2]),";");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"#else");
      fprintf(FP_WRITE,"%s%s",Scoot,"if (setjmp(GosubStack[GosubNdx++])==0)");
      fprintf(FP_WRITE,"%s%s%s\n"," goto ",ucase(Stk[2]),";");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"#endif");
      goto L1433;
    }
  if(strcmp(sWord,"return")==0){
      if(Ndx>1 ){
          char Convert[BCXSTRSIZE];
          strcpy(Convert,"FUNCTION = ");
          for(int i=2; i<=Ndx; i++)
            {
              strcpy(Convert, join(3,Convert,Stk[i],SPC));
            }
          Inject(Convert);
          return 0;
        }
      else
        {
          Use_GoSub=TRUE;
          fprintf(FP_WRITE,"%s%s\n",Scoot,"#if defined(__MINGW64__)");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"__builtin_longjmp (GosubStack [--GosubNdx],1);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"#else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"longjmp (GosubStack [--GosubNdx],1);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"#endif");
          fprintf(FP_WRITE,"%s\n","");
        }
      goto L1433;
    }
  if(strcmp(sWord,"fallthrough")==0){
      iFallThrough=TRUE;
      goto L1433;
    }
  if(strcmp(sWord,"case")==0){
      if(SelectState[StateIdx].iStartCase==0 ){
          InBlockReSet();
        }
      SelectState[StateIdx].iStartCase=0;
      InBlockSet();
      for(int i=2; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],"!=")==0){
              strcpy(Stk[i],"<>");
            }
          if(*Stk[i]==37&&*Stk[i+1]!=61 ){
              strcpy(Stk[i]," % ");
            }
          if(*Stk[i]==33&&*Stk[i+1]==61 ){
              strcpy(Stk[i],"<>");
              *Stk[i+1]=0;
            }
          if(*Stk[i]==60&&*Stk[i+1]==62 ){
              strcpy(Stk[i],"<>");
              *Stk[i+1]=0;
            }
          if(*Stk[i]==61&&*Stk[i+1]==60 ){
              strcpy(Stk[i],"<=");
              *Stk[i+1]=0;
            }
          if(*Stk[i]==60&&*Stk[i+1]==61 ){
              strcpy(Stk[i],"<=");
              *Stk[i+1]=0;
            }
          if(*Stk[i]==61&&*Stk[i+1]==62 ){
              strcpy(Stk[i],">=");
              *Stk[i+1]=0;
            }
          if(*Stk[i]==62&&*Stk[i+1]==61 ){
              strcpy(Stk[i],">=");
              *Stk[i+1]=0;
            }
          if(isalpha(*Stk[i])){
              strcpy(Stk[i], join(2,Stk[i],SPC));
            }
        }
      *gTmpStr=0;
      For_Next_Error_Detected=FALSE;
      if(DataType(CaseVar)==vt_STRVAR ){
          For_Next_Error_Detected=TRUE;
        }
      int ss={0};
      int idx={0};
      if(CheckLocal(CaseVar,&(idx))==vt_CHAR ){
          ss=TRUE;
        }
      if(CheckLocal(CaseVar,&(idx))==vt_SCHAR ){
          ss=TRUE;
        }
      if(CheckGlobal(CaseVar,&(idx))==vt_CHAR ){
          ss=TRUE;
        }
      if(CheckGlobal(CaseVar,&(idx))==vt_SCHAR ){
          ss=TRUE;
        }
      if(CheckLocal(CaseVar,&(idx))==vt_STRVAR ){
          ss=TRUE;
        }
      if(CheckGlobal(CaseVar,&(idx))==vt_STRVAR ){
          ss=TRUE;
        }
      if(ss==TRUE ){
          strcat(CaseVar,"$");
        }
      int i={0};
      for(int A=2; A<=Ndx; A++)
        {
          if(inchr("([",Stk[A])){
              i++;
            }
          if(inchr(")]",Stk[A])){
              i--;
            }
          if(i ){
              strcat(gTmpStr,Stk[A]);
              continue;
            }
          if(strcmp(Stk[A],",")==0){
              if(!inchr("<>=",Stk[A+1])){
                  strcpy(gTmpStr, join(4,gTmpStr," or ",CaseVar,"="));
                }
              else
                {
                  strcpy(gTmpStr, join(3,gTmpStr," or ",CaseVar));
                }
              *Stk[A]=0;
              continue;
            }
          if(strcmp(Stk[A],"&&")==0){
              strcpy(gTmpStr, join(3,gTmpStr," and ",CaseVar));
              *Stk[A]=0;
            }
          else if(strcmp(Stk[A],"||")==0){
              strcpy(gTmpStr, join(3,gTmpStr," or ",CaseVar));
              *Stk[A]=0;
            }
          else
            {
              strcat(gTmpStr,Stk[A]);
            }
        }
      char szDrop[BCXSTRSIZE]={0};
      if(SelectState[StateIdx].CaseFlag==0 ){
          SelectState[StateIdx].NoBreak=0;
        }
      if(SelectState[StateIdx].CaseFlag ){
          char LszTmp[BCXSTRSIZE]={0};
          if(iFallThrough==FALSE ){
              SelectState[StateIdx].CaseFlag--;
              if(SelectState[StateIdx].NoBreak==0 ){
                  if(SelectState[StateIdx].NoBreak==0 ){
                      SelectState[StateIdx].CaseFlag++;
                      sprintf(LszTmp,"goto L%i;",SelectState[StateIdx].iJumpTo);
                      fprintf(FP_WRITE,"%s%s\n",Scoot,LszTmp);
                    }
                }
            }
          else
            {
              sprintf(szDrop,"L%i",LabelGenerator);
              sprintf(LszTmp,"goto L%i;",LabelGenerator++);
              strcat(szDrop,":");
              fprintf(FP_WRITE,"%s%s\n",Scoot,LszTmp);
              SelectState[StateIdx].CaseFlag--;
            }
          BumpDown("Unbalanced SELECT");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
          BumpDown("Unbalanced SELECT");
        }
      SelectState[StateIdx].CaseFlag++;
      if(m_iMatchLft(CaseVar," BAND ")){
          SelectState[StateIdx].NoBreak=1;
          strcpy(Src, join(4,"IF ",gTmpStr,CaseVar," Then "));
        }
      else
        {
          if(inchr("<>=",gTmpStr)&&!IsQuoted(gTmpStr)){
              strcpy(Src, join(4,"IF ",CaseVar,gTmpStr," Then "));
            }
          else
            {
              strcpy(Src, join(5,"IF ",CaseVar," = ",gTmpStr," Then "));
            }
        }
      Inject(Src);
      if(iFallThrough ){
          Inject(szDrop);
        }
      iFallThrough=FALSE;
      goto L1433;
    }
  if(strcmp(sWord,"select")==0){
      LoopType[++LoopTypeCnt].iLoopType=lt_SELECT;
      LoopType[LoopTypeCnt].iJumpTo=LabelGenerator++;
      Generate_Goto(LoopTypeCnt,0);
      LoopType[LoopTypeCnt].iLoopLine=LineNum[FileNdx];
      BuildStr(3,Ndx,CaseVar);
      PushSelectState(CaseVar);
      SelectState[StateIdx].iStartCase=1;
      SelectState[StateIdx].CaseFlag=0;
      SelectState[StateIdx].iJumpTo=LoopType[LoopTypeCnt].iJumpTo;
      iFallThrough=FALSE;
      goto L1433;
    }
  if(strcmp(sWord,"caseelse")==0){
      if(SelectState[StateIdx].iStartCase==0 ){
          InBlockReSet();
        }
      InBlockSet();
      SelectState[StateIdx].iStartCase=0;
      SelectState[StateIdx].CaseElseFlag=TRUE;
      if(SelectState[StateIdx].CaseFlag ){
          BumpDown("Unbalanced SELECT");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
          BumpDown("Unbalanced SELECT");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"else");
          BumpUp();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
          BumpUp();
        }
      goto L1433;
    }
  if(strcmp(sWord,"endselect")==0){
      if(SelectState[StateIdx].iStartCase==0 ){
          InBlockReSet();
        }
      if(LoopTypeCnt==0 ){
          Abort("Too many end loops");
        }
      if(LoopType[LoopTypeCnt--].iLoopType!=lt_SELECT ){
          static char sErr[BCXSTRSIZE];
          strcpy(sErr, join(4,LoopTypeName(LoopType[LoopTypeCnt+1].iLoopType)," at",str(LoopType[LoopTypeCnt+1].iLoopLine)," closed with END SELECT"));
          Abort(sErr);
        }
      if(SelectState[StateIdx].CaseFlag==0 ){
          if(SelectState[StateIdx].CaseElseFlag==0 ){
              Abort("Missing case statement before select end");
            }
          else
            {
              Abort("Missing case statement before case else");
            }
        }
      BumpDown("Unbalanced SELECT");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      BumpDown("Unbalanced SELECT");
      if(SelectState[StateIdx].CaseFlag>1 ){
          static char LszTmp[BCXSTRSIZE];
          sprintf(LszTmp,"L%i:;",SelectState[StateIdx].iJumpTo);
          fprintf(FP_WRITE,"%s%s%s\n",CRLF,LszTmp,CRLF);
        }
      SelectState[StateIdx].NoBreak=SelectState[StateIdx].CaseElseFlag=0;
      PopSelectState(CaseVar);
      goto L1433;
    }
  if(strcmp(sWord,"for")==0){
      if(m_iMatchWrd(Stk[2],"each")){
          char foreachlocal[BCXSTRSIZE];
          char temp_parms[BCXSTRSIZE];
          char ComVar[BCXSTRSIZE];
          strcpy(ComVar,Stk[3]);
          Use_COM_Collections=Use_COM=ComSwitchON=TRUE;
          fprintf(FP_WRITE,"%s%s\n",Scoot," VariantClear(&COM_ack_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot," COM_enum_var = NULL;");
          fprintf(FP_WRITE,"%s%s\n",Scoot," COM_long_coll = 0;");
          if(!IsVariableComObject(ComVar)){
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"OBJECT ",ComVar,";");
            }
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"ZeroMemory((PVOID)&",ComVar,",sizeof(OBJECT));");
          LoopLocalVar[LoopLocalCnt++]=0;
          COM_FOREACH_enumerator=TRUE;
          strcpy(foreachlocal,mid(Src,instr(Src," in ",1,1)+3));
          if(!IsVariableComObject(ComVar)){
              Add_Com_Local_Var(ComVar);
            }
          if(inchr(foreachlocal,".")){
              COM_Parse_GetProperty("COM_ack_var",foreachlocal);
              strcpy(temp_parms,trim(extract(foreachlocal,".")));
            }
          else
            {
              strcpy(temp_parms,trim(foreachlocal));
            }
          COM_FOREACH_enumerator=FALSE;
          fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_GetEnum_iface = TRUE;");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_invoke(&",temp_parms,", L",DDQ,",");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"DISPATCH_PROPERTYGET|DISPATCH_METHOD, &COM_ack_var);");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_reset_disp_chain(&",temp_parms,");");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_GetEnum_iface = FALSE;\n");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"for(;;) { // for each construction ...");
          BumpUp();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR,_T(",enc("Get object enumerator: No Collections!"),"));");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_ack_var.vt != VT_DISPATCH && COM_ack_var.vt != VT_UNKNOWN) {");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  COM_last_HR = E_NOINTERFACE;");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR,_T(",enc("Enum interface not available! Collections unavailable!"),"));");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  VariantClear(&COM_ack_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_ack_var.vt == VT_DISPATCH) {");
          BumpUp();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #ifdef __cplusplus");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  COM_last_HR = COM_ack_var.pdispVal");
          fprintf(FP_WRITE,"%s%s\n",Scoot," ->QueryInterface(IID_IEnumVARIANT, (void **)&COM_enum_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"   COM_last_HR = COM_ack_var.pdispVal->lpVtbl");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  ->QueryInterface(COM_ack_var.pdispVal,");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"   &IID_IEnumVARIANT, (void **)&COM_enum_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"#endif\n");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"   COM_HR_ErrMsg (COM_last_HR,_T(",enc("QueryInterface: Get enum variant: No Collections!"),"));");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"   VariantClear(&COM_ack_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"   break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
          BumpDown("");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} else if (COM_ack_var.vt == VT_UNKNOWN) {");
          BumpUp();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #ifdef __cplusplus");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    COM_last_HR = COM_ack_var.punkVal");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    ->QueryInterface(IID_IEnumVARIANT, (void **)&COM_enum_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    COM_last_HR = COM_ack_var.punkVal->lpVtbl");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"   ->QueryInterface(COM_ack_var.punkVal, ");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    &IID_IEnumVARIANT, (void **)&COM_enum_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"#endif\n");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR,_T(",enc("QueryInterface: Get enum variant: No Collections!"),"));");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  VariantClear(&COM_ack_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
          BumpDown("");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"VariantClear(&COM_ack_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}\n");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  while(COM_enum_var) {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    BCX_SetNothing(&",ComVar,");");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    #ifdef __cplusplus");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"      COM_last_HR = COM_enum_var");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    ->Next(1, &",ComVar,".pObjects[0], &COM_long_coll);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    #else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"      COM_last_HR = COM_enum_var->lpVtbl");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    ->Next(COM_enum_var, 1, &",ComVar,".pObjects[0], &COM_long_coll);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    #endif");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    if (FAILED(COM_last_HR)) {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      COM_HR_ErrMsg (COM_last_HR,_T(",enc("Enumeration failed! No Collections!"),"));");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    #ifdef __cplusplus");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"       if(COM_enum_var) COM_enum_var->Release();");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    #else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"       if(COM_enum_var) COM_enum_var->lpVtbl");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"      ->Release(COM_enum_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    #endif");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    COM_enum_var = NULL;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  } ");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  if (",ComVar,".pObjects[0].vt != VT_DISPATCH)");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    {");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      VariantClear(&",ComVar,".pObjects[0]);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"      COM_long_coll = 0;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    }");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    { ");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",ComVar,".pStatus = TRUE;");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",ComVar,".ipointer = 0;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"      COM_objects_cnt++;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    }");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  if (0 == COM_long_coll) {");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #ifdef __cplusplus");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"     if(COM_enum_var) COM_enum_var->Release();");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #else");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"     if(COM_enum_var) COM_enum_var->lpVtbl");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"    ->Release(COM_enum_var);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  #endif");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  BCX_SetNothing(&",ComVar,");");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  COM_enum_var = NULL;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  break;");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
          BumpUp();
        }
      else
        {
          int FFlg={0};
          int For1={0};
          int For2={0};
          int For3={0};
          int For4={0};
          char Reg[BCXSTRSIZE]={0};
          char xxx[BCXSTRSIZE]={0};
          char yyy[BCXSTRSIZE]={0};
          char zzz[BCXSTRSIZE]={0};
          char qqq[BCXSTRSIZE]={0};
          char Lvar[BCXSTRSIZE]={0};
          char Scratch[BCXSTRSIZE]={0};
          *Scratch=0;
          for(long zz=1; zz<=Ndx; zz++)
            {
              strcpy(Scratch, join(3,Scratch,SPC,Stk[zz]));
            }
          strcpy(Scratch,VB2BCX(Scratch));
          FastLexer(Scratch,SPC,c_FULLSET);
          for(int i=Ndx; i>=1; i+=-1)
            {
              if(m_iMatchWrd(Stk[i],"step")){
                  FFlg=TRUE;
                  goto L1451;
                }
            }
L1451:;
          if(!FFlg ){
              Ndx++;
              strcpy(Stk[Ndx],"step");
              Ndx++;
              strcpy(Stk[Ndx],"1");
            }
          For_Next_Error_Detected=FALSE;
          for(int i=1; i<=Ndx; i++)
            {
              if(*Stk[i]==61 ){
                  For_Next_Error_Detected=TRUE;
                }
            }
          if(For_Next_Error_Detected==FALSE ){
              Abort("Missing =");
            }
          For_Next_Error_Detected=FALSE;
          for(int i=1; i<=Ndx; i++)
            {
              if(m_iMatchWrd(Stk[i],"to")){
                  For_Next_Error_Detected=TRUE;
                }
            }
          if(For_Next_Error_Detected==FALSE ){
              Abort("Missing TO");
            }
          strcpy(Reg,lcase(Stk[2]));
          if(strcmp(Reg,"char")==0  || strcmp(Reg,"sbyte")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"signed char ");
              goto L1454;
            }
          if(strcmp(Reg,"uchar")==0  || strcmp(Reg,"ubyte")==0  || strcmp(Reg,"byte")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"unsigned char ");
              goto L1454;
            }
          if(strcmp(Reg,"int")==0  || strcmp(Reg,"fint")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"int ");
              goto L1454;
            }
          if(strcmp(Reg,"uint")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"unsigned int ");
              goto L1454;
            }
          if(strcmp(Reg,"long")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"long ");
              goto L1454;
            }
          if(strcmp(Reg,"ulong")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"unsigned long ");
              goto L1454;
            }
          if(strcmp(Reg,"llong")==0  || strcmp(Reg,"longlong")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"long long ");
              goto L1454;
            }
          if(strcmp(Reg,"ulonglong")==0  || strcmp(Reg,"uint64")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"unsigned long long ");
              goto L1454;
            }
          if(strcmp(Reg,"short")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"short ");
              goto L1454;
            }
          if(strcmp(Reg,"ushort")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"unsigned short ");
              goto L1454;
            }
          if(strcmp(Reg,"single")==0  || strcmp(Reg,"float")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"float ");
              goto L1454;
            }
          if(strcmp(Reg,"size_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"size_t ");
              goto L1454;
            }
          if(strcmp(Reg,"ssize_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"SSIZE_T");
              goto L1454;
            }
          if(strcmp(Reg,"int8_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"int8_t ");
              goto L1454;
            }
          if(strcmp(Reg,"int16_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"int16_t ");
              goto L1454;
            }
          if(strcmp(Reg,"int32_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"int32_t ");
              goto L1454;
            }
          if(strcmp(Reg,"int64_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"int64_t ");
              goto L1454;
            }
          if(strcmp(Reg,"uint8_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"uint8_t ");
              goto L1454;
            }
          if(strcmp(Reg,"uint16_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"uint16_t ");
              goto L1454;
            }
          if(strcmp(Reg,"uint32_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"uint32_t ");
              goto L1454;
            }
          if(strcmp(Reg,"uint64_t")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"uint64_t ");
              goto L1454;
            }
          if(strcmp(Reg,"double")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"double ");
              goto L1454;
            }
          if(strcmp(Reg,"ldouble")==0){
              strcpy(Reg,SPC);
              LoopLocalVar[LoopLocalCnt++]=1;
              strcpy(Lvar,"long double ");
              Use_Ldouble=TRUE;
            }
          else
            {
              *Reg=0;
              LoopLocalVar[LoopLocalCnt++]=0;
            }

L1454:;

          if(*Reg ){
              for(int j=3; j<=Ndx; j++)
                {
                  strcpy(Stk[j-1],Stk[j]);
                }
              Ndx--;
            }
          for(int i=2; i<=Ndx; i++)
            {
              if(strcmp(Stk[i],"=")==0){
                  For1=i-1;
                  goto L1456;
                }
            }
L1456:;
          for(int i=For1+2; i<=Ndx; i++)
            {
              if(m_iMatchWrd(Stk[i],"to")){
                  For2=i-1;
                  goto L1457;
                }
            }
L1457:;
          for(int i=For2+2; i<=Ndx; i++)
            {
              if(m_iMatchWrd(Stk[i],"step")){
                  For3=i-1;
                  goto L1458;
                }
            }
L1458:;
          For4=For3+2;
          BuildCleanStr(2,For1,xxx);
          BuildCleanStr(For1+2,For2,yyy);
          BuildCleanStr(For2+2,For3,zzz);
          BuildCleanStr(For4,Ndx,qqq);
          strcpy(Reg,Lvar);
          if(IsDecimalNumber(qqq)){
              if(LeftStr(qqq,"-")){
                  if(strcmp(qqq,"1")==0){
                      fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,"for(",Reg,xxx,"=",yyy,"; ",xxx,">=",zzz,"; ",xxx,"++)");
                    }
                  else
                    {
                      if(strcmp(qqq,"1")==0){
                          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,"for(",Reg,xxx,"=",yyy,"; ",xxx,">=",zzz,"; ",xxx,"++)");
                        }
                      else
                        {
                          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,"for(",Reg,xxx,"=",yyy,"; ",xxx,">=",zzz,"; ",xxx,"+=",qqq,")");
                        }
                    }
                }
              else
                {
                  if(strcmp(qqq,"1")==0){
                      fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,"for(",Reg,xxx,"=",yyy,"; ",xxx,"<=",zzz,"; ",xxx,"++)");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,"for(",Reg,xxx,"=",yyy,"; ",xxx,"<=",zzz,"; ",xxx,"+=",qqq,")");
                    }
                }
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,"for(",Reg,xxx,"=",yyy,"; (",qqq,">=0 ? ",xxx,"<=",zzz," : ",xxx,">=",zzz,"); ",xxx,"+=",qqq,")");
            }
          BumpUp();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
          BumpUp();
        }
      LoopType[++LoopTypeCnt].iLoopType=lt_FORNEXT;
      LoopType[LoopTypeCnt].iJumpTo=LabelGenerator++;
      *LoopType[LoopTypeCnt].szUseNeedLabel=0;
      LoopType[LoopTypeCnt].iLoopLine=LineNum[FileNdx];
      InBlockSet();
      goto L1433;
    }
  if(strcmp(sWord,"next")==0){
      InBlockReSet();
      if(LoopTypeCnt==0 ){
          Abort("Too many end loops");
        }
      if(LoopType[LoopTypeCnt].iLoopType!=lt_FORNEXT ){
          char sErr[BCXSTRSIZE];
          strcpy(sErr, join(4,LoopTypeName(LoopType[LoopTypeCnt].iLoopType)," at",str(LoopType[LoopTypeCnt].iLoopLine)," closed with NEXT"));
          Abort(sErr);
        }
      BumpDown("Unbalanced FOR/NEXT");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      LoopLocalVar[LoopLocalCnt]--;
      if(LoopType[LoopTypeCnt].szUseNeedLabel[0]!=0 ){
          fprintf(FP_WRITE,"%s\n",LoopType[LoopTypeCnt].szUseNeedLabel);
        }
      LoopTypeCnt--;
      if(LoopLocalCnt<0 ){
          Abort("Next without For");
        }
      BumpDown("Unbalanced FOR/NEXT");
      goto L1433;
    }
  if(strcmp(sWord,"beginblock")==0){
      InBlockSet();
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
      goto L1433;
    }
  if(strcmp(sWord,"endblock")==0){
      InBlockReSet();
      BumpDown("Unbalanced BLOCK/END BLOCK");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      goto L1433;
    }
  if(strcmp(sWord,"call")==0){
      static char LTmp[BCXSTRSIZE];
      BuildCleanStr(2,Ndx,LTmp);
      if(!m_iMatchRgt(LTmp,")")){
          strcat(LTmp,"()");
        }
      strcat(LTmp,";");
      fprintf(FP_WRITE,"%s%s\n",Scoot,LTmp);
      goto L1433;
    }
  if(strcmp(sWord,"continue")==0){
      fprintf(FP_WRITE,"%s%s\n",Scoot,"continue;");
      goto L1433;
    }
  if(strcmp(sWord,"end")==0){
      if(Ndx==1 ){
          InsertTokens(1,2,"=","0");
        }
      if(strcmp(Stk[2],"=")==0){
          if(Use_Wingui==FALSE ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"fflush(stdout);");
            }
          fprintf(FP_WRITE,"%s%s",Scoot,"ExitProcess(");
          strcpy(Stk[++Ndx],");");
          WriteCleanTokens(3,Ndx);
          goto L1433;
        }
      if(m_iMatchWrd(Stk[2],"if")){
          BumpDown("Unbalanced IF/END IF");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
          BumpDown("Unbalanced IF/END IF");
          goto L1433;
        }
      goto L1433;
    }
  if(strcmp(sWord,"endif")==0){
      BumpDown("Extra unindents at ENDIF");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      BumpDown("Extra unindents at ENDIF");
      goto L1433;
    }
  if(strcmp(sWord,"endprogram")==0){
      fprintf(FP_WRITE,"%s\n","");
      if(Use_Sound ){
          fprintf(FP_WRITE,"%s%s\n",Scoot,"midiOutClose (hMidi);");
        }
      fprintf(FP_WRITE,"%s\n","return EXIT_SUCCESS;    // End of main program");
      fprintf(FP_WRITE,"%s\n","}\n\n");
      EndOfProgram=1;
      goto L1433;
    }
  if(strcmp(sWord,"if")==0){
      Emit_IfCond("if",eFull);
      goto L1433;
    }
  if(strcmp(sWord,"else")==0){
      BumpDown("Unbalanced IF/END IF");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      BumpDown("Unbalanced IF/END IF");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"else");
      BumpUp();
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
      goto L1433;
    }
  if(strcmp(sWord,"elseif")==0){
      BumpDown("Unbalanced IF/END IF");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      BumpDown("Unbalanced IF/END IF");
      Emit_IfCond("else if",eFull);
      goto L1433;
    }
  if(strcmp(sWord,"xfor")==0){
      int iBy={0};
      int iUntil={0};
      int iWhile={0};
      static int Ndx2;
      static int iPB;
      static int iLast;
      static char Stak[128][BCXSTRSIZE];
      static char sClose[BCXSTRSIZE];
      static char lszType[BCXSTRSIZE];
      for(int ii=2; ii<=Ndx; ii++)
        {
          if(m_iMatchWrd(Stk[ii],"while")){
              iWhile=ii;
            }
          if(m_iMatchWrd(Stk[ii],"until")){
              iUntil=ii;
            }
          if(m_iMatchWrd(Stk[ii],"by")){
              iBy=ii;
            }
        }
      if(iWhile==0&&iUntil==0 ){
          Abort("Missing WHILE or UNTIL in XFOR");
        }
      if(iWhile&&iUntil ){
          Abort("Can't have both WHILE and UNTIL in XFOR");
        }
      if(iBy==0 ){
          Abort("Missing BY in XFOR");
        }
      iLast=iWhile+iUntil;
      *lszType=0;
      if(iLast>2 ){
          int i=2;
          int j=3;
          for(;;)
            {
              while(strcmp(Stk[j],"=")!=0){
                  j++;
                }
              if(j-i>1 ){
                  if(lszType[0]!=0 ){
                      strcat(lszType,": RAW ");
                    }
                  strcat(lszType,Stk[j-1]);
                  strcat(lszType," AS");
                  while(i<j-1){
                      strcat(lszType,SPC);
                      strcat(lszType,Stk[i]);
                      *Stk[i++]=0;
                    }
                }
              i=j+1;
              iPB=0;
              while(i<=iLast){
                  if(*Stk[i]==40 ){
                      iPB++;
                    }
                  if(*Stk[i]==41 ){
                      iPB--;
                    }
                  if(*Stk[i]==91 ){
                      iPB++;
                    }
                  if(*Stk[i]==93 ){
                      iPB--;
                    }
                  if(iPB==0 && strcmp(Stk[i],",")==0){
                      goto L1463;
                    }
                  i++;
                }
L1463:;
              i++;
              j=i+1;
              if(i>=iLast ){
                  goto L1460;
                }
            }
L1460:;
        }
      strcpy(Stak[1],"for(");
      strcpy(sClose,"; ");
      int jj=2;
      int ii=2;
      while(ii<=Ndx){
          if(*Stk[ii]!=0 ){
              if(m_iMatchWrd(Stk[ii],"while")){
                  strcpy(Stk[ii],"; ");
                  iLast=jj;
                }
              if(m_iMatchWrd(Stk[ii],"until")){
                  strcpy(Stk[ii],"; !(");
                  strcpy(sClose,");");
                  iLast=jj;
                }
              if(m_iMatchWrd(Stk[ii],"by")){
                  strcpy(Stk[ii],sClose);
                  iBy=jj;
                }
              strcpy(Stak[jj],Stk[ii]);
              jj++;
            }
          ii++;
        }
      Ndx2=jj-1;
      if(NOTNULL(lszType)){
          BumpUp();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
          InBlockSet();
          strcpy(lszType, join(2,"RAW ",lszType));
          LoopLocalVar[LoopLocalCnt++]=1;
          ii=iMatchNQ(lszType,": RAW ");
          while(ii){
              strcpy(Src,left(lszType,ii-1));
              strcpy(lszType,mid(lszType,ii+2));
              PassOne=TRUE;
              Inject(Src);
              ii=iMatchNQ(lszType,": RAW ");
            }
          strcpy(Src,lszType);
          PassOne=TRUE;
          Inject(Src);
        }
      else
        {
          LoopLocalVar[LoopLocalCnt++]=0;
        }
      strcpy(Stk[1],"while");
      for(int k=iLast+1; k<=iBy-1; k++)
        {
          strcpy(Stk[k-iLast+1],Stak[k]);
        }
      Ndx=iBy-iLast;
      *Stk[Ndx+1]=0;
      for(int m=1; m<=Ndx; m++)
        {
          if(strcmp(Stk[m],"&&")==0){
              strcpy(Stk[m],"&& ");
            }
        }
      fprintf(FP_WRITE,"%s",Scoot);
      for(int k=1; k<=Ndx2; k++)
        {
          if(k<=iLast||k>=iBy ){
              fprintf(FP_WRITE,"%s",Stak[k]);
            }
          if(k==iLast ){
              Emit_IfCond("while",ePart);
            }
        }
      fprintf(FP_WRITE,"%s\n",")");
      BumpUp();
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
      LoopType[++LoopTypeCnt].iLoopType=lt_FORXNEXT;
      LoopType[LoopTypeCnt].iJumpTo=LabelGenerator++;
      *LoopType[LoopTypeCnt].szUseNeedLabel=0;
      LoopType[LoopTypeCnt].iLoopLine=LineNum[FileNdx];
      InBlockSet();
      goto L1433;
    }
  if(strcmp(sWord,"xnext")==0){
      InBlockReSet();
      if(LoopTypeCnt==0 ){
          Abort("Too many end loops");
        }
      if(LoopType[LoopTypeCnt].iLoopType!=lt_FORXNEXT ){
          char sErr[BCXSTRSIZE];
          strcpy(sErr, join(4,LoopTypeName(LoopType[LoopTypeCnt].iLoopType)," at",str(LoopType[LoopTypeCnt].iLoopLine)," closed with NEXT"));
          Abort(sErr);
        }
      BumpDown("Unbalanced XFOR/XNEXT");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      if(NOTZERO(LoopLocalVar[--LoopLocalCnt])){
          InBlockReSet();
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
          BumpDown("Unbalanced XFOR/XNEXT");
        }
      if(LoopType[LoopTypeCnt].szUseNeedLabel[0]!=0 ){
          fprintf(FP_WRITE,"%s\n",LoopType[LoopTypeCnt].szUseNeedLabel);
        }
      LoopTypeCnt--;
      if(LoopLocalCnt<0 ){
          Abort("XNEXT without XFOR");
        }
      BumpDown("Unbalanced XFOR/XNEXT");
      goto L1433;
    }
  if(strcmp(sWord,"do")==0){
      InBlockSet();
      if(iDoWhile ){
          LoopType[++LoopTypeCnt].iLoopType=iDoWhile;
        }
      else
        {
          LoopType[++LoopTypeCnt].iLoopType=lt_DOLOOP;
        }
      LoopType[LoopTypeCnt].iJumpTo=LabelGenerator++;
      *LoopType[LoopTypeCnt].szUseNeedLabel=0;
      iDoWhile=0;
      LoopType[LoopTypeCnt].iLoopLine=LineNum[FileNdx];
      fprintf(FP_WRITE,"%s%s\n",Scoot,"for(;;)");
      BumpUp();
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
      goto L1433;
    }
  if(strcmp(sWord,"loop")==0){
      InBlockReSet();
      if(LoopTypeCnt==0 ){
          Abort("Too many end loops");
        }
      if(iLoopCond ){
          if(LoopType[LoopTypeCnt].iLoopType!=lt_DOLOOP ){
              char sErr[BCXSTRSIZE];
              strcpy(sErr, join(4,LoopTypeName(LoopType[LoopTypeCnt].iLoopType)," at",str(LoopType[LoopTypeCnt].iLoopLine)," closed with LOOP CONDITION"));
              Abort(sErr);
            }
        }
      iLoopCond=0;
      BumpDown("Unbalanced DO/LOOP");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      if(LoopType[LoopTypeCnt].szUseNeedLabel[0]!=0 ){
          fprintf(FP_WRITE,"%s\n",LoopType[LoopTypeCnt].szUseNeedLabel);
        }
      LoopTypeCnt--;
      BumpDown("Unbalanced DO/LOOP");
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1433:;

  return 0;
}

int Emit_KeyboardProcs (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"input")==0){
      Emit_InputCode();
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

int Emit_QsortIdxProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  int i={0};
  char LTmp[BCXSTRSIZE]={0};
  char Stptr[BCXSTRSIZE]={0};
  char StMem[BCXSTRSIZE]={0};
  char StName[BCXSTRSIZE]={0};
  Use_BcxTempStr=TRUE;
  strcpy(Var,No_Sigil(Stk[2]));
  BuildCleanStr(4,Ndx-4,LTmp);
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"Key = ",Stk[Ndx],";");
  if(strcmp(Var,"0")!=0){
      fprintf(FP_WRITE,"%s%s\n",Scoot,"int iDx;");
      fprintf(FP_WRITE,"%s%s%s%s",Scoot,"for(iDx=0; iDx<",LTmp,"; iDx += 1) ");
      fprintf(FP_WRITE,"%s%s\n",Var,"[iDx]=iDx;");
    }
  if(!inchr(Stk[Ndx-2],".")){
      Use_Idxqsort=Use_BCX_stricmp=TRUE;
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"pppStr = ",No_Sigil(Stk[Ndx-2]),";");
      fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"qsort(",Var,",",LTmp,",sizeof(int), IdxCompare);");
    }
  else
    {
      strcpy(StMem,remain(No_Sigil(Stk[Ndx-2]),"."));
      strcpy(Stptr,extract(Stk[Ndx-2],"."));
      if(CheckLocal(Stptr,&(i))!=vt_UNKNOWN ){
          strcpy(StName,TypeDefs[LocalVars[i].VarDef].VarName);
        }
      else
        {
          if(CheckGlobal(Stptr,&(i))!=vt_UNKNOWN ){
              strcpy(StName,TypeDefs[GlobalVars[i].VarDef].VarName);
            }
        }
      if(strcmp(Var,"0")!=0){
          Use_IdxqsortSt=Use_BCX_stricmp=TRUE;
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"cmp1 =(char*)(",Stptr,") + offsetof(",StName,",",StMem,");");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"StructSize = sizeof(",StName,");");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"qsort(",Var,",",LTmp,", sizeof(int), IdxCompareSt);");
        }
      else
        {
          Use_PtrqsortSt=Use_BCX_stricmp=TRUE;
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"OffSet = offsetof(",StName,",",StMem,");");
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"qsort(",Stptr,",",LTmp,", sizeof(",StName,"), PtrCompareSt);");
        }
    }
  return 0;
}

int Emit_QsortProcs (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  int iAlphaNumeric=FALSE;
  char LTmp[BCXSTRSIZE]={0};
  int order=0;
  int QST=0;
  int vt={0};
  Use_BcxTempStr=TRUE;
  if(m_iMatchWrd(Stk[Ndx],"sensitive")){
      Use_Strqsorts=TRUE;
      Ndx-=(2);
    }
  if(m_iMatchWrd(Stk[2],"dynamic")){
      QST=TRUE;
      LShiftStk(2);
    }
  if(m_iMatchWrd(Stk[Ndx],"natural")){
      iAlphaNumeric=Use_AlphaNumeric=TRUE;
      Ndx-=(2);
    }
  if(m_iMatchWrd(Stk[Ndx],"ascending")){
      order=2;
      Ndx-=(2);
    }
  if(m_iMatchWrd(Stk[Ndx],"descending")){
      order=1;
      Ndx-=(2);
    }
  if(order==0 ){
      order=2;
    }
  BuildStr(4,Ndx,LTmp);
  strcpy(Var,No_Sigil(Stk[2]));
  vt=DataType(Stk[2]);
  if(vt!=vt_STRVAR&&vt!=vt_INTEGER&&vt!=vt_SINGLE&&vt!=vt_DOUBLE ){
      vt=CheckType(Stk[2]);
    }
  fprintf(FP_WRITE,"%s%s%s%s%s",Scoot,"qsort(",Var,",",No_Sigil(LTmp));
  if(vt==vt_STRVAR ){
      if(!QST ){
          if(order==1 ){
              if(iAlphaNumeric ){
                  fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),AlphaNumericD);");
                  Use_AlphaNumericD=TRUE;
                }
              else
                {
                  if(Use_Strqsorts==TRUE ){
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),StrCompareDs);");
                      Use_Strqsortds=TRUE;
                      Use_Strqsorts=FALSE;
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),StrCompareD);");
                      Use_Strqsortd=Use_BCX_stricmp=TRUE;
                    }
                }
            }
          else
            {
              if(iAlphaNumeric ){
                  fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),AlphaNumericA);");
                  Use_AlphaNumericA=TRUE;
                }
              else
                {
                  if(Use_Strqsorts==TRUE ){
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),StrCompareAs);");
                      Use_Strqsortas=TRUE;
                      Use_Strqsorts=FALSE;
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),StrCompareA);");
                      Use_Strqsorta=Use_BCX_stricmp=TRUE;
                    }
                }
            }
        }
      else
        {
          if(order==1 ){
              if(iAlphaNumeric ){
                  fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),DynAlphaNumericD);");
                  Use_DynAlphaNumericD=TRUE;
                }
              else
                {
                  if(Use_Strqsorts==TRUE ){
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),DynStrCompareDs);");
                      Use_DynStrqsortds=TRUE;
                      Use_Strqsorts=FALSE;
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),DynStrCompareD);");
                      Use_DynStrqsortd=Use_BCX_stricmp=TRUE;
                    }
                }
            }
          else
            {
              if(iAlphaNumeric ){
                  fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),DynAlphaNumericA);");
                  Use_DynAlphaNumericA=TRUE;
                }
              else
                {
                  if(Use_Strqsorts==TRUE ){
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),DynStrCompareAs);");
                      Use_DynStrqsortas=TRUE;
                      Use_Strqsorts=FALSE;
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s\n",",sizeof(",Var,"[0]),DynStrCompareA);");
                      Use_DynStrqsorta=Use_BCX_stricmp=TRUE;
                    }
                }
            }
        }
      goto L1470;
    }
  if(vt==vt_INTEGER ){
      if(order==1 ){
          fprintf(FP_WRITE,"%s\n",",sizeof(int), NumCompareDint);");
          Use_Numqsortdint=TRUE;
        }
      else
        {
          fprintf(FP_WRITE,"%s\n",",sizeof(int), NumCompareAint);");
          Use_Numqsortaint=TRUE;
        }
      goto L1470;
    }
  if(vt==vt_SINGLE ){
      if(order==1 ){
          fprintf(FP_WRITE,"%s\n",",sizeof(float), NumCompareDfloat);");
          Use_Numqsortdfloat=TRUE;
        }
      else
        {
          fprintf(FP_WRITE,"%s\n",",sizeof(float), NumCompareAfloat);");
          Use_Numqsortafloat=TRUE;
        }
      goto L1470;
    }
  if(vt==vt_DOUBLE ){
      if(order==1 ){
          fprintf(FP_WRITE,"%s\n",",sizeof(double), NumCompareDdouble);");
          Use_Numqsortddouble=TRUE;
        }
      else
        {
          fprintf(FP_WRITE,"%s\n",",sizeof(double), NumCompareAdouble);");
          Use_Numqsortadouble=TRUE;
        }
    }
  else
    {
      if(order==1 ){
          fprintf(FP_WRITE,"%s\n",",sizeof(int), NumCompareDint);");
          Use_Numqsortdint=TRUE;
        }
      else
        {
          fprintf(FP_WRITE,"%s\n",",sizeof(int), NumCompareAint);");
          Use_Numqsortaint=TRUE;
        }
    }

L1470:;

  return 0;
}

int Emit_template (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"template")==0){
      char LTmp[BCXSTRSIZE];
      UsingTemplate=TRUE;
      BuildDelimStr(1,Ndx,LTmp);
      fprintf(FP_UDT,"%s\n",LTmp);
      FP_WRITE=FP_UDT;
      goto L1471;
    }
  if(strcmp(sWord,"endtemplate")==0){
      UsingTemplate=FALSE;
    }

L1471:;

  *FuncRetnFlag=0;
  return 0;
}

void AddProto (char* szProto)
{
  if(UsingTemplate==FALSE ){
      ProtoCnt++;
      if(ProtoCnt==c_MaxProtoType ){
          Abort("Maximum Prototypes Exceeded.");
        }
      strcpy(ProtoType[ProtoCnt].Prototype,szProto);
    }
}

int Emit_Const (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  char Buffer[BCXSTRSIZE]={0};
  if(InClass ){
      for(int i=1; i<=Ndx; i++)
        {
          if(IsValidName(Stk[i])&&IsValidName(Stk[i+1])){
              strcpy(Stk[i], join(2,Stk[i],SPC));
            }
          strcat(Buffer,Stk[i]);
        }
      fprintf(FP_UDT,"%s%s%s\n",Scoot,Buffer,";");
    }
  else
    {
      int  Depth={0};
      int  j={0};
      int  SegCount={0};
      int  SegEnd[64]={0};
      int  SegStart[64]={0};
      SegCount=0;
      Depth=0;
      SegStart[0]=2;
      for(long i=2; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],"(")==0){
              Depth++;
            }
          else if(strcmp(Stk[i],")")==0){
              Depth--;
            }
          else if(Depth==0 && strcmp(Stk[i],",")==0){
              int  LooksLikeNewAssignment={0};
              LooksLikeNewAssignment=FALSE;
              if(i+1<=Ndx ){
                  if(IsValidName(Stk[i+1])){
                      long  k={0};
                      long  TempDepth={0};
                      TempDepth=0;
                      for(k=i+2; k<=Ndx; k++)
                        {
                          if(strcmp(Stk[k],"(")==0){
                              TempDepth++;
                            }
                          if(strcmp(Stk[k],")")==0){
                              TempDepth--;
                            }
                          if(TempDepth==0 && strcmp(Stk[k],"=")==0){
                              LooksLikeNewAssignment=TRUE;
                              goto L1474;
                            }
                          if(TempDepth==0 && strcmp(Stk[k],",")==0){
                              goto L1474;
                            }
                        }
L1474:;
                    }
                }
              if(LooksLikeNewAssignment ){
                  SegEnd[SegCount]=i-1;
                  SegCount++;
                  SegStart[SegCount]=i+1;
                }
            }
        }
      SegEnd[SegCount]=Ndx;
      SegCount++;
      for(long i=0; i<=SegCount-1; i++)
        {
          int  segS={0};
          int  segE={0};
          segS=SegStart[i];
          segE=SegEnd[i];
          if(segS>segE ){
              continue;
            }
          *Stk[1]=0;
          if(segE>=segS+1 ){
              if(strcmp(Stk[segS+1],"(")==0){
                  if(c_MaxMacros==MacroCount ){
                      Abort("Max Const Macros exceeded.");
                    }
                  strcpy(ConstMacro[MacroCount],Stk[segS]);
                  MacroCount++;
                }
            }
          long  CurrentIdx={0};
          long  FoundLocalEquals={0};
          FoundLocalEquals=FALSE;
          for(CurrentIdx=segS; CurrentIdx<=segE; CurrentIdx++)
            {
              if(FoundLocalEquals==FALSE&&*Stk[CurrentIdx]==61 ){
                  FoundLocalEquals=TRUE;
                  CurrentIdx++;
                  goto L1476;
                }
              else
                {
                  if(IsDecimalNumber(Stk[CurrentIdx])){
                      strcpy(Stk[1], join(2,Stk[1],SPC));
                    }
                  strcpy(Stk[1], join(2,Stk[1],Stk[CurrentIdx]));
                }
            }
L1476:;
          strcpy(Stk[1], join(3,"#define ",No_Sigil(Stk[1]),SPC));
          *Buffer=0;
          for(j=CurrentIdx; j<=segE; j++)
            {
              if(!IsQuoted(Stk[j])){
                  strcpy(Stk[j],RemoveStr(Stk[j],"$"));
                }
              if(j<segE ){
                  if((IsValidName(Stk[j])&&IsValidName(Stk[j+1]))||(( IsValidName(Stk[j])||IsDecimalNumber(Stk[j]))&&IsDecimalNumber(Stk[j+1]))){
                      strcpy(Stk[j], join(2,Stk[j],SPC));
                    }
                }
              strcat(Buffer,Stk[j]);
            }
          while((int)strlen(Stk[1])<45){
              strcpy(Stk[1], join(2,Stk[1],SPC));
            }
          strcpy(Buffer, join(3,SPC,Stk[1],Buffer));
          strcpy(Buffer,replace(Buffer,"( ","("));
          if(InConditional ){
              if(InFunction ){
                  fprintf(FP_WRITE,"%s\n",Buffer);
                }
              else
                {
                  if(strcmp(ConstLastDef,"FP_CST")!=0){
                      fprintf(FP_CST,"%s%s\n",InIfDef,"// FP_CST");
                      strcpy(ConstLastDef,"FP_CST");
                    }
                  fprintf(FP_CST,"%s\n",Buffer);
                }
            }
          else
            {
              fprintf(FP_CST,"%s\n",Buffer);
            }
        }
    }
  return 0;
}

int Emit_Redim (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  int VarDataType={0};
  int IsAsterisk={0};
  int BC={0};
  struct _UDT_VARINFO_STORAGE*  VI={0};
  int vt={0};
  int id={0};
  int dimensions={0};
  int i={0};
  int IsPreserve={0};
  int LoIndex={0};
  int HiIndex={0};
  char szVarName[BCXSTRSIZE]={0};
  char Buffsz[BCXSTRSIZE]={0};
  char SOF[BCXSTRSIZE]={0};
  Process_Option_Base();
  IsPreserve=m_iMatchWrd(Stk[2],"preserve");
  LoIndex=2+IsPreserve;
  VarDataType=DataType(Stk[LoIndex]);
  strcpy(szVarName,No_Sigil(Stk[LoIndex]));
  IsAsterisk=m_iMatchWrd(Stk[LoIndex+1],"*");
  ValidateVarName(szVarName);
  HiIndex=m_GetAsPosB(Ndx,1)-1;
  if(HiIndex<1 ){
      HiIndex=Ndx;
    }
  while(HiIndex>LoIndex){
      if(strcmp(Stk[HiIndex],"[")==0){
          BC--;
        }
      else if(strcmp(Stk[HiIndex],"]")==0){
          BC++;
          if(BC==1 ){
              HiIndex--;
              continue;
            }
        }
      if(BC==0 ){
          if(strcmp(Stk[HiIndex-1],"]")!=0){
              goto L1479;
            }
          strcpy(Buffsz, join(2,",",Buffsz));
        }
      else
        {
          strcpy(Buffsz, join(2,Stk[HiIndex],Buffsz));
        }
      HiIndex--;
    }
L1479:;
  vt=CheckLocal(szVarName,&(id));
  if(vt==vt_UNKNOWN ){
      vt=CheckGlobal(szVarName,&(id));
      if(vt==vt_UNKNOWN ){
          char szTmp[BCXSTRSIZE]={0};
          int startNdx={0};
          if(strcmp(Stk[3],"*")==0  || strcmp(Stk[5],"*")==0){
              strcpy(szTmp,"DIM ");
              for(int j=2; j<=Ndx; j++)
                {
                  strcpy(szTmp, join(3,szTmp,Stk[j],SPC));
                }
              Inject(szTmp);
              return 0;
            }
          if(bcx_stricmp(Stk[2],"PRESERVE")==0){
              startNdx=3;
            }
          else
            {
              startNdx=2;
            }
          for(int j=startNdx; j<=Ndx; j++)
            {
              strcpy(szTmp, join(3,szTmp,Stk[j],SPC));
            }
          if(InWinMain||InMain==TRUE ){
              Inject(join(2,"GLOBAL dynamic ",szTmp));
            }
          else
            {
              Inject(join(2,"LOCAL dynamic ",szTmp));
            }
          return 0;
        }
      VI=&(GlobalVars[id]);
    }
  else
    {
      VI=&(LocalVars[id]);
    }
  dimensions=VI->VarPntr;
  if(vt==vt_STRUCT||vt==vt_UDT||vt==vt_UNION ){
      strcpy(SOF,GetElement(LoIndex,&(vt),&(dimensions),VI->VarDef));
      i=Ndx;
      Ndx=HiIndex-1;
      AsmUnknownStructs(1);
      Ndx=i;
      RemEmptyTokens();
      strcpy(szVarName,No_Sigil(Stk[LoIndex]));
      IsAsterisk=m_iMatchWrd(Stk[LoIndex+1],"*");
    }
  else
    {
      strcpy(SOF,GetVarTypeName(vt));
    }
  if(strcmp(ltrim(SOF),"")!=0){
      if(m_iMatchWrd(Stk[Ndx-1],"as")){
          if(strcmp(SOF,Stk[Ndx])!=0  && !m_iMatchWrd(Stk[Ndx],"string")){
              Abort(join(6,"Cannot change types for variable ",szVarName," previously defined as ",SOF," on line",str(VI->VarLine)));
            }
          if(m_iMatchWrd(Stk[Ndx],"string")){
              Ndx--;
              AppendTokens(3,"[","BCXSTRSIZE","]");
            }
          else
            {
              Ndx-=(2);
            }
        }
      else
        {
          if(((vt==vt_CHAR||vt==vt_SCHAR)&&VarDataType==vt_STRVAR&&IsAsterisk==0)||vt==vt_CHARPTR ){
              AppendTokens(3,"[","BCXSTRSIZE","]");
            }
        }
    }
  if(SOF[0]==0 ){
      strcpy(SOF,Stk[Ndx]);
    }
  if(strcmp(Stk[3+IsPreserve],"[")==0){
      if(IsPreserve ){
          LoIndex=4;
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s\n",Scoot,"if (",szVarName,") { DestroyArr((void **)",szVarName,",",str(dimensions),", 1); ",szVarName,"=NULL; }");
          LoIndex=3;
        }
      Use_DynamicA=Use_BcxTempStr=TRUE;
      *Buffsz=0;
      for(i=LoIndex; i<=Ndx; i++)
        {
          if(*Stk[i]==91 ){
              i++;
              BC=1;
              while(BC>0){
                  if(*Stk[i]==91 ){
                      BC++;
                      strcat(Buffsz,Stk[i]);
                    }
                  else
                    {
                      if(*Stk[i]==93 ){
                          BC--;
                          if(BC==0&&i<Ndx ){
                              strcat(Buffsz,",");
                            }
                          if(BC ){
                              strcat(Buffsz,Stk[i]);
                            }
                        }
                      else
                        {
                          strcat(Buffsz,Stk[i]);
                        }
                    }
                  i++;
                }
              i--;
            }
        }
      strcpy(Buffsz,No_Sigil(Buffsz));
      if(vt==vt_STRLIT||vt==vt_DECFUNC||vt==vt_NUMBER||(vt==vt_VOID&&inchr(Stk[Ndx],"*")==0)){
          Abort(join(2,Stk[Ndx]," is not a valid type"));
        }
      if(vt==vt_STRVAR ){
          strcpy(SOF,"char");
          strcat(Buffsz,",");
          strcat(Buffsz,"BCXSTRSIZE");
        }
      strcpy(Buffsz,replace(Buffsz,",",", (size_t)"));
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      char szTmp[BCXSTRSIZE];
      strcpy(szTmp, join(5,"size_t dimensions[",str(dimensions,1),"] = {(size_t)",Buffsz,"};"));
      strcpy(szTmp,replace(szTmp,", (size_t)};","};"));
      fprintf(FP_WRITE,"%s%s\n",Scoot,szTmp);
      if(LeftStr(szVarName,"(*")){
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,szVarName,"= (",SOF,stringx(dimensions-1,42),")CreateArr(",szVarName,", sizeof(",SOF,"), ",str(IsPreserve,1),", ",str(dimensions-1,1),", dimensions);");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,szVarName,"= (",SOF,stringx(dimensions,42),")CreateArr(",szVarName,", sizeof(",SOF,"), ",str(IsPreserve,1),", ",str(dimensions,1),", dimensions);");
        }
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      goto REDIM_EXIT;
    }
  if(strcmp(Stk[3],"*")==0  || (IsPreserve && strcmp(Stk[4],"*")==0)){
      if(IsPreserve ){
          fprintf(FP_WRITE,"%s%s%s%s%s",Scoot,szVarName,"=(char*)realloc(",szVarName,",");
          i=5;
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"free(",szVarName,");");
          fprintf(FP_WRITE,"%s%s%s",Scoot,szVarName,"=(char*)calloc(");
          i=4;
        }
      if(IsPreserve ){
          strcpy(Stk[++Ndx],");");
        }
      else
        {
          strcpy(Stk[++Ndx],",1);");
        }
      WriteCleanTokens(i,Ndx);
      goto REDIM_EXIT;
    }
  Abort("Invalid REDIM statement");

REDIM_EXIT:;

  return 0;
}

int Emit_Extern (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  int IsVolatile;
  int IsSubOrFuncPtr;
  char CVar[BCXSTRSIZE];
  int IsPointer;
  int id;
  int vt;
  char L_DimType[BCXSTRSIZE];
  IsSubOrFuncPtr=SubFuncTest();
  Process_Option_Base();
  IsVolatile=m_iMatchWrd(Stk[2],"volatile");
  strcpy(CVar,No_Sigil(Stk[2+IsVolatile]));
  ValidateVarName(CVar);
  if(strcmp(Stk[Ndx],"*")==0){
      PointerFix();
    }
  if(strcmp(Stk[Ndx],"&")==0){
      *Stk[Ndx--]=0;
      strcpy(Stk[Ndx], join(2,Stk[Ndx],"&"));
    }
  if(strcmp(Stk[3+IsVolatile],"*")==0){
      if(IsVolatile ){
          Abort("volatile dynamic strings not supported");
        }
      DimDynaString(CVar,2,0);
      return 0;
    }
  if(IsSubOrFuncPtr ){
      if(IsVolatile ){
          Abort("volatile SUB/FUNCTION pointers not supported");
        }
      if(DimSubFunc(0)){
          return 0;
        }
    }
  strcpy(Var,No_Sigil(Stk[2+IsVolatile]));
  ValidateVarName(Var);
  IsPointer=0;
  *L_DimType=0;
  if(m_iMatchWrd(Stk[Ndx-1],"as")){
      GetTypeInfo(Stk[Ndx],&(IsPointer),&(id),&(vt));
      strcpy(Stk[Ndx],RemoveStr(Stk[Ndx],"*"));
      BuildStr(3+IsVolatile,Ndx-2,L_DimType);
    }
  else
    {
      BuildStr(3+IsVolatile,Ndx,L_DimType);
      vt=DataType(Stk[2+IsVolatile]);
      id=0;
    }
  if(vt==vt_STRVAR ){
      strcat(L_DimType,"[BCXSTRSIZE]");
    }
  if(IsVolatile ){
      AddGlobal(Var,vt,id,L_DimType,IsPointer,0,4);
    }
  else
    {
      AddGlobal(Var,vt,id,L_DimType,IsPointer,0,1);
    }
  return 0;
}

int Emit_Run (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  fprintf(FP_WRITE,"%s%s",Scoot,"Run (");
  strcpy(Stk[++Ndx],");");
  WriteCleanTokens(2,Ndx);
  return 0;
}

int Emit_Shell (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  char LZZ[BCXSTRSIZE];
  BuildDelimStr(2,Ndx,LZZ);
  if(ISNULL(LZZ)){
      strcpy(LZZ,DDQ);
    }
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"system(",No_Sigil(LZZ),");");
  return 0;
}

int Emit_Data (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  for(int A=2; A<=Ndx; A++)
    {
      if(strcmp(Stk[A],"-")==0){
          strcpy(Stk[A], join(2,"-",Stk[A+1]));
          *Stk[A+1]=0;
          LShiftStk(A+1);
        }
    }
  for(int A=2; A<=Ndx; A++)
    {
      if(inchr(Stk[A],DQ)==0 && strcmp(Stk[A],",")!=0){
          strcpy(Stk[A],enc(Stk[A]));
        }
      fprintf(FP_DAT,"%s",Stk[A]);
    }
  fprintf(FP_DAT,"%s\n","");
  return 0;
}

int Emit_Declare (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  char TempProto[BCXSTRSIZE];
  struct _UDT_VARCODE_ATTRIBUTES  Varcode;
  struct _UDT_ARG_COMMAS_STORAGE  ACS;
  Varcode.IsExported=FALSE;
  Varcode.UseInLine=UseInLine;
  FuncSubDecs1("sub",1,Ndx,&(Varcode));
  SepFuncArgs(3,&(ACS),TRUE);
  strcpy(TempProto,MakeDecProto(&(ACS)));
  if(!NoTypeDeclare ){
      fprintf(FP_UDT,"%s%s\n",TempProto,";");
    }
  else
    {
      AddProto(join(2,TempProto,";"));
    }
  return 0;
}

int Emit_Auto (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImAuto);
  return 0;
}

int Emit_Dim (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImDim);
  return 0;
}

int Emit_Local (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImLocal);
  return 0;
}

int Emit_PrivateDim (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImCPPPrvDim);
  return 0;
}

int Emit_Raw (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImRaw);
  return 0;
}

int Emit_Register (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImRegister);
  return 0;
}

int Emit_Static (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  DimVar(ImStatic);
  return 0;
}

int Emit_Clear (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  Use_Clear=Use_SysMacros=TRUE;
  fprintf(FP_WRITE,"%s%s",Scoot,"Clear");
  if(strcmp(Stk[2],"(")!=0){
      fprintf(FP_WRITE,"%s","(");
    }
  for(int i=2; i<=Ndx; i++)
    {
      fprintf(FP_WRITE,"%s",No_Sigil(Stk[i]));
    }
  if(strcmp(Stk[Ndx],")")!=0){
      fprintf(FP_WRITE,"%s",")");
    }
  fprintf(FP_WRITE,"%s\n",";");
  return 0;
}

int Emit_Swap (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  struct _UDT_VARINFO_STORAGE*  VI1;
  struct _UDT_VARINFO_STORAGE*  VI2;
  int  indx;
  int A;
  int i;
  int j;
  BOOLEAN  ThirdArgExists;
  Use_BcxTempStr=TRUE;
  ThirdArgExists=FALSE;
  for(i=2; i<=Ndx; i++)
    {
      if(*Stk[i]==44 ){
          if(i<Ndx ){
              for(j=i+1; j<=Ndx; j++)
                {
                  if(*Stk[j]==44 ){
                      ThirdArgExists=TRUE;
                      goto L1488;
                    }
                }
L1488:;
            }
          goto L1487;
        }
    }
L1487:;
  if(ThirdArgExists ){
      fprintf(FP_WRITE,"%s%s",Scoot,"swap (");
      for(i=2; i<=Ndx; i++)
        {
          if(*Stk[i]==44 ){
              fprintf(FP_WRITE,"%s",", ");
            }
          else
            {
              fprintf(FP_WRITE,"%s",No_Sigil(Stk[i]));
            }
        }
      fprintf(FP_WRITE,"%s\n",");");
    }
  else
    {
      fprintf(FP_WRITE,"%s%s",Scoot,"swap ((byte*)&");
      for(i=2; i<=Ndx; i++)
        {
          if(*Stk[i]==44 ){
              goto L1490;
            }
          fprintf(FP_WRITE,"%s",No_Sigil(Stk[i]));
        }
L1490:;
      A=CheckLocal(Stk[2],&(indx));
      if(A==vt_UNKNOWN ){
          A=CheckGlobal(Stk[2],&(indx));
          if(A==vt_UNKNOWN ){
              Abort(join(3,"Variable '",Stk[2],"' in swap statement unknown"));
            }
          VI1=&(GlobalVars[indx]);
        }
      else
        {
          VI1=&(LocalVars[indx]);
        }
      if(RightStr(Stk[i-1],"]")){
          if(VI1->VarType==vt_CHAR&&VI1->VarPntr==1 ){
              fprintf(FP_WRITE,"%s","[0]");
            }
          if(VI1->VarType==vt_SCHAR&&VI1->VarPntr==1 ){
              fprintf(FP_WRITE,"%s","[0]");
            }
        }
      fprintf(FP_WRITE,"%s",",(byte*)&");
      i++;
      for(j=i; j<=Ndx; j++)
        {
          fprintf(FP_WRITE,"%s",No_Sigil(Stk[j]));
        }
      A=CheckLocal(Stk[i],&(indx));
      if(A==vt_UNKNOWN ){
          A=CheckGlobal(Stk[i],&(indx));
          if(A==vt_UNKNOWN ){
              Abort(join(3,"Variable '",Stk[i],"' in swap statement unknown"));
            }
          VI2=&(GlobalVars[indx]);
        }
      else
        {
          VI2=&(LocalVars[indx]);
        }
      if(RightStr(Stk[j-1],"]")){
          if(VI2->VarType==vt_CHAR&&VI2->VarPntr==1 ){
              fprintf(FP_WRITE,"%s","[0]");
            }
          if(VI2->VarType==vt_SCHAR&&VI2->VarPntr==1 ){
              fprintf(FP_WRITE,"%s","[0]");
            }
        }
      if(VI1->VarType!=VI2->VarType ){
          Warning("Possible size error in swap statement");
        }
      if(VI2->VarType==vt_STRVAR||VI2->VarType==vt_CHAR||VI2->VarType==vt_SCHAR ){
          fprintf(FP_WRITE,"%s",",strlen(");
        }
      else
        {
          fprintf(FP_WRITE,"%s",",sizeof(");
        }
      strcpy(Stk[++Ndx],"));");
      WriteCleanTokens(i,Ndx);
    }
  return 0;
}

int Emit_PrinterProcs (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"ejectpage")==0){
      fprintf(FP_WRITE,"%s%s\n",Scoot,"EjectPage();");
      goto L1492;
    }
  if(strcmp(sWord,"printerclose")==0){
      fprintf(FP_WRITE,"%s%s\n",Scoot,"PrinterClose();");
      goto L1492;
    }
  if(strcmp(sWord,"printeropen")==0){
      if(Ndx==1 ){
          fprintf(FP_WRITE,"%s%s\n",Scoot,"PrinterOpen();");
        }
      else
        {
          char szPrinterParameters[BCXSTRSIZE];
          BuildStr(2,Ndx,szPrinterParameters);
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"PrinterOpen(",szPrinterParameters,");");
        }
      goto L1492;
    }
  if(strcmp(sWord,"lprint")==0  || strcmp(sWord,"sprint")==0){
      int IsLprint=FALSE;
      int IsSprint=FALSE;
      if(m_iMatchWrd(Stk[1],"lprint")){
          Use_Proto=IsLprint=IsSprint=TRUE;
          strcpy(Stk[1],"sprint");
          InsertTokens(1,2,"BcxPtr_Buffer",",");
        }
      if(m_iMatchWrd(Stk[1],"sprint")){
          IsSprint=TRUE;
        }
      if(IsDecimalNumber(Stk[2])){
          strcpy(Stk[2], join(2,"FP",Stk[2]));
        }
      if(IsSprint ){
          strcpy(szFileHandle,No_Sigil(Stk[2]));
        }
      else
        {
          if(m_iMatchWrd(Stk[2],"stderr")){
              strcpy(szFileHandle,"stderr");
            }
          else
            {
              static int i;
              if(CheckLocal(Stk[2],&(i))==vt_UNKNOWN ){
                  if(CheckGlobal(Stk[2],&(i))==vt_UNKNOWN ){
                      AddGlobal(Stk[2],vt_FILEPTR);
                    }
                }
              *szFileHandle=0;
              for(int iii=2; iii<=Ndx; iii++)
                {
                  if(*Stk[iii]==44||*Stk[iii]==59 ){
                      *Stk[iii]=0;
                      goto L1493;
                    }
                  strcat(szFileHandle,Stk[iii]);
                  *Stk[iii]=0;
                }
L1493:;
              strcat(szFileHandle,"@");
            }
        }
      *Stk[2]=0;
      *Stk[3]=0;
      static char LZZ[BCXSTRSIZE];
      if(IsSprint ){
          strcpy(LZZ, join(2,"s",PrintWriteFormat(0)));
          strcpy(LZZ,RemoveStr(LZZ,"\\n"));
        }
      else
        {
          strcpy(LZZ, join(2,"f",PrintWriteFormat(0)));
        }
      strcpy(LZZ, join(4,left(LZZ,8),RemoveStr(szFileHandle,"@"),",",mid(LZZ,9)));
      if(IsLprint ){
          fprintf(FP_WRITE,"%s%s\n",Scoot,LZZ);
          fprintf(FP_WRITE,"%s%s\n",Scoot,"PrinterWrite(BcxPtr_Buffer);");
          if(!Use_Printer ){
              strcpy(SrcTmp,"printer");
              Inject(SrcTmp);
            }
        }
      else
        {
          fprintf(FP_WRITE,"%s%s\n",Scoot,LZZ);
        }
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1492:;

  return 0;
}

int Emit_Free (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  struct _UDT_VARINFO_STORAGE*  VI;
  int A;
  int vt;
  int id;
  int dimensions;
  char CVar[BCXSTRSIZE];
  int IsDynVar={0};
  A=2;
  if(m_iMatchWrd(Stk[2],"dynamic")){
      IsDynVar=TRUE;
      A=3;
    }
  if(strcmp(Stk[A],"(")==0){
      A++;
      Ndx--;
    }
  strcpy(CVar,No_Sigil(Stk[A]));
  vt=CheckLocal(CVar,&(id));
  if(vt==vt_UNKNOWN ){
      vt=CheckGlobal(CVar,&(id));
      if(vt==vt_UNKNOWN ){
          Abort(join(3,"Cannot REDIM ",CVar," not previously dimensioned"));
        }
      VI=&(GlobalVars[id]);
    }
  else
    {
      VI=&(LocalVars[id]);
      if(IsDynVar ){
          Warning("Local dynamic variables are automatically freed.",1);
        }
    }
  BuildStr(A,Ndx,CVar);
  strcpy(CVar,trim(No_Sigil(CVar)));
  if(vt==vt_STRUCT||vt==vt_UNION ){
      GetElement(2,&(vt),&(dimensions),VI->VarDef);
      if(vt!=vt_UNKNOWN&&dimensions>0 ){
          Use_BcxTempStr=Use_DynamicA=TRUE;
          fprintf(FP_WRITE,"%s%s%s",Scoot,"if (",CVar);
          fprintf(FP_WRITE,"%s%s%s %d %s",") { DestroyArr((void **)",CVar,",",(int)dimensions,", 1); ");
          fprintf(FP_WRITE,"%s%s\n",CVar,"=NULL; }");
          return 0;
        }
    }
  if(VI->VarPntr>1 ){
      Use_BcxTempStr=Use_DynamicA=TRUE;
      fprintf(FP_WRITE,"%s%s%s",Scoot,"if (",CVar);
      fprintf(FP_WRITE,"%s%s%s%s%s",") { DestroyArr((void **)",CVar,",",str(VI->VarPntr),", 1); ");
      fprintf(FP_WRITE,"%s%s\n",CVar,"=NULL; }");
    }
  else
    {
      fprintf(FP_WRITE,"%s%s%s%s",Scoot,"free(",CVar,"), ");
      fprintf(FP_WRITE,"%s%s\n",CVar,"=NULL;");
    }
  return 0;
}

int Emit_Dynamic (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  if(InFunction ){
      g_FoundLocalDynArray=TRUE;
    }
  int w=0;
  char szSizeOf[BCXSTRSIZE];
  char LZZ[BCXSTRSIZE];
  char CVar[BCXSTRSIZE];
  int vt;
  int id;
  int dimensions;
  Process_Option_Base();
  strcpy(CVar,No_Sigil(Stk[2]));
  ValidateVarName(CVar);
  if(strcmp(Stk[Ndx],"*")==0){
      PointerFix();
    }
  if(strcmp(Stk[Ndx],"&")==0){
      *Stk[Ndx--]=0;
      strcpy(Stk[Ndx], join(2,Stk[Ndx],"&"));
    }
  if(m_iMatchWrd(Stk[Ndx-1],"as")){
      strcpy(szSizeOf,Stk[Ndx]);
      GetTypeInfo(szSizeOf,&(w),&(id),&(vt));
      if(vt==vt_STRLIT||vt==vt_DECFUNC||vt==vt_NUMBER||(vt==vt_VOID&&inchr(Stk[Ndx],"*")==0)){
          Abort(join(2,szSizeOf," is not a valid type"));
        }
      if(vt==vt_FILEPTR&&inchr(szSizeOf,"*")==0 ){
          strcat(szSizeOf,"*");
        }
      Ndx-=(2);
    }
  else
    {
      vt=DataType(Stk[2]);
      id=0;
      strcpy(szSizeOf,GetVarTypeName(vt));
    }
  Use_DynamicA=Use_BcxTempStr=TRUE;
  BuildStr(3,Ndx,LZZ);
  dimensions=tally(LZZ,"][")+1;
  if(dimensions>1 ){
      strcpy(LZZ,replace(LZZ,"][",","));
    }
  strcpy(LZZ,No_Sigil(LZZ));
  RemoveAll(LZZ,"[]");
  if(vt==vt_STRVAR ){
      vt=vt_CHAR;
      strcpy(szSizeOf,"char");
      if(InTypeDef ){
          if(strcmp(Stk[3],"[")!=0){
              dimensions--;
            }
          else
            {
              vt=vt_CHARPTR;
            }
        }
      dimensions++;
      strcat(LZZ,",");
      strcat(LZZ,"BCXSTRSIZE");
    }
  if(InTypeDef ){
      if(vt==vt_STRUCT ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,"struct _",szSizeOf,space(2),stringx(dimensions,42),CVar,";");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,szSizeOf,space(2),stringx(dimensions,42),CVar,";");
        }
      AddTypedefElement(BaseTypeDefsCnt[InTypeDef],vt,CVar,szSizeOf,dimensions);
    }
  else if(InFunction!=FALSE ){
      LocalDynArrCnt++;
      if(c_MaxLocalDynArr==LocalDynArrCnt ){
          Abort("Maximum number of Local Dynamic Arrays exceeded.");
        }
      strcpy(LocalDynArrName[LocalDynArrCnt], join(9,"if (",CVar,") { DestroyArr((void **)",CVar,",",str(dimensions),", 1); ",CVar,"=NULL; }"));
      fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,szSizeOf,space(2),stringx(dimensions,42),CVar,"=0;");
      AddLocal(CVar,vt,id,"",dimensions);
    }
  else
    {
      if(Use_GenFree ){
          AddDynamicGlobal(join(9,"if (",CVar,") { DestroyArr((void **)",CVar,",",str(dimensions),", 1); ",CVar,"=NULL; }"));
        }
      AddGlobal(CVar,vt,id,"",dimensions);
    }
  if(!InTypeDef ){
      strcpy(LZZ,replace(LZZ,",",", (size_t)"));
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"size_t dimensions[",str(dimensions,1),"] = {(size_t)",LZZ,"};");
      if(InFunction ){
          AuxLocalDynArrayCount++;
          strcpy(AuxLocalDynArray[AuxLocalDynArrayCount], join(3,"if (",CVar,") DestroyArr((void **)"));
          strcpy(AuxLocalDynArray[AuxLocalDynArrayCount], join(5,AuxLocalDynArray[AuxLocalDynArrayCount],CVar,",",str(dimensions),", 1);"));
        }
      fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,CVar,"= (",szSizeOf,stringx(dimensions,42),")CreateArr (",CVar,",sizeof(",szSizeOf,"),0,",str(dimensions,1),", dimensions);");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
    }
  return 0;
}

void DimVar (int iType)
{
  int w=0;
  int id=0;
  int vt=0;
  int IsALocalVar=FALSE;
  int NotInitialized=TRUE;
  static char UseStatic[BCXSTRSIZE];
  static int IsVolatile;
  static char sVolatile[BCXSTRSIZE];
  static int Ok2Initialize;
  static char szVarName[BCXSTRSIZE];
  static int VarType;
  static int IsSubOrFuncPtr;
  static int IsConsOrDestPtr;
  static int IsPointer;
  static char LTmp[BCXSTRSIZE];
  static char L_DimType[BCXSTRSIZE];
  static char szVarTypeName[BCXSTRSIZE];
  static char szMemsetName[BCXSTRSIZE];
  static char szVarDecName[BCXSTRSIZE];
  if(BYTE_AT(Stk[Ndx][0])==58 ){
      strcpy(Stk[Ndx-1], join(2,Stk[Ndx-1],Stk[Ndx]));
      Ndx--;
    }
  IsDim=IsLocal=IsRaw=IsRegister=IsStatic=FALSE;
  if(iType==ImDim ){
      IsDim=TRUE;
    }
  if(iType==ImLocal ){
      IsLocal=TRUE;
    }
  if(iType==ImRaw ){
      IsDim=IsRaw;
    }
  if(iType==ImRegister ){
      IsRegister=TRUE;
    }
  if(iType==ImStatic ){
      IsStatic=TRUE;
    }
  IsVolatile=m_iMatchWrd(Stk[2],"volatile");
  if(IsVolatile ){
      if(IsRegister ){
          Abort("Register volatile not supported");
        }
      strcpy(sVolatile,"volatile ");
    }
  else
    {
      *sVolatile=0;
    }
  IsSubOrFuncPtr=SubFuncTest();
  IsConsOrDestPtr=Ctor_Dtor_Detected(2);
  Process_Option_Base();
  if(strcmp(Stk[Ndx],"*")==0){
      PointerFix();
    }
  if(strcmp(Stk[Ndx],"&")==0){
      *Stk[Ndx--]=0;
      strcpy(Stk[Ndx], join(2,Stk[Ndx],"&"));
    }
  if(IsSubOrFuncPtr ){
      if(IsVolatile ){
          Abort("volatile SUB/FUNCTION pointers not supported");
        }
      if(DimSubFunc(0)){
          return;
        }
    }
  if(IsConsOrDestPtr ){
      if(IsVolatile ){
          Abort("volatile SUB/FUNCTION pointers not supported");
        }
      if(DimSubFunc(2)){
          return;
        }
    }
  if(InFunction||InTypeDef||InCppTypeDef||InClass||InBlock||InNameSpace ){
      IsALocalVar=TRUE;
    }
  if(InTypeDef||IsVolatile ){
      Ok2Initialize=FALSE;
    }
  else
    {
      if(UseCpphdr ){
          if(NOTZERO(iType  & (ImDim|ImLocal))){
              Ok2Initialize=TRUE;
            }
          else
            {
              Ok2Initialize=FALSE;
            }
        }
      else
        {
          if(NOTZERO(iType  & (ImDim|ImLocal|ImAuto))){
              Ok2Initialize=TRUE;
            }
          else
            {
              Ok2Initialize=FALSE;
            }
        }
    }
  if(InTypeDef||InNameSpace ){
      *UseStatic=0;
      IsStatic=FALSE;
    }
  else
    {
      if(NOTZERO(iType  &  ImStatic)){
          IsStatic=TRUE;
          strcpy(UseStatic,"static ");
        }
      else
        {
          *UseStatic=0;
          IsStatic=FALSE;
        }
    }
  strcpy(szVarName,No_Sigil(Stk[2+IsVolatile]));
  ValidateVarName(szVarName);
  VarType=DataType(Stk[2+IsVolatile]);
  if(strcmp(Stk[3+IsVolatile],"*")==0){
      if(IsVolatile ){
          Abort("volatile dynamic strings not supported");
        }
      DimDynaString(szVarName,0,0);
      return;
    }
  int iASoffset=m_GetAsPosB(Ndx,2);
  if(iASoffset ){
      char sConst[BCXSTRSIZE]={0};
      int iIsConst={0};
      if(iASoffset==Ndx-2 ){
          if(m_iMatchWrd(Stk[Ndx-1],"const")){
              strcpy(sConst,"const ");
              iIsConst=1;
            }
        }
      IsPointer=tally(Stk[Ndx],"*");
      BuildStr(2+IsVolatile,iASoffset-1,LTmp);
      BuildStr(3+IsVolatile,iASoffset-1,L_DimType);
      if(NOTZERO(inchr(LTmp,"="))){
          NotInitialized=FALSE;
        }
      strcpy(szVarTypeName,RemoveStr(Stk[Ndx],"*"));
      GetTypeInfo(szVarTypeName,&(w),&(id),&(vt));
      if(vt==vt_WINBOOL ){
          strcpy(Stk[Ndx],iReplace(Stk[Ndx],"WINBOOL","BOOL"));
        }
      if(vt==vt_STRVAR ){
          strcpy(Stk[Ndx],"char");
          strcpy(szVarTypeName,Stk[Ndx]);
          strcat(L_DimType,"[BCXSTRSIZE]");
          strcat(LTmp,"[BCXSTRSIZE]");
        }
      strcpy(Stk[Ndx],rpad(Stk[Ndx],c_PADSIZE));
      if(vt==vt_FILEPTR ){
          strcpy(Stk[Ndx], join(2,Stk[Ndx],"*"));
        }
      if(IsALocalVar ){
          if(iType==ImDim||iType==ImLocal||iType==ImRaw ){
              if(vt==vt_STRUCT ){
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s",Scoot,UseStatic,sVolatile,sConst,"struct _",Stk[Ndx],space(2));
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s%s",Scoot,UseStatic,sVolatile,sConst,Stk[Ndx],space(2));
                }
              if(InTypeDef&&!InBlock ){
                  if(vt==vt_UDT ){
                      if(ComSwitchON ){
                          if(strcmp(TypeDefs[id].VarName,"OBJECT")==0){
                              Abort("Use of Object type in UDTs is Illegal!");
                            }
                        }
                    }
                  AddTypedefElement(BaseTypeDefsCnt[InTypeDef],vt,szVarName,szVarTypeName);
                }
              goto L1494;
            }
          if(iType==ImStatic ){
              fprintf(FP_WRITE,"%s%s%s%s%s%s",Scoot,UseStatic,sVolatile,sConst,Stk[Ndx],space(2));
              goto L1494;
            }
          if(iType==ImAuto ){
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s",Scoot,SPC,sVolatile,sConst,SPC,Stk[Ndx],space(2));
              goto L1494;
            }
          if(iType==ImRegister ){
              fprintf(FP_WRITE,"%s%s%s%s%s",Scoot,SPC,sConst,Stk[Ndx],space(2));
              goto L1494;
            }
          if(iType==ImCPPPrvDim ){
              fprintf(FP_WRITE,"%s%s%s%s",Scoot,"private: ",Stk[Ndx],space(2));
            }

L1494:;

          if(iType!=ImCPPPrvDim ){
              if(!InTypeDef ){
                  if(vt==vt_UDT ){
                      if(ComSwitchON ){
                          if(strcmp(TypeDefs[id].VarName,"OBJECT")==0){
                              Add_Com_Global_Var(szVarName);
                              Use_COM=Use_BcxTempStr=TRUE;
                            }
                        }
                    }
                  AddLocal(szVarName,vt,id,L_DimType,IsPointer,0,0,iIsConst);
                }
            }
          if(Ok2Initialize ){
              strcpy(szMemsetName,No_Sigil(extract(LTmp,"[")));
              if(IsPointer ){
                  if(NotInitialized ){
                      fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),"={0};");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),";");
                    }
                }
              else
                {
                  if(vt==vt_BOOL||vt==vt_BYTE||vt==vt_DWORD||vt==vt_INTEGER||vt==vt_LONG||vt==vt_SHORT||vt==vt_UINT||vt==vt_ULONG||vt==vt_USHORT||vt==vt_DWORD||vt==vt_WORD||vt==vt_DOUBLE||vt==vt_SINGLE||vt==vt_LDOUBLE||vt==vt_PCHAR||vt==vt_PBYTE||vt==vt_SSHORT||vt==vt_SCHAR ){
                      if(NotInitialized ){
                          fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),"={0};");
                        }
                      else
                        {
                          fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),";");
                        }
                    }
                  else
                    {
                      if(NotInitialized ){
                          fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),"={0};");
                        }
                      else
                        {
                          fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),";");
                        }
                    }
                }
            }
          else
            {
              fprintf(FP_WRITE,"%s%s\n",No_Sigil(LTmp),";");
            }
        }
      else
        {
          if(IsVolatile ){
              AddGlobal(szVarName,vt,id,L_DimType,IsPointer,0,3,0,iIsConst);
            }
          else
            {
              if(vt==vt_UDT ){
                  if(ComSwitchON ){
                      if(strcmp(TypeDefs[id].VarName,"OBJECT")==0){
                          Add_Com_Global_Var(szVarName);
                          Use_COM=Use_BcxTempStr=TRUE;
                        }
                    }
                }
              if(iType==ImRaw ){
                  AddGlobal(szVarName,vt,id,L_DimType,IsPointer,0,2,0,iIsConst);
                }
              else
                {
                  AddGlobal(szVarName,vt,id,L_DimType,IsPointer,0,0,0,iIsConst);
                }
            }
        }
      return;
    }
  BuildStr(3+IsVolatile,Ndx,LTmp);
  if(NOTZERO(inchr(LTmp,"="))){
      NotInitialized=FALSE;
    }
  if(IsALocalVar ){
      strcpy(LTmp,trim(No_Sigil(LTmp)));
    }
  if(VarType==vt_STRVAR ){
      strcat(LTmp,"[BCXSTRSIZE]");
    }
  if(IsALocalVar ){
      if(VarType==vt_STRVAR ){
          strcpy(szVarDecName,"char");
        }
      else
        {
          strcpy(szVarDecName,GetVarTypeName(VarType));
        }
      strcpy(szVarDecName,rpad(szVarDecName,c_PADSIZE));
      if(UseCpphdr ){
          int Ok2UseMemset;
          Ok2UseMemset=Ok2Initialize;
          if(iType==ImDim||iType==ImLocal||iType==ImRaw||iType==ImStatic ){
              if((ImDim|ImLocal) & (Ok2UseMemset)){
                  fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,szVarDecName,SPC,szVarName,LTmp,"={0};");
                  Ok2UseMemset=FALSE;
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,UseStatic,sVolatile,szVarDecName,SPC,szVarName,LTmp,";");
                }
              goto L1496;
            }
          if(iType==ImRegister ){
              if(IsVolatile ){
                  Abort("Register volatile not supported");
                }
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,SPC,szVarDecName,SPC,szVarName,LTmp,";");
              goto L1496;
            }
          if(iType==ImCPPPrvDim ){
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,"private: ",szVarDecName,SPC,szVarName,LTmp,";");
            }

L1496:;

          if(Ok2UseMemset ){
              strcpy(szMemsetName,No_Sigil(extract(szVarName,"[")));
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"memset(&",szMemsetName,",0,sizeof(",szMemsetName,"));");
            }
        }
      else
        {
          if(iType==ImDim||iType==ImLocal||iType==ImStatic||iType==ImRaw ){
              if(NotInitialized&&Ok2Initialize ){
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,UseStatic,sVolatile,szVarDecName,SPC,szVarName,LTmp,"={0};");
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,UseStatic,sVolatile,szVarDecName,SPC,szVarName,LTmp,";");
                }
              goto L1497;
            }
          if(iType==ImAuto ){
              if(NotInitialized&&Ok2Initialize ){
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"auto ",sVolatile,szVarDecName,SPC,szVarName,LTmp,"={0};");
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"auto ",sVolatile,szVarDecName,SPC,szVarName,LTmp,";");
                }
              goto L1497;
            }
          if(iType==ImRegister ){
              if(IsVolatile ){
                  Abort("Register volatile not supported");
                }
              if(NotInitialized&&Ok2Initialize ){
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,SPC,szVarDecName,SPC,szVarName,LTmp,"={0};");
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,SPC,szVarDecName,SPC,szVarName,LTmp,";");
                }
              goto L1497;
            }
          if(iType==ImCPPPrvDim ){
              if(NotInitialized&&Ok2Initialize ){
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,"private: ",szVarDecName,SPC,szVarName,LTmp,"={0};");
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s%s%s%s\n",Scoot,"private: ",szVarDecName,SPC,szVarName,LTmp,";");
                }
            }

L1497:;

        }
      if(iType!=ImCPPPrvDim ){
          if(InTypeDef ){
              if(VarType==vt_UDT ){
                  if(ComSwitchON ){
                      if(strcmp(TypeDefs[id].VarName,"OBJECT")==0){
                          Abort("Use of Object type in UDTs is Illegal!");
                        }
                    }
                }
              AddTypedefElement(BaseTypeDefsCnt[InTypeDef],VarType,szVarName,szVarTypeName);
            }
          else
            {
              AddLocal(szVarName,VarType,0,LTmp);
            }
        }
      return;
    }
  static int iGlobalExtn;
  if(IsVolatile ){
      iGlobalExtn=3;
    }
  else
    {
      if(VarType==vt_UDT ){
          if(ComSwitchON ){
              if(strcmp(TypeDefs[id].VarName,"OBJECT")==0){
                  Add_Com_Global_Var(szVarName);
                  Use_COM=Use_BcxTempStr=TRUE;
                }
            }
        }
      iGlobalExtn=0;
    }
  AddGlobal(szVarName,VarType,0,LTmp,0,0,iGlobalExtn);
}

int Emit_CPP_EndClass (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  if(InClass!=1 ){
      Abort("Syntax Error");
    }
  BumpDown("Extra unindents and/or missing indents before END CLASS");
  fprintf(FP_UDT,"%s%s\n",Scoot,"};");
  fprintf(FP_UDT,"%s\n","");
  BumpDown("Extra unindents and/or missing indents before END CLASS");
  InClass--;
  FP_WRITE=FP2;
  *InClassName=0;
  *InClassPP=0;
  return 0;
}

int Emit_CPP_Namespace (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  FP_WRITE=FP_UDT;
  fprintf(FP_WRITE,"%s%s%s\n",Scoot,"namespace ",Stk[2]);
  BumpUp();
  fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
  InNameSpace++;
  return 0;
}

int Emit_CPP_Class (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  if(InClass||InTypeDef||InCppTypeDef||InFunction||ISNULL(Stk[2])){
      Abort("Syntax Error");
    }
  strcpy(InClassName,Stk[2]);
  if(UsingTemplate==FALSE ){
      fprintf(FP_UDT,"%s\n","");
    }
  if(NOTNULL(InIfDef) && strcmp(InIfDef,"FP3")!=0){
      fprintf(FP_UDT,"%s\n",InIfDef);
    }
  fprintf(FP_UDT,"%s","class ");
  FP_WRITE=FP_UDT;
  for(int i=2; i<=Ndx; i++)
    {
      if(m_iMatchWrd(Stk[i+1],"inherits")){
          strcpy(Stk[i], join(2,Stk[i],":"));
          strcpy(Stk[i+1],"public");
        }
      if(strcmp(Stk[i],"using")==0){
          fprintf(FP_UDT,"%s"," : ");
          continue;
        }
      if(strcmp(Stk[i],"::")==0){
          fprintf(FP_UDT,"%s"," : ");
        }
      else
        {
          if(m_iMatchWrd(Stk[i],"private")){
              strcpy(Stk[i],"private");
            }
          if(m_iMatchWrd(Stk[i],"public")){
              strcpy(Stk[i],"public");
            }
          AddSpace(i);
          fprintf(FP_UDT,"%s",Stk[i]);
        }
    }
  BumpUp();
  fprintf(FP_UDT,"%s%s%s\n","\n",Scoot,"{");
  InClass++;
  *InClassPP=0;
  if(UsingTemplate==TRUE ){
      WasAClass=TRUE;
    }
  return 0;
}

void Emit_CPP_AccessSpecifier (char *szAccess)
{
  UseCpp=TRUE;
  if(strcmp(Stk[2],":")==0){
      if(InClassPP[0]){
          fprintf(FP_UDT,"%s\n","");
          BumpDown(join(2,"Error in Emit_CPP_",szAccess));
        }
      fprintf(FP_UDT,"%s%s%s\n",Scoot,szAccess,":");
      BumpUp();
      strcpy(InClassPP,szAccess);
    }
}

int Emit_CPP_Public (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  Emit_CPP_AccessSpecifier("public");
  return 0;
}

int Emit_CPP_Asm (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  Emit_Assignments(FuncRetnFlag);
  return 0;
}

int Emit_CPP_Protected (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  Emit_CPP_AccessSpecifier("protected");
  return 0;
}

int Emit_CPP_Private (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  Emit_CPP_AccessSpecifier("private");
  return 0;
}

int Emit_CPP_EndNamespace (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  fprintf(FP_UDT,"%s%s\n",Scoot,"};\n");
  BumpDown("Extra unindents and/or missing indents before END NAMESPACE");
  InNameSpace--;
  return 0;
}

int Emit_CPP_Try (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  fprintf(FP_WRITE,"%s%s\n",Scoot,"try");
  BumpUp();
  fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
  InBlockSet();
  return 0;
}

int Emit_CPP_EndTry (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
  BumpDown("Unbalanced TRY/END TRY");
  InBlockReSet();
  return 0;
}

int Emit_CPP_Throw (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  char LTmp[BCXSTRSIZE];
  if(Ndx==1 ){
      strcpy(LTmp,enc("An Exception has occured!"));
    }
  else
    {
      BuildDelimStr(2,Ndx,LTmp);
    }
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"throw ",LTmp,";");
  return 0;
}

int Emit_CPP_Catch (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  struct _UDT_VARCODE_ATTRIBUTES  VarCode;
  VarCode.IsExported=FALSE;
  VarCode.UseInLine=UseInLine;
  InBlockReSet();
  *gTmpStr=0;
  if(Ndx>1 ){
      int A;
      FuncSubDecs1("sub",1,Ndx,&(VarCode));
      FuncSubDecs2("sub",mt_Opts,&(VarCode),1,&(Ndx));
      VarCode.Methd=mt_FuncSubDecC_DecAParam;
      A=3;
      while(A<Ndx){
          GetParameter(&(A),&(VarCode),mt_OptsAParam,mt_OptsNoParam,1);
          A++;
        }
      VarCode.Methd=mt_FuncSubDecC_DecAParam;
      strcpy(VarCode.Token,Stk[1]);
      FuncSubDecs3(&(VarCode),Ndx,0);
      strcpy(gTmpStr,VarCode.Header);
    }
  else
    {
      strcpy(gTmpStr,"catch (PCTSTR str)");
    }
  fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
  BumpDown("Extra unindents and/or missing indents before CATCH");
  InBlockSet();
  fprintf(FP_WRITE,"%s%s\n",Scoot,gTmpStr);
  BumpUp();
  fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
  return 0;
}

int Emit_CPP_Delete (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(sWord);
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  UseCpp=TRUE;
  char LTmp[BCXSTRSIZE];
  BuildCleanStr(2,Ndx,LTmp);
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"delete ",LTmp,";");
  return 0;
}

int Emit_DialogBox (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"dialogbox")==0){
      int L_Comma=0;
      fprintf(FP_WRITE,"%s%s",Scoot,"DialogBox");
      for(int A=2; A<=Ndx; A++)
        {
          if(strcmp(Stk[A],",")==0){
              L_Comma++;
            }
          if(L_Comma==3 ){
              if(strcmp(Stk[A],",")==0){
                  strcpy(Stk[A],",(DLGPROC)");
                }
            }
          fprintf(FP_WRITE,"%s",No_Sigil(Stk[A]));
        }
      fprintf(FP_WRITE,"%s\n",";");
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

char * Emit_Conditional_Operator_Repair (char* szArg)
{
  char  *BCX_RetStr={0};
  if(!InstrAny(szArg,"=!<>|&")){
      BCX_RetStr = BCX_TempStr(strlen(szArg));
      strcpy(BCX_RetStr,szArg);
      return BCX_RetStr;
    }
  char Tmp[BCXSTRSIZE]={0};
  strcpy(Tmp,trim(szArg));
  strcpy(Tmp,replace(Tmp,"= =","=="));
  strcpy(Tmp,replace(Tmp,"! =","!="));
  strcpy(Tmp,replace(Tmp,"< =","<="));
  strcpy(Tmp,replace(Tmp,"> =",">="));
  strcpy(Tmp,replace(Tmp,"| |","||"));
  strcpy(Tmp,replace(Tmp,"& &","&&"));
  strcpy(Tmp,replace(Tmp,"% =","%="));
  strcpy(Tmp,replace(Tmp,"^ =","^="));
  BCX_RetStr = BCX_TempStr(strlen(Tmp));
  strcpy(BCX_RetStr,Tmp);
  return BCX_RetStr;
}

int Emit_ConditionalCompilation (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"~ifndef")==0){
      strcpy(InIfDef,"#ifndef ");
      for(int i=2; i<=Ndx; i++)
        {
          strcpy(InIfDef, join(3,InIfDef,Stk[i],SPC));
        }
      strcpy(InIfDef,Emit_Conditional_Operator_Repair(InIfDef));
      if(InFunction||InMain ){
          fprintf(FP_WRITE,"%s\n",InIfDef);
        }
      else
        {
          fprintf(FP_CST,"%s\n",InIfDef);
        }
      goto L1502;
    }
  if(strcmp(sWord,"~ifdef")==0){
      strcpy(InIfDef,"#if defined ");
      for(int i=2; i<=Ndx; i++)
        {
          strcpy(InIfDef, join(3,InIfDef,Stk[i],SPC));
        }
      strcpy(InIfDef,Emit_Conditional_Operator_Repair(InIfDef));
      strcpy(ConstLastDef,InIfDef);
      char tmp[BCXSTRSIZE]={0};
      strcpy(tmp,trim(LookAhead(SourceFile,1)));
      if(bcx_stricmp(left(tmp,4),"SUB ")==0  ||  bcx_stricmp(left(tmp,9),"FUNCTION ")==0){
          strcpy(tmp,"SUSPEND");
        }
      if(InFunction ){
          fprintf(FP_WRITE,"%s\n",InIfDef);
          strcpy(InIfDef,"FP3");
        }
      else
        {
          if(InMain && strcmp(tmp,"SUSPEND")!=0){
              fprintf(FP_WRITE,"%s\n",InIfDef);
            }
        }
      goto L1502;
    }
  if(strcmp(sWord,"~if")==0){
      strcpy(InIfDef,"#if ");
      for(int i=2; i<=Ndx; i++)
        {
          strcpy(InIfDef, join(3,InIfDef,Stk[i],SPC));
        }
      strcpy(InIfDef,Emit_Conditional_Operator_Repair(InIfDef));
      strcpy(ConstLastDef,InIfDef);
      if(InFunction ){
          fprintf(FP_WRITE,"%s\n",InIfDef);
          strcpy(InIfDef,"FP3");
        }
      else
        {
          if(InMain ){
              fprintf(FP_WRITE,"%s\n",InIfDef);
            }
        }
      goto L1502;
    }
  if(strcmp(sWord,"~elseif")==0){
      strcpy(InIfDef,"#elif defined ");
      for(int i=2; i<=Ndx; i++)
        {
          strcpy(InIfDef, join(3,InIfDef,Stk[i],SPC));
        }
      strcpy(InIfDef,Emit_Conditional_Operator_Repair(InIfDef));
      strcpy(ConstLastDef,InIfDef);
      if(InFunction||InMain ){
          fprintf(FP_WRITE,"%s\n",InIfDef);
        }
      else
        {
          fprintf(FP_CST,"%s\n",InIfDef);
        }
      goto L1502;
    }
  if(strcmp(sWord,"~else")==0){
      strcpy(InIfDef,"#else");
      strcpy(ConstLastDef,InIfDef);
      if(InFunction||InMain ){
          fprintf(FP_WRITE,"%s\n",InIfDef);
        }
      else
        {
          fprintf(FP_CST,"%s\n",InIfDef);
        }
      goto L1502;
    }
  if(strcmp(sWord,"~endif")==0){
      if(strcmp(InIfDef,"FP3")==0){
          fprintf(FP3,"%s\n","#endif");
        }
      else
        {
          fprintf(FP_WRITE,"%s\n","#endif");
        }
      if(strcmp(ConstLastDef,"FP_CST")==0){
          fprintf(FP_CST,"%s\n","#endif");
        }
      strcpy(InIfDef,"#endif");
      if(InConditional==0 ){
          *InIfDef=0;
          *ConstLastDef=0;
        }
      goto L1502;
    }
  if(strcmp(sWord,"~pragmaoptimizeon")==0){
      fprintf(FP_WRITE,"%s\n","#ifdef __POCC__");
      fprintf(FP_WRITE,"%s\n","#pragma optimize(time)");
      fprintf(FP_WRITE,"%s\n","#endif");
      fprintf(FP_WRITE,"%s\n","#ifdef __LCC__");
      fprintf(FP_WRITE,"%s\n","#pragma optimize(1)");
      fprintf(FP_WRITE,"%s\n","#endif");
      goto L1502;
    }
  if(strcmp(sWord,"~pragmaoptimizeoff")==0){
      fprintf(FP_WRITE,"%s\n","#ifdef __POCC__");
      fprintf(FP_WRITE,"%s\n","#pragma optimize(none)");
      fprintf(FP_WRITE,"%s\n","#endif");
      fprintf(FP_WRITE,"%s\n","#ifdef __LCC__");
      fprintf(FP_WRITE,"%s\n","#pragma optimize(0)");
      fprintf(FP_WRITE,"%s\n","#endif");
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1502:;

  return 0;
}

int Emit_Shared_Global (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"shared")==0  || strcmp(sWord,"global")==0){
      static int wxy;
      static char szSizeOf[BCXSTRSIZE];
      static int IsShared;
      static int IsVolatile;
      static int IsSubOrFuncPtr;
      static char CVar[BCXSTRSIZE];
      static int id;
      static int vt;
      static int dimensions;
      static int IsPointer;
      static char LZZ[BCXSTRSIZE];
      wxy=0;
      IsSubOrFuncPtr=SubFuncTest();
      Process_Option_Base();
      IsVolatile=m_iMatchWrd(Stk[2],"volatile");
      strcpy(CVar,No_Sigil(Stk[2+IsVolatile]));
      ValidateVarName(CVar);
      IsShared=m_iMatchWrd(Stk[1],"shared");
      if(strcmp(Stk[Ndx],"*")==0){
          PointerFix();
        }
      if(strcmp(Stk[Ndx],"&")==0){
          *Stk[Ndx--]=0;
          strcpy(Stk[Ndx], join(2,Stk[Ndx],"&"));
        }
      if(strcmp(Stk[3+IsVolatile],"*")==0){
          if(IsVolatile ){
              Abort("volatile dynamic strings not supported");
            }
          DimDynaString(CVar,1,IsShared);
          goto L1507;
        }
      if(IsSubOrFuncPtr ){
          if(IsVolatile ){
              Abort("volatile SUB/FUNCTION pointers not supported");
            }
          DimSubFunc(0);
          goto L1507;
        }
      if(m_iMatchWrd(Stk[2],"dynamic")){
          strcpy(CVar,No_Sigil(Stk[3]));
          ValidateVarName(CVar);
          if(m_iMatchWrd(Stk[Ndx-1],"as")){
              strcpy(szSizeOf,Stk[Ndx]);
              GetTypeInfo(szSizeOf,&(wxy),&(id),&(vt));
              if(vt==vt_STRLIT||vt==vt_DECFUNC||vt==vt_NUMBER||(vt==vt_VOID&&inchr(Stk[Ndx],"*")==0)){
                  Abort(join(2,Stk[Ndx]," is not a valid type"));
                }
              Ndx-=(2);
            }
          else
            {
              vt=DataType(Stk[3]);
              id=0;
              strcpy(szSizeOf,GetVarTypeName(vt));
            }
          Use_DynamicA=Use_BcxTempStr=TRUE;
          BuildStr(4,Ndx,LZZ);
          dimensions=tally(LZZ,"][")+1;
          if(dimensions>1 ){
              strcpy(LZZ,replace(LZZ,"][",","));
            }
          strcpy(LZZ,No_Sigil(LZZ));
          RemoveAll(LZZ,"[]");
          if(vt==vt_STRVAR ){
              vt=vt_CHAR;
              strcpy(szSizeOf,"char");
              dimensions++;
              strcat(LZZ,",");
              strcat(LZZ,"BCXSTRSIZE");
            }
          if(Use_GenFree ){
              AddDynamicGlobal(join(9,"if (",CVar,") {DestroyArr((void **)",CVar,",",str(dimensions),", 1); ",CVar,"=NULL;}"));
            }
          AddGlobal(CVar,vt,id,"",dimensions);
          strcpy(LZZ,replace(LZZ,",",", (size_t)"));
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"size_t dimensions[",str(dimensions,1),"] = {(size_t)",LZZ,"};");
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s%s%s%s\n",Scoot,CVar,"= (",szSizeOf,stringx(dimensions,42),")CreateArr (",CVar,", sizeof(",szSizeOf,"), 0,",str(dimensions,1),", dimensions);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
          goto L1507;
        }
      IsPointer=0;
      strcpy(Var,No_Sigil(Stk[2+IsVolatile]));
      ValidateVarName(Var);
      if(m_iMatchWrd(Stk[Ndx-1],"as")){
          if(inchr(Stk[Ndx],"*")){
              IsPointer=tally(Stk[Ndx],"*");
              strcpy(Stk[Ndx],RemoveStr(Stk[Ndx],"*"));
            }
          BuildStr(3+IsVolatile,Ndx-2,DimType);
          GetTypeInfo(Stk[Ndx],&(wxy),&(id),&(vt));
        }
      else
        {
          BuildStr(3+IsVolatile,Ndx,DimType);
          vt=DataType(Stk[2+IsVolatile]);
          id=0;
        }
      if(vt==vt_STRVAR ){
          strcat(DimType,"[BCXSTRSIZE]");
        }
      if(vt==vt_UDT ){
          if(ComSwitchON ){
              if(strcmp(TypeDefs[id].VarName,"OBJECT")==0){
                  Add_Com_Global_Var(CVar);
                  Use_COM=Use_BcxTempStr=TRUE;
                }
            }
        }
      wxy=0;
      if(IsShared ){
          wxy=2;
        }
      if(IsVolatile ){
          wxy+=3;
        }
      AddGlobal(Var,vt,id,DimType,IsPointer,0,wxy);
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1507:;

  return 0;
}

int Emit_EndFuncSub (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"endfunction")==0  || strcmp(sWord,"endsub")==0){
      AuxLocalDynArrayCount=0;
      g_FoundLocalDynArray=FALSE;
      InFunction=FALSE;
      InMain=TRUE;
      if(LoopTypeCnt ){
          LoopErrorMsg();
        }
      if(COM_lc_names_index>0 ){
          Free_Com_Objects(TRUE);
        }
      if(m_iMatchWrd(Stk[1],"endfunction")){
          InWinMain=FALSE;
          LocalDynaCnt=0;
          LocalDynArrCnt=0;
          if(InDialogEvt ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"if(Msg==WM_CLOSE) DestroyWindow(hWnd);");
              if(Use_Sound ){
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"midiOutClose (hMidi);");
                }
              fprintf(FP_WRITE,"%s%s\n",Scoot,"return EXIT_SUCCESS;");
              InDialogEvt=FALSE;
            }
          if(ModDialogEvt ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"if(Msg==WM_CLOSE) EndDialog(hWnd,0);");
              if(Use_Sound ){
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"midiOutClose (hMidi);");
                }
              fprintf(FP_WRITE,"%s%s\n",Scoot,"return EXIT_SUCCESS;");
              ModDialogEvt=FALSE;
            }
          if(CallBackFlag ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"return DefWindowProc(hWnd, Msg, wParam, lParam);");
              CallBackFlag=FALSE;
            }
        }
      if(m_iMatchWrd(Stk[1],"endsub")){
          if(NOTZERO(LocalDynaCnt)){
              for(int j=1; j<=LocalDynaCnt; j++)
                {
                  fprintf(FP_WRITE,"%s%s\n",Scoot,DynaStr[j]);
                }
              LocalDynaCnt=0;
            }
          if(NOTZERO(LocalDynArrCnt)){
              for(int i=1; i<=LocalDynArrCnt; i++)
                {
                  fprintf(FP_WRITE,"%s%s\n",Scoot,LocalDynArrName[i]);
                }
              LocalDynArrCnt=0;
            }
        }
      if(ForceMainToFunc==TRUE&&NoMain==FALSE ){
          if(Use_Sound ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"midiOutClose (hMidi);");
            }
          fprintf(FP_WRITE,"%s%s\n",Scoot,"return EXIT_SUCCESS;");
          ForceMainToFunc=FALSE;
        }
      BumpDown("Unbalance statements occurred before END");
      if(InNameSpace||InClass||InCppTypeDef ){
          fprintf(FP_UDT,"%s%s\n",Scoot,"}\n");
          int  iIndentsUsed={0};
          char szErr[BCXSTRSIZE]={0};
          iIndentsUsed=0;
          *szErr=0;
          if(InNameSpace ){
              iIndentsUsed+=((InNameSpace*2));
              strcpy(szErr," Namespace,");
            }
          if(InClass ){
              iIndentsUsed+=(((InClass+1)*2));
              strcat(szErr," Class Module,");
            }
          if(InCppTypeDef ){
              iIndentsUsed+=((InCppTypeDef*2));
              strcat(szErr," PPType,");
            }
          if(Indent>iIndentsUsed ){
              strcpy(szErr,left(szErr,(int)strlen(szErr)-1));
              strcpy(szErr, join(5,"Possible missing (",Using("##",(Indent-iIndentsUsed)*0.5),") END statements in",szErr," SUB/FUNCTION"));
              printf("%s\n",repeat(80,"_"));
              printf("%s\n",szErr);
              printf("%s\n",repeat(80,"_"));
            }
        }
      else
        {
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}\n\n");
        }
      InFunction=Use_Static=FALSE;
      if(FP_WRITE==FP3 ){
          strcpy(InIfDef,"FP3");
        }
      if(!(InNameSpace||InClass)){
          FP_WRITE=FP2;
        }
      ByrefCnt=0;
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

int Emit_Union (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"union")==0){
      if(InTypeDef==0 ){
          SaveFP_WRITENum=FP_WRITE;
        }
      FP_WRITE=FP_UDT;
      InTypeDef++;
      if(c_MaxBaseTypeDefs==InTypeDef ){
          Abort("Maximum number of nested TypeDefs exceeded.");
        }
      strcpy(TypeDefName[InTypeDef],Stk[2]);
      AddTypeDefs(TypeDefName[InTypeDef],vt_UNION);
      BaseTypeDefsCnt[InTypeDef]=TypeDefsCnt;
      fprintf(FP_WRITE,"%s\n","");
      if(InTypeDef==1 ){
          fprintf(FP_WRITE,"%s\n","typedef union ");
          fprintf(FP_WRITE,"%s\n","{");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s\n",Scoot,"union");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
          AddTypedefElement(BaseTypeDefsCnt[InTypeDef-1],vt_UNION,TypeDefName[InTypeDef],TypeDefName[InTypeDef]);
        }
      BumpUp();
      goto L1511;
    }
  if(strcmp(sWord,"endunion")==0){
      BumpDown("Unbalanced UNION/END UNION");
      if(InTypeDef==1 ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n","} ",TypeDefName[InTypeDef],", *LP",ucase(TypeDefName[InTypeDef]),", *",ucase(TypeDefName[InTypeDef]),"_PTR",";");
          FP_WRITE=SaveFP_WRITENum;
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"} ",TypeDefName[InTypeDef],";");
        }
      fprintf(FP_WRITE,"%s\n","");
      InTypeDef--;
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1511:;

  return 0;
}

int Emit_Type (char* sWord,PINT  FuncRetnFlag)
{
  UNREFERENCED_PARAMETER(FuncRetnFlag);
  if(strcmp(sWord,"type")==0){
      static int i;
      static int j;
      if(InTypeDef==0 ){
          SaveFP_WRITENum=FP_WRITE;
        }
      FP_WRITE=FP_UDT;
      if(Ndx>2 ){
          if(InTypeDef ){
              Abort("Single line TYPE within type/union not supported");
            }
          i=m_GetAsPosB(Ndx,1);
          if(i==0 ){
              Abort("Missing AS TYPE");
            }
          fprintf(FP_WRITE,"%s%s",Scoot,"typedef ");
          j=i-1;
          i++;
          while(i<=Ndx){
              fprintf(FP_WRITE,"%s%s",Stk[i],SPC);
              i++;
            }
          for(i=2; i<=j; i++)
            {
              fprintf(FP_WRITE,"%s",Stk[i]);
            }
          fprintf(FP_WRITE,"%s\n",";");
          FP_WRITE=SaveFP_WRITENum;
        }
      else
        {
          InTypeDef++;
          if(c_MaxBaseTypeDefs==InTypeDef ){
              Abort("Maximum number of nested TypeDefs exceeded.");
            }
          strcpy(TypeDefName[InTypeDef],Stk[2]);
          AddTypeDefs(TypeDefName[InTypeDef],vt_STRUCT);
          BaseTypeDefsCnt[InTypeDef]=TypeDefsCnt;
          if(InClass||InTypeDef>1 ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"struct");
              fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
              AddTypedefElement(BaseTypeDefsCnt[InTypeDef-1],vt_STRUCT,TypeDefName[InTypeDef],TypeDefName[InTypeDef]);
            }
          else
            {
              fprintf(FP_WRITE,"%s\n","");
              fprintf(FP_WRITE,"%s%s\n","typedef struct _",TypeDefName[InTypeDef]);
              fprintf(FP_WRITE,"%s\n","{");
            }
          BumpUp();
        }
      goto L1512;
    }
  if(strcmp(sWord,"endtype")==0){
      BumpDown("Unbalanced TYPE/END TYPE");
      if(InClass ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"} ",TypeDefName[InTypeDef],";");
          fprintf(FP_WRITE,"%s\n","");
        }
      else
        {
          char szTDNames[BCXSTRSIZE]={0};
          if(Ndx>1 ){
              static int i;
              static int j;
              i=m_GetAsPosB(Ndx,1);
              if(i==0 ){
                  Abort("Missing AS after END TYPE");
                }
              strcpy(szTDNames,", ");
              for(int ii=i+1; ii<=Ndx; ii++)
                {
                  j=inchr(Stk[ii],"*");
                  if(j ){
                      strcpy(Stk[ii], join(2,mid(Stk[ii],j),left(Stk[ii],j-1)));
                    }
                  strcat(szTDNames,Stk[ii]);
                }
            }
          if(InTypeDef==1 ){
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s%s\n","}",TypeDefName[InTypeDef],", *LP",ucase(TypeDefName[InTypeDef]),", *",ucase(TypeDefName[InTypeDef]),"_PTR",szTDNames,";");
              fprintf(FP_WRITE,"%s\n","");
              FP_WRITE=SaveFP_WRITENum;
              char sztemp[BCXSTRSIZE]={0};
              strcpy(sztemp, join(3,"#define ",ucase(TypeDefName[InTypeDef]),"_CLASS"));
              while((int)strlen(sztemp)<44){
                  strcat(sztemp,SPC);
                }
              fprintf(FP_CST,"%s%s%s%s%s\n",Scoot,sztemp," struct _",ucase(TypeDefName[InTypeDef]),"*");
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"} ",TypeDefName[InTypeDef],szTDNames,";");
              fprintf(FP_WRITE,"%s\n","");
            }
        }
      InTypeDef--;
    }

L1512:;

  return 0;
}

int Emit_PPType (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"pptype")==0){
      FP_WRITE=FP_UDT;
      if(InTypeDef||InCppTypeDef||InClass||InFunction||ISNULL(Stk[2])){
          Abort("Syntax Error");
        }
      fprintf(FP_UDT,"%s\n","");
      if(strcmp(InIfDef,"FP3")!=0  && NOTNULL(InIfDef)){
          fprintf(FP_UDT,"%s\n",InIfDef);
        }
      fprintf(FP_UDT,"%s","struct ");
      for(int i=2; i<=Ndx; i++)
        {
          if(m_iMatchWrd(Stk[i],"using")){
              strcpy(Stk[i],": ");
            }
          AddSpace(i);
          fprintf(FP_UDT,"%s",Stk[i]);
        }
      BumpUp();
      fprintf(FP_UDT,"%s%s%s\n","\n",Scoot,"{");
      InCppTypeDef++;
      goto L1517;
    }
  if(strcmp(sWord,"endpptype")==0){
      if(InCppTypeDef!=1 ){
          Abort("Syntax Error");
        }
      BumpDown("Extra unindents and/or missing indents before END PPTYPE");
      fprintf(FP_UDT,"%s%s\n",Scoot,"};");
      InCppTypeDef--;
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1517:;

  return 0;
}

void GetParameterASHelper (int iEQPos,int iASPos,int iOptOk,int iLoc)
{
  static int iLast;
  if(iOptOk==0 ){
      Abort("Optional variables not supported without OPTIONAL");
    }
  if(iASPos==0 ){
      iLast=iLoc;
    }
  else
    {
      if(iASPos<iEQPos ){
          iLast=iLoc;
        }
      else
        {
          iLast=iASPos-1;
        }
    }
  for(int i=iEQPos+1; i<=iLast; i++)
    {
      strcpy(Stk[iEQPos], join(2,Stk[iEQPos],SPC));
      strcpy(Stk[iEQPos], join(2,Stk[iEQPos],Stk[i]));
      *Stk[i]=0;
    }
}

void GetParameter (PINT  piStart,UDT_VARCODE_ATTRIBUTES*  ptVar,int iAParam,int iNoParam,int iOptOk)
{
  int iASPos=0;
  int iEQPos=0;
  int iNd={0};
  int iLoc=*piStart;
  if(ISNULL(Stk[iLoc])){
      return;
    }
  strcpy(ptVar->Token,No_Sigil(Stk[iLoc]));
  for(;;)
    {
      if(strcmp(Stk[iLoc+1],"(")==0){
          int iEndPoint;
          char LTmp[BCXSTRSIZE];
          int iStartPoint;
          struct _UDT_ARG_COMMAS_STORAGE  ACS;
          Clear(ACS);
          *CallType=0;
          SepFuncArgs(iLoc-1,&(ACS),TRUE);
          iStartPoint=IMAX(ACS.CommaPos[0],iLoc);
          g_SubFuncPtr=TRUE;
          if(ACS.NumArgs==0 ){
              iEndPoint=IMIN(ACS.CommaPos[1]+1,Ndx);
            }
          else
            {
              iEndPoint=IMIN(ACS.CommaPos[ACS.NumArgs]+1,Ndx);
            }
          if(strcmp(Stk[iEndPoint],"=")==0){
              *Stk[iEndPoint++]=0;
              while(!(iEndPoint<=Ndx)&&(m_iMatchWrd(Stk[iEndPoint],"as"))){
                  strcat(LTmp,Stk[iEndPoint]);
                  *Stk[iEndPoint++]=0;
                }
              RemoveAll(LTmp,"{}",1);
              if(NOTNULL(LTmp)){
                  RemEmptyTokens();
                }
            }
          char L_FuncName[BCXSTRSIZE];
          int OldiEndPoint;
          if(m_iMatchWrd(Stk[iEndPoint],"as")){
              iEndPoint++;
              if(m_iMatchWrd(Stk[iEndPoint],"function")){
                  LShiftStk(iEndPoint);
                }
              while(*Stk[iEndPoint]!=44&&*Stk[iEndPoint]!=41){
                  if(ISNULL(Stk[iEndPoint])){
                      LShiftStk(iEndPoint);
                    }
                  else
                    {
                      iEndPoint++;
                    }
                }
            }
          OldiEndPoint=iEndPoint;
          struct _UDT_VARCODE_ATTRIBUTES  tVar;
          tVar.IsExported=FALSE;
          tVar.UseInLine=UseInLine;
          *piStart=iStartPoint-1;
          InsertTokens((*piStart)-1,1,"function");
          FuncSubDecs1("sub",iStartPoint-1,iEndPoint,&(tVar));
          FuncSubDecs2("sub",mt_FuncSubDecC_Dec,&(tVar),*piStart,&(OldiEndPoint));
          strcpy(tVar.Functype,ltrim(tVar.Functype));
          strcpy(L_FuncName,No_Sigil(Stk[iStartPoint]));
          *piStart=iStartPoint+2;
          while(*piStart<OldiEndPoint){
              GetParameter(piStart,&(tVar),mt_FuncSubDecC_DecAParam,mt_FuncSubDecC_DecNoParam,0);
              (*piStart)++;
            }
          tVar.Methd=mt_FuncSubDecC_DecAParam;
          strcpy(tVar.Token,L_FuncName);
          FuncSubDecs3(&(tVar),OldiEndPoint,1);
          strcat(ptVar->Header,tVar.Header);
          strcat(ptVar->Proto,tVar.Proto);
          *piStart=iEndPoint;
          if(strcmp(Stk[(*piStart)+1],",")==0){
              strcat(ptVar->Header,",");
              strcat(ptVar->Proto,",");
              (*piStart)++;
            }
          g_SubFuncPtr=FALSE;
          return;
        }
      if(strcmp(Stk[iLoc],",")==0  || strcmp(Stk[iLoc],")")==0){
          goto L1520;
        }
      if(m_iMatchWrd(Stk[iLoc],"as")){
          iASPos=iLoc;
        }
      if(m_iMatchWrd(Stk[iLoc],"=")){
          iEQPos=iLoc;
        }
      iLoc++;
    }
L1520:;
  iLoc--;
  if(strcmp(Stk[iLoc],"...")!=0){
      int iIsConst=0;
      if(iEQPos ){
          GetParameterASHelper(iEQPos,iASPos,iOptOk,iLoc);
        }
      if(iASPos ){
          int iLast=iLoc;
          int iAfterAs1=iASPos+1;
          int iAfterAs2=iASPos+2;
          if(iASPos<iEQPos ){
              iLast=iEQPos-1;
            }
          if(iAfterAs1!=iLast ){
              if(m_iMatchWrd(Stk[iAfterAs1],"const")){
                  iIsConst=1;
                  strcpy(Stk[iAfterAs1], join(2,Stk[iAfterAs1],SPC));
                  strcpy(Stk[iAfterAs1], join(2,Stk[iAfterAs1],Stk[iAfterAs2]));
                  *Stk[iAfterAs2]=0;
                }
                {
                int  i;
                for(i=iAfterAs2; i<=iLast; i++)
                  {
                    if(m_iMatchWrd(Stk[i],"ptr")){
                        strcpy(Stk[i],"*");
                      }
                    strcpy(Stk[iAfterAs1], join(2,Stk[iAfterAs1],Stk[i]));
                    *Stk[i]=0;
                  }
                  }
            }
          strcpy(ptVar->AsToken,Stk[iAfterAs1]);
          GetTypeInfo(ptVar->AsToken,&((ptVar->IsPtrFlag)),&(iNd),&((ptVar->VarNo)));
        }
      else
        {
          int iPtrCnt=tally(Stk[*piStart],"*");
          strcpy(ptVar->AsToken, join(2,VarTypeLookup[inchr(c_VARTYPES,right(Stk[*piStart],1))],stringx(iPtrCnt,42)));
          strcpy(Stk[*piStart],RemoveStr(Stk[*piStart],"*"));
          GetTypeInfo(ptVar->AsToken,&((ptVar->IsPtrFlag)),&(iNd),&((ptVar->VarNo)));
        }
      ptVar->Methd=iAParam;
      GetVarCode(ptVar,"GetParameter 1");
      if(iEQPos ){
          ptVar->Methd=iNoParam;
          strcpy(ptVar->Token,Stk[iEQPos]);
          GetVarCode(ptVar,"GetParameter 2");
        }
      AddLocal(ptVar->Token,ptVar->VarNo,0,"",ptVar->IsPtrFlag,0,0,iIsConst);
    }
  else
    {
      ptVar->Methd=iNoParam;
      strcpy(ptVar->Token,Stk[iLoc]);
      GetVarCode(ptVar,"GetParameter 3");
    }
  iLoc++;
  if(strcmp(Stk[iLoc],",")==0){
      ptVar->Methd=iNoParam;
      strcpy(ptVar->Token,Stk[iLoc]);
      GetVarCode(ptVar,"GetParameter 4");
    }
  *piStart=iLoc;
}

int Emit_OptFuncSub (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"optfunction")==0  || strcmp(sWord,"optsub")==0){
      int  IOptLoc;
      struct _UDT_VARCODE_ATTRIBUTES  VarCode;
      VarCode.IsExported=FALSE;
      VarCode.UseInLine=UseInLine;
      FuncSubDecs1("optsub",1,Ndx,&(VarCode));
      InFunction=TRUE;
      LocalVarCnt=0;
      if(InNameSpace ){
          FP_WRITE=FP2;
        }
      else
        {
          if(UsingTemplate==FALSE ){
              FP_WRITE=FP3;
            }
        }
      FuncSubDecs2("optsub",mt_Opts,&(VarCode),1,&(Ndx));
      strcpy(FunctionName,No_Sigil(Stk[2]));
      IOptLoc=4;
      while(IOptLoc<Ndx){
          GetParameter(&(IOptLoc),&(VarCode),mt_OptsAParam,mt_OptsNoParam,1);
          IOptLoc++;
        }
      VarCode.Methd=mt_FuncSubDecC_DecAParam;
      strcpy(VarCode.Token,FunctionName);
      FuncSubDecs3(&(VarCode),Ndx,0);
      if(Use_Static ){
          strcpy(VarCode.Header, join(2,"static ",VarCode.Header));
          strcpy(VarCode.Proto, join(2,"static ",VarCode.Proto));
        }
      AddProto(VarCode.Proto);
      if(strcmp(InIfDef,"FP3")==0){
          *ProtoType[ProtoCnt].Condition=0;
        }
      else
        {
          strcpy(ProtoType[ProtoCnt].Condition,InIfDef);
        }
      ProtoType[ProtoCnt].CondLevel=InConditional;
      fprintf(FP_WRITE,"%s\n",VarCode.Header);
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

int Emit_OverLoadFuncSub (char* sWord,PINT  FuncRetnFlag)
{
  static UDT_VARCODE_ATTRIBUTES  VarCode;
  VarCode.IsExported=FALSE;
  VarCode.UseInLine=UseInLine;
  if(strcmp(sWord,"overloadedfunction")==0  || strcmp(sWord,"overloadedsub")==0){
      static char LTmp[BCXSTRSIZE];
      static int A;
      Use_Overloaded=TRUE;
      FuncSubDecs1("overloadedsub",1,Ndx,&(VarCode));
      if(strcmp(sWord,"overloadedfunction")==0){
          InFunction=eFunctionType;
        }
      else
        {
          InFunction=eSubType;
        }
      InMain=FALSE;
      LocalVarCnt=0;
      if(UsingTemplate==FALSE ){
          FP_WRITE=FP_OVR;
        }
      FuncSubDecs2("overloadedsub",mt_OverLoad,&(VarCode),1,&(Ndx));
      strcpy(FunctionName,No_Sigil(Stk[2]));
      strcpy(LTmp, join(2," overloaded ",FunctionName));
      strcpy(FunctionName,LTmp);
      A=4;
      while(A<Ndx){
          GetParameter(&(A),&(VarCode),mt_OverLoadAParam,mt_OverLoadNoParam,0);
          A++;
        }
      VarCode.Methd=mt_FuncSubDecC_Dec;
      strcpy(VarCode.Token,FunctionName);
      FuncSubDecs3(&(VarCode),Ndx,0);
      if(Use_Static ){
          strcpy(VarCode.Header, join(2,"static ",VarCode.Header));
        }
      fprintf(FP_WRITE,"%s\n",VarCode.Header);
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

int ClassProto (PCHAR szProto)
{
  static int iReturn;
  static int iCnt;
  for(iReturn=0,iCnt=0; iCnt<iClassCnt && iReturn==0; iCnt++)
    {
      if(strcmp(szProto,ClassNames[iCnt])==0){
          iReturn=1;
        }
    }
  return iReturn;
}

int Emit_ConDes (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"constructor")==0  || strcmp(sWord,"destructor")==0){
      if(InFunction ){
          Abort("Syntax Error: already in function");
        }
      int A;
      char CTOR_USE[BCXSTRSIZE];
      int New_Ndx=Ndx;
      int iCPPFunSub;
      struct _UDT_VARCODE_ATTRIBUTES  VarCode;
      VarCode.IsExported=FALSE;
      VarCode.UseInLine=UseInLine;
      iCPPFunSub=0;
      for(int ct=1; ct<=Ndx; ct++)
        {
          if(strcmp(Stk[ct],"using")==0){
              iCPPFunSub=1;
              New_Ndx=ct-1;
              BuildDelimStr(ct+1,Ndx,CTOR_USE);
              goto L1531;
            }
        }
L1531:;
      Ndx=New_Ndx;
      FuncSubDecs1("sub",1,Ndx,&(VarCode));
      IsStdFunc=FALSE;
      InMain=FALSE;
      LocalVarCnt=0;
      if(InNameSpace||InClass||InCppTypeDef ){
          InFunction=FALSE;
          FP_WRITE=FP_UDT;
        }
      else
        {
          InFunction=TRUE;
          if(UsingTemplate==FALSE ){
              FP_WRITE=FP3;
            }
        }
      FuncSubDecs2("sub",mt_ConsDes,&(VarCode),1,&(Ndx));
      strcpy(VarCode.Functype,ltrim(VarCode.Functype));
      strcpy(FunctionName,No_Sigil(Stk[2]));
      A=4;
      while(A<Ndx){
          GetParameter(&(A),&(VarCode),mt_ConsDesAParam,mt_ConsDesNoParam,1);
          A++;
        }
      if((strcmp(sWord,"constructor")==0)  || (ISTRUE(inchr(FunctionName,"~")))){
          strcpy(VarCode.Token,FunctionName);
        }
      else
        {
          strcpy(VarCode.Token, join(2,"~",FunctionName));
        }
      VarCode.Methd=mt_FuncSubDecC_DecAParam;
      FuncSubDecs3(&(VarCode),Ndx,0);
      if(Use_Static ){
          strcpy(VarCode.Header, join(2,"static ",VarCode.Header));
          strcpy(VarCode.Proto, join(2,"static ",VarCode.Proto));
        }
      if(iMatchNQ(VarCode.Proto,"::")==0&&m_IAmNot(InNameSpace)&&m_IAmNot(InClass)&&m_IAmNot(InCppTypeDef)){
          iCPPFunSub=0;
          AddProto(VarCode.Proto);
          if(strcmp(InIfDef,"FP3")==0){
              if(ProtoCnt>1 ){
                  strcpy(ProtoType[ProtoCnt].Condition,ProtoType[ProtoCnt-1].Condition);
                }
              else
                {
                  *ProtoType[ProtoCnt].Condition=0;
                }
            }
          else
            {
              strcpy(ProtoType[ProtoCnt].Condition,InIfDef);
            }
          ProtoType[ProtoCnt].CondLevel=InConditional;
          if(*InIfDef ){
              if(strcmp(InIfDef,"FP3")!=0){
                  fprintf(FP_WRITE,"%s\n",InIfDef);
                }
            }
        }
      if(iCPPFunSub==1 ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,VarCode.Header,": ",CTOR_USE);
        }
      else
        {
          fprintf(FP_WRITE,"%s%s\n",Scoot,VarCode.Header);
        }
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
      goto L1530;
    }
  if(strcmp(sWord,"endconstructor")==0){
      BumpDown("Unbalanced CONSTRUCTOR/END CONSTRUCTOR");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      InFunction=FALSE;
      goto L1530;
    }
  if(strcmp(sWord,"enddestructor")==0){
      BumpDown("Unbalanced DESTRUCTOR/END DESTRUCTOR");
      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
      InFunction=FALSE;
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }

L1530:;

  return 0;
}

int Emit_Implied (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"impfunction")==0){
      int A;
      char szImp[BCXSTRSIZE];
      struct _UDT_VARCODE_ATTRIBUTES  VarCode;
      VarCode.IsExported=FALSE;
      VarCode.UseInLine=UseInLine;
      FuncSubDecs1("sub",1,Ndx,&(VarCode));
      IsStdFunc=FALSE;
      InMain=FALSE;
      LocalVarCnt=0;
      FuncSubDecs2("sub",mt_FuncSubDecC_Dec,&(VarCode),1,&(Ndx));
      *szImp=0;
      for(;;)
        {
          strcpy(szImp, join(2,Stk[Ndx],szImp));
          if(!(strcmp(Stk[Ndx--],"=")!=0)){
              goto L1534;
            }
        }
L1534:;
      strcpy(VarCode.Functype,ltrim(VarCode.Functype));
      strcpy(FunctionName,No_Sigil(Stk[2]));
      A=4;
      while(A<Ndx){
          GetParameter(&(A),&(VarCode),mt_OptsAParam,mt_OptsNoParam,1);
          A++;
        }
      VarCode.Methd=mt_FuncSubDecC_DecAParam;
      strcpy(VarCode.Token,FunctionName);
      FuncSubDecs3(&(VarCode),Ndx,0);
      fprintf(FP_UDT,"%s%s%s%s\n",Scoot,VarCode.Header,szImp,";");
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

int Emit_FuncSub (char* sWord,PINT  FuncRetnFlag)
{
  if(strcmp(sWord,"function")==0  || strcmp(sWord,"sub")==0  || strcmp(sWord,"publicfunction")==0  || strcmp(sWord,"publicsub")==0  || strcmp(sWord,"privatefunction")==0  || strcmp(sWord,"privatesub")==0){
      strcpy(gCurrentFunction,AbortSrc);
      if(InFunction ){
          Abort("Syntax Error: Nested functions not supported.");
        }
      static int A;
      static char CTOR_USE[BCXSTRSIZE];
      static int iCPPFunSub;
      static UDT_VARCODE_ATTRIBUTES  VarCode;
      int New_Ndx=Ndx;
      VarCode.IsExported=FALSE;
      VarCode.UseInLine=UseInLine;
      if(strcmp(sWord,"publicfunction")==0  || strcmp(sWord,"publicsub")==0){
          strcpy(Stk[1],mid(Stk[1],6));
          goto L1537;
        }
      if(strcmp(sWord,"privatefunction")==0  || strcmp(sWord,"privatesub")==0){
          strcpy(Stk[1],mid(Stk[1],7));
        }

L1537:;

      iCPPFunSub=0;
      for(int ct=1; ct<=Ndx; ct++)
        {
          if(m_iMatchWrd(Stk[ct],"using")){
              iCPPFunSub=1;
              New_Ndx=ct-1;
              BuildDelimStr(ct+1,Ndx,CTOR_USE);
              goto L1538;
            }
        }
L1538:;
      Ndx=New_Ndx;
      if(strcmp(Stk[2],"main")==0){
          NoMain=TRUE;
          strcpy(Stk[1],"function");
          strcpy(Stk[2],"main%");
          ForceMainToFunc=TRUE;
        }
      FuncSubDecs1("sub",1,Ndx,&(VarCode));
      IsStdFunc=FALSE;
      if(m_iMatchWrd(Stk[Ndx],"stdcall")){
          strcpy(CallType,"__stdcall ");
          Ndx--;
          IsStdFunc=TRUE;
        }
      InMain=FALSE;
      LocalVarCnt=0;
      if(InNameSpace||InCppTypeDef ){
          InFunction=FALSE;
          FP_WRITE=FP2;
        }
      else
        {
          if(iMatchNQ(sWord,"function")){
              InFunction=eFunctionType;
            }
          else
            {
              InFunction=eSubType;
            }
          if(UsingTemplate==FALSE ){
              FP_WRITE=FP3;
            }
        }
      strcpy(VarCode.Functype,ltrim(VarCode.Functype));
      FuncSubDecs2("sub",mt_FuncSubDecC_Dec,&(VarCode),1,&(Ndx));
      if(UseCpp&&m_iMatchRgt(Stk[2],"operator")==TRUE ){
          strcat(VarCode.Functype,Stk[2]);
          strcat(VarCode.Functype,SPC);
          *FunctionName=0;
          BOOL  bOppFound;
          for(A=3,bOppFound=FALSE; !bOppFound; A++)
            {
              if(*Stk[A]==40 ){
                  if(*Stk[A+1]!=41&&*Stk[A+2]!=40 ){
                      bOppFound=TRUE;
                    }
                  if(A>3&&*Stk[A+1]==41 ){
                      bOppFound=TRUE;
                    }
                }
              if(!bOppFound ){
                  strcat(VarCode.Functype,Stk[A]);
                }
            }
        }
      else
        {
          strcpy(FunctionName,No_Sigil(Stk[2]));
          if(VarCode.IsExported||IsStdFunc ){
              strcpy(FunctionName, join(2,CallType,FunctionName));
            }
          A=4;
        }
      while(A<Ndx){
          if(UseCpp ){
              GetParameter(&(A),&(VarCode),mt_OptsAParam,mt_OptsNoParam,1);
            }
          else
            {
              GetParameter(&(A),&(VarCode),mt_FuncSubDecC_DecAParam,mt_FuncSubDecC_DecNoParam,0);
            }
          A++;
        }
      VarCode.Methd=mt_FuncSubDecC_DecAParam;
      strcpy(VarCode.Token,FunctionName);
      FuncSubDecs3(&(VarCode),Ndx,0);
      if(m_iMatchWrd(Stk[Ndx],"const")){
          strcat(VarCode.Header," const");
        }
      if(m_iMatchLft(VarCode.Header,"main(")){
          strcpy(VarCode.Header,"int main(int argc, PCTSTR argv[])");
          strcpy(VarCode.Proto,"int main(int argc, PCTSTR argv[]);");
          CurrentFuncType=vt_INTEGER;
        }
      if(Use_Static ){
          strcpy(VarCode.Header, join(2,"static ",VarCode.Header));
          strcpy(VarCode.Proto, join(2,"static ",VarCode.Proto));
        }
      if(m_IAmNot(InNameSpace)&&m_IAmNot(InClass)&&m_IAmNot(InCppTypeDef)){
          int iClassFunction;
          char tmp[BCXSTRSIZE];
          strcpy(tmp,extract(VarCode.Proto,"("));
          if(iMatchNQ(tmp,"::")>0 ){
              strcpy(tmp,extract(tmp,"::"));
              iClassFunction=ClassProto(tmp);
              if(iClassFunction==0 ){
                  if(c_MaxClassNames==iClassCnt ){
                      Abort(join(3,"Maximum c_MaxClassNames =",str(c_MaxClassNames)," reached"));
                    }
                  strcpy(ClassNames[iClassCnt],tmp);
                  iClassCnt++;
                }
              iClassFunction=1;
            }
          else
            {
              iClassFunction=0;
            }
          if(iClassFunction==0 ){
              AddProto(VarCode.Proto);
              if(strcmp(InIfDef,"FP3")==0){
                  if(ProtoCnt>1 ){
                      strcpy(ProtoType[ProtoCnt].Condition,ProtoType[ProtoCnt-1].Condition);
                    }
                  else
                    {
                      *ProtoType[ProtoCnt].Condition=0;
                    }
                }
              else
                {
                  strcpy(ProtoType[ProtoCnt].Condition,InIfDef);
                }
              ProtoType[ProtoCnt].CondLevel=InConditional;
              if(NOTNULL(InIfDef)){
                  if(strcmp(InIfDef,"FP3")!=0){
                      fprintf(FP_WRITE,"%s\n",InIfDef);
                    }
                }
            }
        }
      if(InNameSpace||InClass||InCppTypeDef ){
          char szCPP_SF1[BCXSTRSIZE]={0};
          if(InClass&&m_iMatchWrd(Stk[2],InClassName)){
              strcpy(VarCode.Header,remain(VarCode.Header,SPC));
            }
          fprintf(FP_UDT,"%s%s%s",Scoot,szCPP_SF1,VarCode.Header);
          if(iCPPFunSub==1 ){
              fprintf(FP_UDT,"%s%s\n"," : ",CTOR_USE);
            }
          else
            {
              fprintf(FP_UDT,"%s\n","");
            }
          FP_WRITE=FP_UDT;
        }
      else
        {
          fprintf(FP_WRITE,"%s\n",VarCode.Header);
        }
      fprintf(FP_WRITE,"%s%s\n",Scoot,"{");
      BumpUp();
    }
  else
    {
      Emit_Assignments(FuncRetnFlag);
    }
  return 0;
}

void Emit_BCXVariables ()
{
  while(iEmitVarGroup){
      if(1==(iEmitVarGroup&1)){
          Emit_PrinterVariables();
          iEmitVarGroup=iEmitVarGroup^ePrinterGroup;
          goto L1542;
        }
      if(1==((iEmitVarGroup>>1)&1)){
          AddFontVariables();
          iEmitVarGroup=iEmitVarGroup^eFontGroup;
          goto L1542;
        }
      if(1==((iEmitVarGroup>>2)&1)){
          AddClassName();
          iEmitVarGroup=iEmitVarGroup^eClassName;
          goto L1542;
        }
      if(1==((iEmitVarGroup>>3)&1)){
          AddBCX_hInstance();
          iEmitVarGroup=iEmitVarGroup^eBCX_hInstance;
        }
      else
        {
          Abort("Unknown variable grouping was selected (Add to SUB EmitBCXVariables).");
        }

L1542:;

    }
}

void AddBCX_hInstance ()
{
  static int IWasHere=0;
  if(IWasHere ){
      return;
    }
  AddGlobal("BCX_hInstance",vt_HINSTANCE);
  IWasHere++;
}

void AddClassName ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddGlobal("BCX_ClassName",vt_STRVAR);
  IWasHere++;
}

void Emit_PrinterVariables ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddGlobal("BcxPtr_hDC",vt_HDC);
  AddGlobal("BcxPtr_FontMetrix",vt_LONG);
  AddGlobal("BcxPtr_LineCtr",vt_LONG);
  AddGlobal("BcxPtr_PrinterOn",vt_LONG);
  AddGlobal("BcxPtr_hFont",vt_HFONT);
  AddGlobal("BcxPtr_hFontOld",vt_HFONT);
  AddGlobal("BcxPtr_di",vt_DOCINFO);
  AddGlobal("BcxPtr_Lf",vt_LOGFONT);
  AddGlobal("BcxPtr_tm",vt_TEXTMETRIC);
  AddGlobal("BcxPtr_Text",vt_STRVAR);
  AddGlobal("BcxPtr_Buffer",vt_STRVAR);
  IWasHere++;
}

void AddFontVariables ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddGlobal("BCX_ScaleX",vt_SINGLE);
  AddGlobal("BCX_ScaleY",vt_SINGLE);
  IWasHere++;
}

void AddBcxFontVar ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddGlobal("BcxFont",vt_HFONT);
  IWasHere++;
}

void AddPenSizeVariables ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddGlobal("BCX_Pensize=1",vt_INTEGER);
  AddGlobal("BCX_Penstyle=0",vt_INTEGER);
  IWasHere++;
}

void AddGrafixVariables ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddGlobal("BCX_BUFFER_BMWIDTH",vt_INTEGER);
  AddGlobal("BCX_BUFFER_BMHEIGHT",vt_INTEGER);
  AddGlobal("BCX_BUFFER",vt_HDC);
  AddGlobal("BCX_PREV_BMP",vt_HBITMAP);
  AddGlobal("BCX_BUFFER_BMP",vt_BITMAPINFO);
  IWasHere++;
}

void AddGUIGlobals ()
{
  static int IWasHere;
  if(IWasHere ){
      return;
    }
  AddFontVariables();
  AddBCX_hInstance();
  AddGlobal("BCX_hwndMDIClient",vt_HWND);
  AddGlobal("BCX_WndClass",vt_WNDCLASSEX);
  AddGlobal("BCX_GUI_Init",vt_WINBOOL);
  AddGlobal("BCX_ClassName",vt_STRVAR);
  IWasHere++;
}

void ProcessMsgCracker ()
{
  char msg_[BCXSTRSIZE];
  char proc_[BCXSTRSIZE];
  char ret_[BCXSTRSIZE];
  char tmp_[16][BCXSTRSIZE];
  int  tmpNdx;
  int  i;
  int  j;
  i=j=tmpNdx=0;
  FastLexer(Src,SPC,":");
  if(m_iMatchWrd(Stk[3],"inline")){
      strcpy(tmp_[++tmpNdx], join(3,"IF Msg = ",Stk[2]," THEN"));
      if(strcmp(Stk[Ndx],":")!=0){
          strcpy(Stk[++Ndx],":");
        }
      for(i=4,j=4; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],":")==0){
              BuildDelimStr(j,i-1,tmp_[++tmpNdx]);
              j=i+1;
            }
        }
      strcpy(tmp_[++tmpNdx],"END IF");
      for(i=1; i<=tmpNdx; i++)
        {
          Inject(tmp_[i]);
        }
    }
  else
    {
      FastLexer(Src," ,()","");
      strcpy(msg_,Stk[2]);
      strcpy(proc_,Stk[3]);
      strcpy(ret_,Stk[4]);
      if(NOTNULL(ret_)){
          strcpy(ret_, join(2,",",ret_));
        }
      strcpy(Src, join(3,"IF Msg = ",msg_," THEN"));
      Inject(Src);
      if((int)strlen(trim(ret_))>0 ){
          strcpy(Src, join(5,"  FUNCTION=",proc_,"(hWnd,wParam,lParam",ret_,")"));
        }
      else
        {
          strcpy(Src, join(5,space(2),proc_,"(hWnd,wParam,lParam",ret_,")"));
        }
      Inject(Src);
      strcpy(Src,"END IF");
      Inject(Src);
    }
  *Src=0;
}

void ProcessCmdHandler ()
{
  char id_[BCXSTRSIZE];
  char proc_[BCXSTRSIZE];
  char ret_[BCXSTRSIZE];
  char tmp_[16][BCXSTRSIZE];
  int  tmpNdx;
  int  i;
  int  j;
  tmpNdx=0;
  FastLexer(Src,SPC,":");
  if(m_iMatchWrd(Stk[3],"inline")){
      strcpy(tmp_[++tmpNdx], join(3,"IF Msg = WM_COMMAND AND CBCTL = ",Stk[2]," THEN "));
      if(strcmp(Stk[Ndx],":")!=0){
          strcpy(Stk[++Ndx],":");
        }
      for(i=4,j=4; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],":")==0){
              BuildDelimStr(j,i-1,tmp_[++tmpNdx]);
              j=i+1;
            }
        }
      strcpy(tmp_[++tmpNdx],"END IF");
      for(i=1; i<=tmpNdx; i++)
        {
          Inject(tmp_[i]);
        }
    }
  else
    {
      FastLexer(Src," ,()","");
      strcpy(id_,Stk[2]);
      strcpy(proc_,Stk[3]);
      strcpy(ret_,Stk[4]);
      if(NOTNULL(ret_)){
          strcpy(ret_, join(2,",",ret_));
        }
      strcpy(Src, join(3,"IF Msg = WM_COMMAND AND CBCTL = ",id_," THEN"));
      Inject(Src);
      if((int)strlen(trim(ret_))>0 ){
          strcpy(Src, join(5,"  FUNCTION=",proc_,"(hWnd,wParam,lParam",ret_,")"));
          Inject(Src);
        }
      else
        {
          strcpy(Src, join(5,space(2),proc_,"(hWnd,wParam,lParam",ret_,") "));
          Inject(Src);
        }
      strcpy(Src,"END IF");
      Inject(Src);
    }
  *Src=0;
}

void ProcessMsgHandler ()
{
  FastLexer(Src,", ()","");
  strcpy(Src, join(3,"FUNCTION ",Stk[2]," (hWnd AS HWND, wParam AS WPARAM, lParam AS LPARAM, LReturn AS LRESULT=0) AS LRESULT"));
  Inject(Src);
  *Src=0;
}

void ProcessMsgHandlerEnd ()
{
  strcpy(Src,"FUNCTION = LReturn");
  Inject(Src);
  strcpy(Src,"END FUNCTION");
  Inject(Src);
  *Src=0;
}

int Doinclude (char* szWord,PINT  iFLAG)
{
  static int BeenHere;
  *iFLAG=0;
  if(strcmp(szWord,"#include")==0){
      if(BeenHere==FALSE ){
          BeenHere=TRUE;
          fprintf(FP_HDR,"%s\n",SPC);
        }
      fprintf(FP_HDR,"%s%s\n","#include",Src+8);
      goto L1547;
    }
  if(strcmp(szWord,"$include")==0){
      char orgfileName[BCXSTRSIZE]={0};
      strcpy(Src,iReplace(Src,"$BCX$",BcxPath()));
      strcpy(szFile,extract(Src,"'"));
      strcpy(szFile,trim(RemoveStr(mid(szFile,9),DQ)));
      if(*szFile==60 ){
          strcpy(szFile,mid(szFile,2,(int)strlen(szFile)-2));
          strcpy(szFile, join(2,Environ("BCXLIB"),szFile));
        }
      strcpy(orgfileName,szFile);
      if(!Exist(szFile)){
          strcpy(szFile,BcxSplitPath(szFile,FNAME|FEXT));
          strcpy(szFile, join(2,BcxSplitPath(FileNames[FileNdx],FDRV|FPATH),szFile));
        }
      if(!Exist(szFile)){
          printf("%s\n","Debug: Inside FUNCTION Doinclude");
          printf("%s%s\n","Debug: szFile =",szFile);
          printf("%s%s\n","Debug: orgfileName$ =",orgfileName);
          printf("\n");
          Abort(join(2,"Unable to $INCLUDE ",orgfileName));
        }
      PushFileIO();
      if((SourceFile=fopen(szFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", szFile); exit(1);
       }
      FileNdx++;
      strcpy(FileNames[FileNdx],szFile);
      LineNum[FileNdx]=0;
      if(FileNdx==c_MaxFiles-1 ){
          Abort("Maximum Include Files exceeded.");
        }
    }

L1547:;

  return 0;
}

void Generate_Goto (int i,int iSend)
{
  char LszTmp[BCXSTRSIZE];
  sprintf(LoopType[i].szUseNeedLabel,"L%i:;",LoopType[i].iJumpTo);
  if(iSend ){
      sprintf(LszTmp,"goto L%i;",LoopType[i].iJumpTo);
      fprintf(FP_WRITE,"%s%s\n",Scoot,LszTmp);
    }
}

int Doaccelerator (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(Accelerator,RemoveStr(Stk[2],DQ));
  return 0;
}

int Doasm (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  char LTmp[BCXSTRSIZE]={0};
  *iFLAG=0;
  Emit_Optimize("none","0","  // No Optimizations in ASM block");
  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("Unbalanced $Asm");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      if(SrcFlag ){
          fprintf(FP_WRITE,"%s%s\n","// ",Src);
        }
      StripTabs();
      strcpy(Src,trim(Src));
      int meta_asm_loop={0};
      BOOL  meta_asm_comment_present={0};
      int  Src_Len={0};
      Src_Len=(int)strlen(Src);
      meta_asm_comment_present=FALSE;
      for(meta_asm_loop=0; meta_asm_loop<=Src_Len; meta_asm_loop++)
        {
          if(Src[meta_asm_loop]==c_SglQt||Src[meta_asm_loop]==59 ){
              strcpy(LTmp,right(Src,Src_Len-meta_asm_loop-1));
              Src[meta_asm_loop]=0;
              meta_asm_comment_present=TRUE;
              goto L1549;
            }
        }
L1549:;
      strcpy(Src,trim(Src));
      if(m_iMatchLft(Src,"$asm")){
          goto L1548;
        }
      strcpy(Src,replace(Src,"$","0x"));
      strcpy(Src,iReplace(Src,"&h","0x"));
      if(NOTNULL(Src)){
          strcpy(Src, join(3,"_asm(",enc(Src),vchr(1,1)));
          if(meta_asm_comment_present ){
              strcpy(Src, join(4,Src,TAB,"//",LTmp));
            }
          strcpy(SrcTmp,Src);
          fprintf(FP_WRITE,"%s\n","#if !defined(__POCC__) && !defined (__cplusplus)");
          strcpy(Src,replace(Src,vchr(1,1),")"));
          fprintf(FP_WRITE,"%s\n",Src);
          fprintf(FP_WRITE,"%s\n","#else");
          strcpy(SrcTmp,replace(SrcTmp,"_asm(","__asm{"));
          strcpy(SrcTmp,replace(SrcTmp,vchr(1,1),"}"));
          fprintf(FP_WRITE,"%s\n",RemoveStr(SrcTmp,DQ));
          fprintf(FP_WRITE,"%s\n","#endif");
        }
    }
L1548:;
  Emit_Optimize("","1","  // Restoring Optimizer state");
  return 0;
}

int Dobcx_resource (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_GenResFile=TRUE;
  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("Unbalanced $BCX_RESOURCE");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      Sanitize_Code(Src);
      if(m_iMatchLft(ltrim(Src),"$bcx_r")){
          goto L1550;
        }
      fprintf(FP_RES,"%s\n",Src);
    }
L1550:;
  return 0;
}

int Dobcxversion (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(Src,trim(mid(Src,12)));
  strcpy(Src,RemoveStr(Src,DQ));
  if(strcmp(lcase(c_VERSION),lcase(Src))==-1){
      Abort(join(10,CRLF,"Your Translator needs updating.",CRLF," This program ",enc(FileNames[FileNdx])," requires BCX Version: ",Src," or later.",CRLF,CRLF));
    }
  else
    {
      if(c_BCX_COLORS ){
          color(12,0 );
        }
      printf("%s%s%s","This App needs BCX Version ",Src," or newer. ");
      if(c_BCX_COLORS ){
          color(9,0 );
        }
      printf("%s%s\n","[OKAY] Detected BCX ",c_VERSION);
    }
  color(2,0 );
  return 0;
}

int Doccode (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  FILE*  FP_TMP;
  char szWhere[BCXSTRSIZE];
  *iFLAG=0;
  if(Ndx>1 ){
      strcpy(szWhere,lcase(Stk[2]));
    }
  else
    {
      strcpy(szWhere,"default");
    }
  if(strcmp(szWhere,"set")==0){
      FP_TMP=FP_SET;
      goto L1551;
    }
  if(strcmp(szWhere,"header")==0){
      FP_TMP=FP_HDR;
      goto L1551;
    }
  if(strcmp(szWhere,"const")==0){
      FP_TMP=FP_CST;
      goto L1551;
    }
  if(strcmp(szWhere,"udt")==0){
      FP_TMP=FP_UDT;
      goto L1551;
    }
  if(strcmp(szWhere,"enum")==0){
      FP_TMP=FP_ENU;
      goto L1551;
    }
  if(strcmp(szWhere,"funcsub")==0){
      FP_TMP=FP_CCODE;
    }
  else
    {
      if(InFunction ){
          FP_TMP=FP3;
        }
      else
        {
          if(InClass||InCppTypeDef||InNameSpace ){
              FP_TMP=FP_UDT;
            }
          else
            {
              FP_TMP=FP2;
            }
        }
    }

L1551:;

  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("Unbalanced $Ccode");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      StripTabs();
      if(m_iMatchLft(ltrim(Src),"$ccode")){
          if(SrcFlag ){
              fprintf(FP_TMP,"%s%s%s%s%s\n","// [",trim(FileNames[FileNdx])," - ",str(LineNum[FileNdx],1),"] End of $CCODE Block");
            }
          goto L1552;
        }
      fprintf(FP_TMP,"%s\n",rtrim(Src));
    }
L1552:;
  return 0;
}

int Docom_op (char* szWord,PINT  iFLAG)
{
  *iFLAG=0;
  if(strcmp(szWord,"$com_off")==0){
      Use_COM=FALSE;
      ComSwitchON=FALSE;
      goto L1553;
    }
  if(strcmp(szWord,"$com_on")==0){
      Use_COM=Use_BcxTempStr=TRUE;
      ComSwitchON=TRUE;
      goto L1553;
    }
  if(strcmp(szWord,"$com_trace")==0){
      COM_build_trace_code=TRUE;
      printf("%s\n","COM trace code added to translated C file!");
      printf("%s\n","Trace informations will be sent to file: c:\\com_trace.txt");
    }

L1553:;

  return 0;
}

int Docomment (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  static FILE*  TmpFile;
  if(m_IAm(InClass)||m_IAm(InCppTypeDef)){
      TmpFile=FP_UDT;
    }
  else
    {
      TmpFile=FP_WRITE;
    }
  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("Unbalanced $Comment");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      StripTabs();
      if(m_iMatchLft(ltrim(Src),"$comment")){
          goto L1554;
        }
      fprintf(TmpFile,"%s%s\n","// ",Src);
    }
L1554:;
  return 0;
}

int Dofillstring (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  static char TheVariable[BCXSTRSIZE];
  strcpy(Src,IRemoveStr(Src,"$fill"));
  strcpy(Src,trim(Src));
  if(ISFALSE inchr(Src,"$")){
      if(ISFALSE inchr(Src,"[")){
          strcat(Src,"$");
        }
      else
        {
          int i=inchr(Src,"[");
          strcpy(Src, join(3,mid(Src,1,i-1),"$",mid(Src,i)));
        }
    }
  Inject(join(3,Src," = ",enc("")));
  strcpy(TheVariable, join(4,Src," = ",Src," & "));
  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("Unbalanced $FILL");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      StripTabs();
      strcpy(Src,ltrim(Src));
      if(LeftStr(Src,"'")||LeftStr(Src,"rem",TRUE)){
          *Src=0;
        }
      if(LeftStr(Src,"$fill",TRUE)){
          goto L1555;
        }
      strcpy(Src,replace(Src,BKSLASH2,BKSLASH4));
      strcpy(Src,replace(Src,BKSLASH1,BKSLASH2));
      if(NOTNULL(Src)){
          Inject(join(2,TheVariable,Src));
        }
    }
L1555:;
  *Src=0;
  return 0;
}

int DoWarningsOn (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  WarningFlag=TRUE;
  return 0;
}

int DoWarningsOff (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  WarningFlag=FALSE;
  return 0;
}

int DoZap (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  ZapFlag=TRUE;
  return 0;
}

int Docompiler (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(Src,remain(Src,SPC));
  strcpy(Compiler,trim(Src));
  return 0;
}

int DoBcxStrSize (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(UserBcxStrSize,trim(remain(Src,SPC)));
  return 0;
}

int Docpp (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  UNREFERENCED_PARAMETER(iFLAG);
  UseCpp=TRUE;
  return 0;
}

int Docpphdr (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  UseCpphdr=TRUE;
  UseIO=TRUE;
  return 0;
}

int Docproto (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  FastLexer(Src,SPC,"!");
  if(m_iMatchWrd(Stk[2],"!")){
      AddProto(remain(Src,"!"));
      *ProtoType[ProtoCnt].Condition=0;
      ProtoType[ProtoCnt].CondLevel=0;
    }
  else
    {
      int i=iMatchNQ(Src,"function");
      if(i==0 ){
          i=iMatchNQ(Src,"sub");
        }
      if(i ){
          strcpy(Src, join(2,"c_declare ",mid(Src,i)));
        }
      else
        {
          i=iMatchNQ(Src,"$cproto");
          strcpy(Src, join(2,"c_declare function ",mid(Src,i+7)));
        }
      PassOne=TRUE;
      PreParse(Src);
      PassOne=FALSE;
      UseCProto=TRUE;
      *iFLAG=2;
    }
  return *iFLAG;
}

int Dodefine (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  UNREFERENCED_PARAMETER(iFLAG);
  char Tmp[BCXSTRSIZE]={0};
  strcpy(Tmp,"#define");
  for(int i=2; i<=Ndx; i++)
    {
      strcat(Tmp,SPC);
      strcat(Tmp,Stk[i]);
      *Stk[i]=0;
    }
  strcpy(Tmp,replace(Tmp," ) = ",") "));
  strcpy(Tmp,replace(Tmp," ( "," ("));
  strcpy(Tmp,replace(Tmp," , ",","));
  strcpy(Tmp,replace(Tmp," CONST "," const "));
  strcpy(Tmp,replace(Tmp," INT "," int "));
  strcpy(Tmp,replace(Tmp," LONG "," long "));
  strcpy(Tmp,replace(Tmp," DOUBLE "," double "));
  strcpy(Tmp,replace(Tmp," FLOAT "," float "));
  fprintf(FP_DEF,"%s\n",Tmp);
  Ndx=0;
  return 0;
}

int Dodll (char* szWord,PINT  iFLAG)
{
  *iFLAG=0;
  if(strcmp(szWord,"$dll")==0){
      MakeDLL=TRUE;
      Ndx=0;
      if(m_iMatchWrd(Stk[2],"stdcall")){
          UseStdCall=TRUE;
        }
      if(NoDllMain==FALSE ){
          fprintf(FP_WRITE,"%s\n","");
          fprintf(FP_WRITE,"%s\n","__declspec(dllexport) BOOL WINAPI DllMain (HINSTANCE hInst, ULONG Reason, PVOID Reserved)");
          fprintf(FP_WRITE,"%s\n","{");
          fprintf(FP_WRITE,"%s\n","  switch (Reason)");
          fprintf(FP_WRITE,"%s\n","  {");
          fprintf(FP_WRITE,"%s\n","    case DLL_PROCESS_ATTACH:");
          fprintf(FP_WRITE,"%s\n","      BCX_hInstance = hInst;");
          fprintf(FP_WRITE,"%s\n","      break;");
          fprintf(FP_WRITE,"%s\n","    case DLL_PROCESS_DETACH:");
          fprintf(FP_WRITE,"%s\n","      break;");
          fprintf(FP_WRITE,"%s\n","    case DLL_THREAD_ATTACH:");
          fprintf(FP_WRITE,"%s\n","      break;");
          fprintf(FP_WRITE,"%s\n","    case DLL_THREAD_DETACH:");
          fprintf(FP_WRITE,"%s\n","      break;");
          fprintf(FP_WRITE,"%s\n","   }");
          fprintf(FP_WRITE,"%s\n"," return TRUE;");
          fprintf(FP_WRITE,"%s\n","}\n\n");
          AddBCX_hInstance();
        }
      goto L1557;
    }
  if(strcmp(szWord,"$nodllmain")==0){
      NoDllMain=TRUE;
    }

L1557:;

  return 0;
}

int Dofiletest (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  if(m_iMatchWrd(Stk[2],"ON")){
      UseFileTest=TRUE;
    }
  else if(m_iMatchWrd(Stk[2],"OFF")){
      UseFileTest=FALSE;
    }
  else
    {
      Abort(join(3,"Unrecognized argument '",Stk[2],"' to $FILETEST"));
    }
  return 0;
}

int Dofsstatic (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_Static=!Use_Static;
  return 0;
}

int Dogenfree (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_GenFree=TRUE;
  return 0;
}

int Doheader (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  fprintf(FP_HDR,"%s\n",SPC);
  fprintf(FP_HDR,"%s\n","// *************************************************");
  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("Unbalanced $Header");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      StripTabs();
      strcpy(Src,trim(Src));
      if(m_iMatchLft(Src,"$header")){
          goto L1558;
        }
      fprintf(FP_HDR,"%s\n",Src);
    }
L1558:;
  return 0;
}

int Dointerface (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  UseCpp=TRUE;
  strcpy(Src,remain(Src,SPC));
  fprintf(FP_UDT,"%s%s%s\n","interface ",Src,"\n  {");
  for(;;)
    {
      if(EoF(SourceFile)){
          Abort("$Interface Without $EndInterface");
        }
      Src[0]=0;
      fgets(Src, 2048 , SourceFile);
        if(feof(SourceFile) || (Src[strlen(Src)-1]==10))
          {
           Src[strcspn(Src,"\r\n")] = 0;
          }
         else
          {
            printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(SourceFile));
            printf("%s\n","The actual truncated line of text:");
            printf("%s",Src);
            exit(1);
          }
      LineNum[FileNdx]++;
      if(m_iMatchLft(ltrim(Src),"$endinterface")){
          *Src=0;
          goto L1559;
        }
      fprintf(FP_UDT,"%s\n",Src);
    }
L1559:;
  strcpy(Src,remain(Src,SPC));
  strcpy(Src,trim(Src));
  fprintf(FP_UDT,"%s%s%s\n","  } ",Src,";");
  return 0;
}

int Doiprint (char* szWord,PINT  iFLAG)
{
  *iFLAG=0;
  if(strcmp(szWord,"$iprint_on")==0){
      TranslateSlash=TRUE;
      goto L1560;
    }
  if(strcmp(szWord,"$iprint_off")==0){
      TranslateSlash=FALSE;
    }

L1560:;

  return 0;
}

int DoCase_offon (char* szWord,PINT  iFLAG)
{
  *iFLAG=0;
  if(strcmp(szWord,"$case_on")==0){
      IgnoreStrCase=FALSE;
      goto L1561;
    }
  if(strcmp(szWord,"$case_off")==0){
      IgnoreStrCase=TRUE;
    }

L1561:;

  return 0;
}

int Doleanandmean (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_LeanAndMean=TRUE;
  return 0;
}

int Doliberror (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_BcxTempStr=Use_Date=Use_Time=Use_LoadLibraryError=TRUE;
  if(*Stk[2]!=c_DblQt ){
      Abort("$LIBERROR requires a string literal");
    }
  strcpy(LibraryErrorLog,Stk[2]);
  return 0;
}

int Dolibrary (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(Src,replace(Src,BKSLASH1,BKSLASH2));
  strcpy(Src,IRemoveStr(Src,"$library"));
  strcpy(Src,trim(Src));
  AddLibrary(Src);
  return 0;
}

int Dolinker (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(Src,remain(Src,SPC));
  strcpy(Linker,Src);
  return 0;
}

int Domultithread (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_MULTITHREADED_SW=TRUE;
  return 0;
}

int DoNoBorland (char* szWord,PINT  iFLAG)
{
  NO_BORLAND=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int DoNoGccClang (char* szWord,PINT  iFLAG)
{
  NO_GCCCLANG=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int DoNoLccwin (char* szWord,PINT  iFLAG)
{
  NO_LCCWIN=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int DoNoLibs (char* szWord,PINT  iFLAG)
{
  NO_LIBS=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int DoNoMsvc (char* szWord,PINT  iFLAG)
{
  NO_MSVC=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int DoNoPelles (char* szWord,PINT  iFLAG)
{
  NO_PELLES=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int DoNoVkkeys (char* szWord,PINT  iFLAG)
{
  NO_VKKEYS=TRUE;
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  return 0;
}

int Donoini (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  TestForBcxIni=TRUE;
  return 0;
}

int Donoio (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  UseIO=FALSE;
  return 0;
}

int Doremovelib (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  strcpy(Src,replace(Src,BKSLASH1,BKSLASH2));
  strcpy(Src,IRemoveStr(Src,"$nolibrary"));
  RemoveLibrary(Src);
  return 0;
}

int Donomain (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  NoMain=TRUE;
  return 0;
}

int Donowin (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  WinHeaders=FALSE;
  return 0;
}

int Doonentry (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  PassOne=TRUE;
  PreParse(Src);
  PassOne=FALSE;
  EntryCnt++;
  if(c_MaxOnEntry==EntryCnt ){
      Abort("Maximum $OnEnty exceeded.");
    }
  strcpy(Entry[EntryCnt],Stk[2]);
  return 0;
}

int Doonexit (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  XitCount++;
  if(c_MaxOnExit==XitCount ){
      Abort("Maximum $OnExit exceeded.");
    }
  strcpy(Xit[XitCount],Stk[2]);
  return 0;
}

int Dooptimizer (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  char szState[BCXSTRSIZE];
  *iFLAG=2;
  strcpy(szState,lcase(Stk[2]));
  *Src=0;
  if(strcmp(szState,"on")==0){
      if(OptimizerFirstSetting==TRUE ){
          OptimizerFirstSetting=FALSE;
          strcpy(Src,"~pragmaoptimizeon");
          OptimizerEnabled=TRUE;
        }
      else
        {
          if(OptimizerEnabled==FALSE ){
              OptimizerEnabled=TRUE;
              strcpy(Src,"~pragmaoptimizeon");
            }
        }
    }
  else if(strcmp(szState,"off")==0){
      if(OptimizerFirstSetting==TRUE ){
          OptimizerFirstSetting=FALSE;
          strcpy(Src,"~pragmaoptimizeoff");
          OptimizerEnabled=FALSE;
        }
      else
        {
          if(OptimizerEnabled==TRUE ){
              OptimizerEnabled=FALSE;
              strcpy(Src,"~pragmaoptimizeoff");
            }
        }
    }
  else
    {
      Abort(join(2,"Error in $OPTIMIZER MetaStatement: ",Src));
    }
  PreParse(Src);
  return 2;
}

int Dopack (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  int iLoc=2;
  *iFLAG=0;
  FastLexer(Src,"","()");
  if(strcmp(Stk[iLoc],"(")==0){
      iLoc++;
    }
  fprintf(FP_UDT,"%s%s%s\n","#pragma pack (",Stk[iLoc],")");
  return 0;
}

int Dopp (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  PPFlag=!PPFlag;
  if(PPFlag ){
      if(PPDLL_HANDLE==NULL ){
          PPDLL_HANDLE=LoadLibrary("BCXPP.DLL");
          if(!PPDLL_HANDLE ){
              Abort("Failed to Open BCX Preprocessor DLL!");
            }
          else
            {
              printf("%s\n","BCXPP.DLL Successfully Loaded");
            }
#if defined __GNUC__ 
#pragma GCC diagnostic ignored "-Wcast-function-type"
          PPProc=(CPP_FARPROC)GetProcAddress(PPDLL_HANDLE,"ProcessLine");
#pragma GCC diagnostic pop
#else
#ifndef _MSC_VER 
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
          PPProc=(CPP_FARPROC)GetProcAddress(PPDLL_HANDLE,"ProcessLine");
#endif
          if(!PPProc ){
              Abort("'FUNCTION ProcessLine' missing in BCX Preprocessor DLL!");
            }
        }
    }
  return 0;
}

int Doprj (char* szWord,PINT  iFLAG)
{
  *iFLAG=0;
  if(strcmp(szWord,"$prj")==0){
      strcpy(Project, join(2,ucase(extract(command(1),".")),".USE"));
      strcpy(HFile, join(2,ucase(extract(command(1),".")),".H"));
      Use_SingleFile=FALSE;
      Use_BcxTempStr=TRUE;
      goto L1562;
    }
  if(strcmp(szWord,"$prjuse")==0){
      Use_BcxTempStr=TRUE;
      FastLexer(Src,SPC,c_FULLSET);
      SetUsed();
    }

L1562:;

  return 0;
}

int Doproject (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  EnableProject();
  return 0;
}

int Dorems (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  InsertComments=~InsertComments;
  *Src=0;
  Ndx=0;
  return 0;
}

int Doresource (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  Use_Resource=TRUE;
  strcpy(ResCompiler,Stk[2]);
  strcpy(UserResFile,RemoveStr(Stk[3],DQ));
  return 0;
}

int Dosource (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  SrcFlag=!SrcFlag;
  return 0;
}

int Dostdcall (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  UseStdCall=TRUE;
  return 0;
}

int Dotest (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  TestState=!TestState;
  return 0;
}

int Dotrace (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  TraceFlag=!TraceFlag;
  return 0;
}

int Dotypedef (char* szWord,PINT  iFLAG)
{
  UNREFERENCED_PARAMETER(szWord);
  *iFLAG=0;
  fprintf(FP_UDT,"%s\n","");
  strcpy(Src,iReplace(Src,"callback","CALLBACK"));
  strcpy(Src,iReplace(Src,"pchar","PCHAR"));
  fprintf(FP_UDT,"%s%s%s\n","typedef ",remain(Src,SPC),";");
  return 0;
}

int IMAX (int a,int b)
{
  if(a>b ){
      return a;
    }
  else
    {
      return b;
    }
}

int IMIN (int a,int b)
{
  if(a<b ){
      return a;
    }
  else
    {
      return b;
    }
}

void StdProtos (FILE* FP_OUTPUT)
{
  if(Use_Project==FALSE ){
      if(Use_BcxTempStr||Use_Console||Use_Proto ){
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s%s\n","//      ",c_BCX_STR_STD_PROTOS);
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_GUINoMain||Use_MDIGUINoMain||Use_Wingui ){
          if(Use_BCX_FrameWnd ){
              fprintf(FP_OUTPUT,"%s\n","HWND    BCX_FrameWnd (PCTSTR, WNDPROC, PCTSTR, HMENU=NULL, int=0, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=0, int=0);");
            }
          if(Use_BCX_Wnd ){
              fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Wnd (PCTSTR, WNDPROC, PCTSTR, HWND=0, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=0, int=0, int=0);");
            }
          if(Use_BCX_SetBkGrdBrush ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_SetBkGrdBrush (HWND, HBRUSH);");
            }
          if(Use_BCX_SetClassStyle ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_SetClassStyle (HWND, long);");
            }
          if(Use_BCX_SetIcon ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_SetIcon (HWND, int);");
            }
          if(Use_BCX_SetIconSm ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_SetIconSm (HWND, int);");
            }
          if(Use_BCX_SetCursor ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_SetCursor (HWND, PCTSTR);");
            }
          if(Use_BCX_SetMetric ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_SetMetric (PCTSTR);");
            }
          if(Use_GUINoMain ){
              if(Use_BCX_MsgPump ){
                  fprintf(FP_OUTPUT,"%s\n","int     BCX_MsgPump (HACCEL=0);");
                }
            }
          else if(Use_MDIGUINoMain ){
              if(Use_BCX_MDI_MsgPump ){
                  fprintf(FP_OUTPUT,"%s\n","int     BCX_MDI_MsgPump (HACCEL=0);");
                }
            }
          if(Use_BCX_RegWnd ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_RegWnd (PCTSTR, WNDPROC);");
            }
          if(Use_BCX_InitGUI ){
              fprintf(FP_OUTPUT,"%s\n","void    BCX_InitGUI (void);");
            }
        }
      if(Use_Clng ){
          fprintf(FP_OUTPUT,"%s\n","long    CLNG (double);");
        }
      if(Use_Cint ){
          fprintf(FP_OUTPUT,"%s\n","int     Cint (double);");
        }
      if(Use_Tix ){
          fprintf(FP_OUTPUT,"%s\n","void    TIX_START(void);");
          fprintf(FP_OUTPUT,"%s\n","double  TIX_NOW(void);");
        }
      if(Use_StartupCode ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_StartupCode_ (void);");
        }
      if(Use_ExitCode ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_ExitCode_ (void);");
        }
      if(Use_Eof ){
          fprintf(FP_OUTPUT,"%s\n","int     EoF (FILE*);");
        }
      if(Use_NamePathFromFP==TRUE ){
          fprintf(FP_OUTPUT,"%s\n","char*   NamePathFromFP (FILE*);");
        }
      if(Use_Longestline ){
          fprintf(FP_OUTPUT,"%s\n","UINT    LongestLine(PCTSTR);");
        }
      if(Use_Nextlinelen ){
          fprintf(FP_OUTPUT,"%s\n","UINT    NextLineLen (FILE*);");
        }
      if(Use_AppActivate ){
          fprintf(FP_OUTPUT,"%s\n","int     AppActivate (PCTSTR);");
        }
      if(Use_BoxCommon ){
          fprintf(FP_OUTPUT,"%s\n","PWORD   lpwAlign (PWORD);");
        }
      if(Use_Inputbox ){
          fprintf(FP_OUTPUT,"%s\n","char*   InputBox (PCTSTR, PCTSTR, PCTSTR, int=0);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CreatePrompter (PCTSTR, PCTSTR, PCTSTR, int);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK Prompter (HWND, UINT, WPARAM, LPARAM);");
        }
      if(Use_VBS ){
          fprintf(FP_OUTPUT,"%s\n","HRESULT VBS_RUN_SCRIPT (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","HRESULT VBS_ADDCODE    (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","double  VBS_EVAL_NUM   (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","char*   VBS_EVAL_STR   (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","BOOL    VBS_START      (void);");
          fprintf(FP_OUTPUT,"%s\n","void    VBS_STOP       (void);");
          fprintf(FP_OUTPUT,"%s\n","void    VBS_RESET      (void);");
          fprintf(FP_OUTPUT,"%s\n","char*   VBS_ERROR      (void);");
        }
      if(Use_Infobox ){
          fprintf(FP_OUTPUT,"%s\n","void    InfoBox (PCTSTR, PCTSTR, int=170, int=170);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK CB_InfoBox (HWND, UINT, WPARAM, LPARAM);");
        }
      if(Use_Mdigui ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_MDICHILD (PCTSTR, PCTSTR, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=CW_USEDEFAULT, int=CW_USEDEFAULT, ULONG=0, LPARAM=0);");
          fprintf(FP_OUTPUT,"%s\n","void    BCX_MDICLASS (WNDPROC, PCHAR);");
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_MDICLIENT (HWND, int);");
        }
      if(Use_BCX_Colordlg ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_ColorDlg (ULONG=RGB(128, 128, 128), HWND=0);");
        }
      if(Use_BCXMDialog ){
          fprintf(FP_OUTPUT,"%s\n","INT_PTR BCX_MDialog (DLGPROC, PCTSTR, HWND, int=0, int=0, int=250, int=150, int=0, int=0, PCTSTR=NULL, int=0);");
        }
      if(Use_BCXDialog ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Dialog (DLGPROC, PCTSTR, HWND, int=0, int=0, int=250, int=150, int=0, int=0, PCTSTR=NULL, int=0);");
        }
      if(Use_BCXDialogCommon ){
          fprintf(FP_OUTPUT,"%s\n","void    SetDialogScale (HWND, BOOL);");
        }
      if(Use_SetDimension ){
          fprintf(FP_OUTPUT,"%s\n","void    SetDimension (PCTSTR , int, HWND, BOOL=FALSE);");
        }
      if(Use_GetDimension ){
          fprintf(FP_OUTPUT,"%s\n","int     GetDimension (PCTSTR ,HWND, BOOL=FALSE);");
        }
      if(Use_Form ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Form (PCTSTR, int=0, int=0, int=250, int=150, int=-1, int=0);");
        }
      if(Use_Setclientsize ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_SetClientSize (HWND, int, int, float=1.0f, float=1.0f);");
        }
      if(Use_BCX_Get_Window_Width ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Get_Window_Width (HWND);");
        }
      if(Use_BCX_Get_Window_Height ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Get_Window_Height (HWND);");
        }
      if(Use_Edit ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Edit (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
        }
      if(Use_BCX_Input ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Input (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
        }
      if(Use_Button ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Button (PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=-1);");
        }
      if(Use_BmpButton ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_BmpButton (PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=0, int=-1);");
        }
      if(Use_SplitButton ){
          fprintf(FP_OUTPUT,"%s\n","typedef struct {");
          fprintf(FP_OUTPUT,"%s\n","  char szLabel[256];");
          fprintf(FP_OUTPUT,"%s\n","  int  nID;");
          fprintf(FP_OUTPUT,"%s\n","} BCX_SPLITBUTTONDATA;\n\n");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","#define BCX_MAX_SPLITBUTTONS 64");
          fprintf(FP_OUTPUT,"%s\n","#define BCX_MAX_SPLITBUTTON_ITEMS 32\n");
          fprintf(FP_OUTPUT,"%s\n","typedef struct {");
          fprintf(FP_OUTPUT,"%s\n","  HWND    hWnd;");
          fprintf(FP_OUTPUT,"%s\n","  int     nCtlID;");
          fprintf(FP_OUTPUT,"%s\n","  HMENU   hPopupMenu;");
          fprintf(FP_OUTPUT,"%s\n","  int     nItemCount;");
          fprintf(FP_OUTPUT,"%s\n","  WNDPROC lpfnOrigProc;");
          fprintf(FP_OUTPUT,"%s\n","} BCX_SPLITBUTTONINFO;\n");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","static BCX_SPLITBUTTONINFO BCX_SplitButtons[BCX_MAX_SPLITBUTTONS];");
          fprintf(FP_OUTPUT,"%s\n","static int BCX_SplitButtonCount = 0;\n\n");
          fprintf(FP_OUTPUT,"%s\n","HWND BCX_SplitButton(PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
          fprintf(FP_OUTPUT,"%s\n","void BCX_SplitButton_SetItems(HWND, BCX_SPLITBUTTONDATA*, int);");
          fprintf(FP_OUTPUT,"%s\n","void BCX_SplitButton_AddItem(HWND, PCTSTR, int);");
          fprintf(FP_OUTPUT,"%s\n","void BCX_SplitButton_AddSeparator(HWND);");
        }
      if(Use_Label ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Label (PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_Group ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Group (PCTSTR, HWND, int, int, int, int, int, int=0, int=0);");
        }
      if(Use_Checkbox ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Checkbox (PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_Radio ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Radio (PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_Combobox ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Combobox (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
        }
      if(Use_Listbox ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Listbox (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
        }
      if(Use_Blackrect ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_BlackRect (PCTSTR, HWND, int, int, int, int, int, int=0, int=0);");
        }
      if(Use_Whiterect ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_WhiteRect (PCTSTR, HWND, int, int, int, int, int, int=0, int=0);");
        }
      if(Use_Grayrect ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_GrayRect (PCTSTR, HWND, int, int, int, int, int, int=0, int=0);");
        }
      if(Use_Datepick ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_DatePick (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
        }
      if(Use_Richedit ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_RichEdit (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
          fprintf(FP_OUTPUT,"%s\n","void    SetWindowRTFText (HWND, PCTSTR);");
        }
      if(Use_Status ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Status (PCTSTR, HWND, int=200, int=1, PINT=NULL);");
        }
      if(Use_BCX_OlePicture ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_OlePicture (PCTSTR, HWND=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_Bitmap ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Bitmap (PCTSTR, HWND=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_Icon ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Icon (PCTSTR, HWND=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_Listview ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_ListView (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1, int=15);");
        }
      if(Use_Treeview ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Treeview (PCTSTR, HWND, int, int, int, int, int, int=0, int=-1);");
        }
      if(Use_BCX_Control ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Control (PCTSTR, HWND, PCTSTR, int, int, int, int, int, int=0, int=0);");
        }
      if(Use_ProgressBar ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_ProgressBar (PCTSTR, HWND, int=0, int=0, int=0, int=0, int=0, int=0, int=-1);");
        }
      if(Use_BCX_Slider ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Slider (PCTSTR, HWND, int, int, int, int, int, int=0, int=0, int=0);");
        }
      if(Use_BCX_Splitter ){
          fprintf(FP_OUTPUT,"%s\n","void    DrawXorBar (HWND, RECT *);");
          fprintf(FP_OUTPUT,"%s\n","int     BCX_SetSplitPos (HWND, int=50, int=0);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK SplitterWndProc (HWND, UINT, WPARAM, LPARAM);");
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Splitter (HWND, int, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_BCX_Toolbar ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Toolbar (HWND, int, int, PCTSTR=NULL, PINT=NULL, PVOID=NULL, PINT=NULL, int=0, int=0, int=0, int=0);");
        }
      if(Use_BCX_Tab ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_Tab (HWND, int, int, HWND *, char[][BCXSTRSIZE], int, int, int, int, HIMAGELIST=NULL, int=0, int=0);");
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_AddTab (HWND, int, PCTSTR, int=-1, int=0);");
          fprintf(FP_OUTPUT,"%s\n","void    BCX_RemTab (HWND, int);");
          fprintf(FP_OUTPUT,"%s\n","int     BCX_TabSelect (HWND, LPARAM);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK TabPageWndProc (HWND, UINT, WPARAM, LPARAM);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK TabCallback (HWND, UINT, WPARAM, LPARAM);");
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK TabSizeCallback (HWND, UINT, WPARAM, LPARAM);");
        }
      if(Use_Draw ){
          fprintf(FP_OUTPUT,"%s\n","HDC     StartDraw (HWND);");
          fprintf(FP_OUTPUT,"%s\n","HBITMAP EndDraw (HWND, HDC);");
        }
      if(Use_BCX_UpDown ){
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_UpDown (HWND, int, int, int, int, int, int, int=0);");
        }
      if(Use_BCX_Get_UpDown ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Get_UpDown (HWND);");
        }
      if(Use_BCX_Print ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Print (HWND, int, int, PCTSTR, HDC=NULL);");
        }
      if(Use_BCX_Printex ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Printex (HWND, long, long, char*, long, long, char*, long, HDC=NULL);");
        }
      if(Use_SetFormColor ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Set_Form_Color (HWND, ULONG);");
        }
      if(Use_BCX_Tile ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Tile (HWND, HBITMAP);");
        }
      if(Use_GetText ){
          fprintf(FP_OUTPUT,"%s\n","char*   BCX_Get_Text (HWND);");
        }
      if(Use_GetResource ){
          fprintf(FP_OUTPUT,"%s\n","PVOID   GetResource (int, char*, ULONG*);");
        }
      if(Use_SetText ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Set_Text (HWND, PCTSTR);");
        }
      if(Use_Elf ){
          fprintf(FP_OUTPUT,"%s\n","void    EditLoadFile (HWND, PCTSTR);");
        }
      if(Use_ListBoxLoadFile ){
          fprintf(FP_OUTPUT,"%s\n","void    ListBoxLoadFile (HWND, PCTSTR, int=0, int=0);");
        }
      if(Use_ComboBoxLoadFile ){
          fprintf(FP_OUTPUT,"%s\n","void    ComboBoxLoadFile (HWND, PCTSTR);");
        }
      if(Use_SetFont ){
          fprintf(FP_OUTPUT,"%s\n","HFONT   BCX_Set_Font (PCTSTR, float, int=0, int=0, int=0, int=0, int=0, int=0);");
        }
      if(Use_BCX_Preset ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Preset (HWND, int, int, HDC=NULL);");
        }
      if(Use_BCX_Line ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Line (HWND, int, int, int, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Polar_Line ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Polar_Line(HWND, int, int, float, float, ULONG, HDC=NULL);");
        }
      if(Use_BCX_Lineto ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Lineto (HWND, int, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Triangle ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Triangle(HWND, LONG, LONG, LONG, LONG, LONG, LONG, DWORD, LONG, HDC=NULL);");
        }
      if(Use_BCX_Gradient ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Gradient(HWND, ULONG, ULONG, int, HDC=NULL);");
        }
      if(Use_BCX_Polygon ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Polygon (HWND, const POINT *, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_PolyBezier ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_PolyBezier (HWND, const POINT *, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Polyline ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Polyline (HWND, const POINT*, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Circle ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Circle (HWND, int, int, int, int=0, int=0, HDC=NULL);");
        }
      if(Use_BCX_Ellipse ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Ellipse (HWND, int, int, int, int, int=0, int=0, HDC=NULL);");
        }
      if(Use_BCX_Rectangle ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Rectangle (HWND, int, int, int, int, int=0, int=0, HDC=NULL);");
        }
      if(Use_BCX_Roundrect ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Roundrect(HWND, int, int, int, int, int, int, int=0, int=0, HDC=NULL);");
        }
      if(Use_BCX_Arc ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Arc (HWND, int, int, int, int, int, int, int, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Pie ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Pie(HWND, int, int, int, int, int, int, int, int, int=0, int=0, HDC=NULL);");
        }
      if(Use_Set_BCX_Bitmap ){
          fprintf(FP_OUTPUT,"%s\n","void    Set_BCX_Bitmap (HWND, PCTSTR, int=0, int=0, int=0);");
        }
      if(Use_Set_BCX_Bitmap2 ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP Set_BCX_Bitmap2 (HWND, HBITMAP, int=1);");
        }
      if(Use_Newbmp ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP NewBmp (void);");
        }
      if(Use_Makebmp ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP MakeBmp (HDC);");
        }
      if(Use_Makehdc ){
          fprintf(FP_OUTPUT,"%s\n","HDC     MakeHdc (HBITMAP);");
        }
      if(Use_Set_BCX_BmpButton ){
          fprintf(FP_OUTPUT,"%s\n","void    Set_BCX_BmpButton (HWND, PCTSTR, int=0);");
        }
      if(Use_Set_BCX_Icon ){
          fprintf(FP_OUTPUT,"%s\n","void    Set_BCX_Icon (HWND, PCTSTR, int=0, int=0, int=0);");
        }
      if(Use_BCX_Fontdlg ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_FontDlg (BOOL=0, HWND=0);");
        }
      if(Use_BCX_Blit ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Blit (HBITMAP,HDC);");
        }
      if(Use_BCX_Blit_Stretch ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Blit_Stretch (HBITMAP,HDC);");
        }
      if(Use_BCX_Blit_Sprite ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Blit_Sprite (HBITMAP, int, int, ULONG, HDC);");
        }
      if(Use_BCX_Buffer ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_BUFFER_START (int, int);");
          fprintf(FP_OUTPUT,"%s\n","void    BCX_BUFFER_STOP  (HWND);");
        }
      if(Use_BCX_Pset ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_Pset (HWND, int, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Polar_Pset ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Polar_Pset(HWND, int, int, float, float, ULONG, HDC=NULL);");
        }
      if(Use_BCX_Floodfill ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_FloodFill (HWND, int, int, int, int, int=0, HDC=NULL);");
        }
      if(Use_BCX_Getpixel ){
          fprintf(FP_OUTPUT,"%s\n","ULONG   BCX_Getpixel (HWND, int, int, HDC=NULL);");
        }
      if(Use_BCX_Get ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP BCX_Get (HWND, int, int, int, int, int=SRCCOPY, HDC=NULL);");
        }
      if(Use_BCX_Put ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Put (HWND, HBITMAP, int, int, int, int, int=SRCCOPY, HDC=NULL);");
        }
      if(Use_BCX_LoadBMP ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP BCX_LoadBMP (PCTSTR, int=0, int=0);");
        }
      if(Use_BCX_LoadImage ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP BCX_LoadImage (PCTSTR, int=0);");
        }
      if(Use_DrawTransBMP ){
          fprintf(FP_OUTPUT,"%s\n","void    DrawTransBMP (HWND, HBITMAP, ULONG, int, int, HDC=NULL);");
        }
      if(Use_DrawStr ){
          fprintf(FP_OUTPUT,"%s\n","void    Draw(char* DrawString);");
        }
      if(Use_BCX_BmpWidth ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_BmpWidth (HBITMAP);");
        }
      if(Use_BCX_ToolTip ){
          fprintf(FP_OUTPUT,"%s\n","LRESULT BCX_ToolTip (PCTSTR, HWND, int=0);");
          fprintf(FP_OUTPUT,"%s\n","HWND    BCX_CreateToolTip (HWND, int);");
        }
      if(Use_BCX_BmpHeight ){
          fprintf(FP_OUTPUT,"%s\n","int     BCX_BmpHeight (HBITMAP);");
        }
      if(Use_QBColor ){
          fprintf(FP_OUTPUT,"%s\n","ULONG   qbcolor (int);");
        }
      if(Use_SetColor ){
          fprintf(FP_OUTPUT,"%s\n","LRESULT Set_Color (int, int, HDC, HWND);");
        }
      if(Use_PlayWav ){
          fprintf(FP_OUTPUT,"%s\n","void    PlayWav (PCTSTR, int=0,  int=SND_SYNC);");
        }
      if(Use_SaveBmp ){
          fprintf(FP_OUTPUT,"%s\n","void    SaveBmp (PVOID, PTSTR);");
        }
      if(Use_GetBmp ){
          fprintf(FP_OUTPUT,"%s\n","HDC     GetBmp (int, int, int, int, HWND);");
        }
      if(Use_Center ){
          fprintf(FP_OUTPUT,"%s\n","void    Center (HWND, HWND=0, HWND=0);");
        }
      if(Use_Cls ){
          fprintf(FP_OUTPUT,"%s\n","void    cls (void);");
        }
      if(Use_Color ){
          fprintf(FP_OUTPUT,"%s\n","void    color (int, int=0);");
        }
      if(Use_PushPopColors ){
          fprintf(FP_OUTPUT,"%s\n","void    PushColors (void);");
          fprintf(FP_OUTPUT,"%s\n","void    PopColors  (void);");
        }
      if(Use_Consolesize ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_SetConsoleSize  (int= 80,int= 25);");
          fprintf(FP_OUTPUT,"%s\n","void    BCX_PushConsoleSize (void);");
          fprintf(FP_OUTPUT,"%s\n","void    BCX_PopConsoleSize  (void);");
        }
      if(Use_Panel ){
          fprintf(FP_OUTPUT,"%s\n","void    panel (int, int, int, int, int, int, int, int);");
        }
      if(Use_Locate ){
          fprintf(FP_OUTPUT,"%s\n","void    locate (int, int, int=1, int=12);");
        }
      if(Use_Pos ){
          fprintf(FP_OUTPUT,"%s\n","int     Pos (void);");
        }
      if(Use_Csrlin ){
          fprintf(FP_OUTPUT,"%s\n","int     Csrlin (void);");
        }
      if(Use_Run ){
          fprintf(FP_OUTPUT,"%s\n","int     Run (PCTSTR, int=1, int=0);");
        }
      if(Use_Doevents ){
          fprintf(FP_OUTPUT,"%s\n","void    DoEvents (void);");
        }
      if(Use_Randomize ){
          fprintf(FP_OUTPUT,"%s\n","void    randomize (unsigned int);");
        }
      if(Use_Midstr ){
          fprintf(FP_OUTPUT,"%s\n","void    midstr (char*, int, int, char *);");
        }
      if(Use_Swap ){
          fprintf(FP_OUTPUT,"%s\n","void    swap (byte*, byte*, int);");
        }
      if(Use_BcxTempStr ){
          fprintf(FP_OUTPUT,"%s\n","char*   BCX_TempStr (size_t);");
        }
      if(Use_sziif ){
          fprintf(FP_OUTPUT,"%s\n","char*   sziif (int, PCTSTR, PCTSTR);");
        }
      if(Use_Using ){
          fprintf(FP_OUTPUT,"%s\n","char*   Using (PCTSTR, long double);");
        }
      if(Use_Format ){
          fprintf(FP_OUTPUT,"%s\n","char*   Format (long double, PCTSTR=NULL);");
        }
      if(Use_TempFileName ){
          fprintf(FP_OUTPUT,"%s\n","char*   TempFileName (PCTSTR, PCTSTR);");
        }
      if(Use_AppExePath ){
          fprintf(FP_OUTPUT,"%s\n","char*   AppExePath (void);");
        }
      if(Use_AppExeName ){
          fprintf(FP_OUTPUT,"%s\n","char*   AppExeName (void);");
        }
      if(Use_VChr ){
          fprintf(FP_OUTPUT,"%s\n","char*   vchr (int,...);");
        }
      if(Use_Lcase ){
          fprintf(FP_OUTPUT,"%s\n","char*   lcase (PCTSTR);");
        }
      if(Use_Ucase ){
          fprintf(FP_OUTPUT,"%s\n","char*   ucase (PCTSTR);");
        }
      if(Use_Mid ){
          fprintf(FP_OUTPUT,"%s\n","char*   mid (PCTSTR, int, int=-1);");
        }
      if(Use_Ltrim ){
          fprintf(FP_OUTPUT,"%s\n","char*   ltrim (PCTSTR, char=32);");
        }
      if(Use_Rtrim ){
          fprintf(FP_OUTPUT,"%s\n","char*   rtrim (PCTSTR, char=32);");
        }
      if(Use_Trim ){
          fprintf(FP_OUTPUT,"%s\n","char*   trim (PCTSTR);");
        }
      if(Use_Strim ){
          fprintf(FP_OUTPUT,"%s\n","char*   strim (PCTSTR);");
        }
      if(Use_Left ){
          fprintf(FP_OUTPUT,"%s\n","char*   left (PCTSTR, int);");
        }
      if(Use_Right ){
          fprintf(FP_OUTPUT,"%s\n","char*   right (PCTSTR, int);");
        }
      if(Use_Cpad ){
          fprintf(FP_OUTPUT,"%s\n","char*   cpad (PCTSTR, int, int=32);");
        }
      if(Use_Rpad ){
          fprintf(FP_OUTPUT,"%s\n","char*   rpad (PCTSTR, int, int=32);");
        }
      if(Use_Lpad ){
          fprintf(FP_OUTPUT,"%s\n","char*   lpad (PCTSTR, int, int=32);");
        }
      if(Use_String ){
          fprintf(FP_OUTPUT,"%s\n","char*   stringx (int, int);");
        }
      if(Use_Repeat ){
          fprintf(FP_OUTPUT,"%s\n","char*   repeat (int, PCTSTR);");
        }
      if(Use_Extract ){
          fprintf(FP_OUTPUT,"%s\n","char*   extract (PCTSTR, PCTSTR);");
        }
      if(Use_ExtractAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   extractany (PCTSTR, PCTSTR);");
        }
      if(Use_Remain ){
          fprintf(FP_OUTPUT,"%s\n","char*   remain (PCTSTR, PCTSTR);");
        }
      if(Use_RemainAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   remainany (PCTSTR, PCTSTR);");
        }
      if(Use_Reverse ){
          fprintf(FP_OUTPUT,"%s\n","char*   reverse (PCTSTR);");
        }
      if(Use_Command ){
          fprintf(FP_OUTPUT,"%s\n","char*   command (int=-1);");
        }
      if(Use_Mcase ){
          fprintf(FP_OUTPUT,"%s\n","char*   mcase (PCTSTR);");
        }
      if(Use_Replace ){
          fprintf(FP_OUTPUT,"%s\n","char*   replace (PCTSTR, PCTSTR, PCTSTR);");
        }
      if(Use_iReplace ){
          fprintf(FP_OUTPUT,"%s\n","char*   iReplace (PCTSTR, PCTSTR, PCTSTR);");
        }
      if(Use_ReplaceAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   ReplaceAny (PCTSTR, PCTSTR, PCTSTR);");
        }
      if(Use_IReplaceAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   IReplaceAny (PCTSTR, PCTSTR, PCTSTR);");
        }
      if(Use_RemoveAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   RemoveAny (PCTSTR, PCTSTR);");
        }
      if(Use_IRemoveAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   IRemoveAny (PCTSTR, PCTSTR);");
        }
      if(Use_Sleep ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Sleep (int);");
        }
      if(Use_Space ){
          fprintf(FP_OUTPUT,"%s\n","char*   space (int a);");
        }
      if(Use_Str ){
          fprintf(FP_OUTPUT,"%s\n","char*   str (double, int=0);");
        }
      if(Use_Strl ){
          fprintf(FP_OUTPUT,"%s\n","char*   strl (long double, int=0);");
        }
      if(Use_RegString ){
          fprintf(FP_OUTPUT,"%s\n","char*   RegString (HKEY, PCTSTR, PCTSTR);");
        }
      if(Use_CreateRegString ){
          fprintf(FP_OUTPUT,"%s\n","void    CreateRegString (HKEY, PCTSTR, PCTSTR, PCTSTR);");
        }
      if(Use_DeleteRegKey ){
          fprintf(FP_OUTPUT,"%s\n","void    DeleteRegKey (HKEY, PCTSTR);");
        }
      if(Use_CreateRegInt ){
          fprintf(FP_OUTPUT,"%s\n","void    CreateRegInt (HKEY, PCTSTR, PCTSTR, int);");
        }
      if(Use_Mkpath ){
          fprintf(FP_OUTPUT,"%s\n","void    MkPath (PCTSTR);");
        }
      if(Use_Findfirst ){
          fprintf(FP_OUTPUT,"%s\n","char*   findfirst (PCTSTR);");
        }
      if(Use_Findnext ){
          fprintf(FP_OUTPUT,"%s\n","char*   findnext (void);");
        }
      if(Use_Lookahead ){
          fprintf(FP_OUTPUT,"%s\n","char*   LookAhead (FILE*, int=1);");
        }
      if(Use_Issystem ){
          fprintf(FP_OUTPUT,"%s\n","int     issystem (PCTSTR);");
        }
      if(Use_Ishidden ){
          fprintf(FP_OUTPUT,"%s\n","int     ishidden (PCTSTR);");
        }
      if(Use_Isreadonly ){
          fprintf(FP_OUTPUT,"%s\n","int     isreadonly (PCTSTR);");
        }
      if(Use_Isfile ){
          fprintf(FP_OUTPUT,"%s\n","int     isfile (PCTSTR);");
        }
      if(Use_Isfolder ){
          fprintf(FP_OUTPUT,"%s\n","int     isfolder (PCTSTR);");
        }
      if(Use_Curdir ){
          fprintf(FP_OUTPUT,"%s\n","char*   curdir (void);");
        }
      if(Use_Windir ){
          fprintf(FP_OUTPUT,"%s\n","char*   windir (void);");
        }
      if(Use_GetSpecialFolder ){
          fprintf(FP_OUTPUT,"%s\n","char*   GetSpecialFolder (int, int=0, HWND=NULL);");
        }
      if(Use_GetSpecialFolderex ){
          fprintf(FP_OUTPUT,"%s\n","char*   GetSpecialFolderEx (const GUID, ULONG=0);");
        }
      if(Use_Sysdir ){
          fprintf(FP_OUTPUT,"%s\n","char*   sysdir (void);");
        }
      if(Use_Tempdir ){
          fprintf(FP_OUTPUT,"%s\n","char*   tempdir (void);");
        }
      if(Use_Environ ){
          fprintf(FP_OUTPUT,"%s\n","char*   Environ (PCTSTR);");
        }
      if(Use_Boolstr ){
          fprintf(FP_OUTPUT,"%s\n","char*   BoolStr (int);");
        }
      if(Use_Hex ){
          fprintf(FP_OUTPUT,"%s\n","char*   hex(uint64_t, int=0);");
        }
      if(Use_Bin ){
          fprintf(FP_OUTPUT,"%s\n","char*   Bin (int);");
        }
      if(Use_Oct ){
          fprintf(FP_OUTPUT,"%s\n","char*   oct (int);");
        }
      if(Use_Date ){
          fprintf(FP_OUTPUT,"%s\n","char*   date (int=0);");
        }
      if(Use_IsoDate ){
          fprintf(FP_OUTPUT,"%s\n","char*   isodate (int=0);");
        }
      if(Use_Mouse_sx ){
          fprintf(FP_OUTPUT,"%s\n","int     MOUSEX_SCREEN (void);");
          fprintf(FP_OUTPUT,"%s\n","#define MOUSE_SX MOUSEX_SCREEN()");
        }
      if(Use_Mouse_sy ){
          fprintf(FP_OUTPUT,"%s\n","int     MOUSEY_SCREEN (void);");
          fprintf(FP_OUTPUT,"%s\n","#define MOUSE_SY MOUSEY_SCREEN()");
        }
      if(Use_Mouse_cx ){
          fprintf(FP_OUTPUT,"%s\n","int     MOUSEX_CLIENT (void);");
          fprintf(FP_OUTPUT,"%s\n","#define MOUSE_CX MOUSEX_CLIENT()");
        }
      if(Use_Mouse_cy ){
          fprintf(FP_OUTPUT,"%s\n","int     MOUSEY_CLIENT (void);");
          fprintf(FP_OUTPUT,"%s\n","#define MOUSE_CY MOUSEY_CLIENT()");
        }
      if(Use_Now ){
          fprintf(FP_OUTPUT,"%s\n","char*   now (int=0);");
        }
      if(Use_SearchPath ){
          fprintf(FP_OUTPUT,"%s\n","char*   SEARCHPATH (PCTSTR);");
        }
      if(Use_BcxSplitPath ){
          fprintf(FP_OUTPUT,"%s\n","char*   BcxSplitPath (PCTSTR, int);");
        }
      if(Use_BCX_Path ){
          fprintf(FP_OUTPUT,"%s\n","char*   BcxPath (void);");
        }
      if(Use_LccPath ){
          fprintf(FP_OUTPUT,"%s\n","char*   LccPath (void);");
        }
      if(Use_PellesPath ){
          fprintf(FP_OUTPUT,"%s\n","char*   PellesPath (void);");
        }
      if(Use_Strtoken ){
          fprintf(FP_OUTPUT,"%s\n","char*   StrToken (PCTSTR, PCTSTR, int);");
        }
      if(Use_RegExist ){
          fprintf(FP_OUTPUT,"%s\n","long    RegExist (HKEY, PCHAR, PCHAR);");
        }
      if(Use_RegInt ){
          fprintf(FP_OUTPUT,"%s\n","int     RegInt (HKEY, PCTSTR, PCTSTR);");
        }
      if(Use_FileLocked ){
          fprintf(FP_OUTPUT,"%s\n","int     FileLocked (PCTSTR);");
        }
      if(Use_Bff ){
          fprintf(FP_OUTPUT,"%s\n","char*   BFF (PCTSTR, int=0, PCTSTR=NULL);");
          fprintf(FP_OUTPUT,"%s\n","int     CALLBACK BFFCallBack (HWND,  UINT,  LPARAM,  LPARAM);");
        }
      if(Use_FillArray ){
          fprintf(FP_OUTPUT,"%s\n","int     fillarray (PCTSTR, int, int, void *);");
        }
      if(Use_Lclick ){
          fprintf(FP_OUTPUT,"%s\n","int     lClick (void);");
        }
      if(Use_Rclick ){
          fprintf(FP_OUTPUT,"%s\n","int     rClick (void);");
        }
      if(Use_Remove ){
          fprintf(FP_OUTPUT,"%s\n","char*   RemoveStr (PCTSTR, PCTSTR);");
        }
      if(Use_IRemove ){
          fprintf(FP_OUTPUT,"%s\n","char*   IRemoveStr (PCTSTR, PCTSTR);");
        }
      if(Use_Hook ){
          fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK SBProc (int, WPARAM, LPARAM);");
        }
      if(Use_Getfilename ){
          fprintf(FP_OUTPUT,"%s\n","char*   GetFileName (PCTSTR,PCTSTR, int=0, HWND=0, ULONG=0, PCTSTR=NULL, PCTSTR=NULL, PINT=NULL);");
        }
      if(Use_GetSaveAsFilename ){
          fprintf(FP_OUTPUT,"%s\n","char*   GetSaveAsFileName (PCTSTR, PCTSTR, int=0, HWND=NULL, ULONG=0, PCTSTR=NULL, PCTSTR=NULL, PINT=NULL);");
        }
      if(Use_GetTextSize ){
          fprintf(FP_OUTPUT,"%s\n","SIZE*   GetTextSize (PCTSTR, HWND=0, HFONT=0);");
        }
      if(Use_Time ){
          fprintf(FP_OUTPUT,"%s\n","char*   timef (int=0, int=0);");
        }
      if(Use_Join ){
          fprintf(FP_OUTPUT,"%s\n","char*   join(int, PCTSTR, ...);");
        }
      if(Use_Enclose ){
          fprintf(FP_OUTPUT,"%s\n","char*   enc (PCTSTR, int=0, int=0);");
        }
      if(Use_Stristr ){
          fprintf(FP_OUTPUT,"%s\n","char*   _stristr_(PCTSTR, PCTSTR);");
        }
      if(Use_IInstrAny||Use_InstrAny ){
          fprintf(FP_OUTPUT,"%s\n","char*   DeDupeSort(const char*);");
          fprintf(FP_OUTPUT,"%s\n","int     DeDupeCompare(const void*, const void*);");
        }
      if(Use_Wrap ){
          fprintf(FP_OUTPUT,"%s%s%s%s%s\n","char*   wrap (PCTSTR, PCTSTR=",enc(""),", PCTSTR=",enc(""),");");
        }
      if(Use_Unwrap ){
          fprintf(FP_OUTPUT,"%s%s%s%s%s\n","char*   unwrap (PCTSTR, PCTSTR=",enc(""),", PCTSTR=",enc(""),");");
        }
      if(Use_Freefile ){
          fprintf(FP_OUTPUT,"%s\n","FILE*   FreeFile (void);");
        }
      if(Use_PeekStr ){
          fprintf(FP_OUTPUT,"%s\n","char*   peekstr (PVOID, int);");
        }
      if(Use_Getaddr ){
          fprintf(FP_OUTPUT,"%s\n","char    *GetAddr (PVOID);");
        }
      if(Use_Setaddr ){
          fprintf(FP_OUTPUT,"%s\n","void    SetAddr (int* ,int);");
        }
      if(Use_Asc ){
          fprintf(FP_OUTPUT,"%s\n","int     asc (PCTSTR, int=0);");
        }
      if(Use_Instrrev ){
          fprintf(FP_OUTPUT,"%s\n","int     InstrRev (PCTSTR, PCTSTR, int=0, int=0);");
        }
      if(Use_FirstInstance ){
          fprintf(FP_OUTPUT,"%s\n","BOOL    FindFirstInstance (PCTSTR);");
        }
      if(Use_BCX_stricmp ){
          fprintf(FP_OUTPUT,"%s\n","int     bcx_stricmp (PCTSTR cs, PCTSTR ct);");
        }
      if(Use_Instr ){
          fprintf(FP_OUTPUT,"%s\n","int     instr (PCTSTR, PCTSTR, int=1, int=0);");
        }
      if(Use_IInstr ){
          fprintf(FP_OUTPUT,"%s\n","int     iinstr (PCTSTR, PCTSTR, int=1);");
        }
      if(Use_InstrAny ){
          fprintf(FP_OUTPUT,"%s\n","int     InstrAny (PCTSTR, PCTSTR, int=1);");
        }
      if(Use_IInstrAny ){
          fprintf(FP_OUTPUT,"%s\n","int     IInstrAny (PCTSTR, PCTSTR, int=1);");
        }
      if(Use_Like_Instr ){
          fprintf(FP_OUTPUT,"%s\n","int     Like_Instr (PCTSTR Buffer, PCTSTR Pattern);");
        }
      if(Use_Verify ){
          fprintf(FP_OUTPUT,"%s\n","int     Verify (PCTSTR, PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","int     VerifyInstr (PCTSTR, PCTSTR, int=0);");
        }
      if(Use_Retain ){
          fprintf(FP_OUTPUT,"%s\n","char*   Retain (PCTSTR, PCTSTR);");
        }
      if(Use_LoadFile ){
          fprintf(FP_OUTPUT,"%s\n","char*   LoadFile (PCTSTR);");
        }
      if(Use_Inchr ){
          fprintf(FP_OUTPUT,"%s\n","int     inchr (PCTSTR, PCTSTR);");
        }
      if(Use_Idxqsort ){
          fprintf(FP_OUTPUT,"%s\n","int     IdxCompare (const void *, const void *);");
        }
      if(Use_IdxqsortSt ){
          fprintf(FP_OUTPUT,"%s\n","int     IdxCompareSt (const void *, const void *);");
        }
      if(Use_PtrqsortSt ){
          fprintf(FP_OUTPUT,"%s\n","int     PtrCompareSt (const void *, const void *);");
        }
      if(Use_Strqsortas ){
          fprintf(FP_OUTPUT,"%s\n","int     StrCompareAs (const void *, const void *);");
        }
      if(Use_Strqsorta ){
          fprintf(FP_OUTPUT,"%s\n","int     StrCompareA (const void *, const void *);");
        }
      if(Use_Strqsortds ){
          fprintf(FP_OUTPUT,"%s\n","int     StrCompareDs (const void *, const void *);");
        }
      if(Use_Strqsortd ){
          fprintf(FP_OUTPUT,"%s\n","int     StrCompareD (const void *, const void *);");
        }
      if(Use_DynStrqsortas ){
          fprintf(FP_OUTPUT,"%s\n","int     DynStrCompareAs (const void *, const void *);");
        }
      if(Use_DynStrqsorta ){
          fprintf(FP_OUTPUT,"%s\n","int     DynStrCompareA (const void *, const void *);");
        }
      if(Use_DynStrqsortds ){
          fprintf(FP_OUTPUT,"%s\n","int     DynStrCompareDs (const void *, const void *);");
        }
      if(Use_DynStrqsortd ){
          fprintf(FP_OUTPUT,"%s\n","int     DynStrCompareD (const void *, const void *);");
        }
      if(Use_DynAlphaNumericA ){
          fprintf(FP_OUTPUT,"%s\n","int     DynAlphaNumericA (const void *, const void *);");
        }
      if(Use_DynAlphaNumericD ){
          fprintf(FP_OUTPUT,"%s\n","int     DynAlphaNumericD (const void *, const void *);");
        }
      if(Use_AlphaNumericA ){
          fprintf(FP_OUTPUT,"%s\n","int     AlphaNumericA (const void *, const void *);");
        }
      if(Use_AlphaNumericD ){
          fprintf(FP_OUTPUT,"%s\n","int     AlphaNumericD (const void *, const void *);");
        }
      if(Use_AlphaNumeric ){
          fprintf(FP_OUTPUT,"%s\n","int     AlphaNumeric (const void *, const void *);");
        }
      if(Use_Numqsortaint ){
          fprintf(FP_OUTPUT,"%s\n","int     NumCompareAint (const void *,const void *);");
        }
      if(Use_Numqsortdint ){
          fprintf(FP_OUTPUT,"%s\n","int     NumCompareDint (const void *,const void *);");
        }
      if(Use_Numqsortafloat ){
          fprintf(FP_OUTPUT,"%s\n","int     NumCompareAfloat (const void *,const void *);");
        }
      if(Use_Numqsortdfloat ){
          fprintf(FP_OUTPUT,"%s\n","int     NumCompareDfloat (const void *,const void *);");
        }
      if(Use_Numqsortadouble ){
          fprintf(FP_OUTPUT,"%s\n","int     NumCompareAdouble (const void *,const void *);");
        }
      if(Use_Numqsortddouble ){
          fprintf(FP_OUTPUT,"%s\n","int     NumCompareDdouble (const void *,const void *);");
        }
      if(Use_Msgbox ){
          fprintf(FP_OUTPUT,"%s\n","int     MsgBox (PCTSTR,PCTSTR,int);");
        }
      if(Use_Like ){
          fprintf(FP_OUTPUT,"%s\n","int     like (PCTSTR, PCTSTR);");
        }
      if(Use_LeftStr ){
          fprintf(FP_OUTPUT,"%s\n","int     LeftStr  (PCTSTR, PCTSTR, int=0);");
        }
      if(Use_RightStr ){
          fprintf(FP_OUTPUT,"%s\n","int     RightStr (PCTSTR, PCTSTR, int=0);");
        }
      if(Use_Textmode ){
          fprintf(FP_OUTPUT,"%s\n","int     TextMode (int);");
        }
      if(Use_Tally ){
          fprintf(FP_OUTPUT,"%s\n","int     tally (PCTSTR, PCTSTR, int=0);");
        }
      if(Use_Diskfree ){
          fprintf(FP_OUTPUT,"%s\n","UINT64  DiskFree (PCTSTR);");
        }
      if(Use_Diskused ){
          fprintf(FP_OUTPUT,"%s\n","UINT64  DiskUsed (PCTSTR);");
        }
      if(Use_Disksize ){
          fprintf(FP_OUTPUT,"%s\n","UINT64  DiskSize (PCTSTR);");
        }
      if(Use_Hex2Dec ){
          fprintf(FP_OUTPUT,"%s\n","UINT64  Hex2Dec (PCTSTR);");
        }
      if(Use_Inkey ){
          fprintf(FP_OUTPUT,"%s\n","char*   inkey (void);");
        }
      if(Use_InkeyD ){
          fprintf(FP_OUTPUT,"%s\n","int     inkeyd (void);");
        }
      if(Use_Bin2dec ){
          fprintf(FP_OUTPUT,"%s\n","int     Bin2Dec (PCTSTR);");
        }
      if(Use_Download ){
          fprintf(FP_OUTPUT,"%s\n","int     Download (PCTSTR, PCTSTR);");
        }
      if(Use_Exist ){
          fprintf(FP_OUTPUT,"%s\n","BOOL    Exist   (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","BOOL    Exist_A (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","BOOL    Exist_B (PCTSTR);");
        }
      if(Use_Gethttpfilesize ){
          fprintf(FP_OUTPUT,"%s\n","ULONG   GetHttpFileSize (PCTSTR);");
        }
      if(Use_Downloadtostr ){
          fprintf(FP_OUTPUT,"%s\n","char*   DownloadToStr (PCTSTR);");
        }
      if(Use_Ins ){
          fprintf(FP_OUTPUT,"%s\n","char*   ins (PCTSTR, int, PCTSTR);");
        }
      if(Use_Del ){
          fprintf(FP_OUTPUT,"%s\n","char*   del (PCTSTR, int, int);");
        }
      if(Use_Chrtoutf8 ){
          fprintf(FP_OUTPUT,"%s\n","char *ChrToUtf8 (PCSTR);");
        }
      if(Use_Utf8tochr ){
          fprintf(FP_OUTPUT,"%s\n","char *UTF8toCHR (PCSTR);");
        }
      if(Use_Screen ){
          fprintf(FP_OUTPUT,"%s\n","int     Screen (int, int, int=0);");
        }
      if(Use_Pause ){
          fprintf(FP_OUTPUT,"%s\n","void    Pause (void);");
        }
      if(Use_Clip_Gettext ){
          fprintf(FP_OUTPUT,"%s\n","char*   Clipboard_GetText (void);");
        }
      if(Use_Clip_Gettextsize ){
          fprintf(FP_OUTPUT,"%s\n","int     Clipboard_GetTextSize (void);");
        }
      if(Use_Clip_Settext ){
          fprintf(FP_OUTPUT,"%s\n","void    Clipboard_SetText (PCTSTR);");
        }
      if(Use_Clip_Getbitmap ){
          fprintf(FP_OUTPUT,"%s\n","HBITMAP Clipboard_GetBitmap (void);");
        }
      if(Use_Clip_Setbitmap ){
          fprintf(FP_OUTPUT,"%s\n","void    Clipboard_SetBitmap (HBITMAP);");
        }
      if(Use_Keypress ){
          fprintf(FP_OUTPUT,"%s\n","int     keypress (void);");
        }
      if(Use_Iif ){
          fprintf(FP_OUTPUT,"%s\n","double  iif (int, double, double);");
        }
      if(Use_Lof ){
          fprintf(FP_OUTPUT,"%s\n","unsigned long long int  lof (PCTSTR);");
        }
      if(Use_Sgn ){
          fprintf(FP_OUTPUT,"%s\n","double  sgn (double);");
        }
      if(Use_Round ){
          fprintf(FP_OUTPUT,"%s\n","double  Round (double, int);");
        }
      if(Use_Rnd ){
          fprintf(FP_OUTPUT,"%s\n","float   rnd (void);");
        }
      if(Use_Rnd2 ){
          fprintf(FP_OUTPUT,"%s\n","double  rnd2 (double, double);");
        }
      if(Use_Exp ){
          fprintf(FP_OUTPUT,"%s\n","double  Exp (double);");
        }
      if(Use_Max ){
          fprintf(FP_OUTPUT,"%s\n","double  MAX (double, double);");
        }
      if(Use_Min ){
          fprintf(FP_OUTPUT,"%s\n","double  MIN (double, double);");
        }
      if(Use_Modstyle ){
          fprintf(FP_OUTPUT,"%s\n","BOOL    ModStyle (HWND, LONG_PTR=0, LONG_PTR=0, BOOL=0);");
        }
      if(Use_Timer ){
          fprintf(FP_OUTPUT,"%s\n","float   timer (void);");
        }
      if(Use_Loc ){
          fprintf(FP_OUTPUT,"%s\n","int     loc (FILE *fp, int fplen);");
        }
      if(Use_Rec ){
          fprintf(FP_OUTPUT,"%s\n","int     rec (FILE *fp, int fplen);");
        }
      if(Use_RecCount ){
          fprintf(FP_OUTPUT,"%s\n","int     reccount (FILE *fp, int fplen);");
        }
      if(Use_Scan ){
          fprintf(FP_OUTPUT,"%s\n","int     scan (PCTSTR input, PCTSTR format, ...);");
        }
      if(Use_KBinput ){
          fprintf(FP_OUTPUT,"%s\n","void    KBinput (void);");
        }
      if(Use_Split ){
          fprintf(FP_OUTPUT,"%s\n","int     Split (char[][BCXSTRSIZE], PCTSTR, PCTSTR, int=0);");
        }
      if(Use_DSplit ){
          fprintf(FP_OUTPUT,"%s\n","int     DSplit (PSTR *, PCTSTR, PCTSTR, int=0);");
        }
      if(Use_SysStr ){
          fprintf(FP_OUTPUT,"%s\n","BSTR    SysStr (PCTSTR szIn, int=0, int=0);");
        }
      if(Use_LCaseTbl ){
          fprintf(FP_OUTPUT,"%s\n","unsigned char*  MakeLCaseTbl (void);");
        }
      if(Use_UCaseTbl ){
          fprintf(FP_OUTPUT,"%s\n","unsigned char*  MakeUCaseTbl (void);");
        }
      if(Use_Cvi ){
          fprintf(FP_OUTPUT,"%s\n","short   CVI (PCTSTR);");
        }
      if(Use_Mki ){
          fprintf(FP_OUTPUT,"%s\n","char*   MKI (short);");
        }
      if(Use_Cvl ){
          fprintf(FP_OUTPUT,"%s\n","long    CVL (PCTSTR);");
        }
      if(Use_Mkl ){
          fprintf(FP_OUTPUT,"%s\n","char*   MKL (int);");
        }
      if(Use_Cvs ){
          fprintf(FP_OUTPUT,"%s\n","float   CVS (PCTSTR);");
        }
      if(Use_Mks ){
          fprintf(FP_OUTPUT,"%s\n","char*   MKS (float);");
        }
      if(Use_Cvd ){
          fprintf(FP_OUTPUT,"%s\n","double  CVD (PCTSTR);");
        }
      if(Use_Cvld ){
          fprintf(FP_OUTPUT,"%s\n","long double  CVLD (PCTSTR);");
        }
      if(Use_Mkd ){
          fprintf(FP_OUTPUT,"%s\n","char*   MKD (double);");
        }
      if(Use_Mkld ){
          fprintf(FP_OUTPUT,"%s\n","char*   MKLD (long double);");
        }
      if(Use_OSVersion ){
          fprintf(FP_OUTPUT,"%s\n","int     OSVersion (void);");
        }
      if(Use_Sound ){
          fprintf(FP_OUTPUT,"%s\n","int     Sound (float, int=0, int=127, int=0, float=1.0f);");
          fprintf(FP_OUTPUT,"%s\n","int     PlaySnd (void);");
        }
      if(Use_Hscroll||Use_Vscroll ){
          fprintf(FP_OUTPUT,"%s\n","void    BCX_Scroll (HWND, int, int, int, int, int, int, int, int, int, int);");
        }
      if(Use_DynacallCommon ){
          fprintf(FP_OUTPUT,"%s\n","HINSTANCE BCX_LoadDll (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","void      BCX_UnloadDll (void);");
          if(Use_Dynacall ){
              fprintf(FP_OUTPUT,"%s\n","INT_PTR   BCX_DynaCallB (PCTSTR, PCTSTR, int, ...);");
            }
          if(Use_DynacallA ){
              fprintf(FP_OUTPUT,"%s\n","INT_PTR   BCX_DynaCallA(PCTSTR, PCTSTR, int, INT_PTR *);");
            }
        }
      if(Use_DynamicA ){
          fprintf(FP_OUTPUT,"%s\n","void*   CreateArr (void*, int, int, int, size_t *);");
          fprintf(FP_OUTPUT,"%s\n","void    DestroyArr (void**, int, int);");
        }
      if(Use_ContainedIn ){
          fprintf(FP_OUTPUT,"%s\n","int     containedin (char*, char **, int=0);");
        }
      if(Use_FindInType ){
          fprintf(FP_OUTPUT,"%s\n","int     FindInType (PCTSTR, PCTSTR, int, int, int, int=0, PINT=NULL);");
        }
      if(Use_Printer ){
          fprintf(FP_OUTPUT,"%s%s%s\n","int     PrinterOpen  (PCTSTR =",enc("Courier New"),", int=12, int=DEFAULT_CHARSET);");
          fprintf(FP_OUTPUT,"%s\n","void    PrinterWrite (PCTSTR, int=80, int=60);");
          fprintf(FP_OUTPUT,"%s\n","void    EjectPage    (void);");
          fprintf(FP_OUTPUT,"%s\n","void    PrinterClose (void);");
        }
      if(Use_COM ){
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n","//          Late binding COM support section");
          fprintf(FP_OUTPUT,"%s\n","//  (c) Ljubisa Knezevic 2004-2009, ljube@blic.net");
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","#define COM_MSGBOX(a,b,c)MessageBox(GetActiveWindow(),(a),(b),(c))");
          fprintf(FP_OUTPUT,"%s\n","#define COM_PROPS DISPATCH_PROPERTYGET|DISPATCH_METHOD");
          fprintf(FP_OUTPUT,"%s\n","#define COM_PARAMS COM_param_list.pParams");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_WideToAnsi ){
          fprintf(FP_OUTPUT,"%s\n","//<---UNICODE AWARE");
          fprintf(FP_OUTPUT,"%s\n","char*   WideToAnsi (PWSTR, UINT=CP_ACP, ULONG=0);");
          fprintf(FP_OUTPUT,"%s\n","//>---UNICODE AWARE");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_AnsiToWide ){
          fprintf(FP_OUTPUT,"%s\n","//<---UNICODE AWARE");
          fprintf(FP_OUTPUT,"%s\n","PWSTR AnsiToWide (PCSTR, UINT=CP_ACP, ULONG=MB_PRECOMPOSED, BOOL=TRUE);");
          fprintf(FP_OUTPUT,"%s\n","//>---UNICODE AWARE");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_SafeArrays ){
          fprintf(FP_OUTPUT,"%s\n","HRESULT InitSafeArray    (SAFEARRAY** ppsa, VARTYPE vtype, UINT ndim, ...);");
          fprintf(FP_OUTPUT,"%s\n","HRESULT DestroySafeArray (SAFEARRAY* psA);");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_COM_UsesConversion ){
          fprintf(FP_OUTPUT,"%s\n","HRESULT  COM_AS2WS (PCSTR  ansi_string, UINT code_page=CP_ACP);");
          fprintf(FP_OUTPUT,"%s\n","HRESULT  COM_WS2AS (PCWSTR wide_string, UINT code_page=CP_ACP);");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      if(Use_COM_CLSID ){
          fprintf(FP_OUTPUT,"%s\n","char*    BCX_CLSID(char*);");
        }
      if(Use_COM ){
          fprintf(FP_OUTPUT,"%s %d \n","#define c_COM_Stack_Size ",(int)c_COM_Stack_Size);
          fprintf(FP_OUTPUT,"%s\n","#ifndef CON_VARBOOL2BOOL");
          fprintf(FP_OUTPUT,"%s\n","  #define CON_VARBOOL2BOOL(b) ((BOOL)(b ? TRUE : FALSE))");
          fprintf(FP_OUTPUT,"%s\n","#endif");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","typedef struct _OBJECT {");
          fprintf(FP_OUTPUT,"%s\n","  IUnknown*  p_unknown;");
          fprintf(FP_OUTPUT,"%s\n","  VARIANT    pObjects[c_COM_Stack_Size];");
          fprintf(FP_OUTPUT,"%s\n","  BOOL       pStatus;");
          fprintf(FP_OUTPUT,"%s\n","  int        ipointer;");
          fprintf(FP_OUTPUT,"%s\n","}OBJECT, *LPOBJECT;");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","typedef struct _PARAM_VARARRAY {");
          fprintf(FP_OUTPUT,"%s\n","  VARIANT  pParams[c_COM_Stack_Size];");
          fprintf(FP_OUTPUT,"%s\n","}PARAM_VARARRAY, *LPPARAM_VARARRAY;");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n","//       COM functions used internally by BCX");
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","void     COM_ole_initialize            (void);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_ole_uninitialize          (void);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_HR_ErrMsg                 (HRESULT hr, TCHAR *extra_info);");
          fprintf(FP_OUTPUT,"%s\n","DISPID   COM_get_dispatch_ID           (IDispatch *lpDispatch, PWSTR comsegment);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_get_next_dispatch         (OBJECT *object, PWSTR comsegment);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_invoke                    (OBJECT *object, PWSTR comsegment, WORD wFlags, VARIANT *pvResult);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_build_except_info         (HRESULT hr, EXCEPINFO *pexcep = NULL, UINT uiArgErr = 0);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_clean_plist               (void);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_reset_disp_chain          (OBJECT *object);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_create_safearray          (void);");
          if(COM_build_trace_code ){
              fprintf(FP_OUTPUT,"%s\n","static char COM_trace_line[BCXSTRSIZE];");
            }
          fprintf(FP_OUTPUT,"%s\n","void     COM_trace_dump_DISPPARAMS     (DISPPARAMS* dp);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_trace_add_line            (PCTSTR dp);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_trace_dump_indicators     (OBJECT *object);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_trace_dump_flags          (WORD wFlags);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_FREE_TEMP_ANSI_STRING     (void);");
          fprintf(FP_OUTPUT,"%s\n","void     COM_FREE_TEMP_WIDE_STRING     (void);");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n","//       Public COM support functions");
          fprintf(FP_OUTPUT,"%s\n","// *************************************************");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","OBJECT   COM                    (PCTSTR);");
          fprintf(FP_OUTPUT,"%s\n","void     UNCOM                  (OBJECT);");
          fprintf(FP_OUTPUT,"%s\n","void     BCX_SHOW_COM_ERRORS    (BOOL);");
          fprintf(FP_OUTPUT,"%s\n","void     BCX_SetNothing         (OBJECT*);");
          fprintf(FP_OUTPUT,"%s\n","BOOL     BCX_GET_COM_SUCCESS    (void);");
          fprintf(FP_OUTPUT,"%s\n","BOOL     BCX_GET_COM_STATUS     (OBJECT*);");
          fprintf(FP_OUTPUT,"%s\n","char*    BCX_GET_COM_ERROR_DESC (void);");
          fprintf(FP_OUTPUT,"%s\n","int      ISOBJECT               (OBJECT);");
          fprintf(FP_OUTPUT,"%s\n","HRESULT  BCX_GET_COM_ERROR_CODE (void);");
          if(Use_COM_CreateObject ){
              fprintf(FP_OUTPUT,"%s\n","void     BCX_CreateObject       (TCHAR *objname, OBJECT *obj);");
            }
          if(Use_COM_GetObject ){
              fprintf(FP_OUTPUT,"%s\n","void     BCX_GetObject          (TCHAR *objname, OBJECT *obj);");
              fprintf(FP_OUTPUT,"%s\n","void     BCX_GetObjectMon       (LPCOLESTR objname, OBJECT *obj);");
            }
          if(Use_COM_DispatchObject ){
              fprintf(FP_OUTPUT,"%s\n","void     BCX_DispatchObject     (IUnknown *iobj, OBJECT *obj, BOOL b_release = TRUE);");
            }
        }
    }
}

void Add_Com_Global_Var (char* p_name)
{
  if((int)strlen(p_name)>64 ){
      Abort(join(5,"Length of object variable ",p_name," is:",str((int)strlen(p_name)),". Maximum allowed is 64 characters."));
    }
  if(COM_gl_names_index==c_COM_Max_Gl_Objs ){
      Abort(join(5,"Max number of Global COM object variables reached:",str(c_COM_Max_Gl_Objs),CRLF,"Failed to reserve space for Object variable: ",p_name));
      return;
    }
  strcpy(COM_gl_names[COM_gl_names_free_index].com_VarName,p_name);
  COM_gl_names[COM_gl_names_free_index].initialized=TRUE;
  COM_gl_names_index++;
  COM_gl_names_free_index=COM_gl_names_index;
}

void Add_Com_Local_Var (char* p_name)
{
  if((int)strlen(p_name)>64 ){
      Abort(join(5,"Length of object variable ",p_name," is:",str((int)strlen(p_name)),". Maximum allowed is 64 characters."));
    }
  if(COM_lc_names_index==c_COM_Max_Lc_Objs ){
      Abort(join(5,"Max number of Local COM object variables reached:",str(c_COM_Max_Lc_Objs),CRLF,"Failed to reserve space for Object variable: ",p_name));
      return;
    }
  strcpy(COM_lc_names[COM_lc_names_free_index].com_VarName,p_name);
  COM_lc_names[COM_lc_names_free_index].initialized=TRUE;
  COM_lc_names_index++;
  COM_lc_names_free_index=COM_lc_names_index;
}

int IsVariableComObject (char* p_varname)
{
  char sz_var_name[BCXSTRSIZE];
  int  l_index;
  strcpy(sz_var_name,trim(p_varname));
  if(COM_lc_names_index>0 ){
      for(l_index=0; l_index<=COM_lc_names_index-1; l_index++)
        {
          if(COM_lc_names[l_index].initialized==TRUE ){
              if(strcmp(sz_var_name,COM_lc_names[l_index].com_VarName)==0){
                  return l_index+1;
                }
            }
        }
    }
  if(COM_gl_names_index>0 ){
      for(l_index=0; l_index<=COM_gl_names_index-1; l_index++)
        {
          if(COM_gl_names[l_index].initialized==TRUE ){
              if(strcmp(sz_var_name,COM_gl_names[l_index].com_VarName)==0){
                  return (-1*(l_index+1));
                }
            }
        }
    }
  return 0;
}

void Free_Com_Objects (BOOL p_remove)
{
  int  j={0};
  int eraseOffset={0};
  for(;;)
    {
      if(COM_lc_names[j].initialized==TRUE ){
        }
      else
        {
          eraseOffset++;
        }
      j++;
      if(!(j<(COM_lc_names_index+eraseOffset))){
          goto L1565;
        }
    }
L1565:;
  if(p_remove==TRUE ){
      COM_lc_names_index=0;
      COM_lc_names_free_index=0;
    }
}

BOOL Find_COM_statement (char* pp_Src)
{
  int FOUND_OBJECT={0};
  int FOUND_DOT={0};
  int FOUND_EQU={0};
  char p_Src[BCXSTRSIZE];
  char word_left[BCXSTRSIZE];
  char prev_word_left[BCXSTRSIZE];
  int  j;
  strcpy(p_Src,pp_Src);
  if(ISNULL(p_Src)){
      return FALSE;
    }
  if(strcmp(p_Src,"endwith")==0){
      return FALSE;
    }
  ProcessingCOM_Set=FALSE;
  if(LeftStr(pp_Src,"set ",TRUE)){
      ProcessingCOM_Set=TRUE;
      strcpy(pp_Src,trim(mid(pp_Src,5)));
      strcpy(p_Src,pp_Src);
    }
  if(m_iMatchLft(p_Src,"for ")){
      return FALSE;
    }
  if(m_iMatchLft(p_Src,"with ")){
      strcpy(word_left,trim(mid(p_Src,6)));
      if(COM_open_WITH_statement ){
          if(word_left[0]==46 ){
              COM_open_WITH_statement++;
              strcpy(p_Src, join(4,COM_with_temp_str_name," = ",COM_with_temp_str_name,word_left));
            }
          else
            {
              Abort("Nested <WITH> statements, in open WITH block, are allowed only for interfaces of same COM object. For more info, see rules for using COM in BCX.");
            }
        }
      else
        {
          strcpy(prev_word_left,trim(extract(word_left,".")));
          if(IsVariableComObject(prev_word_left)){
              COM_open_WITH_statement++;
              strcpy(COM_with_temp_str_name,prev_word_left);
              strcpy(p_Src,word_left);
              if(inchr(p_Src,".")==0 ){
                  *pp_Src=0;
                  return TRUE;
                }
              strcpy(p_Src, join(3,prev_word_left," = ",word_left));
            }
        }
    }
  else
    {
      if(COM_open_WITH_statement ){
          if(p_Src[0]==46 ){
              strcpy(p_Src, join(2,COM_with_temp_str_name,p_Src));
            }
        }
    }
  FastLexer(p_Src,"","'");
  int  i;
  i=2;
  strcpy(p_Src,Stk[1]);
  while(i<=Ndx){
      if(*Stk[i]==39 ){
          goto L1566;
        }
      strcat(p_Src,Stk[i]);
      i++;
    }
L1566:;
  FastLexer(p_Src,"","= ",0);
  i=1;
  j=0;
  while(i<Ndx){
      if(*Stk[i]==61 ){
          j=i;
        }
      i++;
    }
  if(j ){
      i=2;
      strcpy(p_Src,trim(Stk[1]));
      while(i<j){
          strcat(p_Src,trim(Stk[i]));
          i++;
        }
      strcat(p_Src,Stk[j]);
      while(++j<=Ndx){
          strcat(p_Src,trim(Stk[j]));
        }
    }
  FastLexer(p_Src,"","[]()=. ",0);
  char szLeft[BCXSTRSIZE]={0};
  char szRight[BCXSTRSIZE]={0};
  int FOUND_SPACE={0};
  FOUND_OBJECT=FALSE;
  FOUND_EQU=FALSE;
  FOUND_SPACE=FALSE;
  FOUND_DOT=FALSE;
  int DO_COM=0;
  for(i=1; i<=Ndx; i++)
    {
      if(FOUND_OBJECT==FALSE ){
          FOUND_OBJECT=IsVariableComObject(Stk[i]);
        }
      if(*Stk[i]==61 ){
          FOUND_EQU=TRUE;
          if(FOUND_OBJECT==FALSE ){
              if(DO_COM==0 ){
                  DO_COM=(-1);
                }
              else
                {
                  DO_COM=1;
                }
            }
          else
            {
              if(FOUND_DOT==FALSE ){
                  DO_COM=(-1);
                }
              else
                {
                  DO_COM=1;
                }
            }
          continue;
        }
      if(FOUND_OBJECT!=FALSE&&*Stk[i]==46 ){
          FOUND_DOT=TRUE;
        }
      if(FOUND_OBJECT&&*Stk[i]==32 ){
          FOUND_SPACE=i;
          continue;
        }
      if(FOUND_EQU||FOUND_SPACE ){
          strcat(szRight,Stk[i]);
          if(strcmp(Stk[i],"(")==0){
              int  iP;
              iP=1;
              while(iP){
                  i++;
                  if(strcmp(Stk[i],"(")==0){
                      iP++;
                    }
                  if(strcmp(Stk[i],")")==0){
                      iP--;
                    }
                  strcat(szRight,trim(Stk[i]));
                }
            }
        }
      else
        {
          if(strcmp(Stk[i],"(")==0){
              int  iP;
              strcat(szLeft,Stk[i]);
              iP=1;
              while(iP){
                  if(i==Ndx ){
                      Abort("Unbalance () in COM statement");
                    }
                  i++;
                  if(strcmp(Stk[i],"(")==0){
                      iP++;
                    }
                  if(strcmp(Stk[i],")")==0){
                      iP--;
                    }
                  strcat(szLeft,trim(Stk[i]));
                }
            }
          else
            {
              strcat(szLeft,Stk[i]);
            }
        }
    }
  if(FOUND_OBJECT!=FALSE ){
      if(FOUND_DOT ){
          if(COM_build_trace_code ){
              fprintf(FP_WRITE,"%s%s%s\n","COM_add_trace_line(",enc("  "),");");
              fprintf(FP_WRITE,"%s%s%s\n","COM_add_trace_line(",enc("***********************************************************"),");");
              fprintf(FP_WRITE,"%s%s%s\n","COM_add_trace_line(",enc(join(2,"Source Line= ",Make_COM_Trace_Lines(pp_Src))),");");
            }
          if(DO_COM==-1 ){
              COM_Parse_GetProperty(szLeft,szRight);
              goto L1573;
            }
          if(DO_COM==0 ){
              COM_Parse_Method(szLeft,szRight);
              goto L1573;
            }
          if(DO_COM==1 ){
              COM_Parse_SetProperty(szLeft,szRight,FOUND_OBJECT);
            }

L1573:;

          *pp_Src=0;
          return TRUE;
        }
    }
  PreParse(pp_Src);
  return FALSE;
}

void COM_Parse_GetProperty (char* varname,char* com_property)
{
  Use_COM_GetProperty=Use_COM_UsesConversion=Use_COM=TRUE;
  char com_method[BCXSTRSIZE]={0};
  int j={0};
  int k={0};
  char ObjName[BCXSTRSIZE]={0};
  char ComTok[BCXSTRSIZE]={0};
  char ComTokPrev[BCXSTRSIZE]={0};
  char temp_param[BCXSTRSIZE]={0};
  char force_cast[BCXSTRSIZE]={0};
  int force_casting={0};
  strcpy(com_method,trim(com_property));
  if(com_method[0]==c_LPar ){
      strcpy(force_cast,trim(ucase(extract(com_method+1,")"))));
      strcpy(com_method,trim(remain(com_method,")")));
      force_casting=1;
    }
  ParseCom(com_method);
  j=1;
  strcpy(ObjName,ComStk[j++]);
  strcpy(ComTok,ComStk[j++]);
  for(;;)
    {
      strcpy(ComTokPrev,ComTok);
      strcpy(ComTok,ComStk[j++]);
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"lstrcpy(COM_ErrMsg, _T(",enc(Make_COM_Trace_Lines(ComTokPrev)),"));");
      if(inchr(ComTokPrev,"(")>0 ){
          strcpy(temp_param,trim(remain(ComTokPrev,"(")));
          k=Com_Make_Param_List(mid(temp_param,1,(int)strlen(temp_param)-1),1);
          fprintf(FP_WRITE,"%s%s %d %s\n",Scoot,"COM_plist_index =",(int)k,";");
          strcpy(ComTokPrev,extract(ComTokPrev,"("));
        }
      if(ComTok[0]!=0 ){
          if(COM_build_trace_code ){
              fprintf(FP_WRITE,"%s%s%s\n","    COM_add_trace_line(",enc(join(2,">>> Get next dispatch for:: ",ComTokPrev)),");");
            }
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_get_next_dispatch(&",ObjName,", L",enc(RemoveStr(ComTokPrev,SPC)),");");
        }
      else
        {
          if(COM_open_WITH_statement ){
              if(COM_build_trace_code ){
                  fprintf(FP_WRITE,"%s%s%s\n","    COM_add_trace_line(",enc(join(2,"WITH construction >>> Get next dispatch for:: ",ComTokPrev)),");");
                }
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_get_next_dispatch(&",ObjName,", L",enc(RemoveStr(ComTokPrev,SPC)),");");
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_dispatch_at_offset = ",COM_with_temp_str_name,".ipointer;");
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_dispatch_storage_index++;");
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_dispatch_storage[COM_dispatch_storage_index] = COM_dispatch_at_offset;");
              return;
            }
          if(COM_build_trace_code ){
              fprintf(FP_WRITE,"%s%s%s\n","    COM_add_trace_line(",enc(join(2,">>> COM_invoke for:: ",ComTokPrev)),");");
            }
          if(COM_FOREACH_enumerator==TRUE ){
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_get_next_dispatch(&",ObjName,", L",enc(RemoveStr(ComTokPrev,SPC)),");");
              return;
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s%s%s",Scoot,"COM_invoke(&",ObjName,", L",enc(RemoveStr(ComTokPrev,SPC)));
              fprintf(FP_WRITE,"%s\n",",COM_PROPS, &COM_vt_result);\n");
            }
          if(force_casting==1 ){
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"VariantChangeType(&COM_vt_result, &COM_vt_result,0,",force_cast,");");
            }
          if(!*varname ){
              goto L1574;
            }
          char Cleanvarname[BCXSTRSIZE];
          strcpy(Cleanvarname,trim(No_Sigil(varname)));
          if(force_casting==1 ){
              if(strcmp(force_cast,"VT_BSTR")==0){
                  fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = SysAllocString(COM_vt_result.bstrVal);");
                }
              else
                {
                  strcpy(force_cast,replace(force_cast,"VT_","V_"));
                  fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,Cleanvarname," = ",force_cast,"(&COM_vt_result);");
                }
            }
          else
            {
              struct _UDT_VARINFO_STORAGE*  VI;
              int vt;
              int id;
              struct _UDT_VARINFO_STORAGE  tVI;
              if(inchr(Cleanvarname,".")){
                  char sTAG[BCXSTRSIZE];
                  strcpy(sTAG,left(Cleanvarname,inchr(Cleanvarname,".")-1));
                  vt=LookupVarType(sTAG,&(id));
                  if(vt==vt_UNKNOWN ){
                      Abort(join(3,"Unknown structure ",sTAG," not previously dimensioned"));
                    }
                  tVI.VarPntr=0;
                  tVI.VarType=0;
                  if(vt==vt_VARIANT ){
                      int i={0};
                      strcpy(sTAG,mid(Cleanvarname,inchr(Cleanvarname,".")+1));
                      i=0;
                      while(VariantList[i].sNAME){
                          if(strcmp(VariantList[i].sNAME,sTAG)==0){
                              tVI.VarType=VariantList[i].iTYPE;
                              tVI.VarPntr=VariantList[i].iPTRS;
                              vt=tVI.VarType;
                              goto L1575;
                            }
                          i++;
                        }
L1575:;
                    }
                  VI=&(tVI);
                }
              else
                {
                  vt=CheckLocal(Cleanvarname,&(id));
                  if(vt==vt_UNKNOWN ){
                      vt=CheckGlobal(Cleanvarname,&(id));
                      if(vt==vt_UNKNOWN ){
                          Abort(join(3,"Unknown variable ",varname," not previously dimensioned"));
                        }
                      VI=&(GlobalVars[id]);
                    }
                  else
                    {
                      VI=&(LocalVars[id]);
                    }
                }
              if(vt==vt_VARIANT ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"VariantCopy((VARIANT *)(&",Cleanvarname,"),&COM_vt_result);");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"VariantCopy(&",Cleanvarname,",&COM_vt_result);");
                    }
                  goto L1576;
                }
              if(vt==vt_DOUBLE ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_R8|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_R8|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pdblVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_R8)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_R8);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.dblVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_SINGLE ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_R4|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_R4|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pfltVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_R4)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_R4);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.fltVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_INTEGER ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_INT|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_INT|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pintVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_INT)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  VariantChangeType(&COM_vt_result,");
                      fprintf(FP_WRITE,"%s%s\n",Scoot," &COM_vt_result,0, VT_INT);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.intVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_UINT ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_UI4|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI4|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.uintVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_INT)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  VariantChangeType(&COM_vt_result,");
                      fprintf(FP_WRITE,"%s%s\n",Scoot," &COM_vt_result,0, VT_INT);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.uintVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_LONG ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_I4|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_I4|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.plVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_I4)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result, &COM_vt_result,0,VT_I4);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.lVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_ULONG ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_UI4|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI4|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pulVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_UI4)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI4);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.ulVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_LLONG ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_I8|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType (&COM_vt_result,&COM_vt_result,0,VT_I8|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pllVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_I8)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_I8);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.llVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_ULONGLONG ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_UI8|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI8|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pullVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_UI8)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI8);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.ullVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_SHORT||vt==vt_SSHORT ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_I2|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_I2|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.piVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_I2)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_I2);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.iVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_USHORT ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_UI2|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI2|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.puiVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_UI2)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI2);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.uiVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_BYTE ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_UI1|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI1|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pbVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_UI1)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_UI1);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.bVal;");
                    }
                  goto L1576;
                }
              if(vt==vt_BOOL ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != (VT_BOOL|VT_BYREF))");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"     VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_BOOL|VT_BYREF);");
                      if(COM_build_trace_code ){
                          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    COM_add_trace_line(",enc(join(3,"Return variable for ",Cleanvarname," was coerced")),");");
                        }
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pboolVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = CON_VARBOOL2BOOL(COM_vt_result.boolVal);");
                    }
                  goto L1576;
                }
              if(vt==vt_STRVAR||vt==vt_CHAR||vt==vt_SCHAR ){
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"if(COM_vt_result.vt == VT_NULL){");
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  *",Cleanvarname,"=0;");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_last_HR = VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_BSTR);\n");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR,_T(",enc("VariantChangeType (BSTR) Failed!"),"));");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  #ifndef UNICODE");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  COM_last_HR = COM_WS2AS(COM_vt_result.bstrVal);");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  if (FAILED(COM_last_HR)) {");
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    COM_HR_ErrMsg (COM_last_HR,_T(",enc("COM Get Property Failed! W2A failure!"),"));");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  } else {");
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"   strcpy(",Cleanvarname,", COM_psz_tmp);");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  #else");
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  lstrcpy(",Cleanvarname,",COM_vt_result.bstrVal);");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"  #endif");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
                  goto L1576;
                }
              if(vt==vt_UDT ){
                  if(ProcessingCOM_Set&&IsVariableComObject(Cleanvarname)){
                      ProcessingCOM_Set=FALSE;
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_DISPATCH) {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    COM_last_HR = VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_DISPATCH);");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"}\n");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  strcpy(COM_ErrMsg ,",enc(Cleanvarname),");");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR, _T(",enc("VariantChangeType failed. Expected IDispatch*"),"));");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  VariantInit(&",Cleanvarname,".pObjects[0]);");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_last_HR = VariantCopy(&",Cleanvarname,".pObjects[0],&COM_vt_result);\n");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  if (FAILED(COM_last_HR)) {");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    strcpy(COM_ErrMsg ,",enc(Cleanvarname),");");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    COM_HR_ErrMsg (COM_last_HR, _T(",enc("VariantCopy failed."),"));");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  } else {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    COM_objects_cnt++;");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    ",Cleanvarname,".pStatus = TRUE;");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    ",Cleanvarname,".ipointer = 0;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }  ");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt == VT_BOOL) {");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = CON_VARBOOL2BOOL(COM_vt_result.boolVal);");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"switch (COM_vt_result.vt)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  case VT_R8:");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",Cleanvarname," = COM_vt_result.dblVal;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  case VT_R4:");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",Cleanvarname," = COM_vt_result.fltVal;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  default:");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",Cleanvarname," = (int)COM_vt_result.lVal;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
                    }
                  goto L1576;
                }
              if(vt==vt_BSTR ){
                  if(VI->VarPntr ){
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.pbstrVal;");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = COM_vt_result.bstrVal;");
                    }
                }
              else
                {
                  if(ProcessingCOM_Set&&IsVariableComObject(Cleanvarname)){
                      ProcessingCOM_Set=FALSE;
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt != VT_DISPATCH) {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    COM_last_HR = VariantChangeType(&COM_vt_result,&COM_vt_result,0,VT_DISPATCH);");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"}\n");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  strcpy(COM_ErrMsg ,",enc(Cleanvarname),");");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR, _T(",enc("VariantChangeType failed. Expected IDispatch*"),"));");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  VariantInit(&",Cleanvarname,".pObjects[0]);");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_last_HR = VariantCopy(&",Cleanvarname,".pObjects[0], &COM_vt_result);\n");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  if (FAILED(COM_last_HR)) {");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    strcpy(COM_ErrMsg ,",enc(Cleanvarname),");");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    COM_HR_ErrMsg (COM_last_HR, _T(",enc("VariantCopy failed."),"));");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  } else {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    bcx_ole_objects_count++;");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    ",Cleanvarname,".pStatus = TRUE;");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"    ",Cleanvarname,".ipointer = 0;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }  ");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"} ");
                    }
                  else
                    {
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"if (COM_vt_result.vt == VT_BOOL) {");
                      fprintf(FP_WRITE,"%s%s%s\n",Scoot,Cleanvarname," = CON_VARBOOL2BOOL(COM_vt_result.boolVal);");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"switch (COM_vt_result.vt)");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  {");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  case VT_R8:");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",Cleanvarname," = COM_vt_result.dblVal;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  case VT_R4:");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",Cleanvarname," = COM_vt_result.fltVal;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  default:");
                      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"      ",Cleanvarname," = (int)COM_vt_result.lVal;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"    break;");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"  }");
                      fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
                    }
                }

L1576:;

            }
          fprintf(FP_WRITE,"%s%s\n",Scoot,"VariantClear(&COM_vt_result);");
          goto L1574;
        }
    }
L1574:;
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"if (0 == COM_reset_chain) COM_reset_disp_chain(&",ObjName,");");
}

void COM_Parse_SetProperty (char* com_method,char* pparms,int Obj_At_Index)
{
  Use_COM_SetProperty=Use_COM_UsesConversion=Use_COM=TRUE;
  int j={0};
  int k={0};
  char ObjName[BCXSTRSIZE]={0};
  char ComTok[BCXSTRSIZE]={0};
  char ComTokPrev[BCXSTRSIZE]={0};
  char temp_param[BCXSTRSIZE]={0};
  char parms[BCXSTRSIZE]={0};
  int BuildSafeArray={0};
  if(COM_build_trace_code ){
      fprintf(FP_WRITE,"%s%s%s\n","    COM_add_trace_line(",enc(join(7,"COM_Parse_SetProperty(",Make_COM_Trace_Lines(com_method)," , ",Make_COM_Trace_Lines(pparms)," , ",str(Obj_At_Index),")")),");");
    }
  strcpy(parms,trim(pparms));
  if(NOTNULL(parms)){
      if(strcmp(mid(ucase(parms),1,6),"ARRAY(")==0  || strcmp(mid(ucase(parms),1,6),"ARRAY ")==0){
          strcpy(parms,remain(parms,"("));
          j=(int)strlen(parms)-1;
          parms[j]=0;
          BuildSafeArray=1;
          Use_COM_SafeArray=TRUE;
        }
    }
  ParseCom(com_method);
  j=1;
  strcpy(ObjName,ComStk[j++]);
  strcpy(ComTok,ComStk[j++]);
  for(;;)
    {
      strcpy(ComTokPrev,ComTok);
      strcpy(ComTok,ComStk[j++]);
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"lstrcpy(COM_ErrMsg, _T(",enc(Make_COM_Trace_Lines(ComTokPrev)),"));");
      if(ComTok[0]!=0 ){
          if(inchr(ComTokPrev,"(")>0 ){
              strcpy(temp_param,trim(remain(ComTokPrev,"(")));
              k=Com_Make_Param_List(mid(temp_param,1,(int)strlen(temp_param)-1),1);
              fprintf(FP_WRITE,"%s%s %d %s\n",Scoot,"COM_plist_index =",(int)k,";");
              strcpy(ComTokPrev,trim(extract(ComTokPrev,"(")));
            }
          if(COM_build_trace_code ){
              fprintf(FP_WRITE,"%s%s%s\n","    COM_add_trace_line(",enc(join(2,">>> Get next dispatch for:: ",ComTokPrev)),");");
            }
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_get_next_dispatch(&",ObjName,", L",enc(RemoveStr(ComTokPrev,SPC)),");");
        }
      else
        {
          if(COM_build_trace_code ){
              fprintf(FP_WRITE,"%s%s%s\n","COM_add_trace_line(",enc(join(2,"Invoke helper for:: ",ComTokPrev)),");");
            }
          k=Com_Make_Param_List(parms,0);
          fprintf(FP_WRITE,"%s%s %d %s\n",Scoot,"COM_plist_index =",(int)k,";");
          if(BuildSafeArray ){
              fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_create_safearray();");
            }
          char sXX[BCXSTRSIZE];
          strcpy(sXX, join(2,vchr(1,92),vchr(1,c_DblQt)));
          strcpy(ComTokPrev,replace(ComTokPrev,vchr(1,c_DblQt),sXX));
          fprintf(FP_WRITE,"%s\n","");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (!COM_BCX_ERROR)");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"  COM_invoke(&",ObjName,", L",enc(RemoveStr(ComTokPrev,SPC)),", DISPATCH_PROPERTYPUT, NULL);\n");
          goto L1577;
        }
    }
L1577:;
}

int GetParameterTokens (char* sP)
{
  int  iWorkingOn;
  int  iLastTokenPlus1;
  char ParamTok[BCXSTRSIZE];
  FastLexer(sP,"",",()[]");
  iLastTokenPlus1=Ndx;
  if(tally(sP,"(")||tally(sP,"[")){
      for(iWorkingOn=1; iWorkingOn<=Ndx; iWorkingOn++)
        {
          strcpy(Stk[iWorkingOn],trim(Stk[iWorkingOn]));
        }
      RemEmptyTokens();
      iWorkingOn=1;
      iLastTokenPlus1=0;
      while(BYTE_AT(Stk[iWorkingOn][0]>0)){
          strcpy(ParamTok,Stk[iWorkingOn]);
          if(ParamTok[0]!=c_Comma&&BYTE_AT(Stk[iWorkingOn+1][0])!=c_Comma ){
              for(;;)
                {
                  iWorkingOn++;
                  if(iWorkingOn>Ndx ){
                      goto L1580;
                    }
                  strcat(ParamTok,Stk[iWorkingOn]);
                  while((tally(ParamTok,"[")-tally(ParamTok,"]"))!=0||(tally(ParamTok,"(")-tally(ParamTok,")"))!=0){
                      iWorkingOn++;
                      strcat(ParamTok,Stk[iWorkingOn]);
                    }
                  if(BYTE_AT(Stk[iWorkingOn][0])==c_Comma ){
                      goto L1580;
                    }
                  if(!(*Stk[iWorkingOn]>0)){
                      goto L1580;
                    }
                }
L1580:;
            }
          iWorkingOn++;
          strcpy(Stk[++iLastTokenPlus1],ParamTok);
          if(iWorkingOn>Ndx ){
              goto L1579;
            }
        }
L1579:;
      Ndx=iLastTokenPlus1;
    }
  iLastTokenPlus1++;
  *Stk[iLastTokenPlus1]=0;
  if(c_MaxParamToken<=iLastTokenPlus1 ){
      Abort("Maximum nunber of com tokens exceeded.");
    }
  for(iWorkingOn=1; iWorkingOn<=iLastTokenPlus1; iWorkingOn++)
    {
      strcpy(ParamToken[iWorkingOn],Stk[iWorkingOn]);
    }
  return Ndx;
}

int Com_Make_Param_List (char* parms,int IsIndex)
{
  char szTempStr[BCXSTRSIZE];
  char szCleanTemp[BCXSTRSIZE];
  int  iTokens;
  int  i;
  int  j;
  int  k;
  int  iArrayFlag;
  int  iByrefFlag;
  char P1[BCXSTRSIZE];
  char P2[BCXSTRSIZE];
  char local_parm_copy[BCXSTRSIZE];
  char local_temp_str[BCXSTRSIZE];
  int  ComParameterCnt;
  int  iReturn;
  if(parms[0]==0 ){
      return 0;
    }
  ComParameterCnt=0;
  strcpy(local_parm_copy,trim(parms));
  iTokens=GetParameterTokens(local_parm_copy);
  i=1;
  while(i<=iTokens){
      if(BYTE_AT(ParamToken[i][0])==c_Comma ){
          i++;
        }
      else
        {
          i+=(2);
        }
      ComParameterCnt++;
    }
  iReturn=ComParameterCnt;
  i=1;
  while(i<=iTokens){
      *P1=0;
      strcpy(P2,";");
      iByrefFlag=0;
      iArrayFlag=0;
      if(BYTE_AT(ParamToken[i][0])==c_Comma ){
          j=comvt_ERROR;
          strcpy(szCleanTemp,"DISP_E_PARAMc_NOTFOUND");
          i++;
        }
      else
        {
          j=ComParamType(ParamToken[i],&(k));
          if(k ){
              *szCleanTemp=0;
              for(k=1; k<=Ndx; k++)
                {
                  strcat(szCleanTemp,Stk[k]);
                }
              strcpy(szCleanTemp,No_Sigil(szCleanTemp));
            }
          else
            {
              if(j==comvt_CAST ){
                  ConvertCast(ParamToken[i],local_temp_str,szCleanTemp);
                }
              else
                {
                  strcpy(szCleanTemp,No_Sigil(ParamToken[i]));
                }
            }
          iByrefFlag=j & comvt_BYREF;
          if(iByrefFlag ){
              strcpy(P1,"p");
              strcpy(P2,"|VT_BYREF;");
            }
          iArrayFlag=j & comvt_ARRAY;
          if(iArrayFlag ){
              strcat(P1,"p");
              strcpy(P2, join(2,"|VT_ARRAY",P2));
            }
          j=j & comvt_TYPEMASK;
          i+=(2);
        }
      ComParameterCnt--;
      strcpy(szTempStr,str(ComParameterCnt,1));
      if(j==comvt_EMPTY ){
          if(iArrayFlag ){
              Abort("Invalid: Array of empty");
            }
          if(iByrefFlag ){
              Abort("Invalid: Pointer to empty");
            }
          goto L1586;
        }
      if(j==comvt_UI1 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_UI1",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"bVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_UI2 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_UI2",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"uiVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_UI4 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_UI4",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"ulVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_UI8 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_UI8",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"ullVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_UINT ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_UINT",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"uintVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_INT ){
          if(IsIndex==1 ){
              fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I4",P2);
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].lVal = ",szCleanTemp,";");
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_INT",P2);
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"intVal = ",szCleanTemp,";");
            }
          goto L1586;
        }
      if(j==comvt_I1 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I1",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"cVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_I2 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I2",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"iVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_I4 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I4",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"lVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_I8 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I8",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"llval = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_R4 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_R4",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"fltVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_R8 ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_R8",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"dblVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_CY ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_CY",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"cyVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_BSTR ){
          strcpy(szCleanTemp,replace(szCleanTemp,vchr(1,92),vchr(2,92,92)));
          strcpy(szCleanTemp,replace(szCleanTemp,vchr(3,92,92,92),vchr(2,92,92)));
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_BSTR",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"bstrVal = SysAllocString(L",szCleanTemp,");");
          goto L1586;
        }
      if(j==comvt_DECIMAL ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_BYREF|VT_DECIMAL;");
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"decVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_NULL ){
          if(iArrayFlag ){
              Abort("Invalid: Array of NULLs");
            }
          if(iByrefFlag ){
              Abort("Invalid: Pointer to NULL");
            }
          goto L1586;
        }
      if(j==comvt_ERROR ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_ERROR",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"scode = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_BOOL ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_BOOL",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"boolVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_TRUE ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_BOOL",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"boolVal = VARIANT_TRUE;");
          goto L1586;
        }
      if(j==comvt_FALSE ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_BOOL",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"boolVal = VARIANT_FALSE;");
          goto L1586;
        }
      if(j==comvt_DATE ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_DATE",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"date = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_DISPATCH ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_DISPATCH",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"pdispVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_VARIANT ){
          if(!iByrefFlag&&!iArrayFlag ){
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_PARAMS[",szTempStr,"].vt = VT_VARIANT|VT_ARRAY;");
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"  COM_PARAMS[",szTempStr,"].pvarVal = ",szCleanTemp,".pvarVal;");
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"  COM_PARAMS[",szTempStr,"].vt = VT_VARIANT",P2);
              fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"  COM_PARAMS[",szTempStr,"].",P1,"pvarVal = ",szCleanTemp,";");
            }
          goto L1586;
        }
      if(j==comvt_UNKNOWN ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_UNKNOWN",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"punkVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_PVOID ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_PVOID",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"byref = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_STRVAR ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_last_HR = COM_AS2WS(",szCleanTemp,");");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"if (FAILED(COM_last_HR)) {");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"  COM_HR_ErrMsg (COM_last_HR, _T(");
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,SPC,enc("Build ParamList Failed! A2W failure!"),"));");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"} else {");
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_BSTR",P2);
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"  COM_PARAMS[",szTempStr,"].bstrVal = SysAllocString(COM_PWSTR_temp);");
          fprintf(FP_WRITE,"%s%s\n",Scoot,"}");
          goto L1586;
        }
      if(j==comvt_R8_LITERAL ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_R8",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].dblVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_OBJECT ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"VariantCopy(&COM_PARAMS[",szTempStr,"], &",szCleanTemp,".pObjects[0]);");
          goto L1586;
        }
      if(j==comvt_I4_LITERAL ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I4",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].lVal = ",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_VOID ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_VOID;");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].lVal = (void)",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_SAFEARRAY ){
          fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_SAFEARRAY",P2);
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",P1,"parray = &",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_NAMED_ARGUMENT ){
          Abort(join(3,"Named arguments are NOT supported in this version! (",ParamToken[i],")"));
          goto L1586;
        }
      if(j==comvt_CAST ){
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = ",local_temp_str,";");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].",szCleanTemp,";");
          goto L1586;
        }
      if(j==comvt_DEFAULT ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].vt = VT_I4;");
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_PARAMS[",szTempStr,"].lVal = (long)",szCleanTemp,";");
        }

L1586:;

    }
  return iReturn;
}

int ComParamType (char* sParam,int* iRebuild)
{
  int  varidx;
  int  k;
  struct _UDT_VARINFO_STORAGE*  ptVI;
  int  iBYREF_Flag;
  *iRebuild=0;
  if(sParam[0]==c_LPar ){
      return comvt_CAST;
    }
  if(m_iMatchWrd(sParam,"true")){
      return comvt_TRUE;
    }
  if(m_iMatchWrd(sParam,"false")){
      return comvt_FALSE;
    }
  if(sParam[0]==c_DblQt ){
      return comvt_BSTR;
    }
  if(IsDecimalNumber(sParam)){
      if(inchr(sParam,".")){
          return comvt_R8_LITERAL;
        }
      else
        {
          return comvt_I4_LITERAL;
        }
    }
  if(iMatchNQ(sParam,":=")>0 ){
      return comvt_NAMED_ARGUMENT;
    }
  if(IsVariableComObject(trim(No_Sigil(sParam)))){
      return comvt_OBJECT;
    }
  if(RightStr(sParam,"#")){
      return comvt_R8;
    }
  if(RightStr(sParam,"!")){
      return comvt_R4;
    }
  if(RightStr(sParam,"$")){
      return comvt_STRVAR;
    }
  if(RightStr(sParam,"%")){
      return comvt_INT;
    }
  ptVI=NULL;
  k=CheckLocal(sParam,&(varidx));
  if(k!=vt_UNKNOWN ){
      ptVI=&(LocalVars[varidx]);
    }
  else
    {
      k=CheckGlobal(sParam,&(varidx));
      if(k!=vt_UNKNOWN ){
          ptVI=&(GlobalVars[varidx]);
        }
    }
  if(ptVI!=NULL ){
      iBYREF_Flag=0;
      if(ptVI->VarPntr==1 ){
          iBYREF_Flag=comvt_BYREF;
        }
      if(ptVI->VarPntr<2 ){
          if(k==vt_VOID ){
              return comvt_VOID|iBYREF_Flag;
            }
          if(k==vt_STRVAR ){
              return comvt_STRVAR|iBYREF_Flag;
            }
          if(k==vt_DOUBLE ){
              return comvt_R8|iBYREF_Flag;
            }
          if(k==vt_SINGLE ){
              return comvt_R4|iBYREF_Flag;
            }
          if(k==vt_INTEGER ){
              return comvt_INT|iBYREF_Flag;
            }
          if(k==vt_LLONG ){
              return comvt_I8|iBYREF_Flag;
            }
          if(k==vt_ULONGLONG ){
              return comvt_UI8|iBYREF_Flag;
            }
          if(k==vt_LONG ){
              return comvt_I4|iBYREF_Flag;
            }
          if(k==vt_ULONG ){
              return comvt_UI4|iBYREF_Flag;
            }
          if(k==vt_SHORT||k==vt_SSHORT ){
              return comvt_I2|iBYREF_Flag;
            }
          if(k==vt_USHORT ){
              return comvt_UI2|iBYREF_Flag;
            }
          if(k==vt_CHAR||k==vt_SCHAR ){
              return comvt_I1|iBYREF_Flag;
            }
          if(k==vt_BYTE ){
              return comvt_UI1|iBYREF_Flag;
            }
          if(k==vt_BOOL ){
              return comvt_BOOL|iBYREF_Flag;
            }
          if(k==vt_UINT ){
              return comvt_UINT|iBYREF_Flag;
            }
          if(k==vt_VARIANT ){
              return comvt_VARIANT|iBYREF_Flag;
            }
          if(k==vt_UDT ){
              if(strcmp(TypeDefs[ptVI->VarDef].VarName,"SAFEARRAY")==0){
                  return comvt_SAFEARRAY|iBYREF_Flag;
                }
            }
        }
    }
  if(inchr(sParam,"(")){
      char Keyword[BCXSTRSIZE];
      struct _UDT_SUB_FUNC_TOKENS*  tpBCX;
      *iRebuild=1;
      PreParse(sParam);
      TokenSubstitutions(1);
      strcpy(Keyword,lcase(Stk[1]));
      tpBCX=GetWordInfo(Keyword);
      if(tpBCX ){
          if(tpBCX->iCOM!=comvt_BAD ){
              return tpBCX->iCOM;
            }
        }
    }
  *iRebuild=0;
  return comvt_DEFAULT;
}

void ConvertCast (char* szParam,char* szVT,char* szVAL)
{
  int  i;
  char szTemp[BCXSTRSIZE];
  *szVT=0;
  *szVAL=0;
  strcpy(szTemp,extract(szParam,")"));
  strcpy(szTemp,mid(szTemp,2));
  if(LeftStr(szTemp,"VT_")){
      if(LeftStr(szTemp,"VT_ARRAY")){
          strcpy(szVAL,"parray");
          strcpy(szVT,"VT_ARRAY");
          strcpy(szTemp,RemoveStr(szTemp,"VT_ARRAY"));
        }
      if(iMatchNQ(szTemp,"VT_BYREF")){
          strcpy(szVAL, join(2,"p",szVAL));
          if(NOTNULL(szVT)){
              strcat(szVT,"|");
            }
          strcat(szVT,"VT_BYREF");
          strcpy(szTemp,RemoveStr(szTemp,"VT_BYREF"));
        }
      while(szTemp[0]==124){
          strcpy(szTemp,mid(szTemp,2));
        }
      i=0;
      while(ptVCasts[i].pszCAST!=NULL){
          if(LeftStr(szTemp,ptVCasts[i].pszCAST)){
              strcpy(szTemp,remain(szParam,")"));
              if(*szTemp==40 ){
                  strcpy(szTemp,remain(szTemp,")"));
                }
              strcpy(szVAL, join(3,szVAL,"=",szTemp));
              if(NOTNULL(szVT)){
                  strcat(szVT,"|");
                }
              strcat(szVT,ptVCasts[i].pszCAST);
              return;
            }
          i++;
        }
      if(iMatchNQ(szVAL,"array")){
          if(NOTNULL(szVT)){
              strcat(szVT,"|");
            }
          strcat(szVT,szTemp);
          strcpy(szTemp,remain(szParam,")"));
          if(*szTemp==40 ){
              strcpy(szTemp,remain(szTemp,")"));
            }
          strcpy(szVAL, join(3,szVAL,"=",szTemp));
          return;
        }
      Abort(join(3,"Unknown cast. ",szTemp," See help file"));
    }
  if(inchr(szTemp,"*")){
      strcpy(szVAL,"p");
    }
  strcpy(szTemp,RemoveStr(szTemp,"*"));
  i=0;
  while(ptCCasts[i].pszCAST!=NULL){
      if(strcmp(szTemp,ptCCasts[i].pszCAST)==0){
          strcpy(szTemp,remain(szParam,")"));
          if(*szTemp==41 ){
              strcpy(szTemp,remain(szTemp,")"));
            }
          strcpy(szVAL, join(4,szVAL,ptCCasts[i].pszVAL,"=",szTemp));
          if(NOTNULL(szVT)){
              strcat(szVT,"|");
            }
          strcat(szVT,ptCCasts[i].pszCAST);
          return;
        }
      i++;
    }
  Abort(join(7,"Unknown C cast. szParam$=",szParam," szVT$=",szVT," szVAL$=",szVAL," See help file"));
}

void COM_Parse_Method (char* com_method,char* pparms)
{
  Use_COM_InvokeMethod=Use_COM_UsesConversion=Use_COM=TRUE;
  int j={0};
  int k={0};
  char ObjName[BCXSTRSIZE]={0};
  char ComTok[BCXSTRSIZE]={0};
  char ComToken[BCXSTRSIZE]={0};
  char temp_param[BCXSTRSIZE]={0};
  int BuildSafeArray={0};
  char parms[BCXSTRSIZE]={0};
  if(COM_build_trace_code ){
      fprintf(FP_WRITE,"%s","    COM_add_trace_line(");
      fprintf(FP_WRITE,"%s%s\n",enc(join(5,"COM_Parse_Method(",Make_COM_Trace_Lines(com_method)," , ",Make_COM_Trace_Lines(parms),")")),");");
    }
  strcpy(parms,trim(pparms));
  if(parms[0]!=0 ){
      if(strcmp(mid(ucase(parms),1,6),"ARRAY(")==0  || strcmp(mid(ucase(parms),1,6),"ARRAY ")==0){
          strcpy(parms,remain(parms,"("));
          j=(int)strlen(parms)-1;
          parms[j]=0;
          BuildSafeArray=1;
          Use_COM_SafeArray=TRUE;
        }
    }
  ParseCom(com_method);
  j=1;
  strcpy(ObjName,ComStk[j++]);
  for(;;)
    {
      strcpy(ComTok,ComStk[j++]);
      strcpy(ComToken,ComTok);
      fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"lstrcpy(COM_ErrMsg, _T(",enc(Make_COM_Trace_Lines(ComTok)),"));");
      if(inchr(ComTok,"(")>0 ){
          strcpy(temp_param,trim(remain(ComTok,"(")));
          k=Com_Make_Param_List(mid(temp_param,1,(int)strlen(temp_param)-1),0);
          fprintf(FP_WRITE,"%s%s %d %s\n",Scoot,"COM_plist_index =",(int)k,";");
          strcpy(ComToken,extract(ComTok,"("));
        }
      if(COM_build_trace_code ){
          if(NOTNULL(ComStk[j])){
              fprintf(FP_WRITE,"%s%s%s\n","    COM_add_trace_line(",enc(join(2,"Get next dispatch for ",Make_COM_Trace_Lines(ComTok))),");");
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s\n","COM_add_trace_line(",enc(join(2,"Invoke helper for:: ",ComTok)),");");
            }
        }
      if(ISNULL(ComStk[j])){
          if((int)strlen(trim(parms))>0 ){
              k=Com_Make_Param_List(parms,0);
              fprintf(FP_WRITE,"%s%s %d %s\n",Scoot,"COM_plist_index =",(int)k,";");
              if(BuildSafeArray ){
                  fprintf(FP_WRITE,"%s%s\n",Scoot,"COM_create_safearray();");
                }
            }
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_invoke(&",ObjName,", L",enc(RemoveStr(ComToken,SPC)),", DISPATCH_METHOD, NULL);\n");
          goto L1591;
        }
      fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"COM_get_next_dispatch(&",ObjName,", L",enc(RemoveStr(ComToken,SPC)),");");
    }
L1591:;
}

void ParseCom (char* sCom)
{
  int  i;
  int  j;
  int  k;
  char ComTok[BCXSTRSIZE];
  ComNdx=0;
  FastLexer(sCom,SPC,"()");
  if(Ndx ){
      i=1;
      strcpy(ComStk[++ComNdx],StrToken(Stk[i],".",1));
      j=1;
      for(;;)
        {
          j++;
          strcpy(ComTok,StrToken(Stk[i],".",j));
          if(strcmp(ComTok,right(Stk[i],(int)strlen(ComTok)))==0){
              if(i<Ndx ){
                  if(strcmp(Stk[i+1],"(")==0){
                      k=0;
                      for(;;)
                        {
                          i++;
                          strcat(ComTok,Stk[i]);
                          if(strcmp(Stk[i],"(")==0){
                              k++;
                            }
                          if(strcmp(Stk[i],")")==0){
                              k--;
                            }
                          if(!(k)){
                              goto L1593;
                            }
                        }
L1593:;
                    }
                  i++;
                  j=1;
                }
            }
          if(ISNULL(ComTok)){
              goto L1592;
            }
          Add2ComStk(ComTok);
        }
L1592:;
      Add2ComStk("");
      ComNdx--;
    }
}

void Add2ComStk (char* ComTok)
{
  if(c_MaxComStk==++ComNdx ){
      Abort("Too many COM tokens.");
    }
  strcpy(ComStk[ComNdx],ComTok);
}

char * Make_COM_Trace_Lines (char* p_Src)
{
  char  *BCX_RetStr={0};
  char pp_Src[BCXSTRSIZE]={0};
  strcpy(pp_Src,trim(p_Src));
  strcpy(pp_Src,replace(pp_Src,BKSLASH1,BKSLASH2));
  strcpy(pp_Src,replace(pp_Src,vchr(1,c_DblQt),join(2,vchr(1,92),vchr(1,c_DblQt))));
  strcpy(pp_Src,replace(pp_Src,"%","%%"));
  strcpy(pp_Src,replace(pp_Src,"'","\'"));
  BCX_RetStr = BCX_TempStr(strlen(pp_Src));
  strcpy(BCX_RetStr,pp_Src);
  return BCX_RetStr;
}

void Emit_Prolog (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s\n","//      Made with BCX BASIC To C/C++ Translator");
  fprintf(FP_OUTPUT,"%s%s\n","//            Version ",c_VERSION);
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s","//    Translated for compiling with a ");
  if(UseCpp ){
      fprintf(FP_OUTPUT,"%s\n","C++ Compiler");
    }
  else
    {
      fprintf(FP_OUTPUT,"%s\n","C Compiler");
    }
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  if(UseCpp ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  #error A C++ compiler is required");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(NO_MSVC==FALSE ){
      fprintf(FP_OUTPUT,"%s\n","#ifdef _MSC_VER");
      fprintf(FP_OUTPUT,"%s\n","  #ifndef _CRT_SECURE_NO_WARNINGS");
      fprintf(FP_OUTPUT,"%s\n","    #define _CRT_SECURE_NO_WARNINGS");
      fprintf(FP_OUTPUT,"%s\n","  #endif");
      fprintf(FP_OUTPUT,"%s\n","#endif");
    }
  if(Use_LeanAndMean==TRUE ){
      fprintf(FP_OUTPUT,"%s\n","#define  WIN32_LEAN_AND_MEAN");
    }
  if(Use_MULTITHREADED_SW ){
      fprintf(FP_OUTPUT,"%s\n","#define __BCX_MULTITHREADED__");
    }
  if(Use_COM||Use_VBS ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef _WIN32_DCOM");
      fprintf(FP_OUTPUT,"%s\n","  #define _WIN32_DCOM");
      fprintf(FP_OUTPUT,"%s\n","#endif");
    }
  if(Use_UNICODE ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef UNICODE");
      fprintf(FP_OUTPUT,"%s\n","  #define UNICODE   // used by Windows headers");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","  #define _UNICODE  // used by CRT headers");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(UseCpp&&UseCpphdr ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#if defined(__cplusplus)");
      if(UseIO ){
          fprintf(FP_OUTPUT,"%s\n","  #include <iostream>");
        }
      fprintf(FP_OUTPUT,"%s\n","  #include <fstream>");
      fprintf(FP_OUTPUT,"%s\n","  #include <sstream>");
      fprintf(FP_OUTPUT,"%s\n","  #include <iomanip>");
      fprintf(FP_OUTPUT,"%s\n","  typedef std::string stdstr;");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(lof(defFile)>7 ){
      if((FP99=fopen(defFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", defFile); exit(1);
       }
      while(!EoF(FP99)){
          Src[0]=0;
          fgets(Src, 2048 , FP99);
            if(feof(FP99) || (Src[strlen(Src)-1]==10))
              {
               Src[strcspn(Src,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FP99));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Src);
                exit(1);
              }
          fprintf(FP_OUTPUT,"%s\n",Src);
        }
      if(FP99)
       {
         fclose(FP99);
         FP99=NULL;
       }
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(ZapFlag==FALSE ){
      if(WinHeaders==TRUE||Use_Project==TRUE ){
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","// Windows API headers");
          fprintf(FP_OUTPUT,"%s\n","#include <windows.h>    // Core Windows API");
          fprintf(FP_OUTPUT,"%s\n","#include <windowsx.h>   // Windows API macros and functions");
          fprintf(FP_OUTPUT,"%s\n","#include <commctrl.h>   // Common Controls");
          fprintf(FP_OUTPUT,"%s\n","#include <commdlg.h>    // Common Dialogs");
          fprintf(FP_OUTPUT,"%s\n","#include <direct.h>     // Directory handling");
          fprintf(FP_OUTPUT,"%s\n","#include <locale.h>     // Locale handling");
          fprintf(FP_OUTPUT,"%s\n","#include <mmsystem.h>   // Multimedia");
          fprintf(FP_OUTPUT,"%s\n","#include <ole2.h>       // OLE 2.0 functionality");
          fprintf(FP_OUTPUT,"%s\n","#include <oleauto.h>    // OLE Automation");
          fprintf(FP_OUTPUT,"%s\n","#include <olectl.h>     // OLE Controls");
          fprintf(FP_OUTPUT,"%s\n","#include <richedit.h>   // Rich Edit Control");
          fprintf(FP_OUTPUT,"%s\n","#include <shellapi.h>   // Shell API");
          fprintf(FP_OUTPUT,"%s\n","#include <shlobj.h>     // Shell Objects");
          fprintf(FP_OUTPUT,"%s\n","#include <shlwapi.h>    // Shell lightweight utility functions");
          fprintf(FP_OUTPUT,"%s\n","#include <tchar.h>      // Unicode/ANSI character mapping");
          fprintf(FP_OUTPUT,"%s\n","#include <urlmon.h>     // URL Monikers");
          fprintf(FP_OUTPUT,"%s\n","#include <wchar.h>      // Wide character support");
          fprintf(FP_OUTPUT,"%s\n","#include <wctype.h>     // Wide character classification");
          fprintf(FP_OUTPUT,"%s\n","#include <wininet.h>    // Internet");
          fprintf(FP_OUTPUT,"%s\n","#include <winsock.h>    // Windows Sockets (Winsock 1.1)");
          fprintf(FP_OUTPUT,"%s\n",SPC);
        }
      fprintf(FP_OUTPUT,"%s\n","// ISO C Standard Library headers");
      fprintf(FP_OUTPUT,"%s\n","#include <ctype.h>      // Character classification");
      fprintf(FP_OUTPUT,"%s\n","#include <math.h>       // Mathematical functions");
      fprintf(FP_OUTPUT,"%s\n","#include <setjmp.h>     // Non-local jumps");
      fprintf(FP_OUTPUT,"%s\n","#include <stdarg.h>     // Variable arguments");
      fprintf(FP_OUTPUT,"%s\n","#include <stddef.h>     // Common definitions");
      fprintf(FP_OUTPUT,"%s\n","#include <stdio.h>      // Input/output");
      fprintf(FP_OUTPUT,"%s\n","#include <stdlib.h>     // General utilities");
      fprintf(FP_OUTPUT,"%s\n","#include <string.h>     // String handling");
      fprintf(FP_OUTPUT,"%s\n","#include <time.h>       // Date and time");
      fprintf(FP_OUTPUT,"%s\n","#include <errno.h>      // Error numbers");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// C99 Standard headers");
      fprintf(FP_OUTPUT,"%s\n","#include <stdbool.h>    // Boolean type");
      fprintf(FP_OUTPUT,"%s\n","#include <inttypes.h>   // Integer types");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// POSIX headers");
      fprintf(FP_OUTPUT,"%s\n","#include <fcntl.h>      // File control options");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// Windows-specific headers");
      fprintf(FP_OUTPUT,"%s\n","#include <process.h>    // Process control functions");
      fprintf(FP_OUTPUT,"%s\n","#include <io.h>         // Low-level I/O (Windows POSIX subset)");
      fprintf(FP_OUTPUT,"%s\n","#include <conio.h>      // Console I/O (Windows-specific)");
    }
  fprintf(FP_OUTPUT,"%s\n",SPC);
}

void Emit_Main_Function ()
{
  fprintf(FP_WRITE,"%s\n","int main(int argc, char *argv[])");
     fflush(FP_WRITE);
}

void Emit_Epilog ()
{
  if(Use_Wingui+MakeDLL+NoMain+EndOfProgram==0 ){
      if(Use_Sound ){
          fprintf(FP_WRITE,"%s%s\n",Scoot,"midiOutClose (hMidi);");
        }
      fprintf(FP_WRITE,"%s\n","return EXIT_SUCCESS;   // End of main program");
      fprintf(FP_WRITE,"%s\n","}");
         fflush(FP_WRITE);
    }
}

void Emit_CompilerDefines ()
{
  static int BeenHere;
  if(BeenHere ){
      return;
    }
  BeenHere=TRUE;
  fprintf(FP_HDR,"%s\n","");
  if(UseImportExport ){
      fprintf(FP_HDR,"%s\n","#if defined(__cplusplus)");
      fprintf(FP_HDR,"%s\n","  #define C_EXPORT EXTERN_C __declspec(dllexport)");
      fprintf(FP_HDR,"%s\n","  #define C_IMPORT EXTERN_C __declspec(dllimport)");
      fprintf(FP_HDR,"%s\n","#else");
      fprintf(FP_HDR,"%s\n","  #define C_EXPORT __declspec(dllexport)");
      fprintf(FP_HDR,"%s\n","  #define C_IMPORT __declspec(dllimport)");
      fprintf(FP_HDR,"%s\n","#endif");
      fprintf(FP_HDR,"%s\n","");
    }
  if(ZapFlag==FALSE ){
      if(NO_MSVC==FALSE ){
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","//                   Microsoft VC++");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","#ifndef DECLSPEC_UUID");
          fprintf(FP_HDR,"%s\n","  #if(_MSC_VER >= 1100) && defined(__cplusplus)");
          fprintf(FP_HDR,"%s\n","    #define DECLSPEC_UUID(x)  __declspec(uuid(x))");
          fprintf(FP_HDR,"%s\n","  #else");
          fprintf(FP_HDR,"%s\n","    #define DECLSPEC_UUID(x)");
          fprintf(FP_HDR,"%s\n","  #endif");
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","#if (_MSC_VER >= 1900)            // earlier versions untested");
          fprintf(FP_HDR,"%s\n","   #include <intrin.h>");
          fprintf(FP_HDR,"%s\n","      #ifndef _rdtsc");
          fprintf(FP_HDR,"%s\n","         #define _rdtsc __rdtsc   // MSVC uses 2 underscores");
          fprintf(FP_HDR,"%s\n","      #endif");
          if(WarningFlag==FALSE ){
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4018) // signed/unsigned mismatch warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4100) // unreferenced argument warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4244) // conversion from type1 to type2 warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4245) // conversion from type1 to type2 warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4267) // conversion from type1 to type2 warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4305) // truncation from double to float warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4312) // truncation from cast warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4389) // conversion from signed to unsigned warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4459) // hides global declaration warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4459) // local hides global declaration");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4554) // use parentheses to clarify precedence");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4800) // forcing value to bool warnings");
              fprintf(FP_HDR,"%s\n","   #pragma warning(disable: 4838) // conversion from type1 to type2 warnings");
            }
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","");
        }
      if(NO_GCCCLANG==FALSE ){
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","//                  GCC and CLANG");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","#if defined(__GNUC__) || defined(__clang__)");
          fprintf(FP_HDR,"%s\n","   #ifndef __BCPLUSPLUS__");
          fprintf(FP_HDR,"%s\n","      #include <x86intrin.h>");
          fprintf(FP_HDR,"%s\n","   #endif");
          if(WarningFlag==FALSE ){
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wwrite-strings"));
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wunused-parameter"));
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wunknown-pragmas"));
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wdangling-else"));
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wint-to-pointer-cast"));
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wdeprecated"));
              fprintf(FP_HDR,"%s%s\n","   #pragma GCC diagnostic ignored ",enc("-Wsizeof-pointer-div"));
            }
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","");
        }
      if(NO_BORLAND==FALSE ){
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","//                  Embarcadero C++");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","#if defined(__BCPLUSPLUS__)");
          fprintf(FP_HDR,"%s\n","      #include<malloc.h>");
          fprintf(FP_HDR,"%s\n","      #if defined (_clang__)");
          fprintf(FP_HDR,"%s\n","          #include <mmintrin.h>");
          fprintf(FP_HDR,"%s\n","      #endif");
          fprintf(FP_HDR,"%s\n","      #define _kbhit kbhit");
          fprintf(FP_HDR,"%s\n","      #ifndef _rdtsc");
          fprintf(FP_HDR,"%s\n","         #define _rdtsc __rdtsc  // Uses 2 underscores");
          fprintf(FP_HDR,"%s\n","      #endif");
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","");
        }
      if(ISFALSE UseCpp&&NO_LCCWIN==FALSE ){
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","//                     Lcc-Win32");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","#if defined(__LCC__)");
          fprintf(FP_HDR,"%s\n","    #define  PCTSTR    LPCTSTR");
          fprintf(FP_HDR,"%s\n","    #define _fseeki64  fseek");
          fprintf(FP_HDR,"%s\n","    #define _ftelli64  ftell");
          fprintf(FP_HDR,"%s\n","    #define _itoa      itoa");
          fprintf(FP_HDR,"%s\n","    #define _ltoa      ltoa");
          fprintf(FP_HDR,"%s\n","    #define _strdup    strdup");
          fprintf(FP_HDR,"%s\n","    #define _stricmp   stricmp");
          fprintf(FP_HDR,"%s\n","    #define _strnicmp  strnicmp");
          fprintf(FP_HDR,"%s\n","    #include <intrinsics.h>");
          fprintf(FP_HDR,"%s\n","    #include <malloc.h>  // for _msize");
          fprintf(FP_HDR,"%s\n","    #if defined(__windows_h__)");
          fprintf(FP_HDR,"%s\n","       #define COMPILE_MULTIMON_STUBS");
          fprintf(FP_HDR,"%s\n","       #include <multimon.h>");
          fprintf(FP_HDR,"%s\n","       #include <iehelper.h>");
          fprintf(FP_HDR,"%s\n","       #include <exdisp.h>");
          fprintf(FP_HDR,"%s\n","    #endif");
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","");
        }
      if(Use_Overloaded_Macro ){
          fprintf(FP_HDR,"%s\n","#if !defined(__LCC__)");
          fprintf(FP_HDR,"%s\n","    #define overloaded");
          fprintf(FP_HDR,"%s\n","#else");
          fprintf(FP_HDR,"%s\n","    #define overloaded overloaded");
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","");
        }
      if(ISFALSE UseCpp&&NO_PELLES==FALSE ){
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","//                     Pelles C");
          fprintf(FP_HDR,"%s\n","// *************************************************");
          fprintf(FP_HDR,"%s\n","");
          fprintf(FP_HDR,"%s\n","#if defined(__POCC__)");
          fprintf(FP_HDR,"%s\n","    #include <intrin.h>");
          fprintf(FP_HDR,"%s\n","    #pragma pack_stack(off)");
          if(WarningFlag==FALSE ){
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2006)    // Non-portable conversion int to const char*");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2007)    // Non-portable inline code");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2027)    // Missing prototype");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2073)    // Loss of precision float to int");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2115)    // Initialized but not used warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2118)    // Unreferenced argument warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2130)    // Usually flawed reporting");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2134)    // Possible infinite loop");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2154)    // Buggy unreachable code warning using sizeof");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2197)    // Unsigned long int not a std bit-field type");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2215)    // Conversion from type1 to type2 warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2218)    // Unreferenced parameter");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2230)    // Incomplete struct declarations (vbs support)");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2232)    // Unable to check variable arguments");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2235)    // Not all control paths return a value");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2241)    // Function marked for deprecation");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2243)    // Use parentheses to clarify");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2248)    // Non-portable use of extension");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2250)    // Shadowing variable");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2251)    // Types with different signedness");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2804)    // Consider changing type to size_t warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2805)    // Possible anti-aliasing violation warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2808)    // Unsequenced assignment warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2810)    // Potential realloc warnings");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2812)    // Attempt to read from non-readable location");
              fprintf(FP_HDR,"%s\n","    #pragma warn(disable: 2813)    // Possible out-of-bounds warning (caused by CAST)");
            }
          fprintf(FP_HDR,"%s\n","#endif");
          fprintf(FP_HDR,"%s\n","");
        }
    }
}

void Emit_System_Vars (FILE* FP_OUTPUT)
{
  if(Use_Console||Use_Findfirst||Use_Findnext||Use_GoSub||Use_BcxTempStr||Use_Ldouble||Use_Crlf||Use_Inputbox||Use_Infobox||Use_Inputbuffer||Use_BCX_Splitter||Use_Dynacall||Use_DynacallA||Use_LCaseTbl||Use_UCaseTbl ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s%s\n","//             ",c_BCX_STR_SYS_VARS);
      fprintf(FP_OUTPUT,"%s\n","// *************************************************");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(Use_BCX_Splitter ){
      fprintf(FP_OUTPUT,"%s\n","static ULONG SplitBarFG=RGB(0,0,255);");
      fprintf(FP_OUTPUT,"%s\n","static ULONG SplitBarBG=RGB(212,212,212);");
      fprintf(FP_OUTPUT,"%s\n","#define SPLITBAR_SIZE 2");
      fprintf(FP_OUTPUT,"%s\n","#define MIN_PANESIZE 4");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","typedef struct _SPLITTERINFO{");
      fprintf(FP_OUTPUT,"%s\n","   BOOL  fMovingBar;");
      fprintf(FP_OUTPUT,"%s\n","   HWND  hwPane1;");
      fprintf(FP_OUTPUT,"%s\n","   HWND  hwPane2;");
      fprintf(FP_OUTPUT,"%s\n","   int   percent;");
      fprintf(FP_OUTPUT,"%s\n","   int   splittype;");
      fprintf(FP_OUTPUT,"%s\n","   int   swsStyle;");
      fprintf(FP_OUTPUT,"%s\n","   HCURSOR  hCursor;");
      fprintf(FP_OUTPUT,"%s\n","}SPLITTERINFO, *LPSPLITTERINFO;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(Use_Ldouble ){
      fprintf(FP_OUTPUT,"%s\n","#define LDOUBLE long double");
    }
  if(Use_Idxqsort ){
      fprintf(FP_OUTPUT,"%s\n","char*** pppStr;");
    }
  if(Use_Idxqsort||Use_IdxqsortSt||Use_PtrqsortSt ){
      fprintf(FP_OUTPUT,"%s\n","int     Key;");
    }
  if(Use_IdxqsortSt ){
      fprintf(FP_OUTPUT,"%s\n","char*   cmp1;");
      fprintf(FP_OUTPUT,"%s\n","int     StructSize;");
    }
  if(Use_PtrqsortSt ){
      fprintf(FP_OUTPUT,"%s\n","int     OffSet;");
    }
  if(Use_Sound ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#define SNDQUE 10000");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","typedef struct _soundtype {");
      fprintf(FP_OUTPUT,"%s\n","   float  Freq;");
      fprintf(FP_OUTPUT,"%s\n","   int    Dura;");
      fprintf(FP_OUTPUT,"%s\n","   int    Vol;");
      fprintf(FP_OUTPUT,"%s\n","   int    Voice;");
      fprintf(FP_OUTPUT,"%s\n","   float  Tempo;");
      fprintf(FP_OUTPUT,"%s\n","   int    sndTid;");
      fprintf(FP_OUTPUT,"%s\n","} soundtype, *LPSOUNDTYPE;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static soundtype  SndPmtr[SNDQUE+1];");
      fprintf(FP_OUTPUT,"%s\n","static UINT       gTenter;");
      fprintf(FP_OUTPUT,"%s\n","static UINT       gTwait;");
      fprintf(FP_OUTPUT,"%s\n","static UINT       gTexit;");
      fprintf(FP_OUTPUT,"%s\n","static UINT       gTarray;");
      fprintf(FP_OUTPUT,"%s\n","static BOOL       gTsig;");
      fprintf(FP_OUTPUT,"%s\n","static HANDLE     gSThread=NULL;");
      fprintf(FP_OUTPUT,"%s\n","static HMIDIOUT   hMidi;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(Use_BCX_Fontdlg ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","typedef struct _BCX_FONT_TYPE {");
      fprintf(FP_OUTPUT,"%s\n","   LOGFONT lf;");
      fprintf(FP_OUTPUT,"%s\n","   int  SIZE;");
      fprintf(FP_OUTPUT,"%s\n","   int  RGB;");
      fprintf(FP_OUTPUT,"%s\n","} BCX_FONT_TYPE;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","BCX_FONT_TYPE BCX_FONT;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  if(Use_NUL ){
      fprintf(FP_OUTPUT,"%s\n","static char    NUL [1]={0};        // Null");
    }
  if(Use_BEL ){
      fprintf(FP_OUTPUT,"%s\n","static char    BEL [2]={7,0};      // Bell");
    }
  if(Use_BS ){
      fprintf(FP_OUTPUT,"%s\n","static char    BS  [2]={8,0};      // Back Space");
    }
  if(Use_TAB ){
      fprintf(FP_OUTPUT,"%s\n","static char    TAB [2]={9,0};      // Horz Tab");
    }
  if(Use_LF ){
      fprintf(FP_OUTPUT,"%s\n","static char    LF  [2]={10,0};     // Line Feed");
    }
  if(Use_VT ){
      fprintf(FP_OUTPUT,"%s\n","static char    VT  [2]={11,0};     // Vert Tab");
    }
  if(Use_FF ){
      fprintf(FP_OUTPUT,"%s\n","static char    FF  [2]={12,0};     // Form Feed");
    }
  if(Use_CR ){
      fprintf(FP_OUTPUT,"%s\n","static char    CR  [2]={13,0};     // Carr Rtn");
    }
  if(Use_EF ){
      fprintf(FP_OUTPUT,"%s\n","static char    EF  [2]={26,0};     // End-of-File");
    }
  if(Use_ESC ){
      fprintf(FP_OUTPUT,"%s\n","static char    ESC [2]={27,0};     // Escape");
    }
  if(Use_SPC ){
      fprintf(FP_OUTPUT,"%s\n","static char    SPC [2]={32,0};     // Space");
    }
  if(Use_DQ ){
      fprintf(FP_OUTPUT,"%s\n","static char    DQ  [2]={34,0};     // Double-Quote");
    }
  if(Use_DDQ ){
      fprintf(FP_OUTPUT,"%s\n","static char    DDQ [3]={34,34,0};  // Double-Double-Quote");
    }
  if(Use_Crlf ){
      fprintf(FP_OUTPUT,"%s\n","static char    CRLF[3]={13,10,0};  // Carr Rtn & Line Feed");
    }
  if(Use_Inputbox ){
      fprintf(FP_OUTPUT,"%s\n","char   BCX_INPUTBOX_VAL[BCXSTRSIZE];");
    }
  if(Use_Cursor ){
      fprintf(FP_OUTPUT,"%s\n","static COORD   cursor;             // holds coordinates of cursor");
    }
  if(Use_Console ){
      fprintf(FP_OUTPUT,"%s\n","static HANDLE  hConsole;           // handle of console window");
    }
  if(Use_Cls||Use_Color ){
      fprintf(FP_OUTPUT,"%s\n","static int     color_fg = 7;       // forground color set to default");
      fprintf(FP_OUTPUT,"%s\n","static int     color_bg = 0;       // background color set to default");
    }
  if(Use_Consolesize ){
      fprintf(FP_OUTPUT,"%s\n","static int     BcxSaveConX;");
      fprintf(FP_OUTPUT,"%s\n","static int     BcxSaveConY;");
    }
  if(Use_PushPopColors ){
      fprintf(FP_OUTPUT,"%s\n","static int     color_pshpop;       // Push / Pop Color storage");
    }
  if(Use_Scan ){
      fprintf(FP_OUTPUT,"%s\n","static int     ScanError;          // holds last error from scan function");
    }
  if(Use_Inputbuffer ){
      fprintf(FP_OUTPUT,"%s\n","static char    InputBuffer[2048];");
    }
  if(Use_Hook ){
      fprintf(FP_OUTPUT,"%s\n","static HHOOK   CmDlgHook;");
    }
  if(Use_GoSub ){
      fprintf(FP_OUTPUT,"%s\n","static jmp_buf GosubStack[32];");
      fprintf(FP_OUTPUT,"%s\n","static int     GosubNdx;");
    }
  if(Use_LCaseTbl ){
      fprintf(FP_OUTPUT,"%s\n","static unsigned char*  LowCase;");
    }
  if(Use_UCaseTbl ){
      fprintf(FP_OUTPUT,"%s\n","static unsigned char*  UprCase;");
    }
  if(Use_Findfirst||Use_Findnext ){
      fprintf(FP_OUTPUT,"%s\n","static HANDLE  fffn_FileHandle;");
      fprintf(FP_OUTPUT,"%s\n","static WIN32_FIND_DATA fffn_FindData;");
    }
  if(Use_DynacallCommon ){
      fprintf(FP_OUTPUT,"%s\n","static  HINSTANCE BCX_DllStore[256];");
    }
  fprintf(FP_OUTPUT,"%s\n",SPC);
}

void Emit_Assignments (int* FuncRetnFlag)
{
  int strtest={0};
  int varid={0};
  struct _UDT_VARINFO_STORAGE*  vi={0};
  char vr[BCXSTRSIZE]={0};
  int brcnt={0};
  char LTmp[BCXSTRSIZE]={0};
  int eo_H={0};
  int eo_I={0};
  int eo_J={0};
  int eo_K={0};
  int HasStorage={0};
  char Arg[BCXSTRSIZE];
  int EqlSgnPos;
  if(Ndx==0 ){
      return;
    }
  for(int i=1; i<=Ndx; i++)
    {
      if(Im_UDT_String(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"$"));
        }
      if(Im_UDT_Single(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"!"));
        }
      if(Im_UDT_Double(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
    }
  for(EqlSgnPos=1; EqlSgnPos<=Ndx; EqlSgnPos++)
    {
      if(*Stk[EqlSgnPos]==61 ){
          if(!(*Stk[EqlSgnPos-1]==60||*Stk[EqlSgnPos-1]==62||*Stk[EqlSgnPos-1]==43||*Stk[EqlSgnPos-1]==45||*Stk[EqlSgnPos-1]==47||*Stk[EqlSgnPos-1]==42)){
              goto L1596;
            }
        }
    }
L1596:;
  if(EqlSgnPos-1==Ndx ){
      BuildCleanStr(1,Ndx,LTmp);
      strcat(LTmp,";");
      if(*FuncRetnFlag==2 ){
          fprintf(FP_WRITE,"%s\n",LTmp);
        }
      else
        {
          fprintf(FP_WRITE,"%s%s\n",Scoot,LTmp);
        }
      if(*FuncRetnFlag==2 ){
          *FuncRetnFlag=0;
          *Stk[1]=0;
          return;
        }
      return;
    }
  for(eo_I=2; eo_I<=EqlSgnPos-1; eo_I++)
    {
      strcpy(Stk[1], join(2,Stk[1],Stk[eo_I]));
    }
  if(Im_UDT_String(Stk[1])){
      strcpy(Stk[1], join(2,Stk[1],"$"));
      for(int i=EqlSgnPos+1; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],"+")==0){
              if(strcmp(Stk[i+1],"+")==0){
                  goto L1598;
                }
              strcpy(Stk[i],"&");
              goto L1598;
            }
        }
L1598:;
    }
  eo_H=inchr(Stk[1],"*");
  if(eo_H ){
      if(!(inchr(Stk[1],"$")&&eo_H>1)){
          RemoveAll(Stk[1],"$");
          goto PROCESSNUMERIC;
        }
    }
  strtest=DataType(Stk[1]);
  if(*Stk[1]!=40 ){
      if(strtest==vt_UNKNOWN ){
          strcpy(Stk[1], join(2,Stk[1],"$"));
          strtest=vt_STRVAR;
        }
    }
  if(strtest==vt_INTEGER ){
      brcnt=tally(Stk[1],"[");
      strcpy(vr,extract(Stk[1],"["));
      strtest=CheckLocal(vr,&(varid));
      if(strtest==vt_UNKNOWN ){
          strtest=CheckGlobal(vr,&(varid));
          vi=&((GlobalVars[varid]));
        }
      else
        {
          vi=&((LocalVars[varid]));
        }
      if(strtest==vt_CHAR||strtest==vt_SCHAR ){
          strtest=vt_STRVAR;
        }
      if(strtest==vt_STRVAR ){
          if(NOTZERO(vi->VarPntr)){
              goto PROCESSNUMERIC;
            }
          if(tally(vi->VarDim,"[")==brcnt ){
              goto PROCESSNUMERIC;
            }
          if(tally(vi->VarDim,"[")!=brcnt+1 ){
              goto PROCESSNUMERIC;
            }
        }
    }
  if(strtest==vt_UNKNOWN ){
      if(!inchr(Stk[1],"$")){
          if(Im_UDT_String(Stk[1])){
              strcpy(Stk[1], join(2,Stk[1],"$"));
              strtest=vt_STRVAR;
            }
        }
    }
  if(strtest==vt_UNKNOWN ){
      if(!inchr(Stk[1],"!")){
          if(Im_UDT_Single(Stk[1])){
              strcpy(Stk[1], join(2,Stk[1],"!"));
              strtest=vt_SINGLE;
            }
        }
    }
  if(strtest==vt_UNKNOWN ){
      if(!inchr(Stk[1],"#")){
          if(Im_UDT_Double(Stk[1])){
              strcpy(Stk[1], join(2,Stk[1],"#"));
              strtest=vt_DOUBLE;
            }
        }
    }
  if(strtest==vt_STRVAR ){
      NormalizeStrConcat();
      if(EqlSgnPos+1==Ndx ){
          if(strcmp(Stk[Ndx],DDQ)==0){
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"*",No_Sigil(Stk[1]),"=0;");
              goto STRINGEXIT;
            }
        }
      if(Ndx==3 ){
          strcpy(Stk[1],No_Sigil(Stk[1]));
          strcpy(Stk[3],No_Sigil(Stk[3]));
          if(strcmp(Stk[1],"BCX_RetStr")==0){
              fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"BCX_RetStr = BCX_TempStr(strlen(",Stk[3],"));");
            }
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"strcpy(",Stk[1],",",Stk[3],");");
          goto STRINGEXIT;
        }
      *Arg=0;
      *LTmp=0;
      eo_J=eo_K=0;
      if(m_iMatchLft(Stk[3],"$$")){
          HasStorage=TRUE;
        }
      strcpy(Var,No_Sigil(Stk[1]));
      if(strcmp(No_Sigil(Stk[EqlSgnPos+1]),Var)==0){
          eo_K=TRUE;
        }
      for(eo_H=EqlSgnPos+1; eo_H<=Ndx; eo_H++)
        {
          if(strcmp(Stk[eo_H],"&")==0  && strcmp(Stk[eo_H-1],",")!=0  && strcmp(Stk[eo_H-1],"(")!=0){
              eo_J++;
              strcat(Arg,LTmp);
              strcpy(LTmp,",");
            }
          else
            {
              strcat(LTmp,No_Sigil(Stk[eo_H]));
            }
        }
      if(NOTNULL(LTmp) && strcmp(LTmp,",")!=0){
          strcat(Arg,LTmp);
        }
      RemoveAll(Var,SPC);
      if(eo_J==0 ){
          if(strcmp(Var,"BCX_RetStr")==0){
              if(HasStorage ){
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"BCX_RetStr=",Arg,";");
                  goto STRINGEXIT;
                }
              else
                {
                  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"BCX_RetStr = BCX_TempStr(strlen(",Arg,"));");
                }
            }
          if(strcmp(right(Var,3),"[0]")==0  && strcmp(Arg,"0")==0){
              fprintf(FP_WRITE,"%s%s%s\n",Scoot,Var," = 0;");
            }
          else
            {
              fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"strcpy(",Var,",",Arg,");");
            }
          goto STRINGEXIT;
        }
      if(eo_K==TRUE&&eo_J==1 ){
          fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"strcat(",Arg,");");
          goto STRINGEXIT;
        }
      strcpy(LTmp,str(++eo_J,1));
      Use_Join=Use_BcxTempStr=TRUE;
      if(strcmp(Var,"BCX_RetStr")==0){
          fprintf(FP_WRITE,"%s%s%s%s%s%s\n",Scoot,"BCX_RetStr=join(",LTmp,",",Arg,");");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s%s%s\n",Scoot,"strcpy(",Var,", join(",LTmp,",",Arg,"));");
        }

STRINGEXIT:;

      return;
    }
  else
    {

PROCESSNUMERIC:;

      for(int i=1; i<=Ndx; i++)
        {
          if(strcmp(Stk[i],"!=")==0){
              strcpy(Stk[i],vchr(2,198,230));
            }
        }
      for(eo_I=2; eo_I<=EqlSgnPos; eo_I++)
        {
          *Stk[eo_I]=0;
        }
      strcpy(Stk[EqlSgnPos],"=");
      if(strcmp(Stk[EqlSgnPos+1],Stk[1])==0  && Ndx==5 ){
          if(InstrAny(Stk[EqlSgnPos+2],"+-*/") && strcmp(Stk[EqlSgnPos+3],">")!=0){
              strcpy(Stk[EqlSgnPos], join(2,Stk[EqlSgnPos+2],Stk[EqlSgnPos]));
              *Stk[EqlSgnPos+1]=0;
              *Stk[EqlSgnPos+2]=0;
            }
        }
      for(eo_H=2; eo_H<=Ndx; eo_H++)
        {
          if(isdigit(*Stk[eo_H])&&m_iMatchRgt(Stk[eo_H],"E")){
              strcpy(Stk[eo_H], join(2,Stk[eo_H],Stk[eo_H+1]));
              if(*Stk[eo_H+1]==45 ){
                  strcpy(Stk[eo_H], join(2,Stk[eo_H],Stk[eo_H+2]));
                  *Stk[eo_H+2]=0;
                }
              *Stk[eo_H+1]=0;
            }
        }
      fprintf(FP_WRITE,"%s%s",Scoot,No_Sigil(Stk[1]));
      int eo_FoundEql={0};
      for(int A=2; A<=Ndx; A++)
        {
          if(*Stk[A]==61 ){
              eo_FoundEql=TRUE;
            }
          if(*Stk[A]==33 ){
              fprintf(FP_WRITE,"%s","!");
              if(eo_FoundEql==FALSE ){
                  if(*Stk[A-1]!=61 ){
                      strcpy(Stk[A-1],replace(Stk[A-1],vchr(2,198,230),"!="));
                      fprintf(FP_WRITE,"%s","=");
                    }
                }
            }
          else
            {
              strcpy(Stk[A],No_Sigil(Stk[A]));
              strcpy(Stk[A],replace(Stk[A],vchr(2,198,230),"!="));
              fprintf(FP_WRITE,"%s",Stk[A]);
            }
          if(A<Ndx ){
              if(ISFALSE(ispunct(*Stk[A+1]))){
                  fprintf(FP_WRITE,"%s","");
                }
            }
        }
      fprintf(FP_WRITE,"%s\n",";");
    }
}

void Emit_RuntimeFunctions (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s%s\n","//                 ",c_BCX_STR_RUNTIME);
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  Emit_RT_Dynacall(FP_OUTPUT);
  Emit_RT_StringCore(FP_OUTPUT);
  Emit_RT_StringUtils(FP_OUTPUT);
  Emit_RT_FileDialogs(FP_OUTPUT);
  Emit_RT_FormatPath1(FP_OUTPUT);
  Emit_RT_FormatPath2(FP_OUTPUT);
  Emit_RT_FileAttrClip1(FP_OUTPUT);
  Emit_RT_FileAttrClip2(FP_OUTPUT);
  Emit_RT_SortDynamic(FP_OUTPUT);
  Emit_RT_SplitConsole(FP_OUTPUT);
  Emit_RT_Controls1(FP_OUTPUT);
  Emit_RT_Controls2(FP_OUTPUT);
  Emit_RT_Graphics1(FP_OUTPUT);
  Emit_RT_Graphics2(FP_OUTPUT);
  Emit_RT_SystemCOM1(FP_OUTPUT);
  Emit_RT_SystemCOM2(FP_OUTPUT);
}

void Emit_RT_Dynacall (FILE* FP_OUTPUT)
{
  if(Use_Dynacall||Use_DynacallA ){
      fprintf(FP_OUTPUT,"%s\n","HINSTANCE BCX_LoadDll (PCTSTR DllName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static int DllCnt;");
      fprintf(FP_OUTPUT,"%s\n","  static int RegUnload;");
      fprintf(FP_OUTPUT,"%s\n","  if (!RegUnload) RegUnload =! atexit(BCX_UnloadDll);");
      fprintf(FP_OUTPUT,"%s\n","  DllCnt = (DllCnt+1) & 255;");
      fprintf(FP_OUTPUT,"%s\n","  FreeLibrary(BCX_DllStore[DllCnt]);");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_DllStore[DllCnt] = LoadLibrary(DllName);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_UnloadDll (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ii;");
      fprintf(FP_OUTPUT,"%s\n","  for(ii = 255;ii >= 0;ii--)");
      fprintf(FP_OUTPUT,"%s\n","    FreeLibrary(BCX_DllStore[ii]);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      if(Use_DynacallA ){
          fprintf(FP_OUTPUT,"%s\n","INT_PTR BCX_DynaCallA(PCTSTR DllName, PCTSTR FuncName, int nArgs, INT_PTR argtable[])");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","    HINSTANCE hInst = 0;");
          fprintf(FP_OUTPUT,"%s\n","    FARPROC lpFunc = 0;");
          fprintf(FP_OUTPUT,"%s\n","    INT_PTR result = 0;");
          fprintf(FP_OUTPUT,"%s\n","    char buff[256];");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Validate argument count");
          fprintf(FP_OUTPUT,"%s\n","    if (nArgs < 0 || nArgs > 16) {");
          fprintf(FP_OUTPUT,"%s\n","        return 0;");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Load the DLL");
          fprintf(FP_OUTPUT,"%s\n","    hInst = GetModuleHandle(DllName);");
          fprintf(FP_OUTPUT,"%s\n","    if (hInst == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","        hInst = BCX_LoadDll(DllName);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    if (hInst == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","        return 0;");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Find the function");
          fprintf(FP_OUTPUT,"%s\n","    lpFunc = GetProcAddress(hInst, FuncName);");
          fprintf(FP_OUTPUT,"%s\n","    if (lpFunc == NULL) {");
          fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        sprintf(buff, ",enc("%s%s"),", FuncName, ",enc("A"),");");
          fprintf(FP_OUTPUT,"%s\n","        lpFunc = GetProcAddress(hInst, buff);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    if (lpFunc == NULL) {");
          fprintf(FP_OUTPUT,"%s%s%s\n","        sprintf(buff, ",enc("_%s"),", FuncName);");
          fprintf(FP_OUTPUT,"%s\n","        lpFunc = GetProcAddress(hInst, buff);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    if (lpFunc == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","        return 0;");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Call the function with properly typed function pointers");
          fprintf(FP_OUTPUT,"%s\n","    // Using DWORD_PTR for consistency with DynaCallB");
          fprintf(FP_OUTPUT,"%s\n","    switch (nArgs) {");
          fprintf(FP_OUTPUT,"%s\n","        case 0: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func0)();");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func0)lpFunc)();");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 1: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func1)(DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func1)lpFunc)((DWORD_PTR)argtable[0]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 2: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func2)(DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func2)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 3: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func3)(DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func3)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 4: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func4)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func4)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 5: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func5)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func5)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                              (DWORD_PTR)argtable[4]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 6: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func6)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func6)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                              (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 7: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func7)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func7)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                              (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 8: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func8)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func8)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                              (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 9: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func9)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func9)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                              (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                              (DWORD_PTR)argtable[8]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 10: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func10)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func10)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 11: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func11)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func11)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9], (DWORD_PTR)argtable[10]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 12: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func12)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func12)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9], (DWORD_PTR)argtable[10], (DWORD_PTR)argtable[11]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 13: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func13)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func13)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9], (DWORD_PTR)argtable[10], (DWORD_PTR)argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[12]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 14: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func14)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func14)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9], (DWORD_PTR)argtable[10], (DWORD_PTR)argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[12], (DWORD_PTR)argtable[13]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 15: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func15)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func15)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9], (DWORD_PTR)argtable[10], (DWORD_PTR)argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[12], (DWORD_PTR)argtable[13], (DWORD_PTR)argtable[14]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 16: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func16)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func16)lpFunc)((DWORD_PTR)argtable[0], (DWORD_PTR)argtable[1], (DWORD_PTR)argtable[2], (DWORD_PTR)argtable[3],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[4], (DWORD_PTR)argtable[5], (DWORD_PTR)argtable[6], (DWORD_PTR)argtable[7],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[8], (DWORD_PTR)argtable[9], (DWORD_PTR)argtable[10], (DWORD_PTR)argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               (DWORD_PTR)argtable[12], (DWORD_PTR)argtable[13], (DWORD_PTR)argtable[14], (DWORD_PTR)argtable[15]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    return result;");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_Dynacall ){
          fprintf(FP_OUTPUT,"%s\n","INT_PTR BCX_DynaCallB(PCTSTR FuncName, PCTSTR DllName, int nArgs, ...)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","    HINSTANCE hInst = 0;");
          fprintf(FP_OUTPUT,"%s\n","    FARPROC lpFunc = 0;");
          fprintf(FP_OUTPUT,"%s\n","    INT_PTR result = 0;");
          fprintf(FP_OUTPUT,"%s\n","    DWORD_PTR *argtable = NULL;  // Changed to DWORD_PTR to handle all pointer types");
          fprintf(FP_OUTPUT,"%s\n","    char buff[256];");
          fprintf(FP_OUTPUT,"%s\n","    va_list ap;");
          fprintf(FP_OUTPUT,"%s\n","    int i;");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Validate argument count");
          fprintf(FP_OUTPUT,"%s\n","    if (nArgs < 0 || nArgs > 16) {");
          fprintf(FP_OUTPUT,"%s\n","        return 0;");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Load the DLL");
          fprintf(FP_OUTPUT,"%s\n","    hInst = GetModuleHandle(DllName);");
          fprintf(FP_OUTPUT,"%s\n","    if (hInst == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","        hInst = BCX_LoadDll(DllName);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    if (hInst == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","        return 0;");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Find the function");
          fprintf(FP_OUTPUT,"%s\n","    lpFunc = GetProcAddress(hInst, FuncName);");
          fprintf(FP_OUTPUT,"%s\n","    if (lpFunc == NULL) {");
          fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        sprintf(buff, ",enc("%s%s"),", FuncName, ",enc("A"),");");
          fprintf(FP_OUTPUT,"%s\n","        lpFunc = GetProcAddress(hInst, buff);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    if (lpFunc == NULL) {");
          fprintf(FP_OUTPUT,"%s%s%s\n","        sprintf(buff, ",enc("_%s"),", FuncName);");
          fprintf(FP_OUTPUT,"%s\n","        lpFunc = GetProcAddress(hInst, buff);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    if (lpFunc == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","        return 0;");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Allocate argument table");
          fprintf(FP_OUTPUT,"%s\n","    if (nArgs > 0) {");
          fprintf(FP_OUTPUT,"%s\n","        argtable = (DWORD_PTR*)malloc(nArgs * sizeof(DWORD_PTR));");
          fprintf(FP_OUTPUT,"%s\n","        if (argtable == NULL) {");
          fprintf(FP_OUTPUT,"%s\n","            return 0;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        ");
          fprintf(FP_OUTPUT,"%s\n","        va_start(ap, nArgs);");
          fprintf(FP_OUTPUT,"%s\n","        for (i = 0; i < nArgs; i++) {");
          fprintf(FP_OUTPUT,"%s\n","            // Use DWORD_PTR to properly handle all pointer types including function pointers");
          fprintf(FP_OUTPUT,"%s\n","            argtable[i] = va_arg(ap, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        va_end(ap);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    // Call the function with properly typed function pointers");
          fprintf(FP_OUTPUT,"%s\n","    // Using DWORD_PTR instead of INT_PTR to match Windows API conventions");
          fprintf(FP_OUTPUT,"%s\n","    switch (nArgs) {");
          fprintf(FP_OUTPUT,"%s\n","        case 0: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func0)();");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func0)lpFunc)();");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 1: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func1)(DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func1)lpFunc)(argtable[0]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 2: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func2)(DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func2)lpFunc)(argtable[0], argtable[1]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 3: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func3)(DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func3)lpFunc)(argtable[0], argtable[1], argtable[2]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 4: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func4)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func4)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 5: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func5)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func5)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                              argtable[4]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 6: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func6)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func6)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                              argtable[4], argtable[5]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 7: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func7)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func7)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                              argtable[4], argtable[5], argtable[6]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 8: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func8)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func8)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                              argtable[4], argtable[5], argtable[6], argtable[7]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 9: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func9)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func9)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                              argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                              argtable[8]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 10: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func10)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func10)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 11: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func11)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func11)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9], argtable[10]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 12: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func12)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func12)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9], argtable[10], argtable[11]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 13: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func13)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func13)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9], argtable[10], argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[12]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 14: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func14)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func14)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9], argtable[10], argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[12], argtable[13]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 15: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func15)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func15)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9], argtable[10], argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[12], argtable[13], argtable[14]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","        case 16: {");
          fprintf(FP_OUTPUT,"%s\n","            typedef DWORD_PTR (WINAPI *Func16)(DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD_PTR);");
          fprintf(FP_OUTPUT,"%s\n","            result = (INT_PTR)((Func16)lpFunc)(argtable[0], argtable[1], argtable[2], argtable[3], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[4], argtable[5], argtable[6], argtable[7], ");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[8], argtable[9], argtable[10], argtable[11],");
          fprintf(FP_OUTPUT,"%s\n","                                               argtable[12], argtable[13], argtable[14], argtable[15]);");
          fprintf(FP_OUTPUT,"%s\n","            break;");
          fprintf(FP_OUTPUT,"%s\n","        }");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    if (argtable) {");
          fprintf(FP_OUTPUT,"%s\n","        free(argtable);");
          fprintf(FP_OUTPUT,"%s\n","    }");
          fprintf(FP_OUTPUT,"%s\n","    ");
          fprintf(FP_OUTPUT,"%s\n","    return result;");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
    }
}

void Emit_RT_StringCore (FILE* FP_OUTPUT)
{
  if(Use_BcxTempStr ){
      fprintf(FP_OUTPUT,"%s\n","char *BCX_TempStr(size_t iBytes)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static int StrCnt;");
      fprintf(FP_OUTPUT,"%s\n","  static char *StrFunc[2048];");
      fprintf(FP_OUTPUT,"%s\n","  static CRITICAL_SECTION cs;");
      fprintf(FP_OUTPUT,"%s\n","  static LONG initialized = 0;");
      fprintf(FP_OUTPUT,"%s\n","  // Thread-safe one-time initialization");
      fprintf(FP_OUTPUT,"%s\n","  if (InterlockedCompareExchange(&initialized, 1, 0) == 0) {");
      fprintf(FP_OUTPUT,"%s\n","      InitializeCriticalSection(&cs);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  // Allocating memory before locking reduces lock duration and blocking.");
      fprintf(FP_OUTPUT,"%s\n","  char *newStr = (char *)calloc(iBytes + 1, sizeof(char));");
      fprintf(FP_OUTPUT,"%s\n","  if (!newStr) return NULL;");
      fprintf(FP_OUTPUT,"%s\n","  EnterCriticalSection(&cs);");
      fprintf(FP_OUTPUT,"%s\n","      StrCnt = (StrCnt + 1) & 2047;");
      fprintf(FP_OUTPUT,"%s\n","      if (StrFunc[StrCnt]) {");
      fprintf(FP_OUTPUT,"%s\n","        free(StrFunc[StrCnt]);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      StrFunc[StrCnt] = newStr;");
      fprintf(FP_OUTPUT,"%s\n","  LeaveCriticalSection(&cs);");
      fprintf(FP_OUTPUT,"%s\n","  return StrFunc[StrCnt];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Left ){
      fprintf(FP_OUTPUT,"%s\n","char *left (PCTSTR szSrc, int length)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  size_t tmplen = strlen(szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  if (length < 1) return BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","  if (length < (int)tmplen) tmplen = length;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(tmplen);");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)memcpy(strtmp, szSrc, tmplen);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Right ){
      fprintf(FP_OUTPUT,"%s\n","char *right (PCTSTR szSrc, int length)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  size_t tmplen = strlen(szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  if (length < 1) return BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","  if ((size_t)length >= tmplen) return strcpy(BCX_TempStr(tmplen), szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  return strcpy(BCX_TempStr(length), szSrc + (tmplen - length));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cpad ){
      fprintf(FP_OUTPUT,"%s\n","char *cpad (PCTSTR szStr, int i_Max, int c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char  fill[2]={0}; fill[0] = (char) c;");
      fprintf(FP_OUTPUT,"%s\n","  char *szTmp = BCX_TempStr(i_Max);");
      fprintf(FP_OUTPUT,"%s\n","  size_t Half = (i_Max/2) + (strlen(szStr)/2);");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(szTmp, szStr);");
      fprintf(FP_OUTPUT,"%s\n","  while((int)strlen(szTmp) < (int)Half)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(szTmp, join(2, fill, szTmp));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while((int)strlen(szTmp)<i_Max)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    strcat(szTmp, fill);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  szTmp[i_Max] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return szTmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Rpad ){
      fprintf(FP_OUTPUT,"%s\n","char *rpad (PCTSTR szStr, int L, int c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp;");
      fprintf(FP_OUTPUT,"%s\n","  int s = (int)strlen(szStr);");
      fprintf(FP_OUTPUT,"%s\n","  if ((L-s) < 1) return (char*)szStr;");
      fprintf(FP_OUTPUT,"%s\n","  strtmp = BCX_TempStr(strlen(szStr)+L);");
      fprintf(FP_OUTPUT,"%s\n","  strcpy (strtmp, szStr);");
      fprintf(FP_OUTPUT,"%s\n","  memset (&strtmp[s], c, (L-s));");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Lpad ){
      fprintf(FP_OUTPUT,"%s\n","char *lpad (PCTSTR szStr, int L, int c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp;");
      fprintf(FP_OUTPUT,"%s\n","  int s = L-(int)strlen(szStr);");
      fprintf(FP_OUTPUT,"%s\n","  if (s < 1) return (char*)szStr;");
      fprintf(FP_OUTPUT,"%s\n","  strtmp = BCX_TempStr(L);");
      fprintf(FP_OUTPUT,"%s\n","  memset (strtmp, c, s);");
      fprintf(FP_OUTPUT,"%s\n","  return strcat(strtmp, szStr);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mid ){
      fprintf(FP_OUTPUT,"%s\n","char *mid (PCTSTR szSrc, int start, int length)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp;");
      fprintf(FP_OUTPUT,"%s\n","  int tmplen = (int)strlen(szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  if (start > tmplen||start < 1) return BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","  if (length < 0 || length > (tmplen-start) + 1)");
      fprintf(FP_OUTPUT,"%s\n","    length = (tmplen-start) + 1;");
      fprintf(FP_OUTPUT,"%s\n","  strtmp = BCX_TempStr(length);");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)memcpy(strtmp, &szSrc[start - 1], length);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Trim ){
      fprintf(FP_OUTPUT,"%s\n","char *trim (PCTSTR szSrc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == szSrc[0]) return (char*)szSrc;");
      fprintf(FP_OUTPUT,"%s\n","  while(*szSrc == 32 || (*szSrc >= 9 && *szSrc <= 13)) szSrc++;");
      fprintf(FP_OUTPUT,"%s\n","  size_t i = strlen(szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  while(i > 0 && (szSrc[i-1] == 32 || (szSrc[i-1] >= 9 && szSrc[i-1] <= 13))) i--;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(i);");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)memcpy(strtmp, szSrc, i);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Ltrim ){
      fprintf(FP_OUTPUT,"%s\n","char *ltrim (PCTSTR szSrc, char c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == szSrc[0]) return (char*) szSrc;");
      fprintf(FP_OUTPUT,"%s\n","  while(*szSrc==32 || (*szSrc >= 9 && *szSrc <= 13) || *szSrc == c) szSrc++;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(strlen(szSrc));");
      fprintf(FP_OUTPUT,"%s\n","  return strcpy(strtmp, szSrc);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Rtrim ){
      fprintf(FP_OUTPUT,"%s\n","char *rtrim (PCTSTR szSrc, char c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == szSrc[0]) return (char*)szSrc;");
      fprintf(FP_OUTPUT,"%s\n","  size_t i = strlen(szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  while(i > 0 && (szSrc[i-1]==32 || (szSrc[i-1]>=9 && szSrc[i-1]<=13) || szSrc[i-1]==c)) i--;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(i);");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)memcpy(strtmp, szSrc, i);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strim ){
      fprintf(FP_OUTPUT,"%s\n","char *strim (PCTSTR szSrc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == szSrc[0]) return (char*) szSrc;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(strlen(szSrc));");
      fprintf(FP_OUTPUT,"%s\n","  char *dst = strtmp;");
      fprintf(FP_OUTPUT,"%s\n","  while (isspace((unsigned char)*szSrc)) szSrc++;");
      fprintf(FP_OUTPUT,"%s\n","  do");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    while (*szSrc && !isspace((unsigned char)*szSrc)) *dst++ = *szSrc++;");
      fprintf(FP_OUTPUT,"%s\n","    if (*szSrc)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      *dst++ = *szSrc++;");
      fprintf(FP_OUTPUT,"%s\n","      while (isspace((unsigned char)*szSrc)) szSrc++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while (*szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  if (isspace((unsigned char)*(--dst))) *dst = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Command ){
      fprintf(FP_OUTPUT,"%s\n","char *command (int nArg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ii = 0;");
      fprintf(FP_OUTPUT,"%s\n","  char *c = NULL, *retstr, *s = GetCommandLine();");
      fprintf(FP_OUTPUT,"%s\n","  if (nArg < ii) // return entire commandline");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    while(*s && *s != 32)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (*s == 34) while(*++s && *s != 34);");
      fprintf(FP_OUTPUT,"%s\n","      s++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    while(isspace((unsigned char)*s))s++;");
      fprintf(FP_OUTPUT,"%s\n","    retstr = BCX_TempStr(strlen(s)+1);");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(retstr, s);");
      fprintf(FP_OUTPUT,"%s\n","    if (*(retstr + strlen(retstr)-1)==20) *retstr=0;");
      fprintf(FP_OUTPUT,"%s\n","    return retstr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while(ii <= nArg)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    while(isspace((unsigned char)*s)) s++; // skip whitespace");
      fprintf(FP_OUTPUT,"%s\n","    c = s;");
      fprintf(FP_OUTPUT,"%s\n","    if (*s == 34) {              // argument starts a quote");
      fprintf(FP_OUTPUT,"%s\n","      while(*++s && *s != 34)    // skip until next quote");
      fprintf(FP_OUTPUT,"%s\n","        ;                        // Do NOT remove this semicolon");
      fprintf(FP_OUTPUT,"%s\n","      if (*s) s++;               // skip quote itself");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      while(*s && *s != 32) s++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    ii++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (*c == 34)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    c++;                       // skip leading quote");
      fprintf(FP_OUTPUT,"%s\n","    if (*(s-1) == 34) s--;     // skip any trailing quotes");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  retstr = BCX_TempStr((int)(s - c) + 1);");
      fprintf(FP_OUTPUT,"%s\n","  strncpy(retstr, c,(int)(s - c));");
      fprintf(FP_OUTPUT,"%s\n","  retstr[s-c]=0;");
      fprintf(FP_OUTPUT,"%s\n","  return retstr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Extract ){
      fprintf(FP_OUTPUT,"%s\n","char *extract (PCTSTR strSrc, PCTSTR strPattern)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR szMatch;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(strlen(strSrc));");
      fprintf(FP_OUTPUT,"%s\n","  if (*strPattern != 0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    szMatch = strstr(strSrc, strPattern);");
      fprintf(FP_OUTPUT,"%s\n","    if (szMatch) return (char*)memcpy(strtmp, strSrc, szMatch-strSrc);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return strcpy(strtmp, strSrc);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ExtractAny ){
      fprintf(FP_OUTPUT,"%s\n","char *extractany(PCTSTR strSrc, PCTSTR strPattern)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp;");
      fprintf(FP_OUTPUT,"%s\n","   int i, j;");
      fprintf(FP_OUTPUT,"%s\n","   int nLenSrc = (int)strlen(strSrc);");
      fprintf(FP_OUTPUT,"%s\n","   int nLenPat = (int)strlen(strPattern);");
      fprintf(FP_OUTPUT,"%s\n","   for (i = 0; i < nLenSrc; ++i)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       for (j = 0; j < nLenPat; ++j)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           if (strSrc[i] == strPattern[j])");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               strtmp = BCX_TempStr(i);");
      fprintf(FP_OUTPUT,"%s\n","               return (char *)memcpy(strtmp, strSrc, i);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   strtmp = BCX_TempStr(nLenSrc);");
      fprintf(FP_OUTPUT,"%s\n","   return strcpy(strtmp, strSrc);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Remain ){
      fprintf(FP_OUTPUT,"%s\n","char *remain (PCTSTR strSrc, PCTSTR strPattern)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR p = strstr(strSrc, strPattern);");
      fprintf(FP_OUTPUT,"%s\n","  if (p)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    p += (strlen(strPattern));");
      fprintf(FP_OUTPUT,"%s\n","    return (char*)p;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)strSrc;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_RemainAny ){
      fprintf(FP_OUTPUT,"%s\n","char* remainany (PCTSTR strSrc, PCTSTR strPattern)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR p = strSrc;");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR found = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  size_t minPos = strlen(strSrc);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Search for each character in strPattern");
      fprintf(FP_OUTPUT,"%s\n","  while (*strPattern)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      PCTSTR temp = strchr(p, *strPattern);");
      fprintf(FP_OUTPUT,"%s\n","      if (temp && (temp - strSrc) < minPos)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          minPos = temp - strSrc;");
      fprintf(FP_OUTPUT,"%s\n","          found = temp;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      strPattern++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // If any character was found, return string after first match");
      fprintf(FP_OUTPUT,"%s\n","    if (found)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        return (char*)(found + 1);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // No match found, return first argument");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)strSrc;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Replace ){
      fprintf(FP_OUTPUT,"%s\n","char *replace(PCTSTR szMain, PCTSTR szFind, PCTSTR szRepl)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   size_t LenPat, LenRep, iTmp, iChange;");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp, *cp_p, *cp_q, *cp_r;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (!szFind || !*szFind)");
      fprintf(FP_OUTPUT,"%s\n","      return (char*) szMain;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   LenRep = strlen(szRepl);");
      fprintf(FP_OUTPUT,"%s\n","   LenPat = strlen(szFind);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   for (iTmp = 0, cp_p = (char*)szMain; (cp_q = strstr(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)");
      fprintf(FP_OUTPUT,"%s\n","      iTmp += (int)(cp_q - cp_p) + LenRep;");
      fprintf(FP_OUTPUT,"%s\n","   iTmp += strlen(cp_p);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   strtmp = BCX_TempStr(iTmp);");
      fprintf(FP_OUTPUT,"%s\n","   if (!strtmp)");
      fprintf(FP_OUTPUT,"%s\n","      return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   for (cp_r = strtmp, cp_p = (char*)szMain; (cp_q = strstr(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","      iChange = (int)(cp_q - cp_p);");
      fprintf(FP_OUTPUT,"%s\n","      memcpy(cp_r, cp_p, iChange);");
      fprintf(FP_OUTPUT,"%s\n","      cp_r += iChange;");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(cp_r, szRepl);");
      fprintf(FP_OUTPUT,"%s\n","      cp_r += LenRep;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(cp_r, cp_p);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_iReplace ){
      fprintf(FP_OUTPUT,"%s\n","char *iReplace(PCTSTR szMain, PCTSTR szFind, PCTSTR szRepl)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   size_t LenPat, LenRep, tmpsz, iChange;");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp, *cp_p, *cp_q, *cp_r;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (!szFind || !*szFind)");
      fprintf(FP_OUTPUT,"%s\n","      return (char*)szMain;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   LenRep = (int)strlen(szRepl);");
      fprintf(FP_OUTPUT,"%s\n","   LenPat = (int)strlen(szFind);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   for (tmpsz = 0, cp_p = (char*)szMain; (cp_q = _stristr_(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)");
      fprintf(FP_OUTPUT,"%s\n","      tmpsz += (int)(cp_q - cp_p) + LenRep;");
      fprintf(FP_OUTPUT,"%s\n","   tmpsz += strlen(cp_p);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   strtmp = BCX_TempStr(tmpsz);");
      fprintf(FP_OUTPUT,"%s\n","   if (!strtmp)");
      fprintf(FP_OUTPUT,"%s\n","      return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   for (cp_r = strtmp, cp_p = (char*)szMain; (cp_q = _stristr_(cp_p, (char*)szFind)) != 0; cp_p = cp_q + LenPat)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","      iChange = (int)(cp_q - cp_p);");
      fprintf(FP_OUTPUT,"%s\n","      memcpy(cp_r, cp_p, iChange);");
      fprintf(FP_OUTPUT,"%s\n","      cp_r += iChange;");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(cp_r, (char*)szRepl);");
      fprintf(FP_OUTPUT,"%s\n","      cp_r += LenRep;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(cp_r, cp_p);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ReplaceAny ){
      fprintf(FP_OUTPUT,"%s\n","char *ReplaceAny(PCTSTR sMainString, PCTSTR sMatchPattern, PCTSTR sReplaceWith)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","   char CopyMain[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","   int nLenMain    = (int)strlen(sMainString);");
      fprintf(FP_OUTPUT,"%s\n","   int nLenMatch   = (int)strlen(sMatchPattern);");
      fprintf(FP_OUTPUT,"%s\n","   int nLenReplace = (int)strlen(sReplaceWith);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (nLenMain == 0 || nLenMatch == 0 || nLenReplace == 0) {");
      fprintf(FP_OUTPUT,"%s\n","       return (PCHAR)sMainString;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   strcpy(CopyMain, sMainString);");
      fprintf(FP_OUTPUT,"%s\n","   for (int i = 0; i < nLenMain; i++) {");
      fprintf(FP_OUTPUT,"%s\n","       for (int y = 0; y < nLenMatch; y++) {");
      fprintf(FP_OUTPUT,"%s\n","           if (CopyMain[i] == sMatchPattern[y]) {");
      fprintf(FP_OUTPUT,"%s\n","               // If lengths are different, use first suitable replacement");
      fprintf(FP_OUTPUT,"%s\n","               if (y < nLenReplace) {");
      fprintf(FP_OUTPUT,"%s\n","                   CopyMain[i] = sReplaceWith[y];");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               break;  // Exit inner loop when match found");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   BCX_RetStr = BCX_TempStr(strlen(CopyMain));");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(BCX_RetStr, CopyMain);");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IReplaceAny ){
      fprintf(FP_OUTPUT,"%s\n","char *IReplaceAny(PCTSTR sMainString, PCTSTR sMatchPattern, PCTSTR sReplaceWith)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","   char CopyMain[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","   int nLenMain    = (int)strlen(sMainString);");
      fprintf(FP_OUTPUT,"%s\n","   int nLenMatch   = (int)strlen(sMatchPattern);");
      fprintf(FP_OUTPUT,"%s\n","   int nLenReplace = (int)strlen(sReplaceWith);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (nLenMain == 0 || nLenMatch == 0 || nLenReplace == 0) {");
      fprintf(FP_OUTPUT,"%s\n","       return (PCHAR)sMainString;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   strcpy(CopyMain, sMainString);");
      fprintf(FP_OUTPUT,"%s\n","   for (int i = 0; i < nLenMain; i++) {");
      fprintf(FP_OUTPUT,"%s\n","       for (int y = 0; y < nLenMatch; y++) {");
      fprintf(FP_OUTPUT,"%s\n","           if ((CopyMain[i] | 32) == (sMatchPattern[y] | 32)) {");
      fprintf(FP_OUTPUT,"%s\n","               // If lengths are different, use first suitable replacement");
      fprintf(FP_OUTPUT,"%s\n","               if (y < nLenReplace) {");
      fprintf(FP_OUTPUT,"%s\n","                   CopyMain[i] = sReplaceWith[y];");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               break;  // Exit inner loop when match found");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   BCX_RetStr = BCX_TempStr(strlen(CopyMain));");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(BCX_RetStr, CopyMain);");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_RemoveAny ){
      fprintf(FP_OUTPUT,"%s\n","char *RemoveAny (PCTSTR MainStr, PCTSTR CharsToRemove)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","   char ResultStr[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","   int i = 0;");
      fprintf(FP_OUTPUT,"%s\n","   int j = 0;");
      fprintf(FP_OUTPUT,"%s\n","   int MainLen  = (int)strlen(MainStr);");
      fprintf(FP_OUTPUT,"%s\n","   int CharsLen = (int)strlen(CharsToRemove);");
      fprintf(FP_OUTPUT,"%s\n","   int CharToRemoveFlag[255]={0};");
      fprintf(FP_OUTPUT,"%s\n","   int ResultLen = 0;");
      fprintf(FP_OUTPUT,"%s\n","   // Set flags for characters to be removed");
      fprintf(FP_OUTPUT,"%s\n","   for (j = 0; j < CharsLen; j++) {");
      fprintf(FP_OUTPUT,"%s\n","       CharToRemoveFlag[(unsigned char)CharsToRemove[j]] = 1;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   for (i = 0; i < MainLen; i++) {");
      fprintf(FP_OUTPUT,"%s\n","       if (CharToRemoveFlag[(unsigned char)MainStr[i]] == 0) {");
      fprintf(FP_OUTPUT,"%s\n","           ResultStr[ResultLen++] = MainStr[i];");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   ResultStr[ResultLen] = 0; // Null-terminate");
      fprintf(FP_OUTPUT,"%s\n","   BCX_RetStr = BCX_TempStr(ResultLen);");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(BCX_RetStr, ResultStr);");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IRemoveAny ){
      fprintf(FP_OUTPUT,"%s\n","char *IRemoveAny (PCTSTR MainStr, PCTSTR CharsToRemove)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","   char ResultStr[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","   int i = 0;");
      fprintf(FP_OUTPUT,"%s\n","   int j = 0;");
      fprintf(FP_OUTPUT,"%s\n","   int MainLen  = (int) strlen(MainStr);");
      fprintf(FP_OUTPUT,"%s\n","   int CharsLen = (int) strlen(CharsToRemove);");
      fprintf(FP_OUTPUT,"%s\n","   int CharToRemoveFlag[255]={0};");
      fprintf(FP_OUTPUT,"%s\n","   int ResultLen = 0;");
      fprintf(FP_OUTPUT,"%s\n","   // Set flags for characters to be removed");
      fprintf(FP_OUTPUT,"%s\n","   for (j = 0; j < CharsLen; j++) {");
      fprintf(FP_OUTPUT,"%s\n","       CharToRemoveFlag[tolower((unsigned char)CharsToRemove[j])] = 1;");
      fprintf(FP_OUTPUT,"%s\n","       CharToRemoveFlag[toupper((unsigned char)CharsToRemove[j])] = 1;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   for (i = 0; i < MainLen; i++) {");
      fprintf(FP_OUTPUT,"%s\n","       if (CharToRemoveFlag[(unsigned char)MainStr[i]] == 0) {");
      fprintf(FP_OUTPUT,"%s\n","           ResultStr[ResultLen++] = MainStr[i];");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   ResultStr[ResultLen] = 0; // Null-terminate");
      fprintf(FP_OUTPUT,"%s\n","   BCX_RetStr = BCX_TempStr(ResultLen);");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(BCX_RetStr, ResultStr);");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_StringUtils (FILE* FP_OUTPUT)
{
  if(Use_Sleep ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Sleep (int Milliseconds)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static UINT Initialized;");
      fprintf(FP_OUTPUT,"%s\n","  static UINT OriginalPeriod;");
      fprintf(FP_OUTPUT,"%s\n","  static UINT CallCount;");
      fprintf(FP_OUTPUT,"%s\n","  // If called with 0, explicitly reset timer resolution and exit");
      fprintf(FP_OUTPUT,"%s\n","  if(Milliseconds <= 0 || CallCount >=65535){");
      fprintf(FP_OUTPUT,"%s\n","      if(Initialized){");
      fprintf(FP_OUTPUT,"%s\n","          timeEndPeriod(OriginalPeriod);");
      fprintf(FP_OUTPUT,"%s\n","          Initialized = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      return;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  // Set timer resolution to 1 ms if not already initialized");
      fprintf(FP_OUTPUT,"%s\n","  if(!Initialized){");
      fprintf(FP_OUTPUT,"%s\n","      TIMECAPS  tMinRes;");
      fprintf(FP_OUTPUT,"%s\n","      timeGetDevCaps(&tMinRes,sizeof(TIMECAPS));");
      fprintf(FP_OUTPUT,"%s\n","      OriginalPeriod = tMinRes.wPeriodMin;");
      fprintf(FP_OUTPUT,"%s\n","      timeBeginPeriod(OriginalPeriod); // Typically sets to 1 ms");
      fprintf(FP_OUTPUT,"%s\n","      Initialized = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  Sleep(Milliseconds);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Reverse ){
      fprintf(FP_OUTPUT,"%s\n","char *reverse (PCTSTR szStr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  size_t j = strlen(szStr);");
      fprintf(FP_OUTPUT,"%s\n","  char *rstr = BCX_TempStr(j);");
      fprintf(FP_OUTPUT,"%s\n","  while(j)  rstr[--j] = *(szStr++);");
      fprintf(FP_OUTPUT,"%s\n","  return rstr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Findfirst ){
      fprintf(FP_OUTPUT,"%s\n","char *findfirst (PCTSTR szSrc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  if (fffn_FileHandle) FindClose(fffn_FileHandle);");
      fprintf(FP_OUTPUT,"%s\n","  fffn_FileHandle = FindFirstFile(szSrc, &fffn_FindData);");
      fprintf(FP_OUTPUT,"%s\n","  if (fffn_FileHandle != INVALID_HANDLE_VALUE)");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(strtmp, fffn_FindData.cFileName);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    fffn_FileHandle = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Findnext ){
      fprintf(FP_OUTPUT,"%s\n","char *findnext (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  if (fffn_FileHandle)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    int Found = FindNextFile(fffn_FileHandle, &fffn_FindData);");
      fprintf(FP_OUTPUT,"%s\n","    if (Found)");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(strtmp, fffn_FindData.cFileName);");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      FindClose(fffn_FileHandle);");
      fprintf(FP_OUTPUT,"%s\n","      fffn_FileHandle = 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Lookahead ){
      fprintf(FP_OUTPUT,"%s\n","char *LookAhead(FILE *FilePointer, int NumLines) {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    char *EmptyStr = ",enc(""),";");
      fprintf(FP_OUTPUT,"%s\n","    char *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    fpos_t CurrentPosition;");
      fprintf(FP_OUTPUT,"%s\n","    char FetchLine[BCXSTRSIZE] = {0};");
      fprintf(FP_OUTPUT,"%s\n","    int Counter;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Validate inputs");
      fprintf(FP_OUTPUT,"%s\n","    if (FilePointer == NULL || NumLines <= 0 || ferror(FilePointer)) {");
      fprintf(FP_OUTPUT,"%s\n","        BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","        if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);");
      fprintf(FP_OUTPUT,"%s\n","        return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Save current file position");
      fprintf(FP_OUTPUT,"%s\n","    if (fgetpos(FilePointer, &CurrentPosition) != 0) {");
      fprintf(FP_OUTPUT,"%s\n","        BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","        if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);");
      fprintf(FP_OUTPUT,"%s\n","        return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Read lines");
      fprintf(FP_OUTPUT,"%s\n","    for (Counter = 1; Counter <= NumLines; Counter++) {");
      fprintf(FP_OUTPUT,"%s\n","        FetchLine[0] = '\\0';");
      fprintf(FP_OUTPUT,"%s\n","        if (fgets(FetchLine, BCXSTRSIZE, FilePointer) == NULL) {");
      fprintf(FP_OUTPUT,"%s\n","            fsetpos(FilePointer, &CurrentPosition); // Restore position");
      fprintf(FP_OUTPUT,"%s\n","            BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","            if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);");
      fprintf(FP_OUTPUT,"%s\n","            return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Remove newline characters");
      fprintf(FP_OUTPUT,"%s%s%s\n","    FetchLine[strcspn(FetchLine, ",enc("\\r\\n"),")] = '\\0';");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Restore file position");
      fprintf(FP_OUTPUT,"%s\n","    fsetpos(FilePointer, &CurrentPosition);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Allocate and copy the result");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(strlen(FetchLine));");
      fprintf(FP_OUTPUT,"%s\n","    if (BCX_RetStr) {");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(BCX_RetStr, FetchLine);");
      fprintf(FP_OUTPUT,"%s\n","    } else {");
      fprintf(FP_OUTPUT,"%s\n","        BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","        if (BCX_RetStr) strcpy(BCX_RetStr, EmptyStr);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Ucase ){
      fprintf(FP_OUTPUT,"%s\n","char *ucase (PCTSTR szStr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return CharUpperA(strcpy(BCX_TempStr(strlen(szStr)), szStr));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Lcase ){
      fprintf(FP_OUTPUT,"%s\n","char *lcase (PCTSTR szStr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return CharLowerA(strcpy(BCX_TempStr(strlen(szStr)), szStr));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mcase ){
      fprintf(FP_OUTPUT,"%s\n","char *mcase (PCTSTR szStr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(strlen(szStr)+1);");
      fprintf(FP_OUTPUT,"%s\n","  char *s = strtmp;");
      fprintf(FP_OUTPUT,"%s\n","  CharLowerA(strcpy(strtmp, szStr));");
      fprintf(FP_OUTPUT,"%s\n","  while(*s)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (islower(*s))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      *s-=32;");
      fprintf(FP_OUTPUT,"%s\n","      while(isalpha(*++s));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    s++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Remove ){
      fprintf(FP_OUTPUT,"%s\n","char *RemoveStr (PCTSTR szSrc, PCTSTR RemoveMe)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp, *pp, *dd;");
      fprintf(FP_OUTPUT,"%s\n","  int  tmplen;");
      fprintf(FP_OUTPUT,"%s\n","  strtmp = dd = BCX_TempStr(strlen(szSrc));");
      fprintf(FP_OUTPUT,"%s\n","  if ((!RemoveMe) || (!*RemoveMe)) return strcpy(strtmp, szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  pp = strstr((char*)szSrc, (char*)RemoveMe); tmplen = (int)strlen(RemoveMe);");
      fprintf(FP_OUTPUT,"%s\n","  while (pp)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    memcpy (dd, szSrc, pp-szSrc);");
      fprintf(FP_OUTPUT,"%s\n","    dd+= (pp - szSrc);");
      fprintf(FP_OUTPUT,"%s\n","    szSrc = pp + tmplen;");
      fprintf(FP_OUTPUT,"%s\n","    pp = strstr((char*)szSrc,(char*)RemoveMe);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  strcpy (dd, (char*)szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IRemove ){
      fprintf(FP_OUTPUT,"%s\n","char *IRemoveStr (PCTSTR szSrc, PCTSTR RemoveMe)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp, *pp, *dd;");
      fprintf(FP_OUTPUT,"%s\n","  int  tmplen;");
      fprintf(FP_OUTPUT,"%s\n","  strtmp = dd = BCX_TempStr(strlen(szSrc));");
      fprintf(FP_OUTPUT,"%s\n","  if (!RemoveMe || !*RemoveMe) return strcpy(strtmp, szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  pp = _stristr_(szSrc, RemoveMe); tmplen = (int)strlen(RemoveMe);");
      fprintf(FP_OUTPUT,"%s\n","  while(pp)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    memcpy (dd, szSrc, pp-szSrc);");
      fprintf(FP_OUTPUT,"%s\n","    dd+= (pp - szSrc);");
      fprintf(FP_OUTPUT,"%s\n","    szSrc =  pp + tmplen;");
      fprintf(FP_OUTPUT,"%s\n","    pp = _stristr_(szSrc, RemoveMe);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  strcpy (dd, szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Ins ){
      fprintf(FP_OUTPUT,"%s\n","char *ins (PCTSTR szStr, int ii, PCTSTR a)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int j = (int)strlen(szStr);");
      fprintf(FP_OUTPUT,"%s\n","  if (ii<1 || ii > j+1) return (char*)szStr;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(j + strlen(a));");
      fprintf(FP_OUTPUT,"%s\n","  memcpy (strtmp, szStr, --ii);");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(&strtmp[ii], a);");
      fprintf(FP_OUTPUT,"%s\n","  return strcat(strtmp, &szStr[ii]);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Del ){
      fprintf(FP_OUTPUT,"%s\n","char *del (PCTSTR szStr, int ii, int j)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  size_t ln = strlen(szStr);");
      fprintf(FP_OUTPUT,"%s\n","  if (ii<1 || ii > ln) return (char*)szStr;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(ln);");
      fprintf(FP_OUTPUT,"%s\n","  memcpy (strtmp, szStr, --ii);");
      fprintf(FP_OUTPUT,"%s\n","  return strcat(strtmp, &szStr[ii+j]);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Chrtoutf8 ){
      fprintf(FP_OUTPUT,"%s\n","char *ChrToUtf8 (PCSTR szAnsi)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (!szAnsi || !*szAnsi)");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szAnsi;");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    // Convert ANSI to wide char (Unicode)");
      fprintf(FP_OUTPUT,"%s\n","    int wlen = MultiByteToWideChar(CP_ACP, 0, szAnsi, -1, NULL, 0);");
      fprintf(FP_OUTPUT,"%s\n","    if (wlen <= 0)");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szAnsi;");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    WCHAR *wsz = (WCHAR *)calloc(wlen, sizeof(WCHAR));");
      fprintf(FP_OUTPUT,"%s\n","    if (!wsz)");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szAnsi;");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_ACP, 0, szAnsi, -1, wsz, wlen);");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    // Convert wide char (Unicode) to UTF-8");
      fprintf(FP_OUTPUT,"%s\n","    int ulen = WideCharToMultiByte(CP_UTF8, 0, wsz, -1, NULL, 0, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    if (ulen <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","      free(wsz);");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szAnsi;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    char *utf8 = BCX_TempStr(ulen - 1);  // Exclude null terminator");
      fprintf(FP_OUTPUT,"%s\n","    WideCharToMultiByte(CP_UTF8, 0, wsz, -1, utf8, ulen, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    free(wsz);");
      fprintf(FP_OUTPUT,"%s\n","    return utf8;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Utf8tochr ){
      fprintf(FP_OUTPUT,"%s\n","char *UTF8toCHR (PCSTR szUtf8)");
      fprintf(FP_OUTPUT,"%s\n","  //*****************************************************************************************");
      fprintf(FP_OUTPUT,"%s\n","  // Uses MultiByteToWideChar to go from UTF-8 → Unicode.");
      fprintf(FP_OUTPUT,"%s\n","  // Uses WideCharToMultiByte to go from Unicode → ANSI (codepage CP_ACP).");
      fprintf(FP_OUTPUT,"%s\n","  // Allocates temp wide string with calloc (freed after use).");
      fprintf(FP_OUTPUT,"%s\n","  // Returns a temp ANSI string via BCX_TempStr() just like other BCX $ string functions.  ");
      fprintf(FP_OUTPUT,"%s\n","  //*****************************************************************************************");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (!szUtf8 || !*szUtf8)");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szUtf8;");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    // Convert UTF-8 to wide char (Unicode)");
      fprintf(FP_OUTPUT,"%s\n","    int wlen = MultiByteToWideChar(CP_UTF8, 0, szUtf8, -1, NULL, 0);");
      fprintf(FP_OUTPUT,"%s\n","    if (wlen <= 0)");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szUtf8;");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    WCHAR *wsz = (WCHAR *)calloc(wlen, sizeof(WCHAR));");
      fprintf(FP_OUTPUT,"%s\n","    if (!wsz)");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szUtf8;");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_UTF8, 0, szUtf8, -1, wsz, wlen);");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    // Convert wide char (Unicode) to ANSI");
      fprintf(FP_OUTPUT,"%s\n","    int alen = WideCharToMultiByte(CP_ACP, 0, wsz, -1, NULL, 0, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    if (alen <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","      free(wsz);");
      fprintf(FP_OUTPUT,"%s\n","      return (char *)szUtf8;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    char *ansi = BCX_TempStr(alen - 1);  // Don't include null terminator");
      fprintf(FP_OUTPUT,"%s\n","    WideCharToMultiByte(CP_ACP, 0, wsz, -1, ansi, alen, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","  ");
      fprintf(FP_OUTPUT,"%s\n","    free(wsz);");
      fprintf(FP_OUTPUT,"%s\n","    return ansi;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Str ){
      fprintf(FP_OUTPUT,"%s\n","char *BCX_Format_Double(double d_, int leading_space)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *s = BCX_TempStr(64);");
      fprintf(FP_OUTPUT,"%s\n","  if (leading_space)");
      fprintf(FP_OUTPUT,"%s%s%s\n","    snprintf(s, 64, ",enc("% .15f"),", d_);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s%s%s\n","    snprintf(s, 64, ",enc("%.15f"),", d_);");
      fprintf(FP_OUTPUT,"%s\n","  char *dot = strchr(s, '.');");
      fprintf(FP_OUTPUT,"%s\n","  if (dot) {");
      fprintf(FP_OUTPUT,"%s\n","    char *end = s + strlen(s) - 1;");
      fprintf(FP_OUTPUT,"%s\n","    while (end > dot && *end == '0') *end-- = 0;");
      fprintf(FP_OUTPUT,"%s\n","    if (end == dot) *end = 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return s;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","char *str(double d_, int nospc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_Format_Double(d_, !nospc);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strl ){
      fprintf(FP_OUTPUT,"%s\n","char *strl(long double d, int nospc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(64);");
      fprintf(FP_OUTPUT,"%s\n","  if (nospc)");
      fprintf(FP_OUTPUT,"%s%s%s\n","    snprintf (strtmp, 64, ",enc("%.19LG"),", d);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s%s%s\n","    snprintf (strtmp, 64, ",enc("% .19LG"),", d);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Curdir ){
      fprintf(FP_OUTPUT,"%s\n","char *curdir (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","  char *strtmp = BCX_TempStr(","BCXSTRSIZE",");");
      fprintf(FP_OUTPUT,"%s\n","  GetCurrentDirectory (BCXSTRSIZE-1, strtmp);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Hex ){
      fprintf(FP_OUTPUT,"%s\n","char *hex(uint64_t a, int len)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    if (len > 16) len = 16;");
      fprintf(FP_OUTPUT,"%s\n","    char *strtmp = BCX_TempStr(34);");
      fprintf(FP_OUTPUT,"%s\n","    char formatStr[8];");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (len > 0)");
      fprintf(FP_OUTPUT,"%s%s%s\n","        sprintf(formatStr, ",enc("%%0%dllX"),", len);");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s%s%s\n","        sprintf(formatStr, ",enc("%%llX"),");");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    sprintf(strtmp, formatStr, a);");
      fprintf(FP_OUTPUT,"%s\n","    return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Val ){
      fprintf(FP_OUTPUT,"%s\n","double val_func(PCTSTR s) {");
      fprintf(FP_OUTPUT,"%s\n","   if (!s) return 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // 1. Skip leading whitespace");
      fprintf(FP_OUTPUT,"%s\n","   while (*s == 32 || *s == 9 || *s == 10 || *s == 13) s++;");
      fprintf(FP_OUTPUT,"%s\n","   if (*s == 0) return 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // 2. Handle BASIC &H, &O, &B");
      fprintf(FP_OUTPUT,"%s\n","   if (*s == '&') {");
      fprintf(FP_OUTPUT,"%s\n","       s++;");
      fprintf(FP_OUTPUT,"%s\n","       int type = toupper((unsigned char)*s);");
      fprintf(FP_OUTPUT,"%s\n","       if (type) s++;");
      fprintf(FP_OUTPUT,"%s\n","       char *endptr;");
      fprintf(FP_OUTPUT,"%s\n","       if (type == 'H') return (double)strtoll(s, &endptr, 16);");
      fprintf(FP_OUTPUT,"%s\n","       if (type == 'O') return (double)strtoll(s, &endptr, 8);");
      fprintf(FP_OUTPUT,"%s\n","       if (type == 'B') return (double)strtoll(s, &endptr, 2);");
      fprintf(FP_OUTPUT,"%s\n","       return 0; ");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // 3. Handle C-style 0x Hex");
      fprintf(FP_OUTPUT,"%s\n","   if (*s == '0' && (toupper((unsigned char)*(s + 1)) == 'X')) {");
      fprintf(FP_OUTPUT,"%s\n","       char *endptr;");
      fprintf(FP_OUTPUT,"%s\n","       return (double)strtoll(s, &endptr, 16);");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // 4. Handle standard numbers (with internal whitespace stripping)");
      fprintf(FP_OUTPUT,"%s\n","   char buffer[256];");
      fprintf(FP_OUTPUT,"%s\n","   int j = 0;");
      fprintf(FP_OUTPUT,"%s\n","   int has_decimal = 0, has_exponent = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   while (*s && j < 254) {");
      fprintf(FP_OUTPUT,"%s\n","       if (*s == 32 || *s == 9) { s++; continue; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","       char c = *s;");
      fprintf(FP_OUTPUT,"%s\n","       if (isdigit((unsigned char)c) || c == '-' || c == '+') {");
      fprintf(FP_OUTPUT,"%s\n","           buffer[j++] = c;");
      fprintf(FP_OUTPUT,"%s\n","       } else if (c == '.' && !has_decimal && !has_exponent) {");
      fprintf(FP_OUTPUT,"%s\n","           buffer[j++] = c;");
      fprintf(FP_OUTPUT,"%s\n","           has_decimal = 1;");
      fprintf(FP_OUTPUT,"%s\n","       } else if (toupper((unsigned char)c) == 'E' && !has_exponent) {");
      fprintf(FP_OUTPUT,"%s\n","           buffer[j++] = 'E';");
      fprintf(FP_OUTPUT,"%s\n","           has_exponent = 1;");
      fprintf(FP_OUTPUT,"%s\n","           if (*(s + 1) == '-' || *(s + 1) == '+') buffer[j++] = *(++s);");
      fprintf(FP_OUTPUT,"%s\n","       } else {");
      fprintf(FP_OUTPUT,"%s\n","           break; ");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       s++;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   buffer[j] = 0;");
      fprintf(FP_OUTPUT,"%s\n","   return (j > 0) ? atof(buffer) : 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Tempdir ){
      fprintf(FP_OUTPUT,"%s\n","char *tempdir (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","   char *strtmp = BCX_TempStr(","BCXSTRSIZE",");");
      fprintf(FP_OUTPUT,"%s\n","   GetTempPath (BCXSTRSIZE-1, strtmp);");
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Windir ){
      fprintf(FP_OUTPUT,"%s\n","char *windir (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","   char *strtmp = BCX_TempStr(","BCXSTRSIZE",");");
      fprintf(FP_OUTPUT,"%s\n","   GetWindowsDirectory (strtmp, BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Sysdir ){
      fprintf(FP_OUTPUT,"%s\n","char *sysdir (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","   GetSystemDirectory (strtmp, BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Repeat ){
      fprintf(FP_OUTPUT,"%s\n","char *repeat(int count, PCTSTR szArg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   if (!szArg || count <= 0)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","      char *strtmp = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","      if (strtmp) *strtmp = 0;");
      fprintf(FP_OUTPUT,"%s\n","      return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   size_t len = strlen(szArg);");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp = BCX_TempStr((count * len) + 1);");
      fprintf(FP_OUTPUT,"%s\n","   char *p = strtmp;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   while (count-- > 0) {");
      fprintf(FP_OUTPUT,"%s\n","       memcpy(p, szArg, len);");
      fprintf(FP_OUTPUT,"%s\n","       p += len;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   *p = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_String ){
      fprintf(FP_OUTPUT,"%s\n","char *stringx (int count_, int szArg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   if (count_<1) return BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp = BCX_TempStr(count_);");
      fprintf(FP_OUTPUT,"%s\n","   return (char*)memset(strtmp, szArg, count_);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Space ){
      fprintf(FP_OUTPUT,"%s\n","char *space (int count)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   if (count<1) return BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp = BCX_TempStr(count);");
      fprintf(FP_OUTPUT,"%s\n","   return (char*)memset(strtmp, 32, count);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Time ){
      static char T0[BCXSTRSIZE];
      static char T1[BCXSTRSIZE];
      static char T2[BCXSTRSIZE];
      static char T3[BCXSTRSIZE];
      static char T4[BCXSTRSIZE];
      static char T5[BCXSTRSIZE];
      static char T6[BCXSTRSIZE];
      static char T7[BCXSTRSIZE];
      static char T8[BCXSTRSIZE];
      static char T9[BCXSTRSIZE];
      static char T10[BCXSTRSIZE];
      static char T11[BCXSTRSIZE];
      static char T12[BCXSTRSIZE];
      strcpy(T0,vchr(10,34,37,72,58,37,77,58,37,83,34));
      strcpy(T1,vchr(4,34,37,72,34));
      strcpy(T2,vchr(4,34,37,77,34));
      strcpy(T3,vchr(4,34,37,83,34));
      strcpy(T4,vchr(4,34,37,112,34));
      strcpy(T5,vchr(4,34,37,89,34));
      strcpy(T6,vchr(4,34,37,109,34));
      strcpy(T7,vchr(4,34,37,100,34));
      strcpy(T8,vchr(4,34,37,65,34));
      strcpy(T9,vchr(4,34,37,119,34));
      strcpy(T10,vchr(4,34,37,106,34));
      strcpy(T11,vchr(4,34,37,85,34));
      strcpy(T12,vchr(13,34,37,73,58,37,77,58,37,83,32,37,112,34));
      fprintf(FP_OUTPUT,"%s\n","char *timef (int t, int u)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   time_t elapse_time;");
      fprintf(FP_OUTPUT,"%s\n","   struct tm *tp;");
      fprintf(FP_OUTPUT,"%s\n","   char *strtmp = BCX_TempStr(256);");
      fprintf(FP_OUTPUT,"%s\n","   time (&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","   if (u==0)");
      fprintf(FP_OUTPUT,"%s\n","     tp = localtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","   else");
      fprintf(FP_OUTPUT,"%s\n","     tp = gmtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","   switch (t)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","   case 0:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T0,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 1:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T1,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 2:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T2,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 3:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T3,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 4:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T4,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 5:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T5,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 6:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T6,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 7:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T7,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 8:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T8,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 9:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T9,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 10:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T10,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 11:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T11,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   case 12:");
      fprintf(FP_OUTPUT,"%s%s%s\n","     strftime(strtmp, 256, ",T12,", tp); break;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Wrap ){
      fprintf(FP_OUTPUT,"%s\n","char *wrap (PCTSTR _a, PCTSTR _b, PCTSTR _c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","   char  Qt[2] = {34, 0};");
      fprintf(FP_OUTPUT,"%s\n","   BCX_RetStr = BCX_TempStr (strlen(_a)+strlen(_b)+strlen(_c)+3);");
      fprintf(FP_OUTPUT,"%s\n","   if (*_b==0 && *_c==0)");
      fprintf(FP_OUTPUT,"%s%s%s\n","     sprintf(BCX_RetStr,",enc("%s%s%s"),", Qt, _a, Qt);");
      fprintf(FP_OUTPUT,"%s\n","   else");
      fprintf(FP_OUTPUT,"%s%s%s\n","     sprintf(BCX_RetStr,",enc("%s%s%s"),", _b, _a, _c);");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Unwrap ){
      fprintf(FP_OUTPUT,"%s\n","char *unwrap (PCTSTR _a, PCTSTR _b, PCTSTR _c)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","   char  Qt[2] = {34,0};");
      fprintf(FP_OUTPUT,"%s\n","   BCX_RetStr = BCX_TempStr(strlen(_a));");
      fprintf(FP_OUTPUT,"%s\n","   strcpy(BCX_RetStr, _a);");
      fprintf(FP_OUTPUT,"%s\n","   if (0 == *_b && 0 == *_c)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","     if (strcmp(left(BCX_RetStr, 1), Qt)==0)");
      fprintf(FP_OUTPUT,"%s\n","       BCX_RetStr = BCX_RetStr + 1;");
      fprintf(FP_OUTPUT,"%s\n","     if (strcmp(right(BCX_RetStr, 1), Qt)==0)");
      fprintf(FP_OUTPUT,"%s\n","       BCX_RetStr[strlen(BCX_RetStr)-1]=0;");
      fprintf(FP_OUTPUT,"%s\n","     return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   if (strcmp(left(BCX_RetStr,  strlen(_b)), _b)==0)");
      fprintf(FP_OUTPUT,"%s\n","     BCX_RetStr = BCX_RetStr + strlen(_b);");
      fprintf(FP_OUTPUT,"%s\n","   if (strcmp(right(BCX_RetStr, strlen(_c)), _c)==0)");
      fprintf(FP_OUTPUT,"%s\n","     BCX_RetStr[strlen(BCX_RetStr)-strlen(_c)]=0;");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Enclose ){
      fprintf(FP_OUTPUT,"%s\n","char *enc (PCTSTR Arg_A, int L, int R)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  size_t tmplen = strlen(Arg_A);");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(tmplen+3);");
      fprintf(FP_OUTPUT,"%s\n","  memcpy(BCX_RetStr+1, Arg_A, tmplen);");
      fprintf(FP_OUTPUT,"%s\n","  *BCX_RetStr = (char)((L==0) ? 34 : L);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr[++tmplen] = (char)((R==0) ? *BCX_RetStr : R);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr[++tmplen] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_VChr ){
      fprintf(FP_OUTPUT,"%s\n","char *vchr(int charcount, ...)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int c = 0, ii = charcount;");
      fprintf(FP_OUTPUT,"%s\n","  char *s_ = BCX_TempStr(charcount + 1);");
      fprintf(FP_OUTPUT,"%s\n","  va_list marker;");
      fprintf(FP_OUTPUT,"%s\n","  s_[ii] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  va_start(marker, charcount);");
      fprintf(FP_OUTPUT,"%s\n","  while (ii-- > 0) s_[c++] = (char) va_arg(marker, int);");
      fprintf(FP_OUTPUT,"%s\n","  va_end(marker);");
      fprintf(FP_OUTPUT,"%s\n","  return s_;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Join ){
      fprintf(FP_OUTPUT,"%s\n","char *join(int ArgCount, PCTSTR Str1, ...)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  va_list  ap={0};");
      fprintf(FP_OUTPUT,"%s\n","  PSTR BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  PSTR currentStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  int i;");
      fprintf(FP_OUTPUT,"%s\n","  size_t totalLen;");
      fprintf(FP_OUTPUT,"%s\n","  totalLen = strlen(Str1);");
      fprintf(FP_OUTPUT,"%s\n","                                      //  Calc memory reqmnt");
      fprintf(FP_OUTPUT,"%s\n","  va_start(ap,Str1);");
      fprintf(FP_OUTPUT,"%s\n","  for(i=1; i<=ArgCount-1; i++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      currentStr = va_arg(ap,PSTR);");
      fprintf(FP_OUTPUT,"%s\n","      if(strlen(currentStr)>0) {");
      fprintf(FP_OUTPUT,"%s\n","          totalLen += (int)strlen(currentStr);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  va_end(ap);");
      fprintf(FP_OUTPUT,"%s\n","                                      //  Allocate memory");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr = BCX_TempStr(totalLen);");
      fprintf(FP_OUTPUT,"%s\n","  if(BCX_RetStr == 0) {");
      fprintf(FP_OUTPUT,"%s\n","      return NULL;                    //   Not a good sign :-(");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","                                      //   Init result with Str1");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(BCX_RetStr,Str1);");
      fprintf(FP_OUTPUT,"%s\n","                                      //   Concat remainiing strings");
      fprintf(FP_OUTPUT,"%s\n","  va_start(ap,Str1);");
      fprintf(FP_OUTPUT,"%s\n","  for(i=1; i<=ArgCount-1; i++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      currentStr = va_arg(ap,PSTR);");
      fprintf(FP_OUTPUT,"%s\n","      if((int)strlen(currentStr)>0) {");
      fprintf(FP_OUTPUT,"%s\n","          strcat(BCX_RetStr,currentStr);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  va_end(ap);");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Environ ){
      fprintf(FP_OUTPUT,"%s\n","char* Environ(PCTSTR szStr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp;");
      fprintf(FP_OUTPUT,"%s\n","  DWORD len;");
      fprintf(FP_OUTPUT,"%s\n","  len = GetEnvironmentVariable(szStr, NULL, 0);   // ask Windows for the real size first");
      fprintf(FP_OUTPUT,"%s\n","  if (len == 0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      strtmp = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","      *strtmp = 0;");
      fprintf(FP_OUTPUT,"%s\n","      return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  strtmp = BCX_TempStr(len);                      // request only what's actually needed");
      fprintf(FP_OUTPUT,"%s\n","  GetEnvironmentVariable(szStr, strtmp, len);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}");
    }
  if(Use_Oct ){
      fprintf(FP_OUTPUT,"%s\n","char *oct (int a)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  sprintf(strtmp, ",vchr(4,34,37,111,34),", a);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Bin ){
      fprintf(FP_OUTPUT,"%s\n","char* Bin(int number)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  _itoa(number, strtmp, 2);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Inkey ){
      fprintf(FP_OUTPUT,"%s\n","char* inkey(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(2);");
      fprintf(FP_OUTPUT,"%s\n","  if (_kbhit())");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    int asccodereturn = _getch();");
      fprintf(FP_OUTPUT,"%s\n","    strtmp[0] = asccodereturn;");
      fprintf(FP_OUTPUT,"%s\n","    strtmp[1] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mouse_sx ){
      fprintf(FP_OUTPUT,"%s\n","int MOUSEX_SCREEN (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  POINT pt={0};");
      fprintf(FP_OUTPUT,"%s\n","  GetCursorPos(&pt);");
      fprintf(FP_OUTPUT,"%s\n","  return pt.x;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mouse_sy ){
      fprintf(FP_OUTPUT,"%s\n","int MOUSEY_SCREEN (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  POINT pt={0};");
      fprintf(FP_OUTPUT,"%s\n","  GetCursorPos(&pt);");
      fprintf(FP_OUTPUT,"%s\n","  return pt.y;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mouse_cx ){
      fprintf(FP_OUTPUT,"%s\n","int MOUSEX_CLIENT (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int clientX={0};");
      fprintf(FP_OUTPUT,"%s\n","  POINT pt   ={0};");
      fprintf(FP_OUTPUT,"%s\n","  RECT rect  ={0};");
      fprintf(FP_OUTPUT,"%s\n","  GetCursorPos(&pt);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(GetForegroundWindow(), &rect);");
      fprintf(FP_OUTPUT,"%s\n","  clientX = pt.x - rect.left;");
      fprintf(FP_OUTPUT,"%s\n","  if(clientX < 0) {");
      fprintf(FP_OUTPUT,"%s\n","      clientX = 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else if(clientX >= (rect.right - rect.left)){");
      fprintf(FP_OUTPUT,"%s\n","      clientX = (rect.right - rect.left) - 1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  return clientX;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mouse_cy ){
      fprintf(FP_OUTPUT,"%s\n","int MOUSEY_CLIENT (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int clientY={0};");
      fprintf(FP_OUTPUT,"%s\n","  POINT pt   ={0};");
      fprintf(FP_OUTPUT,"%s\n","  RECT rect  ={0};");
      fprintf(FP_OUTPUT,"%s\n","  GetCursorPos(&pt);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(GetForegroundWindow(), &rect);");
      fprintf(FP_OUTPUT,"%s\n","  clientY = pt.y - rect.top;");
      fprintf(FP_OUTPUT,"%s\n","  if(clientY < 0) {");
      fprintf(FP_OUTPUT,"%s\n","      clientY = 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else if(clientY >= (rect.bottom - rect.top)){");
      fprintf(FP_OUTPUT,"%s\n","      clientY = (rect.bottom - rect.top) - 1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  return clientY;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Date ){
      fprintf(FP_OUTPUT,"%s\n","char *date (int tz)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  time_t elapse_time;");
      fprintf(FP_OUTPUT,"%s\n","  struct tm *tp;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(24);");
      fprintf(FP_OUTPUT,"%s\n","  time(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","  if (tz == 0)");
      fprintf(FP_OUTPUT,"%s\n","    tp = localtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    tp = gmtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strftime(strtmp, 24, ",enc("%m-%d-%Y"),", tp);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IsoDate ){
      fprintf(FP_OUTPUT,"%s\n","char *isodate (int tz)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  time_t elapse_time;");
      fprintf(FP_OUTPUT,"%s\n","  struct tm *tp;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(24);");
      fprintf(FP_OUTPUT,"%s\n","  time(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","  if (tz == 0)");
      fprintf(FP_OUTPUT,"%s\n","    tp = localtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    tp = gmtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strftime(strtmp, 24, ",enc("20%y-%m-%d"),", tp);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Now ){
      fprintf(FP_OUTPUT,"%s\n","char *now (int tz)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  time_t elapse_time;");
      fprintf(FP_OUTPUT,"%s\n","  struct tm *tp;");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  time(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","  if (tz == 0)");
      fprintf(FP_OUTPUT,"%s\n","    tp = localtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    tp = gmtime(&elapse_time);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strftime(strtmp, 256, ",enc("%m/%d/%y %I:%M:%S %p"),", tp);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_FileDialogs (FILE* FP_OUTPUT)
{
  if(Use_Getfilename ){
      fprintf(FP_OUTPUT,"%s\n","char *GetFileName(PCTSTR Title,");
      fprintf(FP_OUTPUT,"%s\n","                  PCTSTR Filter,");
      fprintf(FP_OUTPUT,"%s\n","                  int     Flag,");
      fprintf(FP_OUTPUT,"%s\n","                  HWND    hWnd,");
      fprintf(FP_OUTPUT,"%s\n","                  ULONG   Flags,");
      fprintf(FP_OUTPUT,"%s\n","                  PCTSTR InitDir,");
      fprintf(FP_OUTPUT,"%s\n","                  PCTSTR Initfname,");
      fprintf(FP_OUTPUT,"%s\n","                  int    *ExtIdx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  OPENFILENAME OpenFileStruct;");
      fprintf(FP_OUTPUT,"%s\n","  char Extension[2048];");
      fprintf(FP_OUTPUT,"%s\n","  int Counter = 0, TmpSize;");
      fprintf(FP_OUTPUT,"%s\n","  static char *filename;");
      fprintf(FP_OUTPUT,"%s\n","  static int BufSize;");
      fprintf(FP_OUTPUT,"%s\n","  TmpSize = ((Flags & OFN_ALLOWMULTISELECT) ? 500000:MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","  if (TmpSize > BufSize)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BufSize  = TmpSize;");
      fprintf(FP_OUTPUT,"%s\n","    filename = (char*)realloc(filename, BufSize);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  memset(filename, 0, BufSize);");
      fprintf(FP_OUTPUT,"%s\n","  memset(Extension, 0, 2048);");
      fprintf(FP_OUTPUT,"%s\n","  memset(&OpenFileStruct, 0, sizeof(OpenFileStruct));");
      fprintf(FP_OUTPUT,"%s\n","  if (Initfname) strcpy(filename, Initfname);");
      fprintf(FP_OUTPUT,"%s\n","  for(Counter = 0;Counter<=(int)strlen(Filter);Counter++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Filter[Counter]=='|')");
      fprintf(FP_OUTPUT,"%s\n","      Extension[Counter]=0;");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      Extension[Counter]=Filter[Counter];");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  CmDlgHook = SetWindowsHookEx(WH_CBT, (HOOKPROC)SBProc, NULL, GetCurrentThreadId());");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lStructSize = sizeof(OpenFileStruct);");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.hwndOwner = hWnd;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.hInstance = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrFilter = Extension;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrTitle = Title;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.nMaxFile = BufSize;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.nMaxFileTitle = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrFile = filename;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrFileTitle = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrCustomFilter = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.nMaxCustFilter = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (ExtIdx) OpenFileStruct.nFilterIndex=*ExtIdx;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrInitialDir = InitDir;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.nFileOffset = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.nFileExtension = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpstrDefExt = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lCustData = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpfnHook = 0;");
      fprintf(FP_OUTPUT,"%s\n","  OpenFileStruct.lpTemplateName = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Flags)");
      fprintf(FP_OUTPUT,"%s\n","    OpenFileStruct.Flags = OFN_HIDEREADONLY|OFN_CREATEPROMPT|OFN_EXPLORER;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    OpenFileStruct.Flags = Flags|OFN_EXPLORER;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Flag)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (GetOpenFileName(&OpenFileStruct)==0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      *filename = 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      int len = (int)strlen(filename);");
      fprintf(FP_OUTPUT,"%s\n","      if (filename[len+1]==0) return filename;");
      fprintf(FP_OUTPUT,"%s\n","      char *fname = filename+len;");
      fprintf(FP_OUTPUT,"%s\n","      while(fname[1])");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        *fname =  ',';");
      fprintf(FP_OUTPUT,"%s\n","        len = (int)strlen(++fname);");
      fprintf(FP_OUTPUT,"%s\n","        fname += len;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (GetSaveFileName(&OpenFileStruct)==0) *filename = 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (ExtIdx) *ExtIdx = OpenFileStruct.nFilterIndex;");
      fprintf(FP_OUTPUT,"%s\n","  return filename;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetSaveAsFilename ){
      fprintf(FP_OUTPUT,"%s\n","//----------------------------------------------------------");
      fprintf(FP_OUTPUT,"%s\n","//         GetSaveAsFileName Support Begins Here");
      fprintf(FP_OUTPUT,"%s\n","//----------------------------------------------------------");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#include <shobjidl.h>  // For IFileOpenDialog, IFileSaveDialog, etc.");
      fprintf(FP_OUTPUT,"%s\n","#include <shlguid.h>   // For CLSID_FileSaveDialog");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#define ID_ENCODING         1000");
      fprintf(FP_OUTPUT,"%s\n","#define FOS_HIDEREADONLY    0x00000004L");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef BCX_SF_BUFFER");
      fprintf(FP_OUTPUT,"%s\n","static char* filename = NULL;");
      fprintf(FP_OUTPUT,"%s\n","static int   BufSize = 0;");
      fprintf(FP_OUTPUT,"%s\n","#define BCX_SF_BUFFER    1");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef ID_ENCODING");
      fprintf(FP_OUTPUT,"%s\n","#define ID_ENCODING 40001");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static void ExtractDirectory(const char* fullPath, char* dirOut, size_t cch)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    size_t n = strlen(fullPath);");
      fprintf(FP_OUTPUT,"%s\n","    const char* p = fullPath + n;");
      fprintf(FP_OUTPUT,"%s\n","    while (p > fullPath && *p != 92 && *p != 47) --p;");
      fprintf(FP_OUTPUT,"%s\n","    size_t len = (p > fullPath) ? (size_t)(p - fullPath) : 0;");
      fprintf(FP_OUTPUT,"%s\n","    if (len >= cch) len = cch - 1;");
      fprintf(FP_OUTPUT,"%s\n","    memcpy(dirOut, fullPath, len);");
      fprintf(FP_OUTPUT,"%s\n","    dirOut[len] = 0;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static void GetExecutableDirectory(char* dirOut, size_t cch)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    char path[MAX_PATH];");
      fprintf(FP_OUTPUT,"%s\n","    GetModuleFileNameA(NULL, path, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","    ExtractDirectory(path, dirOut, cch);");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#if !defined(__POCC__) && !defined(__LCC__)  // Begin c++ support");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#include <vector>");
      fprintf(FP_OUTPUT,"%s\n","#include <string>");
      fprintf(FP_OUTPUT,"%s\n","#include <cwchar>");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static std::vector<COMDLG_FILTERSPEC> ConvertFilterToSpec(PCTSTR Filter, std::vector<wchar_t>& wbuf)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    std::vector<COMDLG_FILTERSPEC> v;");
      fprintf(FP_OUTPUT,"%s\n","    if (!Filter || !*Filter) return v;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","    std::wstring input(Filter);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","    size_t len = MultiByteToWideChar(CP_ACP, 0, Filter, -1, NULL, 0);");
      fprintf(FP_OUTPUT,"%s\n","    wbuf.resize(len);");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_ACP, 0, Filter, -1, wbuf.data(), (int)wbuf.size());");
      fprintf(FP_OUTPUT,"%s\n","    std::wstring input(wbuf.data());");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    size_t pos = 0;");
      fprintf(FP_OUTPUT,"%s\n","    while (pos < input.length()) {");
      fprintf(FP_OUTPUT,"%s\n","        size_t bar1 = input.find(L'|', pos);");
      fprintf(FP_OUTPUT,"%s\n","        if (bar1 == std::wstring::npos) break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        size_t bar2 = input.find(L'|', bar1 + 1);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        std::wstring name = input.substr(pos, bar1 - pos);");
      fprintf(FP_OUTPUT,"%s\n","        std::wstring spec;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        if (bar2 != std::wstring::npos) {");
      fprintf(FP_OUTPUT,"%s\n","            spec = input.substr(bar1 + 1, bar2 - bar1 - 1);");
      fprintf(FP_OUTPUT,"%s\n","            pos = bar2 + 1;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        else {");
      fprintf(FP_OUTPUT,"%s\n","            // Handle the final entry (no trailing pipe)");
      fprintf(FP_OUTPUT,"%s\n","            spec = input.substr(bar1 + 1);");
      fprintf(FP_OUTPUT,"%s\n","            pos = input.length(); // Exit after this");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        // Store copies of the strings");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t* name_copy = _wcsdup(name.c_str());");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t* spec_copy = _wcsdup(spec.c_str());");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        COMDLG_FILTERSPEC fs = { name_copy, spec_copy };");
      fprintf(FP_OUTPUT,"%s\n","        v.push_back(fs);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return v;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static std::wstring PrimaryExtFromSpec(const wchar_t* spec)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","    if (!spec) return L",enc(""),";");
      fprintf(FP_OUTPUT,"%s\n","    const wchar_t* star = wcschr(spec, L'*');");
      fprintf(FP_OUTPUT,"%s%s%s\n","    if (!star) return L",enc(""),";");
      fprintf(FP_OUTPUT,"%s\n","    const wchar_t* dot = wcschr(star, L'.');");
      fprintf(FP_OUTPUT,"%s%s%s\n","    if (!dot) return L",enc(""),";");
      fprintf(FP_OUTPUT,"%s\n","    ++dot;");
      fprintf(FP_OUTPUT,"%s\n","    std::wstring ext;");
      fprintf(FP_OUTPUT,"%s\n","    while (*dot && *dot != L';' && *dot != L' ' && *dot != L')') {");
      fprintf(FP_OUTPUT,"%s\n","        if (*dot == L'*' || *dot == L'?' || *dot == L'.') break;");
      fprintf(FP_OUTPUT,"%s\n","        ext.push_back(*dot++);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return ext;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","class BCX_FileTypeEvents : public IFileDialogEvents {");
      fprintf(FP_OUTPUT,"%s\n","    LONG m_cRef;");
      fprintf(FP_OUTPUT,"%s\n","    const std::vector<COMDLG_FILTERSPEC>& m_types;");
      fprintf(FP_OUTPUT,"%s\n","public:");
      fprintf(FP_OUTPUT,"%s\n","    BCX_FileTypeEvents(const std::vector<COMDLG_FILTERSPEC>& types) : m_cRef(1), m_types(types) {}");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) {");
      fprintf(FP_OUTPUT,"%s\n","        if (!ppv) return E_POINTER;");
      fprintf(FP_OUTPUT,"%s\n","        if (riid == IID_IUnknown || riid == IID_IFileDialogEvents) { *ppv = static_cast<IFileDialogEvents*>(this); AddRef(); return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","        *ppv = 0; return E_NOINTERFACE;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP_(ULONG) AddRef() { return InterlockedIncrement(&m_cRef); }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP_(ULONG) Release() { ULONG c = InterlockedDecrement(&m_cRef); return c; }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnTypeChange(IFileDialog* pfd) {");
      fprintf(FP_OUTPUT,"%s\n","        UINT idx = 0; if (FAILED(pfd->GetFileTypeIndex(&idx)) || idx == 0) return S_OK;");
      fprintf(FP_OUTPUT,"%s\n","        if (idx > m_types.size()) idx = (UINT)m_types.size();");
      fprintf(FP_OUTPUT,"%s\n","        const COMDLG_FILTERSPEC& fs = m_types[idx - 1];");
      fprintf(FP_OUTPUT,"%s\n","        std::wstring ext = PrimaryExtFromSpec(fs.pszSpec);");
      fprintf(FP_OUTPUT,"%s\n","        if (!ext.empty()) {");
      fprintf(FP_OUTPUT,"%s\n","            pfd->SetDefaultExtension(ext.c_str());");
      fprintf(FP_OUTPUT,"%s\n","            PWSTR cur = NULL; if (SUCCEEDED(pfd->GetFileName(&cur)) && cur && *cur) {");
      fprintf(FP_OUTPUT,"%s\n","                std::wstring name(cur); CoTaskMemFree(cur);");
      fprintf(FP_OUTPUT,"%s%s%s\n","                size_t slash = name.find_last_of(L",enc("/\\\\"),");");
      fprintf(FP_OUTPUT,"%s\n","                size_t dot = name.find_last_of(L'.');");
      fprintf(FP_OUTPUT,"%s%s%s\n","                if (dot == std::wstring::npos || (slash != std::wstring::npos && dot < slash)) name += L",enc(".")," + ext;");
      fprintf(FP_OUTPUT,"%s\n","                else { name.erase(dot + 1); name += ext; }");
      fprintf(FP_OUTPUT,"%s\n","                pfd->SetFileName(name.c_str());");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        return S_OK;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnFileOk(IFileDialog*) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnFolderChanging(IFileDialog*, IShellItem*) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnFolderChange(IFileDialog*) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnSelectionChange(IFileDialog*) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnShareViolation(IFileDialog*, IShellItem*, FDE_SHAREVIOLATION_RESPONSE*) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","    IFACEMETHODIMP OnOverwrite(IFileDialog*, IShellItem*, FDE_OVERWRITE_RESPONSE*) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","};");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","char* GetSaveAsFileName(PCTSTR Title, PCTSTR Filter, int Flag, HWND hWnd, ULONG Flags, PCTSTR InitDir, PCTSTR Initfname, PINT ExtIdx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    static char lastUsedFolder[MAX_PATH] = { 0 };");
      fprintf(FP_OUTPUT,"%s\n","    int TmpSize = ((Flags & OFN_ALLOWMULTISELECT) ? 500000 : MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","    if (TmpSize > BufSize) { BufSize = TmpSize; filename = (char*)realloc(filename, BufSize); }");
      fprintf(FP_OUTPUT,"%s\n","    if (!filename) return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    *filename = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);");
      fprintf(FP_OUTPUT,"%s\n","    if (FAILED(hr)) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    IFileSaveDialog* pDlg = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    hr = CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pDlg));");
      fprintf(FP_OUTPUT,"%s\n","    if (FAILED(hr)) { CoUninitialize(); return NULL; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    DWORD fos = FOS_FORCEFILESYSTEM | FOS_OVERWRITEPROMPT;");
      fprintf(FP_OUTPUT,"%s\n","    if (Flags & OFN_CREATEPROMPT) fos |= FOS_CREATEPROMPT;");
      fprintf(FP_OUTPUT,"%s\n","    pDlg->SetOptions(fos);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (Title) {");
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->SetTitle(Title);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t wTitle[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, Title, -1, wTitle, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->SetTitle(wTitle);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    std::vector<wchar_t> fbuf; std::vector<COMDLG_FILTERSPEC> types = ConvertFilterToSpec(Filter, fbuf);");
      fprintf(FP_OUTPUT,"%s\n","    if (!types.empty()) {");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->SetFileTypes((UINT)types.size(), types.data());");
      fprintf(FP_OUTPUT,"%s\n","        UINT defIndex = 1;");
      fprintf(FP_OUTPUT,"%s\n","        if (ExtIdx && *ExtIdx >= 1 && (UINT)*ExtIdx <= types.size()) defIndex = (UINT)*ExtIdx;");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->SetFileTypeIndex(defIndex);");
      fprintf(FP_OUTPUT,"%s\n","        std::wstring ext = PrimaryExtFromSpec(types[defIndex - 1].pszSpec);");
      fprintf(FP_OUTPUT,"%s\n","        if (!ext.empty()) pDlg->SetDefaultExtension(ext.c_str());");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    char workingDir[MAX_PATH];");
      fprintf(FP_OUTPUT,"%s\n","    if (InitDir && *InitDir) { strncpy(workingDir, InitDir, MAX_PATH - 1); workingDir[MAX_PATH - 1] = 0; }");
      fprintf(FP_OUTPUT,"%s\n","    else if (lastUsedFolder[0]) { strncpy(workingDir, lastUsedFolder, MAX_PATH - 1); workingDir[MAX_PATH - 1] = 0; }");
      fprintf(FP_OUTPUT,"%s\n","    else { GetExecutableDirectory(workingDir, MAX_PATH); }");
      fprintf(FP_OUTPUT,"%s\n","    if (workingDir[0]) {");
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        IShellItem* pFolder = NULL; if (SUCCEEDED(SHCreateItemFromParsingName(workingDir, NULL, IID_PPV_ARGS(&pFolder))))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","            pDlg->SetFolder(pFolder); pFolder->Release();");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t wdir[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, workingDir, -1, wdir, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","        IShellItem* pFolder = NULL; if (SUCCEEDED(SHCreateItemFromParsingName(wdir, NULL, IID_PPV_ARGS(&pFolder))))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","            pDlg->SetFolder(pFolder); pFolder->Release();");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (Initfname) {");
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->SetFileName(Initfname);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t wfn[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, Initfname, -1, wfn, MAX_PATH); pDlg->SetFileName(wfn);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Add the custom combo box");
      fprintf(FP_OUTPUT,"%s\n","    IFileDialogCustomize* pCust = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    if (SUCCEEDED(pDlg->QueryInterface(IID_PPV_ARGS(&pCust)))) {");
      fprintf(FP_OUTPUT,"%s\n","        pCust->AddComboBox(ID_ENCODING);");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->AddControlItem(ID_ENCODING, 0, L",enc("UTF-8"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->AddControlItem(ID_ENCODING, 1, L",enc("UTF-8 with BOM"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->AddControlItem(ID_ENCODING, 2, L",enc("UTF-16 LE"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->AddControlItem(ID_ENCODING, 3, L",enc("UTF-16 BE"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->AddControlItem(ID_ENCODING, 4, L",enc("ANSI"),");");
      fprintf(FP_OUTPUT,"%s\n","        pCust->SetSelectedControlItem(ID_ENCODING, 0);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    DWORD cookie = 0; BCX_FileTypeEvents* pEvents = new BCX_FileTypeEvents(types);");
      fprintf(FP_OUTPUT,"%s\n","    if (pEvents) pDlg->Advise(pEvents, &cookie);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hr = pDlg->Show(hWnd);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (SUCCEEDED(hr)) {");
      fprintf(FP_OUTPUT,"%s\n","        IShellItem* pItem = NULL;");
      fprintf(FP_OUTPUT,"%s\n","        if (SUCCEEDED(pDlg->GetResult(&pItem)) && pItem) {");
      fprintf(FP_OUTPUT,"%s\n","            PWSTR psz = NULL; if (SUCCEEDED(pItem->GetDisplayName(SIGDN_FILESYSPATH, &psz)) && psz) {");
      fprintf(FP_OUTPUT,"%s\n","                WideCharToMultiByte(CP_ACP, 0, psz, -1, filename, BufSize, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","                ExtractDirectory(filename, lastUsedFolder, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","                CoTaskMemFree(psz);");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            pItem->Release();");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Correct logic to get the encoding index and overwrite the ExtIdx pointer");
      fprintf(FP_OUTPUT,"%s\n","    if (pCust) {");
      fprintf(FP_OUTPUT,"%s\n","        DWORD selectedEncoding = 0;");
      fprintf(FP_OUTPUT,"%s\n","        if (SUCCEEDED(pCust->GetSelectedControlItem(ID_ENCODING, &selectedEncoding))) {");
      fprintf(FP_OUTPUT,"%s\n","            if (ExtIdx) {");
      fprintf(FP_OUTPUT,"%s\n","                *ExtIdx = (int)selectedEncoding;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (ExtIdx) {");
      fprintf(FP_OUTPUT,"%s\n","        // If the custom control failed to be created, set ExtIdx to a default value");
      fprintf(FP_OUTPUT,"%s\n","        *ExtIdx = -1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // This section is commented out because it conflicts with your goal of getting the encoding index.");
      fprintf(FP_OUTPUT,"%s\n","    // The previous code would overwrite your variable with the FileTypeIndex here.");
      fprintf(FP_OUTPUT,"%s\n","    // if (ExtIdx) { UINT i = 0; *ExtIdx = -1; if (SUCCEEDED(pDlg->GetFileTypeIndex(&i))) *ExtIdx = (int)i; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (cookie) pDlg->Unadvise(cookie);");
      fprintf(FP_OUTPUT,"%s\n","    if (pEvents) pEvents->Release();");
      fprintf(FP_OUTPUT,"%s\n","    if (pCust) pCust->Release();");
      fprintf(FP_OUTPUT,"%s\n","    pDlg->Release();");
      fprintf(FP_OUTPUT,"%s\n","    // Free the duplicated strings from ConvertFilterToSpec");
      fprintf(FP_OUTPUT,"%s\n","    for (auto& fs : types) {");
      fprintf(FP_OUTPUT,"%s\n","        free((void*)fs.pszName);");
      fprintf(FP_OUTPUT,"%s\n","        free((void*)fs.pszSpec);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    CoUninitialize();");
      fprintf(FP_OUTPUT,"%s\n","    if (!filename) return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    return filename;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#else    // Begin c99 support (e.g., when compiling with Pelles C)");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#include <wchar.h>");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static COMDLG_FILTERSPEC* ConvertFilterToSpec(PCTSTR Filter, int* pCount)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    *pCount = 0; if (!Filter || !*Filter) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","    const wchar_t* src = Filter;");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","    int wlen = MultiByteToWideChar(CP_ACP, 0, Filter, -1, NULL, 0);");
      fprintf(FP_OUTPUT,"%s\n","    wchar_t* wtmp = (wchar_t*)calloc(wlen * sizeof(wchar_t), sizeof(wchar_t));");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_ACP, 0, Filter, -1, wtmp, wlen);");
      fprintf(FP_OUTPUT,"%s\n","    const wchar_t* src = wtmp;");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    size_t len = wcslen(src);");
      fprintf(FP_OUTPUT,"%s\n","    int pipes = 0; for (size_t i = 0; i < len; ++i) if (src[i] == L'|') ++pipes;");
      fprintf(FP_OUTPUT,"%s\n","    int pairs = pipes / 2; if (pairs <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","#ifndef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        free(wtmp);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","        return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    pairs++;");
      fprintf(FP_OUTPUT,"%s\n","    wchar_t* wstore = (wchar_t*)malloc((len + 1) * sizeof(wchar_t));");
      fprintf(FP_OUTPUT,"%s\n","    wcscpy(wstore, src);");
      fprintf(FP_OUTPUT,"%s\n","    COMDLG_FILTERSPEC* arr = (COMDLG_FILTERSPEC*)malloc(sizeof(COMDLG_FILTERSPEC) * pairs);");
      fprintf(FP_OUTPUT,"%s\n","    size_t i = 0, idx = 0;");
      fprintf(FP_OUTPUT,"%s\n","    while (idx < (size_t)pairs) {");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t* name = wcschr(wstore + i, L'|');");
      fprintf(FP_OUTPUT,"%s\n","        if (!name) break; *name = 0; name = wstore + i;");
      fprintf(FP_OUTPUT,"%s\n","        i += wcslen(name) + 1;");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t* spec = wcschr(wstore + i, L'|');");
      fprintf(FP_OUTPUT,"%s\n","        if (spec) { *spec = 0; spec = wstore + i; i += wcslen(spec) + 1; }");
      fprintf(FP_OUTPUT,"%s\n","        else { spec = wstore + i; i = len; }");
      fprintf(FP_OUTPUT,"%s\n","        arr[idx].pszName = name; arr[idx].pszSpec = spec; ++idx;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","    free(wtmp);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    * pCount = (int)idx;");
      fprintf(FP_OUTPUT,"%s\n","    return arr; // arr->pszName/Spec point into wstore; we free via arr[0].pszName");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static void PrimaryExtFromSpecW(const wchar_t* spec, wchar_t* out, size_t cch)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    if (!spec || !cch) { if (cch) out[0] = 0; return; }");
      fprintf(FP_OUTPUT,"%s\n","    const wchar_t* star = wcschr(spec, L'*');");
      fprintf(FP_OUTPUT,"%s\n","    const wchar_t* dot = star ? wcschr(star, L'.') : NULL;");
      fprintf(FP_OUTPUT,"%s\n","    size_t j = 0;");
      fprintf(FP_OUTPUT,"%s\n","    if (dot) {");
      fprintf(FP_OUTPUT,"%s\n","        ++dot; while (*dot && *dot != L';' && *dot != L' ' && *dot != L')' && *dot != L'.') {");
      fprintf(FP_OUTPUT,"%s\n","            if (*dot == L'*' || *dot == L'?') break; if (j + 1 < cch) out[j++] = *dot; ++dot;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    out[j] = 0;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","typedef struct BCX_FileTypeEventsC {");
      fprintf(FP_OUTPUT,"%s\n","    IFileDialogEvents iface;");
      fprintf(FP_OUTPUT,"%s\n","    LONG refc;");
      fprintf(FP_OUTPUT,"%s\n","    const COMDLG_FILTERSPEC* types;");
      fprintf(FP_OUTPUT,"%s\n","    int count;");
      fprintf(FP_OUTPUT,"%s\n","} BCX_FileTypeEventsC;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnQueryInterface(IFileDialogEvents* This, REFIID riid, void** ppv)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    if (!ppv) return E_POINTER;");
      fprintf(FP_OUTPUT,"%s\n","    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IFileDialogEvents)) { *ppv = This; This->lpVtbl->AddRef(This); return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","    *ppv = NULL; return E_NOINTERFACE;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n","static ULONG   STDMETHODCALLTYPE C_OnAddRef(IFileDialogEvents* This) { BCX_FileTypeEventsC* s = (BCX_FileTypeEventsC*)This; return InterlockedIncrement(&s->refc); }");
      fprintf(FP_OUTPUT,"%s\n","static ULONG   STDMETHODCALLTYPE C_OnRelease(IFileDialogEvents* This) { BCX_FileTypeEventsC* s = (BCX_FileTypeEventsC*)This; ULONG c = InterlockedDecrement(&s->refc); if (!c) free(s); return c; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnFileOk(IFileDialogEvents* This, IFileDialog* pfd) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnFolderChanging(IFileDialogEvents* This, IFileDialog* pfd, IShellItem* psi) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnFolderChange(IFileDialogEvents* This, IFileDialog* pfd) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnSelectionChange(IFileDialogEvents* This, IFileDialog* pfd) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnShareViolation(IFileDialogEvents* This, IFileDialog* pfd, IShellItem* psi, FDE_SHAREVIOLATION_RESPONSE* pResponse) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnOverwrite(IFileDialogEvents* This, IFileDialog* pfd, IShellItem* psi, FDE_OVERWRITE_RESPONSE* pResponse) { return S_OK; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static HRESULT STDMETHODCALLTYPE C_OnTypeChange(IFileDialogEvents* This, IFileDialog* pfd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    BCX_FileTypeEventsC* s = (BCX_FileTypeEventsC*)This;");
      fprintf(FP_OUTPUT,"%s\n","    UINT idx = 0; if (FAILED(pfd->lpVtbl->GetFileTypeIndex(pfd, &idx)) || idx == 0) return S_OK;");
      fprintf(FP_OUTPUT,"%s\n","    if ((int)idx > s->count) idx = (UINT)s->count;");
      fprintf(FP_OUTPUT,"%s\n","    wchar_t ext[32]; PrimaryExtFromSpecW(s->types[idx - 1].pszSpec, ext, 32);");
      fprintf(FP_OUTPUT,"%s\n","    if (ext[0]) {");
      fprintf(FP_OUTPUT,"%s\n","        pfd->lpVtbl->SetDefaultExtension(pfd, ext);");
      fprintf(FP_OUTPUT,"%s\n","        PWSTR cur = 0; if (SUCCEEDED(pfd->lpVtbl->GetFileName(pfd, &cur)) && cur && *cur) {");
      fprintf(FP_OUTPUT,"%s\n","            size_t len = wcslen(cur);");
      fprintf(FP_OUTPUT,"%s\n","            wchar_t* name = (wchar_t*)malloc((len + 32) * sizeof(wchar_t)); wcscpy(name, cur); CoTaskMemFree(cur);");
      fprintf(FP_OUTPUT,"%s\n","            wchar_t* slash = wcsrchr(name, 92); wchar_t* dot = wcsrchr(name, L'.');");
      fprintf(FP_OUTPUT,"%s%s%s\n","            if (!dot || (slash && dot < slash)) { wcscat(name, L",enc("."),"); wcscat(name, ext); }");
      fprintf(FP_OUTPUT,"%s\n","            else { *(dot + 1) = 0; wcscat(name, ext); }");
      fprintf(FP_OUTPUT,"%s\n","            pfd->lpVtbl->SetFileName(pfd, name); free(name);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return S_OK;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","static const IFileDialogEventsVtbl g_BCXEvtVtbl = {");
      fprintf(FP_OUTPUT,"%s\n","    C_OnQueryInterface,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnAddRef,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnRelease,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnFileOk,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnFolderChanging,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnFolderChange,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnSelectionChange,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnShareViolation,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnTypeChange,");
      fprintf(FP_OUTPUT,"%s\n","    C_OnOverwrite");
      fprintf(FP_OUTPUT,"%s\n","};");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","char* GetSaveAsFileName(PCTSTR Title, PCTSTR Filter, int Flag, HWND hWnd, ULONG Flags, PCTSTR InitDir, PCTSTR Initfname, PINT ExtIdx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    static char lastUsedFolder[MAX_PATH] = { 0 };");
      fprintf(FP_OUTPUT,"%s\n","    int TmpSize = ((Flags & OFN_ALLOWMULTISELECT) ? 500000 : MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","    if (TmpSize > BufSize) { BufSize = TmpSize; filename = (char*)realloc(filename, BufSize); }");
      fprintf(FP_OUTPUT,"%s\n","    if (!filename) return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    *filename = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);");
      fprintf(FP_OUTPUT,"%s\n","    if (FAILED(hr)) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    IFileSaveDialog* pDlg = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_INPROC_SERVER, &IID_IFileSaveDialog, (void**)&pDlg);");
      fprintf(FP_OUTPUT,"%s\n","    if (FAILED(hr)) { CoUninitialize(); return NULL; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    DWORD fos = FOS_FORCEFILESYSTEM | FOS_OVERWRITEPROMPT;");
      fprintf(FP_OUTPUT,"%s\n","    if (Flags & OFN_CREATEPROMPT) fos |= FOS_CREATEPROMPT;");
      fprintf(FP_OUTPUT,"%s\n","    pDlg->lpVtbl->SetOptions(pDlg, fos);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (Title) {");
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->lpVtbl->SetTitle(pDlg, Title);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t wTitle[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, Title, -1, wTitle, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->lpVtbl->SetTitle(pDlg, wTitle);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    int count = 0; COMDLG_FILTERSPEC* types = ConvertFilterToSpec(Filter, &count);");
      fprintf(FP_OUTPUT,"%s\n","    if (types && count > 0) {");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->lpVtbl->SetFileTypes(pDlg, (UINT)count, types);");
      fprintf(FP_OUTPUT,"%s\n","        UINT defIndex = 1;");
      fprintf(FP_OUTPUT,"%s\n","        if (ExtIdx && *ExtIdx >= 1 && *ExtIdx <= count) defIndex = (UINT)*ExtIdx;");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->lpVtbl->SetFileTypeIndex(pDlg, defIndex);");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t ext[32]; PrimaryExtFromSpecW(types[defIndex - 1].pszSpec, ext, 32);");
      fprintf(FP_OUTPUT,"%s\n","        if (ext[0]) pDlg->lpVtbl->SetDefaultExtension(pDlg, ext);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    char workingDir[MAX_PATH];");
      fprintf(FP_OUTPUT,"%s\n","    if (InitDir && *InitDir) { strncpy(workingDir, InitDir, MAX_PATH - 1); workingDir[MAX_PATH - 1] = 0; }");
      fprintf(FP_OUTPUT,"%s\n","    else if (lastUsedFolder[0]) { strncpy(workingDir, lastUsedFolder, MAX_PATH - 1); workingDir[MAX_PATH - 1] = 0; }");
      fprintf(FP_OUTPUT,"%s\n","    else { GetExecutableDirectory(workingDir, MAX_PATH); }");
      fprintf(FP_OUTPUT,"%s\n","    if (workingDir[0]) {");
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        IShellItem* pFolder = NULL; if (SUCCEEDED(SHCreateItemFromParsingName(workingDir, NULL, &IID_IShellItem, (void**)&pFolder)))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","            pDlg->lpVtbl->SetFolder(pDlg, pFolder); pFolder->lpVtbl->Release(pFolder);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t wdir[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, workingDir, -1, wdir, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","        IShellItem* pFolder = NULL; if (SUCCEEDED(SHCreateItemFromParsingName(wdir, NULL, &IID_IShellItem, (void**)&pFolder)))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","            pDlg->lpVtbl->SetFolder(pDlg, pFolder); pFolder->lpVtbl->Release(pFolder);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (Initfname) {");
      fprintf(FP_OUTPUT,"%s\n","#ifdef _UNICODE");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->lpVtbl->SetFileName(pDlg, Initfname);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","        wchar_t wfn[MAX_PATH]; MultiByteToWideChar(CP_ACP, 0, Initfname, -1, wfn, MAX_PATH); pDlg->lpVtbl->SetFileName(pDlg, wfn);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Add the custom combo box");
      fprintf(FP_OUTPUT,"%s\n","    IFileDialogCustomize* pCust = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    if (SUCCEEDED(pDlg->lpVtbl->QueryInterface(pDlg, &IID_IFileDialogCustomize, (void**)&pCust))) {");
      fprintf(FP_OUTPUT,"%s\n","        pCust->lpVtbl->AddComboBox(pCust, ID_ENCODING);");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->lpVtbl->AddControlItem(pCust, ID_ENCODING, 0, L",enc("UTF-8"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->lpVtbl->AddControlItem(pCust, ID_ENCODING, 1, L",enc("UTF-8 with BOM"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->lpVtbl->AddControlItem(pCust, ID_ENCODING, 2, L",enc("UTF-16 LE"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->lpVtbl->AddControlItem(pCust, ID_ENCODING, 3, L",enc("UTF-16 BE"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","        pCust->lpVtbl->AddControlItem(pCust, ID_ENCODING, 4, L",enc("ANSI"),");");
      fprintf(FP_OUTPUT,"%s\n","        pCust->lpVtbl->SetSelectedControlItem(pCust, ID_ENCODING, 0);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    DWORD cookie = 0;");
      fprintf(FP_OUTPUT,"%s\n","    BCX_FileTypeEventsC* sink = (BCX_FileTypeEventsC*)calloc(1, sizeof(BCX_FileTypeEventsC));");
      fprintf(FP_OUTPUT,"%s\n","    if (sink) {");
      fprintf(FP_OUTPUT,"%s\n","        sink->iface.lpVtbl = (IFileDialogEventsVtbl*)&g_BCXEvtVtbl;");
      fprintf(FP_OUTPUT,"%s\n","        sink->refc = 1; sink->types = types; sink->count = count;");
      fprintf(FP_OUTPUT,"%s\n","        pDlg->lpVtbl->Advise(pDlg, (IFileDialogEvents*)sink, &cookie);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hr = pDlg->lpVtbl->Show(pDlg, hWnd);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (SUCCEEDED(hr)) {");
      fprintf(FP_OUTPUT,"%s\n","        IShellItem* pItem = NULL;");
      fprintf(FP_OUTPUT,"%s\n","        if (SUCCEEDED(pDlg->lpVtbl->GetResult(pDlg, &pItem)) && pItem) {");
      fprintf(FP_OUTPUT,"%s\n","            PWSTR psz = NULL; if (SUCCEEDED(pItem->lpVtbl->GetDisplayName(pItem, SIGDN_FILESYSPATH, &psz)) && psz) {");
      fprintf(FP_OUTPUT,"%s\n","                WideCharToMultiByte(CP_ACP, 0, psz, -1, filename, BufSize, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","                ExtractDirectory(filename, lastUsedFolder, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","                CoTaskMemFree(psz);");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            pItem->lpVtbl->Release(pItem);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Correct logic to get the encoding index and overwrite the ExtIdx pointer");
      fprintf(FP_OUTPUT,"%s\n","    if (pCust) {");
      fprintf(FP_OUTPUT,"%s\n","        DWORD selectedEncoding = 0;");
      fprintf(FP_OUTPUT,"%s\n","        if (SUCCEEDED(pCust->lpVtbl->GetSelectedControlItem(pCust, ID_ENCODING, &selectedEncoding))) {");
      fprintf(FP_OUTPUT,"%s\n","            if (ExtIdx) {");
      fprintf(FP_OUTPUT,"%s\n","                *ExtIdx = (int)selectedEncoding;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (ExtIdx) {");
      fprintf(FP_OUTPUT,"%s\n","        // If the custom control failed to be created, set ExtIdx to a default value");
      fprintf(FP_OUTPUT,"%s\n","        *ExtIdx = -1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // This section is commented out because it conflicts with your goal of getting the encoding index.");
      fprintf(FP_OUTPUT,"%s\n","    // The previous code would overwrite your variable with the FileTypeIndex here.");
      fprintf(FP_OUTPUT,"%s\n","    // if (ExtIdx) { UINT i = 0; *ExtIdx = -1; if (SUCCEEDED(pDlg->lpVtbl->GetFileTypeIndex(pDlg, &i))) *ExtIdx = (int)i; }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (cookie) pDlg->lpVtbl->Unadvise(pDlg, cookie);");
      fprintf(FP_OUTPUT,"%s\n","    if (sink)   sink->iface.lpVtbl->Release((IFileDialogEvents*)sink);");
      fprintf(FP_OUTPUT,"%s\n","    if (pCust)  pCust->lpVtbl->Release(pCust);");
      fprintf(FP_OUTPUT,"%s\n","    if (types) { free((void*)types[0].pszName); free(types); }");
      fprintf(FP_OUTPUT,"%s\n","    pDlg->lpVtbl->Release(pDlg);");
      fprintf(FP_OUTPUT,"%s\n","    CoUninitialize();");
      fprintf(FP_OUTPUT,"%s\n","    if (!filename) return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    return filename;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","//----------------------------------------------------------");
      fprintf(FP_OUTPUT,"%s\n","//         GetSaveAsFileName Support Ends Here");
      fprintf(FP_OUTPUT,"%s\n","//----------------------------------------------------------");
      fprintf(FP_OUTPUT,"%s\n","\n\n");
    }
}

void Emit_RT_FormatPath1 (FILE* FP_OUTPUT)
{
  if(Use_AppExePath ){
      fprintf(FP_OUTPUT,"%s\n","char *AppExePath (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  int ii;");
      fprintf(FP_OUTPUT,"%s\n","  ii = GetModuleFileName(GetModuleHandle(0), strtmp, BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  while(ii && strtmp[ii] != 0x5C)");
      fprintf(FP_OUTPUT,"%s\n","    ii--;");
      fprintf(FP_OUTPUT,"%s\n","  strtmp[ii+1] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_AppExeName ){
      fprintf(FP_OUTPUT,"%s\n","char *AppExeName (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  int ii;");
      fprintf(FP_OUTPUT,"%s\n","  ii = GetModuleFileName (GetModuleHandle(NULL), strtmp, BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  while(ii && strtmp[ii] != 0x5C)");
      fprintf(FP_OUTPUT,"%s\n","    ii--;");
      fprintf(FP_OUTPUT,"%s\n","  return &strtmp[ii+1];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_TempFileName ){
      fprintf(FP_OUTPUT,"%s\n","char *TempFileName (PCTSTR szFolder, PCTSTR szPrefix)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  GetTempFileName(szFolder, szPrefix, 0, strtmp);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Boolstr ){
      fprintf(FP_OUTPUT,"%s\n","char * BoolStr (int a)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(5);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (a) return strcpy(BCX_RetStr, ",enc("True"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","  return strcpy(BCX_RetStr, ",enc("False"),");");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Using ){
      fprintf(FP_OUTPUT,"%s\n","char *Using(PCTSTR szMask, long double Num)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","  int CntDec = 0;    // Count the number of ",enc("0")," to left pad the result");
      fprintf(FP_OUTPUT,"%s\n","  int Decimals = 0;  // Count ALL digits RIGHT of the decimal point");
      fprintf(FP_OUTPUT,"%s%s%s\n","  int Dollar = 0;    // Flag to LEFT prepend ",enc("$")," symbol");
      fprintf(FP_OUTPUT,"%s%s%s\n","  int Percent = 0;   // Flag to append ",enc("%")," symbol (does NOT scale value)");
      fprintf(FP_OUTPUT,"%s\n","  int SN = 0;        // Flag to use Sci Notation ");
      fprintf(FP_OUTPUT,"%s\n","  int Spaces = 0;    // Flag for using spaces padding");
      fprintf(FP_OUTPUT,"%s\n","  int Zeros = 0;     // Flag for using zero padding ");
      fprintf(FP_OUTPUT,"%s\n","  int Commas = 0;    // Flag for thousands separators (mask contains comma)");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(256);");
      fprintf(FP_OUTPUT,"%s\n","  char Buf_1[256]={0};");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR p = szMask;");
      fprintf(FP_OUTPUT,"%s\n","  int len;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // First pass: analyze the format mask");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  while (*p)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 36)  Dollar++;      // $");
      fprintf(FP_OUTPUT,"%s\n","    if (Dollar>1)  Dollar=1;      // Restrict");
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 37)  Percent++;     // %");
      fprintf(FP_OUTPUT,"%s\n","    if (Percent>1) Percent=1;     // Restrict");
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 32)  Spaces++;      // Space");
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 44)  Commas = 1;    // Comma in mask");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Track zero padding before decimal");
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 48 && !CntDec)  Zeros++;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Count decimal places (spaces, # or 0 after decimal point)");
      fprintf(FP_OUTPUT,"%s\n","    if ((*p == 32 || *p == 35 || *p == 48) && CntDec)  Decimals++;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 46)  CntDec = 1;    // Decimal point");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (*p == 94)  SN++;          // ^ is for scientific notation");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    p++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Second pass: Assemble the resulting string");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (SN)                         // Process SN and return");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    char Tmp[64]={0};");
      fprintf(FP_OUTPUT,"%s\n","    ");
      fprintf(FP_OUTPUT,"%s\n","    // Per manual: SN always uses full double precision; mask details ignored.");
      fprintf(FP_OUTPUT,"%s%s%s\n","    sprintf(Tmp, ",enc("%.15E"),", (double)Num);");
      fprintf(FP_OUTPUT,"%s\n","    ");
      fprintf(FP_OUTPUT,"%s\n","    // Strip trailing zeros from the mantissa (e.g. 1.2300000E+07-> 1.23E+07)");
      fprintf(FP_OUTPUT,"%s%s%s\n","    while (instr(Tmp, ",enc("0E"),"))");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","      strcpy(Tmp, replace(Tmp, ",enc("0E"),", ",enc("E"),"));");
      fprintf(FP_OUTPUT,"%s\n","    ");
      fprintf(FP_OUTPUT,"%s\n","    // MSVC may emit 3-digit exponents (E+007), so collapse the leading zero");
      fprintf(FP_OUTPUT,"%s\n","    // only when followed by a non-zero digit. Preserve normal 2-digit form.");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s%s%s\n","      char *e = strstr(Tmp, ",enc("E+00"),");");
      fprintf(FP_OUTPUT,"%s\n","      if (e && e[4] >= '1' && e[4] <= '9')");
      fprintf(FP_OUTPUT,"%s\n","        memmove(e + 3, e + 4, strlen(e + 4) + 1);");
      fprintf(FP_OUTPUT,"%s%s%s\n","      e = strstr(Tmp, ",enc("E-00"),");");
      fprintf(FP_OUTPUT,"%s\n","      if (e && e[4] >= '1' && e[4] <= '9')");
      fprintf(FP_OUTPUT,"%s\n","        memmove(e + 3, e + 4, strlen(e + 4) + 1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RetStr, Tmp);");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Format the number with specified decimals");
      fprintf(FP_OUTPUT,"%s%s%s\n","  sprintf(Buf_1, ",enc("%1.*Lf"),", Decimals, Num);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Find integer part length");
      fprintf(FP_OUTPUT,"%s\n","  char *decimal_pos = strchr(Buf_1, '.');");
      fprintf(FP_OUTPUT,"%s\n","  int num_int_digits = decimal_pos ? (int)(decimal_pos - Buf_1) : (int)strlen(Buf_1);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Adjust for negative sign");
      fprintf(FP_OUTPUT,"%s\n","  int has_negative = (Buf_1[0] == '-');");
      fprintf(FP_OUTPUT,"%s\n","  if (has_negative)");
      fprintf(FP_OUTPUT,"%s\n","    num_int_digits--;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Initialize the return string");
      fprintf(FP_OUTPUT,"%s\n","  memset(BCX_RetStr, 0, 256);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  int zero_pad = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Calculate zero padding (apply only if needed)");
      fprintf(FP_OUTPUT,"%s\n","  if (Zeros > 0 && Zeros > num_int_digits)");
      fprintf(FP_OUTPUT,"%s\n","    zero_pad = Zeros - num_int_digits;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Position for the start of the number");
      fprintf(FP_OUTPUT,"%s\n","  int pos = Dollar + Spaces + zero_pad;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Copy the number to the return string");
      fprintf(FP_OUTPUT,"%s\n","  if (has_negative)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Zeros > 0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      // With zero padding, negative goes before zeros");
      fprintf(FP_OUTPUT,"%s\n","      BCX_RetStr[Dollar + Spaces] = '-';");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(BCX_RetStr + pos, Buf_1 + 1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      // Without zero padding, negative stays with number");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(BCX_RetStr + pos, Buf_1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RetStr + pos, Buf_1);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Add commas for thousands (only if mask requested them)");
      fprintf(FP_OUTPUT,"%s\n","  if (Commas)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    char temp[256]={0};");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(temp, BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Find where the number starts after any potential padding");
      fprintf(FP_OUTPUT,"%s\n","    int number_start = Dollar + Spaces + zero_pad;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Handle negative sign position for proper comma placement");
      fprintf(FP_OUTPUT,"%s\n","    if (has_negative && Zeros == 0)");
      fprintf(FP_OUTPUT,"%s\n","      number_start++; // Skip past the negative sign for comma placement");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Find integer part end");
      fprintf(FP_OUTPUT,"%s\n","    decimal_pos = strchr(temp, '.');");
      fprintf(FP_OUTPUT,"%s\n","    int int_end = decimal_pos ? (int)(decimal_pos - temp) : (int)strlen(temp);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Add commas working backwards, but never insert a comma right after the negative sign");
      fprintf(FP_OUTPUT,"%s\n","    for (int i = int_end - 3; i > number_start; i -= 3)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      // Ensure we don't place a comma immediately after a negative sign");
      fprintf(FP_OUTPUT,"%s\n","      if (i > number_start && !(temp[i-1] == '-'))");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        memmove(temp + i + 1, temp + i, (int)strlen(temp + i) + 1);");
      fprintf(FP_OUTPUT,"%s\n","        temp[i] = ',';");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RetStr, temp);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Add dollar sign");
      fprintf(FP_OUTPUT,"%s\n","  if (Dollar)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Num >= 0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      BCX_RetStr[Spaces] = '$';");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (Zeros > 0)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        // With zero padding: move negative, then add dollar");
      fprintf(FP_OUTPUT,"%s\n","        BCX_RetStr[Spaces] = '-';");
      fprintf(FP_OUTPUT,"%s\n","        BCX_RetStr[Spaces + 1] = '$';");
      fprintf(FP_OUTPUT,"%s\n","        ");
      fprintf(FP_OUTPUT,"%s\n","        // Remove duplicate negative sign");
      fprintf(FP_OUTPUT,"%s\n","        for (int i = pos; i < (int)strlen(BCX_RetStr); i++)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          if (BCX_RetStr[i] == '-')");
      fprintf(FP_OUTPUT,"%s\n","          {");
      fprintf(FP_OUTPUT,"%s\n","            memmove(BCX_RetStr + i, BCX_RetStr + i + 1, (int)strlen(BCX_RetStr + i));");
      fprintf(FP_OUTPUT,"%s\n","            break;");
      fprintf(FP_OUTPUT,"%s\n","          }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        // Without zero padding: dollar then negative");
      fprintf(FP_OUTPUT,"%s\n","        BCX_RetStr[Spaces] = '$';");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Fill leading spaces");
      fprintf(FP_OUTPUT,"%s\n","  if (Spaces)");
      fprintf(FP_OUTPUT,"%s\n","    memset(BCX_RetStr, ' ', Spaces);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Fill zeros after spaces but only if needed");
      fprintf(FP_OUTPUT,"%s\n","  for (int i = 0; i < zero_pad; i++)");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr[Dollar + Spaces + i] = '0';");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Add percent sign if needed (suffix only, does NOT scale value)");
      fprintf(FP_OUTPUT,"%s\n","  if (Percent)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    len = (int)strlen(BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr[len] = '%';");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr[len + 1] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Format ){
      fprintf(FP_OUTPUT,"%s\n","char * Format (long double Num, PCTSTR szMask)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr = BCX_TempStr(256);");
      fprintf(FP_OUTPUT,"%s\n","   char Buf_1[256] = {0};");
      fprintf(FP_OUTPUT,"%s\n","   if (!szMask || strlen(szMask) == 0)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s%s%s\n","       sprintf(BCX_RetStr, ",enc("%.6f"),", (double)Num);");
      fprintf(FP_OUTPUT,"%s\n","       // Remove trailing zeros and decimal if not needed");
      fprintf(FP_OUTPUT,"%s\n","       char *end =  BCX_RetStr + strlen(BCX_RetStr) - 1;");
      fprintf(FP_OUTPUT,"%s\n","       while (end > BCX_RetStr && *end == '0') *end-- = 0;");
      fprintf(FP_OUTPUT,"%s\n","       if (end > BCX_RetStr && *end == '.') *end = 0;");
      fprintf(FP_OUTPUT,"%s\n","       return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   PCTSTR current_mask = szMask;");
      fprintf(FP_OUTPUT,"%s\n","   int zeros_left    = 0;   //  Count of zeros to left of decimal");
      fprintf(FP_OUTPUT,"%s\n","   int zeros_right   = 0;   //  Count of zeros to right of decimal");
      fprintf(FP_OUTPUT,"%s\n","   int hash_left     = 0;   //  Count of # to left of decimal");
      fprintf(FP_OUTPUT,"%s\n","   int hash_right    = 0;   //  Count of # to right of decimal");
      fprintf(FP_OUTPUT,"%s\n","   int has_decimal   = 0;   //  Has decimal point");
      fprintf(FP_OUTPUT,"%s\n","   int has_percent   = 0;   //  Has percent sign");
      fprintf(FP_OUTPUT,"%s\n","   int has_comma     = 0;   //  Has comma separator");
      fprintf(FP_OUTPUT,"%s\n","   int sci_notation  = 0;   //  Scientific notation (E+, E-, e+, e-)");
      fprintf(FP_OUTPUT,"%s\n","   int sci_plus      = 0;   //  Use + for positive exponents");
      fprintf(FP_OUTPUT,"%s\n","   int sci_uppercase = 0;   //  Use uppercase E");
      fprintf(FP_OUTPUT,"%s\n","   int fill_char     = 0;   //  Fill character for * format");
      fprintf(FP_OUTPUT,"%s\n","   int literal_chars = 0;   //  Count of literal characters");
      fprintf(FP_OUTPUT,"%s\n","   int past_decimal  = 0;");
      fprintf(FP_OUTPUT,"%s\n","   int space_for_positive = 0;  // Space for positive numbers flag");
      fprintf(FP_OUTPUT,"%s\n","   int has_plus_sign = 0;       // Has explicit + sign");
      fprintf(FP_OUTPUT,"%s\n","   int mask_has_parentheses = 0; // Mask contains parentheses as literals");
      fprintf(FP_OUTPUT,"%s\n","   char mask_prefix[32] = {0};  // Characters before number pattern");
      fprintf(FP_OUTPUT,"%s\n","   char mask_suffix[32] = {0};  // Characters after number pattern");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Check if mask has parentheses as literal characters");
      fprintf(FP_OUTPUT,"%s\n","   int mask_len = (int)strlen(current_mask);");
      fprintf(FP_OUTPUT,"%s\n","   if (mask_len >= 2 && current_mask[0] == '(' && current_mask[mask_len-1] == ')')");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       mask_has_parentheses = 1;");
      fprintf(FP_OUTPUT,"%s\n","       // Extract prefix and suffix (the parentheses)");
      fprintf(FP_OUTPUT,"%s\n","       mask_prefix[0] = '(';");
      fprintf(FP_OUTPUT,"%s\n","       mask_prefix[1] = 0;");
      fprintf(FP_OUTPUT,"%s\n","       mask_suffix[0] = ')';");
      fprintf(FP_OUTPUT,"%s\n","       mask_suffix[1] = 0;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Check for space-for-positive pattern ( +)");
      fprintf(FP_OUTPUT,"%s\n","   if (mask_len >= 2 && current_mask[0] == ' ' && current_mask[1] == '+')");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       space_for_positive = 1;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // Check for explicit + sign without space");
      fprintf(FP_OUTPUT,"%s\n","   else if (current_mask[0] == '+')");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       has_plus_sign = 1;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   PCTSTR p = current_mask;");
      fprintf(FP_OUTPUT,"%s\n","   // If mask has parentheses, skip them during pattern parsing but include everything else");
      fprintf(FP_OUTPUT,"%s\n","   int skip_count = 0;");
      fprintf(FP_OUTPUT,"%s\n","   if (mask_has_parentheses)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       p++;  // Skip opening parenthesis");
      fprintf(FP_OUTPUT,"%s\n","       skip_count = 1;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   ");
      fprintf(FP_OUTPUT,"%s\n","   while (*p && (skip_count == 0 || p < current_mask + mask_len - 1))");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       switch (*p)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           case ' ':");
      fprintf(FP_OUTPUT,"%s\n","               // Count spaces (we'll insert leading spaces later) ");
      fprintf(FP_OUTPUT,"%s\n","               if (!space_for_positive || p != current_mask)");
      fprintf(FP_OUTPUT,"%s\n","                   literal_chars++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case '+':");
      fprintf(FP_OUTPUT,"%s\n","               // Skip + if it's part of space-for-positive pattern");
      fprintf(FP_OUTPUT,"%s\n","               if (!space_for_positive || p != current_mask + 1)");
      fprintf(FP_OUTPUT,"%s\n","                   literal_chars++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case '0':");
      fprintf(FP_OUTPUT,"%s\n","               if (past_decimal) zeros_right++;");
      fprintf(FP_OUTPUT,"%s\n","               else zeros_left++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case '#':");
      fprintf(FP_OUTPUT,"%s\n","               if (past_decimal) hash_right++;");
      fprintf(FP_OUTPUT,"%s\n","               else hash_left++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case '.':");
      fprintf(FP_OUTPUT,"%s\n","               has_decimal = 1;");
      fprintf(FP_OUTPUT,"%s\n","               past_decimal = 1;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case '%':");
      fprintf(FP_OUTPUT,"%s\n","               has_percent = 1;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case ',':");
      fprintf(FP_OUTPUT,"%s\n","               has_comma = 1;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case 'E':");
      fprintf(FP_OUTPUT,"%s\n","               sci_uppercase = 1;");
      fprintf(FP_OUTPUT,"%s\n","               // Fall through");
      fprintf(FP_OUTPUT,"%s\n","           case 'e':");
      fprintf(FP_OUTPUT,"%s\n","               if (*(p+1) == '+' || *(p+1) == '-')");
      fprintf(FP_OUTPUT,"%s\n","               {");
      fprintf(FP_OUTPUT,"%s\n","                   sci_notation = 1;");
      fprintf(FP_OUTPUT,"%s\n","                   if (*(p+1) == '+') sci_plus = 1;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case '*':");
      fprintf(FP_OUTPUT,"%s\n","               if (*(p+1)) {");
      fprintf(FP_OUTPUT,"%s\n","                   fill_char = *(p+1);");
      fprintf(FP_OUTPUT,"%s\n","                   p++;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case 92:");
      fprintf(FP_OUTPUT,"%s\n","               literal_chars++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","           case 34:");
      fprintf(FP_OUTPUT,"%s\n","               // Count characters inside quotes as literals");
      fprintf(FP_OUTPUT,"%s\n","               p++;");
      fprintf(FP_OUTPUT,"%s\n","               while (*p && *p != 34)");
      fprintf(FP_OUTPUT,"%s\n","               {");
      fprintf(FP_OUTPUT,"%s\n","                   literal_chars++;");
      fprintf(FP_OUTPUT,"%s\n","                   p++;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       p++;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // Count leading spaces in mask so we can insert them into the output");
      fprintf(FP_OUTPUT,"%s\n","   int leading_spaces = 0;");
      fprintf(FP_OUTPUT,"%s\n","   char *ms = (char*)current_mask;");
      fprintf(FP_OUTPUT,"%s\n","   if (space_for_positive)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       // Skip the initial space and + for space-for-positive");
      fprintf(FP_OUTPUT,"%s\n","       ms += 2;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   else if (has_plus_sign)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       // Skip the + sign");
      fprintf(FP_OUTPUT,"%s\n","       ms += 1;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // If mask has parentheses, skip the opening parenthesis for space counting");
      fprintf(FP_OUTPUT,"%s\n","   if (mask_has_parentheses && *ms == '(')");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       ms++;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   while (*ms == ' ') { leading_spaces++; ms++; }");
      fprintf(FP_OUTPUT,"%s\n","   // Apply percent conversion");
      fprintf(FP_OUTPUT,"%s\n","   long double work_num = Num;");
      fprintf(FP_OUTPUT,"%s\n","   if (has_percent) work_num *= 100.0L;");
      fprintf(FP_OUTPUT,"%s\n","   ");
      fprintf(FP_OUTPUT,"%s\n","   // Process scientific notation");
      fprintf(FP_OUTPUT,"%s\n","   if (sci_notation)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       // Count decimal places from the mask pattern");
      fprintf(FP_OUTPUT,"%s\n","       int precision = 0;");
      fprintf(FP_OUTPUT,"%s\n","       PCTSTR mask_p = current_mask;");
      fprintf(FP_OUTPUT,"%s\n","       int found_decimal = 0;");
      fprintf(FP_OUTPUT,"%s\n","       while (*mask_p && (*mask_p != 'E' && *mask_p != 'e'))");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           if (found_decimal && (*mask_p == '0' || *mask_p == '#'))");
      fprintf(FP_OUTPUT,"%s\n","               precision++;");
      fprintf(FP_OUTPUT,"%s\n","           else if (*mask_p == '.')");
      fprintf(FP_OUTPUT,"%s\n","               found_decimal = 1;");
      fprintf(FP_OUTPUT,"%s\n","           mask_p++;");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       if (precision == 0) precision = 2; // Default precision");
      fprintf(FP_OUTPUT,"%s\n","       char fmt[32];");
      fprintf(FP_OUTPUT,"%s\n","       if (sci_uppercase)");
      fprintf(FP_OUTPUT,"%s%s%s\n","           sprintf(fmt, ",enc("%%.%dE"),", precision);");
      fprintf(FP_OUTPUT,"%s\n","       else");
      fprintf(FP_OUTPUT,"%s%s%s\n","           sprintf(fmt, ",enc("%%.%de"),", precision);");
      fprintf(FP_OUTPUT,"%s\n","       sprintf(BCX_RetStr, fmt, (double)work_num);");
      fprintf(FP_OUTPUT,"%s\n","       ");
      fprintf(FP_OUTPUT,"%s\n","       // Fix exponent formatting to match expected output");
      fprintf(FP_OUTPUT,"%s%s%s\n","       char *e_pos = strpbrk(BCX_RetStr, ",enc("Ee"),");");
      fprintf(FP_OUTPUT,"%s\n","       if (e_pos)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           char *exp_start = e_pos + 1;");
      fprintf(FP_OUTPUT,"%s\n","           int exp_val = 0;");
      fprintf(FP_OUTPUT,"%s\n","           int is_negative = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           // Parse the exponent value");
      fprintf(FP_OUTPUT,"%s\n","           if (*exp_start == '+' || *exp_start == '-')");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               is_negative = (*exp_start == '-');");
      fprintf(FP_OUTPUT,"%s\n","               exp_val = atoi(exp_start + 1);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","           else");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               exp_val = atoi(exp_start);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           // Format exponent correctly based on pattern");
      fprintf(FP_OUTPUT,"%s\n","           if (sci_plus)");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               // Always show sign (E+00 or E-00)");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","               sprintf(exp_start, is_negative ? ",enc("-%02d")," : ",enc("+%02d"),", exp_val);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","           else");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               // Only show - for negative (e-00 or e00)");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","               sprintf(exp_start, is_negative ? ",enc("-%02d")," : ",enc("%02d"),", exp_val);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s%s%s\n","       if (has_percent) strcat(BCX_RetStr, ",enc("%"),");");
      fprintf(FP_OUTPUT,"%s\n","       // Add parentheses if mask had them");
      fprintf(FP_OUTPUT,"%s\n","       if (mask_has_parentheses)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           char temp[256];");
      fprintf(FP_OUTPUT,"%s\n","           strcpy(temp, BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s%s%s\n","           sprintf(BCX_RetStr, ",enc("%s%s%s"),", mask_prefix, temp, mask_suffix);");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Handle fill character patterns first");
      fprintf(FP_OUTPUT,"%s\n","   if (fill_char)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       // Count total digit positions needed");
      fprintf(FP_OUTPUT,"%s\n","       int total_positions = zeros_left + hash_left;");
      fprintf(FP_OUTPUT,"%s\n","       if (total_positions > 0)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           // Format number as string first");
      fprintf(FP_OUTPUT,"%s\n","           char temp_num[64];");
      fprintf(FP_OUTPUT,"%s%s%s\n","           sprintf(temp_num, ",enc("%.0Lf"),", work_num);");
      fprintf(FP_OUTPUT,"%s\n","           int num_len = (int)strlen(temp_num);");
      fprintf(FP_OUTPUT,"%s\n","           if (temp_num[0] == '-') num_len--; // Don't count minus sign");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           // Build result with fill character");
      fprintf(FP_OUTPUT,"%s\n","           memset(BCX_RetStr, 0, 256);");
      fprintf(FP_OUTPUT,"%s\n","           int pos = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           // Add negative sign if needed");
      fprintf(FP_OUTPUT,"%s\n","           if (temp_num[0] == '-')");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               BCX_RetStr[pos++] = '-';");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           // Add fill characters");
      fprintf(FP_OUTPUT,"%s\n","           int actual_digits = (temp_num[0] == '-') ? num_len : num_len;");
      fprintf(FP_OUTPUT,"%s\n","           for (int i = actual_digits; i < total_positions; i++)");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               BCX_RetStr[pos++] = (char)fill_char;");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           // Add the number (without sign if already added)");
      fprintf(FP_OUTPUT,"%s\n","           strcpy(BCX_RetStr + pos, (temp_num[0] == '-') ? temp_num + 1 : temp_num);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s%s%s\n","           if (has_percent) strcat(BCX_RetStr, ",enc("%"),");");
      fprintf(FP_OUTPUT,"%s\n","           // Add parentheses if mask had them");
      fprintf(FP_OUTPUT,"%s\n","           if (mask_has_parentheses)");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               char temp[256];");
      fprintf(FP_OUTPUT,"%s\n","               strcpy(temp, BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s%s%s\n","               sprintf(BCX_RetStr, ",enc("%s%s%s"),", mask_prefix, temp, mask_suffix);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","           return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Calculate decimal places needed");
      fprintf(FP_OUTPUT,"%s\n","   int decimal_places = zeros_right + hash_right;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Format the basic number");
      fprintf(FP_OUTPUT,"%s\n","   if (decimal_places > 0 || has_decimal)");
      fprintf(FP_OUTPUT,"%s%s%s\n","       sprintf(Buf_1, ",enc("%.*Lf"),", decimal_places, work_num);");
      fprintf(FP_OUTPUT,"%s\n","   else");
      fprintf(FP_OUTPUT,"%s%s%s\n","       sprintf(Buf_1, ",enc("%.0Lf"),", work_num);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Remove trailing zeros for hash (#) format when no zeros specified");
      fprintf(FP_OUTPUT,"%s\n","   if (hash_right > 0 && zeros_right == 0 && strchr(Buf_1, '.'))");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       char *end = Buf_1 + strlen(Buf_1) - 1;");
      fprintf(FP_OUTPUT,"%s\n","       while (end > Buf_1 && *end == '0') *end-- = 0;");
      fprintf(FP_OUTPUT,"%s\n","       if (end > Buf_1 && *end == '.') *end = 0;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Process zero padding on the left");
      fprintf(FP_OUTPUT,"%s\n","   char *decimal_pos = strchr(Buf_1, '.');");
      fprintf(FP_OUTPUT,"%s\n","   int int_part_len = decimal_pos ? (int)(decimal_pos - Buf_1) : (int)strlen(Buf_1);");
      fprintf(FP_OUTPUT,"%s\n","   int has_negative = (Buf_1[0] == '-');");
      fprintf(FP_OUTPUT,"%s\n","   if (has_negative) int_part_len--;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   // Calculate total left padding needed");
      fprintf(FP_OUTPUT,"%s\n","   int total_left_digits = zeros_left + hash_left;");
      fprintf(FP_OUTPUT,"%s\n","   int padding_needed = 0;");
      fprintf(FP_OUTPUT,"%s\n","   if (total_left_digits > int_part_len)");
      fprintf(FP_OUTPUT,"%s\n","       padding_needed = total_left_digits - int_part_len;");
      fprintf(FP_OUTPUT,"%s\n","   memset(BCX_RetStr, 0, 256);  // Build the result string");
      fprintf(FP_OUTPUT,"%s\n","    if (has_negative && zeros_left > 0)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       // Negative with zero padding: -000123.45");
      fprintf(FP_OUTPUT,"%s\n","       *BCX_RetStr = '-';");
      fprintf(FP_OUTPUT,"%s\n","       for (int i = 0; i < padding_needed; i++)");
      fprintf(FP_OUTPUT,"%s\n","           BCX_RetStr[1 + i] = '0';");
      fprintf(FP_OUTPUT,"%s\n","       strcpy(BCX_RetStr + 1 + padding_needed, Buf_1 + 1);");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   else");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       // Positive or negative without zero padding");
      fprintf(FP_OUTPUT,"%s\n","       if (padding_needed > 0 && zeros_left > 0)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           for (int i = 0; i < padding_needed; i++)");
      fprintf(FP_OUTPUT,"%s\n","               BCX_RetStr[i] = '0';");
      fprintf(FP_OUTPUT,"%s\n","           strcpy(BCX_RetStr + padding_needed, Buf_1);");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       else");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           strcpy(BCX_RetStr, Buf_1); // No special padding");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // Handle explicit + sign for positive numbers");
      fprintf(FP_OUTPUT,"%s\n","   if (has_plus_sign && work_num >= 0 && BCX_RetStr[0] != '-')");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       int cur_len = (int)strlen(BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","       if (cur_len < 255)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           memmove(BCX_RetStr + 1, BCX_RetStr, cur_len + 1);");
      fprintf(FP_OUTPUT,"%s\n","           BCX_RetStr[0] = '+';");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // Handle space-for-positive formatting");
      fprintf(FP_OUTPUT,"%s\n","   if (space_for_positive)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       if (work_num >= 0 && BCX_RetStr[0] != '-')");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           // Insert space at beginning for positive numbers");
      fprintf(FP_OUTPUT,"%s\n","           int cur_len = (int)strlen(BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","           if (cur_len < 255)");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               memmove(BCX_RetStr + 1, BCX_RetStr, cur_len + 1);");
      fprintf(FP_OUTPUT,"%s\n","               BCX_RetStr[0] = ' ';");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // Insert leading mask spaces (if any)");
      fprintf(FP_OUTPUT,"%s\n","   if (leading_spaces > 0)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       int cur_len = (int)strlen(BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","       if (cur_len + leading_spaces < 256)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           memmove(BCX_RetStr + leading_spaces, BCX_RetStr, cur_len + 1);");
      fprintf(FP_OUTPUT,"%s\n","           for (int i = 0; i < leading_spaces; i++)");
      fprintf(FP_OUTPUT,"%s\n","               BCX_RetStr[i] = ' ';");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   if (has_comma)  // Add thousand separators (commas)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       char temp[256];");
      fprintf(FP_OUTPUT,"%s\n","       strcpy(temp, BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","       char *dec = strchr(temp, '.');   // Find where integer part ends");
      fprintf(FP_OUTPUT,"%s\n","       int int_end = dec ? (int)(dec - temp) : (int)strlen(temp);");
      fprintf(FP_OUTPUT,"%s\n","        // Add commas from right to left in integer part");
      fprintf(FP_OUTPUT,"%s\n","       for (int pos = int_end - 3; pos > 0; pos -= 3)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","           if (temp[pos-1] != '-' && temp[pos-1] != ' ' && temp[pos-1] != '+') // Don't add comma right after sign or space");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","               memmove(temp + pos + 1, temp + pos, strlen(temp + pos) + 1);");
      fprintf(FP_OUTPUT,"%s\n","               temp[pos] = ',';");
      fprintf(FP_OUTPUT,"%s\n","               int_end++; // Adjust end position");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       strcpy(BCX_RetStr, temp);");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s%s%s\n","   if (has_percent)  strcat(BCX_RetStr, ",enc("%"),");");
      fprintf(FP_OUTPUT,"%s\n","   ");
      fprintf(FP_OUTPUT,"%s\n","   // Add parentheses if mask had them as literal characters");
      fprintf(FP_OUTPUT,"%s\n","   if (mask_has_parentheses)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","       char temp[256];");
      fprintf(FP_OUTPUT,"%s\n","       strcpy(temp, BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s%s%s\n","       sprintf(BCX_RetStr, ",enc("%s%s%s"),", mask_prefix, temp, mask_suffix);");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   ");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SearchPath ){
      fprintf(FP_OUTPUT,"%s\n","char *SEARCHPATH (PCTSTR szFile)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(MAX_PATH+1);");
      fprintf(FP_OUTPUT,"%s\n","  PSTR lpbs = 0;");
      fprintf(FP_OUTPUT,"%s\n","  SearchPath(0, szFile, 0, MAX_PATH, BCX_RetStr, &lpbs);");
      fprintf(FP_OUTPUT,"%s\n","  if (lpbs) *lpbs = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_stricmp ){
      fprintf(FP_OUTPUT,"%s\n","int bcx_stricmp (PCTSTR szOne, PCTSTR szTwo)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char  c1 [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  char  c2 [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(c1,szOne);");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(c2,szTwo);");
      fprintf(FP_OUTPUT,"%s\n","  CharUpperA(c1);");
      fprintf(FP_OUTPUT,"%s\n","  CharUpperA(c2);");
      fprintf(FP_OUTPUT,"%s\n","  int counter=0;");
      fprintf(FP_OUTPUT,"%s\n","  for(;;)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if(c1[counter]^c2[counter])");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if(c1[counter]>c2[counter])");
      fprintf(FP_OUTPUT,"%s\n","        return  1;");
      fprintf(FP_OUTPUT,"%s\n","      return -1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if(!c1[counter]) return 0;");
      fprintf(FP_OUTPUT,"%s\n","    counter++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Stristr ){
      fprintf(FP_OUTPUT,"%s\n","char *_stristr_(PCTSTR Haystack, PCTSTR Needle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int mi = (-1);");
      fprintf(FP_OUTPUT,"%s\n","  while(Needle[++mi])");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Haystack[mi]==0) return 0;");
      fprintf(FP_OUTPUT,"%s\n","    if (UprCase[(unsigned char)Haystack[mi]] != UprCase[(unsigned char)Needle[mi]])");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      Haystack++;");
      fprintf(FP_OUTPUT,"%s\n","      mi = (-1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)Haystack;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_sziif ){
      fprintf(FP_OUTPUT,"%s\n","char *sziif (int cond, PCTSTR szOne, PCTSTR szTwo)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (cond!=0) return (char*)szOne;");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)szTwo;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Retain ){
      fprintf(FP_OUTPUT,"%s\n","char *Retain (PCTSTR Text, PCTSTR ValidChars)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(strlen(Text));");
      fprintf(FP_OUTPUT,"%s\n","  char *temp = BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  while(*Text)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (strchr(ValidChars, *Text)) *(temp++) = *Text;");
      fprintf(FP_OUTPUT,"%s\n","    Text++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_FormatPath2 (FILE* FP_OUTPUT)
{
  if(Use_LoadFile ){
      fprintf(FP_OUTPUT,"%s\n","char* LoadFile (PCTSTR lfName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  FILE* Channel;");
      fprintf(FP_OUTPUT,"%s\n","  char* BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exist(lfName))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(lof(lfName)+1);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    if ((Channel = fopen(lfName, ",enc("rb"),"))!=0)");
      fprintf(FP_OUTPUT,"%s\n","    GET(Channel, BCX_RetStr, lof(lfName));");
      fprintf(FP_OUTPUT,"%s\n","    fclose(Channel);");
      fprintf(FP_OUTPUT,"%s\n","    Channel = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(128);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    return strcpy(BCX_RetStr,",enc("Error: Cannot Access File or File Not Found. %s\\n"),");");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_PeekStr ){
      fprintf(FP_OUTPUT,"%s\n","char *peekstr (PVOID Src, int Count)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *Des = BCX_TempStr(Count);");
      fprintf(FP_OUTPUT,"%s\n","  memmove(Des, Src, Count);");
      fprintf(FP_OUTPUT,"%s\n","  return Des;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Getaddr ){
      fprintf(FP_OUTPUT,"%s\n","char *GetAddr (PVOID X)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   char *BCX_RetStr = BCX_TempStr(64);");
      fprintf(FP_OUTPUT,"%s\n","   // Cast pointer to uintptr_t so it safely adapts to 32-bit or 64-bit");
      fprintf(FP_OUTPUT,"%s%s%s\n","   snprintf(BCX_RetStr, 64, ",enc("0x%016")," PRIxPTR, (uintptr_t)X);");
      fprintf(FP_OUTPUT,"%s\n","   return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Setaddr ){
      fprintf(FP_OUTPUT,"%s\n","void SetAddr (int* Adr, int value)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   (*Adr)=value;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Inputbox ){
      fprintf(FP_OUTPUT,"%s\n","char *InputBox (PCTSTR Title, PCTSTR Prompt, PCTSTR Value, int iHide)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  CreatePrompter(Title, Prompt, Value, iHide);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr = BCX_TempStr(strlen(BCX_INPUTBOX_VAL));");
      fprintf(FP_OUTPUT,"%s\n","  return strcpy(BCX_RetStr, BCX_INPUTBOX_VAL);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CreatePrompter (PCTSTR Title, PCTSTR Prpt, PCTSTR Value, int iHide)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  LPDLGITEMTEMPLATE lpdit;");
      fprintf(FP_OUTPUT,"%s\n","  LPDLGTEMPLATE lpdt;");
      fprintf(FP_OUTPUT,"%s\n","  HINSTANCE hInst;");
      fprintf(FP_OUTPUT,"%s\n","  HGLOBAL hgbl;");
      fprintf(FP_OUTPUT,"%s\n","  LRESULT ret;");
      fprintf(FP_OUTPUT,"%s\n","  PWORD lpw;");
      fprintf(FP_OUTPUT,"%s\n","  PWSTR lpwsz;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG  MyStyle;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_CANCEL = 101;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_TEXT   = 102;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_EDIT   = 103;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_OK     = 104;");
      fprintf(FP_OUTPUT,"%s\n","  hgbl = GlobalAlloc(GMEM_ZEROINIT, 32767);");
      fprintf(FP_OUTPUT,"%s\n","  lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl);\n");
      fprintf(FP_OUTPUT,"%s\n","  MyStyle = WS_VISIBLE|DS_NOFAILCREATE|WS_BORDER|DS_CENTER|DS_SETFONT;");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the InputBox Window");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->style = MyStyle;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cdit = 4;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cx = 160;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cy =  70;");
      fprintf(FP_OUTPUT,"%s\n","  lpw = (PWORD)(lpdt+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, Title, -1, lpwsz, 1+strlen(Title)*2);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = DEFAULT_PITCH;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, ",enc("MS Sans Serif"),", -1, lpwsz, 27);");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the CANCEL button.");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************\n");
      fprintf(FP_OUTPUT,"%s\n","  lpw   = lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  lpdit = (LPDLGITEMTEMPLATE)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->x  = 95;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->y  = 31;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cx = 35;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cy = 12;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->id=(SHORT)ID_CANCEL;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->style = WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  lpw = (PWORD)(lpdit+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0xFFFF;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0x0080;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz  = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, ",enc("CANCEL"),", -1, lpwsz, 13);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the OK button.");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  lpw   = lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  lpdit = (LPDLGITEMTEMPLATE)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->x = 20;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->y = 31;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cx= 35;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cy= 12;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->id=(SHORT)ID_OK;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->style = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  lpw    = (PWORD)(lpdit+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0xFFFF;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0x0080;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz  = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, ",enc("OK"),", -1, lpwsz, 5);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the STATIC control");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  lpw   = lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  lpdit = (LPDLGITEMTEMPLATE)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->x  =  10;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->y  =   5;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cx = 140;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cy =  10;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->id=(SHORT)ID_TEXT;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->style = WS_CHILD|WS_VISIBLE|SS_LEFT;");
      fprintf(FP_OUTPUT,"%s\n","  lpw=(PWORD)(lpdit+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0xFFFF;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0x0082;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz  = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, Prpt, -1, lpwsz, 1+strlen(Prpt)*2);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;     // no creation data");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the EDIT control");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  lpw   = (PWORD)lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  lpdit = (LPDLGITEMTEMPLATE)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->x  =  10;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->y  =  15;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cx = 130;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cy =  12;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->id=(SHORT)ID_EDIT;");
      fprintf(FP_OUTPUT,"%s\n","  if (iHide==0)");
      fprintf(FP_OUTPUT,"%s\n","    lpdit->style = WS_CHILD|WS_TABSTOP|WS_VISIBLE|ES_AUTOHSCROLL|WS_BORDER;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    lpdit->style = ES_PASSWORD|WS_CHILD|WS_TABSTOP|WS_VISIBLE|ES_AUTOHSCROLL|WS_BORDER;");
      fprintf(FP_OUTPUT,"%s\n","  lpw    = (PWORD)(lpdit+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0xFFFF;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0x0081;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz  = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, Value, -1, lpwsz, 1+strlen(Value)*2);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  // ******************");
      fprintf(FP_OUTPUT,"%s\n","  GlobalUnlock(hgbl);");
      fprintf(FP_OUTPUT,"%s\n","  hInst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(0, GWLP_HINSTANCE);");
      fprintf(FP_OUTPUT,"%s\n","  ret = DialogBoxIndirect (hInst, (LPDLGTEMPLATE)hgbl, GetActiveWindow(), (DLGPROC)Prompter);");
      fprintf(FP_OUTPUT,"%s\n","  GlobalFree(hgbl);");
      fprintf(FP_OUTPUT,"%s\n","  return ret;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK Prompter (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ID_CANCEL = 101;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_EDIT   = 103;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_OK     = 104;\n");
      fprintf(FP_OUTPUT,"%s\n","  for(;;)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Msg == WM_INITDIALOG)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      SetFocus(GetDlgItem(hWnd, ID_EDIT));");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (Msg == WM_COMMAND)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (LOWORD(wParam) == ID_OK)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        GetDlgItemText(hWnd, ID_EDIT, BCX_INPUTBOX_VAL, BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","        EndDialog(hWnd, 0);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if (LOWORD(wParam) == ID_CANCEL)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        *BCX_INPUTBOX_VAL = 0;");
      fprintf(FP_OUTPUT,"%s\n","        SendMessage(hWnd, WM_CLOSE, 0, 0);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (Msg == WM_CLOSE)");
      fprintf(FP_OUTPUT,"%s\n","      EndDialog(hWnd, 0);");
      fprintf(FP_OUTPUT,"%s\n","    break;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetSpecialFolder ){
      fprintf(FP_OUTPUT,"%s\n","char *GetSpecialFolder (int nFolder, int bCreate, HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(MAX_PATH);");
      fprintf(FP_OUTPUT,"%s\n","  if (!SHGetSpecialFolderPath(hWnd, BCX_RetStr, nFolder, bCreate))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr[0]=0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetSpecialFolderex ){
      fprintf(FP_OUTPUT,"%s\n","char *GetSpecialFolderEx(const GUID KFID, ULONG KFFlag)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  PCHAR BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  CHAR  szBuffer[2048];");
      fprintf(FP_OUTPUT,"%s\n","  static PWSTR pwsBuffer;");
      fprintf(FP_OUTPUT,"%s\n","  if (NULL == pwsBuffer)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      pwsBuffer = (PWSTR)calloc(2048, sizeof(char)+1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  #ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","     int rc = SHGetKnownFolderPath(&KFID, KFFlag, 0, &pwsBuffer);");
      fprintf(FP_OUTPUT,"%s\n","  #else");
      fprintf(FP_OUTPUT,"%s\n","     int rc = SHGetKnownFolderPath(KFID, KFFlag, 0, &pwsBuffer);");
      fprintf(FP_OUTPUT,"%s\n","  #endif");
      fprintf(FP_OUTPUT,"%s\n","  if (S_OK == rc)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(szBuffer, WideToAnsi(pwsBuffer));");
      fprintf(FP_OUTPUT,"%s\n","      BCX_RetStr = BCX_TempStr(strlen(szBuffer));");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(BCX_RetStr, szBuffer);");
      fprintf(FP_OUTPUT,"%s\n","      return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetText ){
      fprintf(FP_OUTPUT,"%s\n","char *BCX_Get_Text (HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int tmpint;");
      fprintf(FP_OUTPUT,"%s\n","  tmpint = 1 + GetWindowTextLength(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  char *strtmp = BCX_TempStr(tmpint);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowText(hWnd,strtmp,tmpint);");
      fprintf(FP_OUTPUT,"%s\n","  return strtmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Bff ){
      fprintf(FP_OUTPUT,"%s\n","char *BFF(PCTSTR Instructions,int BIF_Flags,PCTSTR InitPath)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  CoInitialize(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  BROWSEINFO tBFF = {0, 0, 0, 0, 0, NULL, 0, 0};");
      fprintf(FP_OUTPUT,"%s\n","  LPITEMIDLIST lpIDList = {0};");
      fprintf(FP_OUTPUT,"%s\n","  tBFF.hwndOwner = GetActiveWindow();");
      fprintf(FP_OUTPUT,"%s\n","  tBFF.lpszTitle = Instructions;");
      fprintf(FP_OUTPUT,"%s\n","  tBFF.ulFlags = BIF_Flags;");
      fprintf(FP_OUTPUT,"%s\n","  if (InitPath)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    tBFF.lpfn = BFFCallBack;");
      fprintf(FP_OUTPUT,"%s\n","    tBFF.lParam = (LPARAM)InitPath;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  lpIDList = SHBrowseForFolder(&tBFF);");
      fprintf(FP_OUTPUT,"%s\n","  if (lpIDList != NULL)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SHGetPathFromIDList((LPITEMIDLIST)lpIDList, BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  CoTaskMemFree(lpIDList);");
      fprintf(FP_OUTPUT,"%s\n","  CoUninitialize();");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","int CALLBACK BFFCallBack (HWND hWnd, UINT Msg, LPARAM lparam, LPARAM lpData)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg == BFFM_INITIALIZED)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (GetFileAttributes((char*)lpData) != 0xffffffff)");
      fprintf(FP_OUTPUT,"%s\n","      SendMessage(hWnd,(UINT_PTR)BFFM_SETSELECTION, (WPARAM)TRUE, (LPARAM)(char*)lpData);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BcxSplitPath ){
      fprintf(FP_OUTPUT,"%s\n","char *BcxSplitPath (PCTSTR FPath, int mask)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!FPath) return BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = BCX_TempStr(strlen(FPath));");
      fprintf(FP_OUTPUT,"%s\n","  char tmp[MAX_PATH*4];");
      fprintf(FP_OUTPUT,"%s\n","  _splitpath(FPath, tmp, &tmp[MAX_PATH], &tmp[MAX_PATH*2], &tmp[MAX_PATH*3]);");
      fprintf(FP_OUTPUT,"%s\n","  if (mask & FDRV) strcat(BCX_RetStr, tmp);");
      fprintf(FP_OUTPUT,"%s\n","  if (mask & FPATH)strcat(BCX_RetStr, &tmp[MAX_PATH]);");
      fprintf(FP_OUTPUT,"%s\n","  if (mask & FNAME)strcat(BCX_RetStr, &tmp[MAX_PATH*2]);");
      fprintf(FP_OUTPUT,"%s\n","  if (mask & FEXT) strcat(BCX_RetStr, &tmp[MAX_PATH*3]);");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Path ){
      fprintf(FP_OUTPUT,"%s\n","char *BcxPath (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RegPath=BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(BCX_RegPath,RegString");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","         (HKEY_LOCAL_MACHINE,",enc("Software\\\\Bcx-32\\\\Bcx\\\\Settings"),",",enc("Path"),"));");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_RegPath[0] == 0)");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RegPath,RegString");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","           (HKEY_CURRENT_USER,",enc("Software\\\\Bcx-32\\\\Bcx\\\\Settings"),",",enc("Path"),"));");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_RegPath[0] == 0)");
      fprintf(FP_OUTPUT,"%s%s%s\n","    return strcpy(BCX_RegPath,",enc("Not Found"),");");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RegPath;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_LccPath ){
      fprintf(FP_OUTPUT,"%s\n","char *LccPath (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr={0};");
      fprintf(FP_OUTPUT,"%s\n","  static char LCC_Reg     [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  static char LCC_RegPath [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(LCC_Reg,",enc("Software\\\\lcc\\\\lcclnk\\\\"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(LCC_RegPath,(char*)RegString(HKEY_LOCAL_MACHINE, LCC_Reg,",enc("libpath"),"));");
      fprintf(FP_OUTPUT,"%s\n","  if (LCC_RegPath[0] == 0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    strcpy(LCC_RegPath, (char*)RegString(HKEY_CURRENT_USER, LCC_Reg,",enc("libpath"),"));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (strcmp(LCC_RegPath,",DDQ,")!=0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(260);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    return strcpy(BCX_RetStr, (char*)left(LCC_RegPath, InstrRev(LCC_RegPath,",enc("\\\\"),")));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr=BCX_TempStr(strlen(LCC_RegPath));");
      fprintf(FP_OUTPUT,"%s\n","    return strcpy(BCX_RetStr,LCC_RegPath);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_PellesPath ){
      fprintf(FP_OUTPUT,"%s\n","char *PellesPath (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr={0};");
      fprintf(FP_OUTPUT,"%s\n","  static char Pelles_Reg     [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  static char Pelles_RegPath [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(Pelles_Reg,",enc("Software\\\\Pelle Orinius\\\\PellesC\\\\Directories\\\\"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(Pelles_RegPath,(char*)RegString(HKEY_LOCAL_MACHINE,Pelles_Reg,",enc("PathDirs"),"));");
      fprintf(FP_OUTPUT,"%s\n","  if (Pelles_RegPath[0]==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    strcpy(Pelles_RegPath,(char*)RegString(HKEY_CURRENT_USER,Pelles_Reg,",enc("PathDirs"),"));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (strcmp(Pelles_RegPath,",DDQ,")!=0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr=BCX_TempStr(256);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    return strcpy(BCX_RetStr,(char*)left(Pelles_RegPath,InstrRev(Pelles_RegPath,",enc("\\\\"),")));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(strlen(Pelles_RegPath));");
      fprintf(FP_OUTPUT,"%s\n","    return strcpy(BCX_RetStr, Pelles_RegPath);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_RegString ){
      fprintf(FP_OUTPUT,"%s\n","char *RegString (HKEY hKey, PCTSTR RegPath, PCTSTR SubKey)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *Result = BCX_TempStr (BCXSTRSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  int BufferLen = BCXSTRSIZE;");
      fprintf(FP_OUTPUT,"%s\n","  if (!RegOpenKeyEx(hKey,RegPath,0,KEY_QUERY_VALUE,&hKey))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    RegQueryValueEx(hKey,SubKey,0,0,(PBYTE)Result,(PDWORD)&BufferLen);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RegCloseKey(hKey);");
      fprintf(FP_OUTPUT,"%s\n","  return Result;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_CreateRegString ){
      fprintf(FP_OUTPUT,"%s\n","void CreateRegString (HKEY HK, PCTSTR Key, PCTSTR VarName, PCTSTR Value)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HKEY  hKey;");
      fprintf(FP_OUTPUT,"%s\n","  char  Buff[100]={0};");
      fprintf(FP_OUTPUT,"%s\n","  ULONG  Result;");
      fprintf(FP_OUTPUT,"%s\n","  RegCreateKeyEx(HK,Key,0,Buff,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&hKey,&Result);");
      fprintf(FP_OUTPUT,"%s\n","  RegSetValueEx(hKey,VarName,0,REG_SZ,(PBYTE)Value,(ULONG)strlen(Value)+1);");
      fprintf(FP_OUTPUT,"%s\n","  RegCloseKey(hKey);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strtoken ){
      fprintf(FP_OUTPUT,"%s\n","char *StrToken (PCTSTR Source, PCTSTR TokenChar, int n)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  char *RetVal = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR Copy = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  int Posn = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int Find = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int LenSrc = (int)strlen(Source);");
      fprintf(FP_OUTPUT,"%s\n","  Copy = Source;");
      fprintf(FP_OUTPUT,"%s\n","  if (tally(Source,TokenChar)==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr=BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (n==1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(LenSrc);");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RetStr,(char*)extract(Source,TokenChar));");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (n>tally(Source,TokenChar)+1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr=BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while(*Copy)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*Copy==TokenChar[0]) Find++;");
      fprintf(FP_OUTPUT,"%s\n","    if (Find==n) break;");
      fprintf(FP_OUTPUT,"%s\n","    Copy++;");
      fprintf(FP_OUTPUT,"%s\n","    Posn++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (n==tally(Source,TokenChar)+1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Posn=LenSrc;");
      fprintf(FP_OUTPUT,"%s\n","    Copy=Source+Posn;");
      fprintf(FP_OUTPUT,"%s\n","    while(*Copy && Source[Posn]!=TokenChar[0])");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      Posn--;");
      fprintf(FP_OUTPUT,"%s\n","      Copy--;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RetVal = (char*)calloc(LenSrc+1,sizeof(char));");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(RetVal,(char*)mid(Source,1,Posn));");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(RetVal,(char*)mid(RetVal,InstrRev(RetVal,TokenChar)));");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr=BCX_TempStr(LenSrc);");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(BCX_RetStr,(char*)RemoveStr(RetVal,(char*)TokenChar));");
      fprintf(FP_OUTPUT,"%s\n","  if (RetVal)free(RetVal);");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_AnsiToWide ){
      fprintf(FP_OUTPUT,"%s\n","//<---UNICODE AWARE");
      fprintf(FP_OUTPUT,"%s\n","PWSTR AnsiToWide (PCSTR AnsiStr, UINT CodePage, ULONG dwFlags, BOOL NullTerm)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int AnsiByteLen;");
      fprintf(FP_OUTPUT,"%s\n","  if (NullTerm)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    AnsiByteLen=-1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    AnsiByteLen=(int)strlen(AnsiStr);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  int WideCharLen;");
      fprintf(FP_OUTPUT,"%s\n","  WideCharLen = MultiByteToWideChar(CodePage, dwFlags, AnsiStr, AnsiByteLen, 0, 0);");
      fprintf(FP_OUTPUT,"%s\n","  if (WideCharLen == 0) return (PWSTR)BCX_TempStr(2);");
      fprintf(FP_OUTPUT,"%s\n","  PWSTR WideStr;");
      fprintf(FP_OUTPUT,"%s\n","  WideStr = (PWSTR)BCX_TempStr(WideCharLen * sizeof(WCHAR));");
      fprintf(FP_OUTPUT,"%s\n","  MultiByteToWideChar(CodePage, dwFlags, AnsiStr, AnsiByteLen, WideStr, WideCharLen);");
      fprintf(FP_OUTPUT,"%s\n","  WideStr[WideCharLen] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return WideStr;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n","//>---UNICODE AWARE\n");
    }
  if(Use_WideToAnsi ){
      fprintf(FP_OUTPUT,"%s\n","//<---UNICODE AWARE");
      fprintf(FP_OUTPUT,"%s\n","char* WideToAnsi (PWSTR WideStr, UINT CodePage, ULONG dwFlags)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  UINT uLen;");
      fprintf(FP_OUTPUT,"%s\n","  uLen = WideCharToMultiByte(CodePage, dwFlags, WideStr,-1,0,0,0,0);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr = (char*)BCX_TempStr(uLen);");
      fprintf(FP_OUTPUT,"%s\n","  WideCharToMultiByte(CodePage, dwFlags, WideStr, -1, BCX_RetStr,uLen,0,0);");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n","//>---UNICODE AWARE\n");
    }
  if(Use_Mki ){
      fprintf(FP_OUTPUT,"%s\n","char *MKI (short cvt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static char temp[3];");
      fprintf(FP_OUTPUT,"%s\n","  return (char*)memmove(temp,&cvt,2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mkl ){
      fprintf(FP_OUTPUT,"%s\n","char *MKL (int cvt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static char temp[5];");
      fprintf(FP_OUTPUT,"%s\n","  return (char*) memmove(temp,&cvt,4);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mks ){
      fprintf(FP_OUTPUT,"%s\n","char *MKS (float cvt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static char temp[5];");
      fprintf(FP_OUTPUT,"%s\n","  return (char*) memmove(temp,&cvt,4);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mkd ){
      fprintf(FP_OUTPUT,"%s\n","char *MKD (double cvt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static char temp[9];");
      fprintf(FP_OUTPUT,"%s\n","  return (char*) memmove(temp,&cvt,8);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mkld ){
      fprintf(FP_OUTPUT,"%s\n","char *MKLD (long double cvt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static char temp[11];");
      fprintf(FP_OUTPUT,"%s\n","  return (char*) memmove(temp,&cvt,10);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cvi ){
      fprintf(FP_OUTPUT,"%s\n","short CVI (PCTSTR s)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return ((short*)s)[0];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cvl ){
      fprintf(FP_OUTPUT,"%s\n","long CVL (PCTSTR s)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return ((long*)s)[0];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cvs ){
      fprintf(FP_OUTPUT,"%s\n","float CVS (PCTSTR s)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return ((float*)s)[0];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cvd ){
      fprintf(FP_OUTPUT,"%s\n","double CVD (PCTSTR s)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return ((double*)s)[0];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cvld ){
      fprintf(FP_OUTPUT,"%s\n","long double CVLD (PCTSTR s)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return ((long double*)s)[0];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Eof ){
      fprintf(FP_OUTPUT,"%s\n","int EoF(FILE *filstream) {");
      fprintf(FP_OUTPUT,"%s\n","    int c;");
      fprintf(FP_OUTPUT,"%s\n","    // Validate file stream");
      fprintf(FP_OUTPUT,"%s\n","    if (filstream == NULL || ferror(filstream)) {");
      fprintf(FP_OUTPUT,"%s\n","        return -1; // Indicate error");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    // Read a character");
      fprintf(FP_OUTPUT,"%s\n","    c = fgetc(filstream);");
      fprintf(FP_OUTPUT,"%s\n","    if (c == EOF) {");
      fprintf(FP_OUTPUT,"%s\n","        if (ferror(filstream)) {");
      fprintf(FP_OUTPUT,"%s\n","            return -1; // File error");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        return 1; // True EOF");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    // Push back the character if it was not EOF");
      fprintf(FP_OUTPUT,"%s\n","    if (ungetc(c, filstream) == EOF) {");
      fprintf(FP_OUTPUT,"%s\n","        return -1; // ungetc failed");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return 0; // Not EOF");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_FileAttrClip1 (FILE* FP_OUTPUT)
{
  if(Use_NamePathFromFP==TRUE ){
      fprintf(FP_OUTPUT,"%s\n","char *NamePathFromFP (FILE *FP)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr={0};");
      fprintf(FP_OUTPUT,"%s\n","  char *szTmp={0};");
      fprintf(FP_OUTPUT,"%s\n","  szTmp = (char*)calloc(2048, 1);");
      fprintf(FP_OUTPUT,"%s\n","  if(GetFinalPathNameByHandle((HANDLE)_get_osfhandle(_fileno(FP)),szTmp,2047,0))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(szTmp, szTmp+4);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr = BCX_TempStr(strlen(szTmp));");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(BCX_RetStr,szTmp);");
      fprintf(FP_OUTPUT,"%s\n","  if (szTmp)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    free(szTmp);");
      fprintf(FP_OUTPUT,"%s\n","    szTmp = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Longestline ){
      fprintf(FP_OUTPUT,"%s\n","UINT LongestLine(PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  UINT Longest = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int Counter = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BYTE OneByte[1]={0};");
      fprintf(FP_OUTPUT,"%s\n","  FILE *FP = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  if (0xffffffff == GetFileAttributes(FName))");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  FP = fopen(FName, ",enc("rb"),");");
      fprintf(FP_OUTPUT,"%s\n","  if (FP == 0)   return 0;");
      fprintf(FP_OUTPUT,"%s\n","  while (!EoF(FP))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    *OneByte = 0;");
      fprintf(FP_OUTPUT,"%s\n","    Counter = 0;");
      fprintf(FP_OUTPUT,"%s\n","    while (*OneByte != 10)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      fread(OneByte, 1, 1, FP);");
      fprintf(FP_OUTPUT,"%s\n","      Counter++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    Counter--;");
      fprintf(FP_OUTPUT,"%s\n","    fseek(FP, -(Counter + 2), SEEK_CUR);");
      fprintf(FP_OUTPUT,"%s\n","    if (Counter > Longest)");
      fprintf(FP_OUTPUT,"%s\n","      Longest = Counter;");
      fprintf(FP_OUTPUT,"%s\n","    fseek(FP, (Counter + 2), SEEK_CUR);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (FP)fclose(FP);");
      fprintf(FP_OUTPUT,"%s\n","  return Longest;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Nextlinelen ){
      fprintf(FP_OUTPUT,"%s\n","UINT NextLineLen (FILE *FP)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int Counter=0;");
      fprintf(FP_OUTPUT,"%s\n","  BYTE  OneByte[1]={0};");
      fprintf(FP_OUTPUT,"%s\n","  while(*OneByte!=10)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    fread (OneByte,1,1,FP);");
      fprintf(FP_OUTPUT,"%s\n","    Counter++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  Counter--;");
      fprintf(FP_OUTPUT,"%s\n","  fseek (FP,-(Counter+2),SEEK_CUR);");
      fprintf(FP_OUTPUT,"%s\n","  return Counter;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_AppActivate ){
      fprintf(FP_OUTPUT,"%s\n","int AppActivate (PCTSTR Arg_Z)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int   CurThread;");
      fprintf(FP_OUTPUT,"%s\n","  int   NewThread;");
      fprintf(FP_OUTPUT,"%s\n","  int   Rc;");
      fprintf(FP_OUTPUT,"%s\n","  int   ArgLen;");
      fprintf(FP_OUTPUT,"%s\n","  char  Buffer[BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  HWND  hWnd;");
      fprintf(FP_OUTPUT,"%s\n","  *Buffer = 0;");
      fprintf(FP_OUTPUT,"%s\n","  ArgLen  = (int)strlen(Arg_Z);");
      fprintf(FP_OUTPUT,"%s\n","  CurThread = GetCurrentThreadId();");
      fprintf(FP_OUTPUT,"%s\n","  hWnd = GetForegroundWindow();");
      fprintf(FP_OUTPUT,"%s\n","  for(Rc=0; Rc<=1000; Rc++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);");
      fprintf(FP_OUTPUT,"%s\n","    GetWindowText(hWnd, Buffer, 256);");
      fprintf(FP_OUTPUT,"%s\n","    if (instr(left(lcase(Buffer), ArgLen), lcase(Arg_Z))) break;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Rc==1001) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  NewThread = GetWindowThreadProcessId(hWnd, NULL);");
      fprintf(FP_OUTPUT,"%s\n","  AttachThreadInput(CurThread, NewThread, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  SetActiveWindow(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Tix ){
      fprintf(FP_OUTPUT,"%s\n","static double  TIX_CPU_FREQ;");
      fprintf(FP_OUTPUT,"%s\n","static int64_t TIX_COUNTER;");
      fprintf(FP_OUTPUT,"%s\n","void TIX_START(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    LARGE_INTEGER li;");
      fprintf(FP_OUTPUT,"%s\n","    if (!QueryPerformanceFrequency(&li)) return;");
      fprintf(FP_OUTPUT,"%s\n","    TIX_CPU_FREQ = (double)li.QuadPart * 0.001;");
      fprintf(FP_OUTPUT,"%s\n","    QueryPerformanceCounter(&li);");
      fprintf(FP_OUTPUT,"%s\n","    TIX_COUNTER = li.QuadPart;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","double TIX_NOW(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    LARGE_INTEGER li;");
      fprintf(FP_OUTPUT,"%s\n","    QueryPerformanceCounter(&li);");
      fprintf(FP_OUTPUT,"%s\n","    return (double)(li.QuadPart - TIX_COUNTER)/TIX_CPU_FREQ;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cint ){
      fprintf(FP_OUTPUT,"%s\n","int Cint (double Arg_A)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return (Arg_A >= 0 ? (int)(Arg_A + 0.5) : (int)(Arg_A - 0.5));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Clng ){
      fprintf(FP_OUTPUT,"%s\n","long CLNG (double Arg_A)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  float   r = 0.5f;");
      fprintf(FP_OUTPUT,"%s\n","  double  a = Arg_A-(long)Arg_A;");
      fprintf(FP_OUTPUT,"%s\n","  if (Arg_A < 0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    r = -0.5;");
      fprintf(FP_OUTPUT,"%s\n","    a = -a;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (((long)Arg_A % 2) == 0 && a<= 0.5)");
      fprintf(FP_OUTPUT,"%s\n","    return (long)Arg_A;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    return (long)(Arg_A+r);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Isfolder ){
      fprintf(FP_OUTPUT,"%s\n","int isfolder (PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n"," DWORD attr = GetFileAttributes(FName);");
      fprintf(FP_OUTPUT,"%s\n"," return (attr != INVALID_FILE_ATTRIBUTES) &&");
      fprintf(FP_OUTPUT,"%s\n","        (attr & FILE_ATTRIBUTE_DIRECTORY);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Isfile ){
      fprintf(FP_OUTPUT,"%s\n","int isfile (PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n"," DWORD attr = GetFileAttributes(FName);");
      fprintf(FP_OUTPUT,"%s\n"," return (attr != INVALID_FILE_ATTRIBUTES) &&");
      fprintf(FP_OUTPUT,"%s\n","        !(attr & FILE_ATTRIBUTE_DIRECTORY);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Ishidden ){
      fprintf(FP_OUTPUT,"%s\n","int ishidden (PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n"," DWORD attr = GetFileAttributes(FName);");
      fprintf(FP_OUTPUT,"%s\n"," return (attr != INVALID_FILE_ATTRIBUTES) &&");
      fprintf(FP_OUTPUT,"%s\n","        (attr & FILE_ATTRIBUTE_HIDDEN);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Isreadonly ){
      fprintf(FP_OUTPUT,"%s\n","int isreadonly (PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n"," DWORD attr = GetFileAttributes(FName);");
      fprintf(FP_OUTPUT,"%s\n"," return (attr != INVALID_FILE_ATTRIBUTES) &&");
      fprintf(FP_OUTPUT,"%s\n","        (attr & FILE_ATTRIBUTE_READONLY);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Issystem ){
      fprintf(FP_OUTPUT,"%s\n","int issystem (PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n"," DWORD attr = GetFileAttributes(FName);");
      fprintf(FP_OUTPUT,"%s\n"," return (attr != INVALID_FILE_ATTRIBUTES) &&");
      fprintf(FP_OUTPUT,"%s\n","        (attr & FILE_ATTRIBUTE_SYSTEM);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Pause ){
      fprintf(FP_OUTPUT,"%s\n","void Pause(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  printf(",enc("\\n%s\\n"),",",enc("Press any key to continue . . ."),");");
      fprintf(FP_OUTPUT,"%s\n","  _getch();");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Clip_Gettextsize ){
      fprintf(FP_OUTPUT,"%s\n","int Clipboard_GetTextSize(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE  hGlob = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  WCHAR  *pWide = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  int     cblen = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (!OpenClipboard(NULL)) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  hGlob = GetClipboardData(CF_UNICODETEXT);");
      fprintf(FP_OUTPUT,"%s\n","  if (hGlob)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    pWide = (WCHAR*)GlobalLock(hGlob);");
      fprintf(FP_OUTPUT,"%s\n","    if (pWide)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      cblen = WideCharToMultiByte(CP_UTF8, 0, pWide, -1, NULL, 0, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","      GlobalUnlock(hGlob);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  CloseClipboard();");
      fprintf(FP_OUTPUT,"%s\n","  return cblen;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Clip_Gettext ){
      fprintf(FP_OUTPUT,"%s\n","char *Clipboard_GetText(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char   *BCX_RetStr = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  HGLOBAL hGlob      = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  WCHAR  *pWide      = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  int     nBytes     = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (!IsClipboardFormatAvailable(CF_UNICODETEXT))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (!OpenClipboard(NULL))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox(GetActiveWindow(),",enc("Cannot open clipboard!"),",",enc("Error!"),", 0);");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  hGlob = GetClipboardData(CF_UNICODETEXT);");
      fprintf(FP_OUTPUT,"%s\n","  if (hGlob)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    pWide = (WCHAR*)GlobalLock(hGlob);");
      fprintf(FP_OUTPUT,"%s\n","    if (pWide)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      nBytes = WideCharToMultiByte(CP_UTF8, 0, pWide, -1, NULL, 0, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","      BCX_RetStr = BCX_TempStr(nBytes);");
      fprintf(FP_OUTPUT,"%s\n","      WideCharToMultiByte(CP_UTF8, 0, pWide, -1, BCX_RetStr, nBytes, NULL, NULL);");
      fprintf(FP_OUTPUT,"%s\n","      GlobalUnlock(hGlob);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  CloseClipboard();");
      fprintf(FP_OUTPUT,"%s\n","  if (!BCX_RetStr) BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Clip_Settext ){
      fprintf(FP_OUTPUT,"%s\n","void Clipboard_SetText(const char *Txt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HGLOBAL hGlobMem = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  WCHAR  *pWide    = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  int     nWChars  = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Txt) return;");
      fprintf(FP_OUTPUT,"%s\n","  nWChars = MultiByteToWideChar(CP_UTF8, 0, Txt, -1, NULL, 0);");
      fprintf(FP_OUTPUT,"%s\n","  if (!nWChars) return;");
      fprintf(FP_OUTPUT,"%s\n","  hGlobMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, nWChars * sizeof(WCHAR));");
      fprintf(FP_OUTPUT,"%s\n","  if (!hGlobMem) return;");
      fprintf(FP_OUTPUT,"%s\n","  pWide = (WCHAR*)GlobalLock(hGlobMem);");
      fprintf(FP_OUTPUT,"%s\n","  if (!pWide)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    GlobalFree(hGlobMem);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  MultiByteToWideChar(CP_UTF8, 0, Txt, -1, pWide, nWChars);");
      fprintf(FP_OUTPUT,"%s\n","  GlobalUnlock(hGlobMem);");
      fprintf(FP_OUTPUT,"%s\n","  if (!OpenClipboard(NULL))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    GlobalFree(hGlobMem);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  EmptyClipboard();");
      fprintf(FP_OUTPUT,"%s\n","  SetClipboardData(CF_UNICODETEXT, hGlobMem);");
      fprintf(FP_OUTPUT,"%s\n","  CloseClipboard();");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Clip_Setbitmap ){
      fprintf(FP_OUTPUT,"%s\n","void Clipboard_SetBitmap (HBITMAP hBmp)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if((hBmp==NULL))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(),",enc("Cannot copy bitmap to clipboard"),",",enc("Invalid bitmap"),", 0);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  OpenClipboard(0);");
      fprintf(FP_OUTPUT,"%s\n","  EmptyClipboard();");
      fprintf(FP_OUTPUT,"%s\n","  SetClipboardData(CF_BITMAP,(HANDLE)hBmp);");
      fprintf(FP_OUTPUT,"%s\n","  CloseClipboard();");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Clip_Getbitmap ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP Clipboard_GetBitmap (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static HBITMAP  hBmp;");
      fprintf(FP_OUTPUT,"%s\n","  if(IsClipboardFormatAvailable(CF_BITMAP))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    OpenClipboard(0);");
      fprintf(FP_OUTPUT,"%s\n","    hBmp = (HBITMAP)GetClipboardData(CF_BITMAP);");
      fprintf(FP_OUTPUT,"%s\n","    CloseClipboard();");
      fprintf(FP_OUTPUT,"%s\n","    if(hBmp==NULL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","      MessageBox (GetActiveWindow(),",enc("Cannot retrieve bitmap from clipboard"),",",enc("Invalid bitmap"),", 0);");
      fprintf(FP_OUTPUT,"%s\n","      return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return hBmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Keypress ){
      fprintf(FP_OUTPUT,"%s\n","int keypress(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ch = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int ii = 0;");
      fprintf(FP_OUTPUT,"%s\n","  INPUT_RECORD InputRecord;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG Count = 0, cks;");
      fprintf(FP_OUTPUT,"%s\n","  WORD vkc, vsc;");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  ULONG OldConsoleMode;");
      fprintf(FP_OUTPUT,"%s\n","  static char uchr[] =");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    0x7E, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E,");
      fprintf(FP_OUTPUT,"%s\n","    0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x7C,");
      fprintf(FP_OUTPUT,"%s\n","    0x7B, 0x7D, 0x3A, 0x22, 0x3C, 0x3E, 0x3F,");
      fprintf(FP_OUTPUT,"%s\n","    0x60, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,");
      fprintf(FP_OUTPUT,"%s\n","    0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x5C,");
      fprintf(FP_OUTPUT,"%s\n","    0x5B, 0x5D, 0x3B, 0x27, 0x2C, 0x2E, 0x2F, 0x00");
      fprintf(FP_OUTPUT,"%s\n","  };");
      fprintf(FP_OUTPUT,"%s\n","  static char lchr[] =");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    0x60, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,");
      fprintf(FP_OUTPUT,"%s\n","    0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x5C,");
      fprintf(FP_OUTPUT,"%s\n","    0x5B, 0x5D, 0x3B, 0x27, 0x2C, 0x2E, 0x2F,");
      fprintf(FP_OUTPUT,"%s\n","    0x7E, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E,");
      fprintf(FP_OUTPUT,"%s\n","    0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x7C,");
      fprintf(FP_OUTPUT,"%s\n","    0x7B, 0x7D, 0x3A, 0x22, 0x3C, 0x3E, 0x3F, 0x00");
      fprintf(FP_OUTPUT,"%s\n","  };");
      fprintf(FP_OUTPUT,"%s\n","  PeekConsoleInput(hStdIn, &InputRecord, 1, &Count);");
      fprintf(FP_OUTPUT,"%s\n","  GetConsoleMode(hStdIn, &OldConsoleMode);");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleMode(hStdIn, 0);");
      fprintf(FP_OUTPUT,"%s\n","  do");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    ReadConsoleInput(hStdIn, &InputRecord, 1, &Count);");
      fprintf(FP_OUTPUT,"%s\n","    SetConsoleMode(hStdIn, OldConsoleMode);");
      fprintf(FP_OUTPUT,"%s\n","    if (Count && InputRecord.EventType == KEY_EVENT && InputRecord.Event.KeyEvent.bKeyDown)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      vkc = InputRecord.Event.KeyEvent.wVirtualKeyCode;");
      fprintf(FP_OUTPUT,"%s\n","      vsc = InputRecord.Event.KeyEvent.wVirtualScanCode;");
      fprintf(FP_OUTPUT,"%s\n","      ch = InputRecord.Event.KeyEvent.uChar.AsciiChar;");
      fprintf(FP_OUTPUT,"%s\n","      cks = InputRecord.Event.KeyEvent.dwControlKeyState;");
      fprintf(FP_OUTPUT,"%s\n","      FlushConsoleInputBuffer(hStdIn);");
      fprintf(FP_OUTPUT,"%s\n","      if ((!ch && vsc > 58))");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if ((cks & 3))");
      fprintf(FP_OUTPUT,"%s\n","          return (1000 + vsc) * (-1);");
      fprintf(FP_OUTPUT,"%s\n","        if ((cks & 12))");
      fprintf(FP_OUTPUT,"%s\n","          return (2000 + vsc) * (-1);");
      fprintf(FP_OUTPUT,"%s\n","        return vsc * (-1);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if (ch && (cks & 3))");
      fprintf(FP_OUTPUT,"%s\n","        return vkc + 1000;");
      fprintf(FP_OUTPUT,"%s\n","      if ((vsc == 15) && (cks & 16))");
      fprintf(FP_OUTPUT,"%s\n","        return 15;");
      fprintf(FP_OUTPUT,"%s\n","      if (vkc == 27)");
      fprintf(FP_OUTPUT,"%s\n","        return 27;");
      fprintf(FP_OUTPUT,"%s\n","      if (ch && (cks & 128))");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        for (ii = 0; ii <= (int)strlen(lchr); ii++)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          if (uchr[ii] == ch)");
      fprintf(FP_OUTPUT,"%s\n","          {");
      fprintf(FP_OUTPUT,"%s\n","            ch = lchr[ii];");
      fprintf(FP_OUTPUT,"%s\n","            break;");
      fprintf(FP_OUTPUT,"%s\n","          }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if (ch)");
      fprintf(FP_OUTPUT,"%s\n","        return ch;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while (TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_InkeyD ){
      fprintf(FP_OUTPUT,"%s\n","int inkeyd(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ch = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int ii = 0;");
      fprintf(FP_OUTPUT,"%s\n","  INPUT_RECORD InputRecord;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG Count = 0, cks;");
      fprintf(FP_OUTPUT,"%s\n","  WORD vkc, vsc;");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE hStdIn = GetStdHandle(STD_INPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  ULONG OldConsoleMode;");
      fprintf(FP_OUTPUT,"%s\n","  static char uchr[] =");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    0x7E, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E,");
      fprintf(FP_OUTPUT,"%s\n","    0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x7C,");
      fprintf(FP_OUTPUT,"%s\n","    0x7B, 0x7D, 0x3A, 0x22, 0x3C, 0x3E, 0x3F,");
      fprintf(FP_OUTPUT,"%s\n","    0x60, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,");
      fprintf(FP_OUTPUT,"%s\n","    0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x5C,");
      fprintf(FP_OUTPUT,"%s\n","    0x5B, 0x5D, 0x3B, 0x27, 0x2C, 0x2E, 0x2F, 0x00");
      fprintf(FP_OUTPUT,"%s\n","  };");
      fprintf(FP_OUTPUT,"%s\n","  static char lchr[] =");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    0x60, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,");
      fprintf(FP_OUTPUT,"%s\n","    0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x5C,");
      fprintf(FP_OUTPUT,"%s\n","    0x5B, 0x5D, 0x3B, 0x27, 0x2C, 0x2E, 0x2F,");
      fprintf(FP_OUTPUT,"%s\n","    0x7E, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E,");
      fprintf(FP_OUTPUT,"%s\n","    0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x7C,");
      fprintf(FP_OUTPUT,"%s\n","    0x7B, 0x7D, 0x3A, 0x22, 0x3C, 0x3E, 0x3F, 0x00");
      fprintf(FP_OUTPUT,"%s\n","  };");
      fprintf(FP_OUTPUT,"%s\n","  PeekConsoleInput(hStdIn, &InputRecord, 1, &Count);");
      fprintf(FP_OUTPUT,"%s\n","  GetConsoleMode(hStdIn, &OldConsoleMode);");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleMode(hStdIn, 0);");
      fprintf(FP_OUTPUT,"%s\n","  ReadConsoleInput(hStdIn, &InputRecord, 1, &Count);");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleMode(hStdIn, OldConsoleMode);");
      fprintf(FP_OUTPUT,"%s\n","  if (Count && InputRecord.EventType == KEY_EVENT && InputRecord.Event.KeyEvent.bKeyDown)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    vkc = InputRecord.Event.KeyEvent.wVirtualKeyCode;");
      fprintf(FP_OUTPUT,"%s\n","    vsc = InputRecord.Event.KeyEvent.wVirtualScanCode;");
      fprintf(FP_OUTPUT,"%s\n","    ch = InputRecord.Event.KeyEvent.uChar.AsciiChar;");
      fprintf(FP_OUTPUT,"%s\n","    cks = InputRecord.Event.KeyEvent.dwControlKeyState;");
      fprintf(FP_OUTPUT,"%s\n","    FlushConsoleInputBuffer(hStdIn);");
      fprintf(FP_OUTPUT,"%s\n","    if (!ch && vsc > 58)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (cks & 3)");
      fprintf(FP_OUTPUT,"%s\n","        return (1000 + vsc) * (-1);");
      fprintf(FP_OUTPUT,"%s\n","      if (cks & 12)");
      fprintf(FP_OUTPUT,"%s\n","        return (2000 + vsc) * (-1);");
      fprintf(FP_OUTPUT,"%s\n","      return vsc * (-1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (ch && (cks & 3))");
      fprintf(FP_OUTPUT,"%s\n","      return vkc + 1000;");
      fprintf(FP_OUTPUT,"%s\n","    if ((vsc == 15) && (cks & 16))");
      fprintf(FP_OUTPUT,"%s\n","      return 15;");
      fprintf(FP_OUTPUT,"%s\n","    if (vkc == 27)");
      fprintf(FP_OUTPUT,"%s\n","      return 27;");
      fprintf(FP_OUTPUT,"%s\n","    if (ch && (cks & 128))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      for (ii = 0; ii <= (int)strlen(lchr); ii++)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (uchr[ii] == ch)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          ch = lchr[ii];");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (ch)");
      fprintf(FP_OUTPUT,"%s\n","      return ch;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Hook ){
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK SBProc (int Msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg==HCBT_ACTIVATE)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    HMONITOR     hMonitor={0};");
      fprintf(FP_OUTPUT,"%s\n","    MONITORINFO  MonitorInfo;");
      fprintf(FP_OUTPUT,"%s\n","    int          Width={0};");
      fprintf(FP_OUTPUT,"%s\n","    int          Height={0};");
      fprintf(FP_OUTPUT,"%s\n","    RECT         rc1;");
      fprintf(FP_OUTPUT,"%s\n","    memset(&MonitorInfo, 0, sizeof(MONITORINFO));");
      fprintf(FP_OUTPUT,"%s\n","    GetWindowRect((HWND)wParam, &rc1);");
      fprintf(FP_OUTPUT,"%s\n","    Width = rc1.right-rc1.left;");
      fprintf(FP_OUTPUT,"%s\n","    Height = rc1.bottom-rc1.top;");
      fprintf(FP_OUTPUT,"%s\n","    if(GetSystemMetrics(SM_CMONITORS) == 1)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","       hMonitor = MonitorFromRect(&rc1,MONITOR_DEFAULTTOPRIMARY);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","       hMonitor = MonitorFromRect(&rc1,MONITOR_DEFAULTTONEAREST);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    MonitorInfo.cbSize = sizeof(MONITORINFO);");
      fprintf(FP_OUTPUT,"%s\n","    GetMonitorInfo(hMonitor, &MonitorInfo);");
      fprintf(FP_OUTPUT,"%s\n","    rc1.left = MonitorInfo.rcWork.left+((MonitorInfo.rcWork.right-MonitorInfo.rcWork.left-Width)/2);");
      fprintf(FP_OUTPUT,"%s\n","    rc1.top = MonitorInfo.rcWork.top+((MonitorInfo.rcWork.bottom-MonitorInfo.rcWork.top-Height)/2);");
      fprintf(FP_OUTPUT,"%s\n","    rc1.right = rc1.left+Width;");
      fprintf(FP_OUTPUT,"%s\n","    rc1.bottom = rc1.top+Height;");
      fprintf(FP_OUTPUT,"%s\n","    SetWindowPos((HWND)wParam, NULL, rc1.left, rc1.top, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);");
      fprintf(FP_OUTPUT,"%s\n","    UnhookWindowsHookEx(CmDlgHook);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Instr ){
      fprintf(FP_OUTPUT,"%s\n","int instr(PCTSTR Haystack, PCTSTR Needle, int offset, int sensflag)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if(offset == 0) {return 0;}");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR s;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Haystack||!*Haystack||!Needle||!*Needle||offset>(int)strlen(Haystack)) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (sensflag)");
      fprintf(FP_OUTPUT,"%s\n","    s = _stristr_(offset > 0 ? Haystack + offset - 1 : Haystack, Needle);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    s = strstr(offset > 0 ? Haystack + offset - 1 : Haystack, Needle);");
      fprintf(FP_OUTPUT,"%s\n","  return s ? (int)(s-Haystack)+1 : 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IInstr ){
      fprintf(FP_OUTPUT,"%s\n","int iinstr(PCTSTR Haystack, PCTSTR Needle, int offset)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if(offset == 0) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR s;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Haystack||!*Haystack||!Needle||!*Needle||offset>=(int)strlen(Haystack)) return 0;");
      fprintf(FP_OUTPUT,"%s\n","    s = _stristr_(offset > 0 ? Haystack + offset-1 : Haystack, Needle);");
      fprintf(FP_OUTPUT,"%s\n","  return s ? (int)(s-Haystack)+1 : 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IInstrAny||Use_InstrAny ){
      fprintf(FP_OUTPUT,"%s\n","int DeDupeCompare(const void *a, const void *b) {");
      fprintf(FP_OUTPUT,"%s\n","    return (*(char*)a - *(char*)b);");
      fprintf(FP_OUTPUT,"%s\n","}");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","char* DeDupeSort(const char* input) {");
      fprintf(FP_OUTPUT,"%s\n","    int CharFreq[256]={0}; ");
      fprintf(FP_OUTPUT,"%s\n","    int length = (int)strlen(input);");
      fprintf(FP_OUTPUT,"%s\n","    char *result = (char*)malloc(length + 1);");
      fprintf(FP_OUTPUT,"%s\n","    int index = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Iterate over each character in the input string");
      fprintf(FP_OUTPUT,"%s\n","    for (int i = 0; i < length; i++) {");
      fprintf(FP_OUTPUT,"%s\n","        unsigned char ch = input[i];");
      fprintf(FP_OUTPUT,"%s\n","        if (CharFreq[ch] == 0) { // If character not encountered before");
      fprintf(FP_OUTPUT,"%s\n","            CharFreq[ch] = 1;");
      fprintf(FP_OUTPUT,"%s\n","            result[index++] = ch; // Add character to the result");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    result[index] = 0;  ");
      fprintf(FP_OUTPUT,"%s\n","    qsort(result, index, sizeof(char), DeDupeCompare);");
      fprintf(FP_OUTPUT,"%s\n","    return result; ");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_InstrAny ){
      fprintf(FP_OUTPUT,"%s\n","int InstrAny (PCTSTR Main, PCTSTR Words, int Start)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char Buffer[BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  strcpy (Buffer, DeDupeSort(Words));");
      fprintf(FP_OUTPUT,"%s\n","  int BufLen = (int)strlen(Buffer);");
      fprintf(FP_OUTPUT,"%s\n","  for(int i = 1; i <= BufLen; i++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    int Found = instr(Main, mid(Buffer, i, 1), Start, 0);");
      fprintf(FP_OUTPUT,"%s\n","    if (Found) return Found;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IInstrAny ){
      fprintf(FP_OUTPUT,"%s\n","int IInstrAny (PCTSTR Main, PCTSTR Words, int Start)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char Buffer[BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  strcpy (Buffer, DeDupeSort(Words));");
      fprintf(FP_OUTPUT,"%s\n","  int BufLen = (int)strlen(Buffer);");
      fprintf(FP_OUTPUT,"%s\n","  for(int i = 1; i <= BufLen; i++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    int Found = iinstr(Main, mid(Buffer, i, 1), Start);");
      fprintf(FP_OUTPUT,"%s\n","    if (Found) return Found;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Instrrev ){
      fprintf(FP_OUTPUT,"%s\n","int InstrRev (PCTSTR Haystack, PCTSTR Needle, int offset, int sens)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int sl, pl, ox;");
      fprintf(FP_OUTPUT,"%s\n","  int (*cmp)(PCTSTR, PCTSTR, size_t);");
      fprintf(FP_OUTPUT,"%s\n","  if (!Haystack || !Needle)  return 0;");
      fprintf(FP_OUTPUT,"%s\n","  sl = (int)strlen(Haystack); pl  = (int)strlen(Needle);");
      fprintf(FP_OUTPUT,"%s\n","  if (offset > sl || 0 == sl || 0 == pl || (ox = sl - pl) < 0)");
      fprintf(FP_OUTPUT,"%s\n","     return 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (offset <= 0)");
      fprintf(FP_OUTPUT,"%s\n","     offset = ox ;");
      fprintf(FP_OUTPUT,"%s\n","  else if (offset >= pl)");
      fprintf(FP_OUTPUT,"%s\n","     offset = offset - pl ;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","     return 0;");
      fprintf(FP_OUTPUT,"%s\n","  cmp = (sens ? _strnicmp : strncmp);");
      fprintf(FP_OUTPUT,"%s\n","  do");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","     if (cmp(Haystack + offset , Needle, pl) == 0)");
      fprintf(FP_OUTPUT,"%s\n","        return offset+1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while (offset--);");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_FileAttrClip2 (FILE* FP_OUTPUT)
{
  if(Use_Like_Instr ){
      fprintf(FP_OUTPUT,"%s\n","static int MatchPattern(PCTSTR Buffer, PCTSTR Pattern, int BufferPos, int PatternPos) {");
      fprintf(FP_OUTPUT,"%s\n","   int BufferLen = (int)strlen(Buffer);");
      fprintf(FP_OUTPUT,"%s\n","   int PatternLen = (int)strlen(Pattern);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   while (PatternPos <= PatternLen && BufferPos <= BufferLen) {");
      fprintf(FP_OUTPUT,"%s\n","       if (PatternPos > PatternLen) {");
      fprintf(FP_OUTPUT,"%s\n","           // Pattern exhausted - success if buffer is also exhausted");
      fprintf(FP_OUTPUT,"%s\n","           return (BufferPos > BufferLen);");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","       int PatternChar = (PatternPos <= PatternLen) ? Pattern[PatternPos - 1] : 0;");
      fprintf(FP_OUTPUT,"%s\n","       switch (PatternChar) {");
      fprintf(FP_OUTPUT,"%s\n","           case '*':");
      fprintf(FP_OUTPUT,"%s\n","               // Wildcard - try matching rest of pattern from each remaining position");
      fprintf(FP_OUTPUT,"%s\n","               PatternPos++;");
      fprintf(FP_OUTPUT,"%s\n","               if (PatternPos > PatternLen) {");
      fprintf(FP_OUTPUT,"%s\n","                   // Pattern ends with *, so it matches");
      fprintf(FP_OUTPUT,"%s\n","                   return 1;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               // Try matching the rest of the pattern from current position onwards");
      fprintf(FP_OUTPUT,"%s\n","               for (int i = BufferPos; i <= BufferLen + 1; i++) {");
      fprintf(FP_OUTPUT,"%s\n","                   if (MatchPattern(Buffer, Pattern, i, PatternPos)) {");
      fprintf(FP_OUTPUT,"%s\n","                       return 1;");
      fprintf(FP_OUTPUT,"%s\n","                   }");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               return 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","           case '?':");
      fprintf(FP_OUTPUT,"%s\n","               // Single character wildcard");
      fprintf(FP_OUTPUT,"%s\n","               if (BufferPos > BufferLen) {");
      fprintf(FP_OUTPUT,"%s\n","                   return 0;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               BufferPos++;");
      fprintf(FP_OUTPUT,"%s\n","               PatternPos++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","               ");
      fprintf(FP_OUTPUT,"%s\n","           case '#':");
      fprintf(FP_OUTPUT,"%s\n","               // Single digit wildcard");
      fprintf(FP_OUTPUT,"%s\n","               if (BufferPos > BufferLen) {");
      fprintf(FP_OUTPUT,"%s\n","                   return 0;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               if (!isdigit((unsigned char)Buffer[BufferPos - 1])) {");
      fprintf(FP_OUTPUT,"%s\n","                   return 0;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               BufferPos++;");
      fprintf(FP_OUTPUT,"%s\n","               PatternPos++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","               ");
      fprintf(FP_OUTPUT,"%s\n","           default:");
      fprintf(FP_OUTPUT,"%s\n","               // Literal character match");
      fprintf(FP_OUTPUT,"%s\n","               if (BufferPos > BufferLen) {");
      fprintf(FP_OUTPUT,"%s\n","                   return 0;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               if (Buffer[BufferPos - 1] != PatternChar) {");
      fprintf(FP_OUTPUT,"%s\n","                   return 0;");
      fprintf(FP_OUTPUT,"%s\n","               }");
      fprintf(FP_OUTPUT,"%s\n","               BufferPos++;");
      fprintf(FP_OUTPUT,"%s\n","               PatternPos++;");
      fprintf(FP_OUTPUT,"%s\n","               break;");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","   // Check if both pattern and buffer are exhausted");
      fprintf(FP_OUTPUT,"%s\n","   return (PatternPos > PatternLen && BufferPos > BufferLen);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","int Like_Instr(PCTSTR Buffer, PCTSTR Pattern) {");
      fprintf(FP_OUTPUT,"%s\n","    char UBuffer[BCXSTRSIZE] = {0};");
      fprintf(FP_OUTPUT,"%s\n","    char UPattern[BCXSTRSIZE] = {0};");
      fprintf(FP_OUTPUT,"%s\n","    int BufferLen = 0;");
      fprintf(FP_OUTPUT,"%s\n","    int PatternLen = 0;");
      fprintf(FP_OUTPUT,"%s\n","    int i, j, k;");
      fprintf(FP_OUTPUT,"%s\n","    if (Buffer[0] == 0 || Pattern[0] == 0) {");
      fprintf(FP_OUTPUT,"%s\n","        return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(UBuffer, ucase(Buffer));");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(UPattern, ucase(Pattern));");
      fprintf(FP_OUTPUT,"%s\n","    BufferLen = (int)strlen(UBuffer);");
      fprintf(FP_OUTPUT,"%s\n","    PatternLen = (int)strlen(UPattern);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (BufferLen == 0 || PatternLen == 0) {");
      fprintf(FP_OUTPUT,"%s\n","        return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    // Special handling for patterns starting with *");
      fprintf(FP_OUTPUT,"%s\n","    if (UPattern[0] == '*') {");
      fprintf(FP_OUTPUT,"%s\n","        // Find the literal part after the *");
      fprintf(FP_OUTPUT,"%s\n","        char LiteralPart[BCXSTRSIZE] = {0};");
      fprintf(FP_OUTPUT,"%s\n","        int LiteralLen = 0;");
      fprintf(FP_OUTPUT,"%s\n","        // Extract everything after the first *");
      fprintf(FP_OUTPUT,"%s\n","        for (i = 1; i < PatternLen; i++) {");
      fprintf(FP_OUTPUT,"%s\n","            LiteralPart[LiteralLen++] = UPattern[i];");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        LiteralPart[LiteralLen] = 0;");
      fprintf(FP_OUTPUT,"%s\n","        ");
      fprintf(FP_OUTPUT,"%s\n","        if (LiteralLen == 0) {");
      fprintf(FP_OUTPUT,"%s%s%s\n","            // Pattern is just ",enc("*"),", match at position 1");
      fprintf(FP_OUTPUT,"%s\n","            return 1;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        // Search for the literal part in the buffer");
      fprintf(FP_OUTPUT,"%s\n","        for (i = 1; i <= BufferLen - LiteralLen + 1; i++) {");
      fprintf(FP_OUTPUT,"%s\n","            int Match = 1;");
      fprintf(FP_OUTPUT,"%s\n","            for (j = 0; j < LiteralLen; j++) {");
      fprintf(FP_OUTPUT,"%s\n","                char BufferChar = UBuffer[i - 1 + j];");
      fprintf(FP_OUTPUT,"%s\n","                char PatternChar = LiteralPart[j];");
      fprintf(FP_OUTPUT,"%s\n","                if (PatternChar == '?') {");
      fprintf(FP_OUTPUT,"%s\n","                    // Single character wildcard - always matches");
      fprintf(FP_OUTPUT,"%s\n","                    continue;");
      fprintf(FP_OUTPUT,"%s\n","                } else if (PatternChar == '#') {");
      fprintf(FP_OUTPUT,"%s\n","                    // Single digit wildcard");
      fprintf(FP_OUTPUT,"%s\n","                    if (!isdigit((unsigned char)BufferChar)) {");
      fprintf(FP_OUTPUT,"%s\n","                        Match = 0;");
      fprintf(FP_OUTPUT,"%s\n","                        break;");
      fprintf(FP_OUTPUT,"%s\n","                    }");
      fprintf(FP_OUTPUT,"%s\n","                } else {");
      fprintf(FP_OUTPUT,"%s\n","                    // Literal character");
      fprintf(FP_OUTPUT,"%s\n","                    if (BufferChar != PatternChar) {");
      fprintf(FP_OUTPUT,"%s\n","                        Match = 0;");
      fprintf(FP_OUTPUT,"%s\n","                        break;");
      fprintf(FP_OUTPUT,"%s\n","                    }");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            if (Match) {");
      fprintf(FP_OUTPUT,"%s\n","                return i; // Return position where literal part starts");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        return 0; // No match found");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    for (i = 1; i <= BufferLen; i++) {");
      fprintf(FP_OUTPUT,"%s\n","        j = i;");
      fprintf(FP_OUTPUT,"%s\n","        k = 1;");
      fprintf(FP_OUTPUT,"%s\n","        int MatchFound = 1;");
      fprintf(FP_OUTPUT,"%s\n","        while (k <= PatternLen && j <= BufferLen && MatchFound) {");
      fprintf(FP_OUTPUT,"%s\n","            char PatternChar = UPattern[k-1];");
      fprintf(FP_OUTPUT,"%s\n","            char BufferChar = UBuffer[j-1];");
      fprintf(FP_OUTPUT,"%s\n","            ");
      fprintf(FP_OUTPUT,"%s\n","            if (PatternChar == '*') {");
      fprintf(FP_OUTPUT,"%s\n","                k++;");
      fprintf(FP_OUTPUT,"%s\n","                if (k > PatternLen) return i; ");
      fprintf(FP_OUTPUT,"%s\n","                ");
      fprintf(FP_OUTPUT,"%s\n","                while (j <= BufferLen) {");
      fprintf(FP_OUTPUT,"%s\n","                    if (Like_Instr(mid(UBuffer, j), mid(UPattern, k))) {");
      fprintf(FP_OUTPUT,"%s\n","                        return i;");
      fprintf(FP_OUTPUT,"%s\n","                    }");
      fprintf(FP_OUTPUT,"%s\n","                    j++;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                MatchFound = 0;");
      fprintf(FP_OUTPUT,"%s\n","            } else if (PatternChar == '#') {");
      fprintf(FP_OUTPUT,"%s\n","                if (!isdigit((unsigned char)BufferChar)) {");
      fprintf(FP_OUTPUT,"%s\n","                    MatchFound = 0;");
      fprintf(FP_OUTPUT,"%s\n","                } else {");
      fprintf(FP_OUTPUT,"%s\n","                    j++;");
      fprintf(FP_OUTPUT,"%s\n","                    k++;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","            } else if (PatternChar == '?') {");
      fprintf(FP_OUTPUT,"%s\n","                j++;");
      fprintf(FP_OUTPUT,"%s\n","                k++;");
      fprintf(FP_OUTPUT,"%s\n","            } else {");
      fprintf(FP_OUTPUT,"%s\n","                if (BufferChar != PatternChar) {");
      fprintf(FP_OUTPUT,"%s\n","                    MatchFound = 0;");
      fprintf(FP_OUTPUT,"%s\n","                } else {");
      fprintf(FP_OUTPUT,"%s\n","                    j++;");
      fprintf(FP_OUTPUT,"%s\n","                    k++;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (MatchFound && k > PatternLen) {");
      fprintf(FP_OUTPUT,"%s\n","            return i;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_LCaseTbl ){
      fprintf(FP_OUTPUT,"%s\n","unsigned char* MakeLCaseTbl (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static unsigned char tbl[257];");
      fprintf(FP_OUTPUT,"%s\n","  int ii; for (ii = 0; ii < 256; ii++)");
      fprintf(FP_OUTPUT,"%s\n","  tbl[ii] = (unsigned char) ii;");
      fprintf(FP_OUTPUT,"%s\n","  tbl[0] = 1;");
      fprintf(FP_OUTPUT,"%s\n","  tbl[256] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  CharLowerA((char *)tbl);");
      fprintf(FP_OUTPUT,"%s\n","  tbl[0] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return tbl;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_UCaseTbl ){
      fprintf(FP_OUTPUT,"%s\n","unsigned char* MakeUCaseTbl (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static unsigned char tbl[257];");
      fprintf(FP_OUTPUT,"%s\n","  int ii; for (ii = 0; ii < 256; ii++)");
      fprintf(FP_OUTPUT,"%s\n","  tbl[ii] = (unsigned char) ii;");
      fprintf(FP_OUTPUT,"%s\n","  tbl[0] = 1;");
      fprintf(FP_OUTPUT,"%s\n","  tbl[256] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  CharUpperA((char *)tbl);");
      fprintf(FP_OUTPUT,"%s\n","  tbl[0] = 0;");
      fprintf(FP_OUTPUT,"%s\n","  return tbl;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Inchr ){
      fprintf(FP_OUTPUT,"%s\n","int inchr (PCTSTR Haystack, PCTSTR Needle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR Idx = Haystack;");
      fprintf(FP_OUTPUT,"%s\n","  while(*Idx)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*Idx == *Needle) return (int)(Idx-Haystack)+1;");
      fprintf(FP_OUTPUT,"%s\n","    Idx++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Asc ){
      fprintf(FP_OUTPUT,"%s\n","extern int asc (PCTSTR z, int index)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return (unsigned char) z[index];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Sgn ){
      fprintf(FP_OUTPUT,"%s\n","double sgn (double a)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (a < 0) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  if (a > 0) return  1;");
      fprintf(FP_OUTPUT,"%s\n","  return  0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Round ){
      fprintf(FP_OUTPUT,"%s\n","double Round (double n, int d)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  double factor = pow(10.0, d);");
      fprintf(FP_OUTPUT,"%s\n","  return round(n * factor) / factor;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Exist ){
      fprintf(FP_OUTPUT,"%s\n","BOOL Exist (PCTSTR szFilePath)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    if (!szFilePath || !*szFilePath) return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","");
      fprintf(FP_OUTPUT,"%s\n","    if (_tcschr(szFilePath, _T('*')) || _tcschr(szFilePath, _T('?')))");
      fprintf(FP_OUTPUT,"%s\n","        return Exist_A(szFilePath);");
      fprintf(FP_OUTPUT,"%s\n","");
      fprintf(FP_OUTPUT,"%s\n","    return Exist_B(szFilePath);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","BOOL Exist_A (PCTSTR szFilePath)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    WIN32_FIND_DATA W32FindData;");
      fprintf(FP_OUTPUT,"%s\n","    HANDLE hFind = FindFirstFile(szFilePath, &W32FindData);");
      fprintf(FP_OUTPUT,"%s\n","    if (hFind == INVALID_HANDLE_VALUE) ");
      fprintf(FP_OUTPUT,"%s\n","        return FALSE;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    FindClose(hFind);");
      fprintf(FP_OUTPUT,"%s\n","    return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","BOOL Exist_B (PCTSTR szFilePath)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    WIN32_FILE_ATTRIBUTE_DATA fileInfo;");
      fprintf(FP_OUTPUT,"%s\n","    if (GetFileAttributesEx(szFilePath, GetFileExInfoStandard, &fileInfo))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","        // Returns TRUE if path exists (file or directory)");
      fprintf(FP_OUTPUT,"%s\n","        return TRUE; ");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Gethttpfilesize ){
      fprintf(FP_OUTPUT,"%s\n","ULONG GetHttpFileSize (PCTSTR url)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HINTERNET hInternet={0};");
      fprintf(FP_OUTPUT,"%s\n","  HINTERNET hConnect={0};");
      fprintf(FP_OUTPUT,"%s\n","  ULONG fileSize ={0};");
      fprintf(FP_OUTPUT,"%s\n","  ULONG bufferSize={0};");
      fprintf(FP_OUTPUT,"%s\n","  ULONG statusCode={0};");
      fprintf(FP_OUTPUT,"%s\n","  ULONG statusSize={0};");
      fprintf(FP_OUTPUT,"%s%s%s\n","  hInternet = InternetOpen(",enc("xcb"),", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);");
      fprintf(FP_OUTPUT,"%s\n","  if(hInternet == NULL ) {");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  hConnect = InternetOpenUrl(hInternet, url, NULL, 0, INTERNET_FLAG_RELOAD, 0);");
      fprintf(FP_OUTPUT,"%s\n","  if(hConnect == NULL ) {");
      fprintf(FP_OUTPUT,"%s\n","      InternetCloseHandle(hInternet);");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  statusSize = sizeof(ULONG);");
      fprintf(FP_OUTPUT,"%s\n","  if(!HttpQueryInfo(hConnect, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,");
      fprintf(FP_OUTPUT,"%s\n","                    &statusCode, &statusSize,NULL)) {");
      fprintf(FP_OUTPUT,"%s\n","      InternetCloseHandle(hConnect);");
      fprintf(FP_OUTPUT,"%s\n","      InternetCloseHandle(hInternet);");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(statusCode != 200) {");
      fprintf(FP_OUTPUT,"%s\n","      InternetCloseHandle(hConnect);");
      fprintf(FP_OUTPUT,"%s\n","      InternetCloseHandle(hInternet);");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  bufferSize = sizeof(ULONG);");
      fprintf(FP_OUTPUT,"%s\n","  if(!HttpQueryInfo(hConnect, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, ");
      fprintf(FP_OUTPUT,"%s\n","                    &fileSize, &bufferSize,NULL)) {");
      fprintf(FP_OUTPUT,"%s\n","      fileSize = 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  InternetCloseHandle(hConnect);");
      fprintf(FP_OUTPUT,"%s\n","  InternetCloseHandle(hInternet);");
      fprintf(FP_OUTPUT,"%s\n","  return fileSize;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Downloadtostr ){
      fprintf(FP_OUTPUT,"%s\n","char *DownloadToStr (PCTSTR Url)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr={0};");
      fprintf(FP_OUTPUT,"%s\n","  char  Fname[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(Fname, TempFileName(tempdir(),",enc("any"),"));");
      fprintf(FP_OUTPUT,"%s\n","  Download(Url, Fname);");
      fprintf(FP_OUTPUT,"%s\n","  char *Buffer;");
      fprintf(FP_OUTPUT,"%s\n","  Buffer = (char*)calloc(lof(Fname)+1, 1);");
      fprintf(FP_OUTPUT,"%s\n","  if(Exist(Fname)){");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(Buffer, LoadFile(Fname));");
      fprintf(FP_OUTPUT,"%s\n","      DeleteFile ((Fname));");
      fprintf(FP_OUTPUT,"%s\n","      BCX_RetStr = BCX_TempStr(strlen(Buffer));");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(BCX_RetStr, Buffer);");
      fprintf(FP_OUTPUT,"%s\n","      if (Buffer) {free(Buffer); Buffer = NULL;}");
      fprintf(FP_OUTPUT,"%s\n","      return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","      if (Buffer) {free(Buffer); Buffer = NULL;}");
      fprintf(FP_OUTPUT,"%s\n","      return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Diskfree ){
      fprintf(FP_OUTPUT,"%s\n","UINT64 DiskFree (PCTSTR Drv)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  UINT64  Capacity;");
      fprintf(FP_OUTPUT,"%s\n","  UINT64  TotalFree;");
      fprintf(FP_OUTPUT,"%s\n","  GetDiskFreeSpaceExA(Drv, NULL, (PULARGE_INTEGER)&Capacity, (PULARGE_INTEGER)&TotalFree);");
      fprintf(FP_OUTPUT,"%s\n","  return TotalFree;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Diskused ){
      fprintf(FP_OUTPUT,"%s\n","UINT64 DiskUsed (PCTSTR Drv)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  UINT64  Capacity;");
      fprintf(FP_OUTPUT,"%s\n","  UINT64  TotalFree;");
      fprintf(FP_OUTPUT,"%s\n","  GetDiskFreeSpaceExA(Drv, NULL, (PULARGE_INTEGER)&Capacity, (PULARGE_INTEGER)&TotalFree);");
      fprintf(FP_OUTPUT,"%s\n","  return Capacity-TotalFree;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Disksize ){
      fprintf(FP_OUTPUT,"%s\n","UINT64 DiskSize (PCTSTR Drv)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  UINT64  Capacity;");
      fprintf(FP_OUTPUT,"%s\n","  UINT64  TotalFree;");
      fprintf(FP_OUTPUT,"%s\n","  GetDiskFreeSpaceExA(Drv, NULL, (PULARGE_INTEGER)&Capacity, (PULARGE_INTEGER)&TotalFree);");
      fprintf(FP_OUTPUT,"%s\n","  return Capacity;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Tally ){
      fprintf(FP_OUTPUT,"%s\n","int tally (PCTSTR Haystack, PCTSTR Needle, int sensflag)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!*Needle) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (!*Haystack) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  size_t mlen = strlen(Needle);");
      fprintf(FP_OUTPUT,"%s\n","  int iCount = 0;");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR p = (0 == sensflag ? strstr(Haystack, Needle) : _stristr_(Haystack, Needle));");
      fprintf(FP_OUTPUT,"%s\n","  while (p)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    iCount++;");
      fprintf(FP_OUTPUT,"%s\n","    p += mlen;");
      fprintf(FP_OUTPUT,"%s\n","    p = (0 == sensflag ? strstr(p, Needle) : _stristr_(p, Needle));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return iCount;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Timer ){
      fprintf(FP_OUTPUT,"%s\n","float timer (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return (GetTickCount() * 0.001f);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Rnd ){
      fprintf(FP_OUTPUT,"%s\n","float rnd (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return (float)rand()/RAND_MAX;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Rnd2 ){
      fprintf(FP_OUTPUT,"%s\n","double rnd2(double minimum, double maximum)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   double value = minimum + 0.5 + ((double)rand() * (maximum - minimum) / (RAND_MAX + 1.0));");
      fprintf(FP_OUTPUT,"%s\n","   return (value > maximum) ? maximum : value;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Exp ){
      fprintf(FP_OUTPUT,"%s\n","double Exp (double arg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return pow(2.718281828459045, arg);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Randomize ){
      fprintf(FP_OUTPUT,"%s\n","void randomize (unsigned int seed)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  srand(seed);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Max ){
      fprintf(FP_OUTPUT,"%s\n","double MAX (double dbl_a, double dbl_b)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return  dbl_a > dbl_b ? dbl_a : dbl_b;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Min ){
      fprintf(FP_OUTPUT,"%s\n","double MIN (double dbl_a, double dbl_b)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return  dbl_a < dbl_b ? dbl_a : dbl_b;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Locate ){
      fprintf(FP_OUTPUT,"%s\n","void locate (int row, int col, int show, int shape)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  CONSOLE_CURSOR_INFO cci;");
      fprintf(FP_OUTPUT,"%s\n","  memset (&cci, 0, sizeof(CONSOLE_CURSOR_INFO));");
      fprintf(FP_OUTPUT,"%s\n","  cursor.X = (SHORT)col-1;");
      fprintf(FP_OUTPUT,"%s\n","  cursor.Y = (SHORT)row-1;");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleCursorPosition(hConsole, cursor);");
      fprintf(FP_OUTPUT,"%s\n","  cci.bVisible = show;");
      fprintf(FP_OUTPUT,"%s\n","  cci.dwSize   = shape;");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleCursorInfo(hConsole, &cci);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Pos ){
      fprintf(FP_OUTPUT,"%s\n","int Pos (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE  hStdOut;");
      fprintf(FP_OUTPUT,"%s\n","  CONSOLE_SCREEN_BUFFER_INFO csbi;");
      fprintf(FP_OUTPUT,"%s\n","  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));");
      fprintf(FP_OUTPUT,"%s\n","  hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  GetConsoleScreenBufferInfo(hStdOut, &csbi);");
      fprintf(FP_OUTPUT,"%s\n","  return csbi.dwCursorPosition.X+1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Csrlin ){
      fprintf(FP_OUTPUT,"%s\n","int Csrlin (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE  hStdOut;");
      fprintf(FP_OUTPUT,"%s\n","  CONSOLE_SCREEN_BUFFER_INFO csbi;");
      fprintf(FP_OUTPUT,"%s\n","  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));");
      fprintf(FP_OUTPUT,"%s\n","  hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  GetConsoleScreenBufferInfo(hStdOut, &csbi);");
      fprintf(FP_OUTPUT,"%s\n","  return csbi.dwCursorPosition.Y+1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Cls ){
      fprintf(FP_OUTPUT,"%s\n","void cls(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    ULONG cCharsWritten;");
      fprintf(FP_OUTPUT,"%s\n","    COORD coordScreen = { 0, 0 };");
      fprintf(FP_OUTPUT,"%s\n","    CONSOLE_SCREEN_BUFFER_INFO csbi;");
      fprintf(FP_OUTPUT,"%s\n","    ULONG dwConSize;");
      fprintf(FP_OUTPUT,"%s\n","    WORD attr;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Get current screen buffer info");
      fprintf(FP_OUTPUT,"%s\n","    GetConsoleScreenBufferInfo(hConsole, &csbi);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Calculate the console screen size");
      fprintf(FP_OUTPUT,"%s\n","    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Fill the console with spaces");
      fprintf(FP_OUTPUT,"%s\n","    FillConsoleOutputCharacter(hConsole, (TCHAR)' ', dwConSize, coordScreen, &cCharsWritten);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Fill the console with the current text and background colors");
      fprintf(FP_OUTPUT,"%s\n","    attr = (WORD)color_fg + (WORD)color_bg * 16;");
      fprintf(FP_OUTPUT,"%s\n","    FillConsoleOutputAttribute(hConsole, attr, dwConSize, coordScreen, &cCharsWritten);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifndef __LCC__");
      fprintf(FP_OUTPUT,"%s\n","    // Clear the scrollback buffer by resizing the console buffer");
      fprintf(FP_OUTPUT,"%s\n","    SMALL_RECT rect;");
      fprintf(FP_OUTPUT,"%s\n","    rect.Left = 0;");
      fprintf(FP_OUTPUT,"%s\n","    rect.Top = 0;");
      fprintf(FP_OUTPUT,"%s\n","    rect.Right = csbi.dwSize.X;");
      fprintf(FP_OUTPUT,"%s\n","    rect.Bottom = csbi.dwSize.Y-1;");
      fprintf(FP_OUTPUT,"%s\n","    SetConsoleWindowInfo(hConsole, TRUE, &rect);");
      fprintf(FP_OUTPUT,"%s\n","    SetConsoleScreenBufferSize(hConsole, csbi.dwSize);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    locate(1, 1, 1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Color ){
      fprintf(FP_OUTPUT,"%s\n","void color(int fg, int bg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (bg == (-1))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SetConsoleTextAttribute(hConsole, (WORD)fg + (WORD)color_bg * 16);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SetConsoleTextAttribute(hConsole, (WORD)fg + (WORD)bg * 16);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  color_fg = fg;");
      fprintf(FP_OUTPUT,"%s\n","  if (bg!=(-1)) color_bg = bg;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_PushPopColors ){
      fprintf(FP_OUTPUT,"%s\n","void PushColors (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  CONSOLE_SCREEN_BUFFER_INFO csbi;");
      fprintf(FP_OUTPUT,"%s\n","  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));");
      fprintf(FP_OUTPUT,"%s\n","  if(0==GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    color_pshpop = 7;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    color_pshpop = csbi.wAttributes;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void PopColors (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if(color_pshpop == 0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    color (7,0);");
      fprintf(FP_OUTPUT,"%s\n","    color_fg = 7;");
      fprintf(FP_OUTPUT,"%s\n","    color_bg = 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),(WORD)color_pshpop);");
      fprintf(FP_OUTPUT,"%s\n","    color_fg = (color_pshpop & 0x0F);");
      fprintf(FP_OUTPUT,"%s\n","    color_bg = (color_pshpop & 0xF0) / 16;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Consolesize ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_SetConsoleSize (int NewX,int NewY)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  COORD    Coords={0};");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE   hconsole={0};");
      fprintf(FP_OUTPUT,"%s\n","  SMALL_RECT  ConsoleSize={0};");
      fprintf(FP_OUTPUT,"%s\n","  CONSOLE_SCREEN_BUFFER_INFO csbi;");
      fprintf(FP_OUTPUT,"%s\n","  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));");
      fprintf(FP_OUTPUT,"%s\n","  hconsole=GetStdHandle(STD_OUTPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  GetConsoleScreenBufferInfo (hconsole, &csbi);");
      fprintf(FP_OUTPUT,"%s\n","  if(csbi.dwSize.X>NewX)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Coords.X = csbi.dwSize.X;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Coords.X = NewX;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if(csbi.dwSize.Y > NewY)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Coords.Y=csbi.dwSize.Y;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Coords.Y=NewY;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  ConsoleSize.Right = NewX-1;");
      fprintf(FP_OUTPUT,"%s\n","  ConsoleSize.Bottom = NewY-1;");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleScreenBufferSize (hconsole, Coords);");
      fprintf(FP_OUTPUT,"%s\n","  SetConsoleWindowInfo (hconsole, TRUE, &ConsoleSize);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_PushConsoleSize (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  COORD    Coords={0};");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE   hconsole={0};");
      fprintf(FP_OUTPUT,"%s\n","  CONSOLE_SCREEN_BUFFER_INFO  csbi;");
      fprintf(FP_OUTPUT,"%s\n","  memset (&csbi, 0, sizeof(CONSOLE_SCREEN_BUFFER_INFO));");
      fprintf(FP_OUTPUT,"%s\n","  SMALL_RECT  ConsoleSize={0};");
      fprintf(FP_OUTPUT,"%s\n","  hconsole=GetStdHandle(STD_OUTPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  GetConsoleScreenBufferInfo (hconsole , &csbi);");
      fprintf(FP_OUTPUT,"%s\n","  BcxSaveConX = 1 + csbi.srWindow.Right-csbi.srWindow.Left;");
      fprintf(FP_OUTPUT,"%s\n","  BcxSaveConY = 1 + csbi.srWindow.Bottom-csbi.srWindow.Top;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_PopConsoleSize (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BCX_SetConsoleSize (BcxSaveConX ,BcxSaveConY);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Panel ){
      fprintf(FP_OUTPUT,"%s\n","void panel (int x1, int y1, int x2, int y2, int fg, int bg, int charcode, int flg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  ULONG ret;");
      fprintf(FP_OUTPUT,"%s\n","  int attr = fg+bg*16, x, y;");
      fprintf(FP_OUTPUT,"%s\n","  for(y = y1;y<=y2;y++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    for(x = x1;x<=x2;x++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      cursor.X = x - 1;");
      fprintf(FP_OUTPUT,"%s\n","      cursor.Y = y - 1;");
      fprintf(FP_OUTPUT,"%s\n","      if (flg) FillConsoleOutputCharacter(hConsole, charcode,  1, cursor, &ret);");
      fprintf(FP_OUTPUT,"%s\n","      FillConsoleOutputAttribute(hConsole, attr, 1, cursor, &ret);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Midstr ){
      fprintf(FP_OUTPUT,"%s\n","void midstr (char *szSrc, int st, int length, char *rep)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int srclen = (int)strlen(szSrc);");
      fprintf(FP_OUTPUT,"%s\n","  if (st > srclen++ || st<1) return;");
      fprintf(FP_OUTPUT,"%s\n","  int replen = (int)strlen(rep);");
      fprintf(FP_OUTPUT,"%s\n","  if (replen < length || length==(-1)) length = replen;");
      fprintf(FP_OUTPUT,"%s\n","  if ((st+length) > srclen) length = srclen-st;");
      fprintf(FP_OUTPUT,"%s\n","  memcpy(&szSrc[st-1], rep, length);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Swap ){
      fprintf(FP_OUTPUT,"%s\n","void swap (byte* A_, byte* B_, int length)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  byte t;");
      fprintf(FP_OUTPUT,"%s\n","  while(length--)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    t = *A_;");
      fprintf(FP_OUTPUT,"%s\n","    *(A_++) = *B_;");
      fprintf(FP_OUTPUT,"%s\n","    *(B_++) = t;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Like ){
      fprintf(FP_OUTPUT,"%s\n","int like (PCTSTR Haystack, PCTSTR Needle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  while (*Needle)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*Needle == '#')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (! *Haystack) return false;");
      fprintf(FP_OUTPUT,"%s\n","      if (! isdigit(*Haystack)) return false;");
      fprintf(FP_OUTPUT,"%s\n","      ++Haystack;");
      fprintf(FP_OUTPUT,"%s\n","      ++Needle;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (*Needle == '?')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (! *Haystack) return false;");
      fprintf(FP_OUTPUT,"%s\n","      ++Haystack;");
      fprintf(FP_OUTPUT,"%s\n","      ++Needle;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (*Needle == '*')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (like(Haystack, Needle + 1)) return true;");
      fprintf(FP_OUTPUT,"%s\n","      if (*Haystack && like(Haystack + 1, Needle))");
      fprintf(FP_OUTPUT,"%s\n","        return true;");
      fprintf(FP_OUTPUT,"%s\n","      return false;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if ((*Haystack++ | 32) != (*Needle++ | 32)) return false; // case-insensitive");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return !*Haystack && !*Needle;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Lof ){
      fprintf(FP_OUTPUT,"%s\n","unsigned long long int lof (PCTSTR FName)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  WIN32_FILE_ATTRIBUTE_DATA fad;");
      fprintf(FP_OUTPUT,"%s\n","  if (!GetFileAttributesEx(FName, GetFileExInfoStandard, &fad))");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  LARGE_INTEGER size;");
      fprintf(FP_OUTPUT,"%s\n","  size.HighPart = fad.nFileSizeHigh;");
      fprintf(FP_OUTPUT,"%s\n","  size.LowPart = fad.nFileSizeLow;");
      fprintf(FP_OUTPUT,"%s\n","  return size.QuadPart;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Mkpath ){
      fprintf(FP_OUTPUT,"%s\n","void MkPath (PCTSTR szPath_)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char Buf[64][BCXSTRSIZE]={{0}};");
      fprintf(FP_OUTPUT,"%s\n","  char Tmp[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","  int  Elements={0};");
      fprintf(FP_OUTPUT,"%s\n","  int  i;");
      fprintf(FP_OUTPUT,"%s\n","  Elements = Split(Buf, szPath_, vchr(1,92)) - 1;");
      fprintf(FP_OUTPUT,"%s\n","  for(i = 0; i<=Elements; i += 1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(Tmp, join(3,Tmp,Buf[i],vchr(1,92)));");
      fprintf(FP_OUTPUT,"%s\n","    _mkdir (Tmp);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Screen ){
      fprintf(FP_OUTPUT,"%s\n","int Screen (int y, int x, int mode)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE  hConsole_ = GetStdHandle(STD_OUTPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  ULONG Slen;");
      fprintf(FP_OUTPUT,"%s\n","  COORD Coord;");
      fprintf(FP_OUTPUT,"%s\n","  WORD  Attr;");
      fprintf(FP_OUTPUT,"%s\n","  char  Char[2];");
      fprintf(FP_OUTPUT,"%s\n","  Coord.X = x-1;");
      fprintf(FP_OUTPUT,"%s\n","  Coord.Y = y-1;");
      fprintf(FP_OUTPUT,"%s\n","  ReadConsoleOutputCharacterA(hConsole_, Char, 1, Coord, &Slen);");
      fprintf(FP_OUTPUT,"%s\n","  ReadConsoleOutputAttribute(hConsole_, &Attr, 1, Coord, &Slen);");
      fprintf(FP_OUTPUT,"%s\n","  if (mode)");
      fprintf(FP_OUTPUT,"%s\n","  return  Attr;");
      fprintf(FP_OUTPUT,"%s\n","  return  (unsigned char)Char[0];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Iif ){
      fprintf(FP_OUTPUT,"%s\n","double iif (int cond, double tp, double fp)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (cond!=0) return tp;");
      fprintf(FP_OUTPUT,"%s\n","  return fp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Doevents ){
      fprintf(FP_OUTPUT,"%s\n","void DoEvents (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  MSG Msg;");
      fprintf(FP_OUTPUT,"%s\n","  while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    TranslateMessage(&Msg);");
      fprintf(FP_OUTPUT,"%s\n","    DispatchMessage(&Msg);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_SortDynamic (FILE* FP_OUTPUT)
{
  if(Use_DynamicA ){
      fprintf(FP_OUTPUT,"%s\n","void *CreateArr(void *dynavar, int elem_size, int update, int num_dims, size_t *args) {");
      fprintf(FP_OUTPUT,"%s\n","  size_t s, s1, s2;");
      fprintf(FP_OUTPUT,"%s\n","  void **vp;");
      fprintf(FP_OUTPUT,"%s\n","  size_t *marker;");
      fprintf(FP_OUTPUT,"%s\n","  marker = args;");
      fprintf(FP_OUTPUT,"%s\n","  s = *marker++;");
      fprintf(FP_OUTPUT,"%s\n","  s2 = s + 2;");
      fprintf(FP_OUTPUT,"%s\n","  if (num_dims == 1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (update && dynavar)");
      fprintf(FP_OUTPUT,"%s\n","      dynavar = realloc(dynavar, s2 * elem_size);");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      dynavar = calloc(s2, elem_size);");
      fprintf(FP_OUTPUT,"%s\n","    return dynavar;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else if (update && dynavar)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    s1 = 0;");
      fprintf(FP_OUTPUT,"%s\n","    vp = (void**)dynavar;");
      fprintf(FP_OUTPUT,"%s\n","    while(*vp && s1 <= s)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      vp++;");
      fprintf(FP_OUTPUT,"%s\n","      s1++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (s1 > s)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      vp--;");
      fprintf(FP_OUTPUT,"%s\n","      DestroyArr(vp, num_dims, 0);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    dynavar = realloc(dynavar, s2 * sizeof(int *));");
      fprintf(FP_OUTPUT,"%s\n","    s1 = 0;");
      fprintf(FP_OUTPUT,"%s\n","    vp = (void**)dynavar;");
      fprintf(FP_OUTPUT,"%s\n","    while(*vp && s1 <= s)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      vp++;");
      fprintf(FP_OUTPUT,"%s\n","      s1++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    while(s1 < s2)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      *(((void **)vp)) = NULL;");
      fprintf(FP_OUTPUT,"%s\n","      vp++;");
      fprintf(FP_OUTPUT,"%s\n","      s1++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    dynavar = calloc(s2 * sizeof(int *), 1);");
      fprintf(FP_OUTPUT,"%s\n","  vp = (void**)dynavar;");
      fprintf(FP_OUTPUT,"%s\n","  if (--num_dims > 0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    for(s1 = 0; s1 < s; s1++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      vp[s1] = CreateArr(vp[s1], elem_size, update, num_dims, marker);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return dynavar;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void DestroyArr (void** dynavar,int num_dims, int top_free)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ii = 0;");
      fprintf(FP_OUTPUT,"%s\n","  static int s = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (num_dims == 1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    free(dynavar);");
      fprintf(FP_OUTPUT,"%s\n","    dynavar = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  s++;");
      fprintf(FP_OUTPUT,"%s\n","  num_dims--;");
      fprintf(FP_OUTPUT,"%s\n","  while(dynavar[ii])");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    DestroyArr((void**)dynavar[ii], num_dims, top_free);");
      fprintf(FP_OUTPUT,"%s\n","    if (num_dims > 1)");
      fprintf(FP_OUTPUT,"%s\n","      free(dynavar[ii]);");
      fprintf(FP_OUTPUT,"%s\n","    dynavar[ii++]=NULL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  s--;");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == s && top_free)");
      fprintf(FP_OUTPUT,"%s\n","    free(dynavar);");
      fprintf(FP_OUTPUT,"%s\n","  dynavar = NULL;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Idxqsort ){
      fprintf(FP_OUTPUT,"%s\n","int IdxCompare (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int *ptr1 = (int*)(one);");
      fprintf(FP_OUTPUT,"%s\n","  int *ptr2 = (int*)(two);");
      fprintf(FP_OUTPUT,"%s\n","  return bcx_stricmp (pppStr[Key][*ptr1], pppStr[Key][*ptr2]);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_IdxqsortSt ){
      fprintf(FP_OUTPUT,"%s\n","int IdxCompareSt (const void* one, const void* two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","#define compare1 cmp1+(StructSize * (*(UINT*)(one)))");
      fprintf(FP_OUTPUT,"%s\n","#define compare2 cmp1+(StructSize * (*(UINT*)(two)))");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==0)");
      fprintf(FP_OUTPUT,"%s\n","    return  bcx_stricmp(compare1, compare2);");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*(int*)(compare1) < *(int*)(compare2)) return -1;");
      fprintf(FP_OUTPUT,"%s\n","    if (*(int*)(compare1) > *(int*)(compare2)) return 1;");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==2)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*(double*)(compare1) < *(double*)(compare2)) return -1;");
      fprintf(FP_OUTPUT,"%s\n","    if (*(double*)(compare1) > *(double*)(compare2)) return 1;");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==3)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*(UINT*)(compare1) < *(UINT*)(compare2)) return -1;");
      fprintf(FP_OUTPUT,"%s\n","    if (*(UINT*)(compare1) > *(UINT*)(compare2)) return 1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_PtrqsortSt ){
      fprintf(FP_OUTPUT,"%s\n","int PtrCompareSt (const void* one, const void* two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","#define pcompare1 ((char*)(one)+OffSet)");
      fprintf(FP_OUTPUT,"%s\n","#define pcompare2 ((char*)(two)+OffSet)");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==0)");
      fprintf(FP_OUTPUT,"%s\n","    return  bcx_stricmp(pcompare1, pcompare2);");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*(int*)(pcompare1) < *(int*)(pcompare2)) return -1;");
      fprintf(FP_OUTPUT,"%s\n","    if (*(int*)(pcompare1) > *(int*)(pcompare2)) return 1;");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==2)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*(double*)(pcompare1) < *(double*)(pcompare2)) return -1;");
      fprintf(FP_OUTPUT,"%s\n","    if (*(double*)(pcompare1) > *(double*)(pcompare2)) return 1;");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Key==3)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*(UINT*)(pcompare1) < *(UINT*)(pcompare2)) return -1;");
      fprintf(FP_OUTPUT,"%s\n","    if (*(UINT*)(pcompare1) > *(UINT*)(pcompare2)) return 1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strqsortas ){
      fprintf(FP_OUTPUT,"%s\n","int StrCompareAs (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = (char*) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = (char*) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return strcmp (v1, v2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strqsorta ){
      fprintf(FP_OUTPUT,"%s\n","int StrCompareA (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = (char*) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = (char*) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return bcx_stricmp (v1,v2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strqsortds ){
      fprintf(FP_OUTPUT,"%s\n","int StrCompareDs (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = (char*) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = (char*) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return strcmp (v2, v1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Strqsortd ){
      fprintf(FP_OUTPUT,"%s\n","int StrCompareD (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = (char*) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = (char*) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return bcx_stricmp (v2, v1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DynStrqsortas ){
      fprintf(FP_OUTPUT,"%s\n","int DynStrCompareAs (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = *(char **) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = *(char **) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return strcmp(v1, v2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DynStrqsorta ){
      fprintf(FP_OUTPUT,"%s\n","int DynStrCompareA (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = *(char **) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = *(char **) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return bcx_stricmp(v1, v2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DynStrqsortds ){
      fprintf(FP_OUTPUT,"%s\n","int DynStrCompareDs (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = *(char **) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = *(char **) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return strcmp(v2, v1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DynStrqsortd ){
      fprintf(FP_OUTPUT,"%s\n","int DynStrCompareD (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = *(char **) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = *(char **) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return bcx_stricmp(v2, v1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DynAlphaNumericA ){
      fprintf(FP_OUTPUT,"%s\n","int DynAlphaNumericA (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = *(char **) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = *(char **) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return AlphaNumeric(v1, v2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DynAlphaNumericD ){
      fprintf(FP_OUTPUT,"%s\n","int DynAlphaNumericD (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *v1 = *(char **) arg1;");
      fprintf(FP_OUTPUT,"%s\n","  char *v2 = *(char **) arg2;");
      fprintf(FP_OUTPUT,"%s\n","  return AlphaNumeric(v2, v1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_AlphaNumericA ){
      fprintf(FP_OUTPUT,"%s\n","int AlphaNumericA (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return AlphaNumeric (arg1, arg2);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_AlphaNumericD ){
      fprintf(FP_OUTPUT,"%s\n","int AlphaNumericD (const void *arg1, const void *arg2)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return AlphaNumeric (arg2, arg1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_AlphaNumeric ){
      fprintf(FP_OUTPUT,"%s\n","int AlphaNumeric(const void *s1p, const void *s2p)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *s1 = (char*)s1p;");
      fprintf(FP_OUTPUT,"%s\n","  char *s2 = (char*)s2p;");
      fprintf(FP_OUTPUT,"%s\n","  do");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (isdigit(s1[0]) && isdigit(s2[0]))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      // Compare numbers as numbers");
      fprintf(FP_OUTPUT,"%s%s%s\n","      int c1 = strspn(s1, ",enc("0123456789"),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","      int c2 = strspn(s2, ",enc("0123456789"),");");
      fprintf(FP_OUTPUT,"%s\n","      if (c1 > c2)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        return 1;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      else if (c1 < c2)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        return -1;");
      fprintf(FP_OUTPUT,"%s\n","      };");
      fprintf(FP_OUTPUT,"%s\n","      // the digit strings have equal length, so compare digit by digit");
      fprintf(FP_OUTPUT,"%s\n","      while (c1--)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (s1[0] > s2[0])");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          return 1;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        else if (s1[0] < s2[0])");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          return -1;");
      fprintf(FP_OUTPUT,"%s\n","        };");
      fprintf(FP_OUTPUT,"%s\n","        s1++;");
      fprintf(FP_OUTPUT,"%s\n","        s2++;");
      fprintf(FP_OUTPUT,"%s\n","      };");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (s1[0] > s2[0])");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return 1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (s1[0] < s2[0])");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return -1;");
      fprintf(FP_OUTPUT,"%s\n","    };");
      fprintf(FP_OUTPUT,"%s\n","    s1++;");
      fprintf(FP_OUTPUT,"%s\n","    s2++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  while ((*s1!=0) || (*s2!=0));");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Numqsortaint ){
      fprintf(FP_OUTPUT,"%s\n","int NumCompareAint (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int *ptr1 = (int *)(one);");
      fprintf(FP_OUTPUT,"%s\n","  int *ptr2 = (int *)(two);");
      fprintf(FP_OUTPUT,"%s\n","  if (*ptr1 < *ptr2) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  else if (*ptr1 == *ptr2) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  else return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Numqsortdint ){
      fprintf(FP_OUTPUT,"%s\n","int NumCompareDint (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int *ptr1 = (int *)(one);");
      fprintf(FP_OUTPUT,"%s\n","  int *ptr2 = (int *)(two);");
      fprintf(FP_OUTPUT,"%s\n","  if (*ptr1 > *ptr2) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  else if (*ptr1 == *ptr2) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  else return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Numqsortafloat ){
      fprintf(FP_OUTPUT,"%s\n","int NumCompareAfloat (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  float *ptr1 = (float *)(one);");
      fprintf(FP_OUTPUT,"%s\n","  float *ptr2 = (float *)(two);");
      fprintf(FP_OUTPUT,"%s\n","  if (*ptr1 < *ptr2) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  else if (*ptr1 == *ptr2) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  else return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Numqsortdfloat ){
      fprintf(FP_OUTPUT,"%s\n","int NumCompareDfloat (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  float *ptr1 = (float *)(one);");
      fprintf(FP_OUTPUT,"%s\n","  float *ptr2 = (float *)(two);");
      fprintf(FP_OUTPUT,"%s\n","  if (*ptr1 > *ptr2) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  else if (*ptr1 == *ptr2) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  else return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Numqsortadouble ){
      fprintf(FP_OUTPUT,"%s\n","int NumCompareAdouble (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  double *ptr1 = (double *)(one);");
      fprintf(FP_OUTPUT,"%s\n","  double *ptr2 = (double *)(two);");
      fprintf(FP_OUTPUT,"%s\n","  if (*ptr1 < *ptr2) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  else if (*ptr1 == *ptr2) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  else return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Numqsortddouble ){
      fprintf(FP_OUTPUT,"%s\n","int NumCompareDdouble (const void *one, const void *two)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  double *ptr1 = (double *)(one);");
      fprintf(FP_OUTPUT,"%s\n","  double *ptr2 = (double *)(two);");
      fprintf(FP_OUTPUT,"%s\n","  if (*ptr1 > *ptr2) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  else if (*ptr1 == *ptr2) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  else return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_FillArray ){
      fprintf(FP_OUTPUT,"%s\n","int fillarray(PCTSTR input, int ArrayType, int MaxCnt, void *Array)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (MaxCnt < 1) return -1;");
      fprintf(FP_OUTPUT,"%s\n","  int c = 0, cnt=(-1), cnt2;");
      fprintf(FP_OUTPUT,"%s\n","  char A [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  int    *intptr    = (int *)Array;");
      fprintf(FP_OUTPUT,"%s\n","  float  *floatptr  = (float *)Array;");
      fprintf(FP_OUTPUT,"%s\n","  double *doubleptr = (double *)Array;");
      fprintf(FP_OUTPUT,"%s\n","  long double *ldoubleptr = (long double *)Array;");
      fprintf(FP_OUTPUT,"%s\n","  for(;;)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    cnt2 = 0;");
      fprintf(FP_OUTPUT,"%s\n","    while(input[++cnt]!=',')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (input[cnt]==0) break;");
      fprintf(FP_OUTPUT,"%s\n","      A[cnt2++]=input[cnt];");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    A[cnt2]=0;");
      fprintf(FP_OUTPUT,"%s\n","    if (cnt2==0||c==MaxCnt) break;");
      fprintf(FP_OUTPUT,"%s\n","    if (ArrayType==2)");
      fprintf(FP_OUTPUT,"%s\n","      intptr[c++] = atoi(A);");
      fprintf(FP_OUTPUT,"%s\n","    else if (ArrayType==3)");
      fprintf(FP_OUTPUT,"%s\n","      floatptr[c++] = atof(A);");
      fprintf(FP_OUTPUT,"%s\n","    else if (ArrayType==4)");
      fprintf(FP_OUTPUT,"%s\n","      doubleptr[c++] = atof(A);");
      fprintf(FP_OUTPUT,"%s\n","    else if (ArrayType==5)");
      fprintf(FP_OUTPUT,"%s\n","      ldoubleptr[c++] = atof(A);");
      fprintf(FP_OUTPUT,"%s\n","    if (input[cnt]==0) break;");
      fprintf(FP_OUTPUT,"%s\n","  } ");
      fprintf(FP_OUTPUT,"%s\n","  return (c-1);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Lclick ){
      fprintf(FP_OUTPUT,"%s\n","int lClick (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if(GetSystemMetrics(SM_SWAPBUTTON)){");
      fprintf(FP_OUTPUT,"%s\n","      if(GetAsyncKeyState(VK_RBUTTON)&0x8000) {");
      fprintf(FP_OUTPUT,"%s\n","          return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(GetAsyncKeyState(VK_LBUTTON)&0x8000) {");
      fprintf(FP_OUTPUT,"%s\n","      return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Rclick ){
      fprintf(FP_OUTPUT,"%s\n","int rClick (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if(GetSystemMetrics(SM_SWAPBUTTON)){");
      fprintf(FP_OUTPUT,"%s\n","      if(GetAsyncKeyState(VK_LBUTTON)&0x8000) {");
      fprintf(FP_OUTPUT,"%s\n","          return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(GetAsyncKeyState(VK_RBUTTON)&0x8000) {");
      fprintf(FP_OUTPUT,"%s\n","      return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Loc ){
      fprintf(FP_OUTPUT,"%s\n","int loc(FILE *fp, int fplen)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  fpos_t t;");
      fprintf(FP_OUTPUT,"%s\n","  fgetpos(fp, &t);");
      fprintf(FP_OUTPUT,"%s\n","#if defined(__POCC__)");
      fprintf(FP_OUTPUT,"%s\n","  t.off %= fplen;");
      fprintf(FP_OUTPUT,"%s\n","  return (int)t.off;");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  t %= fplen;");
      fprintf(FP_OUTPUT,"%s\n","  return (int)t;");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Rec ){
      fprintf(FP_OUTPUT,"%s\n","int rec(FILE *fp, int fplen)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  fpos_t t;");
      fprintf(FP_OUTPUT,"%s\n","  fgetpos(fp, &t);");
      fprintf(FP_OUTPUT,"%s\n","#if defined(__POCC__)");
      fprintf(FP_OUTPUT,"%s\n","  t.off /= fplen;");
      fprintf(FP_OUTPUT,"%s\n","  return (int)++t.off;");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  t /= fplen;");
      fprintf(FP_OUTPUT,"%s\n","  return (int)++t;");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_RecCount ){
      fprintf(FP_OUTPUT,"%s\n","int reccount(FILE *fp, int fplen)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  fpos_t t;");
      fprintf(FP_OUTPUT,"%s\n","  _fseeki64 (fp, 0, SEEK_END);");
      fprintf(FP_OUTPUT,"%s\n","  fgetpos(fp, &t);");
      fprintf(FP_OUTPUT,"%s\n","#if defined(__POCC__)");
      fprintf(FP_OUTPUT,"%s\n","  t.off /= fplen;");
      fprintf(FP_OUTPUT,"%s\n","  return (int)t.off;");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  t /= fplen;");
      fprintf(FP_OUTPUT,"%s\n","  return (int)t;");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Scan ){
      fprintf(FP_OUTPUT,"%s\n","int scan(PCTSTR input, PCTSTR format, ... )");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int       L_c ;");
      fprintf(FP_OUTPUT,"%s\n","  int       L_d ;");
      fprintf(FP_OUTPUT,"%s\n","  char     *s_;");
      fprintf(FP_OUTPUT,"%s\n","  int      *intptr;");
      fprintf(FP_OUTPUT,"%s\n","  float    *floatptr;");
      fprintf(FP_OUTPUT,"%s\n","  double   *doubleptr;");
      fprintf(FP_OUTPUT,"%s\n","  char      L_ScanBuffer[50][BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  va_list   marker;");
      fprintf(FP_OUTPUT,"%s\n","  L_c = 0;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  L_d = Split(L_ScanBuffer,input,",enc(","),");");
      fprintf(FP_OUTPUT,"%s\n","  va_start(marker, format); //Initialize arguments");
      fprintf(FP_OUTPUT,"%s\n","  while(L_d && *format)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (*format == '%') format++;");
      fprintf(FP_OUTPUT,"%s\n","    if (*format == 's')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      s_ = va_arg(marker, char *);");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(s_, L_ScanBuffer[L_c]);");
      fprintf(FP_OUTPUT,"%s\n","      L_c++;");
      fprintf(FP_OUTPUT,"%s\n","      L_d--;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (*format == 'd')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      intptr = va_arg(marker, int *);");
      fprintf(FP_OUTPUT,"%s\n","      *intptr = atoi(L_ScanBuffer[L_c]);");
      fprintf(FP_OUTPUT,"%s\n","      L_c++;");
      fprintf(FP_OUTPUT,"%s\n","      L_d--;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (*format == 'g')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      floatptr = va_arg(marker, float *);");
      fprintf(FP_OUTPUT,"%s\n","      *floatptr = strtof(L_ScanBuffer[L_c], NULL);");
      fprintf(FP_OUTPUT,"%s\n","      L_c++;");
      fprintf(FP_OUTPUT,"%s\n","      L_d--;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (*format == 'l')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      format++;");
      fprintf(FP_OUTPUT,"%s\n","      doubleptr = va_arg(marker, double *);");
      fprintf(FP_OUTPUT,"%s\n","      *doubleptr = atof(L_ScanBuffer[L_c]);");
      fprintf(FP_OUTPUT,"%s\n","      L_c++;");
      fprintf(FP_OUTPUT,"%s\n","      L_d--;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    format++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  va_end(marker);              // Reset variable arguments");
      fprintf(FP_OUTPUT,"%s\n","  if (L_d) return(1);          // More data than variables");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == *format) return(0); // OK");
      fprintf(FP_OUTPUT,"%s\n","  return(-1);                  // More variables than data");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_SplitConsole (FILE* FP_OUTPUT)
{
  if(Use_KBinput ){
      fprintf(FP_OUTPUT,"%s\n","void KBinput (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  *InputBuffer = 0;");
      fprintf(FP_OUTPUT,"%s\n","  fgets(InputBuffer, sizeof(InputBuffer)-1, stdin);");
      fprintf(FP_OUTPUT,"%s\n","  InputBuffer[(int)strlen(InputBuffer)-1]=0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Split ){
      fprintf(FP_OUTPUT,"%s\n","int Split (char Buf[][BCXSTRSIZE], PCTSTR T, PCTSTR Delim, int Flg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int  Begin = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  Count = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  Quote = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  Index = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  ii    = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  lenT  = (int)strlen(T);");
      fprintf(FP_OUTPUT,"%s\n","  if (Flg<0||Flg>4) Flg=0;");
      fprintf(FP_OUTPUT,"%s\n","  const char DDQt [3] = {34,34,0}; // Double Quotation Mark");
      fprintf(FP_OUTPUT,"%s\n","  const char US   [2] = {30,0};    // Information Separator One");
      fprintf(FP_OUTPUT,"%s\n","  const char DQt  [2] = {34,0};    // Quotation Mark");
      fprintf(FP_OUTPUT,"%s\n","  for(Index = 1;Index<=lenT;Index++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (instr(Delim, mid(T, Index, 1)) && !Quote)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(Buf[Count], (char*)mid(T, Begin, Index-Begin));");
      fprintf(FP_OUTPUT,"%s\n","      if (0 == (Flg & 2))");
      fprintf(FP_OUTPUT,"%s\n","        Count++;");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","      if (Buf[Count][0] != 0) Count++;");
      fprintf(FP_OUTPUT,"%s\n","      Begin = 0;");
      fprintf(FP_OUTPUT,"%s\n","      if ((Flg & 1) == 1)   // 1 if true");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Count++], (char*)mid(T, Index, 1));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (strcmp(mid(T, Index, 1), DQt)==0) Quote=!Quote;");
      fprintf(FP_OUTPUT,"%s\n","      if (Begin==0) Begin = Index;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Begin)");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(Buf[Count++], (char*)mid(T, Begin, Index-Begin));");
      fprintf(FP_OUTPUT,"%s\n","  if ((0 == (Flg & 1)) && (Flg < 4)) // 0 if false");
      fprintf(FP_OUTPUT,"%s\n","    for(ii = 0;ii<Count;ii++) strcpy(Buf[ii], (char*)RemoveStr(Buf[ii], DQt));");
      fprintf(FP_OUTPUT,"%s\n","  if(Flg == 4)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    for(Index = 0;Index<Count;Index++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if(instr(Buf[Index],DDQt))");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],replace(Buf[Index],DDQt,US));");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],RemoveStr(Buf[Index],DQt));");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],replace(Buf[Index],US,DQt));");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],RemoveStr(Buf[Index],DQt));");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return Count;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DSplit ){
      fprintf(FP_OUTPUT,"%s\n","int DSplit (PSTR *Buf, PCTSTR T, PCTSTR Delim, int Flg) {");
      fprintf(FP_OUTPUT,"%s\n"," int  Begin = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  Count = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  Quote = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  Index = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  lenT  = (int)strlen(T);");
      fprintf(FP_OUTPUT,"%s\n","  if (Flg<0||Flg>4) Flg=0;");
      fprintf(FP_OUTPUT,"%s\n","  const char DDQt [3] = {34,34,0}; // Double Quotation Mark");
      fprintf(FP_OUTPUT,"%s\n","  const char US   [2] = {30,0};    // Information Separator One");
      fprintf(FP_OUTPUT,"%s\n","  const char DQt  [2] = {34,0};    // Quotation Mark");
      fprintf(FP_OUTPUT,"%s\n","  for(Index = 1;Index<=lenT;Index++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (instr(Delim, mid(T, Index, 1)) && !Quote)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(Buf[Count], (char*)mid(T, Begin, Index-Begin));");
      fprintf(FP_OUTPUT,"%s\n","      if (0 == (Flg & 2))");
      fprintf(FP_OUTPUT,"%s\n","        Count++;");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","      if (Buf[Count][0] != 0) Count++;");
      fprintf(FP_OUTPUT,"%s\n","      Begin = 0;");
      fprintf(FP_OUTPUT,"%s\n","      if ((Flg & 1) == 1)   // 1 if true");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Count++], (char*)mid(T, Index, 1));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (strcmp(mid(T, Index, 1), DQt)==0) Quote=!Quote;");
      fprintf(FP_OUTPUT,"%s\n","      if (Begin==0)  Begin = Index;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Begin) strcpy(Buf[Count++], (char*)mid(T, Begin, Index-Begin));");
      fprintf(FP_OUTPUT,"%s\n","  if ((0 == (Flg & 1)) && (Flg < 4))   // 0 if false");
      fprintf(FP_OUTPUT,"%s\n","    for(Index = 0;Index<Count;Index++) strcpy(Buf[Index], (char*)RemoveStr(Buf[Index], DQt));");
      fprintf(FP_OUTPUT,"%s\n","  if(Flg == 4)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    for(Index = 0;Index<Count;Index++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if(instr(Buf[Index],DDQt))");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],replace(Buf[Index],DDQt,US));");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],RemoveStr(Buf[Index],DQt));");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],replace(Buf[Index],US,DQt));");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Buf[Index],RemoveStr(Buf[Index],DQt));");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return Count;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Bin2dec ){
      fprintf(FP_OUTPUT,"%s\n","int Bin2Dec (PCTSTR cptr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ii, j = 0;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  while(cptr && *cptr && strchr(",enc("01"),", *cptr))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    ii = *cptr++ - '0';");
      fprintf(FP_OUTPUT,"%s\n","    j <<= 1;");
      fprintf(FP_OUTPUT,"%s\n","    j |= (ii & 0x01);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n"," return(j);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Hex2Dec ){
      fprintf(FP_OUTPUT,"%s\n","UINT64 Hex2Dec (PCTSTR szInput)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if(*szInput==38){");
      fprintf(FP_OUTPUT,"%s\n","    return strtoull(szInput + 2, NULL, 16);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else if(*szInput + 1 == 120){");
      fprintf(FP_OUTPUT,"%s\n","    return strtoull(szInput + 2, NULL, 16);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return strtoull(szInput, NULL, 16);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Verify ){
      fprintf(FP_OUTPUT,"%s\n","int Verify (PCTSTR szSrc, PCTSTR Allowed)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  UINT ii, j;");
      fprintf(FP_OUTPUT,"%s\n","  for (ii = 1; ii<=(int)strlen(szSrc); ii++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    j = VerifyInstr(Allowed, mid(szSrc, ii, 1));");
      fprintf(FP_OUTPUT,"%s\n","    if (!j) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","int VerifyInstr(PCTSTR szSrc, PCTSTR strPattern, int offset)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *s;");
      fprintf(FP_OUTPUT,"%s\n","  if (!szSrc || !strPattern || !*strPattern || offset > (int)strlen(szSrc)) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  s = (char*)strstr (offset>0 ? szSrc+offset-1 : szSrc, strPattern);");
      fprintf(FP_OUTPUT,"%s\n","  return s ? (int)(s-szSrc)+1 : 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Freefile ){
      fprintf(FP_OUTPUT,"%s\n","FILE* FreeFile (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    return NULL;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Textmode ){
      fprintf(FP_OUTPUT,"%s\n","int TextMode (int Y)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE hCons = GetStdHandle(STD_OUTPUT_HANDLE);");
      fprintf(FP_OUTPUT,"%s\n","  COORD  Coord;");
      fprintf(FP_OUTPUT,"%s\n","  Coord.X = 80;");
      fprintf(FP_OUTPUT,"%s\n","  Coord.Y = Y;");
      fprintf(FP_OUTPUT,"%s\n","  return SetConsoleScreenBufferSize(hCons, Coord);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Msgbox ){
      fprintf(FP_OUTPUT,"%s\n","int MsgBox (PCTSTR pszMsg, PCTSTR pszTitle, int iNum)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return MessageBox(GetActiveWindow(), pszMsg, pszTitle, iNum);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Center ){
      fprintf(FP_OUTPUT,"%s\n","void Center (HWND hwnd, HWND Xhwnd, HWND Yhwnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  RECT rect, rectP;");
      fprintf(FP_OUTPUT,"%s\n","  int x, y, width, height;");
      fprintf(FP_OUTPUT,"%s\n","  int screenwidth, screenheight;");
      fprintf(FP_OUTPUT,"%s\n","  HMONITOR    hMonitor={0};");
      fprintf(FP_OUTPUT,"%s\n","  MONITORINFO MonitorInfo;");
      fprintf(FP_OUTPUT,"%s\n","  memset(&MonitorInfo, 0, sizeof(MONITORINFO));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect((HWND)hwnd, &rect);");
      fprintf(FP_OUTPUT,"%s\n","  width = rect.right-rect.left;");
      fprintf(FP_OUTPUT,"%s\n","  height = rect.bottom-rect.top;");
      fprintf(FP_OUTPUT,"%s\n","  if(GetSystemMetrics(SM_CMONITORS) == 1)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      hMonitor = MonitorFromRect(&rect,MONITOR_DEFAULTTOPRIMARY);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      hMonitor = MonitorFromRect(&rect,MONITOR_DEFAULTTONEAREST);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  MonitorInfo.cbSize = sizeof(MONITORINFO);");
      fprintf(FP_OUTPUT,"%s\n","  GetMonitorInfo(hMonitor, &MonitorInfo);");
      fprintf(FP_OUTPUT,"%s\n","  if(Xhwnd==NULL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      rect.left = MonitorInfo.rcWork.left + ((MonitorInfo.rcWork.right - MonitorInfo.rcWork.left - width)/2);");
      fprintf(FP_OUTPUT,"%s\n","      rect.top = MonitorInfo.rcWork.top + ((MonitorInfo.rcWork.bottom - MonitorInfo.rcWork.top - height)/2);");
      fprintf(FP_OUTPUT,"%s\n","      rect.right = rect.left + width;");
      fprintf(FP_OUTPUT,"%s\n","      rect.bottom = rect.top + height;");
      fprintf(FP_OUTPUT,"%s\n","      SetWindowPos(hwnd, NULL, rect.left, rect.top, 0, 0, SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);");
      fprintf(FP_OUTPUT,"%s\n","      return;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(hwnd, &rect);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(Xhwnd, &rectP);");
      fprintf(FP_OUTPUT,"%s\n","  width = rect.right-rect.left;");
      fprintf(FP_OUTPUT,"%s\n","  x = ((rectP.right-rectP.left)-width)/2+rectP.left;");
      fprintf(FP_OUTPUT,"%s\n","  if(Yhwnd == NULL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      height = rect.bottom-rect.top;");
      fprintf(FP_OUTPUT,"%s\n","      y = ((rectP.bottom-rectP.top)-height)/2+rectP.top;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      GetWindowRect(Yhwnd, &rectP);;");
      fprintf(FP_OUTPUT,"%s\n","      height = rect.bottom-rect.top;;");
      fprintf(FP_OUTPUT,"%s\n","      y = ((rectP.bottom-rectP.top)-height)/2+rectP.top;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  screenwidth = MonitorInfo.rcWork.right;");
      fprintf(FP_OUTPUT,"%s\n","  screenheight = MonitorInfo.rcWork.bottom;");
      fprintf(FP_OUTPUT,"%s\n","  if(x < MonitorInfo.rcWork.left)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      x = MonitorInfo.rcWork.left+(width/2);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(y < MonitorInfo.rcWork.top)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      y = MonitorInfo.rcWork.top+(height/2);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(((x + width>screenwidth)))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      x = screenwidth-width;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(((y + height>screenheight)))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      y = screenheight-height;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  MoveWindow (hwnd, x, y, width, height, FALSE);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Colordlg ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_ColorDlg (ULONG defcolor, HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static ULONG  CustColors[16];");
      fprintf(FP_OUTPUT,"%s\n","  CHOOSECOLOR cc;");
      fprintf(FP_OUTPUT,"%s\n","  memset(&cc, 0, sizeof(cc));");
      fprintf(FP_OUTPUT,"%s\n","  cc.lStructSize = sizeof(CHOOSECOLOR);");
      fprintf(FP_OUTPUT,"%s\n","  cc.hwndOwner = hWnd;");
      fprintf(FP_OUTPUT,"%s\n","  cc.rgbResult = defcolor;");
      fprintf(FP_OUTPUT,"%s\n","  cc.lpCustColors = CustColors;");
      fprintf(FP_OUTPUT,"%s\n","  cc.Flags = CC_RGBINIT|CC_FULLOPEN;");
      fprintf(FP_OUTPUT,"%s\n","  CmDlgHook = SetWindowsHookEx(WH_CBT, (HOOKPROC)SBProc, NULL, GetCurrentThreadId());");
      fprintf(FP_OUTPUT,"%s\n","  ChooseColor(&cc);");
      fprintf(FP_OUTPUT,"%s\n","  return cc.rgbResult;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Print ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Print(HWND hWnd, int x, int y, PCTSTR Text, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  int a = TextOut(DrawHDC, x, y, Text, strlen(Text));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd, DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return a;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Printex ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Printex (HWND hWnd,long x,long y,char* MyText,long FG_Color,long BG_Color,char* FontFace,long FontSize,HDC hDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC   L_hDC;");
      fprintf(FP_OUTPUT,"%s\n","  HFONT L_hFont;");
      fprintf(FP_OUTPUT,"%s\n","  RECT  L_rc;");
      fprintf(FP_OUTPUT,"%s\n","  SIZE  L_textSize;");
      fprintf(FP_OUTPUT,"%s\n","  if(hDC != 0){");
      fprintf(FP_OUTPUT,"%s\n","      L_hDC = hDC;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      L_hDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  L_hFont = CreateFont(FontSize, 0,0,0,0,0,0,0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, FontFace);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(L_hDC, L_hFont);");
      fprintf(FP_OUTPUT,"%s\n","  GetTextExtentPoint32(L_hDC, MyText, (int)strlen(MyText), &L_textSize);");
      fprintf(FP_OUTPUT,"%s\n","  L_rc.left = x;");
      fprintf(FP_OUTPUT,"%s\n","  L_rc.top = y;");
      fprintf(FP_OUTPUT,"%s\n","  L_rc.right = L_rc.left + L_textSize.cx;");
      fprintf(FP_OUTPUT,"%s\n","  L_rc.bottom = L_rc.top + L_textSize.cy;");
      fprintf(FP_OUTPUT,"%s\n","  SetTextColor(L_hDC, FG_Color);");
      fprintf(FP_OUTPUT,"%s\n","  SetBkColor(L_hDC, BG_Color);");
      fprintf(FP_OUTPUT,"%s\n","  DrawText(L_hDC, MyText, (int)strlen(MyText), &L_rc, DT_LEFT|DT_TOP);");
      fprintf(FP_OUTPUT,"%s\n","  if(hDC == 0){");
      fprintf(FP_OUTPUT,"%s\n","      ReleaseDC(hWnd, L_hDC);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(L_hFont);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Run ){
      fprintf(FP_OUTPUT,"%s\n","int Run (PCTSTR Cmdline, int ShowHide, int WaitState)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int    fRet              =  0;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG  dwState           =  0;");
      fprintf(FP_OUTPUT,"%s\n","  MSG    msg               = {0};");
      fprintf(FP_OUTPUT,"%s\n","  BOOL   bQuitReceived     = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","  BOOL   needShell         = FALSE;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  PTSTR dynCmd            = {0};");
      fprintf(FP_OUTPUT,"%s\n","  PTSTR shellArgs         = {0};");
      fprintf(FP_OUTPUT,"%s\n","  PTSTR appName           = {0};");
      fprintf(FP_OUTPUT,"%s\n","  PTSTR cmdLineToRun      = {0};");
      fprintf(FP_OUTPUT,"%s\n","  TCHAR  comspec[MAX_PATH] = {0};");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  STARTUPINFO         si;");
      fprintf(FP_OUTPUT,"%s\n","  PROCESS_INFORMATION pi;");
      fprintf(FP_OUTPUT,"%s\n","  ZeroMemory(&pi, sizeof(pi));");
      fprintf(FP_OUTPUT,"%s\n","  ZeroMemory(&si, sizeof(si));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  si.cb = sizeof(si);");
      fprintf(FP_OUTPUT,"%s\n","  // Copy original Cmdline (CreateProcess could modify buffer)");
      fprintf(FP_OUTPUT,"%s\n","  dynCmd = _tcsdup(Cmdline);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (!dynCmd) goto EXITRUN;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Always honor requested show/hide state");
      fprintf(FP_OUTPUT,"%s\n","  si.dwFlags |= STARTF_USESHOWWINDOW;");
      fprintf(FP_OUTPUT,"%s\n","  si.wShowWindow = (WORD)ShowHide;");
      fprintf(FP_OUTPUT,"%s\n","  // Determine if a command processor is needed (for >, <, |, & etc.)");
      fprintf(FP_OUTPUT,"%s%s%s\n","  needShell = (_tcspbrk(Cmdline, TEXT(",enc(">|<&"),")) != NULL);");
      fprintf(FP_OUTPUT,"%s\n","  appName = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  cmdLineToRun = dynCmd;");
      fprintf(FP_OUTPUT,"%s\n","  if (needShell)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    DWORD n = GetEnvironmentVariable(TEXT(",enc("COMSPEC"),"), comspec, MAX_PATH);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    if (n == 0 || n >= MAX_PATH) _tcscpy(comspec, TEXT(",enc("cmd.exe"),"));");
      fprintf(FP_OUTPUT,"%s\n","    size_t len = _tcslen(Cmdline) + 4;");
      fprintf(FP_OUTPUT,"%s\n","    shellArgs = (PTSTR)malloc((len + 1) * sizeof(TCHAR));");
      fprintf(FP_OUTPUT,"%s\n","    if (!shellArgs) goto EXITRUN;");
      fprintf(FP_OUTPUT,"%s%s%s\n","    _tcscpy(shellArgs, TEXT(",enc(" /c "),"));");
      fprintf(FP_OUTPUT,"%s\n","    _tcscat(shellArgs, Cmdline);");
      fprintf(FP_OUTPUT,"%s\n","    appName = comspec;");
      fprintf(FP_OUTPUT,"%s\n","    cmdLineToRun = shellArgs;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (CreateProcess((PCTSTR)appName, (PTSTR)cmdLineToRun, NULL, NULL, TRUE,");
      fprintf(FP_OUTPUT,"%s\n","                     NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (WaitState)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      do");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        dwState = MsgWaitForMultipleObjects(1, &pi.hProcess, FALSE, INFINITE, QS_ALLINPUT);");
      fprintf(FP_OUTPUT,"%s\n","        if (dwState == (WAIT_OBJECT_0 + 1))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))");
      fprintf(FP_OUTPUT,"%s\n","          {");
      fprintf(FP_OUTPUT,"%s\n","            if (msg.message == WM_QUIT) bQuitReceived = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","            TranslateMessage(&msg);");
      fprintf(FP_OUTPUT,"%s\n","            DispatchMessage(&msg);");
      fprintf(FP_OUTPUT,"%s\n","          }");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      } while ((dwState == (WAIT_OBJECT_0 + 1)) && !bQuitReceived);");
      fprintf(FP_OUTPUT,"%s\n","      if (dwState == WAIT_OBJECT_0) fRet = 1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      // Process launched successfully, don't wait");
      fprintf(FP_OUTPUT,"%s\n","      fRet = 1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    fRet = -1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","EXITRUN:");
      fprintf(FP_OUTPUT,"%s\n","  if (dynCmd)      free(dynCmd);");
      fprintf(FP_OUTPUT,"%s\n","  if (shellArgs)   free(shellArgs);");
      fprintf(FP_OUTPUT,"%s\n","  if (pi.hThread)  CloseHandle(pi.hThread);");
      fprintf(FP_OUTPUT,"%s\n","  if (pi.hProcess) CloseHandle(pi.hProcess);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Only repost WM_QUIT if we actually received one");
      fprintf(FP_OUTPUT,"%s\n","  if (bQuitReceived) PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","  return fRet;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_PlayWav ){
      fprintf(FP_OUTPUT,"%s\n","void PlayWav (PCTSTR WavFileName, int rsid, int Sync)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!rsid)");
      fprintf(FP_OUTPUT,"%s\n","    PlaySound(WavFileName, NULL, SND_FILENAME|SND_NODEFAULT|Sync);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    PSTR lpRes = (PSTR)GetResource(rsid, RT_RCDATA, 0);");
      fprintf(FP_OUTPUT,"%s\n","    if (lpRes==NULL) return;");
      fprintf(FP_OUTPUT,"%s\n","    PlaySound(lpRes, NULL, SND_MEMORY|SND_NODEFAULT|Sync);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Download ){
      fprintf(FP_OUTPUT,"%s\n","int Download (PCTSTR URL,PCTSTR Localname)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  DeleteUrlCacheEntryA(URL);");
      fprintf(FP_OUTPUT,"%s\n","  if (URLDownloadToFile(NULL, URL, Localname, BINDF_GETNEWESTVERSION, NULL) == S_OK)");
      fprintf(FP_OUTPUT,"%s\n","    return 1;");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_FirstInstance ){
      fprintf(FP_OUTPUT,"%s\n","static HANDLE g_hSingleInstanceMutex = NULL;\n\n");
      fprintf(FP_OUTPUT,"%s\n","BOOL FindFirstInstance (PCTSTR Application)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char MutexName[BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","  HWND hWnd;");
      fprintf(FP_OUTPUT,"%s\n","  int  i;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  strcpy(MutexName, Application);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcat(MutexName, ",enc("_BCX_SingleInstance"),");");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  g_hSingleInstanceMutex = CreateMutex(NULL, FALSE, MutexName);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (g_hSingleInstanceMutex == NULL)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (GetLastError() != ERROR_ALREADY_EXISTS)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return FALSE;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  hWnd = FindWindow(Application, NULL);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (IsIconic(hWnd))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      ShowWindow(hWnd, SW_RESTORE);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    for (i = 0; i < 6 && GetForegroundWindow() != hWnd; i++)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      FlashWindow(hWnd, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","      Sleep(150);");
      fprintf(FP_OUTPUT,"%s\n","      FlashWindow(hWnd, FALSE);");
      fprintf(FP_OUTPUT,"%s\n","      Sleep(150);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    SetForegroundWindow(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  CloseHandle(g_hSingleInstanceMutex);");
      fprintf(FP_OUTPUT,"%s\n","  g_hSingleInstanceMutex = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_ToolTip ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n"," LRESULT BCX_ToolTip(PCTSTR Text, HWND hWnd, int TTStyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    TOOLINFO tti={0};");
      fprintf(FP_OUTPUT,"%s\n","    if (BCX_CreateToolTip(GetParent(hWnd), TTStyle) == 0)");
      fprintf(FP_OUTPUT,"%s\n","        return 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    tti.cbSize = sizeof(tti);");
      fprintf(FP_OUTPUT,"%s\n","    tti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;");
      fprintf(FP_OUTPUT,"%s\n","    tti.hwnd = GetParent(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","    tti.uId = (INT_PTR)hWnd;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Remove existing tool if present");
      fprintf(FP_OUTPUT,"%s\n","    if (SendMessage(BCX_hWnd_ToolTip, TTM_GETTOOLINFO, 0, (LPARAM)&tti))");
      fprintf(FP_OUTPUT,"%s\n","        SendMessage(BCX_hWnd_ToolTip, TTM_DELTOOL, 0, (LPARAM)&tti);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Set up the tool info structure");
      fprintf(FP_OUTPUT,"%s\n","    tti.lpszText = (PTSTR)Text;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Set the maximum width for the tooltip (adjust as needed)");
      fprintf(FP_OUTPUT,"%s\n","    SendMessage(BCX_hWnd_ToolTip, TTM_SETMAXTIPWIDTH, 0, 300);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Add the tool");
      fprintf(FP_OUTPUT,"%s\n","    return SendMessage(BCX_hWnd_ToolTip, TTM_ADDTOOL, 0, (LPARAM)&tti);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_CreateToolTip(HWND hWnd, int TTStyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    ULONG TTType = 0;");
      fprintf(FP_OUTPUT,"%s\n","    if (TTStyle == 0)");
      fprintf(FP_OUTPUT,"%s\n","        TTType = TTS_ALWAYSTIP | TTS_BALLOON;  // Balloon tooltip");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","        TTType = TTS_ALWAYSTIP;  // Rectangular tooltip");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (BCX_hWnd_ToolTip == NULL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","        if (hWnd == NULL)");
      fprintf(FP_OUTPUT,"%s\n","            hWnd = GetActiveWindow();");
      fprintf(FP_OUTPUT,"%s\n","        if (hWnd == NULL)");
      fprintf(FP_OUTPUT,"%s\n","            return 0;");
      fprintf(FP_OUTPUT,"%s\n","        BCX_hWnd_ToolTip = CreateWindowEx(");
      fprintf(FP_OUTPUT,"%s\n","            WS_EX_TOPMOST,");
      fprintf(FP_OUTPUT,"%s\n","            TOOLTIPS_CLASS,");
      fprintf(FP_OUTPUT,"%s\n","            NULL,");
      fprintf(FP_OUTPUT,"%s\n","            WS_POPUP | TTType,");
      fprintf(FP_OUTPUT,"%s\n","            CW_USEDEFAULT, CW_USEDEFAULT,");
      fprintf(FP_OUTPUT,"%s\n","            CW_USEDEFAULT, CW_USEDEFAULT,");
      fprintf(FP_OUTPUT,"%s\n","            hWnd,");
      fprintf(FP_OUTPUT,"%s\n","            NULL,");
      fprintf(FP_OUTPUT,"%s\n","            (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE),");
      fprintf(FP_OUTPUT,"%s\n","            NULL");
      fprintf(FP_OUTPUT,"%s\n","        );\n\n");
      fprintf(FP_OUTPUT,"%s\n","        // Enable multiline tooltips");
      fprintf(FP_OUTPUT,"%s\n","        SetWindowPos(BCX_hWnd_ToolTip, HWND_TOPMOST, 0, 0, 0, 0, ");
      fprintf(FP_OUTPUT,"%s\n","                     SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);");
      fprintf(FP_OUTPUT,"%s\n","        SendMessage(BCX_hWnd_ToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM(32767, 0));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        // Retrieve desktop shortcut font (icon title font)");
      fprintf(FP_OUTPUT,"%s\n","        LOGFONT lf={0};");
      fprintf(FP_OUTPUT,"%s\n","        if (SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","            // Create font based on desktop shortcut font");
      fprintf(FP_OUTPUT,"%s\n","            HFONT hFont = CreateFontIndirect(&lf);");
      fprintf(FP_OUTPUT,"%s\n","            SendMessage(BCX_hWnd_ToolTip, WM_SETFONT, (WPARAM)hFont, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_hWnd_ToolTip;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_LeftStr ){
      fprintf(FP_OUTPUT,"%s\n","int LeftStr (PCTSTR Haystack, PCTSTR Needle, int Insensitive)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == Insensitive)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (strcmp(left(Haystack, (int)strlen(Needle)), Needle)==0)");
      fprintf(FP_OUTPUT,"%s\n","      return 1;");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (strcmp(lcase(left(Haystack, (int)strlen(Needle))), lcase(Needle))==0)");
      fprintf(FP_OUTPUT,"%s\n","    return 1;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_RightStr ){
      fprintf(FP_OUTPUT,"%s\n","int RightStr (PCTSTR Haystack, PCTSTR Needle, int Insensitive)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (0 == Insensitive)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (strcmp(right(Haystack, (int)strlen(Needle)), Needle) == 0)");
      fprintf(FP_OUTPUT,"%s\n","      return 1;");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (strcmp(lcase(right(Haystack,(int)strlen(Needle))), lcase(Needle))==0)");
      fprintf(FP_OUTPUT,"%s\n","    return 1;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Infobox ){
      fprintf(FP_OUTPUT,"%s\n","void InfoBox(PCTSTR Title, PCTSTR xValue, int xSize, int ySize)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  PSTR Value = _strdup(xValue);");
      fprintf(FP_OUTPUT,"%s\n","  if((int)strlen(Value)>32500) Value[32500] = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  LPDLGITEMTEMPLATE lpdit;");
      fprintf(FP_OUTPUT,"%s\n","  LPDLGTEMPLATE lpdt;");
      fprintf(FP_OUTPUT,"%s\n","  HINSTANCE hInst;");
      fprintf(FP_OUTPUT,"%s\n","  HGLOBAL hgbl;");
      fprintf(FP_OUTPUT,"%s\n","  PWORD lpw;");
      fprintf(FP_OUTPUT,"%s\n","  PWSTR lpwsz;");
      fprintf(FP_OUTPUT,"%s\n","  int nchar;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_EDIT = 101;");
      fprintf(FP_OUTPUT,"%s\n","  int ID_OKAY = 102;");
      fprintf(FP_OUTPUT,"%s\n","  // *************************************");
      fprintf(FP_OUTPUT,"%s\n","  hgbl=GlobalAlloc(GMEM_ZEROINIT, 0xFFFF);");
      fprintf(FP_OUTPUT,"%s\n","  lpdt=(LPDLGTEMPLATE)GlobalLock(hgbl);");
      fprintf(FP_OUTPUT,"%s\n","  // *************************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the InfoBox Window");
      fprintf(FP_OUTPUT,"%s\n","  // *************************************");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->style = WS_VISIBLE|DS_NOFAILCREATE|WS_BORDER|DS_CENTER|DS_SETFONT;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cdit = 2;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cx = (SHORT)xSize;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cy = (SHORT)ySize + 10;");
      fprintf(FP_OUTPUT,"%s\n","  lpw = (PWORD)(lpdt+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  nchar = MultiByteToWideChar(CP_ACP, 0, Title, -1, lpwsz, 2*(int)strlen(Title) + 1);");
      fprintf(FP_OUTPUT,"%s\n","  lpw +=  nchar;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = DEFAULT_PITCH;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  nchar = MultiByteToWideChar(CP_ACP, 0, ",enc("Courier"),", -1, lpwsz, 15);");
      fprintf(FP_OUTPUT,"%s\n","  lpw +=  nchar;");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the OKAY button.");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  lpw   = lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  lpdit = (LPDLGITEMTEMPLATE)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->x  = (SHORT)(xSize* 0.5)-24;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->y  = (SHORT)ySize - 29;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cx = (SHORT)40;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cy = (SHORT)12;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->id = (SHORT)ID_OKAY;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->style = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  lpw = (PWORD)(lpdit+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0xFFFF;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0x0080;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz  = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  nchar  = MultiByteToWideChar(CP_ACP, 0, ",enc("Okay"),", -1, lpwsz, 9);");
      fprintf(FP_OUTPUT,"%s\n","  lpw +=  nchar;");
      fprintf(FP_OUTPUT,"%s\n","  lpw = lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  // ************************************");
      fprintf(FP_OUTPUT,"%s\n","  //  Create the Read-Only EDIT control");
      fprintf(FP_OUTPUT,"%s\n","  // ************************************");
      fprintf(FP_OUTPUT,"%s\n","  lpw   = (PWORD)lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  lpdit = (LPDLGITEMTEMPLATE)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->x  =  4;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->y  =  8;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cx = (SHORT)xSize-9;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->cy = (SHORT)ySize-40;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->id = (SHORT)ID_EDIT;");
      fprintf(FP_OUTPUT,"%s\n","  lpdit->style = WS_VISIBLE|WS_VSCROLL|ES_AUTOHSCROLL|WS_CHILD|");
      fprintf(FP_OUTPUT,"%s\n","                 ES_READONLY|ES_MULTILINE|ES_WANTRETURN|WS_HSCROLL;");
      fprintf(FP_OUTPUT,"%s\n","  lpw    = (PWORD)(lpdit+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0xFFFF;");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0x0081;");
      fprintf(FP_OUTPUT,"%s\n","  lpwsz  = (PWSTR)lpw;");
      fprintf(FP_OUTPUT,"%s\n","  nchar  = MultiByteToWideChar(CP_ACP, 0, Value, -1, lpwsz, 2*(int)strlen(Value) + 1);");
      fprintf(FP_OUTPUT,"%s\n","  lpw   += nchar;");
      fprintf(FP_OUTPUT,"%s\n","  lpw    = lpwAlign(lpw);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++ = 0;");
      fprintf(FP_OUTPUT,"%s\n","  // ********************************");
      fprintf(FP_OUTPUT,"%s\n","  GlobalUnlock(hgbl);");
      fprintf(FP_OUTPUT,"%s\n","  hInst = (HINSTANCE)(LONG_PTR)GetWindowLongPtr(0, GWLP_HINSTANCE);");
      fprintf(FP_OUTPUT,"%s\n","  DialogBoxIndirect (hInst, (LPDLGTEMPLATE)hgbl, GetActiveWindow(), (DLGPROC)CB_InfoBox);");
      fprintf(FP_OUTPUT,"%s\n","  GlobalFree(hgbl);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK CB_InfoBox(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  UNREFERENCED_PARAMETER(lParam);");
      fprintf(FP_OUTPUT,"%s\n","  int ID_OKAY = 102;");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg == WM_INITDIALOG)");
      fprintf(FP_OUTPUT,"%s\n","      return TRUE;\n");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg == WM_COMMAND && LOWORD(wParam) == ID_OKAY)");
      fprintf(FP_OUTPUT,"%s\n","      EndDialog(hWnd, 0);\n");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg == WM_CLOSE)");
      fprintf(FP_OUTPUT,"%s\n","      EndDialog(hWnd, 0);");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Inputbox||Use_Infobox ){
      fprintf(FP_OUTPUT,"%s\n","PWORD lpwAlign(PWORD lpIn)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return (PWORD)((((uintptr_t)lpIn) + 3) & (~3));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCXMDialog ){
      fprintf(FP_OUTPUT,"%s\n","INT_PTR BCX_MDialog (DLGPROC DPro, PCTSTR title, HWND hWnd, int X, int Y, int W, int H, int Style, int Exstyle, PCTSTR fntface, int fsz)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  LPDLGTEMPLATE  lpdt;");
      fprintf(FP_OUTPUT,"%s\n","  PWORD  lpw;");
      fprintf(FP_OUTPUT,"%s\n","  PVOID tc = calloc(1024, 1);");
      fprintf(FP_OUTPUT,"%s\n","  lpdt=(LPDLGTEMPLATE)tc;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpdt->style = WS_POPUP|WS_SYSMENU|DS_MODALFRAME|WS_CAPTION;");
      fprintf(FP_OUTPUT,"%s\n","    if (fsz) lpdt->style = lpdt->style|DS_SETFONT;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpdt->style = Style;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->dwExtendedStyle = Exstyle;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cdit = 0;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->x  = X;  lpdt->y  = Y;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cx = W;  lpdt->cy = H;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  lpw=(PWORD)(lpdt+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++=0; *lpw++=0;");
      fprintf(FP_OUTPUT,"%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, title, -1, (PWSTR)lpw, 2*(int)strlen(title) + 1);");
      fprintf(FP_OUTPUT,"%s\n","  if (fsz)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    *lpw++ = fsz;");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_ACP, 0, fntface, -1, (PWSTR)lpw, 2*(int)strlen(fntface) + 1);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  INT_PTR ret = DialogBoxIndirect(BCX_hInstance, (LPDLGTEMPLATE)tc, hWnd, (DLGPROC)DPro);");
      fprintf(FP_OUTPUT,"%s\n","  free(tc);");
      fprintf(FP_OUTPUT,"%s\n","  tc = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  SetDialogScale(0, 1);  //restore previous scale");
      fprintf(FP_OUTPUT,"%s\n","  return ret;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCXDialog ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Dialog (DLGPROC DPro, PCTSTR title, HWND hWnd, int X, int Y, int W, int H, int Style, int Exstyle, PCTSTR fntface, int fsz)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static HWND hdlgs[32];");
      fprintf(FP_OUTPUT,"%s\n","  static DLGPROC dp[32];");
      fprintf(FP_OUTPUT,"%s\n","  int ii=(-1), nxt=(-1);");
      fprintf(FP_OUTPUT,"%s\n","  while (++ii <32 && dp[ii] != DPro)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (dp[ii]==0 && nxt==(-1)) nxt = ii;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (ii<32) // if < 32 then we have a match");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (IsWindow(hdlgs[ii])!=0) return 0;");
      fprintf(FP_OUTPUT,"%s\n","    if (nxt==(-1)) nxt = ii;");
      fprintf(FP_OUTPUT,"%s\n","    dp[ii]=0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  dp[nxt]=DPro;");
      fprintf(FP_OUTPUT,"%s\n","  LPDLGTEMPLATE  lpdt;");
      fprintf(FP_OUTPUT,"%s\n","  PWORD  lpw;");
      fprintf(FP_OUTPUT,"%s\n","  PVOID tc = calloc(1024,1);");
      fprintf(FP_OUTPUT,"%s\n","  lpdt=(LPDLGTEMPLATE)tc;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpdt->style = WS_POPUP|WS_BORDER|WS_SYSMENU|WS_VISIBLE|WS_CAPTION;");
      fprintf(FP_OUTPUT,"%s\n","    if (fsz) lpdt->style = lpdt->style|DS_SETFONT;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpdt->style = Style;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->dwExtendedStyle = Exstyle;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cdit = 0;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->x = X;  lpdt->y =Y;");
      fprintf(FP_OUTPUT,"%s\n","  lpdt->cx = W; lpdt->cy=H;");
      fprintf(FP_OUTPUT,"%s\n","  lpw=(PWORD)(lpdt+1);");
      fprintf(FP_OUTPUT,"%s\n","  *lpw++=0; *lpw++=0;");
      fprintf(FP_OUTPUT,"%s\n","  lpw += MultiByteToWideChar(CP_ACP, 0, title, -1, (PWSTR)lpw, 2*(int)strlen(title)+1);");
      fprintf(FP_OUTPUT,"%s\n","  if (fsz)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    *lpw++ = fsz;");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_ACP, 0, fntface, -1, (PWSTR)lpw, 2*(int)strlen(fntface)+1);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  hdlgs[nxt]=CreateDialogIndirect(BCX_hInstance, (LPDLGTEMPLATE)tc, hWnd, (DLGPROC)DPro);");
      fprintf(FP_OUTPUT,"%s\n","  free(tc);");
      fprintf(FP_OUTPUT,"%s\n","  tc = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  SetDialogScale(0, 1);  //restore previous scale");
      fprintf(FP_OUTPUT,"%s\n","  return hdlgs[nxt];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCXDialog||Use_BCXMDialog||Use_BCXDialogCommon ){
      fprintf(FP_OUTPUT,"%s\n","void SetDialogScale (HWND hdlg, BOOL Restor)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static float BaseX, BaseY;");
      fprintf(FP_OUTPUT,"%s\n","  if (Restor && BaseX)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleX = BaseX;");
      fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleY = BaseY;");
      fprintf(FP_OUTPUT,"%s\n","    BaseX = BaseY = 0;");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (!BaseX)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BaseX = BCX_ScaleX; BaseY = BCX_ScaleY;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  BaseX = BCX_ScaleX; BaseY = BCX_ScaleY;");
      fprintf(FP_OUTPUT,"%s\n","  RECT rc = {0, 0, 4, 8};");
      fprintf(FP_OUTPUT,"%s\n","  MapDialogRect (hdlg, &rc);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleX = (float)rc.right/4;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleY = (float)rc.bottom/8;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetDimension ){
      fprintf(FP_OUTPUT,"%s\n","int GetDimension (PCTSTR PROPNAME, HWND WINHANDLE, BOOL InPixel)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  RECT  rcc, rcp;");
      fprintf(FP_OUTPUT,"%s\n","  int   SX, SY, CAPH, PIX;");
      fprintf(FP_OUTPUT,"%s\n","  if (InPixel==TRUE)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    PIX = 1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    PIX = 15;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  SX = (GetSystemMetrics(SM_CXSIZEFRAME))*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  SY = (GetSystemMetrics(SM_CYSIZEFRAME))*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  CAPH = (GetSystemMetrics(SM_CYCAPTION))*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(WINHANDLE, &rcc);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(GetParent(WINHANDLE), &rcp);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (_stricmp(PROPNAME,",enc("LEFT"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return ((rcc.left-rcp.left)*PIX)-SX;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (_stricmp(PROPNAME,",enc("TOP"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return ((rcc.top-rcp.top)*PIX)-CAPH-SY;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (_stricmp(PROPNAME,",enc("WIDTH"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return (rcc.right-rcc.left)*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (_stricmp(PROPNAME,",enc("HEIGHT"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return (rcc.bottom-rcc.top)*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SetDimension ){
      fprintf(FP_OUTPUT,"%s\n","void SetDimension (PCTSTR PROPNAME, int PROPVAL, HWND WINHANDLE, BOOL InPixel)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  RECT  rcc, rcp;");
      fprintf(FP_OUTPUT,"%s\n","  int   X, Y, W, H, SX, SY, CAPH, PIX;");
      fprintf(FP_OUTPUT,"%s\n","  if (InPixel==TRUE)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    PIX = 1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    PIX = 15;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  SX = (GetSystemMetrics(SM_CXSIZEFRAME))*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  SY = (GetSystemMetrics(SM_CYSIZEFRAME))*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  CAPH = (GetSystemMetrics(SM_CYCAPTION))*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(WINHANDLE, &rcc);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowRect(GetParent(WINHANDLE), &rcp);");
      fprintf(FP_OUTPUT,"%s\n","  X = ((rcc.left-rcp.left)*PIX)-SX;");
      fprintf(FP_OUTPUT,"%s\n","  Y = ((rcc.top-rcp.top)*PIX)-CAPH-SY;");
      fprintf(FP_OUTPUT,"%s\n","  W = (rcc.right-rcc.left)*PIX;");
      fprintf(FP_OUTPUT,"%s\n","  H = (rcc.bottom-rcc.top)*PIX;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if (_stricmp(PROPNAME,",enc("LEFT"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    X = PROPVAL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  else if (_stricmp(PROPNAME,",enc("TOP"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Y = PROPVAL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  else if (_stricmp(PROPNAME,",enc("WIDTH"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    W = PROPVAL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  else if (_stricmp(PROPNAME,",enc("HEIGHT"),")==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    H = PROPVAL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  MoveWindow(WINHANDLE, X/PIX, Y/PIX, W/PIX, H/PIX, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_Controls1 (FILE* FP_OUTPUT)
{
  if(Use_Form ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Form (PCTSTR Caption, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    if (Style == (-1))");
      fprintf(FP_OUTPUT,"%s\n","        Style = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS;");
      fprintf(FP_OUTPUT,"%s\n","    HWND A = CreateWindowEx(Exstyle, BCX_ClassName, Caption, Style, X * BCX_ScaleX, Y * BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","             BCX_ScaleX * (4 + W), BCX_ScaleY * (12 + H), NULL, (HMENU)(UINT_PTR)NULL, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    SendMessage(A, WM_SETFONT, (WPARAM)((BcxFont == 0) ? GetStockObject");
      fprintf(FP_OUTPUT,"%s\n","               (DEFAULT_GUI_FONT) : BcxFont), (LPARAM) MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","    SetWindowPos(A, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);");
      fprintf(FP_OUTPUT,"%s\n","    return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Setclientsize ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_SetClientSize(HWND hwnd, int iWidth, int iHeight, float RatioX, float RatioY)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  RECT rc={0};");
      fprintf(FP_OUTPUT,"%s\n","  RECT rcTemp={0};");
      fprintf(FP_OUTPUT,"%s\n","  int cx, cy;");
      fprintf(FP_OUTPUT,"%s\n","  HMENU hMenu = GetMenu(hwnd);");
      fprintf(FP_OUTPUT,"%s\n","  LONG_PTR dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE);");
      fprintf(FP_OUTPUT,"%s\n","  SetRect(&rc, 0, 0, iWidth * RatioX, iHeight * RatioY);");
      fprintf(FP_OUTPUT,"%s\n","  AdjustWindowRectEx(&rc, dwStyle, (hMenu != NULL), GetWindowLongPtr(hwnd, GWL_EXSTYLE));");
      fprintf(FP_OUTPUT,"%s\n","  if (hMenu != NULL)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    rcTemp = rc;");
      fprintf(FP_OUTPUT,"%s\n","    rcTemp.bottom = 0x7FFF;");
      fprintf(FP_OUTPUT,"%s\n","    SendMessage(hwnd, (UINT_PTR) WM_NCCALCSIZE, (WPARAM) 0, (LPARAM) &rcTemp);");
      fprintf(FP_OUTPUT,"%s\n","    rc.bottom += rcTemp.top;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if ((dwStyle & WS_HSCROLL) == WS_HSCROLL)");
      fprintf(FP_OUTPUT,"%s\n","    rc.bottom = rc.bottom + GetSystemMetrics(SM_CYHSCROLL);");
      fprintf(FP_OUTPUT,"%s\n","  if ((dwStyle & WS_VSCROLL) == WS_VSCROLL)");
      fprintf(FP_OUTPUT,"%s\n","    rc.right = rc.right + GetSystemMetrics(SM_CXVSCROLL);");
      fprintf(FP_OUTPUT,"%s\n","  cx = rc.right - rc.left;");
      fprintf(FP_OUTPUT,"%s\n","  cy = rc.bottom - rc.top;");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowPos(hwnd, NULL, 0, 0, cx, cy, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Get_Window_Width ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Get_Window_Width (HWND hWnd){");
      fprintf(FP_OUTPUT,"%s\n","  RECT rect;");
      fprintf(FP_OUTPUT,"%s\n","  GetClientRect(hWnd, &rect);");
      fprintf(FP_OUTPUT,"%s\n","  return rect.right-rect.left;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Get_Window_Height ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Get_Window_Height (HWND hWnd){");
      fprintf(FP_OUTPUT,"%s\n","  RECT rect;");
      fprintf(FP_OUTPUT,"%s\n","  GetClientRect(hWnd, &rect);");
      fprintf(FP_OUTPUT,"%s\n","  return rect.bottom-rect.top;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Status ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Status (PCTSTR Text, HWND hWnd, int ID, int numparts, int *parts) {");
      fprintf(FP_OUTPUT,"%s\n","   HWND A = CreateWindow(STATUSCLASSNAME,0,WS_CHILD|WS_VISIBLE,0,0,0,0,hWnd,0,BCX_hInstance,0);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   int pts[] = {-1};");
      fprintf(FP_OUTPUT,"%s\n","   if (!parts) parts = pts;");
      fprintf(FP_OUTPUT,"%s\n","   SendMessage(A, (UINT_PTR)SB_SETPARTS, (WPARAM)numparts, (LPARAM)parts);");
      fprintf(FP_OUTPUT,"%s\n","   return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Modstyle ){
      fprintf(FP_OUTPUT,"%s\n","BOOL ModStyle(HWND hWnd, LONG_PTR dwAdd, LONG_PTR dwRemove, BOOL bEx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  SetLastError(0);");
      fprintf(FP_OUTPUT,"%s\n","  LONG_PTR dwStyle = GetWindowLongPtr(hWnd, (bEx ? GWL_EXSTYLE:GWL_STYLE));");
      fprintf(FP_OUTPUT,"%s\n","  LONG_PTR dwNewStyle = (dwStyle & (~dwRemove)) | dwAdd;");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowLongPtr(hWnd, (bEx ? GWL_EXSTYLE : GWL_STYLE), dwNewStyle);");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);");
      fprintf(FP_OUTPUT,"%s\n","  return (0 == GetLastError());");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Button ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Button(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_VISIBLE|BS_MULTILINE|BS_PUSHBUTTON|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle == (-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_STATICEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  HWND A = CreateWindowEx(Exstyle,",enc("button"),", Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                          X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                          hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  if (W==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SIZE *size = GetTextSize(Text, A);");
      fprintf(FP_OUTPUT,"%s\n","    MoveWindow(A, X*BCX_ScaleX, Y*BCX_ScaleY, size->cx+28, size->cy+12, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BmpButton ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_BmpButton(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Res, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND A;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hBmp;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP|BS_BITMAP;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle==(-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_STATICEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("button"),",",DDQ,",Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id,BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  if (!Res)");
      fprintf(FP_OUTPUT,"%s\n","    hBmp = (HBITMAP)LoadImage(0, Text, IMAGE_BITMAP,");
      fprintf(FP_OUTPUT,"%s\n","                              W*BCX_ScaleX, H*BCX_ScaleY, LR_LOADFROMFILE);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    hBmp = (HBITMAP)LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(Res),");
      fprintf(FP_OUTPUT,"%s\n","                              IMAGE_BITMAP, W*BCX_ScaleX, H*BCX_ScaleY, 0);");
      fprintf(FP_OUTPUT,"%s\n","  if (!W && !H)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BITMAP B;");
      fprintf(FP_OUTPUT,"%s\n","    GetObject(hBmp, sizeof(BITMAP), &B);");
      fprintf(FP_OUTPUT,"%s\n","    SetWindowPos(A, 0, 0, 0, B.bmWidth, B.bmHeight, SWP_NOMOVE|SWP_FRAMECHANGED);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage (A, (UINT_PTR)BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBmp);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SplitButton ){
      fprintf(FP_OUTPUT,"%s\n","static BCX_SPLITBUTTONINFO* BCX_FindSplitButton(HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  for (int i = 0; i < BCX_SplitButtonCount; i++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (BCX_SplitButtons[i].hWnd == hWnd)");
      fprintf(FP_OUTPUT,"%s\n","      return &BCX_SplitButtons[i];");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return NULL;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","static BCX_SPLITBUTTONINFO* BCX_FindSplitButtonByID(int nCtlID)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  for (int i = 0; i < BCX_SplitButtonCount; i++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (BCX_SplitButtons[i].nCtlID == nCtlID)");
      fprintf(FP_OUTPUT,"%s\n","      return &BCX_SplitButtons[i];");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return NULL;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","static LRESULT CALLBACK BCX_SplitButtonParentProc(HWND hWnd, UINT uMsg,");
      fprintf(FP_OUTPUT,"%s\n","                                                   WPARAM wParam, LPARAM lParam,");
      fprintf(FP_OUTPUT,"%s\n","                                                   UINT_PTR uIdSubclass, DWORD_PTR dwRefData)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (uMsg == WM_NOTIFY)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    LPNMHDR pnmh = (LPNMHDR)lParam;");
      fprintf(FP_OUTPUT,"%s\n","    if (pnmh->code == BCN_DROPDOWN)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      BCX_SPLITBUTTONINFO *pInfo = BCX_FindSplitButtonByID((int)pnmh->idFrom);");
      fprintf(FP_OUTPUT,"%s\n","      if (pInfo && pInfo->hPopupMenu)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        LPNMBCDROPDOWN pDropDown = (LPNMBCDROPDOWN)lParam;");
      fprintf(FP_OUTPUT,"%s\n","        RECT rc;");
      fprintf(FP_OUTPUT,"%s\n","        CopyRect(&rc, &pDropDown->rcButton);");
      fprintf(FP_OUTPUT,"%s\n","        MapWindowPoints(pInfo->hWnd, HWND_DESKTOP, (LPPOINT)&rc, 2);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        SetForegroundWindow(hWnd);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        UINT nSelected = (UINT)TrackPopupMenu(pInfo->hPopupMenu,");
      fprintf(FP_OUTPUT,"%s\n","                       TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,");
      fprintf(FP_OUTPUT,"%s\n","                       rc.left, rc.bottom, 0, hWnd, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        // Verify this ID exists in the menu (handles cancel returning 0)");
      fprintf(FP_OUTPUT,"%s\n","        MENUITEMINFO mii;");
      fprintf(FP_OUTPUT,"%s\n","        ZeroMemory(&mii, sizeof(MENUITEMINFO));");
      fprintf(FP_OUTPUT,"%s\n","        mii.cbSize = sizeof(MENUITEMINFO);");
      fprintf(FP_OUTPUT,"%s\n","        mii.fMask = MIIM_STRING;");
      fprintf(FP_OUTPUT,"%s\n","        mii.dwTypeData = NULL;");
      fprintf(FP_OUTPUT,"%s\n","        mii.cch = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        if (GetMenuItemInfo(pInfo->hPopupMenu, nSelected, FALSE, &mii))");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          // Valid selection - get the label text");
      fprintf(FP_OUTPUT,"%s\n","          TCHAR szLabel[256];");
      fprintf(FP_OUTPUT,"%s\n","          mii.dwTypeData = szLabel;");
      fprintf(FP_OUTPUT,"%s\n","          mii.cch = 256;");
      fprintf(FP_OUTPUT,"%s\n","          if (GetMenuItemInfo(pInfo->hPopupMenu, nSelected, FALSE, &mii))");
      fprintf(FP_OUTPUT,"%s\n","          {");
      fprintf(FP_OUTPUT,"%s\n","            SetWindowText(pInfo->hWnd, szLabel);");
      fprintf(FP_OUTPUT,"%s\n","          }");
      fprintf(FP_OUTPUT,"%s\n","          // Update the control ID to the selected item's ID");
      fprintf(FP_OUTPUT,"%s\n","          pInfo->nCtlID = nSelected;");
      fprintf(FP_OUTPUT,"%s\n","          SetWindowLongPtr(pInfo->hWnd, GWLP_ID, (LONG_PTR)nSelected);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else if (uMsg == WM_NCDESTROY)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    RemoveWindowSubclass(hWnd, BCX_SplitButtonParentProc, uIdSubclass);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return DefSubclassProc(hWnd, uMsg, wParam, lParam);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_SplitButton_AddSeparator(HWND hSplitBtn)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BCX_SPLITBUTTONINFO *pInfo = BCX_FindSplitButton(hSplitBtn);");
      fprintf(FP_OUTPUT,"%s\n","  if (!pInfo) return;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Create popup menu if it doesn't exist");
      fprintf(FP_OUTPUT,"%s\n","  if (!pInfo->hPopupMenu)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->hPopupMenu = CreatePopupMenu();");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nItemCount = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    MENUINFO mi;");
      fprintf(FP_OUTPUT,"%s\n","    mi.cbSize = sizeof(MENUINFO);");
      fprintf(FP_OUTPUT,"%s\n","    mi.fMask = MIM_STYLE | MIM_BACKGROUND;");
      fprintf(FP_OUTPUT,"%s\n","    mi.dwStyle = MNS_NOCHECK;");
      fprintf(FP_OUTPUT,"%s\n","    mi.hbrBack = GetSysColorBrush(COLOR_3DFACE);");
      fprintf(FP_OUTPUT,"%s\n","    SetMenuInfo(pInfo->hPopupMenu, &mi);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Add the separator");
      fprintf(FP_OUTPUT,"%s\n","  if (pInfo->nItemCount < BCX_MAX_SPLITBUTTON_ITEMS)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    InsertMenu(pInfo->hPopupMenu, -1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nItemCount++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_SplitButton(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD | WS_VISIBLE | BS_SPLITBUTTON | WS_TABSTOP | BS_TEXT | BS_VCENTER;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s%s%s\n","  HWND A = CreateWindowEx(Exstyle, TEXT(",enc("button"),"), Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                          X * BCX_ScaleX, Y * BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                          W * BCX_ScaleX, H * BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                          hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (W == 0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SIZE *size = GetTextSize(Text, A);");
      fprintf(FP_OUTPUT,"%s\n","    MoveWindow(A, X * BCX_ScaleX, Y * BCX_ScaleY, size->cx + 48, size->cy + 12, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Register this split button in our tracking array");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_SplitButtonCount < BCX_MAX_SPLITBUTTONS)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_SPLITBUTTONINFO *pInfo = &BCX_SplitButtons[BCX_SplitButtonCount++];");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->hWnd = A;");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nCtlID = id;");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->hPopupMenu = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nItemCount = 0;");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->lpfnOrigProc = NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Subclass the parent window to intercept WM_NOTIFY");
      fprintf(FP_OUTPUT,"%s\n","    SetWindowSubclass(hWnd, BCX_SplitButtonParentProc, (UINT_PTR)id, 0);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_SplitButton_SetItems(HWND hSplitBtn, BCX_SPLITBUTTONDATA *pItems, int nCount)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BCX_SPLITBUTTONINFO *pInfo = BCX_FindSplitButton(hSplitBtn);");
      fprintf(FP_OUTPUT,"%s\n","  if (!pInfo) return;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Destroy existing menu if any");
      fprintf(FP_OUTPUT,"%s\n","  if (pInfo->hPopupMenu)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    DestroyMenu(pInfo->hPopupMenu);");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->hPopupMenu = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Create new popup menu");
      fprintf(FP_OUTPUT,"%s\n","  pInfo->hPopupMenu = CreatePopupMenu();");
      fprintf(FP_OUTPUT,"%s\n","  pInfo->nItemCount = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Configure menu style");
      fprintf(FP_OUTPUT,"%s\n","  MENUINFO mi;");
      fprintf(FP_OUTPUT,"%s\n","  mi.cbSize = sizeof(MENUINFO);");
      fprintf(FP_OUTPUT,"%s\n","  mi.fMask = MIM_STYLE | MIM_BACKGROUND;");
      fprintf(FP_OUTPUT,"%s\n","  mi.dwStyle = MNS_NOCHECK;");
      fprintf(FP_OUTPUT,"%s\n","  mi.hbrBack = GetSysColorBrush(COLOR_3DFACE);");
      fprintf(FP_OUTPUT,"%s\n","  SetMenuInfo(pInfo->hPopupMenu, &mi);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Add menu items");
      fprintf(FP_OUTPUT,"%s\n","  for (int i = 0; i < nCount && i < BCX_MAX_SPLITBUTTON_ITEMS; i++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    InsertMenu(pInfo->hPopupMenu, -1, MF_BYPOSITION | MF_STRING,");
      fprintf(FP_OUTPUT,"%s\n","               pItems[i].nID, pItems[i].szLabel);");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nItemCount++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_SplitButton_AddItem(HWND hSplitBtn, PCTSTR szLabel, int nID)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BCX_SPLITBUTTONINFO *pInfo = BCX_FindSplitButton(hSplitBtn);");
      fprintf(FP_OUTPUT,"%s\n","  if (!pInfo) return;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Create popup menu if it doesn't exist");
      fprintf(FP_OUTPUT,"%s\n","  if (!pInfo->hPopupMenu)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->hPopupMenu = CreatePopupMenu();");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nItemCount = 0;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    MENUINFO mi;");
      fprintf(FP_OUTPUT,"%s\n","    mi.cbSize = sizeof(MENUINFO);");
      fprintf(FP_OUTPUT,"%s\n","    mi.fMask = MIM_STYLE | MIM_BACKGROUND;");
      fprintf(FP_OUTPUT,"%s\n","    mi.dwStyle = MNS_NOCHECK;");
      fprintf(FP_OUTPUT,"%s\n","    mi.hbrBack = GetSysColorBrush(COLOR_3DFACE);");
      fprintf(FP_OUTPUT,"%s\n","    SetMenuInfo(pInfo->hPopupMenu, &mi);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Add the new item");
      fprintf(FP_OUTPUT,"%s\n","  if (pInfo->nItemCount < BCX_MAX_SPLITBUTTON_ITEMS)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    InsertMenu(pInfo->hPopupMenu, -1, MF_BYPOSITION | MF_STRING, nID, szLabel);");
      fprintf(FP_OUTPUT,"%s\n","    pInfo->nItemCount++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Edit ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Edit(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_VISIBLE|ES_WANTRETURN|WS_TABSTOP|");
      fprintf(FP_OUTPUT,"%s\n","            WS_VSCROLL|ES_MULTILINE|ES_AUTOVSCROLL|ES_AUTOHSCROLL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle==(-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("edit"),", Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Elf ){
      fprintf(FP_OUTPUT,"%s\n","void EditLoadFile (HWND hWnd, PCTSTR File)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  long FileLen;");
      fprintf(FP_OUTPUT,"%s\n","  char *Buff;");
      fprintf(FP_OUTPUT,"%s\n","  FILE *FP;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Exist(File))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(), join(2,",enc("File Not Found:"),",File), ",enc("Error!"),",0);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if ((FP = fopen(File,",enc("rb"),"))==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(), join(2,",enc("Could not read file:"),",File),",enc("Error!"),",0);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  FileLen = lof(File)+1;");
      fprintf(FP_OUTPUT,"%s\n","  Buff=(char*)calloc(FileLen, sizeof(char));");
      fprintf(FP_OUTPUT,"%s\n","  GET(FP, Buff, FileLen);");
      fprintf(FP_OUTPUT,"%s\n","  fclose(FP);");
      fprintf(FP_OUTPUT,"%s\n","  FP = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(hWnd, (UINT_PTR)WM_SETTEXT, (WPARAM)0, (LPARAM)Buff);");
      fprintf(FP_OUTPUT,"%s\n","  if (Buff)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    free(Buff);");
      fprintf(FP_OUTPUT,"%s\n","    Buff = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ListBoxLoadFile ){
      fprintf(FP_OUTPUT,"%s\n","void ListBoxLoadFile (HWND hWnd, PCTSTR Arg_Astr, int apend, int scrol)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  FILE* fp;");
      fprintf(FP_OUTPUT,"%s\n","  static int siz;");
      fprintf(FP_OUTPUT,"%s\n","  int buflen;");
      fprintf(FP_OUTPUT,"%s\n","  char Buff[2049];");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if ((fp = fopen(Arg_Astr,",enc("rb"),"))==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(),",enc("File Not Found"),",",enc("Error!"),",0);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (!apend)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    siz = 0;");
      fprintf(FP_OUTPUT,"%s\n","    SendMessage(hWnd, LB_RESETCONTENT, 0, 0);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","   while(!EoF(fp))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    *Buff = 0;");
      fprintf(FP_OUTPUT,"%s\n","    fgets(Buff, 2048, fp);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    Buff[strcspn(Buff, ",enc("\\r\\n"),")] = 0;");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(Buff, trim(Buff));");
      fprintf(FP_OUTPUT,"%s\n","    buflen = strlen(Buff);");
      fprintf(FP_OUTPUT,"%s\n","    if (buflen>siz) siz = buflen;");
      fprintf(FP_OUTPUT,"%s\n","    if (buflen)");
      fprintf(FP_OUTPUT,"%s\n","      SendMessage(hWnd, (UINT_PTR)LB_ADDSTRING,  0, (LPARAM)Buff);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (scrol)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    buflen = 10+GetTextSize(stringx(siz, 65), hWnd)->cx;");
      fprintf(FP_OUTPUT,"%s\n","    SendMessage(hWnd, (UINT_PTR)LB_SETHORIZONTALEXTENT, (WPARAM)buflen, 0);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (fp) fclose(fp);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ComboBoxLoadFile ){
      fprintf(FP_OUTPUT,"%s\n","void ComboBoxLoadFile (HWND hWnd, PCTSTR Arg_Astr)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  FILE* fp;");
      fprintf(FP_OUTPUT,"%s\n","  char Buff[2049];");
      fprintf(FP_OUTPUT,"%s%s%s\n","  if ((fp = fopen(Arg_Astr,",enc("rb"),"))==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(),",enc("File Not Found"),",",enc("Error!"),",0);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage (hWnd, CB_RESETCONTENT, 0, 0);");
      fprintf(FP_OUTPUT,"%s\n","  while(!feof(fp))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    *Buff = 0;");
      fprintf(FP_OUTPUT,"%s\n","    fgets(Buff, 2048, fp);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    Buff[strcspn(Buff, ",enc("\\r\\n"),")] = 0;");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(Buff, trim(Buff));");
      fprintf(FP_OUTPUT,"%s\n","    if (strlen(Buff))");
      fprintf(FP_OUTPUT,"%s\n","      SendMessage(hWnd, (UINT_PTR)CB_ADDSTRING, (WPARAM)0, (LPARAM)Buff);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (fp) fclose(fp);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Input ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Input(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_LEFT|ES_AUTOHSCROLL;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle==(-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("edit"),",Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Label ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Label(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|SS_NOTIFY|SS_LEFT|WS_VISIBLE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  HWND A = CreateWindowEx(Exstyle,",enc("static"),",Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                          X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                          hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  if (W==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SIZE* size = GetTextSize(Text, A);");
      fprintf(FP_OUTPUT,"%s\n","    MoveWindow(A, X*BCX_ScaleX, Y*BCX_ScaleY, size->cx, size->cy, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Group ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Group(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = BS_GROUPBOX|WS_CHILD|WS_VISIBLE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("button"),",Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Checkbox ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Checkbox(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("button"),",Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  if (W==0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      SIZE *size = GetTextSize(Text, A);");
      fprintf(FP_OUTPUT,"%s\n","      MoveWindow(A, X*BCX_ScaleX, Y*BCX_ScaleY, size->cx+28, size->cy, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Radio ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Radio(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = Style|WS_CHILD|WS_TABSTOP|WS_VISIBLE|BS_AUTORADIOBUTTON;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("button"),",Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  if (W==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    SIZE *size = GetTextSize(Text, A);");
      fprintf(FP_OUTPUT,"%s\n","    MoveWindow(A, X*BCX_ScaleX, Y*BCX_ScaleY, size->cx+28, size->cy, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Combobox ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Combobox(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_VISIBLE|CBS_DROPDOWN|CBS_SORT|WS_VSCROLL|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle == (-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("Combobox"),", NULL,","Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Listbox ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Listbox(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = LBS_STANDARD|WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle == (-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("Listbox"),",NULL,","Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Treeview ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Treeview(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_VISIBLE|WS_CHILD|WS_TABSTOP|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle == (-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s\n","  A = CreateWindowEx(Exstyle, WC_TREEVIEW, NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Blackrect ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_BlackRect(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|SS_NOTIFY|WS_VISIBLE|SS_BLACKRECT;");
      fprintf(FP_OUTPUT,"%s%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("static"),",NULL,","Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Whiterect ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_WhiteRect(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","      Style = WS_CHILD|SS_NOTIFY|WS_VISIBLE|SS_WHITERECT;");
      fprintf(FP_OUTPUT,"%s%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("static"),",NULL,","Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Grayrect ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_GrayRect(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|SS_NOTIFY|WS_VISIBLE|SS_GRAYRECT;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("static"),",NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Datepick ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_DatePick(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD|WS_TABSTOP|WS_VISIBLE|DTS_LONGDATEFORMAT;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle == (-1))");
      fprintf(FP_OUTPUT,"%s\n","    Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s","  A = CreateWindowEx(Exstyle,");
      fprintf(FP_OUTPUT,"%s%s\n",enc("SysDateTimePick32"),", NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Richedit ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_RichEdit(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static HMODULE hMsftedit = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  if (!hMsftedit)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    hMsftedit = LoadLibrary(",enc("Msftedit.dll"),");");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Style = WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_VISIBLE |");
      fprintf(FP_OUTPUT,"%s\n","            WS_HSCROLL | WS_VSCROLL | ES_MULTILINE |");
      fprintf(FP_OUTPUT,"%s\n","            ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle==(-1))   Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("RichEdit50W"),", NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X * BCX_ScaleX, Y * BCX_ScaleY, W * BCX_ScaleX, H * BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, EM_EXLIMITTEXT, 0, 0x7FFFFFFF); // Increase allowable size to 2 GB");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowRTFText(A, Text);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","void SetWindowRTFText (HWND hWnd, PCTSTR Text)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  typedef struct _SETTEXTEX");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    UINT  codepage;");
      fprintf(FP_OUTPUT,"%s\n","    ULONG flags;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  SETTEXTEX, *LPSETTEXTEX;");
      fprintf(FP_OUTPUT,"%s\n","  SETTEXTEX  Rtb;");
      fprintf(FP_OUTPUT,"%s\n","  Rtb.flags = 2; //ST_SELECTION;");
      fprintf(FP_OUTPUT,"%s\n","  Rtb.codepage = CP_ACP;");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(hWnd, (UINT_PTR)EM_SETTEXTEX, (WPARAM)&Rtb, (LPARAM)Text);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Bitmap ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Bitmap(PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Res, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND A;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hBitmap = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CLIPSIBLINGS|WS_CHILD|WS_VISIBLE|SS_BITMAP|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle, ",enc("static"),", NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY,W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (Res)");
      fprintf(FP_OUTPUT,"%s\n","    hBitmap=(HBITMAP)LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(Res), IMAGE_BITMAP,");
      fprintf(FP_OUTPUT,"%s\n","                               W*BCX_ScaleX, H*BCX_ScaleY, LR_CREATEDIBSECTION);");
      fprintf(FP_OUTPUT,"%s\n","  else if (Text != NULL)");
      fprintf(FP_OUTPUT,"%s\n","     {");
      fprintf(FP_OUTPUT,"%s\n","       if (*Text)");
      fprintf(FP_OUTPUT,"%s\n","         hBitmap=(HBITMAP)LoadImage(0, Text, IMAGE_BITMAP, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                                    LR_LOADFROMFILE|LR_CREATEDIBSECTION);");
      fprintf(FP_OUTPUT,"%s\n","     }");
      fprintf(FP_OUTPUT,"%s\n","   if (hBitmap)");
      fprintf(FP_OUTPUT,"%s\n","     SendMessage(A, (UINT_PTR)STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_OlePicture ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_OlePicture (PCTSTR szFile, HWND hWnd, int id, int X, int Y, int W, int H, int Res, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND       A;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP    hBitmap;");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP     bm;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG      dwFileSize;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG      dwBytesRead;");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE     hFile;");
      fprintf(FP_OUTPUT,"%s\n","  LPPICTURE  gpPicture;");
      fprintf(FP_OUTPUT,"%s\n","  PVOID     lpPicData;");
      fprintf(FP_OUTPUT,"%s\n","  PVOID     pvData;");
      fprintf(FP_OUTPUT,"%s\n","  LPSTREAM   pstm;");
      fprintf(FP_OUTPUT,"%s\n","  HGLOBAL    hGlobal;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP|SS_BITMAP;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("static"),", NULL, Style, X*BCX_ScaleX, Y*BCX_ScaleY, 0, 0, hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (Res)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpPicData = GetResource(Res, RT_RCDATA, &dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","    if (lpPicData==NULL) return 0;");
      fprintf(FP_OUTPUT,"%s\n","    hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","    pvData = GlobalLock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","    CopyMemory(pvData, lpPicData, dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","    GlobalUnlock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hFile = CreateFile(szFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    dwFileSize = GetFileSize(hFile, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    if (dwFileSize==(-1))");
      fprintf(FP_OUTPUT,"%s\n","      return NULL;");
      fprintf(FP_OUTPUT,"%s\n","    hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","    pvData = GlobalLock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","    ReadFile(hFile, pvData, dwFileSize, &dwBytesRead, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    GlobalUnlock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","    CloseHandle(hFile);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  CreateStreamOnHGlobal(hGlobal, TRUE, &pstm);");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  OleLoadPicture(pstm, 0, FALSE, &IID_IPicture, (PVOID*)&gpPicture);");
      fprintf(FP_OUTPUT,"%s\n","  pstm->lpVtbl->Release(pstm);");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->lpVtbl->get_Handle(gpPicture, (OLE_HANDLE*)&hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  OleLoadPicture(pstm, 0, FALSE, IID_IPicture, (PVOID*)&gpPicture);");
      fprintf(FP_OUTPUT,"%s\n","  pstm->Release();");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->get_Handle((OLE_HANDLE*)&hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  GetObject(hBitmap, sizeof(bm), &bm);");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowLongPtr(A, GWLP_USERDATA, (LONG_PTR)MAKELONG(bm.bmWidth, bm.bmHeight));");
      fprintf(FP_OUTPUT,"%s\n","  hBitmap = (HBITMAP)CopyImage(hBitmap, IMAGE_BITMAP, W*BCX_ScaleX, H*BCX_ScaleY, 0);");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, (UINT_PTR)STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->lpVtbl->Release(gpPicture);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->Release();");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Icon ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Icon (PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Res, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HICON hIcon;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG dwSize;");
      fprintf(FP_OUTPUT,"%s\n","  PBYTE pBytes;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CHILD|WS_VISIBLE|SS_ICON|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  HWND A = CreateWindowEx(Exstyle, ",enc("static"),", NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                          X*BCX_ScaleX, Y*BCX_ScaleY, 0, 0,");
      fprintf(FP_OUTPUT,"%s\n","                          hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (!Res)");
      fprintf(FP_OUTPUT,"%s\n","    hIcon=(HICON)LoadImage(0, Text, IMAGE_ICON, W, H, LR_LOADFROMFILE);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    pBytes=(PBYTE)GetResource(Res, RT_ANICURSOR, &dwSize);");
      fprintf(FP_OUTPUT,"%s\n","    if (pBytes==NULL)");
      fprintf(FP_OUTPUT,"%s\n","      hIcon=(HICON)LoadImage(BCX_hInstance, MAKEINTRESOURCE(Res), IMAGE_ICON, W, H, 0);");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      hIcon = CreateIconFromResourceEx(pBytes, dwSize, FALSE, 0x00030000, W, H, LR_DEFAULTCOLOR);");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, (UINT_PTR)STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)hIcon);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_Controls2 (FILE* FP_OUTPUT)
{
  if(Use_Listview ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_ListView (PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle, int Cols)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND A;");
      fprintf(FP_OUTPUT,"%s\n","  LV_COLUMN Local_lvCol =");
      fprintf(FP_OUTPUT,"%s%s%s\n","  { LVCF_FMT|LVCF_WIDTH|LVCF_TEXT|LVCF_SUBITEM, LVCFMT_LEFT, 65, ",DDQ,", 0, 0 };\n");
      fprintf(FP_OUTPUT,"%s\n","  // Note: 0x241 = LVS_REPORT|LVS_SHAREIMAGELISTS|LVS_EDITLABELS");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CHILD|WS_TABSTOP|WS_VISIBLE|0x241|WS_BORDER;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle==(-1)) Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("SysListView32"),", NULL, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  Style = LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT;");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, (UINT_PTR)LVM_SETEXTENDEDLISTVIEWSTYLE, (WPARAM)0, (LPARAM)Style);");
      fprintf(FP_OUTPUT,"%s\n","  for(; Local_lvCol.iSubItem<Cols; Local_lvCol.iSubItem += 1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    ListView_InsertColumn(A, 0, &Local_lvCol);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Control ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Control (PCTSTR Class, HWND hWnd, PCTSTR Caption, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;");
      fprintf(FP_OUTPUT,"%s\n","  A = CreateWindowEx(Exstyle, Class, Caption, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd, (HMENU)(UINT_PTR)id,  BCX_hInstance,  NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ProgressBar ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_ProgressBar (PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND A;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  if (Exstyle==(-1)) Exstyle = WS_EX_CLIENTEDGE;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  A = CreateWindowEx(Exstyle,",enc("msctls_progress32"),",Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY, hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, PBM_SETRANGE, 0, MAKELONG(0, 100));");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A, PBM_SETSTEP, 1, 0);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetResource ){
      fprintf(FP_OUTPUT,"%s\n","PVOID GetResource (int Res, char *ResType, ULONG *ResSize)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HRSRC hRes;");
      fprintf(FP_OUTPUT,"%s\n","  HMODULE hMod = GetModuleHandle(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  hRes = FindResource(hMod, MAKEINTRESOURCE(Res), ResType);");
      fprintf(FP_OUTPUT,"%s\n","  if (hRes==NULL) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (ResSize) *ResSize = SizeofResource(hMod, hRes);");
      fprintf(FP_OUTPUT,"%s\n","  return LockResource(LoadResource(hMod, hRes));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GetTextSize ){
      fprintf(FP_OUTPUT,"%s\n","SIZE* GetTextSize (PCTSTR Text, HWND hWnd, HFONT fnt)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC  hdc = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  if (!fnt) fnt = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);");
      fprintf(FP_OUTPUT,"%s\n","  HFONT sobj = (HFONT)SelectObject(hdc, fnt);");
      fprintf(FP_OUTPUT,"%s\n","  static SIZE sz;");
      fprintf(FP_OUTPUT,"%s\n","  GetTextExtentPoint32(hdc, (char*)Text, strlen(Text), &sz);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hdc, sobj);");
      fprintf(FP_OUTPUT,"%s\n","  ReleaseDC(hWnd, hdc);");
      fprintf(FP_OUTPUT,"%s\n","  return (&sz);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Slider ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Slider (PCTSTR Text, HWND hWnd, int id, int X, int Y, int W, int H, int orient, int Style, int Exstyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND  A,B;");
      fprintf(FP_OUTPUT,"%s\n","  if (Style==0||Style==TBS_VERT)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Style = Style|WS_CHILD|WS_VISIBLE|TBS_AUTOTICKS|WS_TABSTOP;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  A = CreateWindowEx(Exstyle, TRACKBAR_CLASS, Text, Style,");
      fprintf(FP_OUTPUT,"%s\n","                     X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                     hWnd,(HMENU)(UINT_PTR)id, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (*Text==0) return A;");
      fprintf(FP_OUTPUT,"%s\n","  SIZE*  size = GetTextSize(Text, 0, (HFONT)DefaultFont);");
      fprintf(FP_OUTPUT,"%s\n","  size->cy += 4; size->cx += 4;");
      fprintf(FP_OUTPUT,"%s\n","  if (orient==0||orient>3) {X = X+(W-size->cx) * 0.5; Y = Y+H+2;}");
      fprintf(FP_OUTPUT,"%s\n","  if (orient==1) {X = X+(W-size->cx) * 0.5; Y = Y-size->cy;}");
      fprintf(FP_OUTPUT,"%s\n","  if (orient==2) {X = X-size->cx; Y = Y+(H-size->cy) * 0.5;}");
      fprintf(FP_OUTPUT,"%s\n","  if (orient==3) {X = X+W+4; Y = Y+(H-size->cy) * 0.5;}");
      fprintf(FP_OUTPUT,"%s\n","  B = BCX_Label(Text, hWnd, 0, X, Y, size->cx, size->cy, WS_CHILD|WS_VISIBLE|WS_TABSTOP|SS_CENTER);");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowLongPtr(A, GWLP_USERDATA, (LONG_PTR)B);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Splitter ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Splitter (HWND hWnd, int id, int swsStyle, int splittype, int X, int Y, int W, int H)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  LPSPLITTERINFO  lpsiWndInfo;");
      fprintf(FP_OUTPUT,"%s\n","  RECT  rParentRect;");
      fprintf(FP_OUTPUT,"%s\n","  static  ATOM  Class;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Class)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    static WNDCLASS  wc;");
      fprintf(FP_OUTPUT,"%s\n","    wc.style = CS_PARENTDC;");
      fprintf(FP_OUTPUT,"%s\n","    wc.lpfnWndProc=(WNDPROC)SplitterWndProc;");
      fprintf(FP_OUTPUT,"%s\n","    wc.cbClsExtra = 0;");
      fprintf(FP_OUTPUT,"%s\n","    wc.cbWndExtra = 4;");
      fprintf(FP_OUTPUT,"%s\n","    wc.hInstance = BCX_hInstance;");
      fprintf(FP_OUTPUT,"%s\n","    wc.hIcon=(HICON)NULL;");
      fprintf(FP_OUTPUT,"%s\n","    wc.hCursor=(HCURSOR)NULL;");
      fprintf(FP_OUTPUT,"%s\n","    wc.hbrBackground=(HBRUSH)(COLOR_ACTIVEBORDER+1);");
      fprintf(FP_OUTPUT,"%s\n","    wc.lpszMenuName = NULL;");
      fprintf(FP_OUTPUT,"%s%s%s\n","    wc.lpszClassName=",enc("SplitterWndClass"),";");
      fprintf(FP_OUTPUT,"%s\n","    Class = RegisterClass(&wc);");
      fprintf(FP_OUTPUT,"%s\n","    if (!Class) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  lpsiWndInfo=(LPSPLITTERINFO)GlobalAlloc(GPTR, sizeof(SPLITTERINFO));");
      fprintf(FP_OUTPUT,"%s\n","  if (lpsiWndInfo==NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n","  lpsiWndInfo->swsStyle = swsStyle;");
      fprintf(FP_OUTPUT,"%s\n","  lpsiWndInfo->splittype = splittype;");
      fprintf(FP_OUTPUT,"%s\n","  lpsiWndInfo->percent = 50;");
      fprintf(FP_OUTPUT,"%s\n","  if (swsStyle==HS_HORIZONTAL)");
      fprintf(FP_OUTPUT,"%s\n","    lpsiWndInfo->hCursor = LoadCursor(NULL, IDC_SIZENS);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    lpsiWndInfo->hCursor = LoadCursor(NULL, IDC_SIZEWE);");
      fprintf(FP_OUTPUT,"%s\n","  if (W==0||H==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    GetClientRect(hWnd, &rParentRect);");
      fprintf(FP_OUTPUT,"%s\n","    X = Y = 0;");
      fprintf(FP_OUTPUT,"%s\n","    W = rParentRect.right;");
      fprintf(FP_OUTPUT,"%s\n","    H = rParentRect.bottom;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  return CreateWindow (",enc("SplitterWndClass"),",",DDQ,", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,");
      fprintf(FP_OUTPUT,"%s\n","                       X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY, hWnd, (HMENU)(UINT_PTR)id, BCX_hInstance, lpsiWndInfo);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","int  BCX_SetSplitPos (HWND hwnd, int nPercentPos, int nNewPos)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  LPSPLITTERINFO  lpsiInfo=(LPSPLITTERINFO)(LONG_PTR)GetWindowLongPtr(hwnd, GWLP_USERDATA);");
      fprintf(FP_OUTPUT,"%s\n","  RECT  rcClient;");
      fprintf(FP_OUTPUT,"%s\n","  int  nPosMax;");
      fprintf(FP_OUTPUT,"%s\n","  int  vhExtent;");
      fprintf(FP_OUTPUT,"%s\n","  if (NULL==lpsiInfo->hwPane1) lpsiInfo->hwPane1 = GetWindow(hwnd, GW_CHILD);");
      fprintf(FP_OUTPUT,"%s\n","  if (NULL==lpsiInfo->hwPane2 && NULL!=lpsiInfo->hwPane1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpsiInfo->hwPane2 = GetWindow(lpsiInfo->hwPane1, GW_HWNDNEXT);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  GetClientRect(hwnd, &rcClient);");
      fprintf(FP_OUTPUT,"%s\n","  if (lpsiInfo->swsStyle==HS_HORIZONTAL)");
      fprintf(FP_OUTPUT,"%s\n","    vhExtent = rcClient.bottom;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    vhExtent = rcClient.right;");
      fprintf(FP_OUTPUT,"%s\n","  if (!nNewPos)");
      fprintf(FP_OUTPUT,"%s\n","    nNewPos=(vhExtent*nPercentPos)/100;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    nPercentPos = 0;");
      fprintf(FP_OUTPUT,"%s\n","  if (nNewPos<(MIN_PANESIZE+SPLITBAR_SIZE))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    lpsiInfo->fMovingBar = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","    ReleaseCapture();");
      fprintf(FP_OUTPUT,"%s\n","    nNewPos = MIN_PANESIZE+SPLITBAR_SIZE;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    nPosMax = vhExtent-(MIN_PANESIZE+SPLITBAR_SIZE);");
      fprintf(FP_OUTPUT,"%s\n","    if (nNewPos>nPosMax)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      nNewPos = nPosMax;");
      fprintf(FP_OUTPUT,"%s\n","      lpsiInfo->fMovingBar = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","      ReleaseCapture();");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (!nPercentPos)");
      fprintf(FP_OUTPUT,"%s\n","    lpsiInfo->percent=(100*nNewPos)/vhExtent;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    lpsiInfo->percent = nPercentPos;");
      fprintf(FP_OUTPUT,"%s\n","  if (lpsiInfo->fMovingBar && lpsiInfo->splittype) return nNewPos;");
      fprintf(FP_OUTPUT,"%s\n","  // =============================================================");
      fprintf(FP_OUTPUT,"%s\n","  //                       Redraw Splitter");
      fprintf(FP_OUTPUT,"%s\n","  // =============================================================");
      fprintf(FP_OUTPUT,"%s\n","  if (lpsiInfo->swsStyle==HS_HORIZONTAL)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (lpsiInfo->hwPane1)");
      fprintf(FP_OUTPUT,"%s\n","      MoveWindow(lpsiInfo->hwPane1,0, 0, rcClient.right, nNewPos, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","    if (lpsiInfo->hwPane2)");
      fprintf(FP_OUTPUT,"%s\n","      MoveWindow(lpsiInfo->hwPane2, 0, nNewPos+SPLITBAR_SIZE, rcClient.right, rcClient.bottom-(nNewPos+SPLITBAR_SIZE), TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (lpsiInfo->hwPane1)");
      fprintf(FP_OUTPUT,"%s\n","      MoveWindow(lpsiInfo->hwPane1, 0, 0, nNewPos, rcClient.bottom, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","    if (lpsiInfo->hwPane2)");
      fprintf(FP_OUTPUT,"%s\n","      MoveWindow(lpsiInfo->hwPane2, nNewPos+SPLITBAR_SIZE, 0, rcClient.right-(nNewPos+SPLITBAR_SIZE), rcClient.bottom, TRUE);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return nNewPos;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK SplitterWndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  LPSPLITTERINFO lpsiInfo=(LPSPLITTERINFO)(LONG_PTR)GetWindowLongPtr(hwnd,GWLP_USERDATA);");
      fprintf(FP_OUTPUT,"%s\n","  static RECT rrc;");
      fprintf(FP_OUTPUT,"%s\n","  static BOOL neederase;");
      fprintf(FP_OUTPUT,"%s\n","  int temppos;\n");
      fprintf(FP_OUTPUT,"%s\n","  for(;;)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_CREATE)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      LPCREATESTRUCT  lpCreateStruct=(LPCREATESTRUCT)lParam;");
      fprintf(FP_OUTPUT,"%s\n","      SetWindowLongPtr (hwnd, GWLP_USERDATA, (LONG_PTR)lpCreateStruct->lpCreateParams);");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_SIZE)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (wParam!=SIZE_MINIMIZED) BCX_SetSplitPos(hwnd, lpsiInfo->percent);");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_LBUTTONDOWN)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      lpsiInfo->fMovingBar = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","      SetCursor(lpsiInfo->hCursor);");
      fprintf(FP_OUTPUT,"%s\n","      SetCapture(hwnd);");
      fprintf(FP_OUTPUT,"%s\n","      if (lpsiInfo->splittype)");
      fprintf(FP_OUTPUT,"%s\n","        GetClientRect(hwnd, &rrc);");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_LBUTTONUP)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (lpsiInfo->fMovingBar)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        lpsiInfo->fMovingBar = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","        ReleaseCapture();");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if (lpsiInfo->splittype)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (neederase) // Don't redraw(erase) if we never moved the bar");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          DrawXorBar(hwnd, 0);");
      fprintf(FP_OUTPUT,"%s\n","          neederase = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        BCX_SetSplitPos(hwnd, lpsiInfo->percent);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_MOUSEMOVE)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (lpsiInfo->fMovingBar)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (lpsiInfo->swsStyle==HS_HORIZONTAL)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          temppos = BCX_SetSplitPos(hwnd, 0, HIWORD(lParam));");
      fprintf(FP_OUTPUT,"%s\n","          rrc.top = temppos-2;");
      fprintf(FP_OUTPUT,"%s\n","          rrc.bottom = temppos+2;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        else");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          temppos = BCX_SetSplitPos(hwnd, 0, LOWORD(lParam));");
      fprintf(FP_OUTPUT,"%s\n","          rrc.left = temppos-2;");
      fprintf(FP_OUTPUT,"%s\n","          rrc.right = temppos+2;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (lpsiInfo->splittype && lpsiInfo->fMovingBar)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          if (neederase) DrawXorBar(hwnd, 0);");
      fprintf(FP_OUTPUT,"%s\n","          DrawXorBar(hwnd, &rrc);");
      fprintf(FP_OUTPUT,"%s\n","          neederase = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      else");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        SetCursor(lpsiInfo->hCursor);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_COMMAND || msg==WM_NOTIFY || msg==WM_HSCROLL || msg==WM_VSCROLL || msg==WM_CTLCOLOREDIT ||");
      fprintf(FP_OUTPUT,"%s\n","        msg==WM_CTLCOLORSTATIC || msg==WM_CTLCOLORBTN || msg==WM_CTLCOLORLISTBOX ||msg==WM_CTLCOLORSCROLLBAR ||");
      fprintf(FP_OUTPUT,"%s\n","        msg==WM_MEASUREITEM || msg==WM_CONTEXTMENU  || msg==WM_DRAWITEM)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return SendMessage(GetParent(hwnd), (UINT_PTR)msg, (WPARAM)wParam, (LPARAM)lParam);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (msg==WM_DESTROY)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      GlobalFree(lpsiInfo);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    break;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return DefWindowProc(hwnd, msg, wParam, lParam);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void DrawXorBar (HWND hWnd, RECT *rc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static RECT R;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hbm;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH  hbr, hbrushOld;");
      fprintf(FP_OUTPUT,"%s\n","  WORD dotPatternBmp[] = { 170, 85, 170, 85, 170, 85, 170, 85 };");
      fprintf(FP_OUTPUT,"%s\n","  HDC hdc = GetDCEx(hWnd, 0, DCX_PARENTCLIP);");
      fprintf(FP_OUTPUT,"%s\n","  SetTextColor(hdc, SplitBarFG ^ RGB(255, 255, 255));");
      fprintf(FP_OUTPUT,"%s\n","  SetBkColor  (hdc, SplitBarBG ^ RGB(255, 255, 255));");
      fprintf(FP_OUTPUT,"%s\n","  hbm = CreateBitmap(8, 8, 1, 1, dotPatternBmp);");
      fprintf(FP_OUTPUT,"%s\n","  hbr = CreatePatternBrush(hbm);");
      fprintf(FP_OUTPUT,"%s\n","  if (rc) CopyRect(&R, rc);");
      fprintf(FP_OUTPUT,"%s\n","  SetBrushOrgEx(hdc, R.left, R.top, 0);");
      fprintf(FP_OUTPUT,"%s\n","  hbrushOld = (HBRUSH)SelectObject(hdc, hbr);");
      fprintf(FP_OUTPUT,"%s\n","  PatBlt(hdc, R.left, R.top, R.right-R.left, R.bottom-R.top, PATINVERT);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hdc, hbrushOld);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(hbr);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(hbm);");
      fprintf(FP_OUTPUT,"%s\n","  ReleaseDC(hWnd,hdc);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Tab ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Tab (HWND hWnd, int id, int NumTabs, HWND *htab,char Names[][BCXSTRSIZE], int X, int Y, int W, int H, HIMAGELIST image, int Style, int StyleEx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int    ii;");
      fprintf(FP_OUTPUT,"%s\n","  static WNDCLASSEX twcx;");
      fprintf(FP_OUTPUT,"%s\n","  static ATOM Class;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Class)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    // Register the Tab page holder windows... ");
      fprintf(FP_OUTPUT,"%s\n","    twcx.cbSize = sizeof(twcx);");
      fprintf(FP_OUTPUT,"%s\n","    twcx.style = CS_PARENTDC;");
      fprintf(FP_OUTPUT,"%s\n","    twcx.lpfnWndProc = (WNDPROC)TabPageWndProc;");
      fprintf(FP_OUTPUT,"%s\n","    twcx.cbClsExtra = 0;");
      fprintf(FP_OUTPUT,"%s\n","    twcx.cbWndExtra = 4;");
      fprintf(FP_OUTPUT,"%s\n","    twcx.hInstance = BCX_hInstance;");
      fprintf(FP_OUTPUT,"%s\n","    twcx.hIcon = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    twcx.hCursor = LoadCursor(NULL, IDC_ARROW);");
      fprintf(FP_OUTPUT,"%s\n","    twcx.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);");
      fprintf(FP_OUTPUT,"%s\n","    twcx.lpszMenuName = NULL;");
      fprintf(FP_OUTPUT,"%s%s%s\n","    twcx.lpszClassName =",enc("TABPAGEHOLDER"),";");
      fprintf(FP_OUTPUT,"%s\n","    twcx.hIconSm = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    Class = RegisterClassEx(&twcx);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  // SubClass tab control parent so we can intercept WM_NOTIFY msgs used to switch pages");
      fprintf(FP_OUTPUT,"%s\n","  if (id>=0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    if (GetProp(hWnd,",enc("Wprc"),")==NULL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s%s%s\n","      SetProp(hWnd,",enc("Wprc"),", (HANDLE)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_WNDPROC));");
      fprintf(FP_OUTPUT,"%s\n","      SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)TabCallback);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (!Style) Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_CLIPSIBLINGS |");
      fprintf(FP_OUTPUT,"%s\n","                        TCS_TABS|TCS_SINGLELINE|TCS_FOCUSONBUTTONDOWN;");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  HWND hMainTab = CreateWindowEx(StyleEx,",enc("SysTabControl32"),",",DDQ,",Style,");
      fprintf(FP_OUTPUT,"%s\n","                                 X*BCX_ScaleX, Y*BCX_ScaleY, W*BCX_ScaleX, H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                                 hWnd, (HMENU)(UINT_PTR)abs(id), BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (hMainTab == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(hMainTab, WM_SETFONT, (WPARAM)DefaultFont, (LPARAM)MAKELPARAM(FALSE, 0));");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowLongPtr(hMainTab, GWLP_USERDATA, (LONG_PTR)htab);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  SetProp(hMainTab,",enc("TabSzWprc"),",(HANDLE)(LONG_PTR)GetWindowLongPtr(hMainTab, GWLP_WNDPROC));");
      fprintf(FP_OUTPUT,"%s\n","  SetWindowLongPtr(hMainTab, GWLP_WNDPROC,(LONG_PTR)TabSizeCallback);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  // Insert tabs in the tab control...");
      fprintf(FP_OUTPUT,"%s\n","  for(ii = 0; ii<NumTabs; ii += 1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_AddTab (hMainTab, ii, Names[ii], (image != NULL ? ii : -1), 1);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (image) TabCtrl_SetImageList(hMainTab, image);");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(hMainTab, (UINT_PTR)WM_SIZE, (WPARAM)SIZE_RESTORED, 0);");
      fprintf(FP_OUTPUT,"%s\n","  TabCtrl_SetCurSel(hMainTab, 0);");
      fprintf(FP_OUTPUT,"%s\n","  ShowWindow(htab[0], SW_SHOW);");
      fprintf(FP_OUTPUT,"%s\n","  return hMainTab;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_AddTab (HWND thwnd, int idx, PCTSTR text, int Imgidx, int showhide)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  TC_ITEM  tc;");
      fprintf(FP_OUTPUT,"%s\n","  int      ii;");
      fprintf(FP_OUTPUT,"%s\n","  int      cnt = TabCtrl_GetItemCount(thwnd);");
      fprintf(FP_OUTPUT,"%s\n","  HWND     *ptab = (HWND*)(LONG_PTR)GetWindowLongPtr(thwnd, GWLP_USERDATA);");
      fprintf(FP_OUTPUT,"%s\n","  tc.mask = TCIF_TEXT|TCIF_IMAGE;");
      fprintf(FP_OUTPUT,"%s\n","  tc.pszText = (char*)text;");
      fprintf(FP_OUTPUT,"%s\n","  tc.iImage = Imgidx;");
      fprintf(FP_OUTPUT,"%s\n","  TabCtrl_InsertItem(thwnd, idx, &tc);");
      fprintf(FP_OUTPUT,"%s\n","  for(ii = cnt; ii>idx; ii += (-1))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    ptab[ii] = ptab[ii-1];");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  ptab[idx] = CreateWindowEx(WS_EX_CONTROLPARENT, ",enc("TABPAGEHOLDER"),",",enc(""),", WS_CHILD | WS_CLIPCHILDREN, 0, 0, 10, 10, GetParent(thwnd), (HMENU)(UINT_PTR)0, BCX_hInstance, NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (ptab[idx] == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SetWindowPos(ptab[idx], HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);");
      fprintf(FP_OUTPUT,"%s\n","  if (showhide==0)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    ShowWindow(ptab[TabCtrl_GetCurSel(thwnd)], SW_HIDE);");
      fprintf(FP_OUTPUT,"%s\n","    SendMessage(thwnd, (UINT_PTR)WM_SIZE, (WPARAM)SIZE_RESTORED, 0);");
      fprintf(FP_OUTPUT,"%s\n","    TabCtrl_SetCurSel(thwnd, idx);");
      fprintf(FP_OUTPUT,"%s\n","    ShowWindow(ptab[idx], SW_SHOW);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return ptab[idx];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK TabSizeCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","  WNDPROC old = (WNDPROC)GetProp(hWnd,(PCSTR)",enc("TabSzWprc"),");");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg==WM_SIZE && wParam != SIZE_MINIMIZED)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    HWND *ptab = (HWND*)(LONG_PTR)GetWindowLongPtr(hWnd, GWLP_USERDATA);");
      fprintf(FP_OUTPUT,"%s\n","    RECT  rc2, rc1 = {0,0 , 0, 0};");
      fprintf(FP_OUTPUT,"%s\n","    TabCtrl_AdjustRect(hWnd,TRUE, &rc1);");
      fprintf(FP_OUTPUT,"%s\n","    GetClientRect(hWnd, &rc2);");
      fprintf(FP_OUTPUT,"%s\n","    MapWindowPoints(hWnd, GetParent(hWnd), (LPPOINT)&rc2, 2);");
      fprintf(FP_OUTPUT,"%s\n","    rc1.top =  -rc1.top; rc1.bottom = -rc1.bottom;");
      fprintf(FP_OUTPUT,"%s\n","    rc1.left = -rc1.left; rc1.right = -rc1.right;");
      fprintf(FP_OUTPUT,"%s\n","    int page;");
      fprintf(FP_OUTPUT,"%s\n","    for(page = 0; page <= TabCtrl_GetItemCount(hWnd)-1; page += 1)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      MoveWindow(ptab[page], rc2.left + rc1.left, rc2.top + rc1.top,");
      fprintf(FP_OUTPUT,"%s\n","                 rc1.right - rc1.left + (rc2.right - rc2.left), rc1.bottom - rc1.top + (rc2.bottom - rc2.top), TRUE);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else if (Msg == WM_DESTROY)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)RemoveProp(hWnd, ",enc("TabSzWprc"),"));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return CallWindowProc(old, hWnd, Msg, wParam, lParam);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","\n#ifndef WM_MOUSEWHEEL");
      fprintf(FP_OUTPUT,"%s\n","    #define WM_MOUSEWHEEL 0x020A");
      fprintf(FP_OUTPUT,"%s\n","#endif\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK TabPageWndProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg==WM_COMMAND||Msg==WM_NOTIFY||Msg==WM_HSCROLL||Msg==WM_VSCROLL||Msg==WM_CTLCOLOREDIT||");
      fprintf(FP_OUTPUT,"%s\n","      Msg==WM_CTLCOLORSTATIC||Msg==WM_CTLCOLORBTN||Msg==WM_CTLCOLORLISTBOX||Msg==WM_CTLCOLORSCROLLBAR||");
      fprintf(FP_OUTPUT,"%s\n","      Msg==WM_DRAWITEM||Msg==WM_MEASUREITEM||Msg==WM_MOUSEWHEEL||Msg==WM_GETFONT)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    return SendMessage(GetParent(hWnd),(UINT_PTR)Msg,(WPARAM)wParam,(LPARAM)lParam);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return DefWindowProc(hWnd,Msg,wParam,lParam);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","int BCX_TabSelect (HWND hWnd, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int PageNo=(-1);");
      fprintf(FP_OUTPUT,"%s\n","  NMHDR*   ptnmhdr = (NMHDR*) lParam;");
      fprintf(FP_OUTPUT,"%s\n","  HWND *ptab=(HWND*)(LONG_PTR)GetWindowLongPtr(ptnmhdr->hwndFrom,GWLP_USERDATA);");
      fprintf(FP_OUTPUT,"%s\n","  if (ptab)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (ptnmhdr->code==TCN_SELCHANGING)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      PageNo = TabCtrl_GetCurSel(ptnmhdr->hwndFrom);");
      fprintf(FP_OUTPUT,"%s\n","      if (PageNo!=(-1))");
      fprintf(FP_OUTPUT,"%s\n","        ShowWindow(ptab[PageNo],SW_HIDE);");
      fprintf(FP_OUTPUT,"%s\n","      PageNo += 0xffff;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else if (ptnmhdr->code==TCN_SELCHANGE)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      PageNo = TabCtrl_GetCurSel(ptnmhdr->hwndFrom);");
      fprintf(FP_OUTPUT,"%s\n","      if (PageNo!=(-1))");
      fprintf(FP_OUTPUT,"%s\n","        ShowWindow(ptab[PageNo],SW_SHOW);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return PageNo;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","LRESULT CALLBACK TabCallback (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","  WNDPROC old=(WNDPROC)GetProp(hWnd,(PCSTR)",enc("Wprc"),");");
      fprintf(FP_OUTPUT,"%s\n","  if (Msg==WM_DESTROY)");
      fprintf(FP_OUTPUT,"%s%s%s\n","    SetWindowLongPtr(hWnd,GWLP_WNDPROC,(LONG_PTR)RemoveProp(hWnd,",enc("Wprc"),"));");
      fprintf(FP_OUTPUT,"%s\n","  else if (Msg==WM_NOTIFY)");
      fprintf(FP_OUTPUT,"%s\n","    BCX_TabSelect(hWnd,lParam);");
      fprintf(FP_OUTPUT,"%s\n","  return CallWindowProc(old,hWnd,Msg,wParam,lParam);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void BCX_RemTab (HWND thwnd, int idx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int cur, cnt;");
      fprintf(FP_OUTPUT,"%s\n","  HWND*  ptab = (HWND*)(LONG_PTR)GetWindowLongPtr(thwnd,GWLP_USERDATA);");
      fprintf(FP_OUTPUT,"%s\n","  cnt = TabCtrl_GetItemCount(thwnd)-1;");
      fprintf(FP_OUTPUT,"%s\n","  if (cnt<0||idx>cnt) return;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  if (TabCtrl_GetCurSel(thwnd)==idx)");
      fprintf(FP_OUTPUT,"%s\n","    TabCtrl_SetCurFocus(thwnd,(cnt>idx?idx+1:idx-1));");
      fprintf(FP_OUTPUT,"%s\n","  TabCtrl_DeleteItem(thwnd,idx);");
      fprintf(FP_OUTPUT,"%s\n","  DestroyWindow(ptab[idx]);");
      fprintf(FP_OUTPUT,"%s\n","  for(cur = idx; cur<cnt; cur += 1)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    ptab[cur] = ptab[cur+1];");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  ptab[cnt] = NULL;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Toolbar ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_Toolbar (HWND hWnd,int id,int NumBtns,PCTSTR Text,int* Bstyles,void* img,int* imgidx,int bx,int by,int Style,int ExStyle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  TBBUTTON*  tbb = (TBBUTTON*)calloc(NumBtns+20,sizeof(TBBUTTON));");
      fprintf(FP_OUTPUT,"%s\n","  TBADDBITMAP  tbbitmap = {0,0};");
      fprintf(FP_OUTPUT,"%s\n","  static  BITMAP  bm;");
      fprintf(FP_OUTPUT,"%s\n","  int  seppos = 0, absidx = 0, index = 0;");
      fprintf(FP_OUTPUT,"%s\n","  int  txtlen = strlen(Text);");
      fprintf(FP_OUTPUT,"%s\n","  if(!Style) Style = WS_CHILD|WS_BORDER;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s%s%s\n","  HWND A = CreateWindowEx(ExStyle,TOOLBARCLASSNAME,",DDQ,",Style|TBSTYLE_FLAT|CCS_NODIVIDER,0,0,0,0,hWnd,(HMENU)(UINT_PTR)id,BCX_hInstance,NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","   if (A == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A,(UINT_PTR)TB_BUTTONSTRUCTSIZE,(WPARAM)sizeof(TBBUTTON),(LPARAM)0);");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A,WM_SETFONT,(WPARAM)DefaultFont,(LPARAM)0);");
      fprintf(FP_OUTPUT,"%s\n","  if(bx&&by) SendMessage(A,(UINT_PTR)TB_SETBUTTONSIZE,(WPARAM)0,(LPARAM)MAKELONG(bx,by));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  while(absidx<NumBtns)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","     while(txtlen)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (Text[seppos]=='|') break;");
      fprintf(FP_OUTPUT,"%s\n","        if(!seppos||seppos==txtlen) {seppos=0; break;}");
      fprintf(FP_OUTPUT,"%s\n","        seppos++;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if(Text[seppos]=='|'&&Text[seppos+1]=='|')");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","          tbb[index].fsStyle = TBSTYLE_SEP;");
      fprintf(FP_OUTPUT,"%s\n","       }else{");
      fprintf(FP_OUTPUT,"%s\n","          if(imgidx)");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","              tbb[index].iBitmap = imgidx[absidx];");
      fprintf(FP_OUTPUT,"%s\n","           }else{");
      fprintf(FP_OUTPUT,"%s\n","              tbb[index].iBitmap = absidx;");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","          tbb[index].idCommand = id+absidx+1;");
      fprintf(FP_OUTPUT,"%s\n","          tbb[index].fsState = TBSTATE_ENABLED;");
      fprintf(FP_OUTPUT,"%s\n","          if(Bstyles) tbb[index].fsStyle = Bstyles[absidx];");
      fprintf(FP_OUTPUT,"%s\n","          tbb[index].iString = absidx;");
      fprintf(FP_OUTPUT,"%s\n","          absidx++;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","      seppos++;");
      fprintf(FP_OUTPUT,"%s\n","      index++;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A,(UINT_PTR)TB_ADDBUTTONS,(WPARAM)index,(LPARAM)(LPTBBUTTON)tbb);");
      fprintf(FP_OUTPUT,"%s\n","  if(img!=0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if(img==HINST_COMMCTRL)");
      fprintf(FP_OUTPUT,"%s\n","       {");
      fprintf(FP_OUTPUT,"%s\n","          tbbitmap.hInst = HINST_COMMCTRL;");
      fprintf(FP_OUTPUT,"%s\n","          tbbitmap.nID = imgidx[NumBtns];");
      fprintf(FP_OUTPUT,"%s\n","          SendMessage(A,(UINT_PTR)TB_ADDBITMAP,0,(LPARAM)(LPTBADDBITMAP)&tbbitmap);");
      fprintf(FP_OUTPUT,"%s\n","       }else{");
      fprintf(FP_OUTPUT,"%s\n","          if(!GetObject((HBITMAP)(img),sizeof(BITMAP),&bm))");
      fprintf(FP_OUTPUT,"%s\n","           {");
      fprintf(FP_OUTPUT,"%s\n","              SendMessage(A, TB_SETIMAGELIST, 0, (LPARAM)img);");
      fprintf(FP_OUTPUT,"%s\n","           }else{");
      fprintf(FP_OUTPUT,"%s\n","              tbbitmap.nID = (UINT_PTR)(img);");
      fprintf(FP_OUTPUT,"%s\n","              SendMessage(A,(UINT_PTR)TB_SETBITMAPSIZE,(WPARAM)0,(LPARAM)MAKELONG(bm.bmWidth/NumBtns,bm.bmHeight));");
      fprintf(FP_OUTPUT,"%s\n","              SendMessage(A,(UINT_PTR)TB_ADDBITMAP,(WPARAM)NumBtns,(LPARAM)(LPTBADDBITMAP)&tbbitmap);");
      fprintf(FP_OUTPUT,"%s\n","           }");
      fprintf(FP_OUTPUT,"%s\n","       }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  if(txtlen && Text[0] != '-')");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      char*  titles;");
      fprintf(FP_OUTPUT,"%s\n","      titles = (char*)calloc(2+txtlen,sizeof(char));");
      fprintf(FP_OUTPUT,"%s\n","      absidx = 0;");
      fprintf(FP_OUTPUT,"%s\n","      for(index = 0;index<txtlen;index++)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if(Text[index]=='|')");
      fprintf(FP_OUTPUT,"%s\n","         {");
      fprintf(FP_OUTPUT,"%s\n","            if(Text[index+1]=='|'||titles[0]==0) continue;");
      fprintf(FP_OUTPUT,"%s\n","            titles[absidx] = 0;");
      fprintf(FP_OUTPUT,"%s\n","         }else{");
      fprintf(FP_OUTPUT,"%s\n","            titles[absidx] = Text[index];");
      fprintf(FP_OUTPUT,"%s\n","         }");
      fprintf(FP_OUTPUT,"%s\n","        absidx++;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      SendMessage(A,(UINT_PTR)TB_ADDSTRING,(WPARAM)0,(LPARAM)titles);");
      fprintf(FP_OUTPUT,"%s\n","      free(titles);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(A,(UINT_PTR)TB_AUTOSIZE, 0, 0);");
      fprintf(FP_OUTPUT,"%s\n","  ShowWindow(A,SW_SHOW);");
      fprintf(FP_OUTPUT,"%s\n","  free(tbb);");
      fprintf(FP_OUTPUT,"%s\n","  return A;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_UpDown ){
      fprintf(FP_OUTPUT,"%s\n","HWND BCX_UpDown (HWND hWnd,int X,int Y,int W,int H,int Lo,int Hi,int Start)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HWND UpDn;");
      fprintf(FP_OUTPUT,"%s\n","  HWND Buddy;");
      fprintf(FP_OUTPUT,"%s\n","  int  Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_NUMBER|ES_LEFT|ES_AUTOHSCROLL;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  Buddy = CreateWindowEx(WS_EX_CLIENTEDGE,",enc("edit"),",0,Style,");
      fprintf(FP_OUTPUT,"%s\n","                       X*BCX_ScaleX,Y*BCX_ScaleY,W*BCX_ScaleX,H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                       hWnd,(HMENU)(UINT_PTR)0,BCX_hInstance,NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (Buddy == NULL) return NULL;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(Buddy,WM_SETFONT,(WPARAM)DefaultFont,(LPARAM)MAKELPARAM(0,0));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  UpDn = CreateUpDownControl(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER|");
      fprintf(FP_OUTPUT,"%s\n","                           UDS_ARROWKEYS|UDS_SETBUDDYINT|UDS_ALIGNRIGHT|UDS_NOTHOUSANDS,");
      fprintf(FP_OUTPUT,"%s\n","                           X*BCX_ScaleX,Y*BCX_ScaleY,W*BCX_ScaleX,H*BCX_ScaleY,");
      fprintf(FP_OUTPUT,"%s\n","                           hWnd,0,BCX_hInstance,Buddy,Hi,Lo,Start);");
      fprintf(FP_OUTPUT,"%s\n","  return UpDn;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Get_UpDown ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Get_UpDown (HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr={0};");
      fprintf(FP_OUTPUT,"%s\n","  HWND  hBuddy;");
      fprintf(FP_OUTPUT,"%s\n","  int   k;");
      fprintf(FP_OUTPUT,"%s\n","  hBuddy = (HWND)SendMessage(hWnd,(UINT_PTR)UDM_GETBUDDY,(WPARAM)0,(LPARAM)0);");
      fprintf(FP_OUTPUT,"%s\n","  k = GetWindowTextLength(hBuddy)+1;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_RetStr = BCX_TempStr(1);");
      fprintf(FP_OUTPUT,"%s\n","  GetWindowText(hBuddy,BCX_RetStr,k);");
      fprintf(FP_OUTPUT,"%s\n","  return (int)atof(BCX_RetStr);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_Graphics1 (FILE* FP_OUTPUT)
{
  if(Use_Draw ){
      fprintf(FP_OUTPUT,"%s\n","HDC StartDraw (HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP oldbmp, tmpbmp;");
      fprintf(FP_OUTPUT,"%s\n","  HDC  hDestDC, WinDC;");
      fprintf(FP_OUTPUT,"%s\n","  RECT rc;");
      fprintf(FP_OUTPUT,"%s\n","  tmpbmp = (HBITMAP)SendMessage(hWnd,STM_GETIMAGE,0,0);");
      fprintf(FP_OUTPUT,"%s\n","  if (tmpbmp==NULL)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    GetClientRect(hWnd,&rc);");
      fprintf(FP_OUTPUT,"%s\n","    WinDC = GetDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","    tmpbmp = CreateCompatibleBitmap(WinDC,rc.right,rc.bottom);");
      fprintf(FP_OUTPUT,"%s\n","    ReleaseDC(NULL,WinDC);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  hDestDC = CreateCompatibleDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  oldbmp = (HBITMAP)SelectObject(hDestDC,tmpbmp);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  SetProp(hWnd,",enc("oldbmp"),",(HANDLE)oldbmp);");
      fprintf(FP_OUTPUT,"%s\n","  return hDestDC;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","HBITMAP EndDraw (HWND hWnd, HDC hDestDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP  oldbmp, tmpbmp;");
      fprintf(FP_OUTPUT,"%s%s%s\n","  oldbmp = (HBITMAP)GetProp(hWnd,",enc("oldbmp"),");");
      fprintf(FP_OUTPUT,"%s\n","  tmpbmp = (HBITMAP)SelectObject(hDestDC,oldbmp);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","  SendMessage(hWnd,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)tmpbmp);");
      fprintf(FP_OUTPUT,"%s\n","  return tmpbmp;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SetText ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Set_Text (HWND hWnd, PCTSTR Text)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  return SetWindowText(hWnd,Text);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SetFormColor ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Set_Form_Color (HWND hWnd, ULONG Kolor)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hbr = CreateSolidBrush(Kolor);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject((HBRUSH)SetClassLongPtr(hWnd,GCLP_HBRBACKGROUND,(LONG_PTR)hbr));");
      fprintf(FP_OUTPUT,"%s\n","  InvalidateRect (hWnd,NULL,TRUE);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Tile ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Tile (HWND hWnd, HBITMAP hBmp)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hbr = CreatePatternBrush(hBmp);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject((HBRUSH)SetClassLongPtr(hWnd,GCLP_HBRBACKGROUND,(LONG_PTR)hbr));");
      fprintf(FP_OUTPUT,"%s\n","  RedrawWindow(hWnd,0,0,0);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SetColor ){
      fprintf(FP_OUTPUT,"%s\n","LRESULT Set_Color (int TxtColr, int BkColr, HDC wParam, HWND lParam)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static HBRUSH  ReUsableBrush;");
      fprintf(FP_OUTPUT,"%s\n","  SetTextColor(wParam,TxtColr);");
      fprintf(FP_OUTPUT,"%s\n","  if (BkColr==(-1))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BkColr = (UINT_PTR)GetClassLongPtr(GetParent(lParam),GCLP_HBRBACKGROUND);");
      fprintf(FP_OUTPUT,"%s\n","    if ((UINT_PTR)BkColr>31)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      SetBkMode(wParam,TRANSPARENT);");
      fprintf(FP_OUTPUT,"%s\n","      return BkColr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      BkColr = GetSysColor(BkColr-1);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(ReUsableBrush);");
      fprintf(FP_OUTPUT,"%s\n","  ReUsableBrush = CreateSolidBrush(BkColr);");
      fprintf(FP_OUTPUT,"%s\n","  SetBkColor(wParam,BkColr);");
      fprintf(FP_OUTPUT,"%s\n","  return (LRESULT)ReUsableBrush;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SetFont ){
      fprintf(FP_OUTPUT,"%s\n","HFONT BCX_Set_Font (PCTSTR Font, float Size, int Bold, int Italic, int Underline, int StrikeThru, int CharSet, int Angle)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC hDC = GetDC(HWND_DESKTOP);");
      fprintf(FP_OUTPUT,"%s\n","  int CyPixels = GetDeviceCaps(hDC,LOGPIXELSY);");
      fprintf(FP_OUTPUT,"%s\n","  ReleaseDC(HWND_DESKTOP,hDC);");
      fprintf(FP_OUTPUT,"%s\n","  return CreateFont(0-(Size*CyPixels)/72,0,Angle,0,Bold,Italic,Underline,StrikeThru,");
      fprintf(FP_OUTPUT,"%s\n","                    CharSet,OUT_TT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,Font);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Preset ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Preset (HWND hWnd, int x, int y, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int a;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  a = MoveToEx(DrawHDC,x,y,NULL);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return a;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Blit ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Blit (HBITMAP hBmp, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC     hdcDest = CreateCompatibleDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcDest, hBmp);");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP  bmpInfo;");
      fprintf(FP_OUTPUT,"%s\n","  GetObject(hBmp,sizeof(BITMAP), &bmpInfo);");
      fprintf(FP_OUTPUT,"%s\n","  int bmpWidth = bmpInfo.bmWidth;");
      fprintf(FP_OUTPUT,"%s\n","  int bmpHeight = bmpInfo.bmHeight;");
      fprintf(FP_OUTPUT,"%s\n","  BitBlt(DrawHDC, 0, 0, bmpWidth, bmpHeight, hdcDest, 0, 0, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hdcDest, hOldBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(hdcDest);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Blit_Stretch ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Blit_Stretch (HBITMAP hBmp, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC     hdcDest = CreateCompatibleDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hOldBitmap = (HBITMAP)SelectObject(hdcDest, hBmp);");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP  bmpInfo;");
      fprintf(FP_OUTPUT,"%s\n","  GetObject(hBmp,sizeof(BITMAP), &bmpInfo);");
      fprintf(FP_OUTPUT,"%s\n","  int bmpWidth = bmpInfo.bmWidth;");
      fprintf(FP_OUTPUT,"%s\n","  int bmpHeight = bmpInfo.bmHeight;");
      fprintf(FP_OUTPUT,"%s\n","  StretchBlt(DrawHDC,0,0,MAXX,MAXY,hdcDest,0,0,bmpWidth,bmpHeight,SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hdcDest, hOldBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(hdcDest);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Blit_Sprite ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Blit_Sprite (HBITMAP hBmp, int Left, int Top, ULONG rgbMask, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC      hdcDest={0};");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP  hOldBitmap={0};");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP   bmpInfo={0};  ");
      fprintf(FP_OUTPUT,"%s\n","  if(!hBmp || !DrawHDC){  ");
      fprintf(FP_OUTPUT,"%s\n","      return; ");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  hdcDest = CreateCompatibleDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  hOldBitmap = (HBITMAP)SelectObject(hdcDest,hBmp);");
      fprintf(FP_OUTPUT,"%s\n","  GetObject(hBmp,sizeof(BITMAP), &bmpInfo);");
      fprintf(FP_OUTPUT,"%s\n","  TransparentBlt(DrawHDC, Left, Top, bmpInfo.bmWidth, bmpInfo.bmHeight,");
      fprintf(FP_OUTPUT,"%s\n","                 hdcDest, 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, rgbMask);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hdcDest,hOldBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(hdcDest);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Buffer ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_BUFFER_START (int x, int y)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   if(BCX_PREV_BMP)");
      fprintf(FP_OUTPUT,"%s\n","   {");
      fprintf(FP_OUTPUT,"%s\n","     DeleteObject(SelectObject(BCX_BUFFER,BCX_PREV_BMP));");
      fprintf(FP_OUTPUT,"%s\n","     BCX_PREV_BMP = NULL;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_BUFFER) DeleteDC(BCX_BUFFER);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER = CreateCompatibleDC(0);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMWIDTH  = x;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMHEIGHT = y;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMP.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMP.bmiHeader.biWidth = BCX_BUFFER_BMWIDTH;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMP.bmiHeader.biHeight = -BCX_BUFFER_BMHEIGHT;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMP.bmiHeader.biPlanes = 1;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMP.bmiHeader.biBitCount = 32;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_BUFFER_BMP.bmiHeader.biCompression = BI_RGB;");
      fprintf(FP_OUTPUT,"%s\n","  BCX_PREV_BMP = (HBITMAP)SelectObject(BCX_BUFFER,CreateDIBSection(0, &BCX_BUFFER_BMP,DIB_RGB_COLORS,0,0,0));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","void BCX_BUFFER_STOP (HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC Local_HDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  BitBlt(Local_HDC,0,0,BCX_BUFFER_BMWIDTH,BCX_BUFFER_BMHEIGHT,BCX_BUFFER,0,0,SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","  ReleaseDC(hWnd,Local_HDC);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(BCX_BUFFER,BCX_PREV_BMP));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Pset ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Pset (HWND hWnd, int x1, int y1, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  int OldPenSize = BCX_Pensize;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  MoveToEx(DrawHDC,x1,y1,NULL);");
      fprintf(FP_OUTPUT,"%s\n","  if(BCX_Pensize<4)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      RetCode = SetPixelV(DrawHDC,x1,y1,Pen); // Use fast thin pixels");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      RetCode = LineTo(DrawHDC,x1,y1);        // Use slow fat pixels");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  BCX_Pensize = OldPenSize;");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Floodfill ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_FloodFill (HWND hWnd,int X,int Y,int Areacolor,int Fillcolor,int FillType,HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,1,Fillcolor);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hOldBrush;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hNewBrush;");
      fprintf(FP_OUTPUT,"%s\n","  hNewBrush = CreateSolidBrush(Fillcolor);");
      fprintf(FP_OUTPUT,"%s\n","  hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  if (!FillType)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    RetCode = ExtFloodFill(DrawHDC, X, Y, Areacolor, 0);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    RetCode = ExtFloodFill(DrawHDC, X, Y, Areacolor, 1);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldBrush));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Line ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Line(HWND hWnd, int x1, int y1, int x2, int y2, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle, BCX_Pensize, Pen);");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  hOldPen = (HPEN)SelectObject(DrawHDC, hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  MoveToEx(DrawHDC, x1, y1, NULL);");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = LineTo(DrawHDC, x2, y2);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC, hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd, DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Lineto ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Lineto (HWND hWnd, int x, int y, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = LineTo(DrawHDC,x,y);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Triangle ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Triangle(HWND hWnd, LONG x1, LONG y1, LONG x2, LONG y2, LONG x3, LONG y3, DWORD fillColor, LONG filled, HDC hdc) {");
      fprintf(FP_OUTPUT,"%s\n","    POINT MyPoint[3];");
      fprintf(FP_OUTPUT,"%s\n","    HBRUSH hBrush=NULL, hOldBrush=NULL;");
      fprintf(FP_OUTPUT,"%s\n","    HPEN hPen=NULL, hOldPen=NULL;");
      fprintf(FP_OUTPUT,"%s\n","    HDC localHDC=NULL;");
      fprintf(FP_OUTPUT,"%s\n","    int needToRelease=0;");
      fprintf(FP_OUTPUT,"%s\n","    int RetCode=0;");
      fprintf(FP_OUTPUT,"%s\n","    // Ensure minimum pen size");
      fprintf(FP_OUTPUT,"%s\n","    if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Determine which HDC to use");
      fprintf(FP_OUTPUT,"%s\n","    if (hWnd != 0) {");
      fprintf(FP_OUTPUT,"%s\n","        localHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","        needToRelease = true;");
      fprintf(FP_OUTPUT,"%s\n","    } else {");
      fprintf(FP_OUTPUT,"%s\n","        localHDC = hdc;");
      fprintf(FP_OUTPUT,"%s\n","        needToRelease = false;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Set up the POINT array");
      fprintf(FP_OUTPUT,"%s\n","    MyPoint[0].x = x1; MyPoint[0].y = y1;");
      fprintf(FP_OUTPUT,"%s\n","    MyPoint[1].x = x2; MyPoint[1].y = y2;");
      fprintf(FP_OUTPUT,"%s\n","    MyPoint[2].x = x3; MyPoint[2].y = y3;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Create and select the brush for filling");
      fprintf(FP_OUTPUT,"%s\n","    if (filled) {");
      fprintf(FP_OUTPUT,"%s\n","        hBrush = CreateSolidBrush(fillColor);");
      fprintf(FP_OUTPUT,"%s\n","        hOldBrush = (HBRUSH)SelectObject(localHDC, hBrush);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Create and select a pen for the outline");
      fprintf(FP_OUTPUT,"%s\n","    hPen = CreatePen(BCX_Penstyle, BCX_Pensize, fillColor);");
      fprintf(FP_OUTPUT,"%s\n","    hOldPen = (HPEN)SelectObject(localHDC, hPen);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Draw the triangle");
      fprintf(FP_OUTPUT,"%s\n","    BeginPath(localHDC);");
      fprintf(FP_OUTPUT,"%s\n","    Polygon(localHDC, MyPoint, 3);");
      fprintf(FP_OUTPUT,"%s\n","    EndPath(localHDC);");
      fprintf(FP_OUTPUT,"%s\n","    if (filled) {");
      fprintf(FP_OUTPUT,"%s\n","        FillPath(localHDC);");
      fprintf(FP_OUTPUT,"%s\n","    } else {");
      fprintf(FP_OUTPUT,"%s\n","        StrokePath(localHDC);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Clean up");
      fprintf(FP_OUTPUT,"%s\n","    if (filled) {");
      fprintf(FP_OUTPUT,"%s\n","        SelectObject(localHDC, hOldBrush);");
      fprintf(FP_OUTPUT,"%s\n","        DeleteObject(hBrush);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    SelectObject(localHDC, hOldPen);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteObject(hPen);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Release the DC if we got it from the window");
      fprintf(FP_OUTPUT,"%s\n","    if (needToRelease) {");
      fprintf(FP_OUTPUT,"%s\n","        ReleaseDC(hWnd, localHDC);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Gradient ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Gradient(HWND MyhWnd, ULONG StartRGB, ULONG EndRGB, int Direction, HDC Myhdc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    HDC myHDC;");
      fprintf(FP_OUTPUT,"%s\n","    RECT myRECT;");
      fprintf(FP_OUTPUT,"%s\n","    int needRelease = 0;");
      fprintf(FP_OUTPUT,"%s\n","    int w, h, i, range;");
      fprintf(FP_OUTPUT,"%s\n","    int r1, g1, b1;");
      fprintf(FP_OUTPUT,"%s\n","    int r2, g2, b2;");
      fprintf(FP_OUTPUT,"%s\n","    double stepR, stepG, stepB;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Get DC and dimensions");
      fprintf(FP_OUTPUT,"%s\n","    if (MyhWnd) {");
      fprintf(FP_OUTPUT,"%s\n","        myHDC = GetDC(MyhWnd);");
      fprintf(FP_OUTPUT,"%s\n","        needRelease = 1;");
      fprintf(FP_OUTPUT,"%s\n","        GetClientRect(MyhWnd, &myRECT);");
      fprintf(FP_OUTPUT,"%s\n","    } else {");
      fprintf(FP_OUTPUT,"%s\n","        myHDC = Myhdc;");
      fprintf(FP_OUTPUT,"%s\n","        GetClipBox(myHDC, &myRECT);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    w = myRECT.right - myRECT.left;");
      fprintf(FP_OUTPUT,"%s\n","    h = myRECT.bottom - myRECT.top;");
      fprintf(FP_OUTPUT,"%s\n","    if (!myHDC || w < 1 || h < 1) return;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Extract RGB components");
      fprintf(FP_OUTPUT,"%s\n","    r1 = GetRValue(StartRGB);");
      fprintf(FP_OUTPUT,"%s\n","    g1 = GetGValue(StartRGB);");
      fprintf(FP_OUTPUT,"%s\n","    b1 = GetBValue(StartRGB);");
      fprintf(FP_OUTPUT,"%s\n","    r2 = GetRValue(EndRGB);");
      fprintf(FP_OUTPUT,"%s\n","    g2 = GetGValue(EndRGB);");
      fprintf(FP_OUTPUT,"%s\n","    b2 = GetBValue(EndRGB);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Determine range and steps based on direction");
      fprintf(FP_OUTPUT,"%s\n","    if (Direction) {");
      fprintf(FP_OUTPUT,"%s\n","        range = w - 1;");
      fprintf(FP_OUTPUT,"%s\n","    } else {");
      fprintf(FP_OUTPUT,"%s\n","        range = h - 1;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (range < 1) range = 1;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    stepR = (double)(r2 - r1) / range;");
      fprintf(FP_OUTPUT,"%s\n","    stepG = (double)(g2 - g1) / range;");
      fprintf(FP_OUTPUT,"%s\n","    stepB = (double)(b2 - b1) / range;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    // Draw gradient lines");
      fprintf(FP_OUTPUT,"%s\n","    for (i = 0; i <= range; i++) {");
      fprintf(FP_OUTPUT,"%s\n","        int currR = r1 + (int)round(stepR * i);");
      fprintf(FP_OUTPUT,"%s\n","        int currG = g1 + (int)round(stepG * i);");
      fprintf(FP_OUTPUT,"%s\n","        int currB = b1 + (int)round(stepB * i);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        currR = currR < 0 ? 0 : (currR > 255 ? 255 : currR);");
      fprintf(FP_OUTPUT,"%s\n","        currG = currG < 0 ? 0 : (currG > 255 ? 255 : currG);");
      fprintf(FP_OUTPUT,"%s\n","        currB = currB < 0 ? 0 : (currB > 255 ? 255 : currB);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        HPEN hPen = CreatePen(PS_SOLID, 1, RGB(currR, currG, currB));");
      fprintf(FP_OUTPUT,"%s\n","        if (!hPen) continue;");
      fprintf(FP_OUTPUT,"%s\n","        HPEN hOldPen = (HPEN)SelectObject(myHDC, hPen);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        if (Direction) {");
      fprintf(FP_OUTPUT,"%s\n","            MoveToEx(myHDC, i, 0, NULL);");
      fprintf(FP_OUTPUT,"%s\n","            LineTo(myHDC, i, h);");
      fprintf(FP_OUTPUT,"%s\n","        } else {");
      fprintf(FP_OUTPUT,"%s\n","            MoveToEx(myHDC, 0, i, NULL);");
      fprintf(FP_OUTPUT,"%s\n","            LineTo(myHDC, w, i);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        SelectObject(myHDC, hOldPen);");
      fprintf(FP_OUTPUT,"%s\n","        DeleteObject(hPen);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (needRelease) ReleaseDC(MyhWnd, myHDC);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Polar_Pset ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Polar_Pset(HWND hWnd, int RadiusX, int RadiusY, float Radius, float AzDecDeg, ULONG RgbColor, HDC MyHdc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  while(AzDecDeg<0) AzDecDeg = AzDecDeg + 360;");
      fprintf(FP_OUTPUT,"%s\n","  AzDecDeg = (270 + AzDecDeg) * 0.017453;");
      fprintf(FP_OUTPUT,"%s\n","  int X = RadiusX + (int)(Radius * cos(AzDecDeg));");
      fprintf(FP_OUTPUT,"%s\n","  int Y = RadiusY + (int)(Radius * sin(AzDecDeg));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_Pset(hWnd, X, Y, RgbColor);");
      fprintf(FP_OUTPUT,"%s\n","      } else {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_Pset(NULL, X, Y, RgbColor, MyHdc);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Polar_Line ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Polar_Line(HWND hWnd, int RadiusX, int RadiusY, float Radius, float AzDecDeg, ULONG RgbColor, HDC MyHdc)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  while(AzDecDeg<0) AzDecDeg = AzDecDeg + 360;");
      fprintf(FP_OUTPUT,"%s\n","  AzDecDeg = (270 + AzDecDeg) * 0.017453;");
      fprintf(FP_OUTPUT,"%s\n","  int X = RadiusX + (int)(Radius * cos(AzDecDeg));");
      fprintf(FP_OUTPUT,"%s\n","  int Y = RadiusY + (int)(Radius * sin(AzDecDeg));");
      fprintf(FP_OUTPUT,"%s\n","  if(hWnd){");
      fprintf(FP_OUTPUT,"%s\n","    BCX_Line(hWnd, RadiusX, RadiusY, X, Y, RgbColor);");
      fprintf(FP_OUTPUT,"%s\n","      } else {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_Line(NULL, RadiusX, RadiusY, X, Y, RgbColor, MyHdc);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Polygon ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Polygon (HWND hWnd, const POINT *lpPoints, int nCount, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode = Polygon(DrawHDC,lpPoints,nCount);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(DrawHDC,hOldPen);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_PolyBezier ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_PolyBezier (HWND hWnd, const POINT *lpPoints, int nCount, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = PolyBezier(DrawHDC,lpPoints,nCount);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(DrawHDC,hOldPen);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Polyline ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Polyline (HWND hWnd, const POINT *lpPoints, int nCount, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = Polyline(DrawHDC,lpPoints,nCount);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(DrawHDC,hOldPen);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Circle ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Circle (HWND hWnd, int X, int Y, int R, int Pen, int Fill, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hOldBrush;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hNewBrush;");
      fprintf(FP_OUTPUT,"%s\n","  if (Fill)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = CreateSolidBrush(Pen);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  } else {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = (HBRUSH)GetStockObject(NULL_BRUSH);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = Ellipse(DrawHDC,X-R,Y+R,X+R,Y-R);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldBrush));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Ellipse ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Ellipse (HWND hWnd, int Left, int Top, int Right, int Bottom, int Pen, int Fill, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hOldBrush;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hNewBrush;");
      fprintf(FP_OUTPUT,"%s\n","  if (Fill)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = CreateSolidBrush(Pen);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  } else {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = (HBRUSH)GetStockObject(NULL_BRUSH);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = Ellipse(DrawHDC,Left,Top,Right,Bottom);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldBrush));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Rectangle ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Rectangle (HWND hWnd, int Left, int Top, int Right, int Bottom, int Pen, int Fill, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hOldBrush;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hNewBrush;");
      fprintf(FP_OUTPUT,"%s\n","  if (Fill)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = CreateSolidBrush(Pen);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  } else {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = (HBRUSH)GetStockObject(NULL_BRUSH);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = Rectangle(DrawHDC,Left,Top,Right,Bottom);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldBrush));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Roundrect ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Roundrect (HWND hWnd, int Left, int Top, int Right, int Bottom, int W,  int H, int Pen, int Fill, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN   hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hOldBrush;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hNewBrush;");
      fprintf(FP_OUTPUT,"%s\n","  if (Fill)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = CreateSolidBrush(Pen);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  } else {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = (HBRUSH)GetStockObject(NULL_BRUSH);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = RoundRect(DrawHDC,Left,Top,Right,Bottom,W,H);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldBrush));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Arc ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Arc (HWND hWnd, int Left, int Top, int Right, int Bottom, int BCX, int BCY, int ECX, int ECY, int Pen, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = Arc(DrawHDC,Left,Top,Right,Bottom,BCX,BCY,ECX,ECY);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Pie ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_Pie (HWND hWnd, int Left, int Top, int Right, int Bottom, int BCX, int BCY, int ECX, int ECY, int Pen, int Fill, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int RetCode;");
      fprintf(FP_OUTPUT,"%s\n","  if (BCX_Pensize < 1) BCX_Pensize = 1;");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hNewPen = CreatePen(BCX_Penstyle,BCX_Pensize,Pen);");
      fprintf(FP_OUTPUT,"%s\n","  HPEN hOldPen = (HPEN)SelectObject(DrawHDC,hNewPen);");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hOldBrush;");
      fprintf(FP_OUTPUT,"%s\n","  HBRUSH hNewBrush;");
      fprintf(FP_OUTPUT,"%s\n","  if (Fill)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = CreateSolidBrush(Pen);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  } else {");
      fprintf(FP_OUTPUT,"%s\n","    hNewBrush = (HBRUSH)GetStockObject(NULL_BRUSH);");
      fprintf(FP_OUTPUT,"%s\n","    hOldBrush = (HBRUSH)SelectObject(DrawHDC,hNewBrush);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RetCode = Pie(DrawHDC,Left,Top,Right,Bottom,BCX,BCY,ECX,ECY);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC,hOldPen));");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(DrawHDC, hOldBrush));");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetCode;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Fontdlg ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_FontDlg (BOOL UseBcxFont, HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  CHOOSEFONT cf;");
      fprintf(FP_OUTPUT,"%s\n","  memset(&cf,0,sizeof(cf));");
      fprintf(FP_OUTPUT,"%s\n","  if (UseBcxFont)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    HDC hdc = GetDC(0);");
      fprintf(FP_OUTPUT,"%s\n","    BCX_FONT.lf.lfHeight = -MulDiv(BCX_FONT.SIZE, GetDeviceCaps(hdc, LOGPIXELSY), 72);");
      fprintf(FP_OUTPUT,"%s\n","    ReleaseDC(0,hdc);");
      fprintf(FP_OUTPUT,"%s\n","    cf.rgbColors = BCX_FONT.RGB;");
      fprintf(FP_OUTPUT,"%s\n","  } else {");
      fprintf(FP_OUTPUT,"%s\n","    memset(&BCX_FONT.lf,0,sizeof(BCX_FONT.lf));");
      fprintf(FP_OUTPUT,"%s\n","    GetObject(GetStockObject(DEFAULT_GUI_FONT),sizeof(BCX_FONT.lf),&BCX_FONT.lf);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  cf.lStructSize = sizeof(CHOOSEFONT);");
      fprintf(FP_OUTPUT,"%s\n","  cf.hwndOwner = hWnd;");
      fprintf(FP_OUTPUT,"%s\n","  cf.lpLogFont = &BCX_FONT.lf;");
      fprintf(FP_OUTPUT,"%s\n","  cf.Flags = CF_INITTOLOGFONTSTRUCT|CF_SCREENFONTS|CF_EFFECTS;");
      fprintf(FP_OUTPUT,"%s\n","  CmDlgHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)SBProc,NULL,GetCurrentThreadId());");
      fprintf(FP_OUTPUT,"%s\n","  int rc = ChooseFont(&cf);");
      fprintf(FP_OUTPUT,"%s\n","  if (rc)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    BCX_FONT.SIZE = cf.iPointSize/10;");
      fprintf(FP_OUTPUT,"%s\n","    BCX_FONT.RGB = cf.rgbColors;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n"," return rc;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Getpixel ){
      fprintf(FP_OUTPUT,"%s\n","ULONG BCX_Getpixel(HWND hWnd, int X, int Y, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!DrawHDC) DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  int i = GetPixel(DrawHDC,X,Y);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return i;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_QBColor ){
      fprintf(FP_OUTPUT,"%s\n","ULONG qbcolor (int N)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static int Initialized;");
      fprintf(FP_OUTPUT,"%s\n","  static ULONG Colors[32];");
      fprintf(FP_OUTPUT,"%s\n","  if(!Initialized){");
      fprintf(FP_OUTPUT,"%s\n","    Colors[0]  = 0x00000000;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[1]  = 0X00A80000;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[2]  = 0X0000A800;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[3]  = 0X00A8A800;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[4]  = 0X000000A8;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[5]  = 0X00A800A8;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[6]  = 0X000054A8;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[7]  = 0X00A8A8A8;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[8]  = 0X00545454;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[9]  = 0X00FC5454;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[10] = 0X0054FC54;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[11] = 0X00FCFC54;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[12] = 0X005454FC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[13] = 0X00FC54FC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[14] = 0X0054FCFC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[15] = 0X00FCFCFC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[16] = 0X00A4A4A4;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[17] = 0X00FFA080;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[18] = 0X00A0FFA0;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[19] = 0X00FFFFA0;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[20] = 0X00A0A0FF;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[21] = 0X00FFA0FF;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[22] = 0X00A0FFFF;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[23] = 0X00D4D4D4;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[24] = 0X00B4B4B4;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[25] = 0X00FFDCBC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[26] = 0X00DCFFDC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[27] = 0X00FFFFDC;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[28] = 0X00DCDCFF;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[29] = 0X00FFDCFF;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[30] = 0X00DCFFFF;");
      fprintf(FP_OUTPUT,"%s\n","    Colors[31] = 0X00E4E4E4;");
      fprintf(FP_OUTPUT,"%s\n","    Initialized = 1;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return Colors[N];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_Graphics2 (FILE* FP_OUTPUT)
{
  if(Use_GetBmp ){
      fprintf(FP_OUTPUT,"%s\n","HDC GetBmp (int Left, int Top, int Width, int Height, HWND hWnd)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","   int x, y;");
      fprintf(FP_OUTPUT,"%s\n","   RECT rc;");
      fprintf(FP_OUTPUT,"%s\n","   GetClientRect(hWnd, &rc);");
      fprintf(FP_OUTPUT,"%s\n","   x = rc.right - rc.left;");
      fprintf(FP_OUTPUT,"%s\n","   y = rc.bottom - rc.top;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","// Adjust Width and Height if they violate client-area sizes");
      fprintf(FP_OUTPUT,"%s\n","   if (Width  > x || Width  < 1) Width  = x;");
      fprintf(FP_OUTPUT,"%s\n","   if (Height > y || Height < 1) Height = y;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  HDC      HdcSrc = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HDC      HdcMem = CreateCompatibleDC(HdcSrc);");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP  hBmp = CreateCompatibleBitmap(HdcSrc, Width, Height);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(SelectObject(HdcMem, hBmp));");
      fprintf(FP_OUTPUT,"%s\n","  BitBlt    (HdcMem, 0, 0, Width, Height, HdcSrc, Left, Top, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","  ReleaseDC (hWnd, HdcSrc);");
      fprintf(FP_OUTPUT,"%s\n","  return HdcMem;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SaveBmp ){
      fprintf(FP_OUTPUT,"%s\n","void SaveBmp(PVOID hobj, PTSTR pszFile) {");
      fprintf(FP_OUTPUT,"%s\n","    BITMAP bmp;");
      fprintf(FP_OUTPUT,"%s\n","    PBITMAPINFO pbmi;");
      fprintf(FP_OUTPUT,"%s\n","    WORD cClrBits;");
      fprintf(FP_OUTPUT,"%s\n","    FILE* file;");
      fprintf(FP_OUTPUT,"%s\n","    BITMAPFILEHEADER hdr;");
      fprintf(FP_OUTPUT,"%s\n","    PBITMAPINFOHEADER pbih;");
      fprintf(FP_OUTPUT,"%s\n","    PBYTE lpBits;");
      fprintf(FP_OUTPUT,"%s\n","    ULONG cb;");
      fprintf(FP_OUTPUT,"%s\n","    BYTE* hp;");
      fprintf(FP_OUTPUT,"%s\n","    HDC hDC = (HDC)hobj;");
      fprintf(FP_OUTPUT,"%s\n","    HBITMAP hBmp = (HBITMAP)hobj;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (GetObjectType(hobj) != OBJ_BITMAP)");
      fprintf(FP_OUTPUT,"%s\n","        hBmp = (HBITMAP)GetCurrentObject(hDC, OBJ_BITMAP);");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","        hDC = CreateCompatibleDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    GetObject(hBmp, sizeof(BITMAP), (PSTR)&bmp);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    cClrBits = (WORD)(bmp.bmPlanes * bmp.bmBitsPixel);");
      fprintf(FP_OUTPUT,"%s\n","    if (cClrBits == 1)");
      fprintf(FP_OUTPUT,"%s\n","        cClrBits = 1;");
      fprintf(FP_OUTPUT,"%s\n","    else if (cClrBits <= 4)");
      fprintf(FP_OUTPUT,"%s\n","        cClrBits = 4;");
      fprintf(FP_OUTPUT,"%s\n","    else if (cClrBits <= 8)");
      fprintf(FP_OUTPUT,"%s\n","        cClrBits = 8;");
      fprintf(FP_OUTPUT,"%s\n","    else if (cClrBits <= 16)");
      fprintf(FP_OUTPUT,"%s\n","        cClrBits = 16;");
      fprintf(FP_OUTPUT,"%s\n","    else if (cClrBits <= 24)");
      fprintf(FP_OUTPUT,"%s\n","        cClrBits = 24;");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","        cClrBits = 32;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (cClrBits != 24)");
      fprintf(FP_OUTPUT,"%s\n","        pbmi = (PBITMAPINFO)LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (int)(1 << cClrBits));");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","        pbmi = (PBITMAPINFO)LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);");
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biWidth = bmp.bmWidth;");
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biHeight = bmp.bmHeight;");
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biPlanes = bmp.bmPlanes;");
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biBitCount = bmp.bmBitsPixel;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (cClrBits < 24)");
      fprintf(FP_OUTPUT,"%s\n","        pbmi->bmiHeader.biClrUsed = (1 << cClrBits);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biCompression = BI_RGB;");
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits + 31) & ~31) / 8 * pbmi->bmiHeader.biHeight;");
      fprintf(FP_OUTPUT,"%s\n","    pbmi->bmiHeader.biClrImportant = 0;");
      fprintf(FP_OUTPUT,"%s\n","    pbih = (PBITMAPINFOHEADER)pbmi;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    lpBits = (PBYTE)malloc(pbih->biSizeImage);");
      fprintf(FP_OUTPUT,"%s\n","    GetDIBits(hDC, hBmp, 0, (WORD)pbih->biHeight, lpBits, pbmi, DIB_RGB_COLORS);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s%s%s\n","    file = fopen(pszFile, ",enc("wb"),");");
      fprintf(FP_OUTPUT,"%s\n","    if (file == NULL) {");
      fprintf(FP_OUTPUT,"%s%s%s\n","        printf(",enc("Failed to open file for writing."),");");
      fprintf(FP_OUTPUT,"%s\n","        return;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hdr.bfType = 0x4d42;");
      fprintf(FP_OUTPUT,"%s\n","    hdr.bfSize = (ULONG)(sizeof(BITMAPFILEHEADER) + pbih->biSize + pbih->biClrUsed * sizeof(RGBQUAD) + pbih->biSizeImage);");
      fprintf(FP_OUTPUT,"%s\n","    hdr.bfReserved1 = 0;");
      fprintf(FP_OUTPUT,"%s\n","    hdr.bfReserved2 = 0;");
      fprintf(FP_OUTPUT,"%s\n","    hdr.bfOffBits = (ULONG)sizeof(BITMAPFILEHEADER) + pbih->biSize + pbih->biClrUsed * sizeof(RGBQUAD);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    fwrite(&hdr, sizeof(BITMAPFILEHEADER), 1, file);");
      fprintf(FP_OUTPUT,"%s\n","    fwrite(pbih, sizeof(BITMAPINFOHEADER) + pbih->biClrUsed * sizeof(RGBQUAD), 1, file);");
      fprintf(FP_OUTPUT,"%s\n","    cb = pbih->biSizeImage;");
      fprintf(FP_OUTPUT,"%s\n","    hp = lpBits;");
      fprintf(FP_OUTPUT,"%s\n","    fwrite(hp, cb, 1, file);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    fclose(file);");
      fprintf(FP_OUTPUT,"%s\n","    free(lpBits);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (GetObjectType(hobj) == OBJ_BITMAP)");
      fprintf(FP_OUTPUT,"%s\n","        DeleteDC(hDC);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Set_BCX_Bitmap ){
      fprintf(FP_OUTPUT,"%s\n","void Set_BCX_Bitmap(HWND hWnd, PCTSTR File, int Res,  int W,  int H)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP Bm_Handle = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  if (Res)");
      fprintf(FP_OUTPUT,"%s\n","     Bm_Handle = (HBITMAP)LoadImage(GetModuleHandle(0),MAKEINTRESOURCE(Res),");
      fprintf(FP_OUTPUT,"%s\n","                IMAGE_BITMAP,W*BCX_ScaleX,H*BCX_ScaleY,LR_CREATEDIBSECTION);");
      fprintf(FP_OUTPUT,"%s\n","  else if (File != NULL)");
      fprintf(FP_OUTPUT,"%s\n","     Bm_Handle = (HBITMAP)LoadImage(0,File,IMAGE_BITMAP,");
      fprintf(FP_OUTPUT,"%s\n","                W*BCX_ScaleX,H*BCX_ScaleY,LR_LOADFROMFILE|LR_CREATEDIBSECTION);");
      fprintf(FP_OUTPUT,"%s\n","  if (Bm_Handle)");
      fprintf(FP_OUTPUT,"%s\n","     DeleteObject((HBITMAP)SendMessage(hWnd,(UINT_PTR)STM_SETIMAGE,");
      fprintf(FP_OUTPUT,"%s\n","                  (WPARAM)IMAGE_BITMAP,(LPARAM)Bm_Handle));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Set_BCX_Bitmap2 ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP Set_BCX_Bitmap2 (HWND hWnd, HBITMAP Bmp, int DeleteBM)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP bm = (HBITMAP)SendMessage(hWnd,STM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)Bmp);");
      fprintf(FP_OUTPUT,"%s\n","  if (DeleteBM)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    DeleteObject(bm);");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return bm;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Newbmp ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP NewBmp (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int screenHeight;");
      fprintf(FP_OUTPUT,"%s\n","  int screenWidth;");
      fprintf(FP_OUTPUT,"%s\n","  HDC hdcScreen;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hBitmap;");
      fprintf(FP_OUTPUT,"%s\n","  hdcScreen = GetDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  screenWidth = GetDeviceCaps(hdcScreen,HORZRES);");
      fprintf(FP_OUTPUT,"%s\n","  screenHeight = GetDeviceCaps(hdcScreen,VERTRES);");
      fprintf(FP_OUTPUT,"%s\n","  hBitmap = CreateCompatibleBitmap(hdcScreen,screenWidth,screenHeight);");
      fprintf(FP_OUTPUT,"%s\n","  ReleaseDC(NULL,hdcScreen);");
      fprintf(FP_OUTPUT,"%s\n","  return hBitmap;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Makebmp ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP MakeBmp(HDC hDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP  bmpInfo;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP hBitmap;");
      fprintf(FP_OUTPUT,"%s\n","  HDC     hTempDC;");
      fprintf(FP_OUTPUT,"%s\n","  long    BmpWidth;");
      fprintf(FP_OUTPUT,"%s\n","  long    BmpHeight;");
      fprintf(FP_OUTPUT,"%s\n","  GetObject(GetCurrentObject(hDC, OBJ_BITMAP), sizeof(BITMAP), &bmpInfo);");
      fprintf(FP_OUTPUT,"%s\n","  BmpWidth = bmpInfo.bmWidth;");
      fprintf(FP_OUTPUT,"%s\n","  BmpHeight = bmpInfo.bmHeight;");
      fprintf(FP_OUTPUT,"%s\n","  hBitmap = CreateCompatibleBitmap(hDC, BmpWidth, BmpHeight);");
      fprintf(FP_OUTPUT,"%s\n","  hTempDC = CreateCompatibleDC(hDC);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hTempDC, hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  BitBlt(hTempDC, 0, 0, BmpWidth, BmpHeight, hDC, 0, 0, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(hTempDC);");
      fprintf(FP_OUTPUT,"%s\n","  return hBitmap;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Makehdc ){
      fprintf(FP_OUTPUT,"%s\n","HDC MakeHdc (HBITMAP hBitmap)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HDC hDC;");
      fprintf(FP_OUTPUT,"%s\n","  hDC = CreateCompatibleDC(NULL);");
      fprintf(FP_OUTPUT,"%s\n","  if(hDC == NULL){");
      fprintf(FP_OUTPUT,"%s\n","     return NULL;");
      fprintf(FP_OUTPUT,"%s\n","   }");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(hDC,hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  return hDC;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Set_BCX_BmpButton ){
      fprintf(FP_OUTPUT,"%s\n","void Set_BCX_BmpButton(HWND hWnd, PCTSTR File, int Res)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  RECT rc;");
      fprintf(FP_OUTPUT,"%s\n","  GetClientRect(hWnd, &rc);");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP Bm_Handle;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Res)");
      fprintf(FP_OUTPUT,"%s\n","      Bm_Handle = (HBITMAP)LoadImage(0, (char*)File, IMAGE_BITMAP, rc.right, rc.bottom, LR_LOADFROMFILE);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","      Bm_Handle = (HBITMAP)LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(Res), IMAGE_BITMAP, rc.right, rc.bottom, 0);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject((HBITMAP)SendMessage");
      fprintf(FP_OUTPUT,"%s\n","               (hWnd, (UINT_PTR)BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)Bm_Handle));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Set_BCX_Icon ){
      fprintf(FP_OUTPUT,"%s\n","void Set_BCX_Icon(HWND hWnd, PCTSTR File, int Res, int W, int H)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HICON hIcon;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG dwSize;");
      fprintf(FP_OUTPUT,"%s\n","  PBYTE pBytes;");
      fprintf(FP_OUTPUT,"%s\n","  if (!Res)");
      fprintf(FP_OUTPUT,"%s\n","    hIcon = (HICON)LoadImage(0,File,IMAGE_ICON,W,H,LR_LOADFROMFILE);");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    pBytes = (PBYTE)GetResource(Res,RT_ANICURSOR,&dwSize);");
      fprintf(FP_OUTPUT,"%s\n","    if (pBytes==NULL)");
      fprintf(FP_OUTPUT,"%s\n","      hIcon = (HICON)LoadImage(BCX_hInstance,MAKEINTRESOURCE(Res),IMAGE_ICON,W,H,0);");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      hIcon = CreateIconFromResourceEx (pBytes,dwSize,FALSE,0x00030000,W,H,LR_DEFAULTCOLOR);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  DestroyIcon((HICON)SendMessage");
      fprintf(FP_OUTPUT,"%s\n","              (hWnd,(UINT_PTR)STM_SETIMAGE,(WPARAM)IMAGE_ICON,(LPARAM)hIcon));");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Get ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP BCX_Get(HWND hWnd, int Left, int Top,");
      fprintf(FP_OUTPUT,"%s\n","                int Width, int Height, int Style, HDC SrcHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!SrcHDC) SrcHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HDC MemHDC = CreateCompatibleDC(SrcHDC);");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP OldBMP;");
      fprintf(FP_OUTPUT,"%s\n","  static HBITMAP RetBMP;");
      fprintf(FP_OUTPUT,"%s\n","  if (RetBMP) DeleteObject(RetBMP);");
      fprintf(FP_OUTPUT,"%s\n","  RetBMP = CreateCompatibleBitmap (SrcHDC,Width,Height);");
      fprintf(FP_OUTPUT,"%s\n","  OldBMP = (HBITMAP)SelectObject(MemHDC,RetBMP);");
      fprintf(FP_OUTPUT,"%s\n","  BitBlt (MemHDC,0,0,Width,Height,SrcHDC,Left,Top,Style);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(MemHDC,OldBMP);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(MemHDC);");
      fprintf(FP_OUTPUT,"%s\n","  if (hWnd) ReleaseDC(hWnd,SrcHDC);");
      fprintf(FP_OUTPUT,"%s\n","  return RetBMP;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_Put ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Put(HWND DesthWnd, HBITMAP hBitmap, int LtDest, int TopDest,");
      fprintf(FP_OUTPUT,"%s\n","             int WidDest, int HgtDest, int Style, HDC DesHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!DesHDC) DesHDC = GetDC(DesthWnd);");
      fprintf(FP_OUTPUT,"%s\n","  HDC MemHDC = CreateCompatibleDC(DesHDC);");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP OldBmp = (HBITMAP)SelectObject(MemHDC,hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  SetMapMode(MemHDC,GetMapMode(DesHDC));");
      fprintf(FP_OUTPUT,"%s\n","  BitBlt (DesHDC,LtDest,TopDest,WidDest,HgtDest,MemHDC,0,0,Style);");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(MemHDC,OldBmp);");
      fprintf(FP_OUTPUT,"%s\n","  if (DesthWnd) ReleaseDC(DesthWnd,DesHDC);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(MemHDC);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_LoadBMP ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP BCX_LoadBMP (PCTSTR F, int ii, int t)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (t) t = LR_LOADTRANSPARENT|LR_LOADMAP3DCOLORS;");
      fprintf(FP_OUTPUT,"%s\n","  if (ii)");
      fprintf(FP_OUTPUT,"%s\n","    return (HBITMAP)LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(ii),IMAGE_BITMAP,0,0,t);");
      fprintf(FP_OUTPUT,"%s\n","  return (HBITMAP)LoadImage(NULL,F,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|t);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_LoadImage ){
      fprintf(FP_OUTPUT,"%s\n","HBITMAP BCX_LoadImage (PCTSTR szFile, int Res)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HANDLE   hFile;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG    dwFileSize;");
      fprintf(FP_OUTPUT,"%s\n","  PVOID    pvData;");
      fprintf(FP_OUTPUT,"%s\n","  HGLOBAL  hGlobal;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG    dwBytesRead = 0;");
      fprintf(FP_OUTPUT,"%s\n","  LPSTREAM pstm;");
      fprintf(FP_OUTPUT,"%s\n","  HBITMAP  hTempBitmap;");
      fprintf(FP_OUTPUT,"%s\n","  PVOID   lpPicData;");
      fprintf(FP_OUTPUT,"%s\n","  LPPICTURE gpPicture;");
      fprintf(FP_OUTPUT,"%s\n","  if(Res)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      lpPicData = GetResource(Res,RT_RCDATA,&dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","      if(lpPicData==NULL) return 0;");
      fprintf(FP_OUTPUT,"%s\n","      hGlobal = GlobalAlloc(GMEM_MOVEABLE|GMEM_NODISCARD,dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","      pvData = GlobalLock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","      CopyMemory(pvData,lpPicData,dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","      GlobalUnlock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if(GetFileAttributes(szFile) == 0xffffffff) return 0;");
      fprintf(FP_OUTPUT,"%s\n","      hFile = CreateFile(szFile,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);");
      fprintf(FP_OUTPUT,"%s\n","      dwFileSize = GetFileSize(hFile,NULL);");
      fprintf(FP_OUTPUT,"%s\n","      hGlobal = GlobalAlloc(GMEM_MOVEABLE|GMEM_NODISCARD,dwFileSize);");
      fprintf(FP_OUTPUT,"%s\n","      pvData = GlobalLock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","      ReadFile(hFile,pvData,dwFileSize,&dwBytesRead,NULL);");
      fprintf(FP_OUTPUT,"%s\n","      GlobalUnlock(hGlobal);");
      fprintf(FP_OUTPUT,"%s\n","      CloseHandle(hFile);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  pstm = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  CreateStreamOnHGlobal(hGlobal,TRUE,&pstm);");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  OleLoadPicture(pstm,dwFileSize,FALSE,&IID_IPicture,(PVOID*)&gpPicture);");
      fprintf(FP_OUTPUT,"%s\n","  pstm->lpVtbl->Release(pstm);");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->lpVtbl->get_Handle(gpPicture,(OLE_HANDLE*)&hTempBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  hTempBitmap = (HBITMAP)CopyImage(hTempBitmap,IMAGE_BITMAP,0,0,LR_COPYRETURNORG);");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->lpVtbl->Release(gpPicture);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  OleLoadPicture(pstm,dwFileSize,FALSE,IID_IPicture,(PVOID*)&gpPicture);");
      fprintf(FP_OUTPUT,"%s\n","  pstm->Release();");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->get_Handle((OLE_HANDLE*)&hTempBitmap);");
      fprintf(FP_OUTPUT,"%s\n","  hTempBitmap = (HBITMAP)CopyImage(hTempBitmap,IMAGE_BITMAP,0,0,LR_COPYRETURNORG);");
      fprintf(FP_OUTPUT,"%s\n","  gpPicture->Release();");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  return hTempBitmap;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DrawTransBMP ){
      fprintf(FP_OUTPUT,"%s\n","void DrawTransBMP(HWND hWnd, HBITMAP hBitmap, ULONG cTransparentColor, int xStart, int yStart, HDC DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    BITMAP bm;");
      fprintf(FP_OUTPUT,"%s\n","    ULONG cColor;");
      fprintf(FP_OUTPUT,"%s\n","    HBITMAP bmAndBack = NULL, bmAndObject = NULL, bmAndMem = NULL, bmSave = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    HBITMAP bmBackOld = NULL, bmObjectOld = NULL, bmMemOld = NULL, bmSaveOld = NULL, hmTMP = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    HBITMAP bmTempOld = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    HDC hdcMem = NULL, hdcBack = NULL, hdcObject = NULL, hdcTemp = NULL, hdcSave = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    POINT ptSize;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (!DrawHDC)");
      fprintf(FP_OUTPUT,"%s\n","        DrawHDC = GetDC(hWnd);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hdcTemp = CreateCompatibleDC(DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","    bmTempOld = (HBITMAP)SelectObject(hdcTemp, hBitmap);");
      fprintf(FP_OUTPUT,"%s\n","    GetObject(hBitmap, sizeof(BITMAP), (PSTR)&bm);");
      fprintf(FP_OUTPUT,"%s\n","    ptSize.x = bm.bmWidth;");
      fprintf(FP_OUTPUT,"%s\n","    ptSize.y = bm.bmHeight;");
      fprintf(FP_OUTPUT,"%s\n","    DPtoLP(hdcTemp, &ptSize, 1);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hdcBack = CreateCompatibleDC(DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","    hdcObject = CreateCompatibleDC(DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","    hdcMem = CreateCompatibleDC(DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","    hdcSave = CreateCompatibleDC(DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);");
      fprintf(FP_OUTPUT,"%s\n","    bmAndMem = CreateCompatibleBitmap(DrawHDC, ptSize.x, ptSize.y);");
      fprintf(FP_OUTPUT,"%s\n","    bmSave = CreateCompatibleBitmap(DrawHDC, ptSize.x, ptSize.y);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    bmBackOld = (HBITMAP)SelectObject(hdcBack, bmAndBack);");
      fprintf(FP_OUTPUT,"%s\n","    bmObjectOld = (HBITMAP)SelectObject(hdcObject, bmAndObject);");
      fprintf(FP_OUTPUT,"%s\n","    bmMemOld = (HBITMAP)SelectObject(hdcMem, bmAndMem);");
      fprintf(FP_OUTPUT,"%s\n","    bmSaveOld = (HBITMAP)SelectObject(hdcSave, bmSave);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    SetMapMode(hdcTemp, GetMapMode(DrawHDC));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcSave, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","    cColor = SetBkColor(hdcTemp, cTransparentColor);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","    SetBkColor(hdcTemp, cColor);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, DrawHDC, xStart, yStart, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(DrawHDC, xStart, yStart, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n","    BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcSave, 0, 0, SRCCOPY);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    SelectObject(hdcTemp, bmTempOld);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hmTMP = (HBITMAP)SelectObject(hdcBack, bmBackOld);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteObject(hmTMP);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hmTMP = (HBITMAP)SelectObject(hdcObject, bmObjectOld);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteObject(hmTMP);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hmTMP = (HBITMAP)SelectObject(hdcMem, bmMemOld);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteObject(hmTMP);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hmTMP = (HBITMAP)SelectObject(hdcSave, bmSaveOld);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteObject(hmTMP);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    DeleteDC(hdcMem);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteDC(hdcBack);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteDC(hdcObject);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteDC(hdcSave);");
      fprintf(FP_OUTPUT,"%s\n","    DeleteDC(hdcTemp);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (hWnd)");
      fprintf(FP_OUTPUT,"%s\n","        ReleaseDC(hWnd, DrawHDC);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_BmpWidth ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_BmpWidth (HBITMAP hBmp)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP bm;");
      fprintf(FP_OUTPUT,"%s\n","  if (hBmp)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    GetObject(hBmp,sizeof(bm),&bm);");
      fprintf(FP_OUTPUT,"%s\n","    return bm.bmWidth;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_BCX_BmpHeight ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_BmpHeight (HBITMAP hBmp)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BITMAP bm;");
      fprintf(FP_OUTPUT,"%s\n","  if (hBmp)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    GetObject(hBmp,sizeof(bm),&bm);");
      fprintf(FP_OUTPUT,"%s\n","    return bm.bmHeight;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DrawStr ){
      fprintf(FP_OUTPUT,"%s\n","void Draw(char* DrawString) {");
      fprintf(FP_OUTPUT,"%s\n","    if(strlen(DrawString) > 8192) return;");
      fprintf(FP_OUTPUT,"%s\n","    static HWND hParent;");
      fprintf(FP_OUTPUT,"%s\n","    static HWND Canvas;");
      fprintf(FP_OUTPUT,"%s\n","    if (hParent == NULL) {");
      fprintf(FP_OUTPUT,"%s\n","        hParent = GetActiveWindow();");
      fprintf(FP_OUTPUT,"%s\n","        Canvas = BCX_Bitmap(0, hParent, ");
      fprintf(FP_OUTPUT,"%s\n","                            0, 0, 0, ");
      fprintf(FP_OUTPUT,"%s\n","                            GetSystemMetrics(SM_CXSCREEN), ");
      fprintf(FP_OUTPUT,"%s\n","                            GetSystemMetrics(SM_CYSCREEN));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    static int X;");
      fprintf(FP_OUTPUT,"%s\n","    static int Y;");
      fprintf(FP_OUTPUT,"%s\n","    static int PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","    static int PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","    static int IsRelative;");
      fprintf(FP_OUTPUT,"%s\n","    static int ReturnFlag;");
      fprintf(FP_OUTPUT,"%s\n","    static double Scale = 1;");
      fprintf(FP_OUTPUT,"%s\n","    static HDC hDestDC;");
      fprintf(FP_OUTPUT,"%s\n","    static int PENCOLOR = RGB(255, 255, 255);");
      fprintf(FP_OUTPUT,"%s\n","    int Distance = 0;");
      fprintf(FP_OUTPUT,"%s\n","    int Ndx = 0;");
      fprintf(FP_OUTPUT,"%s\n","    char Shape[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","    char** Stk = 0;");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","       Stk = NULL;");
      fprintf(FP_OUTPUT,"%s\n","        size_t dimensions[2] = {(size_t)8192, (size_t)1};");
      fprintf(FP_OUTPUT,"%s\n","        Stk = (char**)CreateArr(Stk, 4, 0, 2, dimensions);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    char Verb[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","    char Tmp[BCXSTRSIZE] ={0};");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    strcpy(Shape, ucase(DrawString));");
      fprintf(FP_OUTPUT,"%s%s%s\n","    strcpy(Shape, RemoveStr(Shape, ",enc(";"),"));");
      fprintf(FP_OUTPUT,"%s%s%s\n","    strcpy(Shape, RemoveStr(Shape, ",enc("="),"));");
      fprintf(FP_OUTPUT,"%s%s%s\n","    strcpy(Shape, RemoveStr(Shape, ",enc(SPC),"));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hDestDC = StartDraw(Canvas);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    Ndx = DSplit(Stk, Shape, ",enc("ABCDEFGHLMNPRSU,"),", 1);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    for (int i = 1; i <= Ndx; i++) {");
      fprintf(FP_OUTPUT,"%s\n","        strcpy(Verb, ucase(Stk[i]));");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        // Map strings to character constants");
      fprintf(FP_OUTPUT,"%s\n","        char command = Verb[0];");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","        switch (command) {");
      fprintf(FP_OUTPUT,"%s\n","            case 'B':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","                if (isdigit(*Stk[i])) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                    i += 2;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                    BCX_Preset(0, X, Y, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                } else {");
      fprintf(FP_OUTPUT,"%s\n","                    i++;");
      fprintf(FP_OUTPUT,"%s\n","                    switch (Stk[i][0]) {");
      fprintf(FP_OUTPUT,"%s\n","                        case 'U':");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            Y = Y - Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'D':");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            Y = Y + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'L':");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            X = X - Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'R':");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            X = X + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'E':");
      fprintf(FP_OUTPUT,"%s\n","                            strcpy(Tmp, Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            if (isdigit(*Stk[i + 2])) {");
      fprintf(FP_OUTPUT,"%s\n","                                strcat(Tmp, Stk[i + 2]);");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 1], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 2], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s\n","                            }");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Tmp);");
      fprintf(FP_OUTPUT,"%s\n","                            X = X + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            Y = -Scale + Y - Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'F':");
      fprintf(FP_OUTPUT,"%s\n","                            strcpy(Tmp, Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            if (isdigit(*Stk[i + 2])) {");
      fprintf(FP_OUTPUT,"%s\n","                                strcat(Tmp, Stk[i + 2]);");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 1], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 2], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s\n","                            }");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Tmp);");
      fprintf(FP_OUTPUT,"%s\n","                            X = X + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            Y = -Scale + Y + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'G':");
      fprintf(FP_OUTPUT,"%s\n","                            strcpy(Tmp, Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            if (isdigit(*Stk[i + 2])) {");
      fprintf(FP_OUTPUT,"%s\n","                                strcat(Tmp, Stk[i + 2]);");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 1], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 2], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s\n","                            }");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Tmp);");
      fprintf(FP_OUTPUT,"%s\n","                            X = X - Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            Y = -Scale + Y + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                        case 'H':");
      fprintf(FP_OUTPUT,"%s\n","                            strcpy(Tmp, Stk[i + 1]);");
      fprintf(FP_OUTPUT,"%s\n","                            if (isdigit(*Stk[i + 2])) {");
      fprintf(FP_OUTPUT,"%s\n","                                strcat(Tmp, Stk[i + 2]);");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 1], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s%s%s\n","                                strcpy(Stk[i + 2], ",enc(SPC),");");
      fprintf(FP_OUTPUT,"%s\n","                            }");
      fprintf(FP_OUTPUT,"%s\n","                            Distance = VAL(Tmp);");
      fprintf(FP_OUTPUT,"%s\n","                            X = X + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            Y = -Scale + Y + Distance * Scale;");
      fprintf(FP_OUTPUT,"%s\n","                            break;");
      fprintf(FP_OUTPUT,"%s\n","                    }");
      fprintf(FP_OUTPUT,"%s\n","                    BCX_Preset(0, X, Y, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                    PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                    PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'C':");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                PENCOLOR = qbcolor(VAL(Stk[i]));");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'D':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                    Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                    i--;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Line(0, X, Y, X, Y + Distance, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                Y += Distance;");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'E':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                    Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                    i--;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Line(0, X, Y, X + Distance, Y - Distance, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                X += Distance;");
      fprintf(FP_OUTPUT,"%s\n","                Y -= Distance;");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'F':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                    Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                    i--;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Line(0, X, Y, X + Distance, Y + Distance, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                X += Distance;");
      fprintf(FP_OUTPUT,"%s\n","                Y += Distance;");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'G':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                    Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                    i--;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Line(0, X, Y, X - Distance, Y + Distance, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                X -= Distance;");
      fprintf(FP_OUTPUT,"%s\n","                Y += Distance;");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'H':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                    Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                    i--;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Line(0, X, Y, X - Distance, Y - Distance, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                X -= Distance;");
      fprintf(FP_OUTPUT,"%s\n","                Y -= Distance;");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'L':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                    Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                    i--;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Line(0, X, Y, X - Distance, Y, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                X -= Distance;");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'M':");
      fprintf(FP_OUTPUT,"%s\n","                PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","                PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","                i++;");
      fprintf(FP_OUTPUT,"%s\n","                IsRelative = FALSE;");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","                if ((strcmp(mid(Stk[i], 1, 1), ",enc("+"),") == 0 || strcmp(mid(Stk[i], 1, 1), ",enc("-"),") == 0)) {");
      fprintf(FP_OUTPUT,"%s\n","                    IsRelative = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                if (IsRelative) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = X + VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                    i += 2;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = Y + VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                } else {");
      fprintf(FP_OUTPUT,"%s\n","                    X = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                    i += 2;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                BCX_Lineto(0, X, Y, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                    X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                    Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                    ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","                }");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'N':");
      fprintf(FP_OUTPUT,"%s\n","                ReturnFlag = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","                break;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","            case 'P':");
      fprintf(FP_OUTPUT,"%s\n","                BCX_FloodFill(0, X, Y, qbcolor(VAL(Stk[i + 3])), qbcolor(VAL(Stk[i + 1])), 1, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","                 break;");
      fprintf(FP_OUTPUT,"%s\n","                 ");
      fprintf(FP_OUTPUT,"%s\n","            case 'R':     ");
      fprintf(FP_OUTPUT,"%s\n","                ");
      fprintf(FP_OUTPUT,"%s\n","                  PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","            PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","            i++;");
      fprintf(FP_OUTPUT,"%s\n","            Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","            if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                i--;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","            BCX_Line(0, X, Y, X + Distance, Y, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","            X += Distance;");
      fprintf(FP_OUTPUT,"%s\n","            if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","             break;");
      fprintf(FP_OUTPUT,"%s\n","             ");
      fprintf(FP_OUTPUT,"%s\n","             case 'S':");
      fprintf(FP_OUTPUT,"%s\n","              i++;");
      fprintf(FP_OUTPUT,"%s\n","            Scale = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","            if (Scale <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                Scale = 1;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            break;");
      fprintf(FP_OUTPUT,"%s\n","            ");
      fprintf(FP_OUTPUT,"%s\n","            case 'U':");
      fprintf(FP_OUTPUT,"%s\n","              PreviousX = X;");
      fprintf(FP_OUTPUT,"%s\n","            PreviousY = Y;");
      fprintf(FP_OUTPUT,"%s\n","            i++;");
      fprintf(FP_OUTPUT,"%s\n","            Distance = VAL(Stk[i]);");
      fprintf(FP_OUTPUT,"%s\n","            if (Distance <= 0) {");
      fprintf(FP_OUTPUT,"%s\n","                Distance = 1;");
      fprintf(FP_OUTPUT,"%s\n","                i--;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            Distance *= Scale;");
      fprintf(FP_OUTPUT,"%s\n","            BCX_Line(0, X, Y, X, Y - Distance, PENCOLOR, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","            Y -= Distance;");
      fprintf(FP_OUTPUT,"%s\n","            if (ReturnFlag) {");
      fprintf(FP_OUTPUT,"%s\n","                X = PreviousX;");
      fprintf(FP_OUTPUT,"%s\n","                Y = PreviousY;");
      fprintf(FP_OUTPUT,"%s\n","                ReturnFlag = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","            }");
      fprintf(FP_OUTPUT,"%s\n","            break; ");
      fprintf(FP_OUTPUT,"%s\n","         }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    EndDraw(Canvas, hDestDC);");
      fprintf(FP_OUTPUT,"%s\n","    if (Stk) {");
      fprintf(FP_OUTPUT,"%s\n","        DestroyArr((void**)Stk, 2, 1);");
      fprintf(FP_OUTPUT,"%s\n","        Stk = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
}

void Emit_RT_SystemCOM1 (FILE* FP_OUTPUT)
{
  if(Use_RegExist ){
      fprintf(FP_OUTPUT,"%s\n","long RegExist (HKEY HK, PCHAR Key, PCHAR SubKey)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HKEY hKey;");
      fprintf(FP_OUTPUT,"%s\n","  long Result;");
      fprintf(FP_OUTPUT,"%s\n","  Result = RegOpenKeyEx(HK, Key, 0, KEY_QUERY_VALUE, &hKey);");
      fprintf(FP_OUTPUT,"%s\n","  if (Result == ERROR_SUCCESS)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    static char SubKeyResult [BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s\n","    memset(&SubKeyResult,0,sizeof(SubKeyResult));");
      fprintf(FP_OUTPUT,"%s\n","    int BufferLen = sizeof(SubKeyResult);");
      fprintf(FP_OUTPUT,"%s\n","    Result = -RegQueryValueEx (hKey,SubKey,0,0,(PBYTE)SubKeyResult,(PDWORD)&BufferLen);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  RegCloseKey(hKey);");
      fprintf(FP_OUTPUT,"%s\n","  return Result;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_DeleteRegKey ){
      fprintf(FP_OUTPUT,"%s\n","void DeleteRegKey (HKEY HK, PCTSTR Key)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  RegDeleteKey(HK,Key);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_CreateRegInt ){
      fprintf(FP_OUTPUT,"%s\n","void CreateRegInt (HKEY HK, PCTSTR Key, PCTSTR VarName, int Value)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char  Buf[100]={0};");
      fprintf(FP_OUTPUT,"%s\n","  ULONG Result;");
      fprintf(FP_OUTPUT,"%s\n","  HKEY  hKey;");
      fprintf(FP_OUTPUT,"%s\n","  RegCreateKeyEx(HK,Key,0,Buf,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&hKey,&Result);");
      fprintf(FP_OUTPUT,"%s\n","  RegSetValueEx(hKey,VarName,0,REG_DWORD,(BYTE*)&Value,sizeof(int));");
      fprintf(FP_OUTPUT,"%s\n","  RegCloseKey(hKey);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_RegInt ){
      fprintf(FP_OUTPUT,"%s\n","int RegInt(HKEY HK, PCTSTR Key, PCTSTR SubKey)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HKEY  hKey   =  0;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG Result =  0;");
      fprintf(FP_OUTPUT,"%s\n","  ULONG Size   =  sizeof(ULONG);");
      fprintf(FP_OUTPUT,"%s\n","  RegOpenKeyEx    (HK,Key,0,KEY_QUERY_VALUE,&HK);");
      fprintf(FP_OUTPUT,"%s\n","  RegQueryValueEx (HK,SubKey,0,0,(PBYTE)&Result,&Size);");
      fprintf(FP_OUTPUT,"%s\n","  RegCloseKey     (hKey);");
      fprintf(FP_OUTPUT,"%s\n","  return Result;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Printer ){
      fprintf(FP_OUTPUT,"%s\n","int PrinterOpen (PCTSTR fontname, int PointSize, int charset)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char zPrinter[BCXSTRSIZE];");
      fprintf(FP_OUTPUT,"%s%s%s%s%s%s%s\n","  GetProfileString(",enc("WINDOWS"),",",enc("DEVICE"),",",DDQ,",zPrinter,127);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(zPrinter,(char*)extract(zPrinter,",enc(","),"));");
      fprintf(FP_OUTPUT,"%s%s%s\n","  strcpy(BcxPtr_Text,",enc("Printing ..."),");");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  BcxPtr_hDC = CreateDC(",DDQ,",zPrinter,",DDQ,",0);");
      fprintf(FP_OUTPUT,"%s\n","  if (!BcxPtr_hDC) return 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_di.cbSize = sizeof(BcxPtr_di);");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_di.lpszDocName = BcxPtr_Text;");
      fprintf(FP_OUTPUT,"%s\n","  StartDoc(BcxPtr_hDC,&BcxPtr_di);");
      fprintf(FP_OUTPUT,"%s\n","  StartPage(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","  SetTextAlign(BcxPtr_hDC,TA_BASELINE|TA_NOUPDATECP|TA_LEFT);");
      fprintf(FP_OUTPUT,"%s\n","  SetBkMode(BcxPtr_hDC,TRANSPARENT);");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfHeight = PointSize*GetDeviceCaps(BcxPtr_hDC,LOGPIXELSY)/72;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfWidth = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfEscapement = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfOrientation = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfWeight = FW_NORMAL;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfItalic = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfUnderline = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfStrikeOut = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfCharSet = charset;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfOutPrecision = OUT_DEFAULT_PRECIS;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfQuality = PROOF_QUALITY;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_Lf.lfPitchAndFamily = VARIABLE_PITCH|FF_ROMAN;");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(BcxPtr_Lf.lfFaceName,fontname); ");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_hFont = CreateFontIndirect(&BcxPtr_Lf);");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_hFontOld = (HFONT)SelectObject(BcxPtr_hDC,BcxPtr_hFont);");
      fprintf(FP_OUTPUT,"%s\n","  GetTextMetrics(BcxPtr_hDC, &BcxPtr_tm);");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_FontMetrix = BcxPtr_Lf.lfHeight;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_PrinterOn = 1;");
      fprintf(FP_OUTPUT,"%s\n","  return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void PrinterWrite (PCTSTR TextIn, int CPL, int LPP)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char sTemp[BCXSTRSIZE]={0};");
      fprintf(FP_OUTPUT,"%s\n","  if (!BcxPtr_PrinterOn)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(),",enc("Problem with Printer"),",",DDQ,",0);");
      fprintf(FP_OUTPUT,"%s\n","    return;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  strcpy(sTemp,TextIn);");
      fprintf(FP_OUTPUT,"%s\n","  for(;;)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if ((int)strlen(sTemp) > (int)CPL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(BcxPtr_Text,(char*)left(sTemp,CPL));");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(sTemp,(char*)mid(sTemp,CPL+1));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      strcpy(BcxPtr_Text,sTemp);");
      fprintf(FP_OUTPUT,"%s\n","      *sTemp = 0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (BcxPtr_LineCtr > LPP)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      EndPage(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","      BcxPtr_LineCtr = 0;");
      fprintf(FP_OUTPUT,"%s\n","      StartPage(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    BcxPtr_LineCtr += 1;");
      fprintf(FP_OUTPUT,"%s\n","    TextOut(BcxPtr_hDC,20,BcxPtr_FontMetrix*BcxPtr_LineCtr,BcxPtr_Text,(int)strlen(BcxPtr_Text));");
      fprintf(FP_OUTPUT,"%s\n","    if (sTemp[0]==0) break;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void PrinterClose (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  if (!BcxPtr_PrinterOn) return;");
      fprintf(FP_OUTPUT,"%s\n","  SelectObject(BcxPtr_hDC,BcxPtr_hFontOld);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteObject(BcxPtr_hFont);");
      fprintf(FP_OUTPUT,"%s\n","  EndPage(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","  EndDoc(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","  DeleteDC(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_LineCtr = 0;");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_PrinterOn = 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void EjectPage(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  EndPage(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","  BcxPtr_LineCtr = 0;");
      fprintf(FP_OUTPUT,"%s\n","  StartPage(BcxPtr_hDC);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_COM_CLSID ){
      fprintf(FP_OUTPUT,"%s\n","char* BCX_CLSID(char* ProgID)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","    CLSID ClassID={0};");
      fprintf(FP_OUTPUT,"%s\n","    HRESULT hr={0};");
      fprintf(FP_OUTPUT,"%s\n","    PWSTR pCLSIDString = NULL;");
      fprintf(FP_OUTPUT,"%s\n","    char *BCX_RetStr={0};");
      fprintf(FP_OUTPUT,"%s\n","    char Result[256]={0};");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    hr = CoInitialize(NULL);");
      fprintf(FP_OUTPUT,"%s\n","    if (hr != S_OK) {");
      fprintf(FP_OUTPUT,"%s%s%s\n","        BCX_RetStr = BCX_TempStr(strlen(",enc("COM initialization failed"),"));");
      fprintf(FP_OUTPUT,"%s%s%s\n","        strcpy(BCX_RetStr, ",enc("COM initialization failed"),");");
      fprintf(FP_OUTPUT,"%s\n","        return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    hr = CLSIDFromProgID(AnsiToWide(ProgID), &ClassID);");
      fprintf(FP_OUTPUT,"%s\n","    if (hr == S_OK) {");
      fprintf(FP_OUTPUT,"%s\n","        // Convert CLSID to a string");
      fprintf(FP_OUTPUT,"%s\n","        #ifdef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","        hr = StringFromCLSID(ClassID, &pCLSIDString);");
      fprintf(FP_OUTPUT,"%s\n","        #else");
      fprintf(FP_OUTPUT,"%s\n","        hr = StringFromCLSID(&ClassID, &pCLSIDString);");
      fprintf(FP_OUTPUT,"%s\n","        #endif");
      fprintf(FP_OUTPUT,"%s\n","        if (hr == S_OK) {");
      fprintf(FP_OUTPUT,"%s\n","            strcpy(Result, WideToAnsi(pCLSIDString));");
      fprintf(FP_OUTPUT,"%s\n","            CoTaskMemFree(pCLSIDString);");
      fprintf(FP_OUTPUT,"%s\n","        } else {");
      fprintf(FP_OUTPUT,"%s%s%s\n","            strcpy(Result, ",enc("Failed to convert CLSID to string"),");");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","    } else {");
      fprintf(FP_OUTPUT,"%s%s%s\n","        strcpy(Result, ",enc("Failed to get CLSID"),");");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    CoUninitialize();");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(strlen(Result));");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RetStr, Result);");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SysStr ){
      fprintf(FP_OUTPUT,"%s\n","BSTR SysStr (PCTSTR szIn, int widstr, int bfree)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static BSTR bStr[32];");
      fprintf(FP_OUTPUT,"%s\n","  static int  index;");
      fprintf(FP_OUTPUT,"%s\n","  static int  result;");
      fprintf(FP_OUTPUT,"%s\n","  if (bfree)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    for (index = 0; index<32; index += 1) ");
      fprintf(FP_OUTPUT,"%s\n","    SysFreeString(bStr[index]);");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  result = (++index & 31);");
      fprintf(FP_OUTPUT,"%s\n","  index = result;");
      fprintf(FP_OUTPUT,"%s\n","  SysFreeString(bStr[index]);");
      fprintf(FP_OUTPUT,"%s\n","  ULONG length = (ULONG)strlen(szIn);");
      fprintf(FP_OUTPUT,"%s\n","  if (widstr)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    bStr[index] = SysAllocStringLen(NULL, (2*length));");
      fprintf(FP_OUTPUT,"%s\n","    MultiByteToWideChar(CP_ACP, 0, szIn, -1, bStr[index], (2*length+1));");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    bStr[index] = SysAllocStringByteLen(szIn, length);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return bStr[index];");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_SafeArrays ){
      Emit_BCX_SafeArray(FP_OUTPUT);
    }
  if(Use_COM ){
      Emit_COM_StandardSet(FP_OUTPUT);
      if(COM_build_trace_code ){
          Emit_COM_TraceCalls(FP_OUTPUT);
        }
      if(Use_COM_CreateObject ){
          Emit_COM_CreateObject(FP_OUTPUT);
        }
      if(Use_COM_GetObject ){
          Emit_COM_GetObject(FP_OUTPUT);
        }
      if(Use_COM_DispatchObject ){
          Emit_COM_DispatchObject(FP_OUTPUT);
        }
      if(Use_COM_SafeArray ){
          Emit_COM_SafeArray(FP_OUTPUT);
        }
      if(Use_COM_UsesConversion ){
          Emit_COM_UsesConversion(FP_OUTPUT);
        }
      if(Use_COM_GetProperty ){
          Emit_COM_GetProperty(FP_OUTPUT);
        }
      if(Use_COM_SetProperty ){
          Emit_COM_SetProperty(FP_OUTPUT);
        }
      if(Use_COM_InvokeMethod ){
          Emit_COM_InvokeMethod(FP_OUTPUT);
        }
    }
}

void Emit_RT_SystemCOM2 (FILE* FP_OUTPUT)
{
  if(Use_VBS ){
      fprintf(FP_OUTPUT,"%s\n","BOOL VBS_START (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  HRESULT  hResult;");
      fprintf(FP_OUTPUT,"%s\n","  GUID  clsid;");
      fprintf(FP_OUTPUT,"%s\n","  BSTR  Language;");
      fprintf(FP_OUTPUT,"%s\n","  OLE_ERROR_S = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","  if (S_OK!=OleInitialize(0))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    MessageBox(NULL,",enc("Couldn't initialize OLE!"),",NULL,MB_OK);");
      fprintf(FP_OUTPUT,"%s\n","    PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","#ifdef __BCX_MULTITHREADED__");
      fprintf(FP_OUTPUT,"%s\n","  CoInitializeEx(NULL, COINIT_MULTITHREADED);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s%s%s\n","  hResult=CLSIDFromProgID(OLESTR(",enc("MSScriptControl.ScriptControl"),"),&clsid);");
      fprintf(FP_OUTPUT,"%s\n","  if (hResult!=S_OK)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    for(;;)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (hResult==REGDB_E_CLASSNOTREG)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        OleUninitialize();");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        MessageBox (GetActiveWindow(),",enc("MSScriptControl::Class not registered"),",",enc("Error"),",MB_SETFOREGROUND);");
      fprintf(FP_OUTPUT,"%s\n","        PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","        break;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if (hResult==CLASS_E_NOAGGREGATION)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        OleUninitialize();");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        MessageBox (GetActiveWindow(),",enc("MSScriptControl::Class not created"),",",enc("Error"),",MB_SETFOREGROUND);");
      fprintf(FP_OUTPUT,"%s\n","        PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","        break;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      if (hResult==CLASS_E_CLASSNOTAVAILABLE)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        OleUninitialize();");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        MessageBox (GetActiveWindow(),",enc("MSScriptControl::Class not available"),",",enc("Error"),",MB_SETFOREGROUND);");
      fprintf(FP_OUTPUT,"%s\n","        PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","        break;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        VBS_STOP();");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        MessageBox (GetActiveWindow(),",enc("MSScriptControl::Unknown error"),",",enc("Error"),",MB_SETFOREGROUND);");
      fprintf(FP_OUTPUT,"%s\n","        PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  hResult=CoCreateInstance(&clsid,0,CLSCTX_SERVER,&IID_IScriptControl,(void**)&pSC);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  hResult=CoCreateInstance(clsid,0,CLSCTX_SERVER,IID_IScriptControl,(void**)&pSC);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s%s%s\n","  Language=SysAllocString(OLESTR(",enc("VBScript"),"));");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  hResult=pSC->lpVtbl->put_Language(pSC,Language);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  hResult=pSC->put_Language(Language);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  SysFreeString(Language);");
      fprintf(FP_OUTPUT,"%s\n","  if (hResult!=S_OK)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    VBS_STOP();");
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","    MessageBox (GetActiveWindow(),",enc("Could not start ScriptControl"),",",enc("Error"),",MB_SETFOREGROUND);");
      fprintf(FP_OUTPUT,"%s\n","    PostQuitMessage(0);");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return TRUE;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void VBS_STOP (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  pSC->lpVtbl->Release(pSC);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  pSC->Release();");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  pSC=0;;");
      fprintf(FP_OUTPUT,"%s\n","  OleUninitialize();");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","void VBS_RESET (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  pSC->lpVtbl->Reset(pSC);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  pSC->Reset();");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","HRESULT VBS_RUN_SCRIPT (PCTSTR VB_SCRIPT)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BSTR  MyCode;");
      fprintf(FP_OUTPUT,"%s\n","  HRESULT  hResult;");
      fprintf(FP_OUTPUT,"%s\n","  MyCode=SysAllocString(AnsiToWide(VB_SCRIPT));");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  hResult=pSC->lpVtbl->ExecuteStatement(pSC,MyCode);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  hResult=pSC->ExecuteStatement(MyCode);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  SysFreeString(MyCode);");
      fprintf(FP_OUTPUT,"%s\n","  return SUCCEEDED(hResult);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","HRESULT VBS_ADDCODE (PCTSTR Code)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int CodeLen;");
      fprintf(FP_OUTPUT,"%s\n","  wchar_t* Buf;");
      fprintf(FP_OUTPUT,"%s\n","  BSTR Bbuf;");
      fprintf(FP_OUTPUT,"%s\n","  HRESULT hResult;");
      fprintf(FP_OUTPUT,"%s\n","  CodeLen=(int)strlen(Code);");
      fprintf(FP_OUTPUT,"%s\n","  Buf=(wchar_t*)calloc(2*(CodeLen+1),sizeof(wchar_t));");
      fprintf(FP_OUTPUT,"%s\n","  mbstowcs(Buf,Code,CodeLen);");
      fprintf(FP_OUTPUT,"%s\n","  Bbuf=SysAllocString(Buf);");
      fprintf(FP_OUTPUT,"%s\n","  free((Buf));");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  hResult=pSC->lpVtbl->AddCode(pSC,Bbuf);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  hResult=pSC->AddCode(Bbuf);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  SysFreeString(Bbuf);");
      fprintf(FP_OUTPUT,"%s\n","  return SUCCEEDED(hResult);");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","double VBS_EVAL_NUM (PCTSTR VB_SCRIPT)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  BSTR  MyCode;");
      fprintf(FP_OUTPUT,"%s\n","  HRESULT HResult;");
      fprintf(FP_OUTPUT,"%s\n","  VARIANT vResult;");
      fprintf(FP_OUTPUT,"%s\n","  MyCode=SysAllocString(AnsiToWide(VB_SCRIPT));");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  HResult=pSC->lpVtbl->Eval(pSC,MyCode,&vResult);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  HResult=pSC->Eval(MyCode,&vResult);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  SysFreeString(MyCode);\n");
      fprintf(FP_OUTPUT,"%s\n","  if (SUCCEEDED(HResult))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    HResult=VariantChangeType(&vResult,&vResult,0,VT_R8);");
      fprintf(FP_OUTPUT,"%s\n","    return vResult.dblVal;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","char* VBS_ERROR(void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr= {0};");
      fprintf(FP_OUTPUT,"%s\n","  IScriptError* pScriptError;");
      fprintf(FP_OUTPUT,"%s\n","  HRESULT HResult;");
      fprintf(FP_OUTPUT,"%s\n","  long  ErrNumber;");
      fprintf(FP_OUTPUT,"%s\n","  BSTR  ErrDescription = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  BSTR  ErrText = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  long  ErrLine;");
      fprintf(FP_OUTPUT,"%s\n","  long  ErrColumn;");
      fprintf(FP_OUTPUT,"%s\n","  UINT  Errdesclen;");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  HResult = pSC->lpVtbl->get_Error(pSC, &pScriptError);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  HResult = pSC->get_Error(&pScriptError);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  if FAILED(HResult)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    *BCX_RetStr=0;");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (pScriptError)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->lpVtbl->Get_Number(pScriptError,&ErrNumber);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->lpVtbl->Get_Description(pScriptError, &ErrDescription);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->lpVtbl->Get_Text(pScriptError, &ErrText);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->lpVtbl->Get_Line(pScriptError, &ErrLine);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->lpVtbl->Get_Column(pScriptError, &ErrColumn);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->Get_Number(&ErrNumber);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->Get_Description(&ErrDescription);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->Get_Text(&ErrText);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->Get_Line(&ErrLine);");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->Get_Column(&ErrColumn);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    if (NULL == ErrDescription)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s%s%s\n","      ErrDescription = SysAllocString(OLESTR(",enc("No description available."),"));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (NULL == ErrText)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s%s%s\n","      ErrText = SysAllocString(OLESTR(",enc("No extra error info available."),"));");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    Errdesclen =  SysStringLen(ErrDescription) + SysStringLen(ErrText) + 512;");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr=BCX_TempStr(Errdesclen);");
      fprintf(FP_OUTPUT,"%s%s%s\n","    sprintf(BCX_RetStr,",enc("VBScript error 0x%lX\\nline:%d, column:%d\\nDescription: %s\\nError text: %s"),", ErrNumber, ErrLine, ErrColumn,WideToAnsi(ErrDescription),WideToAnsi(ErrText));");
      fprintf(FP_OUTPUT,"%s\n","    SysFreeString(ErrDescription);");
      fprintf(FP_OUTPUT,"%s\n","    SysFreeString(ErrText);");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->lpVtbl->Release(pScriptError);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","    pScriptError->Release();");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  *BCX_RetStr=0;");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","char* VBS_EVAL_STR(PCTSTR VB_SCRIPT)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  char *BCX_RetStr= {0};");
      fprintf(FP_OUTPUT,"%s\n","  BSTR  MyCode;");
      fprintf(FP_OUTPUT,"%s\n","  HRESULT HResult;");
      fprintf(FP_OUTPUT,"%s\n","  VARIANT vResult;");
      fprintf(FP_OUTPUT,"%s\n","  MyCode=SysAllocString(AnsiToWide(VB_SCRIPT));");
      fprintf(FP_OUTPUT,"%s\n","#ifndef __cplusplus");
      fprintf(FP_OUTPUT,"%s\n","  HResult=pSC->lpVtbl->Eval(pSC,MyCode,&vResult);");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  HResult=pSC->Eval(MyCode,&vResult);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n","  SysFreeString(MyCode);");
      fprintf(FP_OUTPUT,"%s\n","  if (SUCCEEDED(HResult))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    HResult = VariantChangeType(&vResult,&vResult,0,VT_BSTR);");
      fprintf(FP_OUTPUT,"%s\n","    BCX_RetStr = BCX_TempStr(strlen(WideToAnsi(vResult.bstrVal)));");
      fprintf(FP_OUTPUT,"%s\n","    strcpy(BCX_RetStr,(PCTSTR)WideToAnsi(vResult.bstrVal));");
      fprintf(FP_OUTPUT,"%s\n","    return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  *BCX_RetStr=0;");
      fprintf(FP_OUTPUT,"%s\n","  return BCX_RetStr;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_FileLocked ){
      fprintf(FP_OUTPUT,"%s\n","int FileLocked (PCTSTR Filename)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s%s%s\n","  FILE *FP = fopen (Filename,",enc("rb+"),");");
      fprintf(FP_OUTPUT,"%s\n","  if (FP == 0) return 1;");
      fprintf(FP_OUTPUT,"%s\n","  fclose(FP);");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Sound ){
      fprintf(FP_OUTPUT,"%s\n","int Sound (float Freq, int Dura, int Vol, int Voice, float Tempo)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static int MidiRunning;");
      fprintf(FP_OUTPUT,"%s\n","  if(MidiRunning == FALSE)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      MidiRunning = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","      midiOutOpen(&hMidi, (UINT)(-1), 0, 0, CALLBACK_NULL);");
      fprintf(FP_OUTPUT,"%s\n","      Sound(0, 1 ,0);");
      fprintf(FP_OUTPUT,"%s\n","      Sleep(500);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  ULONG dwThreadId;");
      fprintf(FP_OUTPUT,"%s\n","  if (Freq == 0 && Dura <1) return gTenter-gTexit;");
      fprintf(FP_OUTPUT,"%s\n","  if (Freq == 0) Vol=0;");
      fprintf(FP_OUTPUT,"%s\n","  if (Dura<5)  Dura=5;");
      fprintf(FP_OUTPUT,"%s\n","  gTenter++;");
      fprintf(FP_OUTPUT,"%s\n","  gTsig = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","  if (gTenter >= SNDQUE)");
      fprintf(FP_OUTPUT,"%s\n","    gTarray = gTenter % SNDQUE + 1;");
      fprintf(FP_OUTPUT,"%s\n","  else");
      fprintf(FP_OUTPUT,"%s\n","    gTarray = gTenter;");
      fprintf(FP_OUTPUT,"%s\n","  SndPmtr[gTarray].Freq=Freq;");
      fprintf(FP_OUTPUT,"%s\n","  SndPmtr[gTarray].Dura=Dura;");
      fprintf(FP_OUTPUT,"%s\n","  SndPmtr[gTarray].Tempo=Tempo;");
      fprintf(FP_OUTPUT,"%s\n","  SndPmtr[gTarray].Vol=Vol;");
      fprintf(FP_OUTPUT,"%s\n","  SndPmtr[gTarray].Voice=Voice;");
      fprintf(FP_OUTPUT,"%s\n","  SndPmtr[gTarray].sndTid=gTenter;");
      fprintf(FP_OUTPUT,"%s\n","  if (gSThread==NULL && (Freq==fabsf(Freq)||Freq==0))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    gSThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)PlaySnd,(PSTR)",enc("PlaySnd"),",0,&dwThreadId);");
      fprintf(FP_OUTPUT,"%s\n","    timeBeginPeriod(1);  // Set system timer resolution to 1ms");
      fprintf(FP_OUTPUT,"%s\n","       Sleep(1);");
      fprintf(FP_OUTPUT,"%s\n","    timeEndPeriod(1);    // Restore normal resolution");
      fprintf(FP_OUTPUT,"%s\n","    return 0;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  if (Freq!=fabsf(Freq))");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Freq == (-1))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      Freq=0;");
      fprintf(FP_OUTPUT,"%s\n","      SndPmtr[gTarray].Vol=0;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    SndPmtr[gTarray].Freq=fabsf(Freq);");
      fprintf(FP_OUTPUT,"%s\n","    gTsig = TRUE;");
      fprintf(FP_OUTPUT,"%s\n","    while(gSThread != NULL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","    timeBeginPeriod(1);  // Set system timer resolution to 1ms");
      fprintf(FP_OUTPUT,"%s\n","       Sleep(1);");
      fprintf(FP_OUTPUT,"%s\n","    timeEndPeriod(1);    // Restore normal resolution");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    gTexit = gTenter-1;");
      fprintf(FP_OUTPUT,"%s\n","    gTwait = gTenter-1;");
      fprintf(FP_OUTPUT,"%s\n","    gTsig = FALSE;");
      fprintf(FP_OUTPUT,"%s\n","    return PlaySnd();");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
      fprintf(FP_OUTPUT,"%s\n","int PlaySnd (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  soundtype  LocSndPar;");
      fprintf(FP_OUTPUT,"%s\n","  UINT lTarray;");
      fprintf(FP_OUTPUT,"%s\n","  while(gTenter > gTexit && gTsig == FALSE)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    gTwait++;");
      fprintf(FP_OUTPUT,"%s\n","    if (gTwait >= SNDQUE)");
      fprintf(FP_OUTPUT,"%s\n","      lTarray = gTwait % SNDQUE+1;");
      fprintf(FP_OUTPUT,"%s\n","    else");
      fprintf(FP_OUTPUT,"%s\n","      lTarray = gTwait;");
      fprintf(FP_OUTPUT,"%s\n","    LocSndPar = SndPmtr[lTarray];");
      fprintf(FP_OUTPUT,"%s\n","    int L_Note = 0;");
      fprintf(FP_OUTPUT,"%s\n","    int Phrase = 0;");
      fprintf(FP_OUTPUT,"%s\n","    midiOutShortMsg (hMidi,(256 * LocSndPar.Voice) + 192);");
      fprintf(FP_OUTPUT,"%s\n","    L_Note = Round ((log((double) LocSndPar.Freq)- log((double)440.0))/log((double)2)*12+69,0);");
      fprintf(FP_OUTPUT,"%s\n","    Phrase = (LocSndPar.Vol * 256 + L_Note) * 256 + 144;");
      fprintf(FP_OUTPUT,"%s\n","    midiOutShortMsg (hMidi, Phrase);");
      fprintf(FP_OUTPUT,"%s\n","    timeBeginPeriod(1);  // Set system timer resolution to 1ms");
      fprintf(FP_OUTPUT,"%s\n","       Sleep (LocSndPar.Dura * (1/LocSndPar.Tempo + 0.0001f));");
      fprintf(FP_OUTPUT,"%s\n","    timeEndPeriod(1);    // Restore normal resolution");
      fprintf(FP_OUTPUT,"%s\n","    Phrase = (LocSndPar.Vol * 256 + L_Note) * 256 + 128;");
      fprintf(FP_OUTPUT,"%s\n","    midiOutShortMsg (hMidi,Phrase);");
      fprintf(FP_OUTPUT,"%s\n","    gTexit++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  CloseHandle(gSThread);");
      fprintf(FP_OUTPUT,"%s\n","  gSThread = NULL;");
      fprintf(FP_OUTPUT,"%s\n","  return 0;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_OSVersion ){
      fprintf(FP_OUTPUT,"%s\n","int OSVersion (void)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  OSVERSIONINFOEXW  osvi= {0};");
      fprintf(FP_OUTPUT,"%s\n","  osvi.dwOSVersionInfoSize=sizeof(osvi);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","#ifdef __LCC__");
      fprintf(FP_OUTPUT,"%s\n","  FARPROC RtlGetVersion;");
      fprintf(FP_OUTPUT,"%s\n","#define SM_SERVERR2  89");
      fprintf(FP_OUTPUT,"%s\n","#define VER_SUITE_WH_SERVER  32768");
      fprintf(FP_OUTPUT,"%s\n","#define PROCESSOR_ARCHITECTURE_AMD64  9");
      fprintf(FP_OUTPUT,"%s\n","#else");
      fprintf(FP_OUTPUT,"%s\n","  NTSTATUS (WINAPI *RtlGetVersion)(LPOSVERSIONINFOEXW);");
      fprintf(FP_OUTPUT,"%s\n","#endif");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  *(FARPROC*)&RtlGetVersion=GetProcAddress(GetModuleHandle(",enc("ntdll"),"), ",enc("RtlGetVersion"),");");
      fprintf(FP_OUTPUT,"%s\n","  if (RtlGetVersion != NULL)  RtlGetVersion(&osvi);");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  switch (osvi.dwPlatformId)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","  case VER_PLATFORM_WIN32_NT:");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==10 && osvi.dwMinorVersion==0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.dwBuildNumber >= 22000)                       return  OS_Win_11;");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.wProductType == VER_NT_WORKSTATION)           return  OS_Win_10;");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.dwBuildNumber == 17763)                       return  OS_Server_2019;");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.dwBuildNumber >= 20348)                       return  OS_Server_2022;");
      fprintf(FP_OUTPUT,"%s\n","      return  OS_Server_2016;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==6 && osvi.dwMinorVersion==3)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.wProductType == VER_NT_WORKSTATION)           return  OS_Win_81;");
      fprintf(FP_OUTPUT,"%s\n","      return  OS_Server_2012_R2;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==6 && osvi.dwMinorVersion==2)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.wProductType == VER_NT_WORKSTATION)           return  OS_Win_8;");
      fprintf(FP_OUTPUT,"%s\n","      return  OS_Server_2012;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==6 && osvi.dwMinorVersion==1)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.wProductType == VER_NT_WORKSTATION)            return OS_Win_7;");
      fprintf(FP_OUTPUT,"%s\n","      return OS_Server_2008_R2;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==6 && osvi.dwMinorVersion==0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (osvi.wProductType != VER_NT_WORKSTATION)             return OS_Server_2008;");
      fprintf(FP_OUTPUT,"%s\n","      return OS_Vista;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 2)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      int iTestForSM_SERVERR2;");
      fprintf(FP_OUTPUT,"%s\n","      iTestForSM_SERVERR2 = GetSystemMetrics(SM_SERVERR2);");
      fprintf(FP_OUTPUT,"%s\n","      if (iTestForSM_SERVERR2 != 0)                            return OS_Server_2003_R2;");
      fprintf(FP_OUTPUT,"%s\n","      if ((osvi.wSuiteMask & VER_SUITE_WH_SERVER) != 0)        return OS_Home_Server;");
      fprintf(FP_OUTPUT,"%s\n","      if (0 == iTestForSM_SERVERR2)                            return OS_Server_2003;");
      fprintf(FP_OUTPUT,"%s\n","      SYSTEM_INFO siSysInfo;");
      fprintf(FP_OUTPUT,"%s\n","      GetSystemInfo(&siSysInfo);");
      fprintf(FP_OUTPUT,"%s\n","      if ((osvi.wProductType == VER_NT_WORKSTATION) && (siSysInfo.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)) return OS_XP_Pro_x64;");
      fprintf(FP_OUTPUT,"%s\n","      return OSUnknown;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==5 && osvi.dwMinorVersion==1)      return OS_XP;");
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==5 && osvi.dwMinorVersion==0)      return OS_2000;");
      fprintf(FP_OUTPUT,"%s\n","    if (osvi.dwMajorVersion==3 && osvi.dwMinorVersion==51)     return OS_NT3;");
      fprintf(FP_OUTPUT,"%s\n","    return OSUnknown;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  case VER_PLATFORM_WIN32_WINDOWS:");
      fprintf(FP_OUTPUT,"%s\n","    if ((osvi.dwMajorVersion==4 && osvi.dwMinorVersion==90))   return OS_ME;");
      fprintf(FP_OUTPUT,"%s\n","    if ((osvi.dwMajorVersion==4 && osvi.dwMinorVersion==10))   return OS_98;");
      fprintf(FP_OUTPUT,"%s\n","    if ((osvi.dwMajorVersion==4 && osvi.dwMinorVersion==0))    return OS_95;");
      fprintf(FP_OUTPUT,"%s\n","    return OSUnknown;");
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s\n","  case VER_PLATFORM_WIN32s:");
      fprintf(FP_OUTPUT,"%s\n","    return OS_3x;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return OSUnknown;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ContainedIn ){
      fprintf(FP_OUTPUT,"%s\n","int containedin(char *Token, char **Contain, int SensFlag)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int ii=0;");
      fprintf(FP_OUTPUT,"%s\n","  while (Contain[ii][0])");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (0 == ((SensFlag == 0 || SensFlag == 2) ? strcmp(Contain[ii], Token) : bcx_stricmp(Contain[ii], Token)))");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return ((SensFlag < 2) ? 0 : ii);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    ii++;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return -1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_FindInType ){
      fprintf(FP_OUTPUT,"%s\n","int FindInType(PCTSTR Token, PCTSTR StOffset, int StSize, int start, int finish, int c, int *idx)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  int j;");
      fprintf(FP_OUTPUT,"%s\n","  PCTSTR Srch;");
      fprintf(FP_OUTPUT,"%s\n","  int (*cmp)(PCTSTR, PCTSTR);");
      fprintf(FP_OUTPUT,"%s\n","  cmp = ((c == 0 || c == 2) ? strcmp : bcx_stricmp);");
      fprintf(FP_OUTPUT,"%s\n","  for(j=start; j<=finish; j++)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    Srch = StOffset + ((idx==0) ? j*StSize : idx[j]*StSize);");
      fprintf(FP_OUTPUT,"%s\n","    if (cmp(Srch,Token)==0)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      return ((c < 2) ? 0 : j);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","  return -1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_Hscroll||Use_Vscroll ){
      fprintf(FP_OUTPUT,"%s\n","void BCX_Scroll (HWND hWnd, int Msg, int wParam, int lParam, int BCX_LargeChangeX,");
      fprintf(FP_OUTPUT,"%s\n","                 int BCX_LargeChangeY, int BCX_SmallChangeX, int BCX_SmallChangeY,");
      fprintf(FP_OUTPUT,"%s\n","                 int BCX_ViewWidth, int BCX_ViewHeight, int BCX_DynaScrollArg)");
      fprintf(FP_OUTPUT,"%s\n","{");
      fprintf(FP_OUTPUT,"%s\n","  static int oldX;");
      fprintf(FP_OUTPUT,"%s\n","  static int oldY;");
      fprintf(FP_OUTPUT,"%s\n","  static RECT Rc;");
      fprintf(FP_OUTPUT,"%s\n","  for (;;)");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s\n","    if (Msg == WM_VSCROLL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      int yChange;");
      fprintf(FP_OUTPUT,"%s\n","      int yPos;");
      fprintf(FP_OUTPUT,"%s\n","      int LowWp = LOWORD(wParam);");
      fprintf(FP_OUTPUT,"%s\n","      for(;;)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_LINEUP)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          yPos = BCX_siY.nPos-BCX_SmallChangeY;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_LINEDOWN)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          yPos = BCX_siY.nPos+BCX_SmallChangeY;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_PAGEUP)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          yPos = BCX_siY.nPos-BCX_LargeChangeY;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_PAGEDOWN)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          yPos = BCX_siY.nPos+BCX_LargeChangeY;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_THUMBPOSITION)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          yPos = HIWORD(wParam);");
      fprintf(FP_OUTPUT,"%s\n","          if (yPos+(int)BCX_siY.nPage >= (int)BCX_siY.nMax)");
      fprintf(FP_OUTPUT,"%s\n","          {");
      fprintf(FP_OUTPUT,"%s\n","            yPos = BCX_siY.nMax;");
      fprintf(FP_OUTPUT,"%s\n","          }");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          yPos = BCX_siY.nPos;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        break;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      yPos = (int)MAX(0,yPos);");
      fprintf(FP_OUTPUT,"%s\n","      yPos = (int)MIN(BCX_siY.nMax,yPos);");
      fprintf(FP_OUTPUT,"%s\n","      if (yPos == BCX_siY.nPos) return;");
      fprintf(FP_OUTPUT,"%s\n","      yChange = yPos-BCX_siY.nPos;");
      fprintf(FP_OUTPUT,"%s\n","      BCX_siY.nPos = yPos;");
      fprintf(FP_OUTPUT,"%s\n","      ScrollWindowEx(hWnd,0,-yChange,0,0,0,0,SW_SCROLLCHILDREN|SW_ERASE|SW_INVALIDATE);");
      fprintf(FP_OUTPUT,"%s\n","      SetScrollInfo(hWnd,SB_VERT,&BCX_siY,TRUE);");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (Msg == WM_HSCROLL)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      int xChange;");
      fprintf(FP_OUTPUT,"%s\n","      int xPos;");
      fprintf(FP_OUTPUT,"%s\n","      int LowWp = LOWORD(wParam);");
      fprintf(FP_OUTPUT,"%s\n","      for(;;)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_LINELEFT)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          xPos = BCX_siX.nPos-BCX_SmallChangeX;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_LINERIGHT)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          xPos = BCX_siX.nPos+BCX_SmallChangeX;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_PAGEUP)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          xPos = BCX_siX.nPos-BCX_LargeChangeX;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_PAGEDOWN)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          xPos = BCX_siX.nPos+BCX_LargeChangeX;");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (LowWp == SB_THUMBPOSITION)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          xPos = HIWORD(wParam);");
      fprintf(FP_OUTPUT,"%s\n","          if (xPos+(int)BCX_siX.nPage >= (int)BCX_siX.nMax)");
      fprintf(FP_OUTPUT,"%s\n","          {");
      fprintf(FP_OUTPUT,"%s\n","            xPos = BCX_siX.nMax;");
      fprintf(FP_OUTPUT,"%s\n","          }");
      fprintf(FP_OUTPUT,"%s\n","          break;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          xPos = BCX_siX.nPos;");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        break;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","      xPos = (int)MAX(0,xPos);");
      fprintf(FP_OUTPUT,"%s\n","      xPos = (int)MIN(BCX_siX.nMax,xPos);");
      fprintf(FP_OUTPUT,"%s\n","      if (xPos == (int)BCX_siX.nPos) return;");
      fprintf(FP_OUTPUT,"%s\n","      xChange = xPos-BCX_siX.nPos;");
      fprintf(FP_OUTPUT,"%s\n","      BCX_siX.nPos = xPos;");
      fprintf(FP_OUTPUT,"%s\n","      ScrollWindowEx(hWnd,-xChange,0,0,0,0,0,SW_SCROLLCHILDREN|SW_ERASE|SW_INVALIDATE);");
      fprintf(FP_OUTPUT,"%s\n","      SetScrollInfo(hWnd,SB_HORZ,&BCX_siX,TRUE);");
      fprintf(FP_OUTPUT,"%s\n","      break;");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    if (Msg == WM_SIZE)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s\n","      if (BCX_DynaScrollArg)");
      fprintf(FP_OUTPUT,"%s\n","      {");
      fprintf(FP_OUTPUT,"%s\n","        int xNewSize;");
      fprintf(FP_OUTPUT,"%s\n","        int yNewSize = HIWORD(lParam);");
      fprintf(FP_OUTPUT,"%s\n","        int offsetX = 0;");
      fprintf(FP_OUTPUT,"%s\n","        int offsetY = 0;");
      fprintf(FP_OUTPUT,"%s\n","        xNewSize = (GetSystemMetrics(SM_CXFRAME)*2)+(GetSystemMetrics(SM_CXBORDER)*2);");
      fprintf(FP_OUTPUT,"%s\n","        GetWindowRect(hWnd,&Rc);");
      fprintf(FP_OUTPUT,"%s\n","        xNewSize = (Rc.right-Rc.left)-xNewSize-GetSystemMetrics(SM_CXVSCROLL);");
      fprintf(FP_OUTPUT,"%s\n","        if (xNewSize > BCX_ViewWidth-(int)BCX_siX.nPos && (int)BCX_siX.nPos > 0)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          offsetX = (int)MAX(0,(int)MIN(xNewSize-oldX,BCX_siX.nPos));");
      fprintf(FP_OUTPUT,"%s\n","          BCX_siX.nPos = (int)MAX(0,BCX_siX.nPos-offsetX);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (yNewSize > BCX_ViewHeight-(int)BCX_siY.nPos && (int)BCX_siY.nPos > 0)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          offsetY = (int)MAX(0,(int)MIN(yNewSize-oldY,BCX_siY.nPos));");
      fprintf(FP_OUTPUT,"%s\n","          BCX_siY.nPos = (int)MAX(0,BCX_siY.nPos-offsetY);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        if (offsetX || offsetY)");
      fprintf(FP_OUTPUT,"%s\n","        {");
      fprintf(FP_OUTPUT,"%s\n","          ScrollWindowEx(hWnd,offsetX,offsetY,0,0,0,0,SW_SCROLLCHILDREN|SW_ERASE|SW_INVALIDATE);");
      fprintf(FP_OUTPUT,"%s\n","        }");
      fprintf(FP_OUTPUT,"%s\n","        BCX_siX.nMax = (int)MAX(BCX_ViewWidth-xNewSize,0);");
      fprintf(FP_OUTPUT,"%s\n","        BCX_siX.nPage = (int)MAX(BCX_siX.nMax/BCX_LargeChangeX,0);");
      fprintf(FP_OUTPUT,"%s\n","        BCX_siX.nPos = (int)MIN(BCX_siX.nPos,BCX_siX.nMax);");
      fprintf(FP_OUTPUT,"%s\n","        SetScrollInfo(hWnd,SB_HORZ,&BCX_siX,TRUE);");
      fprintf(FP_OUTPUT,"%s\n","        BCX_siY.nMax = (int)MAX(BCX_ViewHeight-yNewSize,0);");
      fprintf(FP_OUTPUT,"%s\n","        BCX_siY.nPage = (int)MAX(BCX_siY.nMax/BCX_LargeChangeY,0);");
      fprintf(FP_OUTPUT,"%s\n","        BCX_siY.nPos = (int)MIN(BCX_siY.nPos,BCX_siY.nMax);");
      fprintf(FP_OUTPUT,"%s\n","        SetScrollInfo(hWnd,SB_VERT,&BCX_siY,TRUE);");
      fprintf(FP_OUTPUT,"%s\n","        oldX = xNewSize;");
      fprintf(FP_OUTPUT,"%s\n","        oldY = yNewSize;");
      fprintf(FP_OUTPUT,"%s\n","      }");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","    break;");
      fprintf(FP_OUTPUT,"%s\n","  }");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_StartupCode ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_StartupCode_(void) {");
      for(int i=1; i<=StartNdx; i++)
        {
          fprintf(FP_OUTPUT,"%s%s%s\n",space(2),StartSub[i],"();");
        }
      fprintf(FP_OUTPUT,"%s\n","  return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_ExitCode ){
      fprintf(FP_OUTPUT,"%s\n","int BCX_ExitCode_(void) {");
      for(int i=1; i<=ExitNdx; i++)
        {
          fprintf(FP_OUTPUT,"%s%s%s\n","  atexit(",ExitSub[i],");");
        }
      fprintf(FP_OUTPUT,"%s\n","  return 1;");
      fprintf(FP_OUTPUT,"%s\n","}\n\n");
    }
  if(Use_GUINoMain||Use_MDIGUINoMain||Use_Wingui ){
      if(Use_BCX_FrameWnd ){
          fprintf(FP_OUTPUT,"%s\n","HWND BCX_FrameWnd (PCTSTR classname, WNDPROC FrameWndProc, PCTSTR caption, HMENU hMenu, int nMenuPos, int X, int Y, int W, int H, int nStyle, int nExStyle)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  HWND  hWnd;");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  BCX_RegWnd (classname,FrameWndProc);");
          fprintf(FP_OUTPUT,"%s\n","  if (nStyle == 0)");
          fprintf(FP_OUTPUT,"%s\n","    nStyle = WS_OVERLAPPEDWINDOW;");
          fprintf(FP_OUTPUT,"%s\n","  hWnd = CreateWindowEx(nExStyle,classname,caption,nStyle,X*BCX_ScaleX,Y*BCX_ScaleY,W*BCX_ScaleX,H*BCX_ScaleY,NULL,(HMENU)(UINT_PTR)hMenu,BCX_hInstance,NULL);");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","    if (hWnd == NULL) return NULL;");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","  SendMessage (hWnd,WM_SETFONT,(WPARAM)DefaultFont,(LPARAM)MAKELPARAM(FALSE,0));");
          fprintf(FP_OUTPUT,"%s\n","  CLIENTCREATESTRUCT ccs={0,1};");
          fprintf(FP_OUTPUT,"%s\n","  //  Find window menu where children will be listed");
          fprintf(FP_OUTPUT,"%s\n","  ccs.hWindowMenu = GetSubMenu (GetMenu(hWnd),nMenuPos-1);");
          fprintf(FP_OUTPUT,"%s\n","  //  Create the MDI client filling the client area");
          fprintf(FP_OUTPUT,"%s%s%s\n","  BCX_hwndMDIClient = CreateWindow(",enc("MDICLIENT"),",NULL, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL,");
          fprintf(FP_OUTPUT,"%s\n","                                     0,0,0,0,hWnd,(HMENU)(UINT_PTR)hMenu,BCX_hInstance,(PVOID)&ccs);");
          fprintf(FP_OUTPUT,"%s\n","  return hWnd;");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_Wnd ){
          fprintf(FP_OUTPUT,"%s\n","HWND BCX_Wnd(PCTSTR classname, WNDPROC wndProc, PCTSTR caption, HWND hParentWnd,int X,int Y,int W,int H,int nStyle,int nExStyle,int nID)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s%s%s\n","  BCX_SetMetric(",enc("pixels"),");");
          fprintf(FP_OUTPUT,"%s\n","  BCX_RegWnd (classname,wndProc);");
          fprintf(FP_OUTPUT,"%s\n","  if (nStyle == 0)");
          fprintf(FP_OUTPUT,"%s\n","    nStyle = WS_OVERLAPPEDWINDOW;");
          fprintf(FP_OUTPUT,"%s\n","  HWND hWnd = CreateWindowEx(nExStyle,classname,caption,nStyle,X*BCX_ScaleX,Y*BCX_ScaleY,");
          fprintf(FP_OUTPUT,"%s\n","                             W*BCX_ScaleX,H*BCX_ScaleY,hParentWnd,(HMENU)(UINT_PTR) nID,BCX_hInstance,NULL);");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","    if (hWnd == NULL) return NULL;");
          fprintf(FP_OUTPUT,"%s\n",SPC);
          fprintf(FP_OUTPUT,"%s\n","  SendMessage(hWnd,WM_SETFONT,(WPARAM)DefaultFont,(LPARAM)MAKELPARAM(FALSE,0));");
          fprintf(FP_OUTPUT,"%s\n","  return hWnd;");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_SetBkGrdBrush ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_SetBkGrdBrush (HWND hWnd, HBRUSH hBrush)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  if (!hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_WndClass.hbrBackground=hBrush;");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    SetClassLongPtr(hWnd,GCLP_HBRBACKGROUND,(LONG_PTR)hBrush);");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_SetClassStyle ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_SetClassStyle (HWND hWnd, long nNewValue)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  if (!hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_WndClass.style=nNewValue;");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    SetClassLongPtr(hWnd,GCL_STYLE,(LONG_PTR)nNewValue);");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_SetIcon ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_SetIcon (HWND hWnd, int nRes)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd == 0)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_WndClass.hIcon = LoadIcon(BCX_hInstance,MAKEINTRESOURCE(nRes));");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    SetClassLongPtr(hWnd,GCLP_HICON,(LONG_PTR)LoadIcon(BCX_hInstance,MAKEINTRESOURCE(nRes)));");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_SetIconSm ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_SetIconSm (HWND hWnd, int nRes)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd == 0)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_WndClass.hIconSm = LoadIcon(BCX_hInstance,MAKEINTRESOURCE(nRes));");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    SetClassLongPtr(hWnd,GCLP_HICONSM,(LONG_PTR)LoadIcon(BCX_hInstance,MAKEINTRESOURCE(nRes)));");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_SetCursor ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_SetCursor (HWND hWnd, PCTSTR cCursor)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd == 0)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_WndClass.hCursor = LoadCursor(BCX_hInstance,cCursor);");
          fprintf(FP_OUTPUT,"%s\n","  if (hWnd)");
          fprintf(FP_OUTPUT,"%s\n","    SetClassLongPtr(hWnd,GCLP_HCURSOR,(LONG_PTR)LoadCursor(BCX_hInstance,cCursor));");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_SetMetric ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_SetMetric (PCTSTR metric)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s%s%s\n","  if (_stricmp(metric,",enc("PIXELS"),")==0)");
          fprintf(FP_OUTPUT,"%s\n","  {");
          fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleX = 1;");
          fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleY = 1;");
          fprintf(FP_OUTPUT,"%s\n","  }");
          fprintf(FP_OUTPUT,"%s%s%s\n","  else if (_stricmp((char*)metric,",enc("DPI"),")==0)");
          fprintf(FP_OUTPUT,"%s\n","  {");
          fprintf(FP_OUTPUT,"%s\n","    HDC  hDc = GetDC(0);");
          fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleX = (GetDeviceCaps(hDc, LOGPIXELSX) / 96);");
          fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleY = (GetDeviceCaps(hDc, LOGPIXELSY) / 96);");
          fprintf(FP_OUTPUT,"%s\n","    ReleaseDC(0, hDc);");
          fprintf(FP_OUTPUT,"%s\n","  }");
          fprintf(FP_OUTPUT,"%s\n","  else");
          fprintf(FP_OUTPUT,"%s\n","  {");
          fprintf(FP_OUTPUT,"%s\n","    RECT  rc = {0,0,4,8};");
          fprintf(FP_OUTPUT,"%s\n","    MapDialogRect(NULL,&rc);");
          fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleX = rc.right/2;");
          fprintf(FP_OUTPUT,"%s\n","    BCX_ScaleY = rc.bottom/4;");
          fprintf(FP_OUTPUT,"%s\n","  }");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_GUINoMain ){
          if(Use_BCX_MsgPump ){
              fprintf(FP_OUTPUT,"%s\n","int BCX_MsgPump (HACCEL Accel)");
              fprintf(FP_OUTPUT,"%s\n","{");
              fprintf(FP_OUTPUT,"%s\n","  MSG  Msg;");
              fprintf(FP_OUTPUT,"%s\n","  if (Accel)");
              fprintf(FP_OUTPUT,"%s\n","  {");
              fprintf(FP_OUTPUT,"%s\n","    while(GetMessage(&Msg,NULL,0,0) > 0)");
              fprintf(FP_OUTPUT,"%s\n","    {");
              fprintf(FP_OUTPUT,"%s\n","      if (!TranslateAccelerator(GetActiveWindow(),Accel,&Msg) && !IsWindow(GetActiveWindow())||!IsDialogMessage(GetActiveWindow(),&Msg))");
              fprintf(FP_OUTPUT,"%s\n","      {");
              fprintf(FP_OUTPUT,"%s\n","        TranslateMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","        DispatchMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","      }");
              fprintf(FP_OUTPUT,"%s\n","    }");
              fprintf(FP_OUTPUT,"%s\n","  }");
              fprintf(FP_OUTPUT,"%s\n","  else");
              fprintf(FP_OUTPUT,"%s\n","  {");
              fprintf(FP_OUTPUT,"%s\n","    while(GetMessage(&Msg,NULL,0,0) > 0)");
              fprintf(FP_OUTPUT,"%s\n","    {");
              fprintf(FP_OUTPUT,"%s\n","      if (!IsWindow(GetActiveWindow())||!IsDialogMessage(GetActiveWindow(),&Msg))");
              fprintf(FP_OUTPUT,"%s\n","      {");
              fprintf(FP_OUTPUT,"%s\n","        TranslateMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","        DispatchMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","      }");
              fprintf(FP_OUTPUT,"%s\n","    }");
              fprintf(FP_OUTPUT,"%s\n","  }");
              fprintf(FP_OUTPUT,"%s\n","  return Msg.wParam;");
              fprintf(FP_OUTPUT,"%s\n","}\n\n");
            }
        }
      if(Use_MDIGUINoMain ){
          if(Use_BCX_MDI_MsgPump ){
              fprintf(FP_OUTPUT,"%s\n","int BCX_MDI_MsgPump (HACCEL  Accel)");
              fprintf(FP_OUTPUT,"%s\n","{");
              fprintf(FP_OUTPUT,"%s\n","  MSG  Msg;");
              fprintf(FP_OUTPUT,"%s\n","  if (Accel)");
              fprintf(FP_OUTPUT,"%s\n","  {");
              fprintf(FP_OUTPUT,"%s\n","    if (!BCX_hwndMDIClient)");
              fprintf(FP_OUTPUT,"%s\n","      return FALSE;");
              fprintf(FP_OUTPUT,"%s\n","    while(GetMessage(&Msg,NULL,0,0) > 0)");
              fprintf(FP_OUTPUT,"%s\n","    {");
              fprintf(FP_OUTPUT,"%s\n","      if (!TranslateMDISysAccel(BCX_hwndMDIClient,&Msg))");
              fprintf(FP_OUTPUT,"%s\n","      {");
              fprintf(FP_OUTPUT,"%s\n","        if (!TranslateAccelerator(GetActiveWindow(),Accel,&Msg))");
              fprintf(FP_OUTPUT,"%s\n","        {");
              fprintf(FP_OUTPUT,"%s\n","          TranslateMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","          DispatchMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","        }");
              fprintf(FP_OUTPUT,"%s\n","      }");
              fprintf(FP_OUTPUT,"%s\n","    }");
              fprintf(FP_OUTPUT,"%s\n","  }");
              fprintf(FP_OUTPUT,"%s\n","  else");
              fprintf(FP_OUTPUT,"%s\n","  {");
              fprintf(FP_OUTPUT,"%s\n","    if (!BCX_hwndMDIClient)");
              fprintf(FP_OUTPUT,"%s\n","      return FALSE;");
              fprintf(FP_OUTPUT,"%s\n","    while(GetMessage(&Msg,NULL,0,0) > 0)");
              fprintf(FP_OUTPUT,"%s\n","    {");
              fprintf(FP_OUTPUT,"%s\n","      if (!TranslateMDISysAccel(BCX_hwndMDIClient,&Msg))");
              fprintf(FP_OUTPUT,"%s\n","       {");
              fprintf(FP_OUTPUT,"%s\n","         TranslateMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","         DispatchMessage(&Msg);");
              fprintf(FP_OUTPUT,"%s\n","       }");
              fprintf(FP_OUTPUT,"%s\n","     }");
              fprintf(FP_OUTPUT,"%s\n","   }");
              fprintf(FP_OUTPUT,"%s\n","  return Msg.wParam;");
              fprintf(FP_OUTPUT,"%s\n","}\n\n");
            }
        }
      if(Use_BCX_RegWnd ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_RegWnd (PCTSTR classname, WNDPROC Form_WndProc)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  if (classname[0] == 0)");
          fprintf(FP_OUTPUT,"%s\n","  {");
          fprintf(FP_OUTPUT,"%s\n","    MessageBox (GetActiveWindow(),");
          fprintf(FP_OUTPUT,"%s%s%s\n","                ",enc("Empty String For BCX_ClassName NOT Allowed"),",");
          fprintf(FP_OUTPUT,"%s%s%s\n","                ",enc("Empty ClassName"),",0);");
          fprintf(FP_OUTPUT,"%s\n","    fflush(stdout);");
          fprintf(FP_OUTPUT,"%s\n","    ExitProcess(1);");
          fprintf(FP_OUTPUT,"%s\n","  }");
          fprintf(FP_OUTPUT,"%s\n","  if (GetClassInfoEx(BCX_hInstance, classname, &BCX_WndClass)!=0)");
          fprintf(FP_OUTPUT,"%s\n","  {");
          fprintf(FP_OUTPUT,"%s\n","    if (!Form_WndProc)");
          fprintf(FP_OUTPUT,"%s\n","      UnregisterClass(classname,BCX_hInstance);");
          fprintf(FP_OUTPUT,"%s\n","    return;");
          fprintf(FP_OUTPUT,"%s\n","  }");
          fprintf(FP_OUTPUT,"%s\n","  if (!BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    BCX_InitGUI();");
          fprintf(FP_OUTPUT,"%s\n","  if (BCX_ScaleX == 0 && BCX_ScaleY == 0)");
          fprintf(FP_OUTPUT,"%s%s%s\n","    BCX_SetMetric(",enc("Pixels"),");");
          fprintf(FP_OUTPUT,"%s\n","  strcpy(BCX_ClassName,classname);");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.lpfnWndProc = Form_WndProc;");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.hInstance = BCX_hInstance;");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.lpszClassName = classname;");
          fprintf(FP_OUTPUT,"%s\n","  RegisterClassEx(&BCX_WndClass);");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
      if(Use_BCX_InitGUI ){
          fprintf(FP_OUTPUT,"%s\n","void BCX_InitGUI (void)");
          fprintf(FP_OUTPUT,"%s\n","{");
          fprintf(FP_OUTPUT,"%s\n","  INITCOMMONCONTROLSEX iccex;");
          fprintf(FP_OUTPUT,"%s\n","  if (BCX_GUI_Init)");
          fprintf(FP_OUTPUT,"%s\n","    return;");
          if(m_iMatchWrd(GUIMetric,"pixels")){
              fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleX = 1;");
              fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleY = 1;");
            }
          else if(m_iMatchWrd(GUIMetric,"dpi")){
              fprintf(FP_OUTPUT,"%s\n","  HDC  hDc = GetDC(0);");
              fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleX = (GetDeviceCaps(hDc, LOGPIXELSX) / 96);");
              fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleY = (GetDeviceCaps(hDc, LOGPIXELSY) / 96);");
              fprintf(FP_OUTPUT,"%s\n","  ReleaseDC(0, hDc);");
            }
          else
            {
              fprintf(FP_OUTPUT,"%s\n","  RECT rc = {0, 0, 4, 8};");
              fprintf(FP_OUTPUT,"%s\n","  MapDialogRect(NULL, &rc);");
              fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleX = rc.right/2;");
              fprintf(FP_OUTPUT,"%s\n","  BCX_ScaleY = rc.bottom/4;");
            }
          fprintf(FP_OUTPUT,"%s\n","  BCX_hInstance = GetModuleHandle(NULL);");
          fprintf(FP_OUTPUT,"%s\n","  BCX_hwndMDIClient = NULL;");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.cbSize = sizeof(BCX_WndClass);");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.style = CS_HREDRAW|CS_VREDRAW|CS_OWNDC|CS_DBLCLKS;");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.cbClsExtra = 0;");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.cbWndExtra = 0;");
          if(ISNULL(GUIIcon)){
              strcpy(GUIIcon," LoadIcon(NULL, IDI_WINLOGO);");
            }
          fprintf(FP_OUTPUT,"%s%s%s\n","  BCX_WndClass.hIcon = ",GUIIcon,";");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.lpszMenuName = NULL;");
          fprintf(FP_OUTPUT,"%s\n","  BCX_WndClass.hIconSm = NULL;");
          fprintf(FP_OUTPUT,"%s\n","  iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);");
          fprintf(FP_OUTPUT,"%s\n","  iccex.dwICC = ICC_LISTVIEW_CLASSES|ICC_TREEVIEW_CLASSES |");
          fprintf(FP_OUTPUT,"%s\n","                ICC_BAR_CLASSES|ICC_TAB_CLASSES|ICC_UPDOWN_CLASS |");
          fprintf(FP_OUTPUT,"%s\n","                ICC_PROGRESS_CLASS|ICC_USEREX_CLASSES|ICC_DATE_CLASSES;");
          fprintf(FP_OUTPUT,"%s\n","  InitCommonControlsEx(&iccex);");
          fprintf(FP_OUTPUT,"%s\n","  OleInitialize(0);");
          fprintf(FP_OUTPUT,"%s\n","  CoInitialize(0);");
          fprintf(FP_OUTPUT,"%s\n","  BCX_GUI_Init = TRUE;");
          fprintf(FP_OUTPUT,"%s\n","}\n\n");
        }
    }
}

void Emit_COM_SupportTypes (FILE* FP_OUTPUT)
{
  char prefix[BCXSTRSIZE];
  strcpy(prefix,"static ");
  if(Use_Project ){
      *prefix=0;
    }
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s\n","//    Global vars used by late binding COM support");
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"PARAM_VARARRAY  COM_param_list;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"_TCHAR          COM_last_ErrMsg[4096];");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"_TCHAR          COM_ErrMsg[64];");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"int             COM_plist_index = 0;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"VARIANT         COM_vt_result;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"HRESULT         COM_last_HR;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"BOOL            COM_ole_initd = FALSE;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"int             COM_objects_cnt = 0;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"int             COM_reset_chain = 0;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"BOOL            COM_BCX_ERROR = FALSE;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"BOOL            COM_bSHOW_ERROR = FALSE;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"SAFEARRAY *     COM_PTR_safearray = NULL;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"PWSTR           COM_PWSTR_temp = NULL;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"char*           COM_psz_tmp = NULL;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"ULONG           COM_wstr_size = 0;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"ULONG           COM_zstr_size = 0;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"BOOL            COM_GetEnum_iface = FALSE;");
  fprintf(FP_OUTPUT,"%s%s %d %s\n",prefix,"int             COM_dispatch_storage[",(int)c_COM_Max_Withs,"];");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"int             COM_dispatch_storage_index = 0;");
  fprintf(FP_OUTPUT,"%s%s\n",prefix,"int             COM_dispatch_at_offset = 0;");
  if(Use_COM_Collections ){
      fprintf(FP_OUTPUT,"%s%s\n",prefix,"VARIANT         COM_ack_var;");
      fprintf(FP_OUTPUT,"%s%s\n",prefix,"IEnumVARIANT*   COM_enum_var = NULL;");
      fprintf(FP_OUTPUT,"%s%s\n",prefix,"ULONG           COM_long_coll = 0;");
    }
}

void Emit_COM_StandardSet (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s\n","//              COM Runtime Functions");
  fprintf(FP_OUTPUT,"%s\n","// *************************************************");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s\n","OBJECT COM (PCTSTR szProgID_) {");
  fprintf(FP_OUTPUT,"%s\n","    static OBJECT oProxy;");
  fprintf(FP_OUTPUT,"%s\n","    BCX_CreateObject ((char*)szProgID_, &oProxy);");
  fprintf(FP_OUTPUT,"%s\n","    return oProxy;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void UNCOM (OBJECT oObj_) {");
  fprintf(FP_OUTPUT,"%s\n","    static OBJECT oProxy;");
  fprintf(FP_OUTPUT,"%s\n","    oProxy = oObj_;");
  fprintf(FP_OUTPUT,"%s\n","    BCX_SetNothing (&oProxy);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","int ISOBJECT (OBJECT Obj) {");
  fprintf(FP_OUTPUT,"%s\n","    if(Obj.pStatus)");
  fprintf(FP_OUTPUT,"%s\n","        return TRUE;");
  fprintf(FP_OUTPUT,"%s\n","   else");
  fprintf(FP_OUTPUT,"%s\n","       return FALSE;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","HRESULT BCX_GET_COM_ERROR_CODE (void) {");
  fprintf(FP_OUTPUT,"%s\n","    return COM_last_HR;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","_TCHAR* BCX_GET_COM_ERROR_DESC (void) {");
  fprintf(FP_OUTPUT,"%s\n","    return COM_last_ErrMsg;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","BOOL BCX_GET_COM_SUCCESS (void) {");
  fprintf(FP_OUTPUT,"%s\n","    return (!COM_BCX_ERROR);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void BCX_SHOW_COM_ERRORS (BOOL Show_err) {");
  fprintf(FP_OUTPUT,"%s\n","    COM_bSHOW_ERROR = Show_err;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","BOOL BCX_GET_COM_STATUS(OBJECT *object) {");
  fprintf(FP_OUTPUT,"%s\n","    if(object)");
  fprintf(FP_OUTPUT,"%s\n","        return object->pStatus;");
  fprintf(FP_OUTPUT,"%s\n","    return 0;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void  COM_clean_plist (void) {");
  fprintf(FP_OUTPUT,"%s\n","int total_parms = COM_plist_index;");
  fprintf(FP_OUTPUT,"%s\n","if (COM_plist_index > 0)");
  fprintf(FP_OUTPUT,"%s\n","   {");
  fprintf(FP_OUTPUT,"%s\n","      do");
  fprintf(FP_OUTPUT,"%s\n","   {");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s%s\n","    sprintf(COM_trace_line, ",enc("+++ clear parameter list. Clear variant at index %d. Variant type = %d"),",COM_plist_index-1,");
      fprintf(FP_OUTPUT,"%s\n","          COM_PARAMS[COM_plist_index-1].vt);");
      fprintf(FP_OUTPUT,"%s\n","    COM_add_trace_line (COM_trace_line);");
    }
  fprintf(FP_OUTPUT,"%s\n","        COM_last_HR = VariantClear (&COM_PARAMS[COM_plist_index-1]);");
  fprintf(FP_OUTPUT,"%s\n","        if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","        {");
  fprintf(FP_OUTPUT,"%s%s%s\n","        wsprintf (COM_ErrMsg, _T(",enc("\\nVariant type = %d, at index %d, total params = %d."),"),");
  fprintf(FP_OUTPUT,"%s\n","                  COM_PARAMS[COM_plist_index-1].vt, COM_plist_index-1, total_parms);");
  fprintf(FP_OUTPUT,"%s%s%s\n","        COM_HR_ErrMsg (COM_last_HR, _T(",enc("Error while cleaning parameter list."),"));");
  fprintf(FP_OUTPUT,"%s\n","      }");
  fprintf(FP_OUTPUT,"%s\n","        COM_plist_index--;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","      while (COM_plist_index > 0);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void  COM_reset_disp_chain (OBJECT *object) {");
  fprintf(FP_OUTPUT,"%s\n","  if (object->ipointer>COM_dispatch_at_offset)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    do");
  fprintf(FP_OUTPUT,"%s\n","    {");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s\n","  sprintf(COM_trace_line, ",enc("Dispath release at index %d. Variant Type = %d"));
      fprintf(FP_OUTPUT,"%s\n","  ,object->ipointer,object->pObjects[object->ipointer].vt);");
      fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line (COM_trace_line);");
    }
  fprintf(FP_OUTPUT,"%s\n","      VariantClear (&object->pObjects[object->ipointer]);");
  fprintf(FP_OUTPUT,"%s\n","      object->ipointer--;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    while (object->ipointer > COM_dispatch_at_offset);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void  COM_ole_uninitialize (void) {");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_objects_cnt)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    _TCHAR ermm[BCXSTRSIZE];");
  fprintf(FP_OUTPUT,"%s%s%s\n","    wsprintf (ermm,_T(",enc("Check SET Nothing statement!\\nUnreleased objects: %d"),"),COM_objects_cnt);");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_MSGBOX (ermm, _T(",enc("Memory leaks detected!"),"),MB_OK|MB_ICONWARNING|MB_TASKMODAL);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  COM_FREE_TEMP_WIDE_STRING();");
  fprintf(FP_OUTPUT,"%s\n","  COM_FREE_TEMP_ANSI_STRING();");
  fprintf(FP_OUTPUT,"%s\n","  CoUninitialize();");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void  COM_get_next_dispatch (OBJECT *object, PWSTR comsegment) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!object->pStatus) return;");
  fprintf(FP_OUTPUT,"%s\n","  if (0 == object->ipointer) COM_BCX_ERROR = FALSE;");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_BCX_ERROR) return;");
  fprintf(FP_OUTPUT,"%s\n","  COM_reset_chain++;");
  fprintf(FP_OUTPUT,"%s\n","  COM_invoke (object, comsegment,COM_PROPS,&object->pObjects[object->ipointer+1]);");
  fprintf(FP_OUTPUT,"%s\n","  COM_reset_chain--;");
  fprintf(FP_OUTPUT,"%s\n","  if (!COM_BCX_ERROR)");
  fprintf(FP_OUTPUT,"%s\n","     object->ipointer++;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_HR_ErrMsg (HRESULT hr, _TCHAR *extra_info) {");
  fprintf(FP_OUTPUT,"%s\n","  COM_BCX_ERROR = TRUE;");
  fprintf(FP_OUTPUT,"%s\n","  PVOID pMsgBuf;");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s\n","  FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,");
  fprintf(FP_OUTPUT,"%s\n","  NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (PTSTR)&pMsgBuf, 0, NULL);");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_last_ErrMsg, _T(",enc("COM error code %d (0x%X)\\n%s\\n%s\\nmember: %s"),"),");
  fprintf(FP_OUTPUT,"%s\n","  hr, hr, extra_info, pMsgBuf, COM_ErrMsg);");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s\n",SPC);
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_trace_add_line(",enc(">>> COM ERROR DUMP >>> COM ERROR DUM >>> COM ERROR DUMP >>>"),");");
      fprintf(FP_OUTPUT,"%s\n","  COM_trace_add_line(COM_last_ErrMsg);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_trace_add_line(",enc("<<< COM ERROR DUMP <<< COM ERROR DUM <<< COM ERROR DUMP <<<"),");");
      fprintf(FP_OUTPUT,"%s\n",SPC);
    }
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s\n","  memset(&COM_ErrMsg,0,sizeof(COM_ErrMsg));");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_bSHOW_ERROR)");
  fprintf(FP_OUTPUT,"%s%s%s\n","      COM_MSGBOX(COM_last_ErrMsg,_T(",enc("COM Parser Error Report:"),"),");
  fprintf(FP_OUTPUT,"%s\n","      MB_OK|MB_ICONERROR|MB_SYSTEMMODAL);");
  fprintf(FP_OUTPUT,"%s\n","  LocalFree(pMsgBuf);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void BCX_SetNothing (OBJECT *obj) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!obj->pStatus) return;");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_trace_add_line (",enc("Called BCX_SetNothing"),");");
    }
  fprintf(FP_OUTPUT,"%s\n","  COM_objects_cnt--;");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    if (obj->p_unknown) obj->p_unknown->Release();");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    if (obj->p_unknown) obj->p_unknown->lpVtbl->Release(obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (obj->ipointer)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    COM_reset_disp_chain (obj);");
  fprintf(FP_OUTPUT,"%s\n","    obj->ipointer = 0;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  COM_last_HR = VariantClear (&obj->pObjects[0]);");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    lstrcpy(COM_ErrMsg, _T(",enc("BCX_SetNothing Failed!"),"));");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR, _T(",enc("Release of IDispatch objs failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  obj->pStatus = FALSE;");
  fprintf(FP_OUTPUT,"%s\n","  Sleep(100);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_ole_initialize (void) {");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_ole_initd) return;");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s%s\n","DeleteFile (",enc("c:\\com_trace.txt"),");");
    }
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __BCX_MULTITHREADED__");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CoInitializeEx (NULL, COINIT_MULTITHREADED);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (SUCCEEDED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    COM_ole_initd = TRUE;");
  fprintf(FP_OUTPUT,"%s\n","    VariantInit (&COM_vt_result);");
  fprintf(FP_OUTPUT,"%s\n","    atexit (COM_ole_uninitialize);");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s\n","    COM_dispatch_storage[0] = 0;");
  fprintf(FP_OUTPUT,"%s\n","    COM_dispatch_storage_index = 0;");
  fprintf(FP_OUTPUT,"%s\n",SPC);
  fprintf(FP_OUTPUT,"%s\n","    if (COM_PWSTR_temp) CoTaskMemFree((void*)COM_PWSTR_temp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_PWSTR_temp = (PWSTR)CoTaskMemAlloc (BCXSTRSIZE);");
  fprintf(FP_OUTPUT,"%s\n","    if (NULL == COM_PWSTR_temp)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      COM_wstr_size = 0;");
  fprintf(FP_OUTPUT,"%s\n","      COM_last_HR =  E_OUTOFMEMORY;");
  fprintf(FP_OUTPUT,"%s\n","      COM_HR_ErrMsg (COM_last_HR,_T(");
  fprintf(FP_OUTPUT,"%s%s%s\n","     ",enc("CoInitializeEx: Memory allocation failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","      return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    COM_wstr_size = BCXSTRSIZE;");
  fprintf(FP_OUTPUT,"%s\n","    if (COM_psz_tmp) free(COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_psz_tmp = (char*)calloc(BCXSTRSIZE, sizeof(char));");
  fprintf(FP_OUTPUT,"%s\n","    if (NULL == COM_psz_tmp)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      COM_last_HR =  E_OUTOFMEMORY;");
  fprintf(FP_OUTPUT,"%s\n","      COM_HR_ErrMsg (COM_last_HR,_T(");
  fprintf(FP_OUTPUT,"%s%s%s\n","     ",enc("CoInitializeEx: Memory allocation failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    COM_zstr_size = BCXSTRSIZE;");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("CoInitializeEx Failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_build_except_info (HRESULT hr, EXCEPINFO *pexcep, UINT uiArgErr) {");
  fprintf(FP_OUTPUT,"%s\n","  SCODE oleSCODE;");
  fprintf(FP_OUTPUT,"%s\n","  static _TCHAR lv_message[BCXSTRSIZE];");
  fprintf(FP_OUTPUT,"%s\n","  oleSCODE = GetScode(hr);");
  fprintf(FP_OUTPUT,"%s\n","  for (;;)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    if (oleSCODE==DISP_E_PARAMNOTFOUND)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      wsprintf (lv_message, _T(",enc("\\nArgument not found, argument %d."),"), uiArgErr);");
  fprintf(FP_OUTPUT,"%s\n","      _tcscat(COM_last_ErrMsg, lv_message);");
  fprintf(FP_OUTPUT,"%s\n","      break;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    if (oleSCODE==DISP_E_TYPEMISMATCH)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      wsprintf (lv_message, _T(",enc("\\nType mismatch, argument %d."),"), uiArgErr);");
  fprintf(FP_OUTPUT,"%s\n","      _tcscat (COM_last_ErrMsg, lv_message);");
  fprintf(FP_OUTPUT,"%s\n","      break;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    if (oleSCODE==DISP_E_BADVARTYPE)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      _tcscat(COM_last_ErrMsg, _T(",enc("\\nOne or more invalid VARIANT arguments."),"));");
  fprintf(FP_OUTPUT,"%s\n","      break;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    if (oleSCODE==E_INVALIDARG)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      _tcscat(COM_last_ErrMsg, _T(",enc("\\nOne of the arguments is invalid."),"));");
  fprintf(FP_OUTPUT,"%s\n","      break;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    break;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (pexcep)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    wsprintf(lv_message, _T(",enc("\\nCOM Error %X:"),"), pexcep->wCode);");
  fprintf(FP_OUTPUT,"%s\n","    if (pexcep->bstrDescription)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      _TCHAR err_desc[512];");
  fprintf(FP_OUTPUT,"%s\n","      #ifndef UNICODE");
  fprintf(FP_OUTPUT,"%s\n","        COM_last_HR = COM_WS2AS (pexcep->bstrDescription);");
  fprintf(FP_OUTPUT,"%s\n","        if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s%s%s\n","          COM_HR_ErrMsg (COM_last_HR,_T(",enc("Get Error Desc: W2A failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","        else");
  fprintf(FP_OUTPUT,"%s%s%s\n","          wsprintf(err_desc, _T(",enc("\\nException desc: %s"),"), COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","      #else");
  fprintf(FP_OUTPUT,"%s%s%s\n","          wsprintf(err_desc, _T(",enc("\\nException desc: %s"),"), pexcep->bstrDescription);");
  fprintf(FP_OUTPUT,"%s\n","      #endif");
  fprintf(FP_OUTPUT,"%s\n","      _tcscat(lv_message, err_desc);");
  fprintf(FP_OUTPUT,"%s\n","      SysFreeString(pexcep->bstrDescription);");
  fprintf(FP_OUTPUT,"%s\n","      pexcep->bstrDescription = NULL;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    if (pexcep->bstrSource)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      _TCHAR err_desc[512];");
  fprintf(FP_OUTPUT,"%s\n","      #ifndef UNICODE");
  fprintf(FP_OUTPUT,"%s\n","        COM_last_HR = COM_WS2AS (pexcep->bstrSource);");
  fprintf(FP_OUTPUT,"%s\n","        if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s%s%s\n","            COM_HR_ErrMsg (COM_last_HR,_T(",enc("Get Error Source Failed! W2A failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","        else");
  fprintf(FP_OUTPUT,"%s%s%s\n","            wsprintf(err_desc, _T(",enc("\\nException source: %s"),"), COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","      #else");
  fprintf(FP_OUTPUT,"%s%s%s\n","            wsprintf(err_desc, _T(",enc("\\nException source: %s"),"), pexcep->bstrSource);");
  fprintf(FP_OUTPUT,"%s\n","      #endif");
  fprintf(FP_OUTPUT,"%s\n","      _tcscat (lv_message, err_desc);");
  fprintf(FP_OUTPUT,"%s\n","      SysFreeString (pexcep->bstrSource);");
  fprintf(FP_OUTPUT,"%s\n","      pexcep->bstrSource = NULL;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    if (pexcep->bstrHelpFile)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      _TCHAR err_desc[512];");
  fprintf(FP_OUTPUT,"%s\n","      #ifndef UNICODE");
  fprintf(FP_OUTPUT,"%s\n","        COM_last_HR = COM_WS2AS (pexcep->bstrHelpFile);");
  fprintf(FP_OUTPUT,"%s\n","        if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s%s%s\n","        COM_HR_ErrMsg (COM_last_HR,_T(",enc("Help File failed: W2A failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","        else");
  fprintf(FP_OUTPUT,"%s\n","        wsprintf(err_desc, _T(");
  fprintf(FP_OUTPUT,"%s%s%s\n","        ",enc("\\nHelp file: %s | topic: %lu"),"), COM_psz_tmp, pexcep->dwHelpContext);");
  fprintf(FP_OUTPUT,"%s\n","      #else");
  fprintf(FP_OUTPUT,"%s\n","        wsprintf(err_desc, _T(");
  fprintf(FP_OUTPUT,"%s%s%s\n","        ",enc("\\nHelp file: %s | topic: %lu"),"), pexcep->bstrHelpFile, pexcep->dwHelpContext);");
  fprintf(FP_OUTPUT,"%s\n","      #endif");
  fprintf(FP_OUTPUT,"%s\n","      _tcscat(lv_message, err_desc);");
  fprintf(FP_OUTPUT,"%s\n","      SysFreeString (pexcep->bstrHelpFile);");
  fprintf(FP_OUTPUT,"%s\n","      pexcep->bstrHelpFile = NULL;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    _tcscat (COM_last_ErrMsg ,lv_message);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_trace_add_line(",enc(">>> COM EXCEPTION DUMP >>> COM EXCEPTION DUMP >>>"),");");
      fprintf(FP_OUTPUT,"%s\n","  COM_trace_add_line(COM_last_ErrMsg);");
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_trace_add_line(",enc("<<< COM EXCEPTION DUMP <<< COM EXCEPTION DUMP <<<"),");");
    }
  fprintf(FP_OUTPUT,"%s\n","  if (COM_bSHOW_ERROR)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_MSGBOX(COM_last_ErrMsg, _T(",enc("COM Parser Exception Info:"),"),");
  fprintf(FP_OUTPUT,"%s\n","    MB_OK|MB_ICONERROR|MB_SYSTEMMODAL);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","DISPID COM_get_dispatch_ID (IDispatch* lpDispatch, PWSTR comsegment) {");
  fprintf(FP_OUTPUT,"%s\n","  static DISPID D_ID;");
  fprintf(FP_OUTPUT,"%s\n","  D_ID = 0;");
  fprintf(FP_OUTPUT,"%s\n","  if (!lpDispatch) return -1;");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = lpDispatch->GetIDsOfNames");
  fprintf(FP_OUTPUT,"%s\n","                 (IID_NULL, &comsegment, 1, LOCALE_SYSTEM_DEFAULT, &D_ID);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = lpDispatch->lpVtbl->GetIDsOfNames");
  fprintf(FP_OUTPUT,"%s\n","                 (lpDispatch, &IID_NULL, &comsegment, 1, LOCALE_SYSTEM_DEFAULT, &D_ID);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("Unrecognized member name"),"));");
  fprintf(FP_OUTPUT,"%s\n","    return -1;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  return D_ID;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_invoke (OBJECT *object, PWSTR comsegment, WORD wFlags, VARIANT *pvResult) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!object->pStatus) return;");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_BCX_ERROR) return;");
  fprintf(FP_OUTPUT,"%s\n","  DISPID lv_DID;");
  fprintf(FP_OUTPUT,"%s\n","  EXCEPINFO exception;");
  fprintf(FP_OUTPUT,"%s\n","  UINT argerr = 0;");
  fprintf(FP_OUTPUT,"%s\n","  DISPPARAMS dp = {NULL, NULL, 0, 0 };");
  fprintf(FP_OUTPUT,"%s\n","  WORD invoke_flags = 0;");
  fprintf(FP_OUTPUT,"%s\n","  DISPID setdispid = DISPID_PROPERTYPUT;");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s\n","  char extra_error_info[BCXSTRSIZE];");
    }
  fprintf(FP_OUTPUT,"%s\n","  if (COM_GetEnum_iface)");
  fprintf(FP_OUTPUT,"%s\n","    lv_DID = DISPID_NEWENUM;");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    lv_DID = COM_get_dispatch_ID (object->pObjects[object->ipointer].pdispVal, comsegment);");
  fprintf(FP_OUTPUT,"%s\n","    if (-1 == lv_DID) goto cleanInProp;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  memset (&exception, 0, sizeof(EXCEPINFO));");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_plist_index>0)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    setdispid = DISPID_PROPERTYPUT;");
  fprintf(FP_OUTPUT,"%s\n","    dp.rgvarg = (VARIANTARG*)COM_PARAMS;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (wFlags & DISPATCH_PROPERTYPUT)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    dp.rgdispidNamedArgs = &setdispid;");
  fprintf(FP_OUTPUT,"%s\n","    dp.cNamedArgs = 1;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  dp.cArgs = COM_plist_index;");
  fprintf(FP_OUTPUT,"%s\n","  invoke_flags = wFlags;");
  fprintf(FP_OUTPUT,"%s\n","  if (wFlags & DISPATCH_PROPERTYGET)");
  fprintf(FP_OUTPUT,"%s\n","    if (pvResult) VariantInit(pvResult);");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s\n","  COM_trace_dump_DISPPARAMS(&dp);");
      fprintf(FP_OUTPUT,"%s\n","  COM_trace_dump_flags(wFlags);");
      fprintf(FP_OUTPUT,"%s\n","  COM_trace_dump_indicators(object);");
    }
  fprintf(FP_OUTPUT,"%s\n","  if (VT_DISPATCH!=object->pObjects[object->ipointer].vt||NULL==object->pObjects[object->ipointer].pdispVal)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","     COM_last_HR = E_NOINTERFACE;");
  fprintf(FP_OUTPUT,"%s%s%s\n","     COM_HR_ErrMsg (COM_last_HR,_T(",enc("COM_invoke::Invalid IDispatch interface."),"));");
  fprintf(FP_OUTPUT,"%s\n","     goto cleanInProp;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","    #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = object->pObjects[object->ipointer].pdispVal");
  fprintf(FP_OUTPUT,"%s\n","     ->Invoke (lv_DID, IID_NULL, LOCALE_SYSTEM_DEFAULT, ");
  fprintf(FP_OUTPUT,"%s\n","        invoke_flags, &dp, pvResult, &exception, &argerr);");
  fprintf(FP_OUTPUT,"%s\n","    #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = object->pObjects[object->ipointer].pdispVal->lpVtbl");
  fprintf(FP_OUTPUT,"%s\n","     ->Invoke(object->pObjects[object->ipointer].pdispVal, lv_DID, &IID_NULL, ");
  fprintf(FP_OUTPUT,"%s\n","        LOCALE_SYSTEM_DEFAULT, invoke_flags , &dp, pvResult, &exception, &argerr);");
  fprintf(FP_OUTPUT,"%s\n","    #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_trace_add_line(",enc("Invoke FAILED!"),");");
    }
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("COM_invoke::Invoke failed."),"));");
  fprintf(FP_OUTPUT,"%s\n","    COM_build_except_info (COM_last_HR, &exception, argerr);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s\n","  else ");
      fprintf(FP_OUTPUT,"%s\n","  {");
      fprintf(FP_OUTPUT,"%s%s%s\n","    COM_add_trace_line (",enc("Invoke SUCEEDED!"),");");
      fprintf(FP_OUTPUT,"%s\n","    if(wFlags & DISPATCH_PROPERTYGET)");
      fprintf(FP_OUTPUT,"%s\n","    {");
      fprintf(FP_OUTPUT,"%s%s%s\n","      sprintf (extra_error_info,",enc("result Variant type = %d"),",pvResult->vt);");
      fprintf(FP_OUTPUT,"%s\n","      COM_add_trace_line (extra_error_info);");
      fprintf(FP_OUTPUT,"%s\n","    }");
      fprintf(FP_OUTPUT,"%s\n","  }");
    }
  fprintf(FP_OUTPUT,"%s\n","cleanInProp:");
  fprintf(FP_OUTPUT,"%s\n","  if (V_ISARRAY(&COM_PARAMS[0]))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    if ((VT_ARRAY|VT_VARIANT)==COM_PARAMS[0].vt)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      COM_last_HR = SafeArrayDestroy(V_ARRAY(&COM_PARAMS[0]));");
  fprintf(FP_OUTPUT,"%s\n","      if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","      {");
  fprintf(FP_OUTPUT,"%s%s%s\n","        lstrcpy(COM_ErrMsg, _T(",enc("SafeArrayDestroy failed"),"));");
  fprintf(FP_OUTPUT,"%s%s%s\n","        COM_HR_ErrMsg (COM_last_HR,_T(",enc("Error wiping param list."),"));");
  fprintf(FP_OUTPUT,"%s\n","      }");
  fprintf(FP_OUTPUT,"%s\n","      ZeroMemory((PVOID)&COM_PARAMS[0],sizeof(VARIANT));");
  fprintf(FP_OUTPUT,"%s\n","      COM_PTR_safearray = NULL;");
  fprintf(FP_OUTPUT,"%s\n","      COM_plist_index = 0;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_plist_index)  COM_clean_plist();");
  fprintf(FP_OUTPUT,"%s\n","  if (0 == COM_reset_chain)  COM_reset_disp_chain(object);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_COM_GetObject (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","void BCX_GetObject (_TCHAR *objname, OBJECT *obj) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!COM_ole_initd) COM_ole_initialize();");
  fprintf(FP_OUTPUT,"%s\n","  CLSID clsid;");
  fprintf(FP_OUTPUT,"%s\n","  #ifndef UNICODE");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = COM_AS2WS (objname);");
  fprintf(FP_OUTPUT,"%s\n","    if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      COM_HR_ErrMsg (COM_last_HR,_T(",enc("CreateObject Failed! A2W failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","      return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = COM_WS2AS (COM_PWSTR_temp);");
  fprintf(FP_OUTPUT,"%s\n","    if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      COM_HR_ErrMsg (COM_last_HR,_T(",enc("CreateObject Failed! W2A failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","      return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s%s%s\n","    sprintf (COM_ErrMsg,",enc("%s, WideName(%s)"),", objname, COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CLSIDFromProgID((LPCOLESTR)COM_PWSTR_temp, (LPCLSID)&clsid);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = COM_WS2AS ((PCWSTR)objname);");
  fprintf(FP_OUTPUT,"%s\n","    lstrcpy (COM_ErrMsg, COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CLSIDFromProgID ((LPCOLESTR)objname, (LPCLSID)&clsid);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","  #ifndef UNICODE");
  fprintf(FP_OUTPUT,"%s\n","    BCX_GetObjectMon ((LPCOLESTR)COM_PWSTR_temp, obj);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    BCX_GetObjectMon ((LPCOLESTR)objname, obj);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = GetActiveObject((REFCLSID)clsid, NULL, (IUnknown**)&obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = GetActiveObject((REFCLSID)&clsid, NULL, (IUnknown**)&obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("GetActiveObject failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    VariantInit (&obj->pObjects[0]);");
  fprintf(FP_OUTPUT,"%s\n","    #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","      COM_last_HR = obj->p_unknown");
  fprintf(FP_OUTPUT,"%s\n","     ->QueryInterface(IID_IDispatch, (void**)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","    #else");
  fprintf(FP_OUTPUT,"%s\n","      COM_last_HR = obj->p_unknown->lpVtbl");
  fprintf(FP_OUTPUT,"%s\n","     ->QueryInterface(obj->p_unknown, &IID_IDispatch, (void **)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","    #endif");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("QueryInterface::IID_IDispatch  failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    if (obj->p_unknown)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","    #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","      obj->p_unknown->Release();");
  fprintf(FP_OUTPUT,"%s\n","    #else");
  fprintf(FP_OUTPUT,"%s\n","      obj->p_unknown->lpVtbl->Release(obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","    #endif");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    obj->pObjects[0].vt = VT_DISPATCH;");
  fprintf(FP_OUTPUT,"%s\n","    obj->pStatus = TRUE;");
  fprintf(FP_OUTPUT,"%s\n","    obj->ipointer = 0;");
  fprintf(FP_OUTPUT,"%s\n","    COM_objects_cnt++;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void BCX_GetObjectMon (LPCOLESTR objname, OBJECT *obj) {");
  fprintf(FP_OUTPUT,"%s\n","  IBindCtx* vBindCtx = NULL;");
  fprintf(FP_OUTPUT,"%s\n","  IMoniker* vMoniker = NULL;");
  fprintf(FP_OUTPUT,"%s\n","  ULONG vChEaten = 0;");
  fprintf(FP_OUTPUT,"%s\n","  COM_last_HR = CreateBindCtx(0, &vBindCtx);");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_last_HR != S_OK)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("GetObject: CreateBindCtx failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  COM_last_HR = MkParseDisplayName(vBindCtx, objname, &vChEaten, &vMoniker);");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_last_HR != S_OK)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("GetObject: Receive Moniker failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    goto CleanGetObjectMon;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  VariantInit(&obj->pObjects[0]);");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = vMoniker->BindToObject(vBindCtx, NULL, IID_IDispatch, ");
  fprintf(FP_OUTPUT,"%s\n","                                        (void **)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = vMoniker->lpVtbl->BindToObject(vMoniker, vBindCtx, NULL, &IID_IDispatch,");
  fprintf(FP_OUTPUT,"%s\n","                                                (void **)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_last_HR != S_OK)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("GetObject: Moniker BindToObject failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    goto CleanGetObjectMon;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  obj->p_unknown = NULL;");
  fprintf(FP_OUTPUT,"%s\n","  obj->pObjects[0].vt = VT_DISPATCH;");
  fprintf(FP_OUTPUT,"%s\n","  obj->pStatus = TRUE;");
  fprintf(FP_OUTPUT,"%s\n","  obj->ipointer = 0;");
  fprintf(FP_OUTPUT,"%s\n","  COM_objects_cnt++;");
  fprintf(FP_OUTPUT,"%s\n","CleanGetObjectMon:");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    if (vMoniker) vMoniker->Release();");
  fprintf(FP_OUTPUT,"%s\n","    if (vBindCtx) vBindCtx->Release();");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    if (vMoniker) vMoniker->lpVtbl->Release (vMoniker);");
  fprintf(FP_OUTPUT,"%s\n","    if (vBindCtx) vBindCtx->lpVtbl->Release (vBindCtx);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_COM_DispatchObject (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","void BCX_DispatchObject(IUnknown *iobj, OBJECT *obj, BOOL b_release) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!obj) return;");
  fprintf(FP_OUTPUT,"%s\n","  static ULONG inc_inf_ussage=0;");
  fprintf(FP_OUTPUT,"%s\n","  if (!COM_ole_initd) COM_ole_initialize();");
  fprintf(FP_OUTPUT,"%s\n","  obj->p_unknown = iobj;");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    inc_inf_ussage = obj->p_unknown->AddRef();");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    inc_inf_ussage = obj->p_unknown->lpVtbl->AddRef(obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  VariantInit(&obj->pObjects[0]);");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = obj->p_unknown");
  fprintf(FP_OUTPUT,"%s\n","   ->QueryInterface(IID_IDispatch, (void**)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = obj->p_unknown->lpVtbl");
  fprintf(FP_OUTPUT,"%s\n","   ->QueryInterface(obj->p_unknown, &IID_IDispatch,");
  fprintf(FP_OUTPUT,"%s\n","     (void**)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("QueryInterface::IID_IDispatch  failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","      obj->p_unknown->Release();");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","      obj->p_unknown->lpVtbl->Release(obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (b_release)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","     iobj->Release();");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","     iobj->lpVtbl->Release(obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  obj->pObjects[0].vt = VT_DISPATCH;");
  fprintf(FP_OUTPUT,"%s\n","  obj->pStatus = TRUE;");
  fprintf(FP_OUTPUT,"%s\n","  obj->ipointer = 0;");
  fprintf(FP_OUTPUT,"%s\n","  COM_objects_cnt++;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_COM_GetProperty (FILE* FP_OUTPUT)
{
  UNREFERENCED_PARAMETER(FP_OUTPUT);
}

void Emit_COM_SetProperty (FILE* FP_OUTPUT)
{
  UNREFERENCED_PARAMETER(FP_OUTPUT);
}

void Emit_COM_InvokeMethod (FILE* FP_OUTPUT)
{
  UNREFERENCED_PARAMETER(FP_OUTPUT);
}

void Emit_COM_SafeArray (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","void COM_create_safearray(void) {");
  fprintf(FP_OUTPUT,"%s\n","  long lv_param_incr = 0;");
  fprintf(FP_OUTPUT,"%s\n","  long lv_param_incr_rev = 0;");
  fprintf(FP_OUTPUT,"%s\n","  HRESULT hr = NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","  COM_PTR_safearray = ");
  fprintf(FP_OUTPUT,"%s\n","  SafeArrayCreateVector (VT_VARIANT,0,COM_plist_index);");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_PTR_safearray == NULL)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    COM_clean_plist();");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = E_OUTOFMEMORY;");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("SafeArrayCreate failed."),"));");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  for (lv_param_incr = COM_plist_index-1; lv_param_incr>=0; lv_param_incr-=1)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    hr = SafeArrayPutElement (COM_PTR_safearray,");
  fprintf(FP_OUTPUT,"%s\n","    &lv_param_incr, &COM_PARAMS[lv_param_incr_rev]);");
  fprintf(FP_OUTPUT,"%s\n","    if (FAILED(hr))");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      wsprintf(COM_ErrMsg, _T(",enc("Param Index = %d."),"),lv_param_incr);");
  fprintf(FP_OUTPUT,"%s\n","      if (COM_PTR_safearray) SafeArrayDestroy (COM_PTR_safearray);");
  fprintf(FP_OUTPUT,"%s\n","      COM_PTR_safearray = NULL;");
  fprintf(FP_OUTPUT,"%s\n","      COM_clean_plist();");
  fprintf(FP_OUTPUT,"%s\n","      COM_last_HR = hr;");
  fprintf(FP_OUTPUT,"%s%s%s\n","      COM_HR_ErrMsg (COM_last_HR,_T(",enc("SafeArrayPutElement failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","      return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    lv_param_incr_rev++;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  if(COM_build_trace_code ){
      fprintf(FP_OUTPUT,"%s%s%s\n","  COM_add_trace_line(",enc("SafeArray created. Cleaning temp variants..."),");");
    }
  fprintf(FP_OUTPUT,"%s\n","  COM_clean_plist();");
  fprintf(FP_OUTPUT,"%s\n","  if(COM_PTR_safearray)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","     VariantInit (&COM_PARAMS[0]);");
  fprintf(FP_OUTPUT,"%s\n","     COM_PARAMS[0].vt = VT_ARRAY|VT_VARIANT;");
  fprintf(FP_OUTPUT,"%s\n","     V_ARRAY (&COM_PARAMS[0]) = COM_PTR_safearray;");
  fprintf(FP_OUTPUT,"%s\n","     COM_plist_index = 1;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_COM_UsesConversion (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","HRESULT COM_WS2AS(PCWSTR wide_string, UINT code_page) {");
  fprintf(FP_OUTPUT,"%s\n","  if (wide_string==NULL) return (HRESULT) NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","  ULONG bytes_copied=0;");
  fprintf(FP_OUTPUT,"%s\n","  ULONG temp_ansi_len = (ULONG)WideCharToMultiByte (");
  fprintf(FP_OUTPUT,"%s\n","  code_page,0,wide_string,-1,COM_psz_tmp,0,NULL,NULL);");
  fprintf(FP_OUTPUT,"%s\n","  if (temp_ansi_len == 0) return (HRESULT) NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_zstr_size < temp_ansi_len)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    if (COM_psz_tmp) free(COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_psz_tmp = (char*)calloc(temp_ansi_len+1,sizeof(char));");
  fprintf(FP_OUTPUT,"%s\n","    if (NULL == COM_psz_tmp)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      COM_zstr_size = 0;");
  fprintf(FP_OUTPUT,"%s\n","      return E_OUTOFMEMORY;");
  fprintf(FP_OUTPUT,"%s\n","    } ");
  fprintf(FP_OUTPUT,"%s\n","    COM_zstr_size = temp_ansi_len;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if ((bytes_copied = WideCharToMultiByte(code_page, 0, wide_string, -1,");
  fprintf(FP_OUTPUT,"%s\n","       COM_psz_tmp, temp_ansi_len,NULL, NULL))==0)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    return HRESULT_FROM_WIN32 (GetLastError());");
  fprintf(FP_OUTPUT,"%s\n","  } ");
  fprintf(FP_OUTPUT,"%s\n","  COM_psz_tmp [bytes_copied] = '\\0';");
  fprintf(FP_OUTPUT,"%s\n","  return (HRESULT)NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","HRESULT COM_AS2WS(PCSTR ansi_string, UINT code_page) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!*ansi_string) return (HRESULT)NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","  ULONG ansi_str_len = (ULONG)strlen (ansi_string);");
  fprintf(FP_OUTPUT,"%s\n","  if (!ansi_str_len) return (HRESULT)NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","  ULONG wide_str_len = (ansi_str_len * 2);");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_wstr_size < wide_str_len)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    if (COM_PWSTR_temp)");
  fprintf(FP_OUTPUT,"%s\n","       CoTaskMemFree((void*)COM_PWSTR_temp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_PWSTR_temp = (PWSTR)CoTaskMemAlloc (wide_str_len);");
  fprintf(FP_OUTPUT,"%s\n","    if (NULL == COM_PWSTR_temp)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      COM_wstr_size = 0;");
  fprintf(FP_OUTPUT,"%s\n","      return E_OUTOFMEMORY;");
  fprintf(FP_OUTPUT,"%s\n","    } ");
  fprintf(FP_OUTPUT,"%s\n","    COM_wstr_size = wide_str_len;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (MultiByteToWideChar (code_page, MB_PRECOMPOSED, ansi_string, ");
  fprintf(FP_OUTPUT,"%s\n","      ansi_str_len, COM_PWSTR_temp, wide_str_len)==0)");
  fprintf(FP_OUTPUT,"%s\n","         return HRESULT_FROM_WIN32(GetLastError());");
  fprintf(FP_OUTPUT,"%s\n","  COM_PWSTR_temp[ansi_str_len] = L'\\0';");
  fprintf(FP_OUTPUT,"%s\n","  return (HRESULT)NO_ERROR;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_FREE_TEMP_WIDE_STRING(void) {");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_PWSTR_temp)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    CoTaskMemFree ((void*)COM_PWSTR_temp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_PWSTR_temp = NULL;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_FREE_TEMP_ANSI_STRING (void) {");
  fprintf(FP_OUTPUT,"%s\n","  if (COM_psz_tmp)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    free (COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_psz_tmp = NULL;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}");
}

void Emit_COM_TraceCalls (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","void bcx_com_trace_dump_DISPPARAMS(DISPPARAMS* dp) {");
  fprintf(FP_OUTPUT,"%s%s%s\n","  COM_add_trace_line(",enc("   --- BEGIN DUMP OF DISPPARAMS  ---"),");");
  fprintf(FP_OUTPUT,"%s\n","  if (!dp)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_add_trace_line(",enc("*** bcx_com_trace_dump_DISPPARAMS failed!"),");");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_add_trace_line(",enc("*** NULL argument received for DISPPARAMS* dp"),");");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_add_trace_line(",enc("   --- END DUMP OF DISPPARAMS ---"),");");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("     DISPPARAMS.rgvarg = %lu  // pointer to array of arguments."),", dp->rgvarg);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("     DISPPARAMS.rgdispidNamedArgs = %lu // pointer to array of Dispatch IDs of named arguments."),", dp->rgdispidNamedArgs);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("     DISPPARAMS.cArgs = %d // Number of arguments."),", dp->cArgs);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("     DISPPARAMS.cNamedArgs = %d  // Number of named arguments"),", dp->cNamedArgs);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  COM_add_trace_line(",enc("   --- END DUMP OF DISPPARAMS ---"),");");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void bcx_com_trace_dump_indicators(OBJECT *object) {");
  fprintf(FP_OUTPUT,"%s%s%s\n","  COM_add_trace_line(",enc("*** start dump of global vars ***"),");");
  fprintf(FP_OUTPUT,"%s\n","  if (object->pStatus)");
  fprintf(FP_OUTPUT,"%s%s%s\n","     strcpy(COM_trace_line, ",enc("   Object status - Initialized"),");");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s%s%s\n","     strcpy(COM_trace_line, ",enc("   Object status - UnInitialized"),");");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("   dispatch chain index = %d"),", object->ipointer);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("   Count of params = %d"),", COM_plist_index);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("   COM_ole_initd = %d"),", COM_ole_initd);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("   COM_objects_cnt = %d"),", COM_objects_cnt);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("   don't reset dispatch chain afer invoke = %d"),", COM_reset_chain);");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s%s%s\n","  COM_add_trace_line(",enc("*** end dump of global vars ***"),");");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void bcx_com_trace_dump_flags(WORD wFlags) {");
  fprintf(FP_OUTPUT,"%s%s%s\n","  wsprintf(COM_trace_line, ",enc("calling invoke with flags: "),");");
  fprintf(FP_OUTPUT,"%s%s%s\n","  if(wFlags & DISPATCH_PROPERTYPUT) strcat(COM_trace_line,",enc("| DISPATCH_PROPERTYPUT "),");");
  fprintf(FP_OUTPUT,"%s%s%s\n","  if(wFlags & DISPATCH_PROPERTYGET) strcat(COM_trace_line,",enc("| DISPATCH_PROPERTYGET "),");");
  fprintf(FP_OUTPUT,"%s%s%s\n","  if(wFlags & DISPATCH_PROPERTYPUTREF) strcat(COM_trace_line,",enc("| DISPATCH_PROPERTYPUTREF "),");");
  fprintf(FP_OUTPUT,"%s%s%s\n","  if(wFlags & DISPATCH_METHOD) strcat(COM_trace_line,",enc("| DISPATCH_METHOD "),");");
  fprintf(FP_OUTPUT,"%s\n","  COM_add_trace_line(COM_trace_line);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void COM_add_trace_line(PCTSTR trcline) {");
  fprintf(FP_OUTPUT,"%s\n","  static FILE *com_trc_file;");
  fprintf(FP_OUTPUT,"%s%s%s%s%s\n","  if((com_trc_file=fopen(",enc("c:\\com_trace.txt"),",",enc("a"),"))==0)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    fprintf(stderr,",enc("Error: File access or File not found. c:\\com_trace.txt\\n"),");");
  fprintf(FP_OUTPUT,"%s\n","    exit(1);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s%s%s\n","  fprintf(com_trc_file,",enc("%s\\n"),", trcline);");
  fprintf(FP_OUTPUT,"%s\n","  if (com_trc_file)");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    fflush(com_trc_file);");
  fprintf(FP_OUTPUT,"%s\n","    fclose(com_trc_file);");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_BCX_SafeArray (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","HRESULT InitSafeArray (SAFEARRAY **ppsa, VARTYPE vtype, UINT ndim, ...) {");
  fprintf(FP_OUTPUT,"%s\n","  int iCNT;");
  fprintf(FP_OUTPUT,"%s\n","  int iDIM;");
  fprintf(FP_OUTPUT,"%s\n","  va_list  marker;");
  fprintf(FP_OUTPUT,"%s\n","  SAFEARRAYBOUND  tArraySize[10];");
  fprintf(FP_OUTPUT,"%s\n","  va_start(marker,ndim);");
  fprintf(FP_OUTPUT,"%s\n","  iCNT = 0;");
  fprintf(FP_OUTPUT,"%s\n","  iDIM = ndim;");
  fprintf(FP_OUTPUT,"%s\n","  while(iDIM--)");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s\n","      tArraySize[iCNT].lLbound = va_arg(marker,long);");
  fprintf(FP_OUTPUT,"%s\n","      tArraySize[iCNT].cElements = va_arg(marker,long);");
  fprintf(FP_OUTPUT,"%s\n","      iCNT++;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","  *ppsa = SafeArrayCreate (vtype,ndim,tArraySize);");
  fprintf(FP_OUTPUT,"%s\n","  if(*ppsa == NULL)");
  fprintf(FP_OUTPUT,"%s\n","      return E_OUTOFMEMORY;");
  fprintf(FP_OUTPUT,"%s\n","  return S_OK;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","HRESULT DestroySafeArray(SAFEARRAY *psA) {");
  fprintf(FP_OUTPUT,"%s\n","  return SafeArrayDestroy(psA);");
  fprintf(FP_OUTPUT,"%s\n","}\n");
}

void Emit_COM_CreateObject (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","void BCX_CreateObject (_TCHAR *objname, OBJECT *obj) {");
  fprintf(FP_OUTPUT,"%s\n","  if (!COM_ole_initd) COM_ole_initialize();");
  fprintf(FP_OUTPUT,"%s\n","  CLSID clsid;");
  fprintf(FP_OUTPUT,"%s\n","  #ifndef UNICODE");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = COM_AS2WS(objname);");
  fprintf(FP_OUTPUT,"%s\n","    if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","      COM_HR_ErrMsg (COM_last_HR,_T(",enc("CreateObject Failed! A2W failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","      return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = COM_WS2AS(COM_PWSTR_temp);");
  fprintf(FP_OUTPUT,"%s\n","    if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","    {");
  fprintf(FP_OUTPUT,"%s%s%s\n","       COM_HR_ErrMsg (COM_last_HR,_T(",enc("CreateObject Failed! W2A failure!"),"));");
  fprintf(FP_OUTPUT,"%s\n","      return;");
  fprintf(FP_OUTPUT,"%s\n","    }");
  fprintf(FP_OUTPUT,"%s%s%s\n","    sprintf(COM_ErrMsg,",enc("%s, WideName(%s)"),", objname, COM_psz_tmp);");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CLSIDFromProgID ((LPCOLESTR)COM_PWSTR_temp, (LPCLSID)&clsid);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    lstrcpy(COM_ErrMsg, objname);");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CLSIDFromProgID ((LPCOLESTR)objname, (LPCLSID)&clsid);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("CLSIDFromProgID failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    return;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CoCreateInstance((REFCLSID)clsid, NULL,  ");
  fprintf(FP_OUTPUT,"%s\n","    CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, IID_IUnknown, (void **)&obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = CoCreateInstance ((REFCLSID)&clsid, NULL, ");
  fprintf(FP_OUTPUT,"%s\n","    CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER,&IID_IUnknown, (void **)&obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED (COM_last_HR))");
  fprintf(FP_OUTPUT,"%s%s%s\n","     COM_HR_ErrMsg (COM_last_HR,_T(",enc("CoCreateInstance failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    VariantInit(&obj->pObjects[0]);");
  fprintf(FP_OUTPUT,"%s\n","    obj->pObjects[0].vt = VT_DISPATCH;");
  fprintf(FP_OUTPUT,"%s\n","  #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = obj->p_unknown");
  fprintf(FP_OUTPUT,"%s\n","   ->QueryInterface(IID_IDispatch, (void **)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","  #else");
  fprintf(FP_OUTPUT,"%s\n","    COM_last_HR = obj->p_unknown->lpVtbl");
  fprintf(FP_OUTPUT,"%s\n","   ->QueryInterface(obj->p_unknown, &IID_IDispatch, (void**)&obj->pObjects[0].pdispVal);");
  fprintf(FP_OUTPUT,"%s\n","  #endif");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  if (FAILED(COM_last_HR))");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s%s%s\n","    COM_HR_ErrMsg (COM_last_HR,_T(",enc("QueryInterface::IID_IDispatch  failed!"),"));");
  fprintf(FP_OUTPUT,"%s\n","    obj->pObjects[0].vt = VT_NULL;");
  fprintf(FP_OUTPUT,"%s\n","    VariantClear(&obj->pObjects[0]);");
  fprintf(FP_OUTPUT,"%s\n","    #ifdef __cplusplus");
  fprintf(FP_OUTPUT,"%s\n","       obj->p_unknown->Release();");
  fprintf(FP_OUTPUT,"%s\n","    #else");
  fprintf(FP_OUTPUT,"%s\n","       obj->p_unknown->lpVtbl->Release(obj->p_unknown);");
  fprintf(FP_OUTPUT,"%s\n","    #endif");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","  else");
  fprintf(FP_OUTPUT,"%s\n","  {");
  fprintf(FP_OUTPUT,"%s\n","    obj->pStatus = TRUE;");
  fprintf(FP_OUTPUT,"%s\n","    obj->ipointer = 0;");
  fprintf(FP_OUTPUT,"%s\n","    COM_objects_cnt++;");
  fprintf(FP_OUTPUT,"%s\n","  }");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_VBScript_Support ()
{
  static int nTimes=0;
  if(nTimes>0 ){
      return;
    }
  nTimes++;
  Use_AnsiToWide=Use_WideToAnsi=Use_BcxTempStr=TRUE;
  fprintf(FP_HDR,"%s\n","");
  fprintf(FP_HDR,"%s\n","// ****************************************");
  fprintf(FP_HDR,"%s%s%s\n","// ***** ",c_BCX_STR_VBS_STRUCTS,"  *****");
  fprintf(FP_HDR,"%s\n","// ****************************************");
  fprintf(FP_HDR,"%s\n","");
  fprintf(FP_HDR,"%s\n","const GUID IID_IScriptControl =");
  fprintf(FP_HDR,"%s\n","{");
  fprintf(FP_HDR,"%s\n","   0x0e59f1d3,0x1fbe,0x11d0,");
  fprintf(FP_HDR,"%s\n","  {0x8f,0xf2,0x00,0xa0,0xd1,0x00,0x38,0xbc}");
  fprintf(FP_HDR,"%s\n","};");
  fprintf(FP_HDR,"%s\n","");
  fprintf(FP_HDR,"%s\n","enum ScriptControlStates");
  fprintf(FP_HDR,"%s\n","{");
  fprintf(FP_HDR,"%s\n","  SCRIPTSTATE_UNINITIALIZED0, SCRIPTSTATE_STARTED1, SCRIPTSTATE_CONNECTED2,");
  fprintf(FP_HDR,"%s\n","  SCRIPTSTATE_DISCONNECTED3, SCRIPTSTATE_CLOSED4, SCRIPTSTATE_INITIALIZED5");
  fprintf(FP_HDR,"%s\n","};");
  fprintf(FP_HDR,"%s\n","");
  fprintf(FP_HDR,"%s\n","const GUID IID_IScriptError =");
  fprintf(FP_HDR,"%s\n","{");
  fprintf(FP_HDR,"%s\n","   0x70841C78, 0x67D, 0x11D0,");
  fprintf(FP_HDR,"%s\n","  {0x95, 0xD8, 0x0, 0xA0, 0x24, 0x63, 0xAB, 0x28}");
  fprintf(FP_HDR,"%s\n","};");
  fprintf(FP_HDR,"%s\n","");
  fprintf(FP_HDR,"%s\n","// *******************************************************************");
  fprintf(FP_HDR,"%s\n","#undef  INTERFACE");
  fprintf(FP_HDR,"%s\n","#define INTERFACE IScriptError");
  fprintf(FP_HDR,"%s\n","// *******************************************************************");
  fprintf(FP_HDR,"%s\n","DECLARE_INTERFACE_(IScriptError, IDispatch) {");
  fprintf(FP_HDR,"%s\n","STDMETHOD (QueryInterface)(THIS_ REFIID riid, PVOID *ppvObj) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD_(ULONG, AddRef)(THIS)  PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD_(ULONG, Release)(THIS) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (GetTypeInfoCount)(THIS_ UINT *pctinfo) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (GetTypeInfo)(THIS_ UINT itinfo, LCID lcid,");
  fprintf(FP_HDR,"%s\n","ITypeInfo **pptinfo) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (GetIDsOfNames)(THIS_ REFIID riid, OLECHAR **rgszNames,");
  fprintf(FP_HDR,"%s\n","           UINT cNames, LCID lcid, DISPID *rgdispid) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Invoke)(THIS_ DISPID dispidMember, REFIID riid, LCID lcid,");
  fprintf(FP_HDR,"%s\n","           WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult,");
  fprintf(FP_HDR,"%s\n","           EXCEPINFO *pexcepinfo, UINT *puArgErr) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_Number)(THIS_ long *pNumber) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_Source)(THIS_ BSTR *pbstrSource) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_Description)(THIS_ BSTR *pbstrDescription) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_HelpFile)(THIS_ BSTR *pbstrHelpFile) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_HelpContext)(THIS_ long *pHelpContext) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_Text)(THIS_ BSTR *pbstrText) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_Line)(THIS_ long *pLine) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Get_Column)(THIS_ long *pColumn) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Clear)(THIS) PURE;};");
  fprintf(FP_HDR,"%s\n","");
  fprintf(FP_HDR,"%s\n","// *******************************************************************");
  fprintf(FP_HDR,"%s\n","#undef  INTERFACE");
  fprintf(FP_HDR,"%s\n","#define INTERFACE IScriptControl");
  fprintf(FP_HDR,"%s\n","// *******************************************************************");
  fprintf(FP_HDR,"%s\n","DECLARE_INTERFACE_(IScriptControl, IDispatch) {");
  fprintf(FP_HDR,"%s\n","STDMETHOD (QueryInterface)(THIS_ REFIID riid, PVOID *ppvObj) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD_(ULONG, AddRef)(THIS)  PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD_(ULONG, Release)(THIS) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (GetTypeInfoCount)(THIS_ UINT *pctinfo) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (GetTypeInfo)(THIS_ UINT itinfo, LCID lcid,");
  fprintf(FP_HDR,"%s\n","ITypeInfo  **pptinfo) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (GetIDsOfNames)(THIS_ REFIID riid, OLECHAR **rgszNames,");
  fprintf(FP_HDR,"%s\n","           UINT cNames, LCID lcid, DISPID *rgdispid) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Invoke)(THIS_ DISPID dispidMember, REFIID riid, LCID lcid,");
  fprintf(FP_HDR,"%s\n","           WORD wFlags, DISPPARAMS *pdispparams, VARIANT *pvarResult,");
  fprintf(FP_HDR,"%s\n","           EXCEPINFO *pexcepinfo, UINT *puArgErr) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_Language)(THIS_ BSTR* pbstrLanguage) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (put_Language)(THIS_ BSTR pbstrLanguage) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_State)(THIS_ enum ScriptControlStates* pssState) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (put_State)(THIS_ enum ScriptControlStates pssState) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (put_SitehWnd)(THIS_ long phwnd) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_SitehWnd)(THIS_ long* phwnd) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_Timeout)(THIS_ long* plMilliseconds) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (put_Timeout)(THIS_ long plMilliseconds) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_AllowUI)(THIS_ VARIANT_BOOL* pfAllowUI) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (put_AllowUI)(THIS_ VARIANT_BOOL pfAllowUI) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_UseSafeSubset)(THIS_ VARIANT_BOOL* pfUseSafeSubset) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (put_UseSafeSubset)(THIS_ VARIANT_BOOL pfUseSafeSubset) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_Modules)(THIS_ interface");
  fprintf(FP_HDR,"%s\n","           IScriptModuleCollection** ppmods) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_Error)(THIS_ interface IScriptError** ppse) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_CodeObject)(THIS_ IDispatch** ppdispObject) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (get_Procedures)(THIS_ interface");
  fprintf(FP_HDR,"%s\n","           IScriptProcedureCollection** ppdispProcedures) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (_AboutBox)(THIS) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (AddObject)(THIS_ BSTR Name, IDispatch* Object,");
  fprintf(FP_HDR,"%s\n","           VARIANT_BOOL AddMembers) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Reset)(THIS) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (AddCode)(THIS_ BSTR Code) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Eval)(THIS_ BSTR Expression, VARIANT* pvarResult) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (ExecuteStatement)(THIS_ BSTR Statement) PURE;");
  fprintf(FP_HDR,"%s\n","STDMETHOD (Run)(THIS_ BSTR ProcedureName, SAFEARRAY** Parameters,");
  fprintf(FP_HDR,"%s\n","           VARIANT* pvarResult) PURE;};");
  fprintf(FP_HDR,"%s\n","");
  if(Use_Project ){
      fprintf(FP_HDR,"%s\n","BOOL OLE_ERROR_S;");
      fprintf(FP_HDR,"%s\n","IScriptControl *pSC;");
    }
  else
    {
      fprintf(FP_HDR,"%s\n","static BOOL OLE_ERROR_S;");
      fprintf(FP_HDR,"%s\n","static IScriptControl *pSC;");
    }
  AddLibrary("ole32.lib");
  AddLibrary("oleaut32.lib");
}

void Emit_Optimize (char* Str1,char* Str2,PCTSTR  Str3)
{
  if(OptimizerEnabled ){
      fprintf(FP_WRITE,"%s\n","#if defined (__POCC__) && !defined(__cplusplus)");
      fprintf(FP_WRITE,"%s%s%s%s\n","  #pragma optimize(",Str1,")",Str3);
      fprintf(FP_WRITE,"%s\n","#elif !defined (__cplusplus)");
      fprintf(FP_WRITE,"%s%s%s%s\n","  #pragma optimize(",Str2,")",Str3);
      fprintf(FP_WRITE,"%s\n","#endif");
    }
}

void Emit_InputCode ()
{
  char Frmat[BCXSTRSIZE]={0};
  char Arg[BCXSTRSIZE]={0};
  char szWrk[BCXSTRSIZE]={0};
  int TestType={0};
  int iThisToken=2;
  if(DataType(Stk[iThisToken])==vt_STRLIT ){
      if(strcmp(Stk[iThisToken+1],",")==0){
          fprintf(FP_WRITE,"%s%s%s%s",Scoot,"printf(",No_Sigil(Stk[iThisToken]),"), ");
        }
      else
        {
          fprintf(FP_WRITE,"%s%s%s%s%s%s",Scoot,"printf(",enc("%s? "),",",No_Sigil(Stk[iThisToken]),"), ");
        }
      iThisToken=4;
    }
  for(int i=1; i<=Ndx; i++)
    {
      if(Im_UDT_String(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"$"));
        }
      if(Im_UDT_Single(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"!"));
        }
      if(Im_UDT_Double(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
      TestType=CheckType(Stk[i]);
      if(TestType==vt_STRVAR ){
          strcpy(Stk[i], join(2,Stk[i],"$"));
        }
      if(TestType==vt_SINGLE ){
          strcpy(Stk[i], join(2,Stk[i],"!"));
        }
      if(TestType==vt_DOUBLE ){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
      if(TestType==vt_LDOUBLE ){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
    }
  BuildStr(iThisToken,Ndx,szWrk);
  FastLexer(szWrk,"",",");
  CommonInputCode(Frmat,Arg);
  Use_KBinput=Use_Scan=TRUE;
  fprintf(FP_WRITE,"%s%s",Scoot,"KBinput(),");
  fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"ScanError=scan(InputBuffer,",enc(Frmat),Arg,");");
}

void Emit_FileInputCode ()
{
  char Arg[BCXSTRSIZE]={0};
  char Frmat[BCXSTRSIZE]={0};
  char szWrk[BCXSTRSIZE]={0};
  int iThisToken={0};
  char FHandle[BCXSTRSIZE]={0};
  InputBufferFlags();
  for(int Tmp=2; Tmp<=Ndx; Tmp++)
    {
      if(*Stk[Tmp]==35 ){
          strcpy(Stk[Tmp],RemoveStr(Stk[Tmp],"#"));
        }
    }
  if(DataType(Stk[2])==vt_NUMBER ){
      strcpy(Stk[2], join(2,"FP",Stk[2]));
    }
  iThisToken=4;
  for(int j=2; j<=Ndx; j++)
    {
      if(*Stk[j]==44 ){
          iThisToken=j+1;
          goto L1608;
        }
      strcat(FHandle,Stk[j]);
    }
L1608:;
  for(int i=1; i<=Ndx; i++)
    {
      if(Im_UDT_String(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"$"));
        }
      if(Im_UDT_Single(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"!"));
        }
      if(Im_UDT_Double(Stk[i])){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
      if(CheckType(Stk[i])==vt_STRVAR ){
          strcpy(Stk[i], join(2,Stk[i],"$"));
        }
      if(CheckType(Stk[i])==vt_SINGLE ){
          strcpy(Stk[i], join(2,Stk[i],"!"));
        }
      if(CheckType(Stk[i])==vt_DOUBLE ){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
      if(CheckType(Stk[i])==vt_LDOUBLE ){
          strcpy(Stk[i], join(2,Stk[i],"#"));
        }
    }
  BuildStr(iThisToken,Ndx,szWrk);
  FastLexer(szWrk,"",",");
  CommonInputCode(Frmat,Arg);
  fprintf(FP_WRITE,"%s%s%s\n","fgets(InputBuffer, 0x100000, ",FHandle,");");
  fprintf(FP_WRITE,"%s%s%s%s\n",Scoot,"InputBuffer[strcspn(InputBuffer, ",enc("\\r\\n"),")] = 0;");
  fprintf(FP_WRITE,"%s%s%s%s%s\n",Scoot,"ScanError = scan(InputBuffer,",enc(Frmat),Arg,");");
  fprintf(FP_WRITE,"%s%s\n",Scoot,"*InputBuffer=0;");
}

void Emit_OSVersionEnum ()
{
  static int BeenHereDoneThat;
  if(BeenHereDoneThat==TRUE ){
      return;
    }
  BeenHereDoneThat=TRUE;
  fprintf(FP_ENU,"%s\n","");
  fprintf(FP_ENU,"%s\n","enum");
  fprintf(FP_ENU,"%s\n","{");
  fprintf(FP_ENU,"%s\n","   OSUnknown = -2,");
  fprintf(FP_ENU,"%s\n","   OSError = -1,");
  fprintf(FP_ENU,"%s\n","   OS_3x,");
  fprintf(FP_ENU,"%s\n","   OS_95,");
  fprintf(FP_ENU,"%s\n","   OS_98,");
  fprintf(FP_ENU,"%s\n","   OS_ME,");
  fprintf(FP_ENU,"%s\n","   OS_NT3,");
  fprintf(FP_ENU,"%s\n","   OS_2000,");
  fprintf(FP_ENU,"%s\n","   OS_XP,");
  fprintf(FP_ENU,"%s\n","   OS_XP_Pro_x64,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2003,");
  fprintf(FP_ENU,"%s\n","   OS_Home_Server,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2003_R2,");
  fprintf(FP_ENU,"%s\n","   OS_Vista,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2008,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2008_R2,");
  fprintf(FP_ENU,"%s\n","   OS_Win_7,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2012,");
  fprintf(FP_ENU,"%s\n","   OS_Win_8,");
  fprintf(FP_ENU,"%s\n","   OS_Win_81,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2012_R2,");
  fprintf(FP_ENU,"%s\n","   OS_Win_10,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2016,");
  fprintf(FP_ENU,"%s\n","   OS_Win_11,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2019,");
  fprintf(FP_ENU,"%s\n","   OS_Server_2022");
  fprintf(FP_ENU,"%s\n","};");
  fprintf(FP_ENU,"%s\n","");
}

void Emit_MDI_MsgPump ()
{
  if((int)strlen(Accelerator)){
      fprintf(FP_WRITE,"%s\n","if(!BCX_hwndMDIClient)");
      fprintf(FP_WRITE,"%s\n","   {");
      fprintf(FP_WRITE,"%s\n","      return FALSE;");
      fprintf(FP_WRITE,"%s\n","   }");
      fprintf(FP_WRITE,"%s\n","   while((GetMessage(&Msg,NULL,0,0)))");
      fprintf(FP_WRITE,"%s\n","     {");
      fprintf(FP_WRITE,"%s\n","       HWND hActiveWindow=GetActiveWindow();");
      fprintf(FP_WRITE,"%s\n","       if((!TranslateMDISysAccel(BCX_hwndMDIClient,&Msg)))");
      fprintf(FP_WRITE,"%s\n","         {");
      fprintf(FP_WRITE,"%s%s%s\n","           if((!TranslateAccelerator(hActiveWindow,",Accelerator,",&Msg)))");
      fprintf(FP_WRITE,"%s\n","             {");
      fprintf(FP_WRITE,"%s\n","               TranslateMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","               DispatchMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","             }");
      fprintf(FP_WRITE,"%s\n","         }");
      fprintf(FP_WRITE,"%s\n","     }");
      fprintf(FP_WRITE,"%s\n","  return Msg.wParam;");
      fprintf(FP_WRITE,"%s\n","}\n");
    }
  else
    {
      fprintf(FP_WRITE,"%s\n"," if(!BCX_hwndMDIClient)");
      fprintf(FP_WRITE,"%s\n"," {");
      fprintf(FP_WRITE,"%s\n","   return FALSE;");
      fprintf(FP_WRITE,"%s\n"," }");
      fprintf(FP_WRITE,"%s\n"," while((GetMessage(&Msg,NULL,0,0)))");
      fprintf(FP_WRITE,"%s\n","   {");
      fprintf(FP_WRITE,"%s\n","   if((!TranslateMDISysAccel(BCX_hwndMDIClient,&Msg)))");
      fprintf(FP_WRITE,"%s\n","     {");
      fprintf(FP_WRITE,"%s\n","       TranslateMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","       DispatchMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","     }");
      fprintf(FP_WRITE,"%s\n","   }");
      fprintf(FP_WRITE,"%s\n","return Msg.wParam;");
      fprintf(FP_WRITE,"%s\n","}\n");
    }
}

void Emit_GUI_MsgPump ()
{
  if((int)strlen(Accelerator)){
      fprintf(FP_WRITE,"%s\n"," while(GetMessage(&Msg,NULL,0,0))");
      fprintf(FP_WRITE,"%s\n","   {");
      fprintf(FP_WRITE,"%s\n","    HWND hActiveWindow = GetActiveWindow();");
      fprintf(FP_WRITE,"%s%s%s\n","    if(!TranslateAccelerator(hActiveWindow,",Accelerator,",&Msg) &&");
      fprintf(FP_WRITE,"%s\n","       ((!IsDialogMessage(hActiveWindow,&Msg)) || (!IsWindow(hActiveWindow))))");
      fprintf(FP_WRITE,"%s\n","      {");
      fprintf(FP_WRITE,"%s\n","        TranslateMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","        DispatchMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","      }");
      fprintf(FP_WRITE,"%s\n","   }");
      fprintf(FP_WRITE,"%s\n"," return Msg.wParam;");
      fprintf(FP_WRITE,"%s\n","}\n");
    }
  else
    {
      fprintf(FP_WRITE,"%s\n"," while(GetMessage(&Msg,NULL,0,0))");
      fprintf(FP_WRITE,"%s\n","   {");
      fprintf(FP_WRITE,"%s\n","    HWND hActiveWindow = GetActiveWindow();");
      fprintf(FP_WRITE,"%s\n","    if((!IsWindow(hActiveWindow)) || (!IsDialogMessage(hActiveWindow,&Msg)))");
      fprintf(FP_WRITE,"%s\n","      {");
      fprintf(FP_WRITE,"%s\n","        TranslateMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","        DispatchMessage(&Msg);");
      fprintf(FP_WRITE,"%s\n","      }");
      fprintf(FP_WRITE,"%s\n","    }");
      fprintf(FP_WRITE,"%s\n"," return Msg.wParam;");
      fprintf(FP_WRITE,"%s\n","}\n");
    }
}

void Emit_WinGUIMain (char* classname,char* metric,char* icon)
{
  fprintf(FP_WRITE,"%s\n","");
  fprintf(FP_WRITE,"%s\n","int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,PSTR CmdLine,int CmdShow) {");
  fprintf(FP_WRITE,"%s\n","   MSG  Msg;");
  fprintf(FP_WRITE,"%s%s%s\n","   strcpy(BCX_ClassName,",classname,");");
  fprintf(FP_WRITE,"%s%s%s\n","   BCX_SetMetric(",enc(metric),");");
  fprintf(FP_WRITE,"%s\n","   BCX_InitGUI();");
  fprintf(FP_WRITE,"%s\n","   BCX_hInstance       =  hInst;");
  fprintf(FP_WRITE,"%s%s\n","   BCX_WndClass.hIcon  = ",icon);
  fprintf(FP_WRITE,"%s\n","   BCX_RegWnd(BCX_ClassName, WndProc);");
  fprintf(FP_WRITE,"%s\n","");
  fprintf(FP_WRITE,"%s\n","   // ******************************************");
  fprintf(FP_WRITE,"%s\n","                     FormLoad();");
  fprintf(FP_WRITE,"%s\n","   // ******************************************");
}

void Emit_MDICode (FILE* FP_OUTPUT)
{
  fprintf(FP_OUTPUT,"%s\n","HWND BCX_MDICHILD (PCTSTR title, PCTSTR MdiClassName,int x,int y,int cx,int cy,ULONG style,LPARAM lParam) {");
  fprintf(FP_OUTPUT,"%s\n","   HWND  hwndChild;");
  fprintf(FP_OUTPUT,"%s%s\n","   char rgch","[BCXSTRSIZE]={0};");
  fprintf(FP_OUTPUT,"%s\n","   static int cUntitled=1;");
  fprintf(FP_OUTPUT,"%s\n","   if(title[0]==0)");
  fprintf(FP_OUTPUT,"%s\n","      {");
  fprintf(FP_OUTPUT,"%s%s%s%s%s\n","        sprintf(rgch,",enc("%s%i"),",",enc("Untitled"),",cUntitled++);");
  fprintf(FP_OUTPUT,"%s\n","      }");
  fprintf(FP_OUTPUT,"%s\n","    else");
  fprintf(FP_OUTPUT,"%s\n","      {");
  fprintf(FP_OUTPUT,"%s\n","        strcpy(rgch,title);");
  fprintf(FP_OUTPUT,"%s\n","      }");
  fprintf(FP_OUTPUT,"%s\n","  //  Create the MDI child window");
  fprintf(FP_OUTPUT,"%s\n","    hwndChild = CreateMDIWindow(MdiClassName, rgch, style, x, y,");
  fprintf(FP_OUTPUT,"%s\n","                cx, cy, BCX_hwndMDIClient, BCX_hInstance, lParam);");
  fprintf(FP_OUTPUT,"%s\n","return hwndChild;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","void BCX_MDICLASS (WNDPROC MCWP, PCHAR ClassName) {");
  fprintf(FP_OUTPUT,"%s\n","   WNDCLASS wc={0};");
  fprintf(FP_OUTPUT,"%s\n","   wc.style=0;");
  fprintf(FP_OUTPUT,"%s\n","   wc.lpfnWndProc=(WNDPROC)MCWP;");
  fprintf(FP_OUTPUT,"%s\n","   wc.cbClsExtra=0;");
  fprintf(FP_OUTPUT,"%s\n","   wc.cbWndExtra=20;");
  fprintf(FP_OUTPUT,"%s\n","   wc.hInstance=BCX_hInstance;");
  fprintf(FP_OUTPUT,"%s%s\n","   wc.hIcon= ",GUIIcon);
  fprintf(FP_OUTPUT,"%s\n","   wc.hCursor=LoadCursor(NULL,IDC_ARROW);");
  fprintf(FP_OUTPUT,"%s\n","   wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);");
  fprintf(FP_OUTPUT,"%s\n","   wc.lpszMenuName=NULL;");
  fprintf(FP_OUTPUT,"%s\n","   wc.lpszClassName=ClassName;");
  fprintf(FP_OUTPUT,"%s\n","   RegisterClass((LPWNDCLASS)&wc);");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
  fprintf(FP_OUTPUT,"%s\n","HWND BCX_MDICLIENT (HWND hwndparent, int icount) {");
  fprintf(FP_OUTPUT,"%s\n","   CLIENTCREATESTRUCT ccs={0,1};");
  fprintf(FP_OUTPUT,"%s\n","   //  Find window menu where children will be listed");
  fprintf(FP_OUTPUT,"%s\n","   ccs.hWindowMenu=GetSubMenu(GetMenu(hwndparent),icount-1);");
  fprintf(FP_OUTPUT,"%s\n","   //  Create the MDI client filling the client area");
  fprintf(FP_OUTPUT,"%s%s%s\n","   BCX_hwndMDIClient=CreateWindow(",enc("MDICLIENT"),",NULL, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL,");
  fprintf(FP_OUTPUT,"%s\n","                                  0,0,0,0,hwndparent,(HMENU)(UINT_PTR)NULL,BCX_hInstance,(PVOID)&ccs);");
  fprintf(FP_OUTPUT,"%s\n","   return BCX_hwndMDIClient;");
  fprintf(FP_OUTPUT,"%s\n","}\n\n");
}

void Emit_ProjectSupport ()
{
  int nPos1={0};
  int nPos2={0};
  char sExt[BCXSTRSIZE]={0};
  char cHFn[BCXSTRSIZE]={0};
  int iWork={0};
  char Tmp[BCXSTRSIZE]={0};
  if(Exist(FileOut)){
      _fcloseall();
      if(ISNULL(CmdLineFileOut)){
          strcpy(Project_Path,curdir());
        }
      else
        {
          strcpy(Project_Path,mid(CmdLineFileOut,1,InstrRev(CmdLineFileOut,vchr(1,92),0)-1));
        }
      if(inchr(command(1),vchr(1,92))){
          strcpy(cHFn,mid(command(1),InstrRev(command(1),vchr(1,92),0)+1));
        }
      else
        {
          strcpy(cHFn,command(1));
        }
      if(inchr(cHFn,".")){
          strcpy(cHFn,mid(cHFn,1,InstrRev(cHFn,".",0)-1));
        }
      strcpy(HFile, join(4,Project_Path,vchr(1,92),cHFn,".bh"));
      if((PJ1=fopen(FileOut, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", FileOut); exit(1);
       }
      if((PJ2=fopen(HFile, "w"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", HFile); exit(1);
       }
      fprintf(PJ2,"%s%s%s\n","#ifndef __BCX_HEADER_",ucase(cHFn),"__");
      iWork=eDoNothing;
      while(!EoF(PJ1)){
          Tmp[0]=0;
          fgets(Tmp, 2048 , PJ1);
            if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
              {
               Tmp[strcspn(Tmp,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Tmp);
                exit(1);
              }
          if(LeftStr(Tmp,"// *")){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              continue;
            }
          if(Tmp[0]==0 ){
              continue;
            }
          if(LeftStr(trim(Tmp),"//")){
              continue;
            }
          if(instr(Tmp,c_BCX_STR_SYS_VARS)){
              iWork=eStartSysVariables;
            }
          else if(instr(Tmp,c_BCX_STR_USR_VARS)){
              iWork=eStartUserVariables;
            }
          else if(instr(Tmp,c_BCX_STR_STD_MACROS)){
              iWork=eStartMacros;
            }
          else if(instr(Tmp,c_BCX_STR_STD_PROTOS)){
              iWork=eStartStdProtos;
            }
          else if(instr(Tmp,c_BCX_STR_USR_PROTOS)){
              iWork=eStartUserProtos;
            }
          else if(instr(Tmp,c_BCX_STR_USR_CONST)){
              iWork=eStartUserConst;
            }
          else if(instr(Tmp,c_BCX_STR_SYS_CONST)){
              iWork=eStartSysConst;
            }
          else if(instr(Tmp,c_BCX_STR_MAIN_PROG)){
              iWork=eDoMainProgram;
            }
          else if(instr(Tmp,c_BCX_STR_USR_PROCS)){
              iWork=eDoUserProcs;
            }
          else if(instr(Tmp,c_BCX_STR_USR_TYPES)){
              iWork=eStartUserTypes;
            }
          if(iWork==eDoMainProgram||iWork==eDoUserProcs ){
              continue;
            }
          if(iWork==eStartSysVariables ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_SYS_VARS);
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s\n","");
              iWork=eDoSysVariables;
              goto L1611;
            }
          if(iWork==eDoSysVariables ){
              if(!(strcmp(left(Tmp,6),"static")==0)){
                  if(inchr(Tmp,"=")){
                      nPos1=inchr(Tmp,"=");
                      nPos2=inchr(Tmp,";");
                      strcpy(sExt,mid(Tmp,nPos1,nPos2-nPos1));
                      strcpy(Tmp,RemoveStr(Tmp,sExt));
                    }
                  fprintf(PJ2,"%s%s\n","extern ",Tmp);
                }
              goto L1611;
            }
          if(iWork==eStartUserVariables ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_USR_VARS);
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s\n","");
              iWork=eDoUserVariables;
              goto L1611;
            }
          if(iWork==eDoUserVariables ){
              if(*trim(Tmp)==35 ){
                  fprintf(PJ2,"%s\n",Tmp);
                }
              else
                {
                  if(inchr(Tmp,"=")){
                      nPos1=inchr(Tmp,"=");
                      nPos2=inchr(Tmp,";");
                      strcpy(sExt,mid(Tmp,nPos1,nPos2-nPos1));
                      strcpy(Tmp,RemoveStr(Tmp,sExt));
                    }
                  if(LeftStr(Tmp,"extern")==FALSE ){
                      fprintf(PJ2,"%s%s\n","extern ",Tmp);
                    }
                  else
                    {
                      fprintf(PJ2,"%s\n",Tmp);
                    }
                }
              goto L1611;
            }
          if(iWork==eStartMacros ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_STD_MACROS);
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s\n","");
              iWork=eDoMacros;
              goto L1611;
            }
          if(iWork==eStartStdProtos ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_STD_PROTOS);
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s\n","");
              iWork=eDoStdProtos;
              goto L1611;
            }
          if(iWork==eDoStdProtos ){
              PCHAR  p;
              while(inchr(Tmp,"=")){
                  nPos1=inchr(Tmp,"=");
                  p=Tmp;
                  p=p+nPos1-1;
                  for(;;)
                    {
                      if(*p!=44&&*p!=(UCHAR)*(SPC)&&*p!=41 ){
                          *p=1;
                        }
                      else
                        {
                          goto L1613;
                        }
                      p++;
                    }
L1613:;
                  strcpy(Tmp,RemoveStr(Tmp,vchr(1,1)));
                }
              if(ISFALSE(LeftStr(Tmp,"extern"))){
                  fprintf(PJ2,"%s%s\n","extern ",Tmp);
                }
              else
                {
                  fprintf(PJ2,"%s\n",Tmp);
                }
              goto L1611;
            }
          if(iWork==eStartUserProtos ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_USR_PROTOS);
              fprintf(PJ2,"%s\n","// *****************\n");
              iWork=eDoUserProtos;
              goto L1611;
            }
          if(iWork==eDoUserProtos ){
              if(ISTRUE(iMatchNQ(Tmp," main"))||ISTRUE(iMatchNQ(Tmp," WinMain"))){
                  goto L1611;
                }
              if(*Tmp==(UCHAR)*(SPC)){
                  goto L1611;
                }
              fprintf(PJ2,"%s%s\n","extern ",Tmp);
              goto L1611;
            }
          if(iWork==eStartUserConst ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_USR_CONST);
              fprintf(PJ2,"%s\n","// *****************\n");
              iWork=eDoUserConst;
              goto L1611;
            }
          if(iWork==eStartSysConst ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_SYS_CONST);
              fprintf(PJ2,"%s\n","// *****************\n");
              iWork=eDoSysConst;
              goto L1611;
            }
          if(iWork==eStartUserTypes ){
              Tmp[0]=0;
              fgets(Tmp, 2048 , PJ1);
                if(feof(PJ1) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(PJ1));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              fprintf(PJ2,"%s\n","// *****************");
              fprintf(PJ2,"%s%s\n","// ",c_BCX_STR_USR_TYPES);
              fprintf(PJ2,"%s\n","// *****************\n");
              iWork=eDoUserTypes;
              goto L1611;
            }
          if(iWork==eDoUserTypes||iWork==eDoUserConst||iWork==eDoSysConst||iWork==eDoMacros ){
              fprintf(PJ2,"%s\n",Tmp);
            }

L1611:;

        }
      fprintf(PJ2,"%s%s%s\n","#endif // __BCX_HEADER_",ucase(cHFn),"__");
      if(PJ1)
       {
         fclose(PJ1);
         PJ1=NULL;
       }
      if(PJ2)
       {
         fclose(PJ2);
         PJ2=NULL;
       }
    }
}

void Emit_Libs ()
{
  static int IWasHere;
  static int nCount;
  char LTmp[BCXSTRSIZE]={0};
  if(IWasHere ){
      return;
    }
  IWasHere++;
  if(*Library[0]==0 ){
      return;
    }
  if(NO_LIBS==FALSE ){
        {
        int  i;
        for(i=0; i<c_MaxLib && NOTNULL(Library[i]); i++)
          {
            strcpy(LTmp,Library[i]);
            RemoveAll(LTmp,join(2,"<>",DQ));
            if(instr(RmLibs,LTmp)){
                continue;
              }
            if(nCount==0 ){
                nCount++;
                fprintf(FP_HDR,"%s\n","");
                fprintf(FP_HDR,"%s\n","// *************************************************");
                fprintf(FP_HDR,"%s\n","// Instruct Linker to Search Object/Import Libraries");
                fprintf(FP_HDR,"%s\n","// *************************************************");
                fprintf(FP_HDR,"%s\n","");
                fprintf(FP_HDR,"%s\n","#if !defined(__GNUC__) && !defined(__TINYC__)");
                fprintf(FP_HDR,"%s\n","   #if !(defined(__BCPLUSPLUS__) && defined(_WIN64))");
                if(UseCpp==FALSE ){
                    fprintf(FP_HDR,"%s\n","      #if !defined(__LCC__)");
                  }
              }
            fprintf(FP_HDR,"%s%s%s\n","    #pragma comment(lib,",enc(LTmp),")");
          }
          }
      if(UseCpp==FALSE ){
          fprintf(FP_HDR,"%s\n","  #else");
          strcat(RmLibs,",<libc.lib>,<kernel32.lib>,<comdlg32.lib>,<user32.lib>,");
          strcat(RmLibs,"<gdi32.lib>,<advapi32.lib>,<comctl32.lib>,<crtdll.lib>,<Msimg32.lib>");
            {
            int  i;
            for(i=0; i<c_MaxLib && NOTNULL(Library[i]); i++)
              {
                if(instr(RmLibs,Library[i])){
                    continue;
                  }
                if(nCount==0 ){
                    nCount++;
                    fprintf(FP_HDR,"%s\n","  #if !defined(__LCC__)");
                  }
                fprintf(FP_HDR,"%s%s\n","    #pragma lib ",Library[i]);
              }
              }
        }
      if(NOTZERO(nCount)){
          if(ISFALSE UseCpp ){
              fprintf(FP_HDR,"%s\n","     #endif");
            }
          fprintf(FP_HDR,"%s\n","  #endif");
          fprintf(FP_HDR,"%s\n","#endif");
        }
    }
}

void Emit_ResourceFile ()
{
  char Tmp[BCXSTRSIZE]={0};
  if(Use_Resource&&!Use_GenResFile ){
      if(NOTNULL(UserResFile)){
          strcpy(Res_File,UserResFile);
        }
    }
  if(Use_GenResFile ){
      CombineRes=FALSE;
      if(Exist(UserResFile)){
          CombineRes=TRUE;
        }
      strcpy(gTmpStr, join(2,extract(ucase(FileOut),"."),"__.rc"));
      strcpy(Res_File,gTmpStr);
      if((ResIn=fopen(resFile, "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", resFile); exit(1);
       }
      if((ResOut=fopen(gTmpStr, "w"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", gTmpStr); exit(1);
       }
      fprintf(ResOut,"%s\n","//  BCX Generated Resource File");
      fprintf(ResOut,"%s%s%s%s\n","//  Date: ",date()," Time: ",timef());
      fprintf(ResOut,"%s\n","");
      fprintf(ResOut,"%s\n","#include <windows.h>");
      fprintf(ResOut,"%s\n","");
      if(CombineRes ){
          if((UserResIn=fopen(UserResFile, "rb"))==0)
           {
          fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", UserResFile); exit(1);
           }
          fprintf(ResOut,"%s\n","// User's *.rc file listing");
          fprintf(ResOut,"%s\n","");
          while(!EoF(UserResIn)){
              Tmp[0]=0;
              fgets(Tmp, 2048 , UserResIn);
                if(feof(UserResIn) || (Tmp[strlen(Tmp)-1]==10))
                  {
                   Tmp[strcspn(Tmp,"\r\n")] = 0;
                  }
                 else
                  {
                    printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(UserResIn));
                    printf("%s\n","The actual truncated line of text:");
                    printf("%s",Tmp);
                    exit(1);
                  }
              if(instr(Tmp,"windows.h",1,1)>0 ){
                  *Tmp=0;
                }
              fprintf(ResOut,"%s\n",Tmp);
            }
        }
      fprintf(ResOut,"%s\n","");
      fprintf(ResOut,"%s\n","// BCX generated *.rc file listing");
      fprintf(ResOut,"%s\n","");
      while(!EoF(ResIn)){
          Tmp[0]=0;
          fgets(Tmp, 2048 , ResIn);
            if(feof(ResIn) || (Tmp[strlen(Tmp)-1]==10))
              {
               Tmp[strcspn(Tmp,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(ResIn));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Tmp);
                exit(1);
              }
          if(instr(Tmp,"include",1,1)>0 ){
              fprintf(ResOut,"%s\n","");
            }
          fprintf(ResOut,"%s\n",Tmp);
        }
      if(ResOut)
       {
         fclose(ResOut);
         ResOut=NULL;
       }
      if(ResIn)
       {
         fclose(ResIn);
         ResIn=NULL;
       }
      if(CombineRes ){
          if(UserResIn)
           {
             fclose(UserResIn);
             UserResIn=NULL;
           }
        }
    }
  if(Exist(resFile)){
      DeleteFile ((resFile));
    }
}

void SetUsed ()
{
  int  i;
  int  x;
  for(i=2; i<=Ndx; i++)
    {
      strcpy(HFiles[HFileCnt], join(5,"#include ",DQ,extract(Stk[i],"."),".h",DQ));
      if(c_MaxHFiles==++HFileCnt ){
          Abort("Maximum number of INCLUDE files exceeded.");
        }
      if((FPUSE=fopen(Stk[i], "rb"))==0)
       {
      fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", Stk[i]); exit(1);
       }
      while(!EoF(FPUSE)){
          Src[0]=0;
          fgets(Src, 2048 , FPUSE);
            if(feof(FPUSE) || (Src[strlen(Src)-1]==10))
              {
               Src[strcspn(Src,"\r\n")] = 0;
              }
             else
              {
                printf("%s%d while reading file: %s\n","Error! - LINE INPUT truncation detected at PROGRAM line: ",__LINE__-7, NamePathFromFP(FPUSE));
                printf("%s\n","The actual truncated line of text:");
                printf("%s",Src);
                exit(1);
              }
          x=inchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ",ucase(mid(Src,5,1)));
          if(x==1 ){
              if(strcmp(Src,"Use_Acosh")==0){
                  Use_Acosh=TRUE;
                }
              if(strcmp(Src,"Use_AnsiToWide")==0){
                  Use_AnsiToWide=TRUE;
                }
              if(strcmp(Src,"Use_AppActivate")==0){
                  Use_AppActivate=TRUE;
                }
              if(strcmp(Src,"Use_AppExeName")==0){
                  Use_AppExeName=TRUE;
                }
              if(strcmp(Src,"Use_AppExePath")==0){
                  Use_AppExePath=TRUE;
                }
              if(strcmp(Src,"Use_Asc")==0){
                  Use_Asc=TRUE;
                }
              if(strcmp(Src,"Use_Asinh")==0){
                  Use_Asinh=TRUE;
                }
              if(strcmp(Src,"Use_Atanh")==0){
                  Use_Atanh=TRUE;
                }
              goto L1620;
            }
          if(x==2 ){
              if(strcmp(Src,"Use_BcxTempStr")==0){
                  Use_BcxTempStr=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Arc")==0){
                  Use_BCX_Arc=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Pie")==0){
                  Use_BCX_Pie=TRUE;
                }
              if(strcmp(Src,"Use_BCX_BmpHeight")==0){
                  Use_BCX_BmpHeight=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Buffer")==0){
                  Use_BCX_Buffer=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Blit")==0){
                  Use_BCX_Blit=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Blit_Stretch")==0){
                  Use_BCX_Blit_Stretch=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Blit_Sprite")==0){
                  Use_BCX_Blit_Sprite=TRUE;
                }
              if(strcmp(Src,"Use_BCX_BmpHeight")==0){
                  Use_BCX_BmpHeight=TRUE;
                }
              if(strcmp(Src,"Use_BCX_BmpWidth")==0){
                  Use_BCX_BmpWidth=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Circle")==0){
                  Use_BCX_Circle=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Colordlg")==0){
                  Use_BCX_Colordlg=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Control")==0){
                  Use_BCX_Control=TRUE;
                }
              if(strcmp(Src,"Use_Consolesize")==0){
                  Use_Consolesize=TRUE;
                }
              if(strcmp(Src,"Use_BCXMDialog")==0){
                  Use_BCXDialogCommon=Use_BCXMDialog=TRUE;
                }
              if(strcmp(Src,"Use_BCXDialog")==0){
                  Use_BCXDialogCommon=Use_BCXDialog=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Ellipse")==0){
                  Use_BCX_Ellipse=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Floodfill")==0){
                  Use_BCX_Floodfill=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Fontdlg")==0){
                  Use_BCX_Fontdlg=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Get")==0){
                  Use_BCX_Get=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Getpixel")==0){
                  Use_BCX_Getpixel=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Get_UpDown")==0){
                  Use_BCX_Get_UpDown=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Get_Window_Height")==0){
                  Use_BCX_Get_Window_Height=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Get_Window_Width")==0){
                  Use_BCX_Get_Window_Width=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Input")==0){
                  Use_BCX_Input=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Line")==0){
                  Use_BCX_Line=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Polar_Line")==0){
                  Use_BCX_Polar_Line=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Lineto")==0){
                  Use_BCX_Lineto=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Triangle")==0){
                  Use_BCX_Triangle=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Gradient")==0){
                  Use_BCX_Gradient=TRUE;
                }
              if(strcmp(Src,"Use_BCX_LoadBMP")==0){
                  Use_BCX_LoadBMP=TRUE;
                }
              if(strcmp(Src,"Use_BCX_LoadImage")==0){
                  Use_BCX_LoadImage=TRUE;
                }
              if(strcmp(Src,"Use_BCX_OlePicture")==0){
                  Use_BCX_OlePicture=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Path")==0){
                  Use_BCX_Path=TRUE;
                }
              if(strcmp(Src,"Use_BcxSplitPath")==0){
                  Use_BcxSplitPath=TRUE;
                }
              if(strcmp(Src,"Use_BCX_PolyBezier")==0){
                  Use_BCX_PolyBezier=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Polygon")==0){
                  Use_BCX_Polygon=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Polyline")==0){
                  Use_BCX_Polyline=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Preset")==0){
                  Use_BCX_Preset=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Print")==0){
                  Use_BCX_Print=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Printex")==0){
                  Use_BCX_Printex=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Pset")==0){
                  Use_BCX_Pset=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Polar_Pset")==0){
                  Use_BCX_Polar_Pset=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Put")==0){
                  Use_BCX_Put=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Rectangle")==0){
                  Use_BCX_Rectangle=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Resize")==0){
                  Use_BCX_Resize=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Roundrect")==0){
                  Use_BCX_Roundrect=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Tab")==0){
                  Use_BCX_Tab=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Toolbar")==0){
                  Use_BCX_Toolbar=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Tile")==0){
                  Use_BCX_Tile=TRUE;
                }
              if(strcmp(Src,"Use_BCX_UpDown")==0){
                  Use_BCX_UpDown=TRUE;
                }
              if(strcmp(Src,"Use_BCX_stricmp")==0){
                  Use_BCX_stricmp=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Slider")==0){
                  Use_BCX_Slider=TRUE;
                }
              if(strcmp(Src,"Use_BCX_Splitter")==0){
                  Use_BCX_Splitter=TRUE;
                }
              if(strcmp(Src,"Use_Bff")==0){
                  Use_Bff=TRUE;
                }
              if(strcmp(Src,"Use_Bin")==0){
                  Use_Bin=TRUE;
                }
              if(strcmp(Src,"Use_Bin2dec")==0){
                  Use_Bin2dec=TRUE;
                }
              if(strcmp(Src,"Use_Bitmap")==0){
                  Use_Bitmap=TRUE;
                }
              if(strcmp(Src,"Use_Blackrect")==0){
                  Use_Blackrect=TRUE;
                }
              if(strcmp(Src,"Use_BmpButton")==0){
                  Use_BmpButton=TRUE;
                }
              if(strcmp(Src,"Use_Boolstr")==0){
                  Use_Boolstr=TRUE;
                }
              if(strcmp(Src,"Use_Button")==0){
                  Use_Button=TRUE;
                }
              goto L1620;
            }
          if(x==3 ){
              if(strcmp(Src,"Use_Center")==0){
                  Use_Center=TRUE;
                }
              if(strcmp(Src,"Use_Checkbox")==0){
                  Use_Checkbox=TRUE;
                }
              if(strcmp(Src,"Use_Chrtoutf8")==0){
                  Use_Chrtoutf8=TRUE;
                }
              if(strcmp(Src,"Use_Cint")==0){
                  Use_Cint=TRUE;
                }
              if(strcmp(Src,"Use_Clip_Getbitmap")==0){
                  Use_Clip_Getbitmap=TRUE;
                }
              if(strcmp(Src,"Use_Clip_Setbitmap")==0){
                  Use_Clip_Setbitmap=TRUE;
                }
              if(strcmp(Src,"Use_Clip_Gettext")==0){
                  Use_Clip_Gettext=TRUE;
                }
              if(strcmp(Src,"Use_Clip_Gettextsize")==0){
                  Use_Clip_Gettextsize=TRUE;
                }
              if(strcmp(Src,"Use_Clip_Settext")==0){
                  Use_Clip_Settext=TRUE;
                }
              if(strcmp(Src,"Use_Clip_Reset")==0){
                  Use_Clip_Reset=TRUE;
                }
              if(strcmp(Src,"Use_Clng")==0){
                  Use_Clng=TRUE;
                }
              if(strcmp(Src,"Use_Cls")==0){
                  Use_Cls=TRUE;
                }
              if(strcmp(Src,"Use_Color")==0){
                  Use_Color=TRUE;
                }
              if(strcmp(Src,"Use_COM")==0){
                  Use_COM=TRUE;
                }
              if(strcmp(Src,"Use_Combobox")==0){
                  Use_Combobox=TRUE;
                }
              if(strcmp(Src,"Use_ComboBoxLoadFile")==0){
                  Use_ComboBoxLoadFile=TRUE;
                }
              if(strcmp(Src,"Use_Command")==0){
                  Use_Command=TRUE;
                }
              if(strcmp(Src,"Use_ContainedIn")==0){
                  Use_ContainedIn=TRUE;
                }
              if(strcmp(Src,"Use_CreateRegInt")==0){
                  Use_CreateRegInt=TRUE;
                }
              if(strcmp(Src,"Use_CreateRegString")==0){
                  Use_CreateRegString=TRUE;
                }
              if(strcmp(Src,"Use_Csrlin")==0){
                  Use_Csrlin=TRUE;
                }
              if(strcmp(Src,"Use_Curdir")==0){
                  Use_Curdir=TRUE;
                }
              if(strcmp(Src,"Use_Cvd")==0){
                  Use_Cvd=TRUE;
                }
              if(strcmp(Src,"Use_Cvi")==0){
                  Use_Cvi=TRUE;
                }
              if(strcmp(Src,"Use_Cvl")==0){
                  Use_Cvl=TRUE;
                }
              if(strcmp(Src,"Use_Cvld")==0){
                  Use_Cvld=TRUE;
                }
              if(strcmp(Src,"Use_Cvs")==0){
                  Use_Cvs=TRUE;
                }
              if(strcmp(Src,"Use_Cpad")==0){
                  Use_Cpad=TRUE;
                }
              goto L1620;
            }
          if(x==4 ){
              if(strcmp(Src,"Use_Datepick")==0){
                  Use_Datepick=TRUE;
                }
              if(strcmp(Src,"Use_Del")==0){
                  Use_Del=TRUE;
                }
              if(strcmp(Src,"Use_DeleteRegKey")==0){
                  Use_DeleteRegKey=TRUE;
                }
              if(strcmp(Src,"Use_Diskfree")==0){
                  Use_Diskfree=TRUE;
                }
              if(strcmp(Src,"Use_Diskused")==0){
                  Use_Diskused=TRUE;
                }
              if(strcmp(Src,"Use_Disksize")==0){
                  Use_Disksize=TRUE;
                }
              if(strcmp(Src,"Use_Doevents")==0){
                  Use_Doevents=TRUE;
                }
              if(strcmp(Src,"Use_Download")==0){
                  Use_Download=TRUE;
                }
              if(strcmp(Src,"Use_Draw")==0){
                  Use_Draw=TRUE;
                }
              if(strcmp(Src,"Use_DrawTransBMP")==0){
                  Use_DrawTransBMP=TRUE;
                }
              if(strcmp(Src,"Use_DSplit")==0){
                  Use_DSplit=TRUE;
                }
              if(strcmp(Src,"Use_Dynacall")==0){
                  Use_DynacallCommon=Use_Dynacall=TRUE;
                }
              if(strcmp(Src,"Use_DynamicA")==0){
                  Use_DynamicA=TRUE;
                }
              if(strcmp(Src,"Use_DynStrqsorta")==0){
                  Use_DynStrqsorta=TRUE;
                }
              if(strcmp(Src,"Use_DynStrqsortas")==0){
                  Use_DynStrqsortas=TRUE;
                }
              if(strcmp(Src,"Use_DynStrqsortd")==0){
                  Use_DynStrqsortd=TRUE;
                }
              if(strcmp(Src,"Use_DynStrqsortds")==0){
                  Use_DynStrqsortds=TRUE;
                }
              goto L1620;
            }
          if(x==5 ){
              if(strcmp(Src,"Use_Edit")==0){
                  Use_Edit=TRUE;
                }
              if(strcmp(Src,"Use_Elf")==0){
                  Use_Elf=TRUE;
                }
              if(strcmp(Src,"Use_Enclose")==0){
                  Use_Enclose=TRUE;
                }
              if(strcmp(Src,"Use_Environ")==0){
                  Use_Environ=TRUE;
                }
              if(strcmp(Src,"Use_Eof")==0){
                  Use_Eof=TRUE;
                }
              if(strcmp(Src,"Use_Exist")==0){
                  Use_Exist=TRUE;
                }
              if(strcmp(Src,"Use_Exp")==0){
                  Use_Exp=TRUE;
                }
              if(strcmp(Src,"Use_Extract")==0){
                  Use_Extract=TRUE;
                }
              goto L1620;
            }
          if(x==6 ){
              if(strcmp(Src,"Use_FileLocked")==0){
                  Use_FileLocked=TRUE;
                }
              if(strcmp(Src,"Use_FillArray")==0){
                  Use_FillArray=TRUE;
                }
              if(strcmp(Src,"Use_Findfirst")==0){
                  Use_Findfirst=TRUE;
                }
              if(strcmp(Src,"Use_Findnext")==0){
                  Use_Findnext=TRUE;
                }
              if(strcmp(Src,"Use_FirstInstance")==0){
                  Use_FirstInstance=TRUE;
                }
              if(strcmp(Src,"Use_FindInType")==0){
                  Use_FindInType=TRUE;
                }
              if(strcmp(Src,"Use_Form")==0){
                  Use_Form=TRUE;
                }
              if(strcmp(Src,"Use_Freefile")==0){
                  Use_Freefile=TRUE;
                }
              goto L1620;
            }
          if(x==7 ){
              if(strcmp(Src,"Use_GetBmp")==0){
                  Use_GetBmp=TRUE;
                }
              if(strcmp(Src,"Use_GetDimension")==0){
                  Use_GetDimension=TRUE;
                }
              if(strcmp(Src,"Use_Getfilename")==0){
                  Use_Getfilename=TRUE;
                }
              if(strcmp(Src,"Use_GetSpecialFolder")==0){
                  Use_GetSpecialFolder=TRUE;
                }
              if(strcmp(Src,"Use_GetSpecialFolderex")==0){
                  Use_GetSpecialFolderex=TRUE;
                }
              if(strcmp(Src,"Use_GetText")==0){
                  Use_GetText=TRUE;
                }
              if(strcmp(Src,"Use_GetTextSize")==0){
                  Use_GetTextSize=TRUE;
                }
              if(strcmp(Src,"Use_Grayrect")==0){
                  Use_Grayrect=TRUE;
                }
              if(strcmp(Src,"Use_Group")==0){
                  Use_Group=TRUE;
                }
              goto L1620;
            }
          if(x==8 ){
              if(strcmp(Src,"Use_Hex")==0){
                  Use_Hex=TRUE;
                }
              if(strcmp(Src,"Use_Hex2Dec")==0){
                  Use_Hex2Dec=TRUE;
                }
              if(strcmp(Src,"Use_Hook")==0){
                  Use_Hook=TRUE;
                }
              if(strcmp(Src,"Use_Hscroll")==0){
                  Use_Hscroll=TRUE;
                }
              goto L1620;
            }
          if(x==9 ){
              if(strcmp(Src,"Use_Icon")==0){
                  Use_Icon=TRUE;
                }
              if(strcmp(Src,"Use_Idxqsort")==0){
                  Use_Idxqsort=TRUE;
                }
              if(strcmp(Src,"Use_IdxqsortSt")==0){
                  Use_IdxqsortSt=TRUE;
                }
              if(strcmp(Src,"Use_Inchr")==0){
                  Use_Inchr=TRUE;
                }
              if(strcmp(Src,"Use_Infobox")==0){
                  Use_BoxCommon=Use_Infobox=TRUE;
                }
              if(strcmp(Src,"Use_Inkey")==0){
                  Use_Inkey=TRUE;
                }
              if(strcmp(Src,"Use_InkeyD")==0){
                  Use_InkeyD=TRUE;
                }
              if(strcmp(Src,"Use_Inputbox")==0){
                  Use_BoxCommon=Use_Inputbox=TRUE;
                }
              if(strcmp(Src,"Use_Ins")==0){
                  Use_Ins=TRUE;
                }
              if(strcmp(Src,"Use_Instr")==0){
                  Use_Instr=TRUE;
                }
              if(strcmp(Src,"Use_InstrAny")==0){
                  Use_InstrAny=TRUE;
                }
              if(strcmp(Src,"Use_Instrrev")==0){
                  Use_Instrrev=TRUE;
                }
              if(strcmp(Src,"Use_IRemove")==0){
                  Use_IRemove=TRUE;
                }
              if(strcmp(Src,"Use_iReplace")==0){
                  Use_iReplace=TRUE;
                }
              goto L1620;
            }
          if(x==10 ){
              if(strcmp(Src,"Use_Join")==0){
                  Use_Join=TRUE;
                }
              goto L1620;
            }
          if(x==11 ){
              if(strcmp(Src,"Use_Keypress")==0){
                  Use_Keypress=TRUE;
                }
              goto L1620;
            }
          if(x==12 ){
              if(strcmp(Src,"Use_Label")==0){
                  Use_Label=TRUE;
                }
              if(strcmp(Src,"Use_Lcase")==0){
                  Use_Lcase=TRUE;
                }
              if(strcmp(Src,"Use_LCaseTbl")==0){
                  Use_LCaseTbl=TRUE;
                }
              if(strcmp(Src,"Use_LccPath")==0){
                  Use_LccPath=TRUE;
                }
              if(strcmp(Src,"Use_Left")==0){
                  Use_Left=TRUE;
                }
              if(strcmp(Src,"Use_Like")==0){
                  Use_Like=TRUE;
                }
              if(strcmp(Src,"Use_Listbox")==0){
                  Use_Listbox=TRUE;
                }
              if(strcmp(Src,"Use_ListBoxLoadFile")==0){
                  Use_ListBoxLoadFile=TRUE;
                }
              if(strcmp(Src,"Use_Listview")==0){
                  Use_Listview=TRUE;
                }
              if(strcmp(Src,"Use_LoadFile")==0){
                  Use_LoadFile=TRUE;
                }
              if(strcmp(Src,"Use_Loc")==0){
                  Use_Loc=TRUE;
                }
              if(strcmp(Src,"Use_Longestline")==0){
                  Use_Longestline=TRUE;
                }
              if(strcmp(Src,"Use_Locate")==0){
                  Use_Locate=TRUE;
                }
              if(strcmp(Src,"Use_Lof")==0){
                  Use_Lof=TRUE;
                }
              if(strcmp(Src,"Use_Lpad")==0){
                  Use_Lpad=TRUE;
                }
              if(strcmp(Src,"Use_Ltrim")==0){
                  Use_Ltrim=TRUE;
                }
              goto L1620;
            }
          if(x==13 ){
              if(strcmp(Src,"Use_Makebmp")==0){
                  Use_Makebmp=TRUE;
                }
              if(strcmp(Src,"Use_Makehdc")==0){
                  Use_Makehdc=TRUE;
                }
              if(strcmp(Src,"Use_Max")==0){
                  Use_Max=TRUE;
                }
              if(strcmp(Src,"Use_Mcase")==0){
                  Use_Mcase=TRUE;
                }
              if(strcmp(Src,"Use_Mid")==0){
                  Use_Mid=TRUE;
                }
              if(strcmp(Src,"Use_Midstr")==0){
                  Use_Midstr=TRUE;
                }
              if(strcmp(Src,"Use_Min")==0){
                  Use_Min=TRUE;
                }
              if(strcmp(Src,"Use_Mkd")==0){
                  Use_Mkd=TRUE;
                }
              if(strcmp(Src,"Use_Mki")==0){
                  Use_Mki=TRUE;
                }
              if(strcmp(Src,"Use_Mkl")==0){
                  Use_Mkl=TRUE;
                }
              if(strcmp(Src,"Use_Mkld")==0){
                  Use_Mkld=TRUE;
                }
              if(strcmp(Src,"Use_Mks")==0){
                  Use_Mks=TRUE;
                }
              if(strcmp(Src,"Use_Mkpath")==0){
                  Use_Mks=TRUE;
                }
              if(strcmp(Src,"Use_Modstyle")==0){
                  Use_Modstyle=TRUE;
                }
              if(strcmp(Src,"Use_Msgbox")==0){
                  Use_Msgbox=TRUE;
                }
              goto L1620;
            }
          if(x==14 ){
              if(strcmp(Src,"Use_Newbmp")==0){
                  Use_Newbmp=TRUE;
                }
              if(strcmp(Src,"Use_Nextlinelen")==0){
                  Use_Nextlinelen=TRUE;
                }
              if(strcmp(Src,"Use_Now")==0){
                  Use_Now=TRUE;
                }
              if(strcmp(Src,"Use_Numqsortadouble")==0){
                  Use_Numqsortadouble=TRUE;
                }
              if(strcmp(Src,"Use_Numqsortafloat")==0){
                  Use_Numqsortafloat=TRUE;
                }
              if(strcmp(Src,"Use_Numqsortaint")==0){
                  Use_Numqsortaint=TRUE;
                }
              if(strcmp(Src,"Use_Numqsortddouble")==0){
                  Use_Numqsortddouble=TRUE;
                }
              if(strcmp(Src,"Use_Numqsortdfloat")==0){
                  Use_Numqsortdfloat=TRUE;
                }
              if(strcmp(Src,"Use_Numqsortdint")==0){
                  Use_Numqsortdint=TRUE;
                }
              goto L1620;
            }
          if(x==15 ){
              if(strcmp(Src,"Use_Oct")==0){
                  Use_Oct=TRUE;
                }
              if(strcmp(Src,"Use_OSVersion")==0){
                  Use_OSVersion=TRUE;
                }
              goto L1620;
            }
          if(x==16 ){
              if(strcmp(Src,"Use_Panel")==0){
                  Use_Panel=TRUE;
                }
              if(strcmp(Src,"Use_Pause")==0){
                  Use_Pause=TRUE;
                }
              if(strcmp(Src,"Use_PeekStr")==0){
                  Use_PeekStr=TRUE;
                }
              if(strcmp(Src,"Use_PellesPath")==0){
                  Use_PellesPath=TRUE;
                }
              if(strcmp(Src,"Use_PlayWav")==0){
                  Use_PlayWav=TRUE;
                }
              if(strcmp(Src,"Use_Pos")==0){
                  Use_Pos=TRUE;
                }
              if(strcmp(Src,"UseCpp")==0){
                  UseCpp=TRUE;
                }
              if(strcmp(Src,"Use_Printer")==0){
                  Use_Printer=TRUE;
                }
              if(strcmp(Src,"Use_ProgressBar")==0){
                  Use_ProgressBar=TRUE;
                }
              if(strcmp(Src,"Use_PtrqsortSt")==0){
                  Use_PtrqsortSt=TRUE;
                }
              goto L1620;
            }
          if(x==17 ){
              if(strcmp(Src,"Use_QBColor")==0){
                  Use_QBColor=TRUE;
                }
              goto L1620;
            }
          if(x==18 ){
              if(strcmp(Src,"Use_Radio")==0){
                  Use_Radio=TRUE;
                }
              if(strcmp(Src,"Use_Randomize")==0){
                  Use_Randomize=TRUE;
                }
              if(strcmp(Src,"Use_Rec")==0){
                  Use_Rec=TRUE;
                }
              if(strcmp(Src,"Use_RecCount")==0){
                  Use_RecCount=TRUE;
                }
              if(strcmp(Src,"Use_RegInt")==0){
                  Use_RegInt=TRUE;
                }
              if(strcmp(Src,"Use_RegString")==0){
                  Use_RegString=TRUE;
                }
              if(strcmp(Src,"Use_Remain")==0){
                  Use_Remain=TRUE;
                }
              if(strcmp(Src,"Use_Remove")==0){
                  Use_Remove=TRUE;
                }
              if(strcmp(Src,"Use_RemoveAny")==0){
                  Use_RemoveAny=TRUE;
                }
              if(strcmp(Src,"Use_Repeat")==0){
                  Use_Repeat=TRUE;
                }
              if(strcmp(Src,"Use_Replace")==0){
                  Use_Replace=TRUE;
                }
              if(strcmp(Src,"Use_ReplaceAny")==0){
                  Use_ReplaceAny=TRUE;
                }
              if(strcmp(Src,"Use_Retain")==0){
                  Use_Retain=TRUE;
                }
              if(strcmp(Src,"Use_Reverse")==0){
                  Use_Reverse=TRUE;
                }
              if(strcmp(Src,"Use_Richedit")==0){
                  Use_Richedit=TRUE;
                }
              if(strcmp(Src,"Use_Right")==0){
                  Use_Right=TRUE;
                }
              if(strcmp(Src,"Use_Rnd")==0){
                  Use_Rnd=TRUE;
                }
              if(strcmp(Src,"Use_Rnd2")==0){
                  Use_Rnd2=TRUE;
                }
              if(strcmp(Src,"Use_Round")==0){
                  Use_Round=TRUE;
                }
              if(strcmp(Src,"Use_Rpad")==0){
                  Use_Rpad=TRUE;
                }
              if(strcmp(Src,"Use_Rtrim")==0){
                  Use_Rtrim=TRUE;
                }
              if(strcmp(Src,"Use_Run")==0){
                  Use_Run=TRUE;
                }
              goto L1620;
            }
          if(x==19 ){
              if(strcmp(Src,"Use_SaveBmp")==0){
                  Use_SaveBmp=TRUE;
                }
              if(strcmp(Src,"Use_Scan")==0){
                  Use_Scan=TRUE;
                }
              if(strcmp(Src,"Use_Screen")==0){
                  Use_Screen=TRUE;
                }
              if(strcmp(Src,"Use_SearchPath")==0){
                  Use_SearchPath=TRUE;
                }
              if(strcmp(Src,"Use_Setclientsize")==0){
                  Use_Setclientsize=TRUE;
                }
              if(strcmp(Src,"Use_SetColor")==0){
                  Use_SetColor=TRUE;
                }
              if(strcmp(Src,"Use_SetDimension")==0){
                  Use_SetDimension=TRUE;
                }
              if(strcmp(Src,"Use_SetFont")==0){
                  Use_SetFont=TRUE;
                }
              if(strcmp(Src,"Use_SetFormColor")==0){
                  Use_SetFormColor=TRUE;
                }
              if(strcmp(Src,"Use_SetText")==0){
                  Use_SetText=TRUE;
                }
              if(strcmp(Src,"Use_Set_BCX_Bitmap")==0){
                  Use_Set_BCX_Bitmap=TRUE;
                }
              if(strcmp(Src,"Use_Set_BCX_Bitmap2")==0){
                  Use_Set_BCX_Bitmap2=TRUE;
                }
              if(strcmp(Src,"Use_Set_BCX_BmpButton")==0){
                  Use_Set_BCX_BmpButton=TRUE;
                }
              if(strcmp(Src,"Use_Set_BCX_Icon")==0){
                  Use_Set_BCX_Icon=TRUE;
                }
              if(strcmp(Src,"Use_Sgn")==0){
                  Use_Sgn=TRUE;
                }
              if(strcmp(Src,"Use_Sound")==0){
                  Use_Sound=TRUE;
                }
              if(strcmp(Src,"Use_Space")==0){
                  Use_Space=TRUE;
                }
              if(strcmp(Src,"Use_Split")==0){
                  Use_Split=TRUE;
                }
              if(strcmp(Src,"Use_Status")==0){
                  Use_Status=TRUE;
                }
              if(strcmp(Src,"Use_Str")==0){
                  Use_Str=TRUE;
                }
              if(strcmp(Src,"Use_Strim")==0){
                  Use_Strim=TRUE;
                }
              if(strcmp(Src,"Use_String")==0){
                  Use_String=TRUE;
                }
              if(strcmp(Src,"Use_Stristr")==0){
                  Use_Stristr=TRUE;
                }
              if(strcmp(Src,"Use_Strl")==0){
                  Use_Strl=TRUE;
                }
              if(strcmp(Src,"Use_Strqsorta")==0){
                  Use_Strqsorta=TRUE;
                }
              if(strcmp(Src,"Use_Strqsortas")==0){
                  Use_Strqsortas=TRUE;
                }
              if(strcmp(Src,"Use_Strqsortd")==0){
                  Use_Strqsortd=TRUE;
                }
              if(strcmp(Src,"Use_Strqsortds")==0){
                  Use_Strqsortds=TRUE;
                }
              if(strcmp(Src,"Use_Strtoken")==0){
                  Use_Strtoken=TRUE;
                }
              if(strcmp(Src,"Use_Swap")==0){
                  Use_Swap=TRUE;
                }
              if(strcmp(Src,"Use_Sysdir")==0){
                  Use_Sysdir=TRUE;
                }
              if(strcmp(Src,"Use_SysStr")==0){
                  Use_SysStr=TRUE;
                }
              if(strcmp(Src,"Use_sziif")==0){
                  Use_sziif=TRUE;
                }
              goto L1620;
            }
          if(x==20 ){
              if(strcmp(Src,"Use_Tix")==0){
                  Use_Tix=TRUE;
                }
              if(strcmp(Src,"Use_Tally")==0){
                  Use_Tally=TRUE;
                }
              if(strcmp(Src,"Use_Tempdir")==0){
                  Use_Tempdir=TRUE;
                }
              if(strcmp(Src,"Use_TempFileName")==0){
                  Use_TempFileName=TRUE;
                }
              if(strcmp(Src,"Use_Textmode")==0){
                  Use_Textmode=TRUE;
                }
              if(strcmp(Src,"Use_Time")==0){
                  Use_Time=TRUE;
                }
              if(strcmp(Src,"Use_Timer")==0){
                  Use_Timer=TRUE;
                }
              if(strcmp(Src,"Use_Treeview")==0){
                  Use_Treeview=TRUE;
                }
              if(strcmp(Src,"Use_Trim")==0){
                  Use_Trim=TRUE;
                }
              goto L1620;
            }
          if(x==21 ){
              if(strcmp(Src,"Use_Utf8tochr")==0){
                  Use_Utf8tochr=TRUE;
                }
              if(strcmp(Src,"Use_Ucase")==0){
                  Use_Ucase=TRUE;
                }
              if(strcmp(Src,"Use_UCaseTbl")==0){
                  Use_UCaseTbl=TRUE;
                }
              if(strcmp(Src,"Use_Using")==0){
                  Use_Using=TRUE;
                }
              if(strcmp(Src,"Use_Unwrap")==0){
                  Use_Unwrap=TRUE;
                }
              goto L1620;
            }
          if(x==22 ){
              if(strcmp(Src,"Use_VBS")==0){
                  Use_VBS=TRUE;
                }
              if(strcmp(Src,"Use_VChr")==0){
                  Use_VChr=TRUE;
                }
              if(strcmp(Src,"Use_Verify")==0){
                  Use_Verify=TRUE;
                }
              goto L1620;
            }
          if(x==23 ){
              if(strcmp(Src,"Use_Whiterect")==0){
                  Use_Whiterect=TRUE;
                }
              if(strcmp(Src,"Use_WideToAnsi")==0){
                  Use_WideToAnsi=TRUE;
                }
              if(strcmp(Src,"Use_Windir")==0){
                  Use_Windir=TRUE;
                }
              if(strcmp(Src,"Use_Wrap")==0){
                  Use_Wrap=TRUE;
                }
            }

L1620:;

        }
      if(FPUSE)
       {
         fclose(FPUSE);
         FPUSE=NULL;
       }
    }
}

void SetFlags ()
{
  if((FPFLAGS=fopen(Project, "w"))==0)
   {
  fprintf(stderr, "Error: Cannot Access File or File Not Found. %s\n", Project); exit(1);
   }
  if(Use_Acosh ){
      fprintf(FPFLAGS,"%s\n","Use_Acosh");
    }
  if(Use_AnsiToWide ){
      fprintf(FPFLAGS,"%s\n","Use_AnsiToWide");
    }
  if(Use_AppActivate ){
      fprintf(FPFLAGS,"%s\n","Use_AppActivate");
    }
  if(Use_AppExeName ){
      fprintf(FPFLAGS,"%s\n","Use_AppExeName");
    }
  if(Use_AppExePath ){
      fprintf(FPFLAGS,"%s\n","Use_AppExePath");
    }
  if(Use_Asc ){
      fprintf(FPFLAGS,"%s\n","Use_Asc");
    }
  if(Use_Asinh ){
      fprintf(FPFLAGS,"%s\n","Use_Asinh");
    }
  if(Use_Atanh ){
      fprintf(FPFLAGS,"%s\n","Use_Atanh");
    }
  if(Use_BCX_Arc ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Arc");
    }
  if(Use_BCX_Pie ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Pie");
    }
  if(Use_BCX_BmpHeight ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_BmpHeight");
    }
  if(Use_BCX_Blit ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Blit");
    }
  if(Use_BCX_Blit_Stretch ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Blit_Stretch");
    }
  if(Use_BCX_Blit_Sprite ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Blit_Sprite");
    }
  if(Use_BCX_Buffer ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Buffer");
    }
  if(Use_BCX_BmpHeight ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_BmpHeight");
    }
  if(Use_BCX_BmpWidth ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_BmpWidth");
    }
  if(Use_BCX_Circle ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Circle");
    }
  if(Use_BCX_Colordlg ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Colordlg");
    }
  if(Use_BCX_Control ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Control");
    }
  if(Use_Consolesize ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Consolesize");
    }
  if(Use_BCX_Ellipse ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Ellipse");
    }
  if(Use_BCX_Floodfill ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Floodfill");
    }
  if(Use_BCX_Fontdlg ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Fontdlg");
    }
  if(Use_BCX_Get ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Get");
    }
  if(Use_BCX_Get_Window_Height ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Get_Window_Height");
    }
  if(Use_BCX_Get_Window_Width ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Get_Window_Width");
    }
  if(Use_BCX_Getpixel ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Getpixel");
    }
  if(Use_BCX_Get_UpDown ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Get_UpDown");
    }
  if(Use_BCX_Input ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Input");
    }
  if(Use_BCX_Line ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Line");
    }
  if(Use_BCX_Polar_Line ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Polar_Line");
    }
  if(Use_BCX_Lineto ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Lineto");
    }
  if(Use_BCX_Triangle ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Triangle");
    }
  if(Use_BCX_Gradient ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Gradient");
    }
  if(Use_BCX_LoadBMP ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_LoadBMP");
    }
  if(Use_BCX_LoadImage ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_LoadImage");
    }
  if(Use_BCX_OlePicture ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_OlePicture");
    }
  if(Use_BCX_Path ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Path");
    }
  if(Use_BcxSplitPath ){
      fprintf(FPFLAGS,"%s\n","Use_BcxSplitPath");
    }
  if(Use_BCX_PolyBezier ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_PolyBezier");
    }
  if(Use_BCX_Polygon ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Polygon");
    }
  if(Use_BCX_Polyline ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Polyline");
    }
  if(Use_BCX_Preset ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Preset");
    }
  if(Use_BCX_Print ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Print");
    }
  if(Use_BCX_Printex ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Printex");
    }
  if(Use_BCX_Pset ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Pset");
    }
  if(Use_BCX_Polar_Pset ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Polar_Pset");
    }
  if(Use_BCX_Put ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Put");
    }
  if(Use_BCX_Rectangle ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Rectangle");
    }
  if(Use_BCX_Resize ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Resize");
    }
  if(Use_BCX_Roundrect ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Roundrect");
    }
  if(Use_BCX_Tab ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Tab");
    }
  if(Use_BCX_Toolbar ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Toolbar");
    }
  if(Use_BCX_Tile ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Tile");
    }
  if(Use_BCX_UpDown ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_UpDown");
    }
  if(Use_BCX_Slider ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Slider");
    }
  if(Use_BCX_Splitter ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_Splitter");
    }
  if(Use_BCX_stricmp ){
      fprintf(FPFLAGS,"%s\n","Use_BCX_stricmp");
    }
  if(Use_BcxTempStr ){
      fprintf(FPFLAGS,"%s\n","Use_BcxTempStr");
    }
  if(Use_Bff ){
      fprintf(FPFLAGS,"%s\n","Use_Bff");
    }
  if(Use_Bin ){
      fprintf(FPFLAGS,"%s\n","Use_Bin");
    }
  if(Use_Bin2dec ){
      fprintf(FPFLAGS,"%s\n","Use_Bin2dec");
    }
  if(Use_Bitmap ){
      fprintf(FPFLAGS,"%s\n","Use_Bitmap");
    }
  if(Use_Blackrect ){
      fprintf(FPFLAGS,"%s\n","Use_Blackrect");
    }
  if(Use_BmpButton ){
      fprintf(FPFLAGS,"%s\n","Use_BmpButton");
    }
  if(Use_Boolstr ){
      fprintf(FPFLAGS,"%s\n","Use_Boolstr");
    }
  if(Use_Button ){
      fprintf(FPFLAGS,"%s\n","Use_Button");
    }
  if(Use_Center ){
      fprintf(FPFLAGS,"%s\n","Use_Center");
    }
  if(Use_Checkbox ){
      fprintf(FPFLAGS,"%s\n","Use_Checkbox");
    }
  if(Use_Chrtoutf8 ){
      fprintf(FPFLAGS,"%s\n","Use_Chrtoutf8");
    }
  if(Use_Cint ){
      fprintf(FPFLAGS,"%s\n","Use_Cint");
    }
  if(Use_Clip_Getbitmap ){
      fprintf(FPFLAGS,"%s\n","Use_Clip_Getbitmap");
    }
  if(Use_Clip_Setbitmap ){
      fprintf(FPFLAGS,"%s\n","Use_Clip_Setbitmap");
    }
  if(Use_Clip_Gettext ){
      fprintf(FPFLAGS,"%s\n","Use_Clip_Gettext");
    }
  if(Use_Clip_Gettextsize ){
      fprintf(FPFLAGS,"%s\n","Use_Clip_Gettextsize");
    }
  if(Use_Clip_Settext ){
      fprintf(FPFLAGS,"%s\n","Use_Clip_Settext");
    }
  if(Use_Clip_Reset ){
      fprintf(FPFLAGS,"%s\n","Use_Clip_Reset");
    }
  if(Use_Clng ){
      fprintf(FPFLAGS,"%s\n","Use_Clng");
    }
  if(Use_Cls ){
      fprintf(FPFLAGS,"%s\n","Use_Cls");
    }
  if(Use_Color ){
      fprintf(FPFLAGS,"%s\n","Use_Color");
    }
  if(Use_COM ){
      fprintf(FPFLAGS,"%s\n","Use_COM");
    }
  if(Use_Combobox ){
      fprintf(FPFLAGS,"%s\n","Use_Combobox");
    }
  if(Use_ComboBoxLoadFile ){
      fprintf(FPFLAGS,"%s\n","Use_ComboBoxLoadFile");
    }
  if(Use_Command ){
      fprintf(FPFLAGS,"%s\n","Use_Command");
    }
  if(Use_ContainedIn ){
      fprintf(FPFLAGS,"%s\n","Use_ContainedIn");
    }
  if(Use_CreateRegInt ){
      fprintf(FPFLAGS,"%s\n","Use_CreateRegInt");
    }
  if(Use_CreateRegString ){
      fprintf(FPFLAGS,"%s\n","Use_CreateRegString");
    }
  if(Use_Cpad ){
      fprintf(FPFLAGS,"%s\n","Use_Cpad");
    }
  if(Use_Csrlin ){
      fprintf(FPFLAGS,"%s\n","Use_Csrlin");
    }
  if(Use_Curdir ){
      fprintf(FPFLAGS,"%s\n","Use_Curdir");
    }
  if(Use_Cvd ){
      fprintf(FPFLAGS,"%s\n","Use_Cvd");
    }
  if(Use_Cvi ){
      fprintf(FPFLAGS,"%s\n","Use_Cvi");
    }
  if(Use_Cvl ){
      fprintf(FPFLAGS,"%s\n","Use_Cvl");
    }
  if(Use_Cvld ){
      fprintf(FPFLAGS,"%s\n","Use_Cvld");
    }
  if(Use_Cvs ){
      fprintf(FPFLAGS,"%s\n","Use_Cvs");
    }
  if(Use_Datepick ){
      fprintf(FPFLAGS,"%s\n","Use_Datepick");
    }
  if(Use_Del ){
      fprintf(FPFLAGS,"%s\n","Use_Del");
    }
  if(Use_Diskfree ){
      fprintf(FPFLAGS,"%s\n","Use_Diskfree");
    }
  if(Use_Diskused ){
      fprintf(FPFLAGS,"%s\n","Use_Diskused");
    }
  if(Use_Disksize ){
      fprintf(FPFLAGS,"%s\n","Use_Disksize");
    }
  if(Use_DeleteRegKey ){
      fprintf(FPFLAGS,"%s\n","Use_DeleteRegKey");
    }
  if(Use_BCXMDialog ){
      fprintf(FPFLAGS,"%s\n","Use_BCXMDialog");
    }
  if(Use_BCXDialog ){
      fprintf(FPFLAGS,"%s\n","Use_BCXDialog");
    }
  if(Use_Doevents ){
      fprintf(FPFLAGS,"%s\n","Use_Doevents");
    }
  if(Use_Download ){
      fprintf(FPFLAGS,"%s\n","Use_Download");
    }
  if(Use_Draw ){
      fprintf(FPFLAGS,"%s\n","Use_Draw");
    }
  if(Use_DrawTransBMP ){
      fprintf(FPFLAGS,"%s\n","Use_DrawTransBMP");
    }
  if(Use_DSplit ){
      fprintf(FPFLAGS,"%s\n","Use_DSplit");
    }
  if(Use_Dynacall&&!DllCnt ){
      fprintf(FPFLAGS,"%s\n","Use_Dynacall");
    }
  if(Use_DynamicA ){
      fprintf(FPFLAGS,"%s\n","Use_DynamicA");
    }
  if(Use_DynStrqsorta ){
      fprintf(FPFLAGS,"%s\n","Use_DynStrqsorta");
    }
  if(Use_DynStrqsortas ){
      fprintf(FPFLAGS,"%s\n","Use_DynStrqsortas");
    }
  if(Use_DynStrqsortd ){
      fprintf(FPFLAGS,"%s\n","Use_DynStrqsortd");
    }
  if(Use_DynStrqsortds ){
      fprintf(FPFLAGS,"%s\n","Use_DynStrqsortds");
    }
  if(Use_Edit ){
      fprintf(FPFLAGS,"%s\n","Use_Edit");
    }
  if(Use_Elf ){
      fprintf(FPFLAGS,"%s\n","Use_Elf");
    }
  if(Use_Enclose ){
      fprintf(FPFLAGS,"%s\n","Use_Enclose");
    }
  if(Use_Environ ){
      fprintf(FPFLAGS,"%s\n","Use_Environ");
    }
  if(Use_Eof ){
      fprintf(FPFLAGS,"%s\n","Use_Eof");
    }
  if(Use_Exist ){
      fprintf(FPFLAGS,"%s\n","Use_Exist");
    }
  if(Use_Exp ){
      fprintf(FPFLAGS,"%s\n","Use_Exp");
    }
  if(Use_Extract ){
      fprintf(FPFLAGS,"%s\n","Use_Extract");
    }
  if(Use_FileLocked ){
      fprintf(FPFLAGS,"%s\n","Use_FileLocked");
    }
  if(Use_FillArray ){
      fprintf(FPFLAGS,"%s\n","Use_FillArray");
    }
  if(Use_Findfirst ){
      fprintf(FPFLAGS,"%s\n","Use_Findfirst");
    }
  if(Use_Findnext ){
      fprintf(FPFLAGS,"%s\n","Use_Findnext");
    }
  if(Use_FirstInstance ){
      fprintf(FPFLAGS,"%s\n","Use_FirstInstance");
    }
  if(Use_FindInType ){
      fprintf(FPFLAGS,"%s\n","Use_FindInType");
    }
  if(Use_Form ){
      fprintf(FPFLAGS,"%s\n","Use_Form");
    }
  if(Use_Freefile ){
      fprintf(FPFLAGS,"%s\n","Use_Freefile");
    }
  if(Use_GetBmp ){
      fprintf(FPFLAGS,"%s\n","Use_GetBmp");
    }
  if(Use_GetDimension ){
      fprintf(FPFLAGS,"%s\n","Use_GetDimension");
    }
  if(Use_Getfilename ){
      fprintf(FPFLAGS,"%s\n","Use_Getfilename");
    }
  if(Use_GetSpecialFolder ){
      fprintf(FPFLAGS,"%s\n","Use_GetSpecialFolder");
    }
  if(Use_GetSpecialFolderex ){
      fprintf(FPFLAGS,"%s\n","Use_GetSpecialFolderex");
    }
  if(Use_GetText ){
      fprintf(FPFLAGS,"%s\n","Use_GetText");
    }
  if(Use_GetTextSize ){
      fprintf(FPFLAGS,"%s\n","Use_GetTextSize");
    }
  if(Use_Grayrect ){
      fprintf(FPFLAGS,"%s\n","Use_Grayrect");
    }
  if(Use_Group ){
      fprintf(FPFLAGS,"%s\n","Use_Group");
    }
  if(Use_Hex ){
      fprintf(FPFLAGS,"%s\n","Use_Hex");
    }
  if(Use_Hex2Dec ){
      fprintf(FPFLAGS,"%s\n","Use_Hex2Dec");
    }
  if(Use_Hook ){
      fprintf(FPFLAGS,"%s\n","Use_Hook");
    }
  if(Use_Hscroll||Use_Vscroll ){
      fprintf(FPFLAGS,"%s\n","Use_Hscroll");
    }
  if(Use_Icon ){
      fprintf(FPFLAGS,"%s\n","Use_Icon");
    }
  if(Use_Idxqsort ){
      fprintf(FPFLAGS,"%s\n","Use_Idxqsort");
    }
  if(Use_IdxqsortSt ){
      fprintf(FPFLAGS,"%s\n","Use_IdxqsortSt");
    }
  if(Use_Iif ){
      fprintf(FPFLAGS,"%s\n","Use_Iif");
    }
  if(Use_Inchr ){
      fprintf(FPFLAGS,"%s\n","Use_Inchr");
    }
  if(Use_Infobox ){
      fprintf(FPFLAGS,"%s\n","Use_Infobox");
    }
  if(Use_Inkey ){
      fprintf(FPFLAGS,"%s\n","Use_Inkey");
    }
  if(Use_InkeyD ){
      fprintf(FPFLAGS,"%s\n","Use_InkeyD");
    }
  if(Use_Infobox ){
      fprintf(FPFLAGS,"%s\n","Use_Infobox");
    }
  if(Use_Inputbox ){
      fprintf(FPFLAGS,"%s\n","Use_Inputbox");
    }
  if(Use_Ins ){
      fprintf(FPFLAGS,"%s\n","Use_Ins");
    }
  if(Use_Instr ){
      fprintf(FPFLAGS,"%s\n","Use_Instr");
    }
  if(Use_InstrAny ){
      fprintf(FPFLAGS,"%s\n","Use_InstrAny");
    }
  if(Use_Instrrev ){
      fprintf(FPFLAGS,"%s\n","Use_Instrrev");
    }
  if(Use_IRemove ){
      fprintf(FPFLAGS,"%s\n","Use_IRemove");
    }
  if(Use_iReplace ){
      fprintf(FPFLAGS,"%s\n","Use_iReplace");
    }
  if(Use_Join ){
      fprintf(FPFLAGS,"%s\n","Use_Join");
    }
  if(Use_Keypress ){
      fprintf(FPFLAGS,"%s\n","Use_Keypress");
    }
  if(Use_Label ){
      fprintf(FPFLAGS,"%s\n","Use_Label");
    }
  if(Use_LCaseTbl ){
      fprintf(FPFLAGS,"%s\n","Use_LCaseTbl");
    }
  if(Use_Lcase ){
      fprintf(FPFLAGS,"%s\n","Use_Lcase");
    }
  if(Use_LccPath ){
      fprintf(FPFLAGS,"%s\n","Use_LccPath");
    }
  if(Use_Left ){
      fprintf(FPFLAGS,"%s\n","Use_Left");
    }
  if(Use_LeftStr ){
      fprintf(FPFLAGS,"%s\n","Use_LeftStr");
    }
  if(Use_Like ){
      fprintf(FPFLAGS,"%s\n","Use_Like");
    }
  if(Use_Listbox ){
      fprintf(FPFLAGS,"%s\n","Use_Listbox");
    }
  if(Use_ListBoxLoadFile ){
      fprintf(FPFLAGS,"%s\n","Use_ListBoxLoadFile");
    }
  if(Use_Listview ){
      fprintf(FPFLAGS,"%s\n","Use_Listview");
    }
  if(Use_LoadFile ){
      fprintf(FPFLAGS,"%s\n","Use_LoadFile");
    }
  if(Use_Loc ){
      fprintf(FPFLAGS,"%s\n","Use_Loc");
    }
  if(Use_Locate ){
      fprintf(FPFLAGS,"%s\n","Use_Locate");
    }
  if(Use_Lof ){
      fprintf(FPFLAGS,"%s\n","Use_Lof");
    }
  if(Use_Longestline ){
      fprintf(FPFLAGS,"%s\n","Use_Longestline");
    }
  if(Use_Lpad ){
      fprintf(FPFLAGS,"%s\n","Use_Lpad");
    }
  if(Use_Ltrim ){
      fprintf(FPFLAGS,"%s\n","Use_Ltrim");
    }
  if(Use_Max ){
      fprintf(FPFLAGS,"%s\n","Use_Max");
    }
  if(Use_Mcase ){
      fprintf(FPFLAGS,"%s\n","Use_Mcase");
    }
  if(Use_Mid ){
      fprintf(FPFLAGS,"%s\n","Use_Mid");
    }
  if(Use_Midstr ){
      fprintf(FPFLAGS,"%s\n","Use_Midstr");
    }
  if(Use_Min ){
      fprintf(FPFLAGS,"%s\n","Use_Min");
    }
  if(Use_Mkd ){
      fprintf(FPFLAGS,"%s\n","Use_Mkd");
    }
  if(Use_Mki ){
      fprintf(FPFLAGS,"%s\n","Use_Mki");
    }
  if(Use_Mkl ){
      fprintf(FPFLAGS,"%s\n","Use_Mkl");
    }
  if(Use_Mkld ){
      fprintf(FPFLAGS,"%s\n","Use_Mkld");
    }
  if(Use_Mks ){
      fprintf(FPFLAGS,"%s\n","Use_Mks");
    }
  if(Use_Mkpath ){
      fprintf(FPFLAGS,"%s\n","Use_Mkpath");
    }
  if(Use_Modstyle ){
      fprintf(FPFLAGS,"%s\n","Use_Modstyle");
    }
  if(Use_Msgbox ){
      fprintf(FPFLAGS,"%s\n","Use_Msgbox");
    }
  if(Use_Nextlinelen ){
      fprintf(FPFLAGS,"%s\n","Use_Nextlinelen");
    }
  if(Use_Now ){
      fprintf(FPFLAGS,"%s\n","Use_Now");
    }
  if(Use_Numqsortadouble ){
      fprintf(FPFLAGS,"%s\n","Use_Numqsortadouble");
    }
  if(Use_Numqsortafloat ){
      fprintf(FPFLAGS,"%s\n","Use_Numqsortafloat");
    }
  if(Use_Numqsortaint ){
      fprintf(FPFLAGS,"%s\n","Use_Numqsortaint");
    }
  if(Use_Numqsortddouble ){
      fprintf(FPFLAGS,"%s\n","Use_Numqsortddouble");
    }
  if(Use_Numqsortdfloat ){
      fprintf(FPFLAGS,"%s\n","Use_Numqsortdfloat");
    }
  if(Use_Numqsortdint ){
      fprintf(FPFLAGS,"%s\n","Use_Numqsortdint");
    }
  if(Use_Oct ){
      fprintf(FPFLAGS,"%s\n","Use_Oct");
    }
  if(Use_OSVersion ){
      fprintf(FPFLAGS,"%s\n","Use_OSVersion");
    }
  if(Use_Panel ){
      fprintf(FPFLAGS,"%s\n","Use_Panel");
    }
  if(Use_Pause ){
      fprintf(FPFLAGS,"%s\n","Use_Pause");
    }
  if(Use_PeekStr ){
      fprintf(FPFLAGS,"%s\n","Use_PeekStr");
    }
  if(Use_PellesPath ){
      fprintf(FPFLAGS,"%s\n","Use_PellesPath");
    }
  if(Use_PlayWav ){
      fprintf(FPFLAGS,"%s\n","Use_PlayWav");
    }
  if(Use_Pos ){
      fprintf(FPFLAGS,"%s\n","Use_Pos");
    }
  if(UseCpp ){
      fprintf(FPFLAGS,"%s\n","UseCpp");
    }
  if(Use_Printer ){
      fprintf(FPFLAGS,"%s\n","Use_Printer");
    }
  if(Use_ProgressBar ){
      fprintf(FPFLAGS,"%s\n","Use_ProgressBar");
    }
  if(Use_PtrqsortSt ){
      fprintf(FPFLAGS,"%s\n","Use_PtrqsortSt");
    }
  if(Use_QBColor ){
      fprintf(FPFLAGS,"%s\n","Use_QBColor");
    }
  if(Use_Radio ){
      fprintf(FPFLAGS,"%s\n","Use_Radio");
    }
  if(Use_Randomize ){
      fprintf(FPFLAGS,"%s\n","Use_Randomize");
    }
  if(Use_Rec ){
      fprintf(FPFLAGS,"%s\n","Use_Rec");
    }
  if(Use_RecCount ){
      fprintf(FPFLAGS,"%s\n","Use_RecCount");
    }
  if(Use_RegInt ){
      fprintf(FPFLAGS,"%s\n","Use_RegInt");
    }
  if(Use_RegString ){
      fprintf(FPFLAGS,"%s\n","Use_RegString");
    }
  if(Use_Remain ){
      fprintf(FPFLAGS,"%s\n","Use_Remain");
    }
  if(Use_Remove ){
      fprintf(FPFLAGS,"%s\n","Use_Remove");
    }
  if(Use_RemoveAny ){
      fprintf(FPFLAGS,"%s\n","Use_RemoveAny");
    }
  if(Use_Repeat ){
      fprintf(FPFLAGS,"%s\n","Use_Repeat");
    }
  if(Use_Replace ){
      fprintf(FPFLAGS,"%s\n","Use_Replace");
    }
  if(Use_ReplaceAny ){
      fprintf(FPFLAGS,"%s\n","Use_ReplaceAny");
    }
  if(Use_Retain ){
      fprintf(FPFLAGS,"%s\n","Use_Retain");
    }
  if(Use_Reverse ){
      fprintf(FPFLAGS,"%s\n","Use_Reverse");
    }
  if(Use_Richedit ){
      fprintf(FPFLAGS,"%s\n","Use_Richedit");
    }
  if(Use_Right ){
      fprintf(FPFLAGS,"%s\n","Use_Right");
    }
  if(Use_RightStr ){
      fprintf(FPFLAGS,"%s\n","Use_RightStr");
    }
  if(Use_Rnd ){
      fprintf(FPFLAGS,"%s\n","Use_Rnd");
    }
  if(Use_Rnd2 ){
      fprintf(FPFLAGS,"%s\n","Use_Rnd2");
    }
  if(Use_Round ){
      fprintf(FPFLAGS,"%s\n","Use_Round");
    }
  if(Use_Rpad ){
      fprintf(FPFLAGS,"%s\n","Use_Rpad");
    }
  if(Use_Rtrim ){
      fprintf(FPFLAGS,"%s\n","Use_Rtrim");
    }
  if(Use_Run ){
      fprintf(FPFLAGS,"%s\n","Use_Run");
    }
  if(Use_SaveBmp ){
      fprintf(FPFLAGS,"%s\n","Use_SaveBmp");
    }
  if(Use_Scan ){
      fprintf(FPFLAGS,"%s\n","Use_Scan");
    }
  if(Use_Screen ){
      fprintf(FPFLAGS,"%s\n","Use_Screen");
    }
  if(Use_SearchPath ){
      fprintf(FPFLAGS,"%s\n","Use_SearchPath");
    }
  if(Use_SetColor ){
      fprintf(FPFLAGS,"%s\n","Use_SetColor");
    }
  if(Use_Setclientsize ){
      fprintf(FPFLAGS,"%s\n","Use_Setclientsize");
    }
  if(Use_SetDimension ){
      fprintf(FPFLAGS,"%s\n","Use_SetDimension");
    }
  if(Use_SetFont ){
      fprintf(FPFLAGS,"%s\n","Use_SetFont");
    }
  if(Use_SetFormColor ){
      fprintf(FPFLAGS,"%s\n","Use_SetFormColor");
    }
  if(Use_SetText ){
      fprintf(FPFLAGS,"%s\n","Use_SetText");
    }
  if(Use_Set_BCX_Bitmap ){
      fprintf(FPFLAGS,"%s\n","Use_Set_BCX_Bitmap");
    }
  if(Use_Set_BCX_Bitmap2 ){
      fprintf(FPFLAGS,"%s\n","Use_Set_BCX_Bitmap2");
    }
  if(Use_Newbmp ){
      fprintf(FPFLAGS,"%s\n","Use_Newbmp");
    }
  if(Use_Makebmp ){
      fprintf(FPFLAGS,"%s\n","Use_Makebmp");
    }
  if(Use_Makehdc ){
      fprintf(FPFLAGS,"%s\n","Use_Makehdc");
    }
  if(Use_Set_BCX_BmpButton ){
      fprintf(FPFLAGS,"%s\n","Use_Set_BCX_BmpButton");
    }
  if(Use_Set_BCX_Icon ){
      fprintf(FPFLAGS,"%s\n","Use_Set_BCX_Icon");
    }
  if(Use_Sgn ){
      fprintf(FPFLAGS,"%s\n","Use_Sgn");
    }
  if(Use_Sound ){
      fprintf(FPFLAGS,"%s\n","Use_Sound");
    }
  if(Use_Space ){
      fprintf(FPFLAGS,"%s\n","Use_Space");
    }
  if(Use_Split ){
      fprintf(FPFLAGS,"%s\n","Use_Split");
    }
  if(Use_Status ){
      fprintf(FPFLAGS,"%s\n","Use_Status");
    }
  if(Use_Str ){
      fprintf(FPFLAGS,"%s\n","Use_Str");
    }
  if(Use_Strim ){
      fprintf(FPFLAGS,"%s\n","Use_Strim");
    }
  if(Use_String ){
      fprintf(FPFLAGS,"%s\n","Use_String");
    }
  if(Use_Stristr ){
      fprintf(FPFLAGS,"%s\n","Use_Stristr");
    }
  if(Use_Strl ){
      fprintf(FPFLAGS,"%s\n","Use_Strl");
    }
  if(Use_Strqsorta ){
      fprintf(FPFLAGS,"%s\n","Use_Strqsorta");
    }
  if(Use_Strqsortas ){
      fprintf(FPFLAGS,"%s\n","Use_Strqsortas");
    }
  if(Use_Strqsortd ){
      fprintf(FPFLAGS,"%s\n","Use_Strqsortd");
    }
  if(Use_Strqsortds ){
      fprintf(FPFLAGS,"%s\n","Use_Strqsortds");
    }
  if(Use_Strtoken ){
      fprintf(FPFLAGS,"%s\n","Use_Strtoken");
    }
  if(Use_Swap ){
      fprintf(FPFLAGS,"%s\n","Use_Swap");
    }
  if(Use_Sysdir ){
      fprintf(FPFLAGS,"%s\n","Use_Sysdir");
    }
  if(Use_SysStr ){
      fprintf(FPFLAGS,"%s\n","Use_SysStr");
    }
  if(Use_sziif ){
      fprintf(FPFLAGS,"%s\n","Use_sziif");
    }
  if(Use_Tally ){
      fprintf(FPFLAGS,"%s\n","Use_Tally");
    }
  if(Use_Tix ){
      fprintf(FPFLAGS,"%s\n","Use_Tix");
    }
  if(Use_Tempdir ){
      fprintf(FPFLAGS,"%s\n","Use_Tempdir");
    }
  if(Use_TempFileName ){
      fprintf(FPFLAGS,"%s\n","Use_TempFileName");
    }
  if(Use_Textmode ){
      fprintf(FPFLAGS,"%s\n","Use_Textmode");
    }
  if(Use_Time ){
      fprintf(FPFLAGS,"%s\n","Use_Time");
    }
  if(Use_Timer ){
      fprintf(FPFLAGS,"%s\n","Use_Timer");
    }
  if(Use_Treeview ){
      fprintf(FPFLAGS,"%s\n","Use_Treeview");
    }
  if(Use_Trim ){
      fprintf(FPFLAGS,"%s\n","Use_Trim");
    }
  if(Use_Ucase ){
      fprintf(FPFLAGS,"%s\n","Use_Ucase");
    }
  if(Use_Using ){
      fprintf(FPFLAGS,"%s\n","Use_Using");
    }
  if(Use_Utf8tochr ){
      fprintf(FPFLAGS,"%s\n","Use_Utf8tochr");
    }
  if(Use_VBS ){
      fprintf(FPFLAGS,"%s\n","Use_VBS");
    }
  if(Use_VChr ){
      fprintf(FPFLAGS,"%s\n","Use_VChr");
    }
  if(Use_Verify ){
      fprintf(FPFLAGS,"%s\n","Use_Verify");
    }
  if(Use_Whiterect ){
      fprintf(FPFLAGS,"%s\n","Use_Whiterect");
    }
  if(Use_WideToAnsi ){
      fprintf(FPFLAGS,"%s\n","Use_WideToAnsi");
    }
  if(Use_Windir ){
      fprintf(FPFLAGS,"%s\n","Use_Windir");
    }
  if(FPFLAGS)
   {
     fclose(FPFLAGS);
     FPFLAGS=NULL;
   }
}
