PB-CTypeTable
PB-CTypeTable
#PureBasic Tool for the Tools Menu
It's intended use is a reference of Pure Basic Variable Types and a reference for how C type variables convert to Pure Basic, additionally when I write the code it may convert 'a' C type variable into a Pure Basic one.
https://github.com/melony-cmd/PB-CTypeTable
note: currently you'll probably need to (manually) re-path the images I'm using as for some reason 'Form Designer' doesn't like relative paths and wants a full path instead, which is "ok" for me not so "ok" for anyone else.
- version 0.0.1a
Added: Header Assistant
https://www.youtube.com/watch?v=fodzfgLNQCY - video of current progress of project
It's intended use is a reference of Pure Basic Variable Types and a reference for how C type variables convert to Pure Basic, additionally when I write the code it may convert 'a' C type variable into a Pure Basic one.
https://github.com/melony-cmd/PB-CTypeTable
note: currently you'll probably need to (manually) re-path the images I'm using as for some reason 'Form Designer' doesn't like relative paths and wants a full path instead, which is "ok" for me not so "ok" for anyone else.
- version 0.0.1a
Added: Header Assistant
https://www.youtube.com/watch?v=fodzfgLNQCY - video of current progress of project
Last edited by Inner on Tue Jan 23, 2024 5:02 am, edited 2 times in total.
Re: PB-CTypeTable
Hi Inner,
I'm no C language guru, but when I saw in your tool that a variable of type long has a size of 8 byte, I thought there was an error.
With VisualStudio 2022, I wrote the following code (console mode) :
As a result i get a sizeOf 4 byte (x86 and x64) which matchs to Microsoft's definition of Long Type :
https://learn.microsoft.com/en-us/windo ... types#LONG
Am I wrong ?
I'm no C language guru, but when I saw in your tool that a variable of type long has a size of 8 byte, I thought there was an error.
With VisualStudio 2022, I wrote the following code (console mode) :
Code: Select all
#include <iostream>
#include <windows.h>
#include <commCtrl.h>
#include <winuser.h>
#define PRINTF_SIZEOF(type) printf(" SizeOf( " #type " ) = %zu\n", sizeof(type))
#define PRINTF_OffsetOf(type,member) printf(" OffsetOf( " #member " ) = %zu\n", offsetof(type,member))
#define PRINTF_Normal(type) printf(" IS_INTRESOURCE( " #type " ) = %zu\n", (type))
int main()
{
#ifdef UNICODE
#if defined(_WIN64)
printf("\n");
printf("\n");
printf(" Compilation Window 64 bit - mode unicode\n");
#else
printf("\n");
printf("\n");
printf(" Compilation Window 32 bit - mode unicode\n");
#endif
LONG essai;
long essai_2;
printf(" LONG essai;\n");
PRINTF_SIZEOF(essai);
printf(" long essai_2;\n");
PRINTF_SIZEOF(essai_2);
#else
printf("You must compile in unicode mode!\n");
#endif
return 0;
}
https://learn.microsoft.com/en-us/windo ... types#LONG
Am I wrong ?
A+
Denis
Denis
Re: PB-CTypeTable
Attention!
On Window x86/x64 is LONG 4 bytes
On macOS x86 and Linux x86 is LONG 4 bytes
On macOS x64 and Linux x64 is LONG 8 bytes
On Window x86/x64 is LONG 4 bytes
On macOS x86 and Linux x86 is LONG 4 bytes
On macOS x64 and Linux x64 is LONG 8 bytes
Code: Select all
CompilerIf Not #PB_Compiler_Backend = #PB_Backend_C
CompilerError "Use C-Backend!"
CompilerEndIf
Global size
! g_size = sizeof(long);
Debug size
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: PB-CTypeTable
Thanks mk-soft for clarification!
I only work on Windows (x86-64) with Intel microp, so I didn't specify it.
Here's a link to Microsoft Data Type Ranges :
https://learn.microsoft.com/en-us/cpp/c ... w=msvc-170
Do you have other links for linux , macOS for C types etc.?
I only work on Windows (x86-64) with Intel microp, so I didn't specify it.
Here's a link to Microsoft Data Type Ranges :
https://learn.microsoft.com/en-us/cpp/c ... w=msvc-170
Do you have other links for linux , macOS for C types etc.?
A+
Denis
Denis
Re: PB-CTypeTable
Shouldn't they be all the same regardless of OS? I could understand MacOS being different though because well MacOS.. not like they keep to a standard or anything.
Either; way need looking into maybe a column for Operating System and or CPU Architecture? the "PureBasic Types" / "C Types" tabs intention was/is to allow the additions and alterations by the user, admittedly I've not been around that code in a little while so it might not be implemented yet as I've been working on the header assistant part of the application, of which I just did a commit to github.
Re: PB-CTypeTable
@Inner
Don't know if you care or not, but on the github page you have two occurrences of the word "veriable".
Maybe you want to correct them to "variable"
Don't know if you care or not, but on the github page you have two occurrences of the word "veriable".
Maybe you want to correct them to "variable"
Re: PB-CTypeTable
Dyslexia for the W .. I swear last night I was looking at the alphabet because I forgot it's order (hadn't slept in 48hrs)
--- and fixed.
Re: PB-CTypeTable
Add a video of the current state of the project, it's just easier/quicker at the moment.
Re: PB-CTypeTable
I don't know anything about the C language, so this should be a great help for getting started and going further.
It looks like a big and nice piece of work, I'll be following you closely
It looks like a big and nice piece of work, I'll be following you closely
Re: PB-CTypeTable
It's a nightmare, others including myself have tried through many private iterations and attempts to find a solution that can automatically convert .h files to something PureBasic can consume, why? well manually converting .h files is monumentally time consuming (also prone to mistakes) and they are dependent (from my perspective) for any constructive use of external libraries be they .lib or .dll, even worse when you have to remember a pile of junk about a language that (again from my point of view) should have had its day already we should be using a 'basic' style language these days, not over complicating things, hence why I am PB Fan.
It would be nice if we could just IncludeHFile "blar.h", but I doubt that day will ever come, so we'll just have to do it the hard way