« lib/App/SeismicUnixGui/configs/big_streams/Project_config.pm
↑ Summary
lib/App/SeismicUnixGui/misc/sunix_pl.pm »
| 1 | package App::SeismicUnixGui::misc::files_LSU; | ||
| 2 | |||
| 3 | =head1 DOCUMENTATION | ||
| 4 | |||
| 5 | |||
| 6 | =head2 SYNOPSIS | ||
| 7 | |||
| 8 | PERL PERL PROGRAM NAME: files_LSU | ||
| 9 | AUTHOR: Juan Lorenzo | ||
| 10 | DATE: May 6 2018 | ||
| 11 | |||
| 12 | DESCRIPTION | ||
| 13 | |||
| 14 | |||
| 15 | BASED ON: | ||
| 16 | Version 0.0.2 May 6 2018 | ||
| 17 | changed _private_* to _* | ||
| 18 | |||
| 19 | V 0.0.3 July 24 2018 include data_in, exclude data_out | ||
| 20 | V 0.0.4 7.14.21 sets the flow color | ||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | =head2 USE | ||
| 25 | |||
| 26 | =head3 NOTES | ||
| 27 | |||
| 28 | =head4 Examples | ||
| 29 | |||
| 30 | =head2 CHANGES and their DATES | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | use Moose; | ||
| 35 | our $VERSION = '0.0.4'; | ||
| 36 | |||
| 37 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 38 | use aliased 'App::SeismicUnixGui::misc::L_SU_path'; | ||
| 39 | use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config'; | ||
| 40 | use aliased 'App::SeismicUnixGui::misc::oop_text'; | ||
| 41 | use App::SeismicUnixGui::misc::SeismicUnix qw($su $suffix_su $txt $suffix_txt); | ||
| 42 | use App::SeismicUnixGui::misc::control '0.0.3'; | ||
| 43 | use aliased 'App::SeismicUnixGui::misc::control'; | ||
| 44 | use aliased 'App::SeismicUnixGui::misc::manage_files_by2'; | ||
| 45 | use aliased 'App::SeismicUnixGui::misc::L_SU_local_user_constants'; | ||
| 46 | use aliased 'App::SeismicUnixGui::misc::name'; | ||
| 47 | use aliased 'App::SeismicUnixGui::misc::manage_dirs_by'; | ||
| 48 | |||
| 49 | my $Project = Project_config->new(); | ||
| 50 | my $L_SU_global_constants = L_SU_global_constants->new(); | ||
| 51 | my $L_SU_path = L_SU_path->new(); | ||
| 52 | my $oop_text = oop_text->new(); | ||
| 53 | my $alias_superflow_name = $L_SU_global_constants->alias_superflow_names_h(); | ||
| 54 | my $alias_superflow_spec_names_h = | ||
| 55 | $L_SU_global_constants->alias_superflow_spec_names_h(); | ||
| 56 | my $var = $L_SU_global_constants->var(); | ||
| 57 | my $global_lib = $L_SU_global_constants->global_libs(); | ||
| 58 | my $GLOBAL_CONFIG_LIB = $global_lib->{_configs_big_streams}; | ||
| 59 | |||
| 60 | #WARNING---- watch out for missing underscore!! | ||
| 61 | # print("files_LSU,alias_superflow_name : $alias_superflow_name->{ProjectVariables}\n"); | ||
| 62 | |||
| 63 | my $alias_PV = $alias_superflow_name->{ProjectVariables}; | ||
| 64 | my $filehandle; | ||
| 65 | |||
| 66 | my $on = $var->{_on}; | ||
| 67 | my $off = $var->{_off}; | ||
| 68 | my $nu = $var->{_nu}; | ||
| 69 | my $true = $var->{_true}; | ||
| 70 | my $false = $var->{_false}; | ||
| 71 | my $empty_string = $var->{_empty_string}; | ||
| 72 | |||
| 73 | my ( @param, @values, @checkbutton_on_off ); | ||
| 74 | my ( $i, $j, $k, $size, $ref_cfg ); | ||
| 75 | my @format; | ||
| 76 | |||
| 77 | # set default | ||
| 78 | $format[0] = $var->{_config_file_format}; | ||
| 79 | |||
| 80 | my $files_LSU = { | ||
| 81 | _CFG => '', | ||
| 82 | _PL_SEISMIC => '', | ||
| 83 | _suffix_type_in => '', | ||
| 84 | _suffix_type_out => '', | ||
| 85 | _flow_color => '', | ||
| 86 | _flow_name_out => '', | ||
| 87 | _filehandle => '', | ||
| 88 | _format_aref => \@format, | ||
| 89 | _is_config => $false, | ||
| 90 | _is_Project_config => $false, | ||
| 91 | _is_data => $false, | ||
| 92 | _is_data_in => $false, | ||
| 93 | _is_data_out => $false, | ||
| 94 | _is_pl => $false, | ||
| 95 | _is_suffix_type => $false, | ||
| 96 | _items_versions_aref => '', | ||
| 97 | _message_w => '', | ||
| 98 | _note => '', | ||
| 99 | _num_params_in_prog => '', | ||
| 100 | _num_progs_in_flow => '', | ||
| 101 | _outbound => '', | ||
| 102 | _outbound2 => '', | ||
| 103 | _prog_names_aref => '', | ||
| 104 | _prog_param_values_aref2 => '', | ||
| 105 | _prog_param_labels_aref2 => '', | ||
| 106 | _program_name => '', | ||
| 107 | _prog_name_sref => '', | ||
| 108 | _program_name_config => '', | ||
| 109 | _program_name_pl => '', | ||
| 110 | _ref_file => '', | ||
| 111 | _Step => '', | ||
| 112 | }; | ||
| 113 | |||
| 114 | $files_LSU->{_filehandle} = undef; | ||
| 115 | |||
| 116 | # will be called again internally by other software | ||
| 117 | # in case there are changes | ||
| 118 | # _set_PL_SEISMIC(); | ||
| 119 | $files_LSU->{_PL_SEISMIC} = $Project->PL_SEISMIC(); | ||
| 120 | |||
| 121 | =head2 sub _close | ||
| 122 | |||
| 123 | =cut | ||
| 124 | |||
| 125 | sub _close { | ||
| 126 | my ($self) = @_; | ||
| 127 | |||
| 128 | close( $files_LSU->{_filehandle} ); | ||
| 129 | |||
| 130 | # print("files_L_SU,_close, closing perl file for writing\n"); | ||
| 131 | |||
| 132 | return ($empty_string); | ||
| 133 | } | ||
| 134 | |||
| 135 | =head2 _get_superflow_config_file_format_aref | ||
| 136 | |||
| 137 | |||
| 138 | =cut | ||
| 139 | |||
| 140 | sub _get_superflow_config_file_format_aref { | ||
| 141 | my ($self) = @_; | ||
| 142 | |||
| 143 | if ( length $files_LSU->{_format_aref} ) { | ||
| 144 | |||
| 145 | my $ref_format = $files_LSU->{_format_aref}; | ||
| 146 | |||
| 147 | # print("files_LSU, _get_config_format,formats=@$ref_format\n"); | ||
| 148 | return ($ref_format); | ||
| 149 | } | ||
| 150 | else { | ||
| 151 | print("files_LSU, _get_config_format, missing formats\n"); | ||
| 152 | return ($empty_string); | ||
| 153 | } | ||
| 154 | |||
| 155 | } | ||
| 156 | |||
| 157 | =head2 sub _get_prog_name_config | ||
| 158 | |||
| 159 | needs $L_SU->{_prog_name_sref} | ||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | sub _get_prog_name_config { | ||
| 164 | my ($self) = @_; | ||
| 165 | |||
| 166 | if ( $files_LSU->{_prog_name_config} ) { | ||
| 167 | |||
| 168 | my $prog_name_config = $files_LSU->{_prog_name_config}; | ||
| 169 | return ($prog_name_config); | ||
| 170 | |||
| 171 | } | ||
| 172 | else { | ||
| 173 | print("files_LSU,_get_prog_name_config, missing prog_name\n"); | ||
| 174 | return ($empty_string); | ||
| 175 | } | ||
| 176 | } | ||
| 177 | |||
| 178 | =head2 sub _get_PL_SEISMIC | ||
| 179 | |||
| 180 | =cut | ||
| 181 | |||
| 182 | sub _get_PL_SEISMIC { | ||
| 183 | |||
| 184 | my ($self) = @_; | ||
| 185 | |||
| 186 | _set_PL_SEISMIC(); | ||
| 187 | if ( defined $files_LSU->{_PL_SEISMIC} ) { | ||
| 188 | |||
| 189 | my $PL_SEISMIC = $files_LSU->{_PL_SEISMIC}; | ||
| 190 | return ($PL_SEISMIC); | ||
| 191 | |||
| 192 | } | ||
| 193 | else { | ||
| 194 | print("files_LSU,_get_PL_SEISMIC, missing prog_name\n"); | ||
| 195 | return ($empty_string); | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | =head2 _open2write | ||
| 200 | |||
| 201 | =cut | ||
| 202 | |||
| 203 | sub _open2write { | ||
| 204 | my ($self) = @_; | ||
| 205 | |||
| 206 | # print("files_L_SU,_open2write, $files_LSU->{_outbound}\n"); | ||
| 207 | |||
| 208 | open( $files_LSU->{_filehandle}, '>', $files_LSU->{_outbound} ) | ||
| 209 | or die("Can't open file name, $!\n"); | ||
| 210 | |||
| 211 | return ($empty_string); | ||
| 212 | } | ||
| 213 | |||
| 214 | =pod | ||
| 215 | |||
| 216 | suffix_type_set_suffix_suffix_type TODO: suffix_type out may not | ||
| 217 | be always type=$su in the case that | ||
| 218 | the program in the list starts with $su | ||
| 219 | At that point it will be necessary to | ||
| 220 | investigate the program_spec.pm module suffix_type sub _set_suffix_type_out { | ||
| 221 | my ($type) = @_; | ||
| 222 | _set_datas files_les_LSU->{_suffix_type_out} = $suffix_types_LSU->{_is_suffix_type} = $true; | ||
| 223 | |||
| 224 | return(); | ||
| 225 | } | ||
| 226 | |||
| 227 | =cut | ||
| 228 | |||
| 229 | =head2 sub _set_PL_SEISMIC | ||
| 230 | |||
| 231 | =cut | ||
| 232 | |||
| 233 | sub _set_PL_SEISMIC { | ||
| 234 | |||
| 235 | my ($self) = @_; | ||
| 236 | |||
| 237 | my $Project = Project_config->new(); | ||
| 238 | |||
| 239 | $files_LSU->{_PL_SEISMIC} = $Project->PL_SEISMIC(); | ||
| 240 | |||
| 241 | # print("files_LSU, _set_PL_SEISMIC, PL_SEISMIC=$files_LSU->{_PL_SEISMIC}\n"); | ||
| 242 | return ($empty_string); | ||
| 243 | |||
| 244 | } | ||
| 245 | |||
| 246 | =head2 _set_data_direction_in | ||
| 247 | |||
| 248 | |||
| 249 | =cut | ||
| 250 | |||
| 251 | sub _set_data_direction_in { | ||
| 252 | my ($self) = @_; | ||
| 253 | |||
| 254 | $files_LSU->{_is_data_in} = $true; | ||
| 255 | _set_data(); | ||
| 256 | |||
| 257 | return ($empty_string); | ||
| 258 | } | ||
| 259 | |||
| 260 | =head2 _set_data_direction_out | ||
| 261 | |||
| 262 | |||
| 263 | =cut | ||
| 264 | |||
| 265 | sub _set_data_direction_out { | ||
| 266 | my ($self) = @_; | ||
| 267 | $files_LSU->{_is_data_out} = $true; | ||
| 268 | _set_data(); | ||
| 269 | |||
| 270 | return ($empty_string); | ||
| 271 | } | ||
| 272 | |||
| 273 | =head2 sub _set_data | ||
| 274 | |||
| 275 | |||
| 276 | =cut | ||
| 277 | |||
| 278 | sub _set_data { | ||
| 279 | |||
| 280 | my ($self) = @_; | ||
| 281 | |||
| 282 | $files_LSU->{_is_data} = $true; | ||
| 283 | |||
| 284 | # print("files_LSU,_set_data,is_data: $files_LSU->{_is_data}\n"); | ||
| 285 | |||
| 286 | return ($empty_string); | ||
| 287 | } | ||
| 288 | |||
| 289 | #=head2 sub _set_data_in | ||
| 290 | # | ||
| 291 | # | ||
| 292 | #=cut | ||
| 293 | # | ||
| 294 | #sub _set_data_in { | ||
| 295 | # | ||
| 296 | # my ($self) = @_; | ||
| 297 | # | ||
| 298 | # $files_LSU->{_is_data_in} = $true; | ||
| 299 | # | ||
| 300 | # # print("files_LSU,_set_data_in,is_data_in: $files_LSU->{_is_data}\n"); | ||
| 301 | # | ||
| 302 | # return($empty_string); | ||
| 303 | #} | ||
| 304 | |||
| 305 | =head2 sub _set_data_out | ||
| 306 | |||
| 307 | |||
| 308 | =cut | ||
| 309 | |||
| 310 | sub _set_data_out { | ||
| 311 | |||
| 312 | my ($self) = @_; | ||
| 313 | |||
| 314 | $files_LSU->{_is_data_out} = $true; | ||
| 315 | |||
| 316 | # print("files_LSU,_set_data_out, | ||
| 317 | # is_data_out: $files_LSU->{_is_data}\n"); | ||
| 318 | |||
| 319 | return ($empty_string); | ||
| 320 | } | ||
| 321 | |||
| 322 | =head2 sub _set_prog_name_config | ||
| 323 | |||
| 324 | needs $L_SU->{_prog_name_sref} | ||
| 325 | |||
| 326 | =cut | ||
| 327 | |||
| 328 | sub _set_prog_name_config { | ||
| 329 | my ($self) = @_; | ||
| 330 | |||
| 331 | if ( $files_LSU->{_prog_name_sref} ) { | ||
| 332 | |||
| 333 | $files_LSU->{_prog_name_config} = | ||
| 334 | ${ $files_LSU->{_prog_name_sref} } . '.config'; | ||
| 335 | return ($empty_string); | ||
| 336 | |||
| 337 | } | ||
| 338 | else { | ||
| 339 | print("files_LSU,_set_prog_name_config, missing prog_name_sref \n"); | ||
| 340 | return ($empty_string); | ||
| 341 | } | ||
| 342 | } | ||
| 343 | |||
| 344 | =head2 sub _set_prog_names_aref | ||
| 345 | |||
| 346 | |||
| 347 | =cut | ||
| 348 | |||
| 349 | sub _set_prog_names_aref { | ||
| 350 | my ($self) = @_; | ||
| 351 | |||
| 352 | $oop_text->set_prog_names_aref( $files_LSU->{_prog_names_aref} ); | ||
| 353 | |||
| 354 | # print("files_LSU, set_prog_names_aref: $files_LSU->{_prog_names_aref} \n"); | ||
| 355 | |||
| 356 | return ($empty_string); | ||
| 357 | } | ||
| 358 | |||
| 359 | =head2 sub _set_prog_version_aref | ||
| 360 | |||
| 361 | |||
| 362 | =cut | ||
| 363 | |||
| 364 | sub _set_prog_version_aref { | ||
| 365 | my ($self) = @_; | ||
| 366 | |||
| 367 | $oop_text->set_prog_version_aref($files_LSU); | ||
| 368 | |||
| 369 | # print("files_LSU,_set_prog_version_aref,versions | ||
| 370 | # @{$files_LSU->{_items_versions_aref}} \n"); | ||
| 371 | |||
| 372 | return ($empty_string); | ||
| 373 | } | ||
| 374 | |||
| 375 | =head2 sub _set_outbound2pl | ||
| 376 | |||
| 377 | print("files_LSU,_set_outbound2pl,program_name $files_LSU->{_program_name}\n"); | ||
| 378 | print("files_LSU,_set_outbound2pl,program_name_config $files_LSU->{_program_name_config}\n"); | ||
| 379 | |||
| 380 | =cut | ||
| 381 | |||
| 382 | sub _set_outbound2pl { | ||
| 383 | |||
| 384 | my ($self) = @_; | ||
| 385 | |||
| 386 | if ( length $files_LSU->{_is_pl} | ||
| 387 | && length $files_LSU->{_flow_name_out} ) | ||
| 388 | { | ||
| 389 | |||
| 390 | # update PL_SEISMIC in case of change | ||
| 391 | my $PL_SEISMIC = _get_PL_SEISMIC(); | ||
| 392 | $files_LSU->{_outbound} = | ||
| 393 | $PL_SEISMIC . '/' . $files_LSU->{_flow_name_out}; | ||
| 394 | |||
| 395 | } | ||
| 396 | else { | ||
| 397 | print("files_LSU,_set_outbound2pl, missing variables\n"); | ||
| 398 | } | ||
| 399 | |||
| 400 | # print("files_LSU,_set_outbound2pl, $files_LSU->{_outbound}\n"); | ||
| 401 | |||
| 402 | return ($empty_string); | ||
| 403 | } | ||
| 404 | |||
| 405 | =head2 _set_suffix_type_in | ||
| 406 | |||
| 407 | =cut | ||
| 408 | |||
| 409 | sub _set_suffix_type_in { | ||
| 410 | my ($suffix_type) = @_; | ||
| 411 | |||
| 412 | _set_data(); | ||
| 413 | $files_LSU->{_suffix_type_in} = $suffix_type; | ||
| 414 | $files_LSU->{_is_suffix_type} = $true; | ||
| 415 | return ($empty_string); | ||
| 416 | } | ||
| 417 | |||
| 418 | =head2 _set_suffix_type_out | ||
| 419 | |||
| 420 | |||
| 421 | =cut | ||
| 422 | |||
| 423 | sub _set_suffix_type_out { | ||
| 424 | my ($suffix_type) = @_; | ||
| 425 | |||
| 426 | _set_data(); | ||
| 427 | $files_LSU->{_suffix_type_out} = $suffix_type; | ||
| 428 | $files_LSU->{_is_suffix_type} = $true; | ||
| 429 | return ($empty_string); | ||
| 430 | } | ||
| 431 | |||
| 432 | =head2 sub check2write | ||
| 433 | |||
| 434 | files_LSU,check2write for pre-built or superflows | ||
| 435 | except Project.config, which uses sub write2 | ||
| 436 | |||
| 437 | =cut | ||
| 438 | |||
| 439 | sub check2write { | ||
| 440 | my (@self) = @_; | ||
| 441 | |||
| 442 | # print("files_LSU, check2write,start\n"); | ||
| 443 | |||
| 444 | if ( not -e $files_LSU->{_outbound} ) { | ||
| 445 | |||
| 446 | # CASE if configuration file does not already exist | ||
| 447 | # e.g., IMMODPG/immodpg.config | ||
| 448 | use File::Copy; | ||
| 449 | _set_prog_name_config(); | ||
| 450 | my $prog_name_config = _get_prog_name_config(); | ||
| 451 | my $from = $GLOBAL_CONFIG_LIB . '/' . $prog_name_config; | ||
| 452 | my $to = $files_LSU->{_outbound}; | ||
| 453 | |||
| 454 | copy( $from, $to ); | ||
| 455 | |||
| 456 | # print("files_LSU check2write copying $from to $to \n"); | ||
| 457 | |||
| 458 | # Now you can overwrite the file | ||
| 459 | _write(); | ||
| 460 | |||
| 461 | } | ||
| 462 | elsif ( -e $files_LSU->{_outbound} ) { | ||
| 463 | |||
| 464 | # CASE if file doesalready exist | ||
| 465 | # print("files_LSU, write_config OK: $files_LSU->{_outbound}\n"); | ||
| 466 | # print( | ||
| 467 | #"files_LSU, write_config, configuration file exists and will be overwritten\n" | ||
| 468 | # ); | ||
| 469 | _write(); | ||
| 470 | |||
| 471 | } | ||
| 472 | else { | ||
| 473 | # CASE if file does already exist | ||
| 474 | print("files_LSU, write_config, unexpected result\n"); | ||
| 475 | } | ||
| 476 | |||
| 477 | return ($empty_string); | ||
| 478 | } | ||
| 479 | |||
| 480 | =head2 sub copy_default_config | ||
| 481 | |||
| 482 | files_LSU,copy_default_config for | ||
| 483 | pre-built/superflows/Tools | ||
| 484 | (except Project.config, uses sub write2) | ||
| 485 | |||
| 486 | =cut | ||
| 487 | |||
| 488 | sub copy_default_config { | ||
| 489 | my (@self) = @_; | ||
| 490 | |||
| 491 | # print("files_LSU, copy_default_config,start\n"); | ||
| 492 | |||
| 493 | if ( not -e $files_LSU->{_outbound} ) { # double check | ||
| 494 | |||
| 495 | # CASE if configuration file does not already exist | ||
| 496 | # e.g. IMMODPG/immodpg.config | ||
| 497 | use File::Copy; | ||
| 498 | _set_prog_name_config(); | ||
| 499 | my $prog_name_config = _get_prog_name_config(); | ||
| 500 | my $from = $GLOBAL_CONFIG_LIB . '/' . $prog_name_config; | ||
| 501 | my $to = $files_LSU->{_outbound}; | ||
| 502 | |||
| 503 | copy( $from, $to ); | ||
| 504 | |||
| 505 | # print("files_LSU copy_default_config copy $from to $to \n"); | ||
| 506 | |||
| 507 | } | ||
| 508 | else { | ||
| 509 | # CASE if file already exists | ||
| 510 | # print("files_LSU, write_config OK: $files_LSU->{_outbound}\n"); | ||
| 511 | # print("files_LSU, write_config, configuration file exists; NADA\n"); | ||
| 512 | } | ||
| 513 | return ($empty_string); | ||
| 514 | |||
| 515 | } | ||
| 516 | |||
| 517 | =head2 sub outbound | ||
| 518 | |||
| 519 | needs prog_name_sref and | ||
| 520 | is_Project_config or | ||
| 521 | or _is_config | ||
| 522 | |||
| 523 | Why use App::SeismicUnixGui::misc::name module?; | ||
| 524 | To modify input names-- | ||
| 525 | adapt them to infer | ||
| 526 | which spec and parameter | ||
| 527 | files to read | ||
| 528 | |||
| 529 | Program names in GUI | ||
| 530 | and configuration file names | ||
| 531 | in the local (!!) directory | ||
| 532 | may be different. | ||
| 533 | |||
| 534 | =cut | ||
| 535 | |||
| 536 | sub outbound { | ||
| 537 | |||
| 538 | my ($self) = @_; | ||
| 539 | |||
| 540 | if ( $files_LSU->{_prog_name_sref} ) { | ||
| 541 | |||
| 542 | my $name = name->new(); | ||
| 543 | |||
| 544 | $files_LSU->{_program_name} = ${ $files_LSU->{_prog_name_sref} }; | ||
| 545 | |||
| 546 | # conveniently shorter local variable name | ||
| 547 | my $program_name = $files_LSU->{_program_name}; | ||
| 548 | |||
| 549 | if ( $files_LSU->{_is_Project_config} ) { | ||
| 550 | |||
| 551 | # CASE 1 for Project_config | ||
| 552 | $files_LSU->{_program_name_config} = | ||
| 553 | $name->change_config($program_name); | ||
| 554 | |||
| 555 | # Find out HOME directory and configuration path for user | ||
| 556 | my $user_constants = L_SU_local_user_constants->new(); | ||
| 557 | |||
| 558 | my $exists = | ||
| 559 | $user_constants->user_configuration_Project_config_exists; | ||
| 560 | my $ACTIVE_PROJECT = $user_constants->get_ACTIVE_PROJECT(); | ||
| 561 | $user_constants->set_user_configuration_Project_config; | ||
| 562 | my $Project_config = | ||
| 563 | $user_constants->get_user_configuration_Project_config; | ||
| 564 | |||
| 565 | if ($exists) | ||
| 566 | { # if it exists: .L_SU/configuration/active/Project.config | ||
| 567 | $files_LSU->{_outbound} = $Project_config; | ||
| 568 | |||
| 569 | # print("files_LSU, outbound, outbounds are Project_config: $Project_config\n"); | ||
| 570 | |||
| 571 | } | ||
| 572 | else { | ||
| 573 | print( | ||
| 574 | "files_LSU, outbound, WARNING, no user configuration Project.config exists\n" | ||
| 575 | ); | ||
| 576 | print("TEMP solution is to write Project.config locally\n"); | ||
| 577 | } | ||
| 578 | |||
| 579 | } | ||
| 580 | elsif ( $files_LSU->{_is_config} ) { # double check | ||
| 581 | |||
| 582 | my $DATA_PATH_IN; | ||
| 583 | |||
| 584 | $L_SU_path->set_program_name($program_name); | ||
| 585 | |||
| 586 | my $pathNmodule_spec_w_slash_pm = | ||
| 587 | $L_SU_path->get_pathNmodule_spec_w_slash_pm(); | ||
| 588 | my $pathNmodule_spec_w_colon = | ||
| 589 | $L_SU_path->get_pathNmodule_spec_w_colon(); | ||
| 590 | |||
| 591 | require $pathNmodule_spec_w_slash_pm; | ||
| 592 | |||
| 593 | # INSTANTIATE | ||
| 594 | my $package = $pathNmodule_spec_w_colon->new(); | ||
| 595 | |||
| 596 | # collect specifications of output directory | ||
| 597 | # from a program_spec.pm module | ||
| 598 | my $specs_h = $package->variables(); | ||
| 599 | my $CONFIG = $specs_h->{_CONFIG}; | ||
| 600 | |||
| 601 | $files_LSU->{_program_name_config} = | ||
| 602 | $name->change_config($program_name); | ||
| 603 | $files_LSU->{_outbound} = | ||
| 604 | $CONFIG . '/' . $files_LSU->{_program_name_config}; | ||
| 605 | |||
| 606 | # print("Case 2 files_LSU, outbound, outbound: $files_LSU->{_outbound} \n"); | ||
| 607 | |||
| 608 | } | ||
| 609 | elsif ($files_LSU->{_is_pl} | ||
| 610 | && $files_LSU->{_PL_SEISMIC} ) | ||
| 611 | { | ||
| 612 | |||
| 613 | #CASE 3 for user-built flows | ||
| 614 | # write to PL_SEISMIC | ||
| 615 | my $PL_SEISMIC = $files_LSU->{_PL_SEISMIC}; | ||
| 616 | $files_LSU->{_program_name_pl} = $program_name; | ||
| 617 | $files_LSU->{_outbound} = | ||
| 618 | $PL_SEISMIC . '/' . $files_LSU->{_program_name_pl}; | ||
| 619 | |||
| 620 | # print("Case 3 files_LSU, outbound, outbound _is_pl: $files_LSU->{_is_pl} \n"); | ||
| 621 | |||
| 622 | } | ||
| 623 | else { | ||
| 624 | print("WARNING: files_LSU,set_outbound,$files_LSU->{_outbound}\n"); | ||
| 625 | } | ||
| 626 | |||
| 627 | # print("files_LSU, outbound,$files_LSU->{_outbound}\n"); | ||
| 628 | } | ||
| 629 | |||
| 630 | return ($empty_string); | ||
| 631 | } | ||
| 632 | |||
| 633 | =head2 sub outbound2 | ||
| 634 | |||
| 635 | needs prog_name_sref | ||
| 636 | is_Project_config or _is_config | ||
| 637 | TODO: make exclusive for cases that are NOT Project_config | ||
| 638 | |||
| 639 | =cut | ||
| 640 | |||
| 641 | sub outbound2 { | ||
| 642 | |||
| 643 | my ($self) = @_; | ||
| 644 | |||
| 645 | if ( $files_LSU->{_prog_name_sref} ) { | ||
| 646 | |||
| 647 | my $name = name->new(); | ||
| 648 | |||
| 649 | $files_LSU->{_program_name} = ${ $files_LSU->{_prog_name_sref} }; | ||
| 650 | my $program_name = $files_LSU->{_program_name}; #conveniently shorter | ||
| 651 | |||
| 652 | if ( $files_LSU->{_is_Project_config} ) { | ||
| 653 | $files_LSU->{_program_name_config} = | ||
| 654 | $name->change_config($program_name); | ||
| 655 | |||
| 656 | # Find out HOME directory and configuration path for user | ||
| 657 | my $user_constants = L_SU_local_user_constants->new(); | ||
| 658 | my $exists = | ||
| 659 | $user_constants->user_configuration_Project_config_exists; | ||
| 660 | my $ACTIVE_PROJECT = $user_constants->get_ACTIVE_PROJECT(); | ||
| 661 | $user_constants->set_user_configuration_Project_config2; | ||
| 662 | my $Project_config2 = | ||
| 663 | $user_constants->get_user_configuration_Project_config2; | ||
| 664 | |||
| 665 | if ($exists) | ||
| 666 | { # if it exists: .L_SU/configuration/active/Project.config | ||
| 667 | $files_LSU->{_outbound2} = $Project_config2; | ||
| 668 | |||
| 669 | # print("files_LSU, outbound, outbounds are Project_config2: $Project_config2\n"); | ||
| 670 | |||
| 671 | } | ||
| 672 | elsif ( $files_LSU->{_is_config} && $files_LSU->{_PL_SEISMIC} ) { | ||
| 673 | my $PL_SEISMIC = $files_LSU->{_PL_SEISMIC}; | ||
| 674 | $files_LSU->{_program_name_config} = | ||
| 675 | $name->change_config($program_name); | ||
| 676 | $files_LSU->{_outbound2} = | ||
| 677 | $PL_SEISMIC . '/' . $files_LSU->{_program_name_config}; | ||
| 678 | # print( | ||
| 679 | #"files_LSU, outbound2, outbound2 _is_config: $files_LSU->{_outbound2} \n" | ||
| 680 | # ); | ||
| 681 | } | ||
| 682 | else { | ||
| 683 | print( | ||
| 684 | "files_LSU, outbound, WARNING, no user configuration Project.config exists\n" | ||
| 685 | ); | ||
| 686 | print("TEMP solution is to write Project.config locally\n"); | ||
| 687 | } | ||
| 688 | } | ||
| 689 | else { | ||
| 690 | |||
| 691 | print("WARNING: files_LSU,outbound2\n"); | ||
| 692 | } | ||
| 693 | |||
| 694 | # print("files_LSU, outbound,$files_LSU->{_outbound2}\n"); | ||
| 695 | } | ||
| 696 | |||
| 697 | return ($empty_string); | ||
| 698 | } | ||
| 699 | |||
| 700 | =head2 sub set_PL_SEISMIC | ||
| 701 | |||
| 702 | =cut | ||
| 703 | |||
| 704 | sub set_PL_SEISMIC { | ||
| 705 | |||
| 706 | my ($self) = @_; | ||
| 707 | |||
| 708 | my $Project = Project_config->new(); | ||
| 709 | $files_LSU->{_PL_SEISMIC} = $Project->PL_SEISMIC(); | ||
| 710 | |||
| 711 | return ($empty_string); | ||
| 712 | |||
| 713 | } | ||
| 714 | |||
| 715 | =head2 set_Project_config | ||
| 716 | turn file type | ||
| 717 | definitions on and off | ||
| 718 | |||
| 719 | =cut | ||
| 720 | |||
| 721 | sub set_Project_config { | ||
| 722 | my ($self) = @_; | ||
| 723 | $files_LSU->{_is_config} = $false; | ||
| 724 | $files_LSU->{_is_Project_config} = $true; | ||
| 725 | |||
| 726 | return ($empty_string); | ||
| 727 | } | ||
| 728 | |||
| 729 | =head2 set_config | ||
| 730 | |||
| 731 | |||
| 732 | =cut | ||
| 733 | |||
| 734 | sub set_config { | ||
| 735 | my ($self) = @_; | ||
| 736 | $files_LSU->{_is_config} = $true; | ||
| 737 | $files_LSU->{_is_Project_config} = $false; | ||
| 738 | |||
| 739 | return ($empty_string); | ||
| 740 | } | ||
| 741 | |||
| 742 | =head2 set_superflow_config_file_format | ||
| 743 | |||
| 744 | |||
| 745 | =cut | ||
| 746 | |||
| 747 | sub set_superflow_config_file_format { | ||
| 748 | my ( $self, $ref_format ) = @_; | ||
| 749 | |||
| 750 | $files_LSU->{_format_aref} = $ref_format; | ||
| 751 | |||
| 752 | return ($empty_string); | ||
| 753 | } | ||
| 754 | |||
| 755 | =head2 set_data | ||
| 756 | |||
| 757 | detects and attempts to rectify program order error | ||
| 758 | $oop_text->set_bin_out(); | ||
| 759 | Expects suprograms that start with "su" or "uni" | ||
| 760 | |||
| 761 | =cut | ||
| 762 | |||
| 763 | sub set_data { | ||
| 764 | my ($self) = @_; | ||
| 765 | |||
| 766 | my $num_progs4flow = scalar @{ $files_LSU->{_prog_names_aref} }; | ||
| 767 | my @prog_names = @{ $files_LSU->{_prog_names_aref} }; | ||
| 768 | |||
| 769 | for ( my $i = 0 ; $i < $num_progs4flow ; $i++ ) { | ||
| 770 | |||
| 771 | if ( $prog_names[$i] eq 'data_in' ) { | ||
| 772 | my $first_2_char = substr( $prog_names[$i], 0, 2 ); | ||
| 773 | |||
| 774 | # if ( $first_2_char eq 'da' ) { | ||
| 775 | # | ||
| 776 | # print("1. files_LSU,set_data,data_in detected\n"); | ||
| 777 | # print("1. files_LSU,set_data,flow_item=$i\n"); | ||
| 778 | # | ||
| 779 | # } else { | ||
| 780 | # print("files_LSU,set_data,su missing data_in program"); | ||
| 781 | # } | ||
| 782 | |||
| 783 | # 2nd program must exist | ||
| 784 | if ( $num_progs4flow > 1 ) { | ||
| 785 | |||
| 786 | # suprog can follow | ||
| 787 | my $first_2_char = substr( $prog_names[ ( $i + 1 ) ], 0, 2 ); | ||
| 788 | my $first_3_char = substr( $prog_names[ ( $i + 1 ) ], 0, 3 ); | ||
| 789 | |||
| 790 | # print( "files_LSU,set_data, second program name starts with first_2_char =$first_2_char\n"); | ||
| 791 | |||
| 792 | if ( $first_2_char eq $su ) { | ||
| 793 | |||
| 794 | # print("1. files_LSU,set_data,su data_in suffix_type\n"); | ||
| 795 | _set_suffix_type_in($su); | ||
| 796 | _set_data_direction_in(); | ||
| 797 | |||
| 798 | } | ||
| 799 | elsif ( $first_3_char eq 'uni' ) { | ||
| 800 | |||
| 801 | # print("1. files_LSU,set_data, txt data_in suffix_type\n"); | ||
| 802 | _set_suffix_type_in($txt); | ||
| 803 | _set_data_direction_in(); | ||
| 804 | |||
| 805 | } | ||
| 806 | else { | ||
| 807 | |||
| 808 | # print("Warning: files_LSU, set_data, missing su,txt suffix type\n"); | ||
| 809 | } | ||
| 810 | |||
| 811 | } | ||
| 812 | else { | ||
| 813 | |||
| 814 | # print("files_LSU,only data and no suffix_type \n"); | ||
| 815 | _set_suffix_type_in($su); # TODO | ||
| 816 | _set_data_direction_in(); | ||
| 817 | } | ||
| 818 | |||
| 819 | } | ||
| 820 | else { | ||
| 821 | |||
| 822 | # print("1. files_LSU,set_data, acceptable second program detected NADA\n"); | ||
| 823 | } | ||
| 824 | |||
| 825 | if ( $prog_names[$i] eq 'data_out' ) { | ||
| 826 | |||
| 827 | # prior program must exist | ||
| 828 | if ( $num_progs4flow > 1 ) { | ||
| 829 | |||
| 830 | # suprog must lead | ||
| 831 | my $first_2_char = substr( $prog_names[ ( $i - 1 ) ], 0, 2 ); | ||
| 832 | if ( $first_2_char eq $su ) { | ||
| 833 | |||
| 834 | # print("2. files_LSU,set_data,leading sunix program detected, dasuffix_typellows\n"); | ||
| 835 | _set_suffix_type_out($su); | ||
| 836 | _set_data_direction_out(); | ||
| 837 | |||
| 838 | } | ||
| 839 | else { | ||
| 840 | |||
| 841 | # print("2. files_LSU,set_data,first 2 csuffix_typeot $su\n"); | ||
| 842 | _set_suffix_type_out($su); # TODO | ||
| 843 | _set_data_direction_out(); | ||
| 844 | } | ||
| 845 | |||
| 846 | } | ||
| 847 | else { | ||
| 848 | |||
| 849 | # print("files_LSU,only data and no psuffix_typex program\n"); | ||
| 850 | _set_suffix_type_out($su); # TODO | ||
| 851 | _set_data_direction_out(); | ||
| 852 | } | ||
| 853 | |||
| 854 | } | ||
| 855 | else { | ||
| 856 | |||
| 857 | # NADA print("2. files_LSU,set_data,program detected\n"); | ||
| 858 | } | ||
| 859 | } | ||
| 860 | return ($empty_string); | ||
| 861 | } | ||
| 862 | |||
| 863 | =head2 sub set_flow_color | ||
| 864 | |||
| 865 | =cut | ||
| 866 | |||
| 867 | sub set_flow_color { | ||
| 868 | my ( $self, $flow_color ) = @_; | ||
| 869 | |||
| 870 | if ( length $flow_color ) { | ||
| 871 | |||
| 872 | $files_LSU->{_flow_color} = $flow_color; | ||
| 873 | |||
| 874 | # print("files_LSU, set_flow_color:$files_LSU->{_flow_color}\n"); | ||
| 875 | |||
| 876 | } | ||
| 877 | else { | ||
| 878 | print("files_LSU, set_flow_color, missing color\n"); | ||
| 879 | } | ||
| 880 | return ($empty_string); | ||
| 881 | } | ||
| 882 | |||
| 883 | =head2 set_message | ||
| 884 | |||
| 885 | relay messages via the main message widget in GUI | ||
| 886 | |||
| 887 | =cut | ||
| 888 | |||
| 889 | sub set_message { | ||
| 890 | my ( $self, $hash_ref ) = @_; | ||
| 891 | |||
| 892 | if ($hash_ref) { | ||
| 893 | |||
| 894 | $files_LSU->{_message_w} = $hash_ref->{_message_w}; | ||
| 895 | |||
| 896 | } | ||
| 897 | else { | ||
| 898 | print("files_LSU, set_message, missing message widget \n"); | ||
| 899 | } | ||
| 900 | return ($empty_string); | ||
| 901 | } | ||
| 902 | |||
| 903 | =head2 set2pl | ||
| 904 | |||
| 905 | saved files are local perl flows | ||
| 906 | |||
| 907 | =cut | ||
| 908 | |||
| 909 | sub set2pl { | ||
| 910 | my ( $self, $hash_ref ) = @_; | ||
| 911 | $files_LSU->{_is_pl} = $true; | ||
| 912 | |||
| 913 | if ( length $files_LSU->{_flow_color} | ||
| 914 | && length $hash_ref ) | ||
| 915 | { | ||
| 916 | |||
| 917 | my $this_color = $files_LSU->{_flow_color}; | ||
| 918 | my $_flow_name_out_color = '_flow_name_out_' . $this_color; | ||
| 919 | |||
| 920 | # print("files_LSU,set2pl, _flow_name_out_color =$_flow_name_out_color \n"); | ||
| 921 | $files_LSU->{_flow_name_out} = $hash_ref->{$_flow_name_out_color}; | ||
| 922 | |||
| 923 | # print( | ||
| 924 | # "files_LSU,set2pl, is $files_LSU->{_is_pl} \n | ||
| 925 | # self,hash_ref: $self,$hash_ref\n" | ||
| 926 | # ); | ||
| 927 | # print("files_LSU,set2pl, _flow_name_out =$hash_ref->{$_flow_name_out_color} \n"); | ||
| 928 | |||
| 929 | _set_outbound2pl(); | ||
| 930 | |||
| 931 | } | ||
| 932 | else { | ||
| 933 | print("files_LSU,set2pl, missing flow color assignment/hash ref \n"); | ||
| 934 | } | ||
| 935 | |||
| 936 | return ($empty_string); | ||
| 937 | } | ||
| 938 | |||
| 939 | =head2 sub set_outbound | ||
| 940 | |||
| 941 | print("files_LSU,set_outbound,program_name $files_LSU->{_program_name}\n"); | ||
| 942 | print("files_LSU,set_outbound,program_name_config $files_LSU->{_program_name_config}\n"); | ||
| 943 | |||
| 944 | =cut | ||
| 945 | |||
| 946 | sub set_outbound { | ||
| 947 | |||
| 948 | my ( $self, $out_scalar_ref ) = @_; | ||
| 949 | my $program_name = $$out_scalar_ref; | ||
| 950 | |||
| 951 | if ($out_scalar_ref) { | ||
| 952 | |||
| 953 | my $name = name->new(); | ||
| 954 | |||
| 955 | $files_LSU->{_program_name} = $$out_scalar_ref; | ||
| 956 | |||
| 957 | if ( $files_LSU->{_is_Project_config} ) { | ||
| 958 | $files_LSU->{_program_name_config} = | ||
| 959 | $name->change_config($program_name); | ||
| 960 | |||
| 961 | # Find out HOME directory and configuration path for user | ||
| 962 | my $user_constants = L_SU_local_user_constants->new(); | ||
| 963 | my $exists = | ||
| 964 | $user_constants->user_configuration_Project_config_exists; | ||
| 965 | my $ACTIVE_PROJECT = $user_constants->get_ACTIVE_PROJECT(); | ||
| 966 | $user_constants->set_user_configuration_Project_config; | ||
| 967 | my $Project_config = | ||
| 968 | $user_constants->get_user_configuration_Project_config; | ||
| 969 | |||
| 970 | if ($exists) | ||
| 971 | { # if it exists: .L_SU/configuration/active/Project.config | ||
| 972 | $files_LSU->{_outbound} = $Project_config; | ||
| 973 | |||
| 974 | # print("files_LSU, set_outbound, outbound is $Project_config; the currently active project\n"); | ||
| 975 | |||
| 976 | } | ||
| 977 | else { | ||
| 978 | print( | ||
| 979 | "files_LSU, set_outbound, WARNING, no user configuration Project.config exists\n" | ||
| 980 | ); | ||
| 981 | print("TEMP solution is to write Project.config locally\n"); | ||
| 982 | } | ||
| 983 | |||
| 984 | } | ||
| 985 | elsif ( $files_LSU->{_is_config} ) { | ||
| 986 | $files_LSU->{_program_name_config} = | ||
| 987 | $name->change_config($program_name); | ||
| 988 | $files_LSU->{_outbound} = $files_LSU->{_program_name_config}; | ||
| 989 | |||
| 990 | } | ||
| 991 | elsif ( $files_LSU->{_is_pl} && $files_LSU->{_PL_SEISMIC} ) { | ||
| 992 | my $PL_SEISMIC = $files_LSU->{_PL_SEISMIC}; | ||
| 993 | $files_LSU->{_program_name_pl} = $program_name; | ||
| 994 | $files_LSU->{_outbound} = | ||
| 995 | $PL_SEISMIC . '/' . $files_LSU->{_program_name_pl}; | ||
| 996 | |||
| 997 | } | ||
| 998 | else { | ||
| 999 | |||
| 1000 | print("WARNING: files_LSU,set_outbound,$files_LSU->{_outbound}\n"); | ||
| 1001 | } | ||
| 1002 | |||
| 1003 | # print("files_LSU,set_outbound,$files_LSU->{_outbound}\n"); | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | return ($empty_string); | ||
| 1007 | } | ||
| 1008 | |||
| 1009 | =head2 sub set_outbound2 | ||
| 1010 | |||
| 1011 | |||
| 1012 | |||
| 1013 | =cut | ||
| 1014 | |||
| 1015 | sub set_outbound2 { | ||
| 1016 | |||
| 1017 | my ( $self, $out_scalar_ref ) = @_; | ||
| 1018 | my $program_name = $$out_scalar_ref; | ||
| 1019 | |||
| 1020 | if ($out_scalar_ref) { | ||
| 1021 | |||
| 1022 | my $name = name->new(); | ||
| 1023 | |||
| 1024 | $files_LSU->{_program_name} = $$out_scalar_ref; | ||
| 1025 | |||
| 1026 | if ( $files_LSU->{_is_Project_config} ) { | ||
| 1027 | $files_LSU->{_program_name_config} = | ||
| 1028 | $name->change_config($program_name); | ||
| 1029 | |||
| 1030 | # Find out HOME directory and configuration path for user | ||
| 1031 | my $user_constants = L_SU_local_user_constants->new(); | ||
| 1032 | my $exists = | ||
| 1033 | $user_constants->user_configuration_Project_config_exists; | ||
| 1034 | my $ACTIVE_PROJECT = $user_constants->get_ACTIVE_PROJECT(); | ||
| 1035 | $user_constants->set_user_configuration_Project_config2; | ||
| 1036 | my $Project_config2 = | ||
| 1037 | $user_constants->get_user_configuration_Project_config2; | ||
| 1038 | |||
| 1039 | if ($exists) | ||
| 1040 | { # if it exists: .L_SU/configuration/active/Project.config | ||
| 1041 | $files_LSU->{_outbound2} = $Project_config2; | ||
| 1042 | |||
| 1043 | # print("files_LSU, set_outbound2, outbounds is: $Project_config2\n"); | ||
| 1044 | } | ||
| 1045 | else { | ||
| 1046 | print( | ||
| 1047 | "files_LSU, set_outbound, WARNING, no user configuration Project.config exists\n" | ||
| 1048 | ); | ||
| 1049 | print("TEMP solution is to write Project.config locally\n"); | ||
| 1050 | } | ||
| 1051 | |||
| 1052 | } | ||
| 1053 | elsif ( $files_LSU->{_is_config} ) { | ||
| 1054 | $files_LSU->{_program_name_config} = | ||
| 1055 | $name->change_config($program_name); | ||
| 1056 | $files_LSU->{_outbound2} = $files_LSU->{_program_name_config}; | ||
| 1057 | |||
| 1058 | } | ||
| 1059 | else { | ||
| 1060 | |||
| 1061 | print("WARNING: files_LSU,set_outbound,$files_LSU->{_outbound}\n"); | ||
| 1062 | } | ||
| 1063 | |||
| 1064 | # print("files_LSU,set_outbound,$files_LSU->{_outbound}\n"); | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | return ($empty_string); | ||
| 1068 | } | ||
| 1069 | |||
| 1070 | =head2 sub set_items_versions_aref | ||
| 1071 | |||
| 1072 | |||
| 1073 | =cut | ||
| 1074 | |||
| 1075 | sub set_items_versions_aref { | ||
| 1076 | |||
| 1077 | my ( $self, $hash_aref ) = @_; | ||
| 1078 | $files_LSU->{_items_versions_aref} = $hash_aref->{_items_versions_aref}; | ||
| 1079 | |||
| 1080 | # print("files_LSU,set_items_versions_aref, | ||
| 1081 | # @{$files_LSU->{_items_versions_aref}}\n"); | ||
| 1082 | |||
| 1083 | return ($empty_string); | ||
| 1084 | } | ||
| 1085 | |||
| 1086 | =head2 sub set_prog_param_values_aref2 | ||
| 1087 | |||
| 1088 | =cut | ||
| 1089 | |||
| 1090 | sub set_prog_param_values_aref2 { | ||
| 1091 | |||
| 1092 | my ( $self, $hash_aref2 ) = @_; | ||
| 1093 | $files_LSU->{_prog_param_values_aref2} = $hash_aref2->{_good_values_aref2}; | ||
| 1094 | |||
| 1095 | return ($empty_string); | ||
| 1096 | } | ||
| 1097 | |||
| 1098 | =head2 sub set_prog_param_labels_aref2 | ||
| 1099 | |||
| 1100 | my $num_progs4flow = scalar @{$files_LSU->{_prog_param_labels_aref2}}; | ||
| 1101 | print("\nfiles_LSU,set_prog_param_labels_aref2, num_progs4flow: $num_progs4flow\n"); | ||
| 1102 | for (my $i=0; $i < $num_progs4flow; $i++ ) { | ||
| 1103 | print("files_LSU,set_prog_param_labels_aref2, | ||
| 1104 | @{@{$files_LSU->{_prog_param_labels_aref2}}[$i]}\n"); | ||
| 1105 | } | ||
| 1106 | |||
| 1107 | my $num_progs4flow = scalar @{$files_LSU->{_prog_param_values_aref2}}; | ||
| 1108 | print("\nfiles_LSU,set_prog_param_values_aref2, num_progs4flow: $num_progs4flow\n"); | ||
| 1109 | for (my $i=0; $i < $num_progs4flow; $i++ ) { | ||
| 1110 | print("files_LSU,set_prog_param_values_aref2, | ||
| 1111 | @{@{$files_LSU->{_prog_param_values_aref2}}[$i]}\n"); | ||
| 1112 | } | ||
| 1113 | |||
| 1114 | |||
| 1115 | =cut | ||
| 1116 | |||
| 1117 | sub set_prog_param_labels_aref2 { | ||
| 1118 | |||
| 1119 | my ( $self, $hash_aref2 ) = @_; | ||
| 1120 | |||
| 1121 | $files_LSU->{_prog_param_labels_aref2} = $hash_aref2->{_good_labels_aref2}; | ||
| 1122 | |||
| 1123 | return ($empty_string); | ||
| 1124 | } | ||
| 1125 | |||
| 1126 | =head2 sub set_prog_names_aref | ||
| 1127 | |||
| 1128 | |||
| 1129 | =cut | ||
| 1130 | |||
| 1131 | sub set_prog_name_sref { | ||
| 1132 | my ( $self, $sref ) = @_; | ||
| 1133 | |||
| 1134 | if ($sref) { | ||
| 1135 | |||
| 1136 | $files_LSU->{_prog_name_sref} = $sref; | ||
| 1137 | |||
| 1138 | # print("files_LSU, set_prog_name_sref, prog_name:${$files_LSU->{_prog_name_sref}}\n"); | ||
| 1139 | return ($empty_string); | ||
| 1140 | |||
| 1141 | } | ||
| 1142 | else { | ||
| 1143 | print("files_LSU, set_prog_name_sref, prog name missing\n"); | ||
| 1144 | return ($empty_string); | ||
| 1145 | } | ||
| 1146 | } | ||
| 1147 | |||
| 1148 | =head2 sub set_prog_names_aref | ||
| 1149 | |||
| 1150 | |||
| 1151 | =cut | ||
| 1152 | |||
| 1153 | sub set_prog_names_aref { | ||
| 1154 | |||
| 1155 | my ( $self, $hash_aref ) = @_; | ||
| 1156 | $files_LSU->{_prog_names_aref} = $hash_aref->{_prog_names_aref}; | ||
| 1157 | |||
| 1158 | # print("files_LSU, set_prog_names_aref, prog_names:@{$files_LSU->{_prog_names_aref}}\n"); | ||
| 1159 | |||
| 1160 | return ($empty_string); | ||
| 1161 | } | ||
| 1162 | |||
| 1163 | =head2 sub set_superflow_specs | ||
| 1164 | |||
| 1165 | Output parameters for superflows | ||
| 1166 | A Tool is a superflow | ||
| 1167 | i/p $hash_ref to obtain entry labels and | ||
| 1168 | values and parameters from widgets to build @CFG | ||
| 1169 | |||
| 1170 | DB | ||
| 1171 | print("prog name $program_name\n"); | ||
| 1172 | print(" save_button,save,configure,write_LSU,tool_specs $files_LSU->{_program_name_config}\n"); | ||
| 1173 | print("save,superflow,write_LSU, key/value pairs:$CFG[$i], $CFG[$j]\n"); | ||
| 1174 | #use Config::Simple; | ||
| 1175 | #my $cfg = Config::Simple(syntax=>'ini'); | ||
| 1176 | #$cfg->write($files_LSU->{_program_name_config}); | ||
| 1177 | # print "@CFGpa\n"; | ||
| 1178 | #$cfg->ram($CFG[$i] ,$CFG[$j]); | ||
| 1179 | #print "@CFG\n"; | ||
| 1180 | # print("write_LSU,tool_specs \nprog_name:${$files_LSU->{_program_name}}\n"); | ||
| 1181 | # print("\n prog_name_config: $files_LSU->{_program_name_config}\n"); | ||
| 1182 | # print(" labels: @{$hash_ref->{_ref_labels}}\n"); | ||
| 1183 | # print(" values: @{$hash_ref->{_ref_values}}\n"); | ||
| 1184 | |||
| 1185 | # no. of variables comes from specs file directly | ||
| 1186 | $length = scalar @{$hash_ref->{_ref_labels}};-- old version | ||
| 1187 | |||
| 1188 | =cut | ||
| 1189 | |||
| 1190 | sub set_superflow_specs { | ||
| 1191 | my ( $self, $hash_ref ) = @_; | ||
| 1192 | |||
| 1193 | # foreach my $key (sort keys %$hash_ref) { | ||
| 1194 | # print (" files_LSU,set_superflow_specs, key is $key, value is $hash_ref->{$key}\n"); | ||
| 1195 | # } | ||
| 1196 | # | ||
| 1197 | # print ("1. files_LSU,set_superflow_specs,prog_name_sref: ${$files_LSU->{_prog_name_sref}} \n"); | ||
| 1198 | |||
| 1199 | if ( $hash_ref && $files_LSU->{_prog_name_sref} ) { | ||
| 1200 | |||
| 1201 | my $name = name->new(); | ||
| 1202 | |||
| 1203 | my ( @CFG, @info ); | ||
| 1204 | my $length; | ||
| 1205 | |||
| 1206 | my $base_program_name = ${ $files_LSU->{_prog_name_sref} }; | ||
| 1207 | my $alias_program_name = | ||
| 1208 | $alias_superflow_spec_names_h->{$base_program_name}; | ||
| 1209 | |||
| 1210 | $L_SU_path->set_program_name($alias_program_name); | ||
| 1211 | |||
| 1212 | my $pathNmodule_spec_w_slash_pm = | ||
| 1213 | $L_SU_path->get_pathNmodule_spec_w_slash_pm(); | ||
| 1214 | my $pathNmodule_spec_w_colon = | ||
| 1215 | $L_SU_path->get_pathNmodule_spec_w_colon(); | ||
| 1216 | |||
| 1217 | require $pathNmodule_spec_w_slash_pm; | ||
| 1218 | |||
| 1219 | # INSTANTIATE | ||
| 1220 | my $program_name_spec = $pathNmodule_spec_w_colon->new(); | ||
| 1221 | |||
| 1222 | # print ("2. files_LSU,set_superflow_specs, instantiate $program_name_spec\n"); | ||
| 1223 | |||
| 1224 | my $max_index = $program_name_spec->get_max_index(); | ||
| 1225 | $length = $max_index + 1; | ||
| 1226 | |||
| 1227 | # get length from corresponding spec file | ||
| 1228 | # length-1 : is largest occupied index | ||
| 1229 | # print("3. files_LSU, set_superflow_specs, length=$length\n"); | ||
| 1230 | |||
| 1231 | for ( my $i = 0, my $j = 0 ; $i < $length ; $i++, $j = $j + 2 ) { | ||
| 1232 | |||
| 1233 | # last value is at j+1 | ||
| 1234 | $CFG[$j] = @{ $hash_ref->{_ref_labels} }[$i]; | ||
| 1235 | $CFG[ ( $j + 1 ) ] = @{ $hash_ref->{_ref_values} }[$i]; | ||
| 1236 | |||
| 1237 | # print ("files_LSU,set_superflow_specs,label=$CFG[$j] value=$CFG[ ( $j + 1 ) ]\n"); | ||
| 1238 | |||
| 1239 | } | ||
| 1240 | |||
| 1241 | $files_LSU->{_CFG} = \@CFG; | ||
| 1242 | |||
| 1243 | # my $ref_lines = $messages->get_config($files_LSU->{_program_name_config} ) | ||
| 1244 | # my $num_lines = scalar @$ref_lines; | ||
| 1245 | # my @lines = @$ref_lines; | ||
| 1246 | # for (my $i=0; $i<$num_lines; $i++) { | ||
| 1247 | # printf OUT $lines[$i]; | ||
| 1248 | # print("files_LSU,set_superflow_specs,program_name_config: $files_LSU->{_program_name_config}\n"); | ||
| 1249 | |||
| 1250 | if ( $files_LSU->{_program_name_config} eq $alias_PV . '.config' ) { | ||
| 1251 | |||
| 1252 | # CASE 1 legacy case--for deprecation | ||
| 1253 | |||
| 1254 | $info[0] = (" # ENVIRONMENT VARIABLES FOR THIS PROJECT\n"); | ||
| 1255 | $info[1] = (" # Notes:\n"); | ||
| 1256 | $info[2] = (" # 1. Default DATE format is DAY MONTH YEAR\n"); | ||
| 1257 | $info[3] = (" # 2. only change what lies between single\n"); | ||
| 1258 | $info[4] = (" # inverted commas\n"); | ||
| 1259 | $info[5] = (" # 3. the directory hierarchy is\n"); | ||
| 1260 | $info[6] = (" # \$PROJECT_HOME/\$date/\$line\n"); | ||
| 1261 | $info[7] = (" # Warning: Do not modify \$HOME\n"); | ||
| 1262 | $info[8] = (" \n"); | ||
| 1263 | } | ||
| 1264 | |||
| 1265 | $files_LSU->{_info} = \@info; | ||
| 1266 | |||
| 1267 | } | ||
| 1268 | else { | ||
| 1269 | print( | ||
| 1270 | "files_LSU,set_superflow_specs, missing hash_ref or prog_name_sref\n" | ||
| 1271 | ); | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | return ($empty_string); | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | =head2 sub sizes | ||
| 1278 | |||
| 1279 | |||
| 1280 | =cut | ||
| 1281 | |||
| 1282 | sub sizes { | ||
| 1283 | $size = ( ( scalar @$ref_cfg ) ) / 2; | ||
| 1284 | return ($size); | ||
| 1285 | } | ||
| 1286 | |||
| 1287 | =head2 sub _write | ||
| 1288 | |||
| 1289 | Write out configuration files to script | ||
| 1290 | |||
| 1291 | =cut | ||
| 1292 | |||
| 1293 | sub _write { | ||
| 1294 | |||
| 1295 | my ($self) = @_; | ||
| 1296 | |||
| 1297 | my $control = control->new(); | ||
| 1298 | my @format; | ||
| 1299 | my $length = ( scalar @{ $files_LSU->{_CFG} } ) / 2; | ||
| 1300 | my $length_info = scalar @{ $files_LSU->{_info} }; | ||
| 1301 | my @info = @{ $files_LSU->{_info} }; | ||
| 1302 | my @CFG = @{ $files_LSU->{_CFG} }; | ||
| 1303 | my $config_file_format_aref = _get_superflow_config_file_format_aref(); | ||
| 1304 | my $num_formats = scalar @$config_file_format_aref; | ||
| 1305 | |||
| 1306 | # print("files_LSU, _write,num_formats=$num_formats\n"); | ||
| 1307 | |||
| 1308 | if ( $num_formats == 1 ) { | ||
| 1309 | |||
| 1310 | for ( my $i = 0 ; $i < $length ; $i++ ) { | ||
| 1311 | |||
| 1312 | $format[$i] = @{$config_file_format_aref}[0]; | ||
| 1313 | |||
| 1314 | # print("1. files_LSU,_write,$format[$i]\n"); | ||
| 1315 | |||
| 1316 | } | ||
| 1317 | |||
| 1318 | } | ||
| 1319 | elsif ( $num_formats > 1 ) { | ||
| 1320 | |||
| 1321 | @format = @$config_file_format_aref; | ||
| 1322 | |||
| 1323 | } | ||
| 1324 | else { | ||
| 1325 | print("3. files_LSU, _write, unexpected result\n"); | ||
| 1326 | } | ||
| 1327 | |||
| 1328 | |||
| 1329 | open( my $fh, '>', $files_LSU->{_outbound} ) | ||
| 1330 | or die "Can't open parameter file:$!"; | ||
| 1331 | |||
| 1332 | for ( my $i = 0 ; $i < $length_info ; $i++ ) { | ||
| 1333 | |||
| 1334 | # skipped in many cases | ||
| 1335 | # length_info=0 formmany tools, e.g. immodpg | ||
| 1336 | |||
| 1337 | printf $fh $info[$i]; | ||
| 1338 | print("5. files_LSU,_write,info is $info[$i]\n"); | ||
| 1339 | } | ||
| 1340 | |||
| 1341 | for ( my $i = 0, my $j = 0 ; $i < $length ; $i++, $j = $j + 2 ) { | ||
| 1342 | |||
| 1343 | my $old_value = $CFG[ ( $j + 1 ) ]; | ||
| 1344 | my $new_value = $control->get_no_quotes($old_value); | ||
| 1345 | |||
| 1346 | printf $fh $format[$i] . "\n", $CFG[$j], "= ", $new_value; | ||
| 1347 | # print("7.files_LSU,_write,$j, $CFG[$j]=$CFG[ ( $j + 1 ) ]\n"); | ||
| 1348 | } | ||
| 1349 | close($fh); | ||
| 1350 | } | ||
| 1351 | |||
| 1352 | =head2 sub write | ||
| 1353 | |||
| 1354 | all files if outbound includes the existing | ||
| 1355 | file path as well | ||
| 1356 | |||
| 1357 | =cut | ||
| 1358 | |||
| 1359 | sub write { | ||
| 1360 | |||
| 1361 | my ($self) = @_; | ||
| 1362 | |||
| 1363 | my $length = ( scalar @{ $files_LSU->{_CFG} } ) / 2; | ||
| 1364 | my $length_info = scalar @{ $files_LSU->{_info} }; | ||
| 1365 | my @info = @{ $files_LSU->{_info} }; | ||
| 1366 | my @CFG = @{ $files_LSU->{_CFG} }; | ||
| 1367 | |||
| 1368 | # print("files_LSU, write, length:$length,length_info:$length_info \n"); | ||
| 1369 | # print("files_LSU,write,files_LSU->{_outbound}: $files_LSU->{_outbound} \n"); | ||
| 1370 | |||
| 1371 | open( my $fh, '>', $files_LSU->{_outbound} ) | ||
| 1372 | or die "Can't open parameter file:$!"; | ||
| 1373 | |||
| 1374 | for ( my $i = 0 ; $i < $length_info ; $i++ ) { | ||
| 1375 | |||
| 1376 | # printf $fh $info[$i]; | ||
| 1377 | } | ||
| 1378 | |||
| 1379 | for ( my $i = 0, my $j = 0 ; $i < $length ; $i++, $j = $j + 2 ) { | ||
| 1380 | |||
| 1381 | if ( defined $CFG[$j] && defined $CFG[ $j + 1 ] ) { | ||
| 1382 | |||
| 1383 | # print (" $CFG[$j],= ,$CFG[($j+1)]\n");; | ||
| 1384 | printf $fh "%-35s%1s%-20s\n", $CFG[$j], "= ", $CFG[ ( $j + 1 ) ]; | ||
| 1385 | |||
| 1386 | } | ||
| 1387 | else { | ||
| 1388 | # print("files_LSU, write, undefined value or name NADA\n"); | ||
| 1389 | } | ||
| 1390 | |||
| 1391 | } | ||
| 1392 | close($fh); | ||
| 1393 | |||
| 1394 | # print("files_LSU, write, done\n"); | ||
| 1395 | return (); | ||
| 1396 | } | ||
| 1397 | |||
| 1398 | =head2 sub write2 | ||
| 1399 | |||
| 1400 | used for dealing with ONLY Project.config | ||
| 1401 | |||
| 1402 | =cut | ||
| 1403 | |||
| 1404 | sub write2 { | ||
| 1405 | my ($self) = @_; | ||
| 1406 | use File::Copy; | ||
| 1407 | |||
| 1408 | my $user_constants = L_SU_local_user_constants->new(); | ||
| 1409 | my $control = control->new(); | ||
| 1410 | |||
| 1411 | my $length = ( scalar @{ $files_LSU->{_CFG} } ) / 2; | ||
| 1412 | my $length_info = scalar @{ $files_LSU->{_info} }; | ||
| 1413 | my @info = @{ $files_LSU->{_info} }; | ||
| 1414 | my @CFG = @{ $files_LSU->{_CFG} }; | ||
| 1415 | |||
| 1416 | my $CONFIGURATION = $user_constants->get_CONFIGURATION(); | ||
| 1417 | my $ACTIVE_PROJECT = $user_constants->get_ACTIVE_PROJECT(); | ||
| 1418 | my $Project_config = $user_constants->get_Project_config(); | ||
| 1419 | |||
| 1420 | my $active_project_name = $user_constants->get_active_project_name(); | ||
| 1421 | my $FROM = $ACTIVE_PROJECT . '/' . $Project_config; | ||
| 1422 | my $TO = | ||
| 1423 | $CONFIGURATION . '/' . $active_project_name . '/' . $Project_config; | ||
| 1424 | |||
| 1425 | my $PATH = $CONFIGURATION . '/' . $active_project_name; | ||
| 1426 | |||
| 1427 | # print("files_LSU,write2, active_project_name: $active_project_name\n"); | ||
| 1428 | # print("files_LSU,write2, CONFIGURATION: $CONFIGURATION\n"); | ||
| 1429 | # print("files_LSU,write2, Project_config: $Project_config\n"); | ||
| 1430 | manage_dirs_by->make_dir($PATH); | ||
| 1431 | copy( $FROM, $TO ); | ||
| 1432 | |||
| 1433 | # print("files_LSU,write2, copy from:$FROM to:$TO \n"); | ||
| 1434 | |||
| 1435 | if ( $files_LSU->{_outbound2} ) { | ||
| 1436 | |||
| 1437 | # print("files_LSU, write2, files_LSU->{_outbound2}: $files_LSU->{_outbound2} \n"); | ||
| 1438 | |||
| 1439 | open( my $fh, '>', $files_LSU->{_outbound2} ) | ||
| 1440 | or die "Can't open parameter file:$!"; | ||
| 1441 | |||
| 1442 | for ( my $i = 0 ; $i < $length_info ; $i++ ) { | ||
| 1443 | |||
| 1444 | my $a = $info[$i]; | ||
| 1445 | |||
| 1446 | # remove terminal quotes | ||
| 1447 | $a = $control->no_quotes($a); | ||
| 1448 | |||
| 1449 | printf $fh $a; | ||
| 1450 | } | ||
| 1451 | |||
| 1452 | for ( my $i = 0, my $j = 0 ; $i < $length ; $i++, $j = $j + 2 ) { | ||
| 1453 | |||
| 1454 | if ( defined $CFG[ ( $j + 1 ) ] ) { | ||
| 1455 | |||
| 1456 | my $cfg = $CFG[ ( $j + 1 ) ]; | ||
| 1457 | |||
| 1458 | # remove all terminal quotes | ||
| 1459 | $cfg = $control->get_no_quotes($cfg); | ||
| 1460 | |||
| 1461 | if ( defined $cfg ) | ||
| 1462 | { # because removing quotes from an empty string does this | ||
| 1463 | |||
| 1464 | # print (" files_LSU, write2, only Project.config, j: $CFG[$j]=$cfg\n"); | ||
| 1465 | printf $fh "%-35s%1s%-20s\n", $CFG[$j], "= ", $cfg; | ||
| 1466 | |||
| 1467 | } | ||
| 1468 | else { | ||
| 1469 | |||
| 1470 | # print("1 files_LSU,write2, cfg is not defined NADA\n"); | ||
| 1471 | # printf $fh " \n", $CFG[$j], "= ", | ||
| 1472 | # $empty_string; | ||
| 1473 | } | ||
| 1474 | |||
| 1475 | } | ||
| 1476 | else { | ||
| 1477 | |||
| 1478 | # print("2 files_LSU,write2, cfg is not defined NADA\n"); | ||
| 1479 | # printf $fh " \n", $CFG[$j], "= ", $empty_string; | ||
| 1480 | } | ||
| 1481 | } | ||
| 1482 | |||
| 1483 | close($fh); | ||
| 1484 | |||
| 1485 | } | ||
| 1486 | else { | ||
| 1487 | print("files_LSU,write2, missing files_LSU->{_outbound2}\n"); | ||
| 1488 | } | ||
| 1489 | } | ||
| 1490 | |||
| 1491 | =head2 sub write_config | ||
| 1492 | |||
| 1493 | |||
| 1494 | =cut | ||
| 1495 | |||
| 1496 | sub write_config { | ||
| 1497 | my ($self) = @_; | ||
| 1498 | |||
| 1499 | my $length = ( scalar @{ $files_LSU->{_CFG} } ) / 2; | ||
| 1500 | my $length_info = scalar @{ $files_LSU->{_info} }; | ||
| 1501 | my @info = @{ $files_LSU->{_info} }; | ||
| 1502 | my @CFG = @{ $files_LSU->{_CFG} }; | ||
| 1503 | |||
| 1504 | open( my $OUT, '>', $files_LSU->{_outbound} ); | ||
| 1505 | |||
| 1506 | for ( my $i = 0 ; $i < $length_info ; $i++ ) { | ||
| 1507 | printf $OUT $info[$i]; | ||
| 1508 | } | ||
| 1509 | |||
| 1510 | for ( my $i = 0, my $j = 0 ; $i < $length ; $i++, $j = $j + 2 ) { | ||
| 1511 | printf $OUT " %-SET_OU35s%1s%-20s\n", $CFG[$j], "= ", | ||
| 1512 | $CFG[ ( $j + 1 ) ]; | ||
| 1513 | } | ||
| 1514 | close($OUT); | ||
| 1515 | } | ||
| 1516 | |||
| 1517 | =head2 sub save | ||
| 1518 | |||
| 1519 | write out user-built *.pl flow files | ||
| 1520 | |||
| 1521 | for (my $i=0, my $j=0; $i<$length; $i++, $j=$j+2){ | ||
| 1522 | printf $OUT " \n",$CFG[$j],"= ",$CFG[($j+1)]; | ||
| 1523 | } | ||
| 1524 | |||
| 1525 | =cut | ||
| 1526 | |||
| 1527 | sub save { | ||
| 1528 | my ($self) = @_; | ||
| 1529 | |||
| 1530 | _open2write(); | ||
| 1531 | _set_prog_names_aref(); | ||
| 1532 | _set_prog_version_aref(); # already collected in sub set_data | ||
| 1533 | |||
| 1534 | # print("files_LSU, save, is data:files_LSU->{_is_data}?:$files_LSU->{_is_data}\n"); | ||
| 1535 | |||
| 1536 | # for suffix type | ||
| 1537 | $oop_text->set_data_io_L_SU($files_LSU) | ||
| 1538 | ; # already collected in sub set_data; | ||
| 1539 | |||
| 1540 | $oop_text->set_message($files_LSU); # already collected in sub set_data; | ||
| 1541 | $oop_text->set_filehandle( $files_LSU->{_filehandle} ); | ||
| 1542 | $oop_text->set_num_progs4flow( $files_LSU->{_prog_names_aref} ); | ||
| 1543 | my $num_progs4flow = scalar @{ $files_LSU->{_prog_names_aref} }; | ||
| 1544 | |||
| 1545 | # print("\nfiles_LSU,save,num_progs4flow: $num_progs4flow\n"); | ||
| 1546 | |||
| 1547 | # principal documentation for the program | ||
| 1548 | $oop_text->get_pod_header(); | ||
| 1549 | |||
| 1550 | # for message and flow | ||
| 1551 | $oop_text->get_use_pkg(); | ||
| 1552 | |||
| 1553 | # for all programs in the flow | ||
| 1554 | $oop_text->instantiation(); | ||
| 1555 | |||
| 1556 | # establish local variables e.g., my @sugain | ||
| 1557 | $oop_text->get_pod_declare(); | ||
| 1558 | |||
| 1559 | # print("1. files_LSU_ save, declaring packages\n"); | ||
| 1560 | $oop_text->get_declare_pkg(); | ||
| 1561 | |||
| 1562 | # insert a macro start here | ||
| 1563 | # $oop_text->set_macro_head(pkg); | ||
| 1564 | |||
| 1565 | # DECLARE DATA | ||
| 1566 | for ( my $j = 0 ; $j < $num_progs4flow ; $j++ ) { | ||
| 1567 | |||
| 1568 | # check each program | ||
| 1569 | my $prog_name = @{ $files_LSU->{_prog_names_aref} }[$j]; | ||
| 1570 | |||
| 1571 | if ( $prog_name eq 'data_in' ) { | ||
| 1572 | |||
| 1573 | if ( $files_LSU->{_is_data_in} ) { | ||
| 1574 | |||
| 1575 | my @params = | ||
| 1576 | @{ @{ $files_LSU->{_prog_param_values_aref2} }[$j] }; | ||
| 1577 | my $file_name = $params[0]; | ||
| 1578 | $oop_text->set_file_name_in($file_name); | ||
| 1579 | |||
| 1580 | # print("1. files_LSU_ save, prog_name=$prog_name\n"); | ||
| 1581 | |||
| 1582 | } | ||
| 1583 | else { | ||
| 1584 | |||
| 1585 | # print("2. files_LSU, save, missing,files_LSU->{_is_data_in}=$files_LSU->{_is_data_in}\n "); | ||
| 1586 | # print("2. files_LSU, save, missing, we have data\n "); | ||
| 1587 | } # we have data | ||
| 1588 | } | ||
| 1589 | |||
| 1590 | if ( $prog_name eq 'data_out' ) { #TODO | ||
| 1591 | # print("1. files_LSU, got to declare data \n"); | ||
| 1592 | # we have data | ||
| 1593 | if ( $files_LSU->{_is_data_out} ) { | ||
| 1594 | |||
| 1595 | my @params = | ||
| 1596 | @{ @{ $files_LSU->{_prog_param_values_aref2} }[$j] }; | ||
| 1597 | my $file_name = $params[0]; | ||
| 1598 | $oop_text->set_file_name_out($file_name); | ||
| 1599 | |||
| 1600 | # print("2. files_LSU_ save, prog_name=$prog_name\n"); | ||
| 1601 | |||
| 1602 | } | ||
| 1603 | } | ||
| 1604 | } | ||
| 1605 | |||
| 1606 | # print $files_LSU->{_filehandle} 'here\n'; | ||
| 1607 | # # pod_instantiation(); | ||
| 1608 | # # instantiation(); | ||
| 1609 | |||
| 1610 | # declare programs and their parameters | ||
| 1611 | for ( my $j = 0 ; $j < $num_progs4flow ; $j++ ) { | ||
| 1612 | |||
| 1613 | my $prog_name = @{ $files_LSU->{_prog_names_aref} }[$j]; | ||
| 1614 | my $version = @{ $files_LSU->{_items_versions_aref} }[$j]; | ||
| 1615 | my $num_params4prog = | ||
| 1616 | scalar @{ @{ $files_LSU->{_prog_param_values_aref2} }[$j] }; | ||
| 1617 | |||
| 1618 | # fix one program name | ||
| 1619 | $oop_text->set_prog_name($prog_name); | ||
| 1620 | |||
| 1621 | # fix current version | ||
| 1622 | $oop_text->set_prog_version($version); | ||
| 1623 | |||
| 1624 | # pod setup of parameter values | ||
| 1625 | $oop_text->set_pod_prog_param_setup(); | ||
| 1626 | |||
| 1627 | my @values = @{ @{ $files_LSU->{_prog_param_values_aref2} }[$j] }; | ||
| 1628 | my @labels = @{ @{ $files_LSU->{_prog_param_labels_aref2} }[$j] }; | ||
| 1629 | |||
| 1630 | # print("files_LSU,save,prog_name:$prog_name\n"); | ||
| 1631 | # print("files_LSU,save,prog_values_aref:@values\n"); | ||
| 1632 | # print("files_LSU,save,prog_labels_aref:@labels\n"); | ||
| 1633 | # print("files_LSU,save,version:$version\n"); | ||
| 1634 | |||
| 1635 | $oop_text->set_prog_version($version); | ||
| 1636 | $oop_text->set_prog_param_values_aref( \@values ); | ||
| 1637 | $oop_text->set_prog_param_labels_aref( \@labels ); | ||
| 1638 | |||
| 1639 | # printing to executable file | ||
| 1640 | $oop_text->get_program_params(); | ||
| 1641 | |||
| 1642 | } | ||
| 1643 | |||
| 1644 | $oop_text->get_pod_flows(); | ||
| 1645 | $oop_text->get_define_flows(); | ||
| 1646 | |||
| 1647 | $oop_text->get_pod_run_flows(); | ||
| 1648 | $oop_text->get_run_flows(); | ||
| 1649 | |||
| 1650 | $oop_text->get_pod_log_flows(); | ||
| 1651 | $oop_text->get_print_flows(); | ||
| 1652 | $oop_text->get_log_flows(); | ||
| 1653 | |||
| 1654 | # insert a macro end here | ||
| 1655 | # $oop_text->set_macro_tail() | ||
| 1656 | |||
| 1657 | _close(); | ||
| 1658 | } | ||
| 1659 | |||
| 1660 | 1; |