882 |
891 |
883 /* (D) Close the class declaration... */ |
892 /* (D) Close the class declaration... */ |
884 s4o.indent_left(); |
893 s4o.indent_left(); |
885 s4o.print(s4o.indent_spaces + "}; /* class "); |
894 s4o.print(s4o.indent_spaces + "}; /* class "); |
886 symbol->configuration_name->accept(*this); |
895 symbol->configuration_name->accept(*this); |
|
896 |
887 s4o.print(" */\n\n\n"); |
897 s4o.print(" */\n\n\n"); |
888 |
898 |
889 return NULL; |
899 return NULL; |
890 } |
900 } |
891 |
901 |
892 |
902 }; |
893 |
903 |
894 |
904 /***********************************************************************/ |
895 |
905 /***********************************************************************/ |
896 |
906 /***********************************************************************/ |
897 |
907 /***********************************************************************/ |
898 #if 0 |
908 /***********************************************************************/ |
899 |
909 /***********************************************************************/ |
900 /* helper symbol for configuration_declaration */ |
910 /***********************************************************************/ |
901 SYM_LIST(resource_declaration_list_c) |
911 /***********************************************************************/ |
902 |
912 |
903 /* |
913 |
904 RESOURCE resource_name ON resource_type_name |
914 class generate_cc_resources_c: public generate_cc_typedecl_c { |
905 optional_global_var_declarations |
915 |
906 single_resource_declaration |
916 public: |
907 END_RESOURCE |
917 generate_cc_resources_c(stage4out_c *s4o_ptr) |
908 */ |
918 : generate_cc_typedecl_c(s4o_ptr) {}; |
909 SYM_REF4(resource_declaration_c, resource_name, resource_type_name, global_var_declarations, resource_declaration) |
919 virtual ~generate_cc_resources_c(void) {} |
910 |
920 |
911 /* task_configuration_list program_configuration_list */ |
921 void *visit(resource_declaration_c *symbol) { |
912 SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list) |
922 return NULL; |
913 |
923 } |
914 /* helper symbol for single_resource_declaration */ |
924 |
915 SYM_LIST(task_configuration_list_c) |
925 void *visit(single_resource_declaration_c *symbol) { |
916 |
926 return NULL; |
917 /* helper symbol for single_resource_declaration */ |
927 } |
918 SYM_LIST(program_configuration_list_c) |
928 |
919 |
929 }; |
920 /* helper symbol for |
930 /***********************************************************************/ |
921 * - access_path |
931 /***********************************************************************/ |
922 * - instance_specific_init |
932 /***********************************************************************/ |
923 */ |
933 /***********************************************************************/ |
924 SYM_LIST(any_fb_name_list_c) |
934 /***********************************************************************/ |
925 |
935 /***********************************************************************/ |
926 /* [resource_name '.'] global_var_name ['.' structure_element_name] */ |
936 /***********************************************************************/ |
927 SYM_REF4(global_var_reference_c, resource_name, global_var_name, structure_element_name, unused) |
937 /***********************************************************************/ |
928 |
938 |
929 /* prev_declared_program_name '.' symbolic_variable */ |
939 class generate_cc_c: public iterator_visitor_c { |
930 SYM_REF2(program_output_reference_c, program_name, symbolic_variable) |
940 protected: |
931 |
941 stage4out_c &s4o; |
932 /* TASK task_name task_initialization */ |
942 stage4out_c pous_s4o; |
933 SYM_REF2(task_configuration_c, task_name, task_initialization) |
943 generate_cc_pous_c generate_cc_pous; |
934 |
944 |
935 /* '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' */ |
945 const char *current_name; |
936 SYM_REF4(task_initialization_c, single_data_source, interval_data_source, priority_data_source, unused) |
946 |
937 |
947 public: |
938 /* PROGRAM [RETAIN | NON_RETAIN] program_name [WITH task_name] ':' program_type_name ['(' prog_conf_elements ')'] */ |
948 generate_cc_c(stage4out_c *s4o_ptr): |
939 SYM_REF6(program_configuration_c, retain_option, program_name, task_name, program_type_name, prog_conf_elements, unused) |
949 s4o(*s4o_ptr), |
940 |
950 generate_cc_pous(&pous_s4o) {} |
941 /* prog_conf_elements ',' prog_conf_element */ |
951 |
942 SYM_LIST(prog_conf_elements_c) |
952 ~generate_cc_c(void) {} |
943 |
953 |
944 /* fb_name WITH task_name */ |
954 /*************************/ |
945 SYM_REF2(fb_task_c, fb_name, task_name) |
955 /* B.1 - Common elements */ |
946 |
956 /*************************/ |
947 /* any_symbolic_variable ASSIGN prog_data_source */ |
957 /*******************************************/ |
948 SYM_REF2(prog_cnxn_assign_c, symbolic_variable, prog_data_source) |
958 /* B 1.1 - Letters, digits and identifiers */ |
949 |
959 /*******************************************/ |
950 /* any_symbolic_variable SENDTO data_sink */ |
960 void *visit(identifier_c *symbol) { |
951 SYM_REF2(prog_cnxn_sendto_c, symbolic_variable, prog_data_source) |
961 current_name = symbol->value; |
952 |
962 return NULL; |
953 /* VAR_CONFIG instance_specific_init_list END_VAR_BOGUS */ |
963 } |
954 SYM_REF2(instance_specific_initializations_c, instance_specific_init_list, unused) |
964 |
955 |
965 /**************************************/ |
956 /* helper symbol for instance_specific_initializations */ |
966 /* B.1.5 - Program organization units */ |
957 SYM_LIST(instance_specific_init_list_c) |
967 /**************************************/ |
958 |
968 /***********************/ |
959 /* resource_name '.' program_name '.' {fb_name '.'} |
969 /* B 1.5.1 - Functions */ |
960 ((variable_name [location] ':' located_var_spec_init) | (fb_name ':' fb_initialization)) |
970 /***********************/ |
961 */ |
971 void *visit(function_declaration_c *symbol) { |
962 SYM_REF6(instance_specific_init_c, resource_name, program_name, any_fb_name_list, variable_name, location, initialization) |
972 symbol->accept(generate_cc_pous); |
963 |
973 return NULL; |
964 /* helper symbol for instance_specific_init */ |
974 } |
965 /* function_block_type_name ':=' structure_initialization */ |
975 |
966 SYM_REF2(fb_initialization_c, function_block_type_name, structure_initialization) |
976 /*****************************/ |
967 |
977 /* B 1.5.2 - Function Blocks */ |
968 #endif |
978 /*****************************/ |
969 |
979 void *visit(function_block_declaration_c *symbol) { |
970 |
980 symbol->accept(generate_cc_pous); |
971 }; /* generate_cc_c */ |
981 return NULL; |
972 |
982 } |
973 |
983 |
|
984 /**********************/ |
|
985 /* B 1.5.3 - Programs */ |
|
986 /**********************/ |
|
987 void *visit(program_declaration_c *symbol) { |
|
988 symbol->accept(generate_cc_pous); |
|
989 return NULL; |
|
990 } |
|
991 |
|
992 |
|
993 /********************************/ |
|
994 /* B 1.7 Configuration elements */ |
|
995 /********************************/ |
|
996 void *visit(configuration_declaration_c *symbol) { |
|
997 symbol->configuration_name->accept(*this); |
|
998 stage4out_c config_s4o(current_name, "c"); |
|
999 generate_cc_config_c generate_cc_config(&config_s4o); |
|
1000 symbol->accept(generate_cc_config); |
|
1001 return NULL; |
|
1002 } |
|
1003 |
|
1004 void *visit(resource_declaration_c *symbol) { |
|
1005 symbol->resource_name->accept(*this); |
|
1006 stage4out_c resources_s4o(current_name, "c"); |
|
1007 generate_cc_resources_c generate_cc_resources(&resources_s4o); |
|
1008 symbol->accept(generate_cc_resources); |
|
1009 return NULL; |
|
1010 } |
|
1011 |
|
1012 void *visit(single_resource_declaration_c *symbol) { |
|
1013 stage4out_c resources_s4o("resource", "c"); |
|
1014 generate_cc_resources_c generate_cc_resources(&resources_s4o); |
|
1015 symbol->accept(generate_cc_resources); |
|
1016 return NULL; |
|
1017 } |
|
1018 |
|
1019 |
|
1020 }; |
974 |
1021 |
975 /***********************************************************************/ |
1022 /***********************************************************************/ |
976 /***********************************************************************/ |
1023 /***********************************************************************/ |
977 /***********************************************************************/ |
1024 /***********************************************************************/ |
978 /***********************************************************************/ |
1025 /***********************************************************************/ |