Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!necntc!ncoast!allbery From: wyle@ethz.UUCP (Wyle) Newsgroups: comp.sources.misc Subject: Modula-2 vi macro package Message-ID: <4088@ncoast.UUCP> Date: Fri, 7-Aug-87 20:23:21 EDT Article-I.D.: ncoast.4088 Posted: Fri Aug 7 20:23:21 1987 Date-Received: Sun, 9-Aug-87 08:43:41 EDT Sender: allbery@ncoast.UUCP Lines: 67 Approved: allbery@ncoast.UUCP X-Archive: comp.sources.misc/8708/8 As promised (ages ago) here follows a set of vi macros inspired by the Sara* macro package on Lilith and Ceres computers. Just put this text in the .exrc file in you modula-2 directory, and away you go! >>> Please Notice: <<< You will have to change the ascii text ^V ^[ and ^M to the ACTUAL control characters. This task is done by the vi commands: :1,$s/^V^[/^V^V^V^[/g :1,$s/^V^M/^V^V^V^M/g where the text before the slash is a carat "^" and letter combination, and the text after the second slash is ACTUAL control characters. Why does one need three (3) levels of control v? I dunno, maybe my C-shell eats one. One must no longer be jealous of the "electric-C" emacs macro package. Here is "electric-Modula-2" for us real quiche eaters. Please send me corrections, fixes, suggestions, fan-mail, money, and bagels (there are NO bagels in Switzerland). Enjoy! -Mitch - ----------------------- cut here --------------------------------- " " The vi modula-2 macro set inspired by sara macros: " Copyright (C) 1987 M F Wyle Computer Science Department " Swiss Federal Institute of Technology, Zuerich, Switzerland " Permission is hereby granted to copy this code provided that " this copyright notice is copied with it. " " map ;ce iCARDINAL var ^V^[bcw map ;C iLONGCARD var ^V^[bcw map ;in iINTEGER var ^V^[bcw map ;re iREAL var ^V^[bcw map ;R iLONGREAL var ^V^[bcw map ;bi iBITSET var ^V^[bcw map ;bo iBOOLEAN var ^V^[bcw map ;se iSET OF var ^V^[bcw map ;ar iARRAY OF var ^V^[bcw map ;pr iPROCEDURE proc(vars) : BOOLEAN;^V^M(* PreConditions: *)^V^M(* PostConditions: *)^V^MEND proc;^V^M^V^[kkkkwcw map ;pt iPOINTER TO var ^V^[bcw map ;ex iEXPORT var^V^[bcw map ;im iIMPLEMENTATION MODULE mod; ^V^[bbcw map ;fr iFROM mod IMPORT vars; ^V^[bbbbcw map ;im iIMPORT module; ^V^[bbcw map ;if iIF ( cond ) THEN^V^M statement ^V^MEND;^V^M^V^[kkkwwcw map ;ie iIF ( cond ) THEN^V^M statement ^V^MELSE^V^M statement2^V^MEND;^V^M^V^[5kwwcw map ;ii iELSEIF ( cond2 ) THEN^V^M stmnt2^V^MELSEIF ( cond3 ) THEN^V^M stmnt3^V^M^V^[ map ;wh iWHILE ( cond ) DO^V^M statement^V^MEND;^V^M^V^[kkkwwcw map ;wi iWITH var DO^V^M statement^V^MEND;^V^M^V^[kkkwcw map ;fo iFOR var := low TO high DO^V^M statement^V^MEND;^V^M^V^[kkkwcw map ;rp iREPEAT^V^M statement^V^MUNTIL ( condition );^V^M^V^[kkwcw map ;lo iLOOP^V^M statement^V^M IF ( cond ) THEN EXIT END;^V^MEND;^V^[kkkwcw map ;rc ivar = RECORD^V^M var1 : t1^V^M var2 : t2^V^MEND;^V^M^V^[kkkkcw map ;ca iCASE var OF^V^M case1 : stmnt1 ^V|^V^M case2 : stmnt2 ^V|^V^Mcase3 : stmnt3^V^M ELSE default^V^MEND; (* case *)^V^M^V^[ map ;ws iWriteString("str");^V^M^V^[kwwcw map ;wl iWriteLn;^V^M^V^[ map ;de i(* debug *)^V^MWriteString("string"); WriteInt(var); WriteLn;^V^M^V^[kwwcw - ---------------------- end of vi m-2 macro set ------------------ Mitchell F. Wyle | csnet or arpa: wyle%ifi.ethz.ch@relay.cs.net Instituet fuer Informatik | uucp: wyle@ethz.uucp ETH Zentrum / SOT | Telephone: 011 41 1 256 5237 8092 Zuerich, Switzerland