Sujet : Re: Bliss
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.vmsDate : 13. Jul 2024, 04:53:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6stoc$3e8kc$1@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Pan/0.158 (Avdiivka; )
On Fri, 12 Jul 2024 23:23:22 -0400, Hunter Goatley wrote:
It's not much, but I successfully compiled a module. It complains about
MAIN=main, and I'm not sure why, but I successfully created a .c with a
main() that called my routine in the BLISS module (which called back to
the C module to actually print some output). Pretty slick!
I was able to compile this example adapted from page 1-15 of the May
1987 “Bliss Language Reference Manual”:
MODULE E1 (MAIN = CTRL) =
BEGIN
FORWARD ROUTINE
CTRL,
STEP;
GLOBAL ROUTINE CTRL =
!+
! This routine inputs a value, operates on it, and
! then outputs the result.
!-
BEGIN
EXTERNAL ROUTINE
GETNUM, ! Input a number from terminal
PUTNUM; ! Output a number to terminal
LOCAL
X, ! Storage for input value
Y; ! Storage for output value
GETNUM(X);
Y = STEP(.X);
PUTNUM(.Y)
END;
ROUTINE STEP(A) =
!+
! This routine adds 1 to the given value.
!-
(.A+1);
END ELUDOM
That “MAIN =” elicited no complaints, but neither did it seem to do
anything useful. I was able to link the compiled code against this
driver program:
#include <stdio.h>
void GETNUM
(
int * x
)
{
*x = 99;
} /*getnum*/
void PUTNUM
(
int x
)
{
fprintf(stdout, "putnum(%d)\n", x);
} /*putnum*/
void CTRL(void);
int main(void)
{
CTRL();
return
0;
} /*main*/
And it output the message “putnum(100)”, as expected.