Dear Hung Hung,
Given the many questions you ask, I highly recommend to you to read
Programing in Modula-2 by Niklaus Wirth. Springer. I recommend ed. 3.
This is anyway a very good and enjoyable read and should help you to understand
M2 quickly, answer all your questions efficiently, and even introduce you to
the spirit of Modula-2 and the structured programing it supports.
Regards, Andreas
ETH Zurich, Prof. em. Dr. Andreas Fischlin, IPCC Vice-Chair WGII, Systems
Ecology, CHN E 24, Universitaetstrasse 16, CH-8092 Zurich, SWITZERLAND
Tel: +41 44 633-6090 Mobile: +41 79 595-4050 Mail: address@hidden
www.sysecol.ethz.ch/people/andreas.fischlin.html
On 24 Mar 2020, at 19:15, Gaius Mulley<address@hidden> wrote:
Hưng Hưng<address@hidden> writes:
Free Pascal has this: procedure test(const x: pchar);
What is the equivalent in gm2?
I want a const pointer. e.g:
type test = pointer to integer;
procedure testit(const x: test);
I need it to be able to complete the translation of the C header to
gm2.
Hi,
there is no const pointer in Modula-2
you can either use:
example.def
DEFINITION MODULE FOR "C" example ;
TYPE
ptr = POINTER TO INTEGER ;
PROCEDURE foo (a: ptr) ;
PROCEDURE bar (VAR a: ptr) ;
END example.
fortunately you can either state this as const or without const in your
C file
example.c
void example_foo (const int *a); /* add/remove const as suits. */
void example_foo (int **a); /* add/remove const as suits. */
etc
regards,
Gaius