PDA

View Full Version : How to create a new "fake" data type?



tbNewbie
08-02-2006, 18:42
I'm working on a library about stacks. Now, a "stack" variable is defined as a number, i.e.


DIM stk AS DWORD

stk = STACK_CREATE()
STACK_PUSH(stk, "test content")
...and so on...


How can I make possible to declare stk with a line like


DIM stk AS STACK


or, create an equate that may replace "STACK" with "DWORD", like in the C "typedef" directive? I've tried the equate-creating function thinBasic_AddEquate, but it doesn't work for data types.

A small request, for third-party modules developers... what about a small guide about available functions and their use with C++ compilers?

Thanks in advance

RobertoBianchi
08-02-2006, 19:05
Hi tbNewbie,

you could try to use this code fragment:

ALIAS DWORD AS STACK

DIM stk AS STACK


Please have a look at ALIAS help online:
http://www.thinbasic.com/public/products/thinBasic/help/html/alias.htm
ALIAS keyword let you add new names that can be used to replace standard one.

We are working on a complete SDK help that will explain SDK functions and functionalities.

Also we are working on data structures. For the moment thinBasic manage numbers (many types) and strings (dynamic, asciiz and fixed-size). More complex data structures like TYPEs will come very soon.

Keep in touch :lol:

Thank you very much and best regards,
Roberto

tbNewbie
13-02-2006, 18:17
Hi tbNewbie,

you could try to use this code fragment:

ALIAS DWORD AS STACK

DIM stk AS STACK


Please have a look at ALIAS help online:
http://www.thinbasic.com/public/products/thinBasic/help/html/alias.htm
ALIAS keyword let you add new names that can be used to replace standard one.

We are working on a complete SDK help that will explain SDK functions and functionalities.

Also we are working on data structures. For the moment thinBasic manage numbers (many types) and strings (dynamic, asciiz and fixed-size). More complex data structures like TYPEs will come very soon.

Keep in touch :lol:

Thank you very much and best regards,
Roberto

Thank you for your *great* (and *very simple*!) idea. Then, if I create a file, say, "STACK.INC" containing the two lines



USES "stack"
ALIAS DWORD AS STACK


and I include it in other files, I've solved the problem? So... I can create, for example, two new fake data types like "STACK" and "QUEUE" or so?

A question in the question... When (ehm... if) I finish my small library for stacks and queues (containing strings), how can I upload it to you to include it in the 3rd party libraries list?

ErosOlmi
13-02-2006, 18:51
Hi tbNewbie,

your method is nice and will work. We are also adding a new function interface that will let you add a new alias directly from inside your DLL module so there will be no need to add the ALIAS in the script.

Regarding your new module, please send a copy to me or Roberto via private message or via mail. We will check it and discuss with you. Possibly we will publish a new forum in wich you can be the moderator so you will have the option to talk with future users and update it. Is it ok?

We will let you know when we will add new function interface.

Regards
Eros