gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the equivalent type in GM2?


From: Hưng Hưng
Subject: Re: What is the equivalent type in GM2?
Date: Sat, 28 Mar 2020 01:26:59 +0700

Let me add additional information. If I use the pointer trick, e.g: PChar, PPChar, PPPChar, then I can't pass the M2 string into C function as it requires C string, if I try to do so the compiler will complain because it expect char to have only length 1. M2 and C have a very different way of processing string, as I see the equivalent pointer to char trick in C would not work on M2.

There is a procedure in module DynamicStrings allow to convert between M2 string and C string, but again, how to translate these data type correctly? If we go the pointer trick we will then have to figure out how to represent PPChar, PPPChar as the procedure in DynamicStrings only helps us up to here. It's circular reasoning. I feel my head as going to explode.

Vào Th 7, 28 thg 3, 2020 vào lúc 01:15 Hưng Hưng <address@hidden> đã viết:
The C function return or took a C string as parameter, with is an array of char or pointer to unsigned char.

Another function return or took an array of C string as parameter, which is an 2D array of char or pointer to pointer to unsigned char.

Another function return or took an array of array of C string as parameter, which is an 3D array of
char or pointer to pointer to pointer to unsigned char.

It's too complex. C code tends to abuse pointer too much.

e.g:

void      IupResetAttribute(Ihandle* ih, const char* name);

int       IupGetAllAttributes(Ihandle* ih, char** names, int n);

int       IupOpen          (int *argc, char ***argv);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]