@@ -179,7 +179,7 @@ fn pick_includes_and_builtins(out: &mut OutFile, apis: &[Api]) {
179
179
180
180
fn write_struct < ' a > ( out : & mut OutFile < ' a > , strct : & ' a Struct , methods : & [ & ExternFn ] ) {
181
181
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( ) ) ;
183
183
writeln ! ( out, "#ifndef {}" , guard) ;
184
184
writeln ! ( out, "#define {}" , guard) ;
185
185
for line in strct. doc . to_string ( ) . lines ( ) {
@@ -225,7 +225,7 @@ fn write_struct_with_methods<'a>(
225
225
methods : & [ & ExternFn ] ,
226
226
) {
227
227
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( ) ) ;
229
229
writeln ! ( out, "#ifndef {}" , guard) ;
230
230
writeln ! ( out, "#define {}" , guard) ;
231
231
for line in ety. doc . to_string ( ) . lines ( ) {
@@ -251,7 +251,7 @@ fn write_struct_with_methods<'a>(
251
251
252
252
fn write_enum < ' a > ( out : & mut OutFile < ' a > , enm : & ' a Enum ) {
253
253
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( ) ) ;
255
255
writeln ! ( out, "#ifndef {}" , guard) ;
256
256
writeln ! ( out, "#define {}" , guard) ;
257
257
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) {
501
501
writeln ! ( out, " throw$.len = ::std::strlen(catch$);" ) ;
502
502
writeln ! (
503
503
out,
504
- " throw$.ptr = ::cxxbridge05 $exception(catch$, throw$.len);" ,
504
+ " throw$.ptr = ::cxxbridge1 $exception(catch$, throw$.len);" ,
505
505
) ;
506
506
writeln ! ( out, " }});" ) ;
507
507
writeln ! ( out, " return throw$;" ) ;
@@ -1012,7 +1012,7 @@ fn write_generic_instantiations(out: &mut OutFile) {
1012
1012
out. end_block ( Block :: ExternC ) ;
1013
1013
1014
1014
out. begin_block ( Block :: Namespace ( "rust" ) ) ;
1015
- out. begin_block ( Block :: InlineNamespace ( "cxxbridge05 " ) ) ;
1015
+ out. begin_block ( Block :: InlineNamespace ( "cxxbridge1 " ) ) ;
1016
1016
for ty in out. types {
1017
1017
if let Type :: RustBox ( ty) = ty {
1018
1018
if let Type :: Ident ( inner) = & ty. inner {
@@ -1026,72 +1026,72 @@ fn write_generic_instantiations(out: &mut OutFile) {
1026
1026
}
1027
1027
}
1028
1028
}
1029
- out. end_block ( Block :: InlineNamespace ( "cxxbridge05 " ) ) ;
1029
+ out. end_block ( Block :: InlineNamespace ( "cxxbridge1 " ) ) ;
1030
1030
out. end_block ( Block :: Namespace ( "rust" ) ) ;
1031
1031
}
1032
1032
1033
1033
fn write_rust_box_extern ( out : & mut OutFile , ident : & Pair ) {
1034
1034
let inner = ident. to_fully_qualified ( ) ;
1035
1035
let instance = ident. to_symbol ( ) ;
1036
1036
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) ;
1039
1039
writeln ! (
1040
1040
out,
1041
- "void cxxbridge05 $box${}$uninit(::rust::Box<{}> *ptr) noexcept;" ,
1041
+ "void cxxbridge1 $box${}$uninit(::rust::Box<{}> *ptr) noexcept;" ,
1042
1042
instance, inner,
1043
1043
) ;
1044
1044
writeln ! (
1045
1045
out,
1046
- "void cxxbridge05 $box${}$drop(::rust::Box<{}> *ptr) noexcept;" ,
1046
+ "void cxxbridge1 $box${}$drop(::rust::Box<{}> *ptr) noexcept;" ,
1047
1047
instance, inner,
1048
1048
) ;
1049
- writeln ! ( out, "#endif // CXXBRIDGE05_RUST_BOX_ {}" , instance) ;
1049
+ writeln ! ( out, "#endif // CXXBRIDGE1_RUST_BOX_ {}" , instance) ;
1050
1050
}
1051
1051
1052
1052
fn write_rust_vec_extern ( out : & mut OutFile , element : & ResolvableName ) {
1053
1053
let element = Type :: Ident ( element. clone ( ) ) ;
1054
1054
let inner = to_typename ( & element, out. types ) ;
1055
1055
let instance = to_mangled ( & element, out. types ) ;
1056
1056
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) ;
1059
1059
writeln ! (
1060
1060
out,
1061
- "void cxxbridge05 $rust_vec${}$new(const ::rust::Vec<{}> *ptr) noexcept;" ,
1061
+ "void cxxbridge1 $rust_vec${}$new(const ::rust::Vec<{}> *ptr) noexcept;" ,
1062
1062
instance, inner,
1063
1063
) ;
1064
1064
writeln ! (
1065
1065
out,
1066
- "void cxxbridge05 $rust_vec${}$drop(::rust::Vec<{}> *ptr) noexcept;" ,
1066
+ "void cxxbridge1 $rust_vec${}$drop(::rust::Vec<{}> *ptr) noexcept;" ,
1067
1067
instance, inner,
1068
1068
) ;
1069
1069
writeln ! (
1070
1070
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;" ,
1072
1072
instance, inner,
1073
1073
) ;
1074
1074
writeln ! (
1075
1075
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;" ,
1077
1077
inner, instance,
1078
1078
) ;
1079
1079
writeln ! (
1080
1080
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;" ,
1082
1082
instance, inner,
1083
1083
) ;
1084
1084
writeln ! (
1085
1085
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;" ,
1087
1087
instance, inner,
1088
1088
) ;
1089
1089
writeln ! (
1090
1090
out,
1091
- "size_t cxxbridge05 $rust_vec${}$stride() noexcept;" ,
1091
+ "size_t cxxbridge1 $rust_vec${}$stride() noexcept;" ,
1092
1092
instance,
1093
1093
) ;
1094
- writeln ! ( out, "#endif // CXXBRIDGE05_RUST_VEC_ {}" , instance) ;
1094
+ writeln ! ( out, "#endif // CXXBRIDGE1_RUST_VEC_ {}" , instance) ;
1095
1095
}
1096
1096
1097
1097
fn write_rust_box_impl ( out : & mut OutFile , ident : & Pair ) {
@@ -1100,12 +1100,12 @@ fn write_rust_box_impl(out: &mut OutFile, ident: &Pair) {
1100
1100
1101
1101
writeln ! ( out, "template <>" ) ;
1102
1102
writeln ! ( out, "void Box<{}>::uninit() noexcept {{" , inner) ;
1103
- writeln ! ( out, " cxxbridge05 $box${}$uninit(this);" , instance) ;
1103
+ writeln ! ( out, " cxxbridge1 $box${}$uninit(this);" , instance) ;
1104
1104
writeln ! ( out, "}}" ) ;
1105
1105
1106
1106
writeln ! ( out, "template <>" ) ;
1107
1107
writeln ! ( out, "void Box<{}>::drop() noexcept {{" , inner) ;
1108
- writeln ! ( out, " cxxbridge05 $box${}$drop(this);" , instance) ;
1108
+ writeln ! ( out, " cxxbridge1 $box${}$drop(this);" , instance) ;
1109
1109
writeln ! ( out, "}}" ) ;
1110
1110
}
1111
1111
@@ -1116,30 +1116,22 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &ResolvableName) {
1116
1116
1117
1117
writeln ! ( out, "template <>" ) ;
1118
1118
writeln ! ( out, "Vec<{}>::Vec() noexcept {{" , inner) ;
1119
- writeln ! ( out, " cxxbridge05 $rust_vec${}$new(this);" , instance) ;
1119
+ writeln ! ( out, " cxxbridge1 $rust_vec${}$new(this);" , instance) ;
1120
1120
writeln ! ( out, "}}" ) ;
1121
1121
1122
1122
writeln ! ( out, "template <>" ) ;
1123
1123
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) ;
1129
1125
writeln ! ( out, "}}" ) ;
1130
1126
1131
1127
writeln ! ( out, "template <>" ) ;
1132
1128
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) ;
1134
1130
writeln ! ( out, "}}" ) ;
1135
1131
1136
1132
writeln ! ( out, "template <>" ) ;
1137
1133
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) ;
1143
1135
writeln ! ( out, "}}" ) ;
1144
1136
1145
1137
writeln ! ( out, "template <>" ) ;
@@ -1150,7 +1142,7 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &ResolvableName) {
1150
1142
) ;
1151
1143
writeln ! (
1152
1144
out,
1153
- " return cxxbridge05 $rust_vec${}$reserve_total(this, cap);" ,
1145
+ " return cxxbridge1 $rust_vec${}$reserve_total(this, cap);" ,
1154
1146
instance,
1155
1147
) ;
1156
1148
writeln ! ( out, "}}" ) ;
@@ -1159,27 +1151,27 @@ fn write_rust_vec_impl(out: &mut OutFile, element: &ResolvableName) {
1159
1151
writeln ! ( out, "void Vec<{}>::set_len(size_t len) noexcept {{" , inner) ;
1160
1152
writeln ! (
1161
1153
out,
1162
- " return cxxbridge05 $rust_vec${}$set_len(this, len);" ,
1154
+ " return cxxbridge1 $rust_vec${}$set_len(this, len);" ,
1163
1155
instance,
1164
1156
) ;
1165
1157
writeln ! ( out, "}}" ) ;
1166
1158
1167
1159
writeln ! ( out, "template <>" ) ;
1168
1160
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) ;
1170
1162
writeln ! ( out, "}}" ) ;
1171
1163
}
1172
1164
1173
1165
fn write_unique_ptr ( out : & mut OutFile , ident : & ResolvableName ) {
1174
1166
let ty = Type :: Ident ( ident. clone ( ) ) ;
1175
1167
let instance = to_mangled ( & ty, out. types ) ;
1176
1168
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) ;
1179
1171
1180
1172
write_unique_ptr_common ( out, & ty) ;
1181
1173
1182
- writeln ! ( out, "#endif // CXXBRIDGE05_UNIQUE_PTR_ {}" , instance) ;
1174
+ writeln ! ( out, "#endif // CXXBRIDGE1_UNIQUE_PTR_ {}" , instance) ;
1183
1175
}
1184
1176
1185
1177
// Shared by UniquePtr<T> and UniquePtr<CxxVector<T>>.
@@ -1213,15 +1205,15 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type) {
1213
1205
) ;
1214
1206
writeln ! (
1215
1207
out,
1216
- "void cxxbridge05 $unique_ptr${}$null(::std::unique_ptr<{}> *ptr) noexcept {{" ,
1208
+ "void cxxbridge1 $unique_ptr${}$null(::std::unique_ptr<{}> *ptr) noexcept {{" ,
1217
1209
instance, inner,
1218
1210
) ;
1219
1211
writeln ! ( out, " new (ptr) ::std::unique_ptr<{}>();" , inner) ;
1220
1212
writeln ! ( out, "}}" ) ;
1221
1213
if can_construct_from_value {
1222
1214
writeln ! (
1223
1215
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 {{" ,
1225
1217
instance, inner, inner,
1226
1218
) ;
1227
1219
writeln ! (
@@ -1233,28 +1225,28 @@ fn write_unique_ptr_common(out: &mut OutFile, ty: &Type) {
1233
1225
}
1234
1226
writeln ! (
1235
1227
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 {{" ,
1237
1229
instance, inner, inner,
1238
1230
) ;
1239
1231
writeln ! ( out, " new (ptr) ::std::unique_ptr<{}>(raw);" , inner) ;
1240
1232
writeln ! ( out, "}}" ) ;
1241
1233
writeln ! (
1242
1234
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 {{" ,
1244
1236
inner, instance, inner,
1245
1237
) ;
1246
1238
writeln ! ( out, " return ptr.get();" ) ;
1247
1239
writeln ! ( out, "}}" ) ;
1248
1240
writeln ! (
1249
1241
out,
1250
- "{} *cxxbridge05 $unique_ptr${}$release(::std::unique_ptr<{}>& ptr) noexcept {{" ,
1242
+ "{} *cxxbridge1 $unique_ptr${}$release(::std::unique_ptr<{}>& ptr) noexcept {{" ,
1251
1243
inner, instance, inner,
1252
1244
) ;
1253
1245
writeln ! ( out, " return ptr.release();" ) ;
1254
1246
writeln ! ( out, "}}" ) ;
1255
1247
writeln ! (
1256
1248
out,
1257
- "void cxxbridge05 $unique_ptr${}$drop(::std::unique_ptr<{}> *ptr) noexcept {{" ,
1249
+ "void cxxbridge1 $unique_ptr${}$drop(::std::unique_ptr<{}> *ptr) noexcept {{" ,
1258
1250
instance, inner,
1259
1251
) ;
1260
1252
writeln ! ( out, " ptr->~unique_ptr();" ) ;
@@ -1266,24 +1258,24 @@ fn write_cxx_vector(out: &mut OutFile, vector_ty: &Type, element: &ResolvableNam
1266
1258
let inner = to_typename ( & element, out. types ) ;
1267
1259
let instance = to_mangled ( & element, out. types ) ;
1268
1260
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) ;
1271
1263
writeln ! (
1272
1264
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 {{" ,
1274
1266
instance, inner,
1275
1267
) ;
1276
1268
writeln ! ( out, " return s.size();" ) ;
1277
1269
writeln ! ( out, "}}" ) ;
1278
1270
writeln ! (
1279
1271
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 {{" ,
1281
1273
inner, instance, inner,
1282
1274
) ;
1283
1275
writeln ! ( out, " return &s[pos];" ) ;
1284
1276
writeln ! ( out, "}}" ) ;
1285
1277
1286
1278
write_unique_ptr_common ( out, vector_ty) ;
1287
1279
1288
- writeln ! ( out, "#endif // CXXBRIDGE05_VECTOR_ {}" , instance) ;
1280
+ writeln ! ( out, "#endif // CXXBRIDGE1_VECTOR_ {}" , instance) ;
1289
1281
}
0 commit comments