|
@Charles Any reason it must be URL Templating? I once wrote a little
template engine in RPG which worked more like the Apache Velocity Engine
(with various template loaders etc). Though I think you only need a
little in-memory template engine.
Some example code of mine. It filled the command string to create a
physical file:
**FREE
ctl-opt dftactgrp(*no) actgrp(*caller) bnddir('TEMPLATE/TEMPLATE');
main();
*inlr = *on;
dcl-proc main;
dcl-s command char(1000);
dcl-s abnormallyEnded ind;
dcl-s mergedCommand varchar(1000);
dcl-s templateLoader pointer;
dcl-s context pointer;
dcl-s engine pointer;
dcl-s mergedContentPtr pointer;
dcl-s info char(50);
command = 'CRTPF FILE(${object_library}/${object_name}) ' +
'SRCFILE(${source_library}/${source_file}) ' +
'SRCMBR(${source_member})' + x'00';
templateLoader = template_loader_memory_create(%addr(command));
context = template_context_create();
template_context_addCharValue(context :
'object_library':%trimr(destlibrary));
template_context_addCharValue(context : 'object_name' : %trimr(member));
template_context_addCharValue(context : 'source_library' :
%trimr(library));
template_context_addCharValue(context : 'source_file' : %trimr(file));
template_context_addCharValue(context : 'source_member' :
%trimr(member));
template_context_addCharValue(context : 'source_member_type' :
%trimr(type));
engine = template_engine_create();
template_engine_addTemplateLoader(engine : templateLoader);
mergedContentPtr = template_engine_merge(engine : context : '*local');
if (mergedContentPtr <> *null);
mergedCommand = %str(mergedContentPtr);
info = mergedCommand;
dsply info;
else;
dsply 'no merged content';
endif;
on-exit abnormallyEnded;
if (engine <> *null);
template_engine_finalize(engine);
endif;
if (context <> *null);
template_context_finalize(context);
endif;
if (templateLoader <> *null);
template_loader_finalize(templateLoader);
endif;
if (mergedContentPtr <> *null);
template_memory_deallocate(mergedContentPtr);
endif;
end-proc;
If you are interested I could provide the code. I haven't found the time
to upload it to a repo.
Best regards
Mihael
On 13.07.20 16:26, Charles Wilt wrote:
ILE C++ is easy to call..thus why we are trying to port it.why
C++ in PASE is what is difficult...
Charles
On Fri, Jul 10, 2020 at 5:25 PM Roger Harman <roger.harman@xxxxxxxxxxx>
wrote:
That's an interesting statement. If it's an ILE program (or module),
claimwould it be difficult to call?
I've only done a couple of C (not C++) programs on IBM i so I can't
URIany expertise - just curiosity.
Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power
--
-----Original Message-----
From: C400-L [mailto:c400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of
Charles Wilt
Sent: Friday, July 10, 2020 9:47 AM
To: Bare Metal Programming IBM i (AS/400 and iSeries)
Subject: Re: [C400-L] ILE C++ standards
That's an option..
Except I want to call the C++ code from RPG...
And while it appears that can be done, it doesn't appear
particularly simple.
Charles
On Fri, Jul 10, 2020 at 10:25 AM Mark Waterbury <
mark.s.waterbury@xxxxxxxxxxxxx> wrote:
Hi, Charles,
If you really need the latest and greatest C++ standards, you should be
looking into installing the GCC G++ compiler under PASE. :-)
All the best,
Mark S. Waterbury
On Friday, July 10, 2020, 12:22:07 PM EDT, Charles Wilt <charles.wilt@xxxxxxxxx> wrote:
"You're surprised by this?"
A little yeah, I expected it to be behind...but 9+ years? :o
No, we don't do much C++, none in fact. But I'd really like to have
butTemplating functionality https://en.wikipedia.org/wiki/URL_Template inRPG
and since there were some existing C++, I thought it'd be worthwhile tosee
if we could port one over.
Charles
On Fri, Jul 10, 2020 at 7:35 AM Kelly Beard <kenverybigliar@xxxxxxxxx>
wrote:
You're surprised by this? :-) Not to sound rude or condescending,
Linuxofyou, like most everyone else in the universe, probably don't do a lot
isC++ work on the 400. Unfortunately, we do. We're on V7R3 here. IBM
not even on C++11, technically, but on C++0x, and you have to, forHeaven
some reason, enable a command option to get that going. Only God in
knows why they cannot stay current. I suspect that maybe the OS iswritten
with whatever C++ was in force at the time and so that is what we'restuck
with, but that's only my uneducated guess.
How many lines is this utility? Probably originally written on a
--notsystem with g++?2011...(aka
On Thu, Jul 9, 2020 at 5:06 PM Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:
So we're trying to port a small C++ utility to ILE...
One of the compile errors is on the following...
for(auto& ele : inVars)
Apparently this the "for each" loop which was added to C++ in
C++11)
We're on v7.2, but even the v7.4 manual doesn't show it as valid.
Looks like C++ on the IBM i include part of the C+11 standards, but
--yetdon't
all. And of course C++14 and C++17 are nowhere to be found.
Bit surprised the i is so far behind the times, but I suppose most
use ILE C/C++...
Charles
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list
To post a message email: C400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list
To post a message email: C400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.
Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.
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.