@@ -19,8 +19,23 @@ typedef struct
1919 rule.count++; \
2020 }
2121
22- // Checks the input CFL grammar
23- GrB_Info LAGraph_CFL_check_grammar (int64_t terms_count , int64_t nonterms_count , int64_t rules_count , const LAGraph_rule_WCNF * rules , char * msg )
22+ // LAGraph_CFL_check_grammar_input: Checks the input CFL grammar
23+ //
24+ // Checks:
25+ // - The rule array is not NULL
26+ // - Valid number of terms/non-terms/rules (> 0)
27+ // - Correctly formed grammar rules in WCNF format
28+ //
29+ // If an error occurs: adds a message using ADD_TO_MSG,
30+ // returns the corresponding GrB_Info
31+
32+ GrB_Info LAGraph_CFL_check_grammar_input (
33+ int64_t terms_count , // Number of terminal symbols
34+ int64_t nonterms_count , // Number of non-terminal symbols
35+ int64_t rules_count , // Number of rules in the grammar
36+ const LAGraph_rule_WCNF * rules , // Array of rules
37+ char * msg // Message string for error reporting
38+ )
2439{
2540 LG_CLEAR_MSG ;
2641 size_t msg_len = 0 ;
@@ -106,8 +121,20 @@ GrB_Info LAGraph_CFL_check_grammar(int64_t terms_count, int64_t nonterms_count,
106121 return GrB_SUCCESS ;
107122}
108123
109- // Checks the input graph for CFL algorithms
110- GrB_Info LAGraph_CFL_check_graph (const GrB_Matrix * adj_matrices , int64_t terms_count , char * msg )
124+ // LAGraph_CFL_check_graph_input: Checks the input graph for CFL algorithms
125+ //
126+ // Checks:
127+ // - The adjacency matrix array is not NULL
128+ // - There are no entries equal to NULL in the adjacency matrix array
129+ //
130+ // If an error occurs: adds a message using ADD_TO_MSG,
131+ // returns the corresponding GrB_NULL_POINTER
132+
133+ GrB_Info LAGraph_CFL_check_graph_input (
134+ const GrB_Matrix * adj_matrices , // Adjacency matrix array for terminals
135+ int64_t terms_count , // Number of terminal symbols
136+ char * msg // Message string for error reporting
137+ )
111138{
112139 LG_CLEAR_MSG ;
113140 size_t msg_len = 0 ;
@@ -142,35 +169,20 @@ GrB_Info LAGraph_CFL_check_graph(const GrB_Matrix *adj_matrices, int64_t terms_c
142169}
143170
144171// LAGraph_CFL_check_base_inputs: Checks the input graph and CFL grammar for algorithms working with it
145- //
146- // Checks:
147- // - The adjacency matrix array is not NULL
148- // - There are no entries equal to NULL in the adjacency matrix array
149- // - The rule array is not NULL
150- // - Valid number of terms/non-terms/rules (> 0)
151- // - Correctly formed grammar rules in WCNF format
152- //
153- // Parameters:
154- // - adj_matrices: adjacency matrix array for terminals
155- // - terms_count: number of terminal symbols
156- // - nonterms_count: number of non-terminal symbols
157- // - rules_count: number of rules in the grammar
158- // - rules: array of rules
159- //
160- // If an error occurs: adds a message using ADD_TO_MSG,
161- // returns the corresponding GrB_Info
162-
172+ // Equivalent to calling LAGraph_CFL_check_graph_input + LAGraph_CFL_check_grammar_input
173+ // See LAGraph_CFL_check_graph_input and LAGraph_CFL_check_grammar_input for details
163174GrB_Info LAGraph_CFL_check_base_inputs (
164- const GrB_Matrix * adj_matrices ,
165- int64_t terms_count ,
166- int64_t nonterms_count ,
167- int64_t rules_count ,
168- const LAGraph_rule_WCNF * rules ,
169- char * msg )
175+ const GrB_Matrix * adj_matrices , // Adjacency matrix array for terminals
176+ int64_t terms_count , // Number of terminal symbols
177+ int64_t nonterms_count , // Number of non-terminal symbols
178+ int64_t rules_count , // Number of rules in the grammar
179+ const LAGraph_rule_WCNF * rules , // Array of rules
180+ char * msg // Message string for error reporting
181+ )
170182{
171183 LG_CLEAR_MSG ;
172184 size_t msg_len = 0 ;
173- LG_TRY (LAGraph_CFL_check_graph (adj_matrices , terms_count , msg ));
174- LG_TRY (LAGraph_CFL_check_grammar (terms_count , nonterms_count , rules_count , rules , msg ));
185+ LG_TRY (LAGraph_CFL_check_graph_input (adj_matrices , terms_count , msg ));
186+ LG_TRY (LAGraph_CFL_check_grammar_input (terms_count , nonterms_count , rules_count , rules , msg ));
175187 return GrB_SUCCESS ;
176188}
0 commit comments