@@ -18,7 +18,7 @@ const build_examples = @import("build_examples.zig");
18
18
const compile_errors = @import ("compile_errors.zig" );
19
19
const assemble_and_link = @import ("assemble_and_link.zig" );
20
20
const debug_safety = @import ("debug_safety.zig" );
21
- const parsec = @import ("parsec .zig" );
21
+ const translate_c = @import ("translate_c .zig" );
22
22
23
23
const TestTarget = struct {
24
24
os : builtin.Os ,
@@ -123,16 +123,16 @@ pub fn addAssembleAndLinkTests(b: &build.Builder, test_filter: ?[]const u8) -> &
123
123
return cases .step ;
124
124
}
125
125
126
- pub fn addParseCTests (b : & build.Builder , test_filter : ? []const u8 ) - > & build.Step {
127
- const cases = %% b .allocator .create (ParseCContext );
128
- * cases = ParseCContext {
126
+ pub fn addTranslateCTests (b : & build.Builder , test_filter : ? []const u8 ) - > & build.Step {
127
+ const cases = %% b .allocator .create (TranslateCContext );
128
+ * cases = TranslateCContext {
129
129
.b = b ,
130
- .step = b .step ("test-parsec " , "Run the C header file parsing tests" ),
130
+ .step = b .step ("test-translate-c " , "Run the C header file parsing tests" ),
131
131
.test_index = 0 ,
132
132
.test_filter = test_filter ,
133
133
};
134
134
135
- parsec .addCases (cases );
135
+ translate_c .addCases (cases );
136
136
137
137
return cases .step ;
138
138
}
@@ -770,7 +770,7 @@ pub const BuildExamplesContext = struct {
770
770
}
771
771
};
772
772
773
- pub const ParseCContext = struct {
773
+ pub const TranslateCContext = struct {
774
774
b : & build.Builder ,
775
775
step : & build.Step ,
776
776
test_index : usize ,
@@ -799,17 +799,17 @@ pub const ParseCContext = struct {
799
799
}
800
800
};
801
801
802
- const ParseCCmpOutputStep = struct {
802
+ const TranslateCCmpOutputStep = struct {
803
803
step : build.Step ,
804
- context : & ParseCContext ,
804
+ context : & TranslateCContext ,
805
805
name : []const u8 ,
806
806
test_index : usize ,
807
807
case : & const TestCase ,
808
808
809
- pub fn create (context : & ParseCContext , name : []const u8 , case : & const TestCase ) - > & ParseCCmpOutputStep {
809
+ pub fn create (context : & TranslateCContext , name : []const u8 , case : & const TestCase ) - > & TranslateCCmpOutputStep {
810
810
const allocator = context .b .allocator ;
811
- const ptr = %% allocator .create (ParseCCmpOutputStep );
812
- * ptr = ParseCCmpOutputStep {
811
+ const ptr = %% allocator .create (TranslateCCmpOutputStep );
812
+ * ptr = TranslateCCmpOutputStep {
813
813
.step = build .Step .init ("ParseCCmpOutput" , allocator , make ),
814
814
.context = context ,
815
815
.name = name ,
@@ -821,15 +821,15 @@ pub const ParseCContext = struct {
821
821
}
822
822
823
823
fn make (step : & build.Step ) - > % void {
824
- const self = @fieldParentPtr (ParseCCmpOutputStep , "step" , step );
824
+ const self = @fieldParentPtr (TranslateCCmpOutputStep , "step" , step );
825
825
const b = self .context .b ;
826
826
827
827
const root_src = %% os .path .join (b .allocator , b .cache_root , self .case .sources .items [0 ].filename );
828
828
829
829
var zig_args = ArrayList ([]const u8 ).init (b .allocator );
830
830
%% zig_args .append (b .zig_exe );
831
831
832
- %% zig_args .append ("parsec " );
832
+ %% zig_args .append ("translate-c " );
833
833
%% zig_args .append (b .pathFromRoot (root_src ));
834
834
835
835
warn ("Test {}/{} {}..." , self .test_index + 1 , self .context .test_index , self .name );
@@ -882,7 +882,7 @@ pub const ParseCContext = struct {
882
882
883
883
if (stderr .len != 0 and ! self .case .allow_warnings ) {
884
884
warn (
885
- \\====== parsec emitted warnings: ===== =======
885
+ \\====== translate-c emitted warnings: =======
886
886
\\{}
887
887
\\============================================
888
888
\\
@@ -914,7 +914,7 @@ pub const ParseCContext = struct {
914
914
warn ("\n " );
915
915
}
916
916
917
- pub fn create (self : & ParseCContext , allow_warnings : bool , filename : []const u8 , name : []const u8 ,
917
+ pub fn create (self : & TranslateCContext , allow_warnings : bool , filename : []const u8 , name : []const u8 ,
918
918
source : []const u8 , expected_lines : ... ) - > & TestCase
919
919
{
920
920
const tc = %% self .b .allocator .create (TestCase );
@@ -932,37 +932,37 @@ pub const ParseCContext = struct {
932
932
return tc ;
933
933
}
934
934
935
- pub fn add (self : & ParseCContext , name : []const u8 , source : []const u8 , expected_lines : ... ) {
935
+ pub fn add (self : & TranslateCContext , name : []const u8 , source : []const u8 , expected_lines : ... ) {
936
936
const tc = self .create (false , "source.h" , name , source , expected_lines );
937
937
self .addCase (tc );
938
938
}
939
939
940
- pub fn addC (self : & ParseCContext , name : []const u8 , source : []const u8 , expected_lines : ... ) {
940
+ pub fn addC (self : & TranslateCContext , name : []const u8 , source : []const u8 , expected_lines : ... ) {
941
941
const tc = self .create (false , "source.c" , name , source , expected_lines );
942
942
self .addCase (tc );
943
943
}
944
944
945
- pub fn addAllowWarnings (self : & ParseCContext , name : []const u8 , source : []const u8 , expected_lines : ... ) {
945
+ pub fn addAllowWarnings (self : & TranslateCContext , name : []const u8 , source : []const u8 , expected_lines : ... ) {
946
946
const tc = self .create (true , "source.h" , name , source , expected_lines );
947
947
self .addCase (tc );
948
948
}
949
949
950
- pub fn addCase (self : & ParseCContext , case : & const TestCase ) {
950
+ pub fn addCase (self : & TranslateCContext , case : & const TestCase ) {
951
951
const b = self .b ;
952
952
953
- const annotated_case_name = %% fmt .allocPrint (self .b .allocator , "parsec {}" , case .name );
953
+ const annotated_case_name = %% fmt .allocPrint (self .b .allocator , "translate-c {}" , case .name );
954
954
if (self .test_filter ) | filter | {
955
955
if (mem .indexOf (u8 , annotated_case_name , filter ) == null )
956
956
return ;
957
957
}
958
958
959
- const parsec_and_cmp = ParseCCmpOutputStep .create (self , annotated_case_name , case );
960
- self .step .dependOn (& parsec_and_cmp .step );
959
+ const translate_c_and_cmp = TranslateCCmpOutputStep .create (self , annotated_case_name , case );
960
+ self .step .dependOn (& translate_c_and_cmp .step );
961
961
962
962
for (case .sources .toSliceConst ()) | src_file | {
963
963
const expanded_src_path = %% os .path .join (b .allocator , b .cache_root , src_file .filename );
964
964
const write_src = b .addWriteFile (expanded_src_path , src_file .source );
965
- parsec_and_cmp .step .dependOn (& write_src .step );
965
+ translate_c_and_cmp .step .dependOn (& write_src .step );
966
966
}
967
967
}
968
968
};
0 commit comments