How to determine the passed Data Type in a ? (any) parameter?

So we have Omitted which can tell us if an optional parameter has been omitted or not, but when it comes to using ? (any) as a datatype in a parameter I cant find anything in the docs that tells me what the data type is.

We have something similar with Who, What, & Where but it just seems like there is this gap identifying the datatype in use unless I’m missing something in the help docs?

I can knock something up to identify the format of the datatype to work out if something is a string, cstring or pstring, but before I do this I thought I’d better check to make sure I’m not reinventing the wheel.

TIA

use a Search first :slight_smile:

Well this Procedure Overloading is different to what I had in mind but it should work. Thanks! :wink:

search Clarionhub for TUFO

A Proposed Convention for the Extended use of the Name Attribute - code - ClarionHub

Is it a bug that needs fixing?

If its a bug, come to any EU country as its perfectly legal to reverse engineer and fix said bug. The EU courts have already ruled on that in Oct 21.

Court of Justice of the European Union allows Reverse Engineering to Correct Errors - Lexology

This appears to be a bit of a laugh.
EUR-Lex - 32009L0024 - EN - EUR-Lex (europa.eu)

Section 14

A person having a right to use a computer program should not be prevented from performing acts necessary to observe, study or test the functioning of the program, provided that those acts do not infringe the copyright in the program.

When reading this! :roll_eyes:
The functionality of a computer program and the programming language cannot be
protected by copyright (europa.eu)

I’m curious with this statement

An undocumented structure is declared in tufo.int and can be used to help with reflecting. An example of tufo.int can be found at

What exactly is being referred to here when it says “undocumented structure”, which bit is it referring too, is the TUFO_CallInterface INTERFACE,TYPE what is being referred to as the undocumented structure or something else?

Essentially, that’s how it works, but it’s an internal process, and could potentially change at some point. Think if it as if you’re reaching in to access PRIVATE class data. Your code may work today, but the designer of the class may decide to change it without announcing it, so your code might break.

So when Bruce refers to Reflectors, he’s not referring to road safety reflectors or bike reflectors but to this definition Reflective programming - Wikipedia

So this now makes sense

Well the approach I was going to do was to try to do a regex on the memory layout, abit like overlay can fit over data in memory. I know the address and the size, so I was going to start there.

What other things are people looking to get out of the language? It mentions the dictionary properties, what sort of dct properties?

See use of the TUFO in the debuger classes

See .getVarType

So _Type is returning the datatype.

Line 1286 RETURN UFO._Type( ADDRESS(xaVar) )

and then the value returned can be looked up in
Debuger.DescribeDataType

Does anyone know where the TUFO method/interface names originate from?

For example, I’m guessing _8ValueUfo__Type@CF is the _Type referred to in the TUFO interface?

Did someone reverse engineer this, leak it or sit there painstakingly going through the shipping dll’s?

It looks like TUFO is linked to the procedures seen in the libmaker using ClaRun.dll with names like
_6VarUfo__ToMem@CFR4vmem
_8ValueUfo__ToMem@CFR4vmem
_9StringUfo__ToMem@CFR4vmem
_11PictureUfoD__ToMem@CFR4vmem
_11PictureUfoL__ToMem@CFR4vmem
_11PictureUfoR__ToMem@CFR4vmem

Edit.

I’m also wondering if this _Type is like the typeid mentioned here.
typeid operator - cppreference.com

I think I’ve figured it out, ie getting the datatype from the ? (any) parameter passed by value.

Picture says a million lines of code…

Well this turned out to be a red herring. Back to the drawing board.

You’re welcome to play with my PrivateClass. It will get data types of passed *? parameters. https://github.com/jslarve/PrivateClass

I’ve already written one which works for the params passed by address, but I was trying to get the data type for those passed by value and thought I was onto something but I wasnt!

GETTYPE.CLW (26.7 KB) GetType.inc (19.4 KB)

This TUFO.int is what is stumping me, I think I’ll have to use this in C11 and try to see what its fitting with and how, I’m assuming its fitting with something in the runtime.

So having loaded your app in C11, would I be correct in saying TUFO.int is a data structure, in the same sense as a Group, where the elements of the group are methods/procedures OVERed a part of the clarion runtime in memory, which is located and fixed over the runtime using Address() and What()?

If so, I can see why the comment exists that state this can change with future updates of the runtime.

This is what I thought I was looking at the other night which my GetType class but was stupidly looking back at the variable contents in memory of the procedure, aka my red herring.

Anyway I’m right, I’ll have a go at backporting this to C6 and see what differences exist in the two runtimes I have here.

This is why ASLR and other methods exists to jumble up the memory…

Its also why Astrings could perhaps be viewed as the haystack in which to hide a needle.

1 Like

An interface is kind of just a set of methods that a class will support.

In c6, there was a different interface, where the methods appeared in a different order

Yeah its a bit like a vertical key, so for now, my interface in C6 looks like this, and then I’ll see what happens with each method, so I should end up with the correct number of methods, the one’s that accept input and the one’s that have output including the datatype.

Its a bit like picking a barrel lock if you have ever watched LockPickingLawyer - YouTube! :roll_eyes:

iWTF    Interface,Type
p1      Procedure(long),long
p2      Procedure(long),long
p3      Procedure(long),long
p4      Procedure(long),long
p5      Procedure(long),long
p6      Procedure(long),long
p7      Procedure(long),long
p8      Procedure(long),long
p9      Procedure(long),long
p10     Procedure(long),long
p11     Procedure(long),long
p12     Procedure(long),long
p13     Procedure(long),long
p14     Procedure(long),long
p15     Procedure(long),long
p16     Procedure(long),long
p17     Procedure(long),long
p18     Procedure(long),long
p19     Procedure(long),long
p20     Procedure(long),long
p21     Procedure(long),long
p22     Procedure(long),long
p23     Procedure(long),long
p24     Procedure(long),long
p25     Procedure(long),long
p26     Procedure(long),long
p27     Procedure(long),long
p28     Procedure(long),long
p29     Procedure(long),long
p30     Procedure(long),long
p31     Procedure(long),long
p32     Procedure(long),long
p33     Procedure(long),long
p34     Procedure(long),long
p35     Procedure(long),long
        End

I think there are a couple of renditions on the news server somewhere.

I’m not going on the newsgroups, I’ll work this out myself, even if it becomes the death of me!

In C6:
Interface method 6 = DataType
Interface method 17 = Memory locations
Interface method 18 = Memory locations
Interface method 24 = Size

Its an interesting technique for extracting otherwise private class data! Kind of makes a mockery of what we get taught about computer security though.

Once I have my class writing template working properly, I’ll finish off the class I’ve written which I wrote to determine the above interface types, that way, TUFO is no longer an unknown, when a new runtime comes out.

So far, I’ve limited the class to only 50 interface methods, but as I dont know what it interface’s over although I suspect its parts of the runtime, I dont know if that is enough or not? Anyone know?

Just a reminder that the TUFO interface changed at one point (I think pre C7 and post C7)
Notice the two versions I have in TUFO.int

ClarionCommunity/TUFO.INT at master · MarkGoldberg/ClarionCommunity (github.com)