× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I think the way to accomplish function overloading and all other
enhancements to RPG is thru the pre processor APIs. Back when I
experimented with it, it worked well. Only had problems integrating with
the debugger. This is how RPG SQL works.


On Wed, Aug 17, 2016 at 12:38 PM, Niels Liisberg <NLI@xxxxxxxxxxxxxxxxx>
wrote:

Hi Mark,

Yes i know.

However, what I'm after is to make a polymorph functioncall like:

print(123.45);
print('hello world');

And let the "print" take care of which type is actually used. The ILE has
a "descriptor" so you can taste what kind of type, but RPG don't let you
define a weak prototype.

Thank you for your concens

Niles

Sendt fra min iPad

Den Aug 17, 2016 kl. 14:29 skrev Mark Murphy/STAR BASE Consulting Inc.
<mmurphy@xxxxxxxxxxxxxxx>:

So you are talking about void pointers then, or a pointer that takes no
type. In RPG every pointer is a "void" pointer. So then

void * myfunc(void *)

is equivalent to

dcl-pr myfunc Pointer;
field1 Pointer value;
end-pr;

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Niels Liisberg <NLI@xxxxxxxxxxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <
rpg400-l@xxxxxxxxxxxx>
From: Niels Liisberg <NLI@xxxxxxxxxxxxxxxxx>
Date: 08/16/2016 06:55PM
Subject: Re: Where to post ideas for RPG


Hi Mark.

Actually all of the above.

Both returning and defining parsed parameters.

Maybe you know that it is quite easy from within C to use and query
these info in the invocation stack ( if DECLSPEC is provided) however RPG i
rather rigid regaring types in prototypes.

So basically what I am after is to let RPG just parse the value / or
pointer to value and let the caller do the rest of the job.

In C++ it is called polymorphism ( with a twist since it would call a
maching procedureinterface) but RPG will drive it far with little effort,
not implementiong full polymorphism, but rather let the caller deal with
the parameters....

So

dcl-pr myfunc void; // The return value has to be examined from the stack
fld1 void value; // Put the value on the stack ( what ever that is)
fld2 void; // Put the address to fld2 on the stack
end-pr;

I don't have a nice syntax for the dynamic numbers of parameters but a
early gues could be:

dcl-pr myfunc;
fld1 int(10) value; // First normal strong prototype ( if any)
*ANY; // Now any numbers of parameters of any types
end-pr;

The above aproch can also be used for lasy procedure declarations, and
also bring in bad coding practis. But also be efficient for conversiontools
to bring in old RPGlll code into to the ILE game.



Den Aug 16, 2016 kl. 15:19 skrev Mark Murphy/STAR BASE Consulting Inc.
<mmurphy@xxxxxxxxxxxxxxx>:

What do you mean by a void prototype?

void myfunction(int)

dcl-pr myfunction;
fld Int(10) value;
end-pr;


or

int myfunction(void)

dcl-pr myfunction Int(10);
end-pr;


Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Niels Liisberg <NLI@xxxxxxxxxxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <
rpg400-l@xxxxxxxxxxxx>
From: Niels Liisberg <NLI@xxxxxxxxxxxxxxxxx>
Date: 08/15/2016 06:58PM
Subject: Where to post ideas for RPG


Hi,

It wold be great if RPG had some kind of "void" prototype and "..."
Which is "any number of parameters" just like in C so I could have a more
clean integration to i.e. The C function "printf()" .

Also a %TYPEOF() that returs a given type / lenght datastructure of a
give variable.


Now. I'm not a member of CEAC. I don't have a place to post these ideas
directly. So what to do? Send mails to Barbara Morris? Is there a forum
elsewhere?

Regads

Niels Liisberg

--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.