[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] binding design patterns for OC

From: Patrick
Subject: [open-cobol-list] binding design patterns for OC
Date: Sat, 24 Aug 2013 10:48:16 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130809 Thunderbird/17.0.8

Hi Everyone

This may be months away from becoming code but I am daydreaming about using libclang to create a binding generator for Open Cobol. The thing is, what good would it be if it didn't generate a sensible binding design.

Bindings are tough and there are a lot of considerations to take into account. I figure one of the most important ones is to do no harm. Namespace collisions ought to be high on the list of considerations, especially with auto-generated code.

Would this be sensible:

  Outer-Scope program

Many nested programs each taking one record as an argument and return one record

linkage section for Outer-Scope that takes one string, one record and returns one record

procedure division that has one big evaluate statement that calls the correct nested program and passes it the correct record

  End Outer-Scope

If each nested program took one record, that record could contain any number of parameters and they would not clutter the evaluate statement. The returning record could likewise contain a variety of parameters.

This binding could then be complied in to the user-developers application and the programs nested within the binding would not collide with his/her application.

The call would look a little funny in that the C function name is an argument:

CALL "some-binding"
        USING BY CONTENT "some-function",
        USING BY VALUE some-record,
        RETURNING another-record  .

Any downsides to this or ways it could be improved? I thought I would try my hand at several manually written bindings before trying something automated.

Thanks for reading-Patrick

reply via email to

[Prev in Thread] Current Thread [Next in Thread]