| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | // Copyright 2009 The Go Authors.  All rights reserved. | 
					
						
							|  |  |  | // Use of this source code is governed by a BSD-style | 
					
						
							|  |  |  | // license that can be found in the LICENSE file. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | package Exporter | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-30 17:36:03 -07:00
										 |  |  | import Utils "utils" | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | import Globals "globals" | 
					
						
							|  |  |  | import Object "object" | 
					
						
							|  |  |  | import Type "type" | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | import Universe "universe" | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type Exporter struct { | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	comp *Globals.Compilation; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	debug bool; | 
					
						
							|  |  |  | 	buf [4*1024] byte; | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 	buf_pos int; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	pkg_ref int; | 
					
						
							|  |  |  | 	type_ref int; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WriteObject(obj *Globals.Object); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WriteByte(x byte) { | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 	E.buf[E.buf_pos] = x; | 
					
						
							|  |  |  | 	E.buf_pos++; | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	/* | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							|  |  |  | 		print " ", x; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	*/ | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WriteInt(x int) { | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	x0 := x; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	for x < -64 || x >= 64 { | 
					
						
							|  |  |  | 		E.WriteByte(byte(x & 127)); | 
					
						
							|  |  |  | 		x = int(uint(x >> 7));  // arithmetic shift | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	// -64 <= x && x < 64 | 
					
						
							|  |  |  | 	E.WriteByte(byte(x + 192)); | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	/* | 
					
						
							|  |  |  | 	if E.debug { | 
					
						
							|  |  |  | 		print " #", x0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	*/ | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WriteString(s string) { | 
					
						
							|  |  |  | 	n := len(s); | 
					
						
							|  |  |  | 	E.WriteInt(n); | 
					
						
							|  |  |  | 	for i := 0; i < n; i++ { | 
					
						
							|  |  |  | 		E.WriteByte(s[i]); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	if E.debug { | 
					
						
							|  |  |  | 		print ` "`, s, `"`; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | func (E *Exporter) WritePackageTag(tag int) { | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	E.WriteInt(tag); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		if tag >= 0 { | 
					
						
							|  |  |  | 			print " [P", tag, "]";  // package ref | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			print "\nP", E.pkg_ref, ":"; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WriteTypeTag(tag int) { | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	E.WriteInt(tag); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 		if tag >= 0 { | 
					
						
							|  |  |  | 			print " [T", tag, "]";  // type ref | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 			print "\nT", E.type_ref, ": ", Type.FormStr(-tag); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | func (E *Exporter) WriteObjectTag(tag int) { | 
					
						
							|  |  |  | 	if tag < 0 { | 
					
						
							|  |  |  | 		panic "tag < 0"; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	E.WriteInt(tag); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		print "\n", Object.KindStr(tag); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WritePackage(pkg *Globals.Package) { | 
					
						
							|  |  |  | 	if E.comp.pkg_list[pkg.obj.pnolev] != pkg { | 
					
						
							|  |  |  | 		panic "inconsistent package object" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if pkg.ref >= 0 { | 
					
						
							|  |  |  | 		E.WritePackageTag(pkg.ref);  // package already exported | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	E.WritePackageTag(-1); | 
					
						
							|  |  |  | 	pkg.ref = E.pkg_ref; | 
					
						
							|  |  |  | 	E.pkg_ref++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	E.WriteString(pkg.obj.ident); | 
					
						
							|  |  |  | 	E.WriteString(pkg.file_name); | 
					
						
							|  |  |  | 	E.WriteString(pkg.key); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | func (E *Exporter) WriteScope(scope *Globals.Scope) { | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							|  |  |  | 		print " {"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for p := scope.entries.first; p != nil; p = p.next { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		E.WriteObject(p.obj); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-08-01 13:33:31 -07:00
										 |  |  | 	E.WriteObject(nil); | 
					
						
							| 
									
										
										
										
											2008-07-30 17:36:03 -07:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							|  |  |  | 		print " }"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (E *Exporter) WriteType(typ *Globals.Type) { | 
					
						
							|  |  |  | 	if typ.ref >= 0 { | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 		E.WriteTypeTag(typ.ref);  // type already exported | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 	if -typ.form >= 0 { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		panic "conflict with ref numbers"; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 	E.WriteTypeTag(-typ.form); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	typ.ref = E.type_ref; | 
					
						
							|  |  |  | 	E.type_ref++; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 	// if we have a named type, export the type identifier and package | 
					
						
							| 
									
										
										
										
											2008-08-04 10:19:36 -07:00
										 |  |  | 	ident := ""; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if typ.obj != nil { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		// named type | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 		if typ.obj.typ != typ { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 			panic "inconsistent named type"; | 
					
						
							| 
									
										
										
										
											2008-08-04 10:19:36 -07:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		ident = typ.obj.ident; | 
					
						
							|  |  |  | 		if !typ.obj.exported { | 
					
						
							|  |  |  | 			// the type is invisible (it's identifier is not exported) | 
					
						
							|  |  |  | 			// prepend "." to the identifier to make it an illegal | 
					
						
							|  |  |  | 			// identifier and thus invisible in Go source code | 
					
						
							|  |  |  | 			ident = "." + ident; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2008-08-04 10:19:36 -07:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	E.WriteString(ident); | 
					
						
							|  |  |  | 	if len(ident) > 0 { | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		// named type | 
					
						
							|  |  |  | 		E.WritePackage(E.comp.pkg_list[typ.obj.pnolev]); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-08-04 10:19:36 -07:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	switch typ.form { | 
					
						
							| 
									
										
										
										
											2008-07-31 10:47:10 -07:00
										 |  |  | 	case Type.ALIAS: | 
					
						
							|  |  |  | 		E.WriteType(typ.elt); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	case Type.ARRAY: | 
					
						
							|  |  |  | 		E.WriteInt(typ.len_); | 
					
						
							| 
									
										
										
										
											2008-07-23 16:04:11 -07:00
										 |  |  | 		E.WriteType(typ.elt); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	case Type.MAP: | 
					
						
							| 
									
										
										
										
											2008-07-23 16:04:11 -07:00
										 |  |  | 		E.WriteType(typ.key); | 
					
						
							|  |  |  | 		E.WriteType(typ.elt); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	case Type.CHANNEL: | 
					
						
							|  |  |  | 		E.WriteInt(typ.flags); | 
					
						
							| 
									
										
										
										
											2008-07-23 16:04:11 -07:00
										 |  |  | 		E.WriteType(typ.elt); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	case Type.FUNCTION: | 
					
						
							|  |  |  | 		E.WriteInt(typ.flags); | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		E.WriteScope(typ.scope); | 
					
						
							| 
									
										
										
										
											2008-07-23 16:04:11 -07:00
										 |  |  | 		 | 
					
						
							|  |  |  | 	case Type.STRUCT, Type.INTERFACE: | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 		E.WriteScope(typ.scope); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-23 16:04:11 -07:00
										 |  |  | 	case Type.POINTER, Type.REFERENCE: | 
					
						
							|  |  |  | 		E.WriteType(typ.elt); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		panic "UNREACHABLE"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | func (E *Exporter) WriteObject(obj *Globals.Object) { | 
					
						
							|  |  |  | 	if obj == nil { | 
					
						
							|  |  |  | 		E.WriteObjectTag(Object.END); | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2008-07-31 10:47:10 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 	E.WriteObjectTag(obj.kind); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if obj.kind == Object.TYPE { | 
					
						
							|  |  |  | 		// named types are handled entirely by WriteType() | 
					
						
							|  |  |  | 		if obj.typ.obj != obj { | 
					
						
							|  |  |  | 			panic "inconsistent named type" | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		E.WriteType(obj.typ); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 	E.WriteString(obj.ident); | 
					
						
							|  |  |  | 	E.WriteType(obj.typ); | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 	switch obj.kind { | 
					
						
							|  |  |  | 	case Object.CONST: | 
					
						
							|  |  |  | 		E.WriteInt(0);  // should be the correct value | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	case Object.VAR: | 
					
						
							|  |  |  | 		E.WriteInt(0);  // should be the correct address/offset | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 	case Object.FUNC: | 
					
						
							|  |  |  | 		E.WriteInt(0);  // should be the correct address/offset | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		panic "UNREACHABLE"; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | func (E *Exporter) Export(comp* Globals.Compilation, file_name string) { | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	E.comp = comp; | 
					
						
							| 
									
										
										
										
											2008-07-30 17:36:03 -07:00
										 |  |  | 	E.debug = comp.flags.debug; | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 	E.buf_pos = 0; | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	E.pkg_ref = 0; | 
					
						
							|  |  |  | 	E.type_ref = 0; | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-07-29 19:02:49 -07:00
										 |  |  | 	if E.debug { | 
					
						
							|  |  |  | 		print "exporting to ", file_name, "\n"; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	// Predeclared types are "pre-exported". | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	// TODO run the loop below only in debug mode | 
					
						
							|  |  |  | 	{	i := 0; | 
					
						
							|  |  |  | 		for p := Universe.types.first; p != nil; p = p.next { | 
					
						
							|  |  |  | 			if p.typ.ref != i { | 
					
						
							|  |  |  | 				panic "incorrect ref for predeclared type"; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			i++; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	E.type_ref = Universe.types.len_; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 	// export package 0 | 
					
						
							| 
									
										
										
										
											2008-08-04 10:19:36 -07:00
										 |  |  | 	pkg := comp.pkg_list[0]; | 
					
						
							| 
									
										
										
										
											2008-08-04 13:27:05 -07:00
										 |  |  | 	E.WritePackage(pkg); | 
					
						
							|  |  |  | 	for p := pkg.scope.entries.first; p != nil; p = p.next { | 
					
						
							|  |  |  | 		if p.obj.exported { | 
					
						
							|  |  |  | 			E.WriteObject(p.obj); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	E.WriteObject(nil); | 
					
						
							| 
									
										
										
										
											2008-07-30 17:36:03 -07:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	if E.debug { | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 		print "\n(", E.buf_pos, " bytes)\n"; | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2008-07-30 21:26:15 -07:00
										 |  |  | 	data := string(E.buf)[0 : E.buf_pos]; | 
					
						
							| 
									
										
										
										
											2008-07-18 14:04:21 -07:00
										 |  |  | 	ok := sys.writefile(file_name, data); | 
					
						
							| 
									
										
										
										
											2008-07-18 14:23:04 -07:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	if !ok { | 
					
						
							|  |  |  | 		panic "export failed"; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2008-07-15 15:37:14 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2008-07-30 17:36:03 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-04 15:37:47 -07:00
										 |  |  | export func Export(comp* Globals.Compilation, pkg_name string) { | 
					
						
							| 
									
										
										
										
											2008-07-30 17:36:03 -07:00
										 |  |  | 	var E Exporter; | 
					
						
							|  |  |  | 	(&E).Export(comp, Utils.FixExt(Utils.BaseName(pkg_name))); | 
					
						
							|  |  |  | } |