@@ -179,7 +179,7 @@ fn pick_includes_and_builtins(out: &mut OutFile, apis: &[Api]) {
179179
180180fn write_struct < ' a > ( out : & mut OutFile < ' a > , strct : & ' a Struct , methods : & [ & ExternFn ] ) {
181181 out. set_namespace ( & strct. name . namespace ) ;
182- let guard = format ! ( "CXXBRIDGE05_STRUCT_ {}" , strct. name. to_symbol( ) ) ;
182+ let guard = format ! ( "CXXBRIDGE1_STRUCT_ {}" , strct. name. to_symbol( ) ) ;
183183 writeln ! ( out, "#ifndef {}" , guard) ;
184184 writeln ! ( out, "#define {}" , guard) ;
185185 for line in strct. doc . to_string ( ) . lines ( ) {
@@ -225,7 +225,7 @@ fn write_struct_with_methods<'a>(
225225 methods : & [ & ExternFn ] ,
226226) {
227227 out. set_namespace ( & ety. name . namespace ) ;
228- let guard = format ! ( "CXXBRIDGE05_STRUCT_ {}" , ety. name. to_symbol( ) ) ;
228+ let guard = format ! ( "CXXBRIDGE1_STRUCT_ {}" , ety. name. to_symbol( ) ) ;
229229 writeln ! ( out, "#ifndef {}" , guard) ;
230230 writeln ! ( out, "#define {}" , guard) ;
231231 for line in ety. doc . to_string ( ) . lines ( ) {
@@ -251,7 +251,7 @@ fn write_struct_with_methods<'a>(
251251
252252fn write_enum < ' a > ( out : & mut OutFile < ' a > , enm : & ' a Enum ) {
253253 out. set_namespace ( & enm. name . namespace ) ;
254- let guard = format ! ( "CXXBRIDGE05_ENUM_ {}" , enm. name. to_symbol( ) ) ;
254+ let guard = format ! ( "CXXBRIDGE1_ENUM_ {}" , enm. name. to_symbol( ) ) ;
255255 writeln ! ( out, "#ifndef {}" , guard) ;
256256 writeln ! ( out, "#define {}" , guard) ;
257257 for line in enm. doc . to_string ( ) . lines ( ) {
@@ -501,7 +501,7 @@ fn write_cxx_function_shim<'a>(out: &mut OutFile<'a>, efn: &'a ExternFn) {
501501 writeln ! ( out, " throw$.len = ::std::strlen(catch$);" ) ;
502502 writeln ! (
503503 out,
504- " throw$.ptr = ::cxxbridge05 $exception(catch$, throw$.len);" ,
504+ " throw$.ptr = ::cxxbridge1 $exception(catch$, throw$.len);" ,
505505 ) ;
506506 writeln ! ( out, " }});" ) ;
507507 writeln ! ( out, " return throw$;" ) ;
@@ -1012,7 +1012,7 @@ fn write_generic_instantiations(out: &mut OutFile) {
10121012 out. end_block ( Block :: ExternC ) ;
10131013
10141014 out. begin_block ( Block :: Namespace ( "rust" ) ) ;
1015- out. begin_block ( Block :: InlineNamespace ( "cxxbridge05 " ) ) ;
1015+ out. begin_block ( Block :: InlineNamespace ( "cxxbridge1 " ) ) ;
10161016 for ty in out. types {
10171017 if let Type :: RustBox ( ty) = ty {
10181018 if let Type :: Ident ( inner) = & ty. inner {
@@ -1026,72 +1026,72 @@ fn write_generic_instantiations(out: &mut OutFile) {
10261026 }
10271027 }
10281028 }
1029- out. end_block ( Block :: InlineNamespace ( "cxxbridge05 " ) ) ;
1029+ out. end_block ( Block :: InlineNamespace ( "cxxbridge1 " ) ) ;
10301030 out. end_block ( Block :: Namespace ( "rust" ) ) ;
10311031}
10321032
10331033fn write_rust_box_extern ( out : & mut OutFile , ident : & Pair ) {
10341034 let inner = ident. to_fully_qualified ( ) ;
10351035 let instance = ident. to_symbol ( ) ;
10361036
1037- writeln ! ( out, "#ifndef CXXBRIDGE05_RUST_BOX_ {}" , instance) ;
1038- writeln ! ( out, "#define CXXBRIDGE05_RUST_BOX_ {}" , instance) ;
1037+ writeln ! ( out, "#ifndef CXXBRIDGE1_RUST_BOX_ {}" , instance) ;
1038+ writeln ! ( out, "#define CXXBRIDGE1_RUST_BOX_ {}" , instance) ;
10391039 writeln ! (
10401040 out,
1041- "void cxxbridge05 $box${}$uninit(::rust::Box<{}> *ptr) noexcept;" ,
1041+ "void cxxbridge1 $box${}$uninit(::rust::Box<{}> *ptr) noexcept;" ,
10421042 instance, inner,
10431043 ) ;
10441044 writeln ! (
10451045 out,
1046- "void cxxbridge05 $box${}$drop(::rust::Box<{}> *ptr) noexcept;" ,
1046+ "void cxxbridge1 $box${}$drop(::rust::Box<{}> *ptr) noexcept;" ,
10471047 instance, inner,
10481048 ) ;
1049- writeln ! ( out, "#endif // CXXBRIDGE05_RUST_BOX_ {}" , instance) ;
1049+ writeln ! ( out, "#endif // CXXBRIDGE1_RUST_BOX_ {}" , instance) ;
10501050}
10511051
10521052fn write_rust_vec_extern ( out : & mut OutFile , element : & ResolvableName ) {
10531053 let element = Type :: Ident ( element. clone ( ) ) ;
10541054 let inner = to_typename ( & element, out. types ) ;
10551055 let instance = to_mangled ( & element, out. types ) ;
10561056
1057- writeln ! ( out, "#ifndef CXXBRIDGE05_RUST_VEC_ {}" , instance) ;
1058- writeln ! ( out, "#define CXXBRIDGE05_RUST_VEC_ {}" , instance) ;
1057+ writeln ! ( out, "#ifndef CXXBRIDGE1_RUST_VEC_ {}" , instance) ;
1058+ writeln ! ( out, "#define CXXBRIDGE1_RUST_VEC_ {}" , instance) ;
10591059 writeln ! (
10601060 out,
1061- "void cxxbridge05 $rust_vec${}$new(const ::rust::Vec<{}> *ptr) noexcept;" ,
1061+ "void cxxbridge1 $rust_vec${}$new(const ::rust::Vec<{}> *ptr) noexcept;" ,
10621062 instance, inner,
10631063 ) ;
10641064 writeln ! (
10651065 out,
1066- "void cxxbridge05 $rust_vec${}$drop(::rust::Vec<{}> *ptr) noexcept;" ,
1066+ "void cxxbridge1 $rust_vec${}$drop(::rust::Vec<{}> *ptr) noexcept;" ,
10671067 instance, inner,
10681068 ) ;
10691069 writeln ! (
10701070 out,
1071- "size_t cxxbridge05 $rust_vec${}$len(const ::rust::Vec<{}> *ptr) noexcept;" ,
1071+ "size_t cxxbridge1 $rust_vec${}$len(const ::rust::Vec<{}> *ptr) noexcept;" ,
10721072 instance, inner,
10731073 ) ;
10741074 writeln ! (
10751075 out,
1076- "const {} *cxxbridge05 $rust_vec${}$data(const ::rust::Vec<{0}> *ptr) noexcept;" ,
1076+ "const {} *cxxbridge1 $rust_vec${}$data(const ::rust::Vec<{0}> *ptr) noexcept;" ,
10771077 inner, instance,
10781078 ) ;
10791079 writeln ! (
10801080 out,
1081- "void cxxbridge05 $rust_vec${}$reserve_total(::rust::Vec<{}> *ptr, size_t cap) noexcept;" ,
1081+ "void cxxbridge1 $rust_vec${}$reserve_total(::rust::Vec<{}> *ptr, size_t cap) noexcept;" ,
10821082 instance, inner,
10831083 ) ;
10841084 writeln ! (
10851085 out,
1086- "void cxxbridge05 $rust_vec${}$set_len(::rust::Vec<{}> *ptr, size_t len) noexcept;" ,
1086+ "void cxxbridge1 $rust_vec${}$set_len(::rust::Vec<{}> *ptr, size_t len) noexcept;" ,
10871087 instance, inner,
10881088 ) ;
10891089 writeln ! (
10901090 out,
1091- "size_t cxxbridge05 $rust_vec${}$stride() noexcept;" ,
1091+ "size_t cxxbridge1 $rust_vec${}$stride() noexcept;" ,
10921092 instance,
10931093 ) ;
1094- writeln ! ( out, "#endif // CXXBRIDGE05_RUST_VEC_ {}" , instance) ;
1094+ writeln ! ( out, "#endif // CXXBRIDGE1_RUST_VEC_ {}" , instance) ;
10951095}
10961096
10971097fn write_rust_box_impl ( out : & mut OutFile , ident : & Pair ) {
@@ -1100,12 +1100,12 @@ fn write_rust_box_impl(out: &mut OutFile, ident: &Pair) {
11001100
11011101 writeln ! ( out, "template <>" ) ;
11021102 writeln ! ( out, "void Box<{}>::uninit() noexcept {{" , inner) ;
1103- writeln ! ( out, " cxxbridge05 $box${}$uninit(this);" , instance) ;
1103+ writeln ! ( out, " cxxbridge1 $box${}$uninit(this);" , instance) ;
11041104 writeln ! ( out, "}}" ) ;
11051105
11061106 writeln ! ( out, "template <>" ) ;
11071107 writeln ! ( out, "void Box<{}>::drop() noexcept {{" , inner) ;
1108- writeln ! ( out, " cxxbridge05 $box${}$drop(this);" , instance) ;
1108+ writeln ! ( out, " cxxbridge1 $box${}$drop(this);" , instance) ;
11091109 writeln ! ( out, "}}" ) ;
11101110}
11111111
@@ -1116,30 +1116,22 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &ResolvableName) {
11161116
11171117 writeln ! ( out, "template <>" ) ;
11181118 writeln ! ( out, "Vec<{}>::Vec() noexcept {{" , inner) ;
1119- writeln ! ( out, " cxxbridge05 $rust_vec${}$new(this);" , instance) ;
1119+ writeln ! ( out, " cxxbridge1 $rust_vec${}$new(this);" , instance) ;
11201120 writeln ! ( out, "}}" ) ;
11211121
11221122 writeln ! ( out, "template <>" ) ;
11231123 writeln ! ( out, "void Vec<{}>::drop() noexcept {{" , inner) ;
1124- writeln ! (
1125- out,
1126- " return cxxbridge05$rust_vec${}$drop(this);" ,
1127- instance,
1128- ) ;
1124+ writeln ! ( out, " return cxxbridge1$rust_vec${}$drop(this);" , instance) ;
11291125 writeln ! ( out, "}}" ) ;
11301126
11311127 writeln ! ( out, "template <>" ) ;
11321128 writeln ! ( out, "size_t Vec<{}>::size() const noexcept {{" , inner) ;
1133- writeln ! ( out, " return cxxbridge05 $rust_vec${}$len(this);" , instance) ;
1129+ writeln ! ( out, " return cxxbridge1 $rust_vec${}$len(this);" , instance) ;
11341130 writeln ! ( out, "}}" ) ;
11351131
11361132 writeln ! ( out, "template <>" ) ;
11371133 writeln ! ( out, "const {} *Vec<{0}>::data() const noexcept {{" , inner) ;
1138- writeln ! (
1139- out,
1140- " return cxxbridge05$rust_vec${}$data(this);" ,
1141- instance,
1142- ) ;
1134+ writeln ! ( out, " return cxxbridge1$rust_vec${}$data(this);" , instance) ;
11431135 writeln ! ( out, "}}" ) ;
11441136
11451137 writeln ! ( out, "template <>" ) ;
@@ -1150,7 +1142,7 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &ResolvableName) {
11501142 ) ;
11511143 writeln ! (
11521144 out,
1153- " return cxxbridge05 $rust_vec${}$reserve_total(this, cap);" ,
1145+ " return cxxbridge1 $rust_vec${}$reserve_total(this, cap);" ,
11541146 instance,
11551147 ) ;
11561148 writeln ! ( out, "}}" ) ;
@@ -1159,27 +1151,27 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &ResolvableName) {
11591151 writeln ! ( out, "void Vec<{}>::set_len(size_t len) noexcept {{" , inner) ;
11601152 writeln ! (
11611153 out,
1162- " return cxxbridge05 $rust_vec${}$set_len(this, len);" ,
1154+ " return cxxbridge1 $rust_vec${}$set_len(this, len);" ,
11631155 instance,
11641156 ) ;
11651157 writeln ! ( out, "}}" ) ;
11661158
11671159 writeln ! ( out, "template <>" ) ;
11681160 writeln ! ( out, "size_t Vec<{}>::stride() noexcept {{" , inner) ;
1169- writeln ! ( out, " return cxxbridge05 $rust_vec${}$stride();" , instance) ;
1161+ writeln ! ( out, " return cxxbridge1 $rust_vec${}$stride();" , instance) ;
11701162 writeln ! ( out, "}}" ) ;
11711163}
11721164
11731165fn write_unique_ptr ( out : & mut OutFile , ident : & ResolvableName ) {
11741166 let ty = Type :: Ident ( ident. clone ( ) ) ;
11751167 let instance = to_mangled ( & ty, out. types ) ;
11761168
1177- writeln ! ( out, "#ifndef CXXBRIDGE05_UNIQUE_PTR_ {}" , instance) ;
1178- writeln ! ( out, "#define CXXBRIDGE05_UNIQUE_PTR_ {}" , instance) ;
1169+ writeln ! ( out, "#ifndef CXXBRIDGE1_UNIQUE_PTR_ {}" , instance) ;
1170+ writeln ! ( out, "#define CXXBRIDGE1_UNIQUE_PTR_ {}" , instance) ;
11791171
11801172 write_unique_ptr_common ( out, & ty) ;
11811173
1182- writeln ! ( out, "#endif // CXXBRIDGE05_UNIQUE_PTR_ {}" , instance) ;
1174+ writeln ! ( out, "#endif // CXXBRIDGE1_UNIQUE_PTR_ {}" , instance) ;
11831175}
11841176
11851177// Shared by UniquePtr<T> and UniquePtr<CxxVector<T>>.
@@ -1213,15 +1205,15 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type) {
12131205 ) ;
12141206 writeln ! (
12151207 out,
1216- "void cxxbridge05 $unique_ptr${}$null(::std::unique_ptr<{}> *ptr) noexcept {{" ,
1208+ "void cxxbridge1 $unique_ptr${}$null(::std::unique_ptr<{}> *ptr) noexcept {{" ,
12171209 instance, inner,
12181210 ) ;
12191211 writeln ! ( out, " new (ptr) ::std::unique_ptr<{}>();" , inner) ;
12201212 writeln ! ( out, "}}" ) ;
12211213 if can_construct_from_value {
12221214 writeln ! (
12231215 out,
1224- "void cxxbridge05 $unique_ptr${}$new(::std::unique_ptr<{}> *ptr, {} *value) noexcept {{" ,
1216+ "void cxxbridge1 $unique_ptr${}$new(::std::unique_ptr<{}> *ptr, {} *value) noexcept {{" ,
12251217 instance, inner, inner,
12261218 ) ;
12271219 writeln ! (
@@ -1233,28 +1225,28 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type) {
12331225 }
12341226 writeln ! (
12351227 out,
1236- "void cxxbridge05 $unique_ptr${}$raw(::std::unique_ptr<{}> *ptr, {} *raw) noexcept {{" ,
1228+ "void cxxbridge1 $unique_ptr${}$raw(::std::unique_ptr<{}> *ptr, {} *raw) noexcept {{" ,
12371229 instance, inner, inner,
12381230 ) ;
12391231 writeln ! ( out, " new (ptr) ::std::unique_ptr<{}>(raw);" , inner) ;
12401232 writeln ! ( out, "}}" ) ;
12411233 writeln ! (
12421234 out,
1243- "const {} *cxxbridge05 $unique_ptr${}$get(const ::std::unique_ptr<{}>& ptr) noexcept {{" ,
1235+ "const {} *cxxbridge1 $unique_ptr${}$get(const ::std::unique_ptr<{}>& ptr) noexcept {{" ,
12441236 inner, instance, inner,
12451237 ) ;
12461238 writeln ! ( out, " return ptr.get();" ) ;
12471239 writeln ! ( out, "}}" ) ;
12481240 writeln ! (
12491241 out,
1250- "{} *cxxbridge05 $unique_ptr${}$release(::std::unique_ptr<{}>& ptr) noexcept {{" ,
1242+ "{} *cxxbridge1 $unique_ptr${}$release(::std::unique_ptr<{}>& ptr) noexcept {{" ,
12511243 inner, instance, inner,
12521244 ) ;
12531245 writeln ! ( out, " return ptr.release();" ) ;
12541246 writeln ! ( out, "}}" ) ;
12551247 writeln ! (
12561248 out,
1257- "void cxxbridge05 $unique_ptr${}$drop(::std::unique_ptr<{}> *ptr) noexcept {{" ,
1249+ "void cxxbridge1 $unique_ptr${}$drop(::std::unique_ptr<{}> *ptr) noexcept {{" ,
12581250 instance, inner,
12591251 ) ;
12601252 writeln ! ( out, " ptr->~unique_ptr();" ) ;
@@ -1266,24 +1258,24 @@ fn write_cxx_vector(out: &mut OutFile, vector_ty: &Type, element: &ResolvableNam
12661258 let inner = to_typename ( & element, out. types ) ;
12671259 let instance = to_mangled ( & element, out. types ) ;
12681260
1269- writeln ! ( out, "#ifndef CXXBRIDGE05_VECTOR_ {}" , instance) ;
1270- writeln ! ( out, "#define CXXBRIDGE05_VECTOR_ {}" , instance) ;
1261+ writeln ! ( out, "#ifndef CXXBRIDGE1_VECTOR_ {}" , instance) ;
1262+ writeln ! ( out, "#define CXXBRIDGE1_VECTOR_ {}" , instance) ;
12711263 writeln ! (
12721264 out,
1273- "size_t cxxbridge05 $std$vector${}$size(const ::std::vector<{}> &s) noexcept {{" ,
1265+ "size_t cxxbridge1 $std$vector${}$size(const ::std::vector<{}> &s) noexcept {{" ,
12741266 instance, inner,
12751267 ) ;
12761268 writeln ! ( out, " return s.size();" ) ;
12771269 writeln ! ( out, "}}" ) ;
12781270 writeln ! (
12791271 out,
1280- "const {} *cxxbridge05 $std$vector${}$get_unchecked(const ::std::vector<{}> &s, size_t pos) noexcept {{" ,
1272+ "const {} *cxxbridge1 $std$vector${}$get_unchecked(const ::std::vector<{}> &s, size_t pos) noexcept {{" ,
12811273 inner, instance, inner,
12821274 ) ;
12831275 writeln ! ( out, " return &s[pos];" ) ;
12841276 writeln ! ( out, "}}" ) ;
12851277
12861278 write_unique_ptr_common ( out, vector_ty) ;
12871279
1288- writeln ! ( out, "#endif // CXXBRIDGE05_VECTOR_ {}" , instance) ;
1280+ writeln ! ( out, "#endif // CXXBRIDGE1_VECTOR_ {}" , instance) ;
12891281}
0 commit comments