Debian Codegraph @

extract.c

raw symbols SCIP
1 /* Foma: a finite-state toolkit and library. */cxx . . $ `<file>/extract.c`/
2 /* Copyright © 2008-2021 Mans Hulden */
3
4 /* This file is part of foma. */
5
6 /* Licensed under the Apache License, Version 2.0 (the "License"); */
7 /* you may not use this file except in compliance with the License. */
8 /* You may obtain a copy of the License at */
9
10 /* http://www.apache.org/licenses/LICENSE-2.0 */
11
12 /* Unless required by applicable law or agreed to in writing, software */
13 /* distributed under the License is distributed on an "AS IS" BASIS, */
14 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
15 /* See the License for the specific language governing permissions and */
16 /* limitations under the License. */
17
18 #include <stdlib.h>
19 #include "foma.h"cxx . . $ `<file>/foma.h`/
20
21 struct fsmcxx . . $ fsm# *fsm_lowercxx . . $ fsm_lower(af08066b5a2430ab).(struct fsmcxx . . $ fsm# *net) {
22 struct fsm_statecxx . . $ fsm_state# *fsm;
23 int i, prevstate, out;
24 fsm = net->statescxx . . $ fsm#states.;
25 fsm_state_initcxx . . $ fsm_state_init(260f42df0f72e5e9).(sigma_maxcxx . . $ sigma_max(e25613b9dc6b48e4).(net->sigmacxx . . $ fsm#sigma.));
26 prevstate = -1;
27 for (i = 0; (fsm+i)->state_nocxx . . $ fsm_state#state_no. != - 1; prevstate = (fsm+i)->state_nocxx . . $ fsm_state#state_no., i++) {
28 if (prevstate != -1 && prevstate != (fsm+i)->state_nocxx . . $ fsm_state#state_no.) {
29 fsm_state_end_statecxx . . $ fsm_state_end_state(49f6e7a06ebc5aa8).();
30 }
31 if (prevstate != (fsm+i)->state_nocxx . . $ fsm_state#state_no.) {
32 fsm_state_set_current_statecxx . . $ fsm_state_set_current_state(b1146eedae1e1d0b).((fsm+i)->state_nocxx . . $ fsm_state#state_no., (fsm+i)->final_statecxx . . $ fsm_state#final_state., (fsm+i)->start_statecxx . . $ fsm_state#start_state.);
33 }
34 if ((fsm+i)->targetcxx . . $ fsm_state#target. != -1) {
35 out = ((fsm+i)->outcxx . . $ fsm_state#out. == UNKNOWNcxx . . $ `fomalib.h:50:9`!) ? IDENTITYcxx . . $ `fomalib.h:51:9`! : (fsm+i)->outcxx . . $ fsm_state#out.;
36 fsm_state_add_arccxx . . $ fsm_state_add_arc(4df37d5d0c1dcce).((fsm+i)->state_nocxx . . $ fsm_state#state_no., out, out, (fsm+i)->targetcxx . . $ fsm_state#target., (fsm+i)->final_statecxx . . $ fsm_state#final_state., (fsm+i)->start_statecxx . . $ fsm_state#start_state.);
37 }
38 }
39 fsm_state_end_statecxx . . $ fsm_state_end_state(49f6e7a06ebc5aa8).();
40 freecxx . . $ free(5d22bdacc48458e8).(net->statescxx . . $ fsm#states.);
41 fsm_state_closecxx . . $ fsm_state_close(1a8333acb2d82ae1).(net);
42 fsm_update_flagscxx . . $ fsm_update_flags(a3a070c1c18f185a).(net,NOcxx . . $ `fomalib.h:83:9`!,NOcxx . . $ `fomalib.h:83:9`!,NOcxx . . $ `fomalib.h:83:9`!,UNKcxx . . $ `fomalib.h:85:9`!,UNKcxx . . $ `fomalib.h:85:9`!,UNKcxx . . $ `fomalib.h:85:9`!);
43 sigma_cleanupcxx . . $ sigma_cleanup(69cc6ca843435274).(net,0);
44 return(net);
45 }
46
47 struct fsmcxx . . $ fsm# *fsm_uppercxx . . $ fsm_upper(af08066b5a2430ab).(struct fsmcxx . . $ fsm# *net) {
48 struct fsm_statecxx . . $ fsm_state# *fsm;
49 int i, prevstate, in;
50 fsm = net->statescxx . . $ fsm#states.;
51 fsm_state_initcxx . . $ fsm_state_init(260f42df0f72e5e9).(sigma_maxcxx . . $ sigma_max(e25613b9dc6b48e4).(net->sigmacxx . . $ fsm#sigma.));
52 prevstate = -1;
53 for (i = 0; (fsm+i)->state_nocxx . . $ fsm_state#state_no. != - 1; prevstate = (fsm+i)->state_nocxx . . $ fsm_state#state_no., i++) {
54 if (prevstate != -1 && prevstate != (fsm+i)->state_nocxx . . $ fsm_state#state_no.) {
55 fsm_state_end_statecxx . . $ fsm_state_end_state(49f6e7a06ebc5aa8).();
56 }
57 if (prevstate != (fsm+i)->state_nocxx . . $ fsm_state#state_no.) {
58 fsm_state_set_current_statecxx . . $ fsm_state_set_current_state(b1146eedae1e1d0b).((fsm+i)->state_nocxx . . $ fsm_state#state_no., (fsm+i)->final_statecxx . . $ fsm_state#final_state., (fsm+i)->start_statecxx . . $ fsm_state#start_state.);
59 }
60 if ((fsm+i)->targetcxx . . $ fsm_state#target. != -1) {
61 in = ((fsm+i)->incxx . . $ fsm_state#in. == UNKNOWNcxx . . $ `fomalib.h:50:9`!) ? IDENTITYcxx . . $ `fomalib.h:51:9`! : (fsm+i)->incxx . . $ fsm_state#in.;
62 fsm_state_add_arccxx . . $ fsm_state_add_arc(4df37d5d0c1dcce).((fsm+i)->state_nocxx . . $ fsm_state#state_no., in, in, (fsm+i)->targetcxx . . $ fsm_state#target., (fsm+i)->final_statecxx . . $ fsm_state#final_state., (fsm+i)->start_statecxx . . $ fsm_state#start_state.);
63 }
64 }
65 fsm_state_end_statecxx . . $ fsm_state_end_state(49f6e7a06ebc5aa8).();
66 freecxx . . $ free(5d22bdacc48458e8).(net->statescxx . . $ fsm#states.);
67 fsm_state_closecxx . . $ fsm_state_close(1a8333acb2d82ae1).(net);
68 fsm_update_flagscxx . . $ fsm_update_flags(a3a070c1c18f185a).(net,NOcxx . . $ `fomalib.h:83:9`!,NOcxx . . $ `fomalib.h:83:9`!,NOcxx . . $ `fomalib.h:83:9`!,UNKcxx . . $ `fomalib.h:85:9`!,UNKcxx . . $ `fomalib.h:85:9`!,UNKcxx . . $ `fomalib.h:85:9`!);
69 sigma_cleanupcxx . . $ sigma_cleanup(69cc6ca843435274).(net,0);
70 return(net);
71 }