Menu

#7 factor out a function for argc, argc with xpl -m

2.0
wont-fix
None
2021-05-15
2020-07-04
No

Hello,

Recently interested in XPL, and nicely done. If you are still updating any of this Daniel... this is a feature request.

I'm demoing some ways of integrating your XPL with GnuCOBOL, which also compiles to C. It would be nice to have the argc, argv predefined XPL variable descriptors filled in via function call and not just when main is emiited (the normal no -m option adds the argc argv init with access to field names which gets hidden in the XPL -> C, GnuCOBOL -> C, C->ELF tool chain. GnuCOBOL CALL only exposes link symbols to functions, and the emitted code has uneasy acces to C variable names.

Not that modular xpl0006 code is meant to know about the CLI, but XPL code that compiles fine can abend with report at runtime. Nice, by the way, but if the XPL code happens to access argc or argv() xpl builtins the script has no presets. Either a function wrapper to init the descriptors or assume just the program name?

Not a biggy in terms of priority or need (but also not completely useless). Whims of trying out a 1972 COBOL based library with a CALL interface into XPL domain specific command interpreters.

Hercules MVS3.8 Tk4-, with ANS COBOL 1972 and XPL from SHARE sources compile fine in 2020 GnuCOBOL and thanks to your port, xpl0006, with nice interopt on the modern side.

Sample of some of the efforts at https://sourceforge.net/p/open-cobol/discussion/contrib/thread/dca517cdd9

Have good, make well,
Blue, btiffin@gnu.org

Discussion

  • Brian Tiffin

    Brian Tiffin - 2020-07-04

    :-)

    Yes and no. As I was about to try and write up a minimal. I can't quite get the incantations that left the descriptors unset. All works as advertised.

    I was early exploring, and using sed to rename function entries generated, and when trying to reproduce, it all just works, Daniel, no traceback.

    prompt$ make tryargs
    xpl -I -m args.xpl
    XPL to C language translator -- version 0.6
    12 cards containing 9 statements were compiled.
    No errors were detected.
    args
    XPL command line arguments
    0 
    date: 120186 (year - 1900) * 1000 + day of year
    time: 2053243 centiseconds since midnight
    GnuCOBOL/XPL trial complete
    

    args.xpl as

    /* display CLI args */
    args: procedure;
      output = 'XPL command line arguments';
      output = argc || ' ' || argv(0);
      declare i bit(16);
      do i = argc - 1 to 1 by -1;
        output = '    ' || argv(i);
      end;
      output = 'date: ' || date || ' (year - 1900) * 1000 + day of year';
      output = 'time: ' || time || ' centiseconds since midnight';
    end args;
    eof
    

    You can close this, I think. I can't find screen history for a transcript, It was a nice traceback from the XPL runtime. I was changing generated sources of both xpl0006 and cobc to experiment, and will take blame for mixing something up. It might have been a top level sans procedure label. :-)

    Turns out there is no need to tweak code gen, and everything just works with -m.

    I'll continue to explore where XPL might meld with COBOL. Nice work.

    Cheers,
    Blue

     

    Last edit: Brian Tiffin 2020-07-04
  • Daniel Weaver

    Daniel Weaver - 2021-05-15
    • Owner: Anonymous --> Daniel Weaver
    • Status: open --> wont-fix
    • Milestone: 1.0 --> 2.0
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.