[Info-vax] Bliss
Lawrence D'Oliveiro
ldo at nz.invalid
Fri Jul 12 23:53:48 EDT 2024
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.
More information about the Info-vax
mailing list