Subroutines - passing arguments ???
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-03-06 01:11 AM
‎2010-03-06
01:11 AM
I'm really missing the possibility to pass arguments to subroutines in GDL.
Is it really so there are no possibility to do that, or is it just I that has avoided to find information about it?
I also got to know there are an interface to Phyton, so I can call Phyton-modules from GDL. Do someone has experience by this? Is this functioning well, and is it easy to learn Phyton when I've experience with other languages like Java, Pascal, Fortran, scripting ...etc ?
In other words are there something that is very different in Phyton than in other languages?
5 REPLIES 5
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-03-06 01:32 AM
‎2010-03-06
01:32 AM
Assuming you mean to pass parameters, this is done in the form:
To interact with Python or other programming languages you might be able to use the limited text and data I/O extensions, but it's likely that you would need to get into API stuff. There are others here that know much more than I do about this.
CALL "macro name" PARAMETERS A = 1, B = 2, something = "nothing" !etc...For more details look up the CALL statement in the GDL Ref Manual (page 222 in my copy).
To interact with Python or other programming languages you might be able to use the limited text and data I/O extensions, but it's likely that you would need to get into API stuff. There are others here that know much more than I do about this.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-03-06 01:52 AM
‎2010-03-06
01:52 AM
Anne wrote:No, there isn't any way to define functions in a GDL script, at least not in the same sense as other languages (or indeed the functions in GDL itself). The method of calling macros suggested by Matthew is similar, but messy - I avoid using macros wherever possible.
I'm really missing the possibility to pass arguments to subroutines in GDL.
Is it really so there are no possibility to do that, or is it just I that has avoided to find information about it?
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-03-06 05:29 PM
‎2010-03-06
05:29 PM
Thank you for your answers. I was thinking of the GOSUB "subroutine",
but maybe I should try to figure out more about using Phyton to "hold" functions I could call. Do someone here know wheter users downloading the GDL-objects (calling Phyton functions) need to have any extra resources on their computers to use this GDL-object? Or if something extra regarding Phyton has to be included in the library being downloaded.
but maybe I should try to figure out more about using Phyton to "hold" functions I could call. Do someone here know wheter users downloading the GDL-objects (calling Phyton functions) need to have any extra resources on their computers to use this GDL-object? Or if something extra regarding Phyton has to be included in the library being downloaded.
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-03-08 06:08 PM
‎2010-03-08
06:08 PM
You can use Macro objects to act as functions as a work around as well. To demonstrate lets say you want a function that takes x and y values and returns x + y. To make this happen, create a library part of macro type with two parameters x and y. Then in your "function" object's main script have the following code...
Also, where have you heard of a Python interface GDL? I haven't found anything of the sort but I would love to have access to them if possible.
EXIT x + yNow, to call the function use the following code in another object
CALL "function" PARAMETERS x = x_value, y = y_value, RETURNED_PARAMETERS sumNow the new object will have a variable, sum, which is assigned the value x_value+y_value since those were the values into x and y.
Also, where have you heard of a Python interface GDL? I haven't found anything of the sort but I would love to have access to them if possible.
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2010-03-08 08:01 PM
‎2010-03-08
08:01 PM
Thanks. I think macros are the solution.
I have understood since last, that GDL is two different technologies,
and it's the other that has an interface to Phyton.
I have understood since last, that GDL is two different technologies,
and it's the other that has an interface to Phyton.