Based on GenTypeCode.m3 from the stablegen package Copyright (C) 1989, Digital Equipment Corporation All rights reserved. See the file COPYRIGHT for a full description. Created by Susan Owicki Last modified on Wed Sep 28 12:03:12 PDT 1994 by weich
The module provides code producing procedures for the stub generator.
MODULE======; IMPORT Atom, Wr, Formatter, Type, SOxCodeFiles, Time, FmtTime, Stdio, Params, Thread; <*FATAL Wr.Failure*> VAR stubchatter: Wr.T; SOxCodeUtils
PROCEDURE======SetPerfMon (flag: BOOLEAN) = BEGIN perfMon := flag; END SetPerfMon; PROCEDURESetObliqCode (flag: BOOLEAN) = BEGIN genObliqCode := flag; END SetObliqCode; PROCEDURESetProxyCode (flag: BOOLEAN) = BEGIN genProxyCode := flag; END SetProxyCode;
PROCEDURE======Message (text: TEXT) = BEGIN TRY Wr.PutText(stubchatter, Params.Get(0) & ": " & text & "\n") EXCEPT | Thread.Alerted => (* ignore *) END; END Message;
PROCEDURE======HeaderComment (writer: Formatter.T; fileName: TEXT) = BEGIN Formatter.PutText(writer,"(***************************************" & "******************************\n"); Formatter.PutText(writer," * " & fileName & "\n"); Formatter.PutText(writer," * DO NOT EDIT --> generated by " & Params.Get(0) & "\n"); Formatter.PutText(writer," * " & FmtTime.Long(Time.Now()) & "\n"); Formatter.PutText(writer," ***************************************" & "******************************)\n\n"); END HeaderComment;
PROCEDURE======FileName (baseName: TEXT; filetype: SOxCodeFiles.T): TEXT = VAR typ : TEXT; BEGIN CASE filetype OF | SOxCodeFiles.T.CB_I3, SOxCodeFiles.T.CB_M3 => typ := "CB"; | SOxCodeFiles.T.PRX_I3 => typ := "Proxy"; | SOxCodeFiles.T.CBPRX_I3 => typ := "CBProxy"; | SOxCodeFiles.T.SO_M3 => typ := "SO"; | SOxCodeFiles.T.PKL_I3 => typ := "Pickle"; | SOxCodeFiles.T.OB_I3, SOxCodeFiles.T.OB_M3 => baseName := "Ob" & baseName; typ := ""; | SOxCodeFiles.T.OBCB_I3, SOxCodeFiles.T.OBCB_M3 => baseName := "Ob" & baseName; typ := "CB"; | SOxCodeFiles.T.OB_OBL, SOxCodeFiles.T.OB_HLP => typ := ""; | SOxCodeFiles.T.OBCB_OBL, SOxCodeFiles.T.OBCB_HLP => typ := "CB"; ELSE typ := ""; END; RETURN baseName & typ; END FileName;
PROCEDURE======FileExtension (filetype: SOxCodeFiles.T): TEXT = BEGIN CASE filetype OF | SOxCodeFiles.T.CB_I3, SOxCodeFiles.T.OB_I3, SOxCodeFiles.T.OBCB_I3, SOxCodeFiles.T.PRX_I3, SOxCodeFiles.T.CBPRX_I3, SOxCodeFiles.T.PKL_I3 => RETURN ".i3"; | SOxCodeFiles.T.CB_M3, SOxCodeFiles.T.SO_M3, SOxCodeFiles.T.OB_M3, SOxCodeFiles.T.OBCB_M3 => RETURN ".m3"; | SOxCodeFiles.T.OB_OBL, SOxCodeFiles.T.OBCB_OBL => RETURN ".obl"; | SOxCodeFiles.T.OB_HLP, SOxCodeFiles.T.OBCB_HLP => RETURN ".hlp"; ELSE RETURN ""; END; END FileExtension;
PROCEDURE======DoFile (filetype: SOxCodeFiles.T): BOOLEAN = BEGIN CASE filetype OF | SOxCodeFiles.T.CB_I3, SOxCodeFiles.T.CBPRX_I3, SOxCodeFiles.T.CB_M3, SOxCodeFiles.T.SO_M3, SOxCodeFiles.T.PKL_I3 => RETURN TRUE; | SOxCodeFiles.T.PRX_I3 => RETURN genProxyCode; | SOxCodeFiles.T.OB_I3, SOxCodeFiles.T.OBCB_I3, SOxCodeFiles.T.OB_OBL, SOxCodeFiles.T.OBCB_OBL, SOxCodeFiles.T.OB_HLP, SOxCodeFiles.T.OBCB_HLP, SOxCodeFiles.T.OB_M3, SOxCodeFiles.T.OBCB_M3 => RETURN genObliqCode; ELSE RETURN FALSE; END; END DoFile;
PROCEDUREBaseName (type: Type.Qid): TEXT = BEGIN RETURN Atom.ToText(type.intf); (* & "_v" & Fmt.Int(Protocol.Version); *) END BaseName; BEGIN stubchatter := Stdio.stderr; END SOxCodeUtils.