001 /* Copyright 2000, 2001, Compaq Computer Corporation */ 002 003 004 package javafe.ast; 005 006 import java.io.OutputStream; 007 import java.io.ByteArrayOutputStream; 008 import java.io.IOException; 009 import javafe.util.Assert; 010 import javafe.util.Location; 011 012 public class DelegatingPrettyPrint extends PrettyPrint { 013 014 //@ invariant del != null; 015 public PrettyPrint del; 016 017 // Caller must establish del != null! 018 //@ requires false; 019 protected DelegatingPrettyPrint() { } 020 021 //@ requires del != null; 022 //@ requires self != null; 023 protected DelegatingPrettyPrint(PrettyPrint self, PrettyPrint del) { 024 super(self); 025 this.del = del; 026 } 027 028 public void print(/*@ non_null @*/ OutputStream o, CompilationUnit cu) { 029 del.print(o, cu); 030 } 031 032 public void printnoln(/*@ non_null @*/ OutputStream o, int ind, TypeDecl d) { 033 del.printnoln(o, ind, d); 034 } 035 036 public void print(/*@ non_null @*/ OutputStream o, int ind, Stmt s) { 037 del.print(o, ind, s); 038 } 039 040 public void print(/*@ non_null @*/ OutputStream o, int ind, TypeDeclElem d, 041 Identifier classId, boolean showBody) { 042 del.print(o, ind, d, classId, showBody); 043 } 044 045 public void print(/*@ non_null @*/ OutputStream o, TypeNameVec tns) { 046 del.print(o, tns); 047 } 048 049 public void print(/*@ non_null @*/ OutputStream o, int ind, FormalParaDeclVec fps) { 050 del.print(o, ind, fps); 051 } 052 053 public void print(/*@ non_null @*/ OutputStream o, int ind, ExprVec es) { 054 del.print(o, ind, es); 055 } 056 057 public void print(/*@ non_null @*/ OutputStream o, GenericVarDecl d) { 058 del.print(o, d); 059 } 060 061 public void print(/*@ non_null @*/ OutputStream o, int ind, LocalVarDecl d, 062 boolean showBody) { 063 del.print(o, ind, d, showBody); 064 } 065 066 public void print(/*@ non_null @*/ OutputStream o, int ind, FieldDecl d, boolean showBody) { 067 del.print(o, ind, d, showBody); 068 } 069 070 public void print(/*@ non_null @*/ OutputStream o, Type t) { 071 del.print(o, t); 072 } 073 074 public void print(/*@ non_null @*/ OutputStream o, Name n) { 075 del.print(o, n); 076 } 077 078 public void print(/*@ non_null @*/ OutputStream o, int ind, VarInit e) { 079 del.print(o, ind, e); 080 } 081 082 public void print(/*@ non_null @*/ OutputStream o, int ind, ObjectDesignator od) { 083 del.print(o, ind, od); 084 } 085 086 public void print(/*@ non_null @*/ OutputStream o, LexicalPragma lp) { 087 del.print(o, lp); 088 } 089 090 public void print(/*@ non_null @*/ OutputStream o, int ind, TypeDeclElemPragma tp) { 091 del.print(o, ind, tp); 092 } 093 094 public void print(/*@ non_null @*/ OutputStream o, int ind, ModifierPragma mp) { 095 del.print(o, ind, mp); 096 } 097 098 public void print(/*@ non_null @*/ OutputStream o, int ind, StmtPragma sp) { 099 del.print(o, ind, sp); 100 } 101 102 public void print(/*@ non_null @*/ OutputStream o, int ind, TypeModifierPragma tp) { 103 del.print(o, ind, tp); 104 } 105 106 public /*@ non_null @*/ String toString(int tag) { 107 return del.toString(tag); 108 } 109 } 110 111 112 113