Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #13091 > unrolled thread

Is it possible to get the signature of method in VO through reflection?

Started byJafar <jafar@marti-orbak.nl>
First post2020-10-01 02:39 -0700
Last post2020-10-01 08:47 -0700
Articles 6 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Is it possible to get the signature of method in VO through reflection? Jafar <jafar@marti-orbak.nl> - 2020-10-01 02:39 -0700
    Re: Is it possible to get the signature of method in VO through reflection? "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-10-01 17:28 +0200
      Re: Is it possible to get the signature of method in VO through reflection? Robert Pope <cooeee@gmail.com> - 2020-10-03 02:56 -0700
        Re: Is it possible to get the signature of method in VO through reflection? Robert van der Hulst <rjvanderhulst@gmail.com> - 2020-10-03 05:12 -0700
    Re: Is it possible to get the signature of method in VO through reflection? JohnMartens <martens@tennishulp.info> - 2020-10-01 17:38 +0200
      Re: Is it possible to get the signature of method in VO through reflection? Jafar <jafar@marti-orbak.nl> - 2020-10-01 08:47 -0700

#13091 — Is it possible to get the signature of method in VO through reflection?

FromJafar <jafar@marti-orbak.nl>
Date2020-10-01 02:39 -0700
SubjectIs it possible to get the signature of method in VO through reflection?
Message-ID<0d394226-f399-40ea-80fa-3cb4d53c86cfn@googlegroups.com>
I know its possible in VO to get the list of methods for a specific class (MethodListClass) or wether a method exists (IsMethod), but is there also a method/function to get the signature of a specific method?

For example lets say I have the following method:

METHOD SetValue(key AS USUAL, valueToSet AS STRING) AS VOID STRICT CLASS Dictionary
   // some code
RETURN

Is then there is any way if I can get some kind of array like this or something similar where I can get the signature?:
{{"Key", "USUAL"}, {"valueToSet", "STRING"}}

[toc] | [next] | [standalone]


#13092

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2020-10-01 17:28 +0200
Message-ID<htmatiFhem7U1@mid.individual.net>
In reply to#13091
Hi Jafar,

many years ago I have seen something like that in a session about
adding a method to a class at runtime.
But is was a very difficult thing, dealing with structures and pointers
and concatenated lists - and it was entirely undocumented code.

Unfortunately i don't remember who was the speaker and where you can
retrieve that material.

Wolfgang


Jafar wrote:

> I know its possible in VO to get the list of methods for a specific
> class (MethodListClass) or wether a method exists (IsMethod), but is
> there also a method/function to get the signature of a specific
> method?
> 
> For example lets say I have the following method:
> 
> METHOD SetValue(key AS USUAL, valueToSet AS STRING) AS VOID STRICT
> CLASS Dictionary    // some code
> RETURN
> 
> Is then there is any way if I can get some kind of array like this or
> something similar where I can get the signature?:  {{"Key", "USUAL"},
> {"valueToSet", "STRING"}}



-- 

[toc] | [prev] | [next] | [standalone]


#13095

FromRobert Pope <cooeee@gmail.com>
Date2020-10-03 02:56 -0700
Message-ID<0bdfb3fd-7599-4016-a77f-96917a44893co@googlegroups.com>
In reply to#13092
On Friday, October 2, 2020 at 1:28:53 AM UTC+10, Wolfgang Riedmann wrote:
> many years ago I have seen something like that in a session about
> adding a method to a class at runtime.
> But is was a very difficult thing, dealing with structures and pointers
> and concatenated lists - and it was entirely undocumented code.
> 
> Unfortunately i don't remember who was the speaker and where you can
> retrieve that material.

This is what I was hoping might have been touched on for my recent IVarList question. I'd seen mentions of this mysterious reflection type API on this NG, but nothing specific abount it.

[toc] | [prev] | [next] | [standalone]


#13096

FromRobert van der Hulst <rjvanderhulst@gmail.com>
Date2020-10-03 05:12 -0700
Message-ID<aa98661d-8d50-4c25-8034-3ca3429e00a2n@googlegroups.com>
In reply to#13095
Guys,

Certain things that you want are available at runtime, others are not.
The System Library contains a module called Runtime. In this module will find the memory structure of class descriptors, ivar descriptors, method descriptors etc.
The runtime function __GetClassPtr() returns the class structure for a type. The _VO_RTCLASS structure describes this. From this structure you can access the list of ivars and methods. There are also pointers to the class descriptors of superclass and subclasses.
The methods in this tabel are descriptors of untyped methods. 
If a method is typed and you have used the onlyearly pragma then this method is NOT included in the list of methods.
Names are represented with symbols and are always in upper case.
There are two functions supplied in source code: __ReplaceIVar() and __ReplaceMethod(). These functions show how you can use the structures.
Parameter names are NOT available at runtime.
All of the structures have a cargo slot that you can (ab)use to store your own information with the class/method/ivar.

If you want to generate code that uses this kind of information, then you need to use a tool that accesses the source code in the repository.



Robert


[toc] | [prev] | [next] | [standalone]


#13093

FromJohnMartens <martens@tennishulp.info>
Date2020-10-01 17:38 +0200
Message-ID<rl4t5a$85a$1@dont-email.me>
In reply to#13091
What do you want to use it for ?


Op 1-10-2020 om 11:39 schreef Jafar:
> I know its possible in VO to get the list of methods for a specific class (MethodListClass) or wether a method exists (IsMethod), but is there also a method/function to get the signature of a specific method?
> 
> For example lets say I have the following method:
> 
> METHOD SetValue(key AS USUAL, valueToSet AS STRING) AS VOID STRICT CLASS Dictionary
>     // some code
> RETURN
> 
> Is then there is any way if I can get some kind of array like this or something similar where I can get the signature?:
> {{"Key", "USUAL"}, {"valueToSet", "STRING"}}
> 

[toc] | [prev] | [next] | [standalone]


#13094

FromJafar <jafar@marti-orbak.nl>
Date2020-10-01 08:47 -0700
Message-ID<cc5e9020-a9b3-43fa-9793-d298acccd46cn@googlegroups.com>
In reply to#13093
Op donderdag 1 oktober 2020 om 17:38:19 UTC+2 schreef JohnMartens:
> What do you want to use it for ? 
> 
> 
> Op 1-10-2020 om 11:39 schreef Jafar:
> > I know its possible in VO to get the list of methods for a specific class (MethodListClass) or wether a method exists (IsMethod), but is there also a method/function to get the signature of a specific method? 
> > 
> > For example lets say I have the following method: 
> > 
> > METHOD SetValue(key AS USUAL, valueToSet AS STRING) AS VOID STRICT CLASS Dictionary 
> > // some code 
> > RETURN 
> > 
> > Is then there is any way if I can get some kind of array like this or something similar where I can get the signature?: 
> > {{"Key", "USUAL"}, {"valueToSet", "STRING"}} 
> >

Hey JohnMartens,

I am trying to update some kind of test framework & I was hoping I could use the param names as some kind of attribute like done in C# in order to configure test source values for example.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web