Webspeed and Classes

Posted by jmls on 29-Nov-2009 02:51

So, here I am trying to use classes with webspeed and failing miserably. At the moment, it seems as if only non-class programs can use any webspeed method - is this true?

How can I {&OUT} in a class method ?

Please save what little there is left of my thinning hair

Julian

All Replies

Posted by Admin on 29-Nov-2009 06:11

{&OUT} translates to

PUT STREAM WebStream UNFORMATTED ...

The WebStream is defined as a SHARED stream. You can't define a SHARED stream in a class.

One thing you might try is to define the WebStream as a NEW GLOBAL SHARED STREM. That would be possible in classes and procedures. You'd have to start from src/web/objects/web-disp.p on. Check  src/web/method/cgi-defs.i. It might be as simple as adding the GLOBAL / NEW GLOBLA keyword to the DEFINE STREAM statements. But of course I haven't tried it...

And then you'd have to create a version of src/web/method/cgi-defs.i that is compatible with classes and include it in you classes.

An alternative would be to populate a (LONGCHAR or CHARACTER) variable in the classes and return that to a procedure that {&OUT}'s it. Probably not what you are seeking for, but wouldn't require modifications to the webspeed framework.

Posted by jmls on 29-Nov-2009 09:41

Thanks, Mike.

I was trying to find out where the WEBSTREAM stream is first defined, in order to see where it goes in the pecking order.

Any ideas ?

Posted by rbf on 29-Nov-2009 09:52

Julian,

How about calling an internal procedure to do the actual writing to WEBSTREAM for you?

You can even PUBLISH FROM ... in a class.

That way you don't have to modify anything in WebSpeed.

Posted by Admin on 29-Nov-2009 14:49

Check: src/web/method/cgidefs.i

/* Stream where we write all web output */

&IF DEFINED(WEBSTREAM) = 0 &THEN

  &GLOBAL-DEFINE WEBSTREAM STREAM WebStream

&ENDIF

/* Only define a stream if there's something to define */

&IF "{&WEBSTREAM}" <> "" &THEN

DEFINE {1} SHARED {&WEBSTREAM}.

&ENDIF

src/web/objects-web-disp.p does include this with NEW:

{ src/web/method/cgidefs.i  NEW } /* standard WS cgidefs.i: functions,vars */

All other programs include this without the NEW.

This thread is closed