Open LADSoft opened 1 year ago
orangec handles those libraries a little differently anyway so it doesn't much matter about the pragma in this case. But I will make sure all the libraries in the list are handled...
no as a matter of fact I just pushed a version of the compiler that now compiles the code you gave me...
no as a matter of fact I just pushed a version of the compiler that now compiles the code you gave me...
Not my code. We are not the same person. For unknown reasons I was also censored, so I have to come back with a new acc.
This is the code generated by BCX that OrangeC not yet able to compile (I updated to latest CI build):
// *********************************************
// Made with BCX BASIC To C/C++ Translator
// Version 7.8.1 (02/07/2022)
// *********************************************
// Translated for compiling with a C Compiler
// *********************************************
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h> // WinApi
#include <windowsx.h> // WinApi
#include <commctrl.h> // WinApi
#include <commdlg.h> // WinApi
#include <direct.h> // WinApi
#include <mmsystem.h> // WinApi
#include <oaidl.h> // WinApi
#include <objbase.h> // WinApi
#include <ocidl.h> // WinApi
#include <ole2.h> // WinApi
#include <oleauto.h> // WinApi
#include <olectl.h> // WinApi
#include <richedit.h> // WinApi
#include <shellapi.h> // WinApi
#include <shlobj.h> // WinApi
#include <urlmon.h> // WinApi
#include <wchar.h> // WinApi
#include <tchar.h> // WinApi
#include <unknwn.h> // WinApi
#include <wininet.h> // WinApi
#include <winsock.h> // WinApi
#include <winuser.h> // WinApi
#include <stdbool.h> // ISO StdLib
#include <ctype.h> // ISO StdLib
#include <math.h> // ISO StdLib
#include <setjmp.h> // ISO StdLib
#include <stdarg.h> // ISO StdLib
#include <stddef.h> // ISO StdLib
#include <stdio.h> // ISO StdLib
#include <stdlib.h> // ISO StdLib
#include <string.h> // ISO StdLib
#include <time.h> // ISO StdLib
#include <process.h> // ISO StdLib
#include <inttypes.h> // ISO StdLib
#include <fcntl.h> // POSIX
#include <io.h> // WinNT POSIX subset
#include <conio.h> // Primitive i/o
// *************************************************
// Compiler Defines
// *************************************************
#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
#if (_MSC_VER >= 1900) // earlier versions untested
#include <intrin.h>
#ifndef _rdtsc
#define _rdtsc __rdtsc // MSVC uses 2 underscores
#endif
#pragma warning(disable: 4018) // signed/unsigned mismatch warnings
#pragma warning(disable: 4100) // unreferenced argument warnings
#pragma warning(disable: 4244) // conversion from type1 to type2 warnings
#pragma warning(disable: 4267) // conversion from type1 to type2 warnings
#pragma warning(disable: 4305) // truncation from double to float warnings
#pragma warning(disable: 4800) // forcing value to bool warnings
#pragma warning(disable: 4838) // conversion from type1 to type2 warnings
#endif
// *************************************************
// GCC and CLANG
// *************************************************
#if defined (__GNUC__) || defined (__clang__)
#ifndef __BCPLUSPLUS__
#include <x86intrin.h>
#endif
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wdangling-else"
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif
// *************************************************
// Embarcadero C++
// *************************************************
#if defined (__BCPLUSPLUS__)
#if defined (_clang__)
#include <mmintrin.h>
#endif
#define _kbhit kbhit
#ifndef _rdtsc
#define _rdtsc __rdtsc // Uses 2 underscores
#endif
#endif
// *************************************************
// Open Watcom
// *************************************************
#if defined (__WATCOM_CPLUSPLUS__)
#define _fcloseall fcloseall
#endif
// *************************************************
// Lcc-Win32
// *************************************************
#if defined( __LCC__)
#define _fseeki64 fseeki64
#define _stricmp stricmp
#define _strnicmp strnicmp
#define _itoa itoa
#define _ltoa ltoa
#include <intrinsics.h>
#include <malloc.h> // for _msize
#if defined( __windows_h__ )
#include <iehelper.h>
#include <exdisp.h>
#endif
#endif
// *************************************************
// Pelles C
// *************************************************
#if defined (__POCC__)
#include <intrin.h>
#pragma pack_stack(off) // Pelle's fix for a v10 optimization bug
#pragma warn(disable: 2006) // Non-portable conversion int to const char*
#pragma warn(disable: 2007) // Non-portable inline code
#pragma warn(disable: 2115) // Initialized but not used warnings
#pragma warn(disable: 2118) // Unreferenced argument warnings
#pragma warn(disable: 2134) // Possible infinite loop
#pragma warn(disable: 2154) // Buggy unreachable code warning using sizeof
#pragma warn(disable: 2197) // Unsigned long int not a std bit-field type
#pragma warn(disable: 2215) // Conversion from type1 to type2 warnings
#pragma warn(disable: 2218) // Unreferenced parameter
#pragma warn(disable: 2230) // Incomplete struct declarations (vbs support)
#pragma warn(disable: 2235) // Not all control paths return a value
#pragma warn(disable: 2241) // Function marked for deprecation
#pragma warn(disable: 2248) // Non-portable use of extension
#pragma warn(disable: 2251) // Types with different signedness
#pragma warn(disable: 2804) // Consider changing type to size_t warnings
#pragma warn(disable: 2805) // Possible anti-aliasing violation warnings
#pragma warn(disable: 2810) // Potential realloc warnings
#endif
// *************************************************
// Instruct Linker to Search Object/Import Libraries
// *************************************************
#if !(defined(__GNUC__))
#if !(defined(__BCPLUSPLUS__) && defined(_WIN64))
#if !defined( __LCC__ )
#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")
#pragma comment(lib,"wininet.lib")
#pragma comment(lib,"urlmon.lib")
#else
#pragma lib <winspool.lib>
#pragma lib <shell32.lib>
#pragma lib <ole32.lib>
#pragma lib <oleaut32.lib>
#pragma lib <uuid.lib>
#pragma lib <odbc32.lib>
#pragma lib <odbccp32.lib>
#pragma lib <winmm.lib>
#pragma lib <imagehlp.lib>
#pragma lib <version.lib>
#pragma lib <wininet.lib>
#pragma lib <urlmon.lib>
#endif
#endif
#endif
// *************************************************
// System Defined Constants
// *************************************************
#define BCXSTRSIZE 2048
// *************************************************
// User Defined Constants
// *************************************************
#define ID_Edit 100
#define ID_Exit 200
#define RAISED 1000
#define SUNKEN 2000
#define FLUSHED 3000
#define SHADOWED 4000
// *************************************************
// Standard Prototypes
// *************************************************
void BCX_SetMetric (LPCTSTR);
void BCX_RegWnd (LPCTSTR, WNDPROC);
void BCX_InitGUI (void);
HWND BCX_Form (LPCTSTR, int=0, int=0, int=250, int=150, int=-1, int=0);
void Center (HWND, HWND=0, HWND=0);
// *************************************************
// User's Global Variables
// *************************************************
static HFONT BcxFont;
static float BCX_ScaleX;
static float BCX_ScaleY;
static HINSTANCE BCX_hInstance;
static HWND BCX_hwndMDIClient;
static WNDCLASSEX BCX_WndClass;
static BOOL BCX_GUI_Init;
static char BCX_ClassName[BCXSTRSIZE];
// *************************************************
// Standard Macros
// *************************************************
#define DefFont ((BcxFont!=0)?BcxFont:(HFONT)SNDMSG(hWnd, WM_GETFONT, 0, 0))
#define DefaultFont ((DefFont==0)?GetStockObject(DEFAULT_GUI_FONT):DefFont)
#define Show(Window)RedrawWindow(Window,0,0,0);ShowWindow(Window,SW_SHOW);
// *************************************************
// User's Prototypes
// *************************************************
void FormLoad (void);
LRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);
LRESULT CALLBACK PaintHandler (HWND,UINT,WPARAM,LPARAM);
void ThreeDFrame (HDC,int,int,int,int,int);
// *************************************************
// Runtime Functions
// *************************************************
void Center (HWND hwnd, HWND Xhwnd, HWND Yhwnd) {
RECT rect, rectP;
int x, y, width, height;
int screenwidth, screenheight;
HMONITOR hMonitor={0};
MONITORINFO MonitorInfo={0};
GetWindowRect((HWND)hwnd, &rect);
width=rect.right-rect.left;
height=rect.bottom-rect.top;
if(GetSystemMetrics(SM_CMONITORS)==1) {
hMonitor=MonitorFromRect( &rect,MONITOR_DEFAULTTOPRIMARY);
}
else
{
hMonitor=MonitorFromRect( &rect,MONITOR_DEFAULTTONEAREST);
}
MonitorInfo.cbSize=sizeof(MONITORINFO);
GetMonitorInfo(hMonitor, &MonitorInfo);
if(Xhwnd==NULL) {
rect.left=MonitorInfo.rcWork.left+((MonitorInfo.rcWork.right-MonitorInfo.rcWork.left-width)/2);
rect.top=MonitorInfo.rcWork.top+((MonitorInfo.rcWork.bottom-MonitorInfo.rcWork.top-height)/2);
rect.right=rect.left+width;
rect.bottom=rect.top+height;
SetWindowPos(hwnd,NULL,rect.left,rect.top,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
return;
}
GetWindowRect(hwnd, &rect);
GetWindowRect(Xhwnd, &rectP);
width=rect.right-rect.left;
x=((rectP.right-rectP.left)-width)*0.5+rectP.left;
if(Yhwnd==NULL) {
height=rect.bottom-rect.top;
y=((rectP.bottom-rectP.top)-height)*0.5+rectP.top;
}
else
{
GetWindowRect(Yhwnd, &rectP);;
height=rect.bottom-rect.top;;
y=((rectP.bottom-rectP.top)-height)*0.5+rectP.top;;
}
screenwidth=MonitorInfo.rcWork.right;
screenheight=MonitorInfo.rcWork.bottom;
if(x<MonitorInfo.rcWork.left) {
x=MonitorInfo.rcWork.left+(width/2);
}
if(y<MonitorInfo.rcWork.top) {
y=MonitorInfo.rcWork.top+(height/2);
}
if(((x+width>screenwidth))) {
x=screenwidth-width;;
}
if(((y+height>screenheight))) {
y=screenheight-height;;
}
MoveWindow (hwnd, x, y, width, height, FALSE);
}
HWND BCX_Form (LPCTSTR Caption, int X, int Y, int W, int H, int Style, int Exstyle) {
if (Style == -1) Style = WS_MINIMIZEBOX|WS_SIZEBOX|WS_CAPTION|WS_MAXIMIZEBOX|WS_POPUP|WS_SYSMENU;
HWND A = CreateWindowEx(Exstyle, BCX_ClassName, Caption, Style, X*BCX_ScaleX, Y*BCX_ScaleY,
BCX_ScaleX*(4+W), BCX_ScaleY*(12+H), NULL,(HMENU)(UINT_PTR)NULL, BCX_hInstance, NULL);
SendMessage (A,(UINT_PTR) WM_SETFONT, (WPARAM)((BcxFont==0) ? GetStockObject
(DEFAULT_GUI_FONT):BcxFont), (LPARAM) MAKELPARAM(FALSE, 0));
return A;
}
void BCX_SetMetric (LPCTSTR metric) {
if (!BCX_GUI_Init)
BCX_InitGUI();
if (_stricmp(metric,"PIXELS")==0)
{
BCX_ScaleX = 1;
BCX_ScaleY = 1;
}
else if (_stricmp((char*)metric,"DPI")==0)
{
HDC hDc = GetDC(0);
BCX_ScaleX = ( GetDeviceCaps( hDc, LOGPIXELSX) / 96.0f);
BCX_ScaleY = ( GetDeviceCaps( hDc, LOGPIXELSY) / 96.0f);
ReleaseDC(0, hDc);
}
else
{
RECT rc = {0,0,4,8};
MapDialogRect(NULL,&rc);
BCX_ScaleX = rc.right* 0.5;
BCX_ScaleY = rc.bottom/4;
}
}
void BCX_RegWnd (LPCTSTR classname, WNDPROC Form_WndProc) {
if (classname[0]==0)
{
MessageBox (GetActiveWindow(),
"Empty String For BCX_ClassName NOT Allowed",
"Empty ClassName",0);
fflush(stdout);
ExitProcess(1);
}
if (GetClassInfoEx( BCX_hInstance, classname, &BCX_WndClass)!=0)
{
if (!Form_WndProc)
UnregisterClass(classname,BCX_hInstance);
return;
}
if (!BCX_GUI_Init)
BCX_InitGUI();
if (BCX_ScaleX == 0 && BCX_ScaleY == 0)
BCX_SetMetric("Pixels");
strcpy(BCX_ClassName,classname);
BCX_WndClass.lpfnWndProc = Form_WndProc;
BCX_WndClass.hInstance = BCX_hInstance;
BCX_WndClass.lpszClassName = classname;
RegisterClassEx(&BCX_WndClass);
}
void BCX_InitGUI (void) {
INITCOMMONCONTROLSEX iccex;
if (BCX_GUI_Init)
return;
RECT rc = {0, 0, 4, 8};
MapDialogRect(NULL, &rc);
BCX_ScaleX = rc.right* 0.5;
BCX_ScaleY = rc.bottom/4;
BCX_hInstance = GetModuleHandle(NULL);
BCX_hwndMDIClient = NULL;
BCX_WndClass.cbSize = sizeof(BCX_WndClass);
BCX_WndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
BCX_WndClass.cbClsExtra = 0;
BCX_WndClass.cbWndExtra = 0;
BCX_WndClass.hIcon = LoadIcon(NULL,IDI_WINLOGO);;
BCX_WndClass.hCursor = LoadCursor(NULL, IDC_ARROW);
BCX_WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
BCX_WndClass.lpszMenuName = NULL;
BCX_WndClass.hIconSm = NULL;
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccex.dwICC=ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES |
ICC_BAR_CLASSES | ICC_TAB_CLASSES | ICC_UPDOWN_CLASS |
ICC_PROGRESS_CLASS | ICC_USEREX_CLASSES | ICC_DATE_CLASSES;
InitCommonControlsEx(&iccex);
OleInitialize(0);
CoInitialize(0);
BCX_GUI_Init = TRUE;
}
// *************************************************
// User's Subs and Functions
// *************************************************
void FormLoad (void)
{
HMENU MainMenu={0};
HMENU FileMenu={0};
HWND Form1={0};
Form1=BCX_Form("3D Frames Demo",6,18,310,120,DS_MODALFRAME|WS_POPUP|WS_CAPTION|WS_SYSMENU);
MainMenu=CreateMenu();
FileMenu=CreateMenu();
AppendMenu(FileMenu,MF_STRING,ID_Exit,"E&xit");
InsertMenu(MainMenu,ID_Edit,MF_POPUP,(UINT_PTR)FileMenu,"File");
SetMenu(Form1,MainMenu);
Center(Form1);
Show(Form1);
}
LRESULT CALLBACK WndProc (HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
if(Msg==WM_COMMAND ){
if(LOWORD(wParam)==ID_Exit ){
DestroyWindow(hWnd);
}
goto L1000;
}
if(Msg==WM_PAINT ){
PaintHandler(hWnd,Msg,wParam,lParam);
goto L1000;
}
if(Msg==WM_CLOSE ){
DestroyWindow(hWnd);
return 0;
}
if(Msg==WM_DESTROY ){
PostQuitMessage(0);
return 0;
}
L1000:;
if(Msg==WM_DESTROY)
{
OleUninitialize();
CoUninitialize();
PostQuitMessage(0);
return EXIT_SUCCESS;
}
return DefWindowProc(hWnd,Msg,wParam,lParam); // endevents
}
LRESULT CALLBACK PaintHandler (HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam)
{
PAINTSTRUCT ps={0};
HDC hdcMainWnd={0};
int BkColorVal={0};
int TxtColorVal={0};
hdcMainWnd=BeginPaint(hWnd, &ps);
ThreeDFrame(hdcMainWnd,10,10,610,200,RAISED);
ThreeDFrame(hdcMainWnd,15,15,605,195,SUNKEN);
ThreeDFrame(hdcMainWnd,25,25,595,175,FLUSHED);
ThreeDFrame(hdcMainWnd,25,25,595,185,SHADOWED);
BkColorVal=SetBkColor(hdcMainWnd,RGB(255,255,255));
TxtColorVal=SetTextColor(hdcMainWnd,RGB(80,0,0));
TextOut(hdcMainWnd,190,60,"3D Frame Demo using BCX !",25);
TxtColorVal=SetTextColor(hdcMainWnd,RGB(0,80,0));
TextOut(hdcMainWnd,160,85,"Attractive 3-D Effects are easy with BCX !",42);
TxtColorVal=SetTextColor(hdcMainWnd,RGB(0,0,80));
TextOut(hdcMainWnd,170,110,"BCX -- The Free Basic To C Translator",37);
EndPaint(hWnd, &ps);
UpdateWindow(hWnd);
return 0;
}
void ThreeDFrame (HDC hDC,int nLeft,int nTop,int nRight,int nBottom,int nStyle)
{
HPEN hPen={0};
if(nStyle==RAISED ){
hPen=CreatePen(PS_SOLID,1,RGB(80,80,80));
SelectObject(hDC,hPen);
MoveToEx(hDC,nLeft,nBottom,NULL);
LineTo(hDC,nRight,nBottom);
LineTo(hDC,nRight,nTop);
SelectObject(hDC,GetStockObject(WHITE_PEN));
LineTo(hDC,nLeft,nTop);
LineTo(hDC,nLeft,nBottom);
goto L1001;
}
if(nStyle==SUNKEN ){
hPen=CreatePen(PS_SOLID,1,RGB(80,80,80));
SelectObject(hDC,hPen);
SelectObject(hDC,GetStockObject(WHITE_PEN));
MoveToEx(hDC,nLeft,nTop,NULL);
LineTo(hDC,nLeft,nBottom);
MoveToEx(hDC,nLeft,nTop,NULL);
LineTo(hDC,nRight,nTop);
SelectObject(hDC,GetStockObject(WHITE_PEN));
LineTo(hDC,nRight,nBottom);
LineTo(hDC,nLeft,nBottom);
goto L1001;
}
if(nStyle==FLUSHED ){
hPen=CreatePen(PS_SOLID,1,RGB(80,80,80));
SelectObject(hDC,hPen);
SelectObject(hDC,GetStockObject(NULL_BRUSH));
Rectangle(hDC,nLeft,nTop,nRight,nBottom);
SelectObject(hDC,GetStockObject(WHITE_PEN));
Rectangle(hDC,++nLeft,++nTop,++nRight,++nBottom);
goto L1001;
}
if(nStyle==SHADOWED ){
SelectObject(hDC,GetStockObject(NULL_PEN));
SelectObject(hDC,GetStockObject(GRAY_BRUSH));
Rectangle(hDC,nLeft+2,nTop+2,nRight+2,nBottom+2);
SelectObject(hDC,GetStockObject(BLACK_PEN));
SelectObject(hDC,GetStockObject(WHITE_BRUSH));
Rectangle(hDC,nLeft-2,nTop-2,nRight-2,nBottom-2);
goto L1001;
}
L1001:;
DeleteObject(hPen);
}
int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR CmdLine,int CmdShow) {
MSG Msg;
strcpy(BCX_ClassName,"FrameDemo");
BCX_SetMetric("");
BCX_InitGUI();
BCX_hInstance = hInst;
BCX_WndClass.hIcon = LoadIcon(NULL,IDI_WINLOGO);
BCX_RegWnd( BCX_ClassName, WndProc );
// ******************************************
FormLoad();
// ******************************************
while(GetMessage(&Msg,NULL,0,0))
{
HWND hActiveWindow = GetActiveWindow();
if(!IsWindow(hActiveWindow) || !IsDialogMessage(hActiveWindow,&Msg))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
return Msg.wParam;
}
The error is (the same error as previous builds):
Error( 11) 3D.c(218): Syntax error: ) expected
Error( 11) 3D.c(219): Syntax error: ) expected
Error( 99) 3D.c(256): Type mismatch in redeclaration of function 'Center'
Warning( 39) 3D.c(219): Previous declaration of 'Center' here
Error( 99) 3D.c(315): Type mismatch in redeclaration of function 'BCX_Form'
Warning( 39) 3D.c(218): Previous declaration of 'BCX_Form' here
Error(112) 3D.c(418): Argument list too short in call to 'BCX_Form'
Error(112) 3D.c(424): Argument list too short in call to 'Center'
6 Errors
I also suggested you to handle pragma comment lib in a way that ignore the .lib extension and use the appropriate .l extension when searching for libraries instead so the code will be able to be compiled as is without change. As it's generated by BCX and BCX doesn't support OrangeC so this is the most seamless path to handle thing.
Please have a look at my problems. Thank you.
I'm sorry I was somewhat flustered that day - two or three people had just vanished along with all their issues and I had no idea what to make of that... so I didn't get to explain the results of this issue very well. What I probably should have done is remake the issue and comment appropriately but well I messed up. In my own defense though I was kinda going from memory at that point. But maybe I will add an issue later in case someone else needs to look in for a solution.
your code does compile/run with the latest version of occ, but you need some command line switches. you need '-x c++' to put occ in c++ mode and '/Wg' to use WinMain instead of main. I also took care of various microsoft library issues so that it wouldn't have linker errors, but again, orangec does libraries a little differently so ignoring the pragma libs is fine in this case.
so anyway try this:
occ -x c++ /Wg 3d.c
and see if that works ok.
I'm sorry I was somewhat flustered that day - two or three people had just vanished along with all their issues and I had no idea what to make of that... so I didn't get to explain the results of this issue very well. What I probably should have done is remake the issue and comment appropriately but well I messed up. In my own defense though I was kinda going from memory at that point. But maybe I will add an issue later in case someone else needs to look in for a solution.
your code does compile/run with the latest version of occ, but you need some command line switches. you need '-x c++' to put occ in c++ mode and '/Wg' to use WinMain instead of main. I also took care of various microsoft library issues so that it wouldn't have linker errors, but again, orangec does libraries a little differently so ignoring the pragma libs is fine in this case.
so anyway try this:
occ -x c++ /Wg 3d.c
and see if that works ok.
It worked. Thank you.
This may be useful when I implement #772 as I'm thinking about doing the sdk the 'standard' way and having a myriad number of .lib files...
I've FINALLY gotten around to this, 99% done, quick question though: in the preprocessor system is there any good way to get the completed concatenated string from the tokenizer or should I go ahead and implement it OR should I create a static function to go ahead and chew until there's a non-string and just return a concatenated string (plus the next token) as a tuple? There's a few ways I think I can go about this but I just want your confirmation on the go ahead.
Other questions: Are there any easy ways for me to leave pragmas for the main compiler because some of the comment pragmas (e.g. pragma comment(user, "string")
dumps the string into the object file, or pragma comment(linker, "string")
specifies specific commands to the linker, the latter I'm sure is already possible, the former I'm not so sure...
string concatentation is done inside the compiler rather than inside the preprocessor; so the concatenated strings wouldn't be directly accessible in the preprocessor.
on pragmas, if the preprocessor doesn't know a pragma it calls ppPragma::catchAll on line 98 of ppPragma.cpp. That calls back to the SetPragmaCatchall call in occparse.cpp (somewhere around line 572) where it gets entered in a table called 'bePragmas'. 'bePragmas' gets propagated through the various compiler modules (streaming through the icf files) although currently it seems like it is not processed anywhere. You could intercept it in the 'occ' project for example since you want to put the result in the object file.
If you want to do the parsing for the pragma in the preprocessor so that you can syntax check them (for example), you could pass some type of pre-processed values through this mechanism...
Happy Holidays!
string concatentation is done inside the compiler rather than inside the preprocessor; so the concatenated strings wouldn't be directly accessible in the preprocessor.
I'm going to do the custom version then because microsoft doesn't follow 5.1.1.2 of C23's standard pdf (this stuff has been the same for awhile though) and does it earlier for this, presumably to make constructs such as their example: #pragma comment( user, "Compiled on " __DATE__ " at " __TIME__ )
easier. https://learn.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-170
on pragmas, if the preprocessor doesn't know a pragma it calls ppPragma::catchAll on line 98 of ppPragma.cpp. That calls back to the SetPragmaCatchall call in occparse.cpp (somewhere around line 572) where it gets entered in a table called 'bePragmas'. 'bePragmas' gets propagated through the various compiler modules (streaming through the icf files) although currently it seems like it is not processed anywhere. You could intercept it in the 'occ' project for example since you want to put the result in the object file.
I'll look into doing the stuff in the backend after doing the frontend work earlier. I was asking on this because it looks like we don't handle pragmas internally to OCC and we mostly just handle it in the preprocessor, I've (mostly) implemented this so far in the preprocessor, it just means that I'm going to have to defer it into the object system for the linker to take care of later, especially in the case of #pragma comment(compiler)
.
What was the referenced issue #772 about before it was deleted? Are there any issues open here? It seems that's implemented in the last release, no?
Not all of the #pragma comment
functionality was added, only that pragma comment(lib, name)
functionality as I determined it would be too much effort for now to support the other three (at least on my end) as it requires kicking information from preprocessor down all the way to the occ
backend.
yeah i don't know exactly what #772 was at this point, as people were deleting their issues out from under me...
Rechecked the part of my mails that weren't deleted, the issue had the title "Very good resources" and possibly was related to header files. But we can keep that out of this issue.
implement at least #pragma comment lib and some other #pragma comment pragmas similar to the microsoft pragmas.