Re: BridgeWorks -> TIG

Liste des GroupesRevenir à co vms 
Sujet : Re: BridgeWorks -> TIG
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vms
Date : 14. Aug 2024, 15:27:25
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9iesc$f9k3$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 8/11/2024 7:03 PM, Arne Vajhøj wrote:
Not much feedback, but I did some of the outstanding tasks and
packed it up.
 Start here:
 https://www.vajhoej.dk/arne/opensource/vms/doc/tig/doc/
 Download links:
 https://www.vajhoej.dk/arne/opensource/vms/vmstig-bin-v0_1.zip
https://www.vajhoej.dk/arne/opensource/vms/vmstig-client-v0_1.zip
https://www.vajhoej.dk/arne/opensource/vms/vmstig-src-v0_1.zip
I have updated.
Despite the native languages on VMS being non-OO then it
bothered me that the client side API was really non-OO
(classes were used but without any data in the class
it is not much OO).
So I came up with a hack.
VMS code (C in this case):
struct ooctx
{
     int counter;
};
static int counter = 0;
long increment(struct ooctx *ctx)
{
     counter++;
     ctx->counter++;
     return 1;
}
long get(struct ooctx *ctx, long *c1, long *c2)
{
     *c1 = counter;
     *c2 = ctx->counter;
     return 1;
}
Silly example, but it should illustrate the difference
between a global variable and a client specific context.
XML to describe API:
<config>
     <image>demoo</image>
     <port>12350</port>
     <mt>false</mt>
     <oocontext>o</oocontext> <!-- <=============== this is the trick -->
     <server>
         <language>dk.vajhoej.vms.tig.server.JavaServerGen</language>
     </server>
     <client>
         <language>dk.vajhoej.vms.tig.client.JavaClientGen</language>
         <language>dk.vajhoej.vms.tig.client.CSharpClientGen</language>
         <language>dk.vajhoej.vms.tig.client.PyClientGen</language>
         <language>dk.vajhoej.vms.tig.client.CppClientGen</language>
     </client>
     <methods>
         <method>
             <name>increment</name>
             <args/>
         </method>
         <method>
             <name>get</name>
             <args>
                 <arg>
                     <name>c1</name>
                     <type>LongWord</type>
                     <pass>Reference</pass>
                     <use>Out</use>
                 </arg>
                 <arg>
                     <name>c2</name>
                     <type>LongWord</type>
                     <pass>Reference</pass>
                     <use>Out</use>
                 </arg>
             </args>
         </method>
     </methods>
</config>
And let us take client in Python.
First O.py for client access to context:
import struct
class O:
     def __init__(self, counter = 0):
         self.counter = counter
     def pack(self):
         return struct.pack('<l', self.counter)
     def unpack(self, blk):
         self.counter = struct.unpack('<l', blk)[0]
Test:
from sys import argv
from DemooClient import *
for i in range(3):
     cli = DemooClient(argv[1])
     for j in range(3):
         stat = cli.increment()
         stat, c1, c2 = cli.get()
         print('%d %d (%d)' % (c1, c2, cli.oocontext().counter))
Output:
C:\Code\VMS\tig\examples>python testo.py 192.168.68.40
1 1 (1)
2 2 (2)
3 3 (3)
4 1 (1)
5 2 (2)
6 3 (3)
7 1 (1)
8 2 (2)
9 3 (3)
If one is not interested in the context client side (private context
in OO world), then one can just specify the size of the context instead
of the type.
<oocontext>o</oocontext>
->
<oocontext>4</oocontext>
and drop O.py implementation and do not try to access context
from client.
Python client:
from sys import argv
from DemoqClient import *
for i in range(3):
     cli = DemoqClient(argv[1])
     for j in range(3):
         stat = cli.increment()
         stat, c1, c2 = cli.get()
         print('%d %d' % (c1, c2))
https://www.vajhoej.dk/arne/opensource/vms/vmstig-bin-v0_2.zip
https://www.vajhoej.dk/arne/opensource/vms/vmstig-client-v0_2.zip
https://www.vajhoej.dk/arne/opensource/vms/vmstig-src-v0_2.zip
Arne

Date Sujet#  Auteur
1 Aug 24 * BridgeWorks -> TIG8Arne Vajhøj
1 Aug 24 +* Re: BridgeWorks -> TIG3Arne Vajhøj
2 Aug 24 i`* Re: BridgeWorks -> TIG2Simon Clubley
4 Aug 24 i `- Re: BridgeWorks -> TIG1Arne Vajhøj
4 Aug 24 +- Re: BridgeWorks -> TIG1Lawrence D'Oliveiro
12 Aug 24 `* Re: BridgeWorks -> TIG3Arne Vajhøj
14 Aug 24  +- Re: BridgeWorks -> TIG1Arne Vajhøj
11 Nov 24  `- Re: BridgeWorks -> TIG1Arne Vajhøj

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal