> This is from an ALgol 68 program that does nothing but add two numbers 
 > and throw them away.  Layout stinks.  But does it look remotely 
 > reasonable?

Looks fine.   Our front end will prettyprint your C-- but I'm not sure
if the result is valid C-- or if the prettyprinter is more for
debugging.  In any case

  qc-- -pp

will do something as documented on the qc--internals man page.

 > How do I indicate that this is the whole main program?  I.e., how do I 
 > tell it where to start executing?

QC-- expects that your run-time system will be written in C
and will probably want control first.  

You can 'export H as main' but you will need to give it the C calling
convention for both the procedure definition and the return.
Here's an example from our test suite:

  foreign "C" main(bits32 argc, "address" bits32 argv) {
    bits32 x, y;
    bits32 n, m;
    n, m = 987, 33;
    x, y = divmod(n, m);

    foreign "C" printf("address" answer, n, m, x, n, m, y, x * m + y);
    foreign "C" return(0);
  }

Norman
_______________________________________________
Cminusminus mailing list
[email protected]
https://cminusminus.org/mailman/listinfo/cminusminus

Reply via email to