Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
HomeFAQSearchRegisterMemberlistUsergroupsLog in
Latest topics
» Hello world.
by Mon Jun 19, 2017 1:37 am

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

» Can I change the program icon/logo in my application ?
by Thu Jul 07, 2016 3:32 am


Share | 

 Internal Structure of Arrays (and Variable Types)?

View previous topic View next topic Go down 

Number of posts : 18
Registration date : 2010-11-07

PostSubject: Internal Structure of Arrays (and Variable Types)?   Tue Oct 21, 2014 5:56 pm

I didn't find all information about the internal data structure of PANORAMIC's data types - and especially - the arrays.

I guess:

integers are four bytes long. The address of an array "Arr%" points to the low byte of Arr%(0) ...
So if I "POKE ADR(Arr%) + 4*n, 3" I'll set the low byte of the n'th element (starting from 0) to 3.

Example (that works like expected):
dim i%
dim Arr%(20)
poke ADR(Arr%)+4*17,3
for i%=0 to 19
print Arr%(i%)
next i%

But that's only guessing from "C".
Also guessing is that strings are zero terminated " char[]"/char * " and string Arrays are therefore arrays of addresses (integers) of zero terminated character sequences!?
But as they have already got (or get on assignment) allocated memory possible problems of understanding may occur.

Also the internal organisation of "reals" is not obvious. Is it documented anywhere?

I know that most BASIC dialects tends to hide these internals but you should know them as soon as you are going to exchange more complex data than a couple of primitives to C or other languages using DLLs.
Back to top Go down
View user profile


Number of posts : 18
Age : 68
Localisation : France
Registration date : 2013-03-23

PostSubject: Re: Internal Structure of Arrays (and Variable Types)?   Sun Mar 22, 2015 9:33 pm

The interface between Panoramic and DLLs is a bit restrictive. If you are willing to have a look on the french forum, there are a lot of information, tutoriels and articles about he subject.

Personally, I develop a DLL in Delphi 6 Personal Edition whose use is quite widespread throughout the french Panoramic community. Several hundreds of functions are available in this DLL, so I have quite an experiance with this subject.

So, let me give some hints:

1. On ly a single DLL may be active at any time, in a Panoramic program. It is dynamically loaded by the DLL_ON command, and unloaded by the DLL_OFF command.

2. A DLL for Panoramic cannot contain procedures. Only functions are allowed.

3. All functions must return a single INTEGER type value. Nothing else is possible.

4. Functions are called through 7 special Panoramic functions: DLL_CALL0, DLL_CALL1, ... DLL_CALL6. The last character specifies the number of parameters to pass to the function. All these special functions have the same syntax:
res% = dll_callx('MyFunction",p1%,...,px%)

5. The DLL function name is passed as a character string as first argument, followed by the real parameters for the DLL function.

6. The DLL function name is case sensitive and must match exactely the exported name in the DLL.

7. All parameters are of type integer. Nothing else can be passed to a DLL function.

8. All parameters are passed "by value". There is no "b y ref" mechanism. So, no value of whatsoever type may be returned through a parameter.

9. No array can be passed as parameter. This is a direct consequence of the "by value" parameter mecanism.

10. All DLL functions are called by the STDCALL convention.

11. A DLL function must have a fixed number of parameters, ranging between 0 and 6. No variable number of parameters are possible, and not more than 6 can be passed.

12. There is no direct access to the data of the Panoramic variables. The data of simple variables are directly stored in the internal symbol table, the string data is stored in a dynaic section as ASCIZ strings, and array data is stored in a proprietary logic, but even more difficult to locate than string data.

So, is this actually restrictive enough ? Could be worse, isn't it ? But wait, there are some technics to get arround some of these limitations. Some support functions are available to help:

adr(variable) returns an integer value representing the address of the data of the variable. This is true for INTEGER and FLOAT types, and for STRING types, it gives a PSTRING value (Delphi terminology).

handle(object) returns an integer value representing the Windows handle the an Panoramic object. This is true for all objects implemented as descendants of TWinControl (EDIT, MEMO, ...), but not for non-windowed objects (ALPHA, PICTURE, TIMER, ...).

handle_canvas(object) returns an integer value representing the canvas handle of a Panoramic object (if the object has one), like FORM, PICTURE...

object_internal(object) returns an integer value representing the TOBJECT value (Delphi terminology) of the object.

All of these values can be passed as parameters to a DLL function. And because we can have adresses, we can pass data back using the address as a pointer...

So, I hope you have a light overview of the subject. Concerning Delphi DLL's, I'll be glad to help you out with any question.
Back to top Go down
View user profile http://klaus.panoramic.voila.net/
Internal Structure of Arrays (and Variable Types)?
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
» Creating the account (URL) globally and using that variable where ever it needed
» Setting & getting variable values
» Please help.. cant figure out variable!
» two variables in one variable
» How to compare two stored variable values in Selenium IDE

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Help?-
Jump to: