NO

Author Topic: Suggestions, Many Suggestions  (Read 19692 times)

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 57
Suggestions, Many Suggestions
« on: August 09, 2022, 05:46:58 PM »
Suggestions. Many Suggestions. I decided to post this all into one single thread. Otherwise, it would clutter this section of the forum and I'll number them all so that people responding can mention it by number.

1. Giving macros called in the code and the macro itself a different color from other code and add it to the "Color and Fonts" section of the enviroment settings. The individual color for macros exists in Visual Studio and it's nice for being able tell what is and what isn't a macro. One could even give the code for structs a particular color as well?

2. Unicode/ASCII selection for Windows API and C in the project settings. Default to unicode for new projects since almost everything is unicode nowadays? I have to remember set the unicode statements for every project, especially Windows projects.

3. I need to add "#Define __STDC_WANT_LIB_EXT1__ 1" in order to use the secure functions. Should this be in project settings and enabled by default for new projects? I believe the Visual Studio compiler even blocks the insecure C functions by default.

Edit: This is by design apparently, this is a part of the C standards.

4. A setting in options to adjust default folder for saving new projects. I don't see a place to change it anywhere in the GUI but I could be missing it.

5. Pelles C defaulting to settings that allow debugging out of the box. I have to adjust the compiler settings to use debugging whenever I install Pelles C anywhere. Not a huge problem but it would be nice for it work out of the box. Though, there could be a reason that it's setup this way that I'm not aware of.

Edit: Whenever I create a new project I need to go to the "Compiler" page to change "Debug information" to "Full" and I need to go to the "Linker" page to change "Debug information" to "Pelles C format". This is all in the project settings. Otherwise, I will get a message about the lack of debug information.


6. The help content in Pelles C appears to mostly be content about the C Standard Library. The entire of documentation of the Windows API is now available from Microsoft on Github under the MIT license. It's in markdown format but imagine it could be converted to the Microsoft (CHM) HTML help. I'm not a lawyer but all it says to do is to credit Microsoft which is easy. I still do like offline documentation even in today's world. It's nice when your internet connection goes "poof" and it would be nice to have it built into the Pelles C UI and the installer.
https://github.com/MicrosoftDocs/win32

Edit: The Microsoft open source help content is a mess. Perhaps a tool to integrate the old style document explorer offline help content into the Pelles C instead? A link to what I've found so far:
https://forum.pellesc.de/index.php?topic=10589.msg36853

7. Related to documentation, it would be convenient if you could just press a keyboard shortcut and it would bring you straight to the built in help content of the particular C Standard Library or Windows API function that the cursor is at.

8. There are function call tips provided by Pelles C after you type the entire name of the function. These tips dissappear if you move the cursor to elsewhere and do not reappear when I later go back to change or complete the function call code. I wish the functions tips would reappear when the cursor or mouse is inside the function code.

9. Memory leak detector, GDI and USER object leak detector, likely a job fit for an add-in?

10. Breakpoints only work within function calls and variables from outside a function. It would be good to be able set breakpoints in code contained entirely within a single function (well, at least, I haven't been able to do so without errors). I imagine that it could be a huge undertaking to enhance the debugger though.


It's says a lot that after using Pelles C for a little while, I'm finding it really hard to think of any more features or suggestions beyond this and some of these are rather minor. The debugger improvements are likely to be the biggest undertaking, to the point that it may not be viable but that's my guess. :)
« Last Edit: October 04, 2022, 09:06:58 PM by CandCPlusPlus »

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 57
Re: Suggestsion, Many Suggestions
« Reply #1 on: August 10, 2022, 02:07:53 AM »
11. I thought of a major suggestion. ARM64 support. An ARM64 build of Pelles C? Possibly even support for compiling for ARM64 on Intel/AMD x64 CPUs (and x64 Pelles C)? Microsoft is really increasing their support of ARM64.

12.  Add comment and uncomment code buttons to the toolbar. I'm quite used to this in Visual Studio. I discovered that you can right click in Pelles C to get a context menu with comment and uncomment button but it would be more convenient to have it in the toolbar.

13. An autocomplete for Windows API functions, the C Standard Library and perhaps even functions in a project's code. Autocomplete could, at least, in theory, be easier to implement in C with "mere" functions and structures. I have noticed that Pelles C already has autocomplete for structs.

14. A way to add and modify the properties for a file to be compiled. Windows shows the file version, properties and everything for many files when you click properties and than details. It's useful for tracking which version an executable is when on one of my computers. It's all blank for files compiled with Pelles C.

15.  Buffer overflow detection and warnings when trying to compile or execute.

Edit: This partially exists when warning level 2 is selected in Pelles C. Stack overflows are detected for stack allocated arrays but *not* for heap allocated arrays or memory.

16. A replace all in selection only option in the Replace dialog.

17. Compiler warnings for assignments in if statements, accidentally using "=" instead of "==". Add possible option in settings for how to handle this?

18. Putting Pelles C on the Microsoft Store?

19. An option for Control Flow Guard (and other Windows security features) ?
« Last Edit: December 03, 2022, 08:26:36 PM by CandCPlusPlus »

Offline John Z

  • Member
  • *
  • Posts: 860
Re: Suggestions, Many Suggestions
« Reply #2 on: August 10, 2022, 12:01:52 PM »
Hi CandCPlusPlus,

Welcome to the forum!


Suggestions. Many Suggestions. I decided to post this all into one single thread. Otherwise, it would clutter this section of the forum and I'll number them all so that people responding can mention it by number.

Well - pros and cons in doing it this way.  Yes less entries but harder to track all inputs on a particular item, also people interested in only one or two will need to wade through it all....  IMO

4. A setting in options to adjust default folder for saving new projects. I don't see a place to change it anywhere in the GUI but I could be missing it.
When you create a new project you have the option of putting it anywhere you want by changing the path in the Location dialog edit box at the bottom of the New Project window.

5. Pelles C defaulting to settings that allow debugging out of the box. I have to adjust the compiler settings to use debugging whenever I install Pelles C anywhere. Not a huge problem but it would be nice for it work out of the box. Though, there could be a reason that it's setup this way that I'm not aware of.
Not sure what this means - is it different from using Project Modes?

7. Related to documentation, it would be convenient if you could just press a keyboard shortcut and it would bring you straight to the built in help content of the particular C Standard Library or Windows API function that the cursor is at.

At least for part of this try using F1 on any highlighted key word to open the help for that function, and the include file it is in.

John Z

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Suggestions, Many Suggestions
« Reply #3 on: August 10, 2022, 12:28:29 PM »
The poide have an Add-In interface and it can handle additional F1 usage.
In Add-Ins section are many examples of additional help searchings for WSDK.

One example for testing:
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#define UNICODE /* for Windows API */
#define _UNICODE    /* for C runtime */
#include <windows.h>
//#include <windowsx.h>
#include <htmlhelp.h>
#include <tchar.h>
#include <addin.h>

#pragma comment(lib, "htmlhelp.lib")

// Locals.
static HANDLE g_hmod = NULL;
static TCHAR szHelp[MAX_PATH];

BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
{
    switch (dwReason)
    {
        case DLL_PROCESS_ATTACH:
            g_hmod = hDLL;
            return TRUE;

        case DLL_PROCESS_DETACH:
            return TRUE;

        default:
            return TRUE;
    }
}

ADDINAPI BOOL WINAPI AddInMain(HWND hwnd, ADDIN_EVENT eEvent)
{
    switch (eEvent)
    {
        case AIE_APP_CREATE:
AddIn_GetIDEFolder(hwnd, ADDIN_FOLDER_HELP, szHelp, sizeof(szHelp));
lstrcat(szHelp, TEXT("\\AddIn.chm"));
            return TRUE;

        case AIE_APP_DESTROY:
            return TRUE;

        default:
            return TRUE;
    }
}

BOOL HelpSearch(HWND hwnd, TCHAR *wcKey);

ADDINAPI BOOL WINAPI AddInHelp(HWND hwnd, ADDIN_HELPEVENT eEvent, LPCVOID pcvData)
{
if (eEvent == AIHE_SRC_KEYWORD_FIRST)
return FALSE;
return HelpSearch(hwnd, (TCHAR*)pcvData);
}

BOOL HelpSearch(HWND hwnd, TCHAR *szKey)
{
TCHAR szTmp[512];
HH_AKLINK aklnk = {0};
aklnk.cbStruct = sizeof(HH_AKLINK);
aklnk.pszKeywords = szKey;
//aklnk.fIndexOnFail = TRUE;
wsprintf(szTmp, TEXT("%s macro;%s function;%s structure"), szKey, szKey, szKey);
aklnk.pszKeywords = szTmp;
if (HtmlHelp(hwnd, szHelp, HH_KEYWORD_LOOKUP, (UINT_PTR)&aklnk) != NULL) {
return TRUE;
}
return FALSE;
}
« Last Edit: August 10, 2022, 02:24:41 PM by TimoVJL »
May the source be with you

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 57
Re: Suggestions, Many Suggestions
« Reply #4 on: August 10, 2022, 09:01:06 PM »
Quote
Well - pros and cons in doing it this way.  Yes less entries but harder to track all inputs on a particular item, also people interested in only one or two will need to wade through it all....  IMO

True. I had not thought of the cons of putting it all into one thread. I may create a second or even third thread if one of the suggestions gets lots of replies. :)

Quote
Not sure what this means - is it different from using Project Modes?

Whenever I create a new project I need to go to the "Compiler" page to change "Debug information" to "Full" and I need to go to the "Linker" page to change "Debug information" to "Pelles C format". This is all in the project settings. Otherwise, I will get a message about the lack of debug information.
« Last Edit: August 11, 2022, 06:14:22 AM by CandCPlusPlus »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Suggestions, Many Suggestions
« Reply #5 on: August 12, 2022, 12:02:00 PM »
PellesC IDE is extensible through the use of addins and wizards that anybody can write using the IDE addin API (see help file).
There is a lot of addins here. While I'm sure you'll find some that fits your requests (i.e. my addin for help here, use the online option to select a word and then using F1 search MSDN online help), you can have a look as examples for addin coding.
The wizards allows you to specify a personal project type, i.e. ready for debug. You can find examples on Pelle site. Browse Extending the IDE -> Project Wizards for examples.
It would be nice if you would share your code with us to add new functionalities to the IDE.
« Last Edit: August 12, 2022, 12:09:32 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Suggestions, Many Suggestions
« Reply #6 on: August 12, 2022, 01:33:38 PM »
A one project was Add-In loader for Add-ins
https://forum.pellesc.de/index.php?topic=8153.0

In git
Tiny Lousy PellesC-Add-Ins
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Suggestions, Many Suggestions
« Reply #7 on: August 12, 2022, 02:38:05 PM »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 860
Re: Suggestions, Many Suggestions
« Reply #8 on: August 14, 2022, 04:00:35 PM »
In git
Tiny Lousy PellesC-Add-Ins

Well if these are considered 'lousy' then the rest of us might as well give up  :) 

John Z

Offline John Z

  • Member
  • *
  • Posts: 860
Re: Suggestions, Many Suggestions
« Reply #9 on: August 14, 2022, 04:10:10 PM »
3. I need to add "#Define __STDC_WANT_LIB_EXT1__ 1" in order to use secure functions. Should this be in project settings and enabled by default for new projects? I believe the Visual Studio compiler even blocks the insecure C functions by default.

I don't think this is true in Pelles C.  You can use safe(r) string functions w/o this define, are there other functions?
Does Visual Studio block the use of free(pointer) or does it automatically assign NULL to the pointer after free?


John Z

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Suggestions, Many Suggestions
« Reply #10 on: August 15, 2022, 01:19:47 AM »
PellesC requires the definition of macro __STDC_WANT_LIB_EXT1__ to '1', as indicated in C11 standard annex k3.
Anyway the standard at paragraph K3.1.1 Standard Headers point 3 says:
Quote
It is implementation-defined whether the functions, macros, and types declared or defined in K.3 and its subclauses are declared or defined by their respective headers if _ _STDC_WANT_LIB_EXT1_ _ is not defined as a macro at the point in the source file where the appropriate header is first included.
I remember that GCC works the same way.
« Last Edit: August 15, 2022, 12:09:08 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 860
Re: Suggestions, Many Suggestions
« Reply #11 on: August 15, 2022, 02:54:11 AM »
PellesC requires the definition of macro __STDC_WANT_LIB_EXT1__ to '1', as indicated in C11 standard annex k3.

You are absolutely right, I'm sorry my BAD test, I added to existing source code a strcat_s and it worked.  Nowhere there did I define the safe flag __STDC_WANT_LIB_EXT1__ .  However when compiling the entire code (45 files) to run the embedded test I had defined it in a json parsing module.  Shows the benefit of using the smallest code possible needed to test something not some humongous program where a test is inserted. Lesson learned....

Apologies,
John Z

Offline CandCPlusPlus

  • Member
  • *
  • Posts: 57
Re: Suggestions, Many Suggestions
« Reply #12 on: August 15, 2022, 05:50:36 AM »
My original post was poorly worded there.

You can use the secure functions without the define statement BUT I do get sporadic compiler warnings about the function being undefined which is annoying. It's a minor annoyance because all I need to do is define "__STDC_WANT_LIB_EXT1__" to stop the warnings and apparently it's a part of the standard which means it's likely to stay as is unless the standards change.  You could get around that by including it by default with the new project templates but, again, it's minor and not that important. :)

If it's a part of the standard, perhaps the fact that it works with sporadic warnings is a bug in itself.

On another note, I swear Visual Studio blocked the less secure functions but it doesn't appear to anymore.
« Last Edit: August 15, 2022, 06:07:30 AM by CandCPlusPlus »

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: Suggestions, Many Suggestions
« Reply #13 on: August 15, 2022, 12:18:21 PM »
My original post was poorly worded there.

You can use the secure functions without the define statement BUT I do get sporadic compiler warnings about the function being undefined which is annoying. It's a minor annoyance because all I need to do is define "__STDC_WANT_LIB_EXT1__" to stop the warnings and apparently it's a part of the standard which means it's likely to stay as is unless the standards change.  You could get around that by including it by default with the new project templates but, again, it's minor and not that important. :)

If it's a part of the standard, perhaps the fact that it works with sporadic warnings is a bug in itself.

On another note, I swear Visual Studio blocked the less secure functions but it doesn't appear to anymore.
The macro "__STDC_WANT_LIB_EXT1__", when set to 1, enables the emission of the prototypes for the secure functions (see annex K), while the secure functions themselves are in any case present in the runtime libraries.
This means that if you don't enable prototypes, setting "__STDC_WANT_LIB_EXT1__" to 1, you'll get warnings from compiler, but the secure functions gets linked anyway.
Of course without prototypes you'll lost error detection and automatic type conversion (between compatible types) operated by the compiler, and this could lead to very bad problems. In any case it is definitely a bad programming practice.
Finally this is not a bug, but a fully compliant behavior.  ;)
« Last Edit: August 15, 2022, 12:24:41 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 860
Re: Suggestions, Many Suggestions
« Reply #14 on: August 16, 2022, 03:32:07 PM »

6. The help content in Pelles C appears to mostly be content about the C Standard Library. The entire of documentation of the Windows API is now available from Microsoft on Github under the MIT license. It's in markdown format but imagine it could be converted to the Microsoft (CHM) HTML help. I'm not a lawyer but all it says to do is to credit Microsoft which is easy. I still do like offline documentation even in today's world. It's nice when your internet connection goes "poof" and it would be nice to have it built into the Pelles C UI and the installer.
https://github.com/MicrosoftDocs/win32

Seems possible.  It would be several (many) months (at least) of work.  I made a small trial, attached.
The markdown also seems to reference some 'links' like:
    href: /windows/desktop/api/Commctrl/nf-commctrl-animate_close
which don't exist in the github markdown repository, and don't exist on my system, so these would take more time to ferret out. 

Finally just to mention the markdown comprises over 400Megabytes of data.  Just doing the section on Controls - just the A's into .chm resulted in a 110K file.  I don't know the upper limit of a .chm file.  BTW the A's only processed 111 lines out of 6884 lines of the controls TOC.

The Github markdown can be dowloaded and used 'offline' as well.  So I'm not sure if there is enough demand for a .chm version. 

John Z

Note just FYI - you can't open .chm over the network so you must download to look at it.

Update: Just a quick build of the controls section w/o frills resulted in a almost 20Meg chm file before compression then about 4.5Megs final. Approx 1760 HTML files...

Update: Full Controls.chm now available on SourceForge @ https://sourceforge.net/projects/windows-controls-api-docs/
« Last Edit: September 12, 2022, 12:12:33 PM by John Z »