 	name
 
 register = (type, hint, pub = false) ->
-	name = type.typename? hint
-	if not type.name?
-		allTypes[type.name = name] = type
-	type.pub or= pub
+	type.pub or= pub or type instanceof bw.Enum
+	if not type.registered
+		type.registered = true
+		name = type.typename? hint
+		if not type.name?
+			allTypes[type.name = name] = type
+		if adapt = type.adapter?()
+			decls.adapters.push adapt
 	type.name
 
 declare = (type) -> if not type.declared and type.pub

for name, type of allTypes
	declare type

for name, type of allTypes when type.pub and type instanceof bw.Struct
	decls.forward.push "struct #{name}"

for t in ['forward', 'other']
	decls[t] = decls[t].filter (x) -> x

			declare t
	decl = type.declaration?() ? (type.spec and type.name != type.spec and "using #{type.name} = #{type.spec}" or "")
	decls[if not deps then 'forward' else 'other'].push decl

capitalizeFirstLetter = (s) -> s[0].toUpperCase() + s.substring 1

