This is a demo I created with my bc9Basic -> c/c++ translator and compiled with VS2013 Express.
James
Edit:
This is the code produced by bc9Basic:
// *********************************************************************
// Created with bc9Basic - BASIC To C/C++ Translator (V) 9.1.8.8 (2014/06/17)
// The bc9Basic translator (bc9.exe) was compiled with
// g++ (tdm64-2) 4.8.1
// ----------------------------------------------------------------------
// BCX (c) 1999 - 2009 by Kevin Diggins
// *********************************************************************
// Translated for compiling with a C Compiler
// On MS Windows
// *********************************************************************
#include <windows.h> // Win32 Header File
#include <windowsx.h> // Win32 Header File
#include <commctrl.h> // Win32 Header File
#include <commdlg.h> // Win32 Header File
#include <mmsystem.h> // Win32 Header File
#include <shellapi.h> // Win32 Header File
#include <shlobj.h> // Win32 Header File
#include <richedit.h> // Win32 Header File
#include <objbase.h> // Win32 Header File
#include <ocidl.h> // Win32 Header File
#include <winuser.h> // Win32 Header File
#include <olectl.h> // Win32 Header File
#include <oaidl.h> // Win32 Header File
#include <ole2.h> // Win32 Header File
#include <oleauto.h> // Win32 Header File
#include <winsock.h> // Win32 Header File
#include <process.h> // dos
#include <direct.h> // dos
#include <io.h> // dos
#include <conio.h> // dos
#include <wchar.h> // dos/linux
#include <ctype.h> // dos/linux
#include <fcntl.h> // dos/linux
#include <math.h> // dos/linux
#include <stdio.h> // dos/linux
#include <string.h> // dos/linux
#include <stddef.h> // dos/linux
#include <stdlib.h> // dos/linux
#include <setjmp.h> // dos/linux
#include <time.h> // dos/linux
#include <stdarg.h> // dos/linux
#include <sys/types.h>
#include <sys/stat.h>
// ***************************************************
// Compiler Defines
// ***************************************************
// C++
#if defined( __cplusplus )
#define overloaded
#define C_EXPORT EXTERN_C __declspec(dllexport)
#define C_IMPORT EXTERN_C __declspec(dllimport)
#else
#define C_EXPORT __declspec(dllexport)
#define C_IMPORT __declspec(dllimport)
#endif
// 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
// $HEADER BEGIN
#pragma comment(lib,"iup.lib")
#pragma comment(lib,"iupcontrols.lib")
#pragma comment(lib,"iupcd.lib")
#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
// $HEADER END
#include "iup.h"
// *************************************************
// Instruct Linker to Search Object/Import Libraries
// *************************************************
#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,"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")
// *************************************************
// End of Object/Import Libraries To Search
// *************************************************
// *************************************************
// User's GLOBAL ENUM blocks
// *************************************************
// *************************************************
// System Defined Constants
// *************************************************
typedef const char* ccptr;
#define CCPTR const char*
#define cfree free
#define WAITKEY system("pause")
#define cSizeOfDefaultString 2048
// *************************************************
// User Defined Constants
// *************************************************
// *************************************************
// Standard Prototypes
// *************************************************
char* BCX_TmpStr(size_t, size_t , int );
char* join (int, ... );
char* enc (const char*, int , int );
// *************************************************
// User Defined Types And Unions
// *************************************************
// *************************************************
// System Variables
// *************************************************
// *************************************************
// User Global Variables
// *************************************************
static PCHAR *g_argv;
static int g_argc;
// *************************************************
// User Prototypes
// *************************************************
int main (int, PCHAR*);
long quit_cb (void);
void AddChild (Ihandle* , Ihandle*);
Ihandle* Create (char *, char *, Ihandle*);
// *************************************************
// User Global Initialized Arrays
// *************************************************
// *************************************************
// Runtime Functions
// *************************************************
#ifndef BCXTmpStrSize
#define BCXTmpStrSize 2048
#endif
char *BCX_TmpStr (size_t Bites, size_t iPad, int iAlloc)
{
static int StrCnt;
static char *StrFunc[BCXTmpStrSize];
StrCnt = (StrCnt + 1) & (BCXTmpStrSize - 1);
if(StrFunc[StrCnt]) {
free (StrFunc[StrCnt]);
StrFunc[StrCnt] = NULL;
}
#if defined BCX_MAX_VAR_SIZE
if(Bites * sizeof(char) > BCX_MAX_VAR_SIZE)
{
printf("Buffer Overflow caught in BCX_TmpStr - requested space of %d EXCEEDS %d\n", (int)(Bites * sizeof(char)), BCX_MAX_VAR_SIZE);
abort();
}
#endif
if(iAlloc) StrFunc[StrCnt] = (char*)calloc(Bites + iPad + 1, sizeof(char));
return StrFunc[StrCnt];
}
char *enc (const char *A, int L, int R)
{
register int tmplen = strlen(A);
register char *BCX_RetStr = BCX_TmpStr(tmplen + 3, 1, 1);
memcpy(BCX_RetStr + 1, 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 * join(int n, ...)
{
register int i = n, tmplen = 0;
register char *s_;
register char *strtmp;
va_list marker;
va_start(marker, n); // Initialize variable arguments
while(i-- > 0)
{
s_ = va_arg(marker, char *);
if(s_) tmplen += strlen(s_);
}
strtmp = BCX_TmpStr(tmplen, 1, 1);
va_end(marker); // Reset variable arguments
i = n;
va_start(marker, n); // Initialize variable arguments
while(i-- > 0)
{
s_ = va_arg(marker, char *);
if(s_) strcat(strtmp, s_);
}
va_end(marker); // Reset variable arguments
return strtmp;
}
// ************************************
// User Subs and Functions
// ************************************
int main (int argc, PCHAR* argv)
{
g_argc = argc;
g_argv = argv;
Ihandle* win;
Ihandle* vbox;
Ihandle* topBox;
Ihandle* serverFrame;
Ihandle* serverBox;
Ihandle* serverCombo;
Ihandle* btnFetch;
Ihandle* controlFrame;
Ihandle* controlBox;
Ihandle* btnAbout;
Ihandle* btnClear;
Ihandle* btnExit;
Ihandle* dictFrame;
Ihandle* serverList;
Ihandle* transFrame;
Ihandle* text;
Ihandle* bottomBox;
Ihandle* label;
Ihandle* entry;
Ihandle* btnSearch;
Ihandle* chkAll;
Ihandle* chkUTF;
IupOpen(0, 0);
win = Create("dialog", "TITLE=Thesaurus, SIZE=500x300", NULL);
vbox = Create("vbox", "MARGIN=10x10", NULL);
topBox = Create("hbox", " GAP=10", vbox);
serverFrame = Create("frame", "TITLE=Servers, EXPAND=YES", topBox);
serverBox = Create("hbox", "GAP=5", serverFrame);
serverCombo = Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox);
btnFetch = Create("button", "TITLE=Fetch, SIZE = 50x", serverBox);
controlFrame = Create("frame", "TITLE=Controls", topBox);
controlBox = Create("hbox", "Margin=6x6, GAP=5", controlFrame);
btnAbout = Create("button", "TITLE=About, SIZE = 50x", controlBox);
btnClear = Create("button", "TITLE=Clear, SIZE = 50x", controlBox);
btnExit = Create("button", "TITLE=Exit, SIZE = 50x", controlBox);
IupSetCallback(btnExit, "ACTION", (Icallback)quit_cb);
dictFrame = Create("frame", "TITLE=Dictionaries", vbox);
serverList = Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame);
transFrame = Create("frame", "TITLE=Translation", vbox);
text = Create("text", "MULTILINE=YES, EXPAND=YES", transFrame);
bottomBox = Create("hbox", "GAP=10", vbox);
label = Create("label", join( 3, "TITLE=", enc("Enter Word to Search For:", 34, 34), ", SIZE=x12"), bottomBox);
entry = Create("text", " EXPAND=HORIZONTAL", bottomBox);
btnSearch = Create("button", "TITLE=Search, SIZE=50x", bottomBox);
chkAll = Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox);
chkUTF = Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox);
AddChild(win, vbox);
IupShow(win);
IupSetFocus(btnFetch);
IupMainLoop();
IupClose();
}
long quit_cb (void)
{
return IUP_CLOSE;
}
void AddChild (Ihandle* parent, Ihandle* child)
{
IupAppend(parent, child);
IupRefresh(parent);
}
Ihandle* Create (char *Value, char *Attr, Ihandle* parent)
{
Ihandle* iHwnd = {0};
iHwnd = IupCreate( Value);;
if(iHwnd )
{
if(strlen(Attr))
{
IupSetAttributes(iHwnd, Attr);
}
if(parent )
{
AddChild(parent, iHwnd);
}
return iHwnd;
}
return NULL;
}