Re: Screen management in C

Liste des GroupesRevenir à co vms 
Sujet : Re: Screen management in C
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vms
Date : 31. Dec 2024, 03:31:41
Autres entêtes
Organisation : SunSITE.dk - Supporting Open source
Message-ID : <6773578e$0$713$14726298@news.sunsite.dk>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 12/28/2024 11:52 AM, Arne Vajhøj wrote:
On 12/27/2024 2:34 PM, Arne Vajhøj wrote:
On 12/27/2024 11:12 AM, Craig A. Berry wrote:
On 12/27/24 9:17 AM, Arne Vajhøj wrote:
Because SMG$ are supporting Pascal/Basic/Cobol/Fortran then
many arguments are pass by descriptor and you will need to setup
those in C, so some familiarity with descriptors will be required.
>
This has been discussed previously here:
>
https://groups.google.com/g/comp.os.vms/c/ufBEqvGdglU
>
That discussion has pointers to various examples,
>
In general VMS Pascal/VMS Basic code should be maybe 25% shorter
than equivalent C code. But with a descriptor centric API like
SMG$ then it may be more like 40% shorter.
>
One could make a nice wrapper in C++ encapsulating the context
and convert between stl::string / C char array and descriptors.
 If anyone want to try, then I suggest:
 $ CXX/POINTER=32 ...
 or you will regret it.
So I tried based on:
* almost 1:1 between wrapper methods and SMG$ functions
* integer in by reference -> by value
* integer out by reference -> integer return value
* string in by descriptor -> char* or stl::string in
* string out by descriptor -> stl::string return value
* status code -> throw exception
* expose displayid, pasteboardid and keyboardid so wrapper
   can be mixed with custom SMG$ function calls
* use original SMG$ constants
Example:
#include <iostream>
using namespace std;
#include "smg.h"
int main(int argc, char *argv[])
{
     try
     {
         SMG smg(true);
         smg.PutString(1, 1, "AA");
         smg.PutString(1, 3, "BB", SMG$M_BOLD);
         smg.PutString(1, 5, "CC", SMG$M_UNDERLINE);
         smg.PutString(1, 7, "DD", SMG$M_REVERSE);
         smg.DrawRectangle(17, 1, 5, 78);
         smg.DrawHorLine(19, 2, 76);
         smg.PutString(18, 2, "ABC");
         smg.PutString(20, 2, "123");
         smg.PutString(2, 1, ">>>> ");
         string reply = smg.GetString(2, 6);
         smg.PutString(3, 1, "You entered: " + reply);
         smg.PutString(4, 1, "Hit PF1 to exit");
         while(smg.GetKey() != SMG$K_TRM_PF1);
     }
     catch(SMGexception& ex)
     {
         cout << ex.what() << endl;
     }
     return 0;
}
If anyone is interested I will make the code available.
Arne

Date Sujet#  Auteur
27 Dec 24 * Screen management in C20David Meyer
27 Dec 24 +* Re: Screen management in C18Arne Vajhøj
27 Dec 24 i`* Re: Screen management in C17Craig A. Berry
27 Dec 24 i `* Re: Screen management in C16Arne Vajhøj
27 Dec 24 i  +* Re: Screen management in C6Single Stage to Orbit
28 Dec 24 i  i`* Re: Screen management in C5Arne Vajhøj
28 Dec 24 i  i `* Re: Screen management in C4Chris Townley
28 Dec 24 i  i  +- Re: Screen management in C1Arne Vajhøj
30 Dec 24 i  i  `* Re: Screen management in C2Dave Froble
30 Dec 24 i  i   `- Re: Screen management in C1Chris Townley
28 Dec 24 i  +* Re: Screen management in C4Lawrence D'Oliveiro
28 Dec 24 i  i`* Re: Screen management in C3Arne Vajhøj
28 Dec 24 i  i +- Re: Screen management in C1Lawrence D'Oliveiro
2 Jan 25 i  i `- Re: Screen management in C1Simon Clubley
28 Dec 24 i  `* Re: Screen management in C5Arne Vajhøj
31 Dec 24 i   `* Re: Screen management in C4Arne Vajhøj
31 Dec 24 i    `* Re: Screen management in C3Lawrence D'Oliveiro
31 Dec 24 i     `* Re: Screen management in C2Arne Vajhøj
31 Dec 24 i      `- Re: Screen management in C1Lawrence D'Oliveiro
28 Dec 24 `- Re: Screen management in C1Stephen Hoffman

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal