Xref: utzoo comp.lang.modula2:761 comp.lang.misc:1417 comp.lang.c:9158 comp.lang.pascal:792 Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!amdahl!nsc!taux01!avi From: avi@taux01.UUCP (Avi Bloch) Newsgroups: comp.lang.modula2,comp.lang.misc,comp.lang.c,comp.lang.pascal Subject: Re: Modula2's godawful IO. Message-ID: <560@taux01.UUCP> Date: 11 Apr 88 12:15:20 GMT References: <764@ndsuvax.UUCP> <535@m10ux.UUCP> Reply-To: avi@taux01.UUCP (Avi Bloch) Organization: National Semiconductor (Israel) Ltd. Lines: 37 Keywords: printf Summary: Using printf in Modula-2 > >I hate C as much as the next guy, but it seems to me that printf is >the solution. Has anyone ever written some kind of front end for a >modula compiler to turn printf's into WriteSh*t's? Another, more general solution, is the one we took when developing National's Modula-2 compiler. We wanted to be able to interface with any C routine, even those that weren't as strict as Modua-2 routines (e.g. num. & type of parameters procedure or function, etc.). The following is an excerpt from the manual on the extension we added for this purpose: PSEUDO-MODULE 'C' ----------------- A pseudo-module 'C' has been implemented which, like the pseudo-module SYSTEM does not actually exist but is built into the compiler. Module C is used to import C routines that cannot be defined using a Modula-2 definition, e.g. routines that have a variable number of parameters (see following example). Objects imported from module C have the following properties: - The object must be a procedure. - No type-checking is done on parameters to such procedures. - The procedures can receive any number of pararmeters. - The procedures can be called using either a procedure call or a function call. - Values returned by such procedures are of type WORD. Example: Give the IMPORT statement: FROM C IMPORT printf; all of the following statements are legal: printf; printf(string, integer, longreal); cardinal = printf(string, integer, longreal);