« lib/App/SeismicUnixGui/developer/code/sunix/sunix_package.pm
↑ Summary
lib/App/SeismicUnixGui/big_streams/iBottomMutePicks2par.pm »
| 1 | package App::SeismicUnixGui::developer::code::sunix::sunix_spec; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants'; | ||
| 6 | use aliased 'App::SeismicUnixGui::misc::dirs'; | ||
| 7 | |||
| 8 | my $get = L_SU_global_constants->new(); | ||
| 9 | my $dirs = dirs->new(); | ||
| 10 | my $flow_type = $get->flow_type_href(); | ||
| 11 | |||
| 12 | =head2 initialize shared anonymous hash | ||
| 13 | |||
| 14 | key/value pairs | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | my $sunix_spec = { | ||
| 19 | _config_file_out => '', | ||
| 20 | _spec_file_out => '', | ||
| 21 | _file_in => '', | ||
| 22 | _file_out => '', | ||
| 23 | _length => '', | ||
| 24 | _package_name => '', | ||
| 25 | _path_out4specs => '', | ||
| 26 | _num_lines => '', | ||
| 27 | _path_out => '', | ||
| 28 | _sudoc => '', | ||
| 29 | _outbound_pm => '', | ||
| 30 | }; | ||
| 31 | |||
| 32 | =head2 sub _get_Moose_section | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | sub _get_Moose_section { | ||
| 37 | my ($self) = @_; | ||
| 38 | my @head; | ||
| 39 | $head[0] = ("use Moose;\n"); | ||
| 40 | |||
| 41 | |||
| 42 | =head2 sub _get_declare_section | ||
| 43 | |||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | sub _get_declare_section { | ||
| 48 | my ($self) = @_; | ||
| 49 | my @declare; | ||
| 50 | my $name = $sunix_spec->{_package_name}; | ||
| 51 | |||
| 52 | $declare[0] = "\n".'my $var = $get->var();'."\n\n". | ||
| 53 | 'my $empty_string = $var->{_empty_string};'."\n". | ||
| 54 | 'my $true = $var->{_true};'."\n". | ||
| 55 | 'my $false = $var->{_false};'."\n". | ||
| 56 | 'my $file_dialog_type = $get->file_dialog_type_href();'."\n". | ||
| 57 | 'my $flow_type = $get->flow_type_href();'."\n"; | ||
| 58 | |||
| 59 | return (\@declare); | ||
| 60 | |||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | =head2 sub _get_instantiation_section | ||
| 65 | |||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | sub _get_instantiation_section { | ||
| 70 | my ($self) = @_; | ||
| 71 | my @instantiate; | ||
| 72 | my $package_name = $sunix_spec->{_package_name}; | ||
| 73 | |||
| 74 | $instantiate[0] = "\n".'use aliased \'App::SeismicUnixGui::configs::big_streams::Project_config\';'."\n". | ||
| 75 | 'use App::SeismicUnixGui::misc::SeismicUnix qw($bin $ps $segy $su $suffix_bin $suffix_ps $suffix_segy $suffix_su $suffix_txt $txt);' . "\n". | ||
| 76 | 'use aliased \'App::SeismicUnixGui::misc::L_SU_global_constants\';'."\n". | ||
| 77 | "\n". | ||
| 78 | 'my $get = L_SU_global_constants->new();'."\n". | ||
| 79 | 'my $Project = Project_config->new();'."\n". | ||
| 80 | "\n"; | ||
| 81 | |||
| 82 | return (\@instantiate); | ||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | =head2 sub _get_package_section | ||
| 87 | |||
| 88 | a small section of the file | ||
| 89 | print ("sunix_package_header,section:name $name\n"); | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | sub _get_package_section { | ||
| 94 | my ($self) = @_; | ||
| 95 | my @head; | ||
| 96 | my $name = $sunix_spec->{_package_name}; | ||
| 97 | my $path_out4specs = $sunix_spec->{_path_out4specs}; | ||
| 98 | |||
| 99 | my $path4SeismicUnixGui = $dirs->get_path4SeismicUnixGui(); | ||
| 100 | # print("sunix_spec,_get_package_section,$path4SeismicUnixGui\n"); | ||
| 101 | |||
| 102 | $path_out4specs =~ s/$path4SeismicUnixGui//g; | ||
| 103 | $path_out4specs =~ s/\//::/g; | ||
| 104 | |||
| 105 | my $colon_path2module_spec = 'App::SeismicUnixGui' .$path_out4specs; | ||
| 106 | |||
| 107 | if($name) { | ||
| 108 | |||
| 109 | $head[0] = 'package '.$colon_path2module_spec.'::'.$name.'_spec;'."\n"; | ||
| 110 | # print("sunix_spec,_get_package_section,$head[0] \n"); | ||
| 111 | |||
| 112 | return (\@head); | ||
| 113 | |||
| 114 | } else { | ||
| 115 | print ("sunix_spec, get_package_section, package name missing"); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 119 | return (\@head); | ||
| 120 | } | ||
| 121 | |||
| 122 | |||
| 123 | =head2 sub _get_version_section | ||
| 124 | |||
| 125 | =cut | ||
| 126 | |||
| 127 | sub _get_version_section { | ||
| 128 | my ($self) = @_; | ||
| 129 | my @head; | ||
| 130 | $head[0] = ("our \$VERSION = '0.0.1';\n"); | ||
| 131 | |||
| 132 | return (\@head); | ||
| 133 | } | ||
| 134 | |||
| 135 | |||
| 136 | =head2 sub _sub_binding_index_aref | ||
| 137 | |||
| 138 | =cut | ||
| 139 | |||
| 140 | sub _sub_binding_index_aref { | ||
| 141 | my ($self) = @_; | ||
| 142 | |||
| 143 | my @section; | ||
| 144 | my $package_name = $sunix_spec->{_package_name}; | ||
| 145 | |||
| 146 | $section[0] = '=head2 sub binding_index_aref'."\n\n". | ||
| 147 | '=cut'."\n\n". | ||
| 148 | ' sub binding_index_aref {'."\n\n". | ||
| 149 | "\t".'my $self = @_;'."\n\n". | ||
| 150 | "\t".'my @index;'."\n\n". | ||
| 151 | "\t".'# e.g., first binding index (index=0)'."\n". | ||
| 152 | "\t".'# connects to third item (index=2)'."\n". | ||
| 153 | "\t".'# in the parameter list'."\n". | ||
| 154 | "#\t".'$index[0] = 1; # inbound item is bound '."\n". | ||
| 155 | "#\t".'$index[1] = 2; # inbound item is bound'."\n". | ||
| 156 | "#\t".'$index[2] = 8; # outbound item is bound'."\n\n". | ||
| 157 | "\t".'$'.$package_name.'_spec ->{_binding_index_aref} = \@index;'."\n". | ||
| 158 | "\t".'return();'."\n\n". | ||
| 159 | ' }'."\n\n\n"; | ||
| 160 | |||
| 161 | return(\@section); | ||
| 162 | |||
| 163 | } | ||
| 164 | |||
| 165 | |||
| 166 | =head2 sub _sub_file_dialog_type_aref | ||
| 167 | |||
| 168 | =cut | ||
| 169 | |||
| 170 | sub _sub_file_dialog_type_aref { | ||
| 171 | my ($self) = @_; | ||
| 172 | |||
| 173 | my @section; | ||
| 174 | my $package_name = $sunix_spec->{_package_name}; | ||
| 175 | |||
| 176 | $section[0] = '=head2 sub file_dialog_type_aref'."\n\n". | ||
| 177 | 'type of dialog (Data, Flow, SaveAs) is needed by binding'."\n". | ||
| 178 | 'one type of dialog for each index'."\n". | ||
| 179 | '=cut'."\n\n". | ||
| 180 | ' sub file_dialog_type_aref {'."\n\n". | ||
| 181 | "\t".'my $self = @_;'."\n\n". | ||
| 182 | "\t".'my @type;'."\n\n". | ||
| 183 | "\t".'my $index_aref = get_binding_index_aref();'."\n". | ||
| 184 | "\t".'my @index = @$index_aref;'."\n\n". | ||
| 185 | "\t".'# bound index will look for data'."\n". | ||
| 186 | "\t".'$type[0] = \'\';'."\n". | ||
| 187 | "#\t".'$type[$index[0]] = $file_dialog_type->{_Data};'."\n". | ||
| 188 | "#\t".'$type[$index[1]] = $file_dialog_type->{_Data};'."\n". | ||
| 189 | "#\t".'$type[$index[2]] = $file_dialog_type->{_Data};'."\n\n". | ||
| 190 | "\t".'$'.$package_name.'_spec ->{_file_dialog_type_aref} = \@type;'."\n". | ||
| 191 | "\t".'return();'."\n\n". | ||
| 192 | ' }'."\n\n\n"; | ||
| 193 | |||
| 194 | return(\@section); | ||
| 195 | |||
| 196 | } | ||
| 197 | |||
| 198 | |||
| 199 | =head2 sub _sub_flow_type_aref | ||
| 200 | |||
| 201 | =cut | ||
| 202 | |||
| 203 | sub _sub_flow_type_aref { | ||
| 204 | my ($self) = @_; | ||
| 205 | |||
| 206 | my @section; | ||
| 207 | my $package_name = $sunix_spec->{_package_name}; | ||
| 208 | |||
| 209 | $section[0] = '=head2 sub flow_type_aref'."\n\n". | ||
| 210 | '=cut'."\n\n". | ||
| 211 | ' sub flow_type_aref {'."\n\n". | ||
| 212 | "\t".'my $self = @_;'."\n\n". | ||
| 213 | "\t".'my @type;'."\n\n". | ||
| 214 | "\t".'$type[0] = $flow_type->{_user_built};'."\n\n". | ||
| 215 | "\t".'$'.$package_name.'_spec ->{_flow_type_aref} = \@type;'."\n". | ||
| 216 | "\t".'return();'."\n\n". | ||
| 217 | ' }'."\n\n\n"; | ||
| 218 | |||
| 219 | return(\@section); | ||
| 220 | |||
| 221 | } | ||
| 222 | |||
| 223 | |||
| 224 | =head2 sub _sub_get_binding_length | ||
| 225 | |||
| 226 | =cut | ||
| 227 | |||
| 228 | sub _sub_get_binding_length { | ||
| 229 | my ($self) = @_; | ||
| 230 | |||
| 231 | my @section; | ||
| 232 | my $package_name = $sunix_spec->{_package_name}; | ||
| 233 | |||
| 234 | $section[0] = '=head2 sub get_binding_length'."\n\n". | ||
| 235 | '=cut'."\n\n". | ||
| 236 | ' sub get_binding_length{'."\n\n". | ||
| 237 | "\t".'my $self = @_;'."\n\n". | ||
| 238 | "\t".'if ($'.$package_name.'_spec->{_binding_index_aref} ) {'."\n\n". | ||
| 239 | "\t\t".'my $binding_length= scalar @{$'.$package_name.'_spec->{_binding_index_aref}};'."\n". | ||
| 240 | "\t\t".'return($binding_length);'."\n\n". | ||
| 241 | "\t".'} else {'."\n". | ||
| 242 | "\t\t".'print("'.$package_name.'_spec, get_binding_length, missing binding_length\n");'."\n". | ||
| 243 | "\t\t".'return();'."\n". | ||
| 244 | "\t".'}'."\n\n". | ||
| 245 | "\t".'return();'."\n". | ||
| 246 | ' }'."\n\n\n"; | ||
| 247 | |||
| 248 | return(\@section); | ||
| 249 | |||
| 250 | } | ||
| 251 | |||
| 252 | |||
| 253 | =head2 sub _sub_get_file_dialog_type_aref | ||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | sub _sub_get_file_dialog_type_aref { | ||
| 258 | my ($self) = @_; | ||
| 259 | |||
| 260 | my @section; | ||
| 261 | my $package_name = $sunix_spec->{_package_name}; | ||
| 262 | |||
| 263 | $section[0] = '=head2 sub get_file_dialog_type_aref'."\n\n". | ||
| 264 | '=cut'."\n\n". | ||
| 265 | ' sub get_file_dialog_type_aref{'."\n\n". | ||
| 266 | "\t".'my $self = @_;'."\n". | ||
| 267 | "\t".'if ($'.$package_name.'_spec->{_file_dialog_type_aref} ) {'."\n\n". | ||
| 268 | "\t\t".'my $index_aref = $'.$package_name.'_spec->{_file_dialog_type_aref};'."\n". | ||
| 269 | "\t\t".'return($index_aref);'."\n\n". | ||
| 270 | "\t".'} else {'."\n". | ||
| 271 | "\t\t".'print("'.$package_name.'_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");'."\n". | ||
| 272 | "\t\t".'return();'."\n". | ||
| 273 | "\t".'}'."\n\n". | ||
| 274 | "\t".'return();'."\n". | ||
| 275 | ' }'."\n\n\n"; | ||
| 276 | |||
| 277 | return(\@section); | ||
| 278 | |||
| 279 | } | ||
| 280 | |||
| 281 | |||
| 282 | =head2 sub sub_get_binding_index_aref | ||
| 283 | |||
| 284 | =cut | ||
| 285 | |||
| 286 | sub _sub_get_binding_index_aref { | ||
| 287 | my ($self) = @_; | ||
| 288 | |||
| 289 | my @section; | ||
| 290 | my $package_name = $sunix_spec->{_package_name}; | ||
| 291 | |||
| 292 | $section[0] = '=head2 sub get_binding_index_aref'."\n\n". | ||
| 293 | '=cut'."\n\n". | ||
| 294 | ' sub get_binding_index_aref{'."\n\n". | ||
| 295 | "\t".'my $self = @_;'."\n". | ||
| 296 | "\t".'my @index;'."\n\n". | ||
| 297 | "\t".'if ($'.$package_name.'_spec->{_binding_index_aref} ) {'."\n\n". | ||
| 298 | "\t\t".'my $index_aref = $'.$package_name.'_spec->{_binding_index_aref};'."\n". | ||
| 299 | "\t\t".'return($index_aref);'."\n\n". | ||
| 300 | "\t".'} else {'."\n". | ||
| 301 | "\t\t".'print("'.$package_name.'_spec, get_binding_index_aref, missing binding_index_aref\n");'."\n". | ||
| 302 | "\t\t".'return();'."\n". | ||
| 303 | "\t".'}'."\n\n". | ||
| 304 | "\t".'my $index_aref = $'.$package_name.'_spec->{_binding_index_aref};'."\n". | ||
| 305 | ' }'."\n\n\n"; | ||
| 306 | |||
| 307 | return(\@section); | ||
| 308 | |||
| 309 | } | ||
| 310 | |||
| 311 | |||
| 312 | sub _sub_get_flow_type_aref { | ||
| 313 | my ($self) = @_; | ||
| 314 | |||
| 315 | my @section; | ||
| 316 | my $package_name = $sunix_spec->{_package_name}; | ||
| 317 | |||
| 318 | $section[0] = '=head2 sub get_flow_type_aref'."\n\n". | ||
| 319 | '=cut'."\n\n". | ||
| 320 | ' sub get_flow_type_aref {'."\n\n". | ||
| 321 | "\t".'my $self = @_;'."\n\n". | ||
| 322 | "\t".'if ($'.$package_name.'_spec->{_flow_type_aref} ) {'."\n\n". | ||
| 323 | "\t\t".' my $index_aref = $'.$package_name.'_spec->{_flow_type_aref};'."\n". | ||
| 324 | "\t\t".' return($index_aref);'."\n\n". | ||
| 325 | "\t".'} else {'."\n". | ||
| 326 | "\t\t".'print("'.$package_name.'_spec, get_flow_type_aref, missing flow_type_aref\n");'."\n". | ||
| 327 | "\t\t".'return();'."\n". | ||
| 328 | "\t".'}'."\n\n". | ||
| 329 | ' }'."\n\n\n"; | ||
| 330 | |||
| 331 | return(\@section); | ||
| 332 | |||
| 333 | } | ||
| 334 | |||
| 335 | |||
| 336 | =head2 sub _sub_get_incompatibles | ||
| 337 | |||
| 338 | section for get_incompatibles | ||
| 339 | |||
| 340 | =cut | ||
| 341 | |||
| 342 | sub _sub_get_incompatibles { | ||
| 343 | my ($self) = @_; | ||
| 344 | |||
| 345 | my @section; | ||
| 346 | my $package_name = $sunix_spec->{_package_name}; | ||
| 347 | |||
| 348 | $section[0] = '=head2 sub get_incompatibles'."\n\n". | ||
| 349 | '=cut'."\n\n". | ||
| 350 | ' sub get_incompatibles{'."\n\n". | ||
| 351 | "\t".'my $self = @_;'."\n". | ||
| 352 | "\t".'my @needed;'."\n\n". | ||
| 353 | "\t".'my @_need_both;'."\n\n". | ||
| 354 | "\t".'my @_need_only_1;'."\n\n". | ||
| 355 | "\t".'my @_none_needed;'."\n\n". | ||
| 356 | "\t".'my @_all_needed;'."\n\n". | ||
| 357 | "\t".'my $params = {'."\n\n". | ||
| 358 | "\t\t".'_need_both'."\t\t\t".'=> \@_need_both,'."\n". | ||
| 359 | "\t\t".'_need_only_1'."\t\t".'=> \@_need_only_1,'."\n". | ||
| 360 | "\t\t".'_none_needed'."\t\t".'=> \@_none_needed,'."\n". | ||
| 361 | "\t\t".'_all_needed'."\t\t\t".'=> \@_all_needed,'."\n\n". | ||
| 362 | "\t".'};'."\n\n". | ||
| 363 | "\t".'my @of_two'."\t\t\t\t\t".'= (\'xx\',\'yy\');'."\n". | ||
| 364 | "\t".'push @{$params->{_need_only_1}} , \@of_two;'."\n\n". | ||
| 365 | "\t".'my $len_1_needed'."\t\t\t".'= scalar @{$params->{_need_only_1}};'."\n\n". | ||
| 366 | "\t".'if ($len_1_needed >= 1) {'."\n\n". | ||
| 367 | "\t\t".'for (my $i=0; $i < $len_1_needed; $i++) {'."\n\n". | ||
| 368 | "\t\t\t".'print("'.$package_name.', get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");'."\n\n". | ||
| 369 | "\t\t".'}'."\n\n". | ||
| 370 | "\t".'} else {'."\n". | ||
| 371 | "\t\t".'print("get_incompatibles, no incompatibles\n")'."\n". | ||
| 372 | "\t".'}'."\n\n". | ||
| 373 | "\t".'return($params);'."\n\n". | ||
| 374 | ' }'."\n\n\n"; | ||
| 375 | |||
| 376 | return(\@section); | ||
| 377 | |||
| 378 | } | ||
| 379 | |||
| 380 | |||
| 381 | =head2 sub _sub_get_prefix_aref | ||
| 382 | |||
| 383 | =cut | ||
| 384 | |||
| 385 | sub _sub_get_prefix_aref { | ||
| 386 | my ($self) = @_; | ||
| 387 | |||
| 388 | my @section; | ||
| 389 | my $package_name = $sunix_spec->{_package_name}; | ||
| 390 | |||
| 391 | $section[0] = '=head2 sub get_prefix_aref'."\n\n". | ||
| 392 | '=cut'."\n\n". | ||
| 393 | ' sub get_prefix_aref {'."\n\n". | ||
| 394 | "\t".'my $self = @_;'."\n\n". | ||
| 395 | "\t".'if ($'.$package_name.'_spec->{_prefix_aref} ) {'."\n\n". | ||
| 396 | "\t\t".'my $prefix_aref= $'.$package_name.'_spec->{_prefix_aref};'."\n". | ||
| 397 | "\t\t".'return($prefix_aref);'."\n\n". | ||
| 398 | "\t".'} else {'."\n". | ||
| 399 | "\t\t".'print("'.$package_name.'_spec, get_prefix_aref, missing prefix_aref\n");'."\n". | ||
| 400 | "\t\t".'return();'."\n". | ||
| 401 | "\t".'}'."\n\n". | ||
| 402 | "\t".'return();'."\n". | ||
| 403 | ' }'."\n\n\n"; | ||
| 404 | |||
| 405 | return(\@section); | ||
| 406 | |||
| 407 | } | ||
| 408 | |||
| 409 | |||
| 410 | =head2 sub _sub_get_suffix_aref | ||
| 411 | |||
| 412 | =cut | ||
| 413 | |||
| 414 | sub _sub_get_suffix_aref { | ||
| 415 | my ($self) = @_; | ||
| 416 | |||
| 417 | my @section; | ||
| 418 | my $package_name = $sunix_spec->{_package_name}; | ||
| 419 | |||
| 420 | $section[0] = '=head2 sub get_suffix_aref'."\n\n". | ||
| 421 | '=cut'."\n". | ||
| 422 | "\n". | ||
| 423 | ' sub get_suffix_aref {'."\n\n". | ||
| 424 | "\t".'my $self = @_;'."\n". | ||
| 425 | "\n". | ||
| 426 | "\t".'if ($'.$package_name.'_spec->{_suffix_aref} ) {'."\n". | ||
| 427 | "\n". | ||
| 428 | "\t\t".' my $suffix_aref= $'.$package_name.'_spec->{_suffix_aref};'."\n". | ||
| 429 | "\t\t".' return($suffix_aref);'."\n". | ||
| 430 | "\n". | ||
| 431 | "\t".'} else {'."\n". | ||
| 432 | "\t\t".' print("$'.$package_name.'_spec, get_suffix_aref, missing suffix_aref\n");'."\n". | ||
| 433 | "\t\t".' return();'."\n". | ||
| 434 | "\t".'}'."\n". | ||
| 435 | "\n". | ||
| 436 | "\t".'return();'."\n". | ||
| 437 | ' }'."\n\n\n"; | ||
| 438 | |||
| 439 | return(\@section); | ||
| 440 | } | ||
| 441 | |||
| 442 | =head2 sub _sub_prefix_aref | ||
| 443 | |||
| 444 | =cut | ||
| 445 | |||
| 446 | sub _sub_prefix_aref{ | ||
| 447 | my ($self) = @_; | ||
| 448 | |||
| 449 | my @section; | ||
| 450 | my $package_name = $sunix_spec->{_package_name}; | ||
| 451 | |||
| 452 | $section[0] = '=head2 sub prefix_aref'."\n\n". | ||
| 453 | 'Include in the Set up'."\n". | ||
| 454 | 'sections of an output Poop flow.'."\n\n". | ||
| 455 | 'prefixes and suffixes to parameter labels'."\n". | ||
| 456 | 'are filtered by sunix_pl'."\n\n". | ||
| 457 | '=cut'."\n\n". | ||
| 458 | ' sub prefix_aref {'."\n\n". | ||
| 459 | "\t".'my $self = @_;'."\n\n". | ||
| 460 | "\t".'my @prefix;'."\n\n". | ||
| 461 | "\t".'for (my $i=0; $i < $max_index; $i++) {'."\n\n". | ||
| 462 | "\t\t".'$prefix[$i] = $empty_string;'."\n\n". | ||
| 463 | "\t".'}'."\n\n". | ||
| 464 | "#\t".'my $index_aref = get_binding_index_aref();'."\n". | ||
| 465 | "#\t".'my @index = @$index_aref;'."\n\n". | ||
| 466 | "\t".'# label 2 in GUI is input xx_file and needs a home directory'."\n". | ||
| 467 | "#\t".'$prefix[ $index[0] ] = \'$DATA_SEISMIC_BIN\' . ".\'/\'.";' ."\n\n". | ||
| 468 | "\t".'# label 3 in GUI is input yy_file and needs a home directory'."\n". | ||
| 469 | "#\t".'$prefix[ $index[1] ] = \'$DATA_SEISMIC_TXT\' . ".\'/\'.";' ."\n\n". | ||
| 470 | "\t".'# label 9 in GUI is input zz_file and needs a home directory'."\n". | ||
| 471 | "#\t".'$prefix[ $index[2] ] = \'$DATA_SEISMIC_SU\' . ".\'/\'.";' ."\n\n". | ||
| 472 | "\t".'$'.$package_name.'_spec ->{_prefix_aref} = \@prefix;'."\n". | ||
| 473 | "\t".'return();'."\n\n". | ||
| 474 | ' }'."\n\n\n"; | ||
| 475 | |||
| 476 | return(\@section); | ||
| 477 | |||
| 478 | } | ||
| 479 | |||
| 480 | |||
| 481 | =head2 sub _sub_suffix_aref | ||
| 482 | |||
| 483 | For sub suffix_aref | ||
| 484 | |||
| 485 | =cut | ||
| 486 | |||
| 487 | sub _sub_suffix_aref{ | ||
| 488 | my ($self) = @_; | ||
| 489 | |||
| 490 | my @section; | ||
| 491 | my $package_name = $sunix_spec->{_package_name}; | ||
| 492 | |||
| 493 | $section[0] = '=head2 sub suffix_aref'."\n\n". | ||
| 494 | 'Initialize suffixes as empty'."\n". | ||
| 495 | 'values'."\n\n". | ||
| 496 | '=cut'."\n\n". | ||
| 497 | ' sub suffix_aref {'."\n\n". | ||
| 498 | "\t".'my $self = @_;'."\n\n". | ||
| 499 | "\t".'my @suffix;'."\n\n". | ||
| 500 | "\t".'for (my $i=0; $i < $max_index; $i++) {'."\n\n". | ||
| 501 | "\t\t".'$suffix[$i] = $empty_string;'."\n\n". | ||
| 502 | "\t".'}'."\n\n". | ||
| 503 | "#\t".'my $index_aref = get_binding_index_aref();'."\n". | ||
| 504 | "#\t".'my @index = @$index_aref;'."\n\n". | ||
| 505 | "\t".'# label 2 in GUI is input xx_file and needs a home directory'."\n". | ||
| 506 | "#\t".'$suffix[ $index[0] ] = \'\'.\'\' . \'$suffix_bin\';'."\n\n". | ||
| 507 | "\t".'# label 3 in GUI is input yy_file and needs a home directory'."\n". | ||
| 508 | "#\t".'$suffix[ $index[1] ] = \'\'.\'\' . \'$suffix_bin\';'."\n\n". | ||
| 509 | "\t".'# label 9 in GUI is output zz_file and needs a home directory'."\n". | ||
| 510 | "#\t".'$suffix[ $index[2] ] = \'\'.\'\' . \'$suffix_su\';'."\n\n". | ||
| 511 | "\t".'$'.$package_name.'_spec ->{_suffix_aref} = \@suffix;'."\n". | ||
| 512 | "\t".'return();'."\n\n". | ||
| 513 | ' }'."\n\n\n"; | ||
| 514 | |||
| 515 | return(\@section); | ||
| 516 | |||
| 517 | } | ||
| 518 | |||
| 519 | =head2 sub file_dialog_type_aref | ||
| 520 | |||
| 521 | =cut | ||
| 522 | |||
| 523 | sub file_dialog_type_aref{ | ||
| 524 | my ($self) = @_; | ||
| 525 | |||
| 526 | my @type; | ||
| 527 | |||
| 528 | $type[0]= ''; | ||
| 529 | |||
| 530 | $sunix_spec->{_file_dialog_type_aref} = \@type; | ||
| 531 | |||
| 532 | return(); | ||
| 533 | |||
| 534 | } | ||
| 535 | |||
| 536 | |||
| 537 | =head2 sub get_max_index | ||
| 538 | |||
| 539 | =cut | ||
| 540 | |||
| 541 | sub get_max_index { | ||
| 542 | my $self = @_; | ||
| 543 | |||
| 544 | if ( $sunix_spec->{_max_index} ) { | ||
| 545 | |||
| 546 | my $max_idx = $sunix_spec->{_max_index}; | ||
| 547 | return($max_idx); | ||
| 548 | |||
| 549 | } else { | ||
| 550 | print("sunix_spec, get_max_index, missing max_index\n"); | ||
| 551 | return(); | ||
| 552 | } | ||
| 553 | } | ||
| 554 | |||
| 555 | |||
| 556 | =head2 sub get_file_dialog_type_aref | ||
| 557 | |||
| 558 | =cut | ||
| 559 | |||
| 560 | sub get_file_dialog_type_aref { | ||
| 561 | my ($self) = @_; | ||
| 562 | |||
| 563 | if ( $sunix_spec->{_file_dialog_type_aref}) { | ||
| 564 | my @type = @{$sunix_spec->{_file_dialog_type_aref}}; | ||
| 565 | return(\@type); | ||
| 566 | } else { | ||
| 567 | print("sunix_spec,get_file_dialog_type_aref, missing file_dialog_type_aref\n"); | ||
| 568 | return(); | ||
| 569 | } | ||
| 570 | } | ||
| 571 | |||
| 572 | =head2 sub flow_type_aref | ||
| 573 | |||
| 574 | =cut | ||
| 575 | |||
| 576 | sub flow_type_aref{ | ||
| 577 | my ($self) = @_; | ||
| 578 | |||
| 579 | my @type; | ||
| 580 | |||
| 581 | $type[0] = $flow_type->{_user_built}; | ||
| 582 | |||
| 583 | $sunix_spec ->{_flow_type_aref} = \@type; | ||
| 584 | |||
| 585 | return(); | ||
| 586 | |||
| 587 | } | ||
| 588 | |||
| 589 | =head2 sub get_flow_type_aref | ||
| 590 | |||
| 591 | =cut | ||
| 592 | |||
| 593 | sub get_flow_type_aref{ | ||
| 594 | my ($self) = @_; | ||
| 595 | |||
| 596 | if ( $sunix_spec->{_flow_type_aref} ) { | ||
| 597 | my $type_aref = $sunix_spec->{_flow_type_aref}; | ||
| 598 | return($type_aref); | ||
| 599 | } else { | ||
| 600 | |||
| 601 | print("sunix_spec, get_flow_type_aref, missing flow_type_aref \n"); | ||
| 602 | return(); | ||
| 603 | } | ||
| 604 | } | ||
| 605 | |||
| 606 | # | ||
| 607 | #=head2 sub variables | ||
| 608 | # | ||
| 609 | # return a hash array | ||
| 610 | # with definitions | ||
| 611 | # | ||
| 612 | #=cut | ||
| 613 | # | ||
| 614 | #sub variables { | ||
| 615 | # my ($self) = @_; | ||
| 616 | # my $hash_ref = $sunix_spec; | ||
| 617 | # return ($hash_ref); | ||
| 618 | #} | ||
| 619 | |||
| 620 | |||
| 621 | # my @file_dialog = @{_sub_file_dialog_type_aref()}; | ||
| 622 | # my @get_max_index = @{_sub_get_max_index()}; | ||
| 623 | # my @get_file_dialog = @{_sub_get_file_dialog_type_aref()}; | ||
| 624 | # my @flow_type = @{_sub_flow_type_aref()}; | ||
| 625 | # my @get_flow_type = @{_sub_get_flow_type_aref()}; | ||
| 626 | # my @get_binding_length = @{_subget_binding_length()}; | ||
| 627 | # my @variables = @{_sub_variables()}; | ||
| 628 | |||
| 629 | |||
| 630 | =head2 sub get_body_section | ||
| 631 | |||
| 632 | a small section of the file | ||
| 633 | print ("sunix_package_header,section:name $name\n"); | ||
| 634 | |||
| 635 | =cut | ||
| 636 | |||
| 637 | sub get_body_section { | ||
| 638 | my ($self) = @_; | ||
| 639 | my @head; | ||
| 640 | my $package_name; | ||
| 641 | $package_name = $sunix_spec->{_package_name}; | ||
| 642 | |||
| 643 | $head[0] = ' my $'.$package_name.'_spec'.' = {'."\n"; | ||
| 644 | $head[1] = ' _CONFIG => $PL_SEISMIC,'."\n"; | ||
| 645 | $head[2] = ' _DATA_DIR_IN => $DATA_SEISMIC_BIN,'."\n"; | ||
| 646 | $head[3] = ' _DATA_DIR_OUT => $DATA_SEISMIC_SU,'."\n"; | ||
| 647 | $head[4] = ' _binding_index_aref => \'\','."\n"; | ||
| 648 | $head[5] = ' _suffix_type_in => $su,'."\n"; | ||
| 649 | $head[6] = ' _data_suffix_in => $suffix_su,'."\n"; | ||
| 650 | $head[7] = ' _suffix_type_out => $su,'."\n"; | ||
| 651 | $head[8] = ' _data_suffix_out => $suffix_su,'."\n"; | ||
| 652 | $head[9] = ' _file_dialog_type_aref => \'\','."\n"; | ||
| 653 | $head[10] = ' _flow_type_aref => \'\','."\n"; | ||
| 654 | $head[11] = ' _has_infile => $true,'."\n"; | ||
| 655 | $head[12] = ' _has_outpar => $false,'."\n"; | ||
| 656 | $head[13] = ' _has_pipe_in => $true, '."\n"; | ||
| 657 | $head[14] = ' _has_pipe_out => $true,'."\n"; | ||
| 658 | $head[15] = ' _has_redirect_in => $true,'."\n"; | ||
| 659 | $head[16] = ' _has_redirect_out => $true,'."\n"; | ||
| 660 | $head[17] = ' _has_subin_in => $false,'."\n"; | ||
| 661 | $head[18] = ' _has_subin_out => $false,'."\n"; | ||
| 662 | $head[19] = ' _is_data => $false,'."\n"; | ||
| 663 | $head[20] = ' _is_first_of_2 => $true,'."\n"; | ||
| 664 | $head[21] = ' _is_first_of_3or_more => $true,'."\n"; | ||
| 665 | $head[22] = ' _is_first_of_4or_more => $true,'."\n"; | ||
| 666 | $head[23] = ' _is_last_of_2 => $false,'."\n"; | ||
| 667 | $head[24] = ' _is_last_of_3or_more => $false,'."\n"; | ||
| 668 | $head[25] = ' _is_last_of_4or_more => $false,'."\n"; | ||
| 669 | $head[26] = ' _is_suprog => $true,'."\n"; | ||
| 670 | $head[27] = ' _is_superflow => $false,'."\n"; | ||
| 671 | $head[28] = ' _max_index => $max_index,'."\n"; | ||
| 672 | $head[29] = ' _prefix_aref => \'\','."\n"; | ||
| 673 | $head[30] = ' _suffix_aref => \'\','."\n"; | ||
| 674 | $head[31] = ' };'."\n"; | ||
| 675 | $head[32] = ''."\n\n"; | ||
| 676 | |||
| 677 | my $incompatibles = { | ||
| 678 | _clip => ['mbal', 'pbal'], | ||
| 679 | }; | ||
| 680 | |||
| 681 | |||
| 682 | # print ("sunix_spec, get_body_section:\n @head\n"); | ||
| 683 | return (\@head); | ||
| 684 | } | ||
| 685 | |||
| 686 | |||
| 687 | =head2 sub get_header_section | ||
| 688 | |||
| 689 | a small section of the file | ||
| 690 | print ("sunix_package_header,section:name $name\n"); | ||
| 691 | |||
| 692 | =cut | ||
| 693 | |||
| 694 | sub get_header_section { | ||
| 695 | my ($self,$name) = @_; | ||
| 696 | my @head; | ||
| 697 | |||
| 698 | my $package_name; | ||
| 699 | $package_name = $sunix_spec->{_package_name} ; | ||
| 700 | my @package = @{_get_package_section()}; | ||
| 701 | my @Moose = @{_get_Moose_section()}; | ||
| 702 | my @version = @{_get_version_section()}; | ||
| 703 | my @instantiate = @{_get_instantiation_section()}; | ||
| 704 | my @declare = @{_get_declare_section()}; | ||
| 705 | |||
| 706 | $head[0] = $package[0]; | ||
| 707 | $head[1] = $Moose[0]; | ||
| 708 | $head[2] = $version[0]; | ||
| 709 | $head[3] = $instantiate[0]; | ||
| 710 | $head[4] = $declare[0]; | ||
| 711 | $head[5] = ''."\n"; | ||
| 712 | $head[6] = 'my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();'."\n"; | ||
| 713 | $head[7] = 'my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY();'."\n"; | ||
| 714 | $head[8] = 'my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory'."\n"; | ||
| 715 | $head[9] = 'my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory'."\n"; | ||
| 716 | $head[10] = 'my $PL_SEISMIC = $Project->PL_SEISMIC();'."\n"; | ||
| 717 | $head[11] = 'my $PS_SEISMIC = $Project->PS_SEISMIC();'."\n"; | ||
| 718 | $head[12] = 'my $max_index = # Insert a number here'."\n"; | ||
| 719 | #$'.$package_name.'->get_max_index();'."\n"; 7.14.21 | ||
| 720 | $head[13] = ''."\n"; | ||
| 721 | $head[14] = ''."\n"; | ||
| 722 | |||
| 723 | # print ("sunix_spec, get_header_section:\n @head\n"); | ||
| 724 | return (\@head); | ||
| 725 | } | ||
| 726 | |||
| 727 | |||
| 728 | =head2 sub get_subroutine_section | ||
| 729 | |||
| 730 | |||
| 731 | =cut | ||
| 732 | |||
| 733 | sub get_subroutine_section { | ||
| 734 | my ($self,$name) = @_; | ||
| 735 | my @head; | ||
| 736 | |||
| 737 | my $package_name; | ||
| 738 | $package_name = $sunix_spec->{_package_name} ; | ||
| 739 | |||
| 740 | my @binding = @{_sub_binding_index_aref()}; | ||
| 741 | my @file_dialog = @{_sub_file_dialog_type_aref()}; | ||
| 742 | my @flow_type = @{_sub_flow_type_aref()}; | ||
| 743 | my @get_binding = @{_sub_get_binding_index_aref()}; | ||
| 744 | my @get_binding_length = @{_sub_get_binding_length()}; | ||
| 745 | my @get_file_dialog = @{_sub_get_file_dialog_type_aref()}; | ||
| 746 | my @get_flow_type = @{_sub_get_flow_type_aref()}; | ||
| 747 | my @get_incompatibles = @{_sub_get_incompatibles()}; | ||
| 748 | my @get_prefix = @{_sub_get_prefix_aref()}; | ||
| 749 | my @get_suffix = @{_sub_get_suffix_aref()}; | ||
| 750 | my @prefix = @{_sub_prefix_aref()}; | ||
| 751 | my @suffix = @{_sub_suffix_aref()}; | ||
| 752 | # my @get_max_index = @{_sub_get_max_index()}; | ||
| 753 | # my @variables = @{_sub_variables()}; | ||
| 754 | |||
| 755 | $head[0] = $binding[0]; | ||
| 756 | $head[1] = $file_dialog[0]; | ||
| 757 | $head[2] = $flow_type[0]; | ||
| 758 | $head[3] = $get_binding[0]; | ||
| 759 | $head[4] = $get_binding_length[0]; | ||
| 760 | $head[5] = $get_file_dialog[0]; | ||
| 761 | $head[6] = $get_flow_type[0]; | ||
| 762 | $head[7] = $get_incompatibles[0]; | ||
| 763 | $head[8] = $get_prefix[0]; | ||
| 764 | $head[9] = $get_suffix[0]; | ||
| 765 | $head[10] = $prefix[0]; | ||
| 766 | $head[11] = $suffix[0]; | ||
| 767 | # $head[3] = $get_max_index[0]; | ||
| 768 | # $head[5] = $flow_type[0]; | ||
| 769 | # $head[8] = $variables[0]; | ||
| 770 | # print ("sunix_spec, get_subroutine_section:\n @head\n"); | ||
| 771 | |||
| 772 | return (\@head); | ||
| 773 | |||
| 774 | } | ||
| 775 | |||
| 776 | |||
| 777 | =head2 sub set_package_name | ||
| 778 | |||
| 779 | a small section of the file | ||
| 780 | |||
| 781 | =cut | ||
| 782 | |||
| 783 | |||
| 784 | sub set_package_name { | ||
| 785 | my ($self,$package_name) = @_; | ||
| 786 | if($package_name) { | ||
| 787 | $sunix_spec->{_package_name} = $package_name; | ||
| 788 | # print ("sunix_spec,set_package_name,name: $package_name\n"); | ||
| 789 | } else { | ||
| 790 | print ("sunix_spec, set_package_name, package name missing\n"); | ||
| 791 | } | ||
| 792 | |||
| 793 | } | ||
| 794 | |||
| 795 | |||
| 796 | =head2 sub get_tail_section | ||
| 797 | |||
| 798 | a small section of the file | ||
| 799 | |||
| 800 | =cut | ||
| 801 | |||
| 802 | sub get_tail_section { | ||
| 803 | my ($self) = @_; | ||
| 804 | my @head; | ||
| 805 | |||
| 806 | my $package_name; | ||
| 807 | $package_name = $sunix_spec->{_package_name} ; | ||
| 808 | |||
| 809 | $head[0] = '=head2 sub variables'."\n"; | ||
| 810 | $head[1] = ''."\n\n"; | ||
| 811 | $head[2] = 'return a hash array '."\n"; | ||
| 812 | $head[3] = 'with definitions'."\n"; | ||
| 813 | $head[4] = ' '."\n"; | ||
| 814 | $head[5] = '=cut'."\n"; | ||
| 815 | $head[6] = ' '."\n"; | ||
| 816 | $head[7] = 'sub variables {'."\n\n"; | ||
| 817 | $head[8] = "\t".'my ($self) = @_;'."\n"; | ||
| 818 | $head[9] = "\t".'my $hash_ref = $'.$package_name.'_spec;'."\n"; | ||
| 819 | $head[10] = "\t".'return ($hash_ref);'."\n"; | ||
| 820 | $head[11] = '}'."\n"; | ||
| 821 | $head[12] = ''."\n"; | ||
| 822 | $head[13] = '1;'."\n"; | ||
| 823 | # print ("sunix_spec, get_tail_section:\n @head\n"); | ||
| 824 | return (\@head); | ||
| 825 | } | ||
| 826 | |||
| 827 | =head2 sub set_path_out4specs | ||
| 828 | |||
| 829 | a small section of the file | ||
| 830 | |||
| 831 | =cut | ||
| 832 | |||
| 833 | sub set_path_out4specs { | ||
| 834 | |||
| 835 | my ($self,$slash_path) = @_; | ||
| 836 | |||
| 837 | if (length $slash_path) { | ||
| 838 | |||
| 839 | $sunix_spec->{_path_out4specs} = $slash_path; | ||
| 840 | # print("sunix_spec,set_path_out4specs, $slash_path\n"); | ||
| 841 | |||
| 842 | } else { | ||
| 843 | print("sunix_spec,set_path_out4specs,missing value\n"); | ||
| 844 | } | ||
| 845 | |||
| 846 | return(); | ||
| 847 | } | ||
| 848 | |||
| 849 | 1; |